XPX code style

Post Reply
Ernest
Posts: 2
Joined: Mon Jun 10, 2019 11:35 am

XPX code style

Post by Ernest »

Headers of function/query_function/procedure

Code: Select all

QUERY_FUNCTION req_create_requirement_breakdown(
      id,
      description     : STRING) 
                      : BreakdownInfo;
   LOCAL
      result          : BreakdownInfo;
      root_part       : plcs::representing_part;
      asg_id          : plcs::assigning_identification;
      asg_descr       : LIST OF plcs::assigning_descriptor;
      asg_time        : LIST OF plcs::assigning_time;
      asg_pers        : LIST OF plcs::assigning_person_in_organization;
      rep_bk_bag      : LIST OF plcs::representing_breakdown;
   END_LOCAL;
   ON_ERROR_DO terminate_service('req_get_main_breakdown_info'); END_ON_ERROR_DO;
   ...
Note the following:
  • input parameters inline (with the same indent) with local variables - to be easier observable by developer (especially by supporting side)
  • types of parameters and local variables are with the same indent - to be separated from var. names (the same reason as above)
  • one line - one parameter/variable declaration (to avoid long lines hiding under right side of editor window)
  • exception handler just after local variables declaration (in one line - to avoid wide gap between header and function body)
Post Reply