Is there any way to stop the diagram in the middle

0 votes
asked Jan 13, 2025 in Question / help by Vipin Kumar
Hi All,

I am writing a lot of procedures, almost each procedure calls another procedure, i am depicting the ctrl+c trap of a zsh in one of the procedure, if I invoke the trap procedure in between any procedure, it displays the correct activity output but still displays the remaining output after the invoke procedure, what I want to do is once the end is reached it should not show the remaining outputs. i tried adding @enduml in the procedure but it doesn't work. Below is my code, if I place the $proc_Trap_Ctrl_C in between of any other procedure it displays the output after the %invoke command.

@startuml Action Build Script

title Action Build Script

!theme spacelab

'Global Variables
!global $script_success = %false()
!global $build_log_file_exist = %false()
!global $code_error_file_exist = %false()
!global $temp_dir_exist = %false()

'Procedures
!procedure $proc_Trap_Ctrl_C()
  |proc_Trap_Ctrl_C|

  'Procedure Body
  !if ($build_log_file_exist == %true())
    :Add an Empty Line to the Build Log File;
    :Add a Ctrl+C Error Log to the Build Log File;
  !endif

  !if ($code_error_file_exist == %true())
    :Add a Ctrl+C Error Log to the Code Error File;
  !endif

  %invoke_procedure($proc_Trap_Exit)
!endprocedure

!procedure $proc_Trap_Terminal_Window()
  |proc_Trap_Terminal_Window|

  'Procedure Body
  !if ($build_log_file_exist == %true())
    :Add an Empty Line to the Build Log File;
    :Add a Terminal Window Error Log to the Build Log File;
  !endif

  !if ($code_error_file_exist == %true())
    :Add a Terminal Window Error Log to the Code Error File;
  !endif

  %invoke_procedure($proc_Trap_Exit)
!endprocedure

!procedure $proc_Trap_Exit()
  |proc_Trap_Exit|

  'Procedure Body
  !if ($script_success == %true())
    !if ($temp_dir_exist == %true())
      :Delete Temporary Directory;
    !endif
  !endif

  end
!endprocedure

!procedure $proc_Check_Code_Error_File ($calling_swimlane)
  |proc_Check_Code_Error_File|

  'Local Variables
  !local $code_error_file_empty = %true()
  !local $code_error = %false()
  !local $message_text = ""

  'Procedure Body
  !if ($code_error_file_exist == %true()) && ($code_error_file_empty == %true())
    !$code_error = %true()
    !$message_text = "The Code Error File Exists and contains the below error:\n\n[dd-mm-yyyy] [ERROR] - Error Log\n"
  !elseif ($code_error_file_exist == %true()) && ($code_error_file_empty == %false())
    !$code_error = %true()
    !$message_text = "The Code Error File Exists but is empty"
  !else
    !$code_error = %false()
  !endif

  !if ($code_error == %true())
    :{{\nsalt\nscale 1.25\nskinparam Backgroundcolor red\n{^"Message Dialog Box"\n$message_text\n[ OK ]}\n}};
    :Delete Temporary Directory;
    end
  !else
    #green:Code Error File does not exist;
  !endif

  |$calling_swimlane|
!endprocedure

!procedure $proc_Initial_Setup ($calling_swimlane)
  |proc_Initial_Setup|

  'Local Variables
  !local $temp_dir_created = %true()
  !local $code_error_file_created = %true()
  !local $code_error = %false()
  !local $message_text = ""

  'Procedure Body
  !if ($temp_dir_created == %true())
    !$temp_dir_exist = %true()
    :Temporary Directory Created;
    !if ($code_error_file_created == %true())
      !$code_error = %false()
      !$code_error_file_exist = %true()
      :Code Error File Created;
      :Clear the Screen;
      :Redirect Error to Code Error File;
    !else
      !$code_error = %true()
      !$message_text = "Code Error File could not be created"
    !endif
  !else
    !$code_error = %true()
    !$message_text = "Temporary Directory could not be created"
  !endif

  !if ($code_error == %true())
    :{{\nsalt\nscale 1.25\nskinparam Backgroundcolor red\n{^"Message Dialog Box"\n$message_text\n[ OK ]}\n}};
    !if ($temp_dir_exist == %true())
      :Delete Temporary Directory;
    !endif
    end
  !else
    #green:Initial Setup Completed;
    %invoke_procedure($proc_Load_Action_Build_Initial_Setup, "proc_Initial_Setup")
  !endif

  |$calling_swimlane|
!endprocedure

!procedure $proc_Load_Action_Build_Initial_Setup ($calling_swimlane)
  |proc_Load_Action_Build_Initial_Setup|

  'Procedure Body
  :{{\nsalt\nscale 1.25\nskinparam Backgroundcolor yellow\n{^"Gauge Dialog Box"\n~~\nLoading Action Build Initial Setup.....\n~~}\n}};

  %invoke_procedure($proc_Check_Required_Scripts, "proc_Load_Action_Build_Initial_Setup")

  |$calling_swimlane|
!endprocedure

!procedure $proc_Check_Required_Scripts ($calling_swimlane)
  |proc_Check_Required_Scripts|

  'Local Variables
  !local $required_scripts_exist = %true()
  !local $required_scripts_empty = %false()
  !local $required_scripts_error = %false()
  !local $script_name="Test.zsh"
  !local $message_text = ""

  'Procedure Body
  !$message_text = "Checking the Required Script: " + $script_name

  !$message_text = $message_text + "\nScript Exist? --> "

  !if ($required_scripts_exist == %true())
    !$message_text = $message_text + "YES"
    !$message_text = $message_text + "\nScript Empty? --> "
    !if ($required_scripts_empty == %false())
      !$message_text = $message_text + "NO"
    !else
      !$message_text = $message_text + "EMPTY!!!!!"
    !endif
  !else
    !$message_text = $message_text + "MISSING!!!!!"
  !endif

  :{{\nsalt\nscale 1.25\nskinparam Backgroundcolor yellow\n{^"Progress Dialog Box"\nChecking the Required Scripts\n$message_text}\n}};

  !if ($required_scripts_exist == %false())
    !$required_scripts_error = %true()
    !$message_text = "SCRIPT MISSING ERROR!!!!!\nThe Required Script: " + $script_name + " is missing"
  !elseif ($required_scripts_empty == %true())
    !$required_scripts_error = %true()
    !$message_text = "SCRIPT EMPTY ERROR!!!!!\nThe Required Script: " + $script_name + " is empty"
  !else
    !$required_scripts_error = %false()
    !$message_text = "The Required Scripts are present and sourced"
  !endif

  !if ($required_scripts_error == %true())
    :{{\nsalt\nscale 1.25\nskinparam Backgroundcolor red\n{^"Message Dialog Box"\n$message_text\n[ OK ]}\n}};
    !$script_success = %true()
    %invoke_procedure($proc_Trap_Exit)
  !else
    :Source the Required Scripts;
    :{{\nsalt\nscale 1.25\nskinparam Backgroundcolor green\n{^"Info Dialog Box"\n$message_text}\n}};
    %invoke_procedure($proc_Check_Build_Log, "proc_Check_Required_Scripts")
  !endif

  |$calling_swimlane|
!endprocedure

!procedure $proc_Check_Build_Log ($calling_swimlane)
  |proc_Check_Build_Log|

  'Local Variables

  'Procedure Body

  |$calling_swimlane|
!endprocedure

|Main Script|
start
:Define the Global Constants;

%invoke_procedure($proc_Check_Code_Error_File,"Main Script")

!if ($code_error_file_exist == %false())
  :Set Ctrl+C Trap;
  :Set Terminal Window Trap;
  :Set Exit Trap;
  :Set Exit on Error;

  %invoke_procedure($proc_Initial_Setup, "Main Script")
!endif

@enduml

Thanks in advance

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.
Anti-spam verification:

[Antispam2 Feature: please please wait 1 or 2 minutes (this message will disappear) before pressing the button otherwise it will fail](--------)
To avoid this verification in future, please log in or register.
...