?? RIGHT := 110 ??
?? NEWTITLE := 'NOS/VE:  Object Library Generator' ??
MODULE ocm$create_object_library;

{ PURPOSE:
{   To initiate execution of the object
{   library generation command.
{ DESIGN:
{   The CREATE_OBJECT_LIBRARY utility is initiated in this module.
{   The real work is done by the procedures called to process the subcommands.

?? NEWTITLE := 'Global Declarations Referenced by This Module', EJECT ??
?? PUSH (LISTEXT := ON) ??
*copyc clc$standard_file_names
*copyc cyd$run_time_error_condition
*copyc oce$library_generator_errors
*copyc oct$return_file_list
*copyc ost$status
?? POP ??
*copyc clp$begin_utility
*copyc clp$end_include
*copyc clp$end_utility
*copyc clp$evaluate_parameters
*copyc clp$include_file
*copyc ocp$initialize_oc_environment
*copyc ocp$close_all_open_files
*copyc ocp$return_files
*copyc ocv$nlm_list
*copyc ocv$open_file_list
*copyc osp$set_status_condition
*copyc pmp$continue_to_cause
*copyc osp$establish_block_exit_hndlr
*copyc osp$disestablish_cond_handler
?? OLDTITLE ??
?? NEWTITLE := 'Global Declarations Declared by This Module', EJECT ??

  VAR
    command_file: amt$local_file_name := clc$current_command_input,
    ocv$return_file_list: [XDCL, STATIC] ^oct$return_file_list := NIL,
    utility_name: string (31) := 'CREATE_OBJECT_LIBRARY          ',
    utility_attributes: array [1 .. 3] of clt$utility_attribute :=
          [[clc$utility_command_table, * ], [clc$utility_function_proc_table, * ], [clc$utility_prompt, [3,
          'COL']]];

{ table command_table type=command scope=local
{ command (add_module                     ,add_modules,  addm)          ..
{   ocp$_add_module call_method=xref
{ command (bind_module                    ,binm) ocp$_bind_module          ..
{   call_method=xref
{ command (change_command_description     ,change_command_descriptions,    ..
{       chacd) ocp$_change_command_description call_method=xref
{ command (change_function_description    ,change_function_descriptions,   ..
{       chafd) ocp$_change_function_descriptio call_method=xref
{ command (change_module_attribute        ,change_module_attributes,       ..
{       chama) ocp$_change_module_attribute call_method=xref
{ command (change_program_description     ,chapd)          ..
{   ocp$_change_program_description call_method=xref
{ command (combine_module                 ,combine_modules,  comm)         ..
{    ocp$_combine_module call_method=xref
{ command (create_command_description     ,crecd)          ..
{   ocp$_create_command_description call_method=xref
{ command (create_form_module             ,crefm) ocp$_create_form_module  ..
{           call_method=xref
{ command (create_function_description    ,crefd)          ..
{   ocp$_create_function_descriptio call_method=xref
{ command (create_linked_module           ,crelm) ocp$create_linked_module ..
{            call_method=proc
{ command (create_message_module          ,cremm)          ..
{   ocp$_create_message_module call_method=xref
{ command (create_module                  ,crem) ocp$_create_module        ..
{     call_method=xref
{ command (create_program_description     ,crepd)          ..
{   ocp$_create_program_description call_method=xref
{ command (delete_module                  ,delete_modules,  delm)          ..
{   ocp$_delete_module call_method=xref
{ command (display_new_library            ,disnl) ocp$_display_new_library ..
{            call_method=xref
{ command (generate_library               ,genl) ocp$generate          ..
{   call_method=xref
{ command (quit                           ,qui) ocp$_quit call_method=local
{ command (reorder_module                 ,reorder_modules,  reom)         ..
{    ocp$_reorder_module call_method=xref
{ command (replace_module                 ,replace_modules,  repm)         ..
{    ocp$_replace_module call_method=xref
{ command (satisfy_external_reference     ,satisfy_external_references,    ..
{          sater) ocp$_satisfy_external_reference call_method=xref
{ command (set_display_option             ,set_display_options,  setdo)    ..
{   ocp$_set_display_option                                       ..
{                call_method=xref
{ tablend

?? PUSH (LISTEXT := ON) ??

  VAR
    command_table: [STATIC, READ] ^clt$command_table := ^command_table_entries,

    command_table_entries: [STATIC, READ] array [1 .. 54] of clt$command_table_entry := [
          {} ['ADDM                           ', clc$abbreviation_entry, clc$normal_usage_entry, 1,
          clc$automatically_log, clc$linked_call, ^ocp$_add_module],
          {} ['ADD_MODULE                     ', clc$nominal_entry, clc$normal_usage_entry, 1,
          clc$automatically_log, clc$linked_call, ^ocp$_add_module],
          {} ['ADD_MODULES                    ', clc$alias_entry, clc$normal_usage_entry, 1,
          clc$automatically_log, clc$linked_call, ^ocp$_add_module],
          {} ['BIND_MODULE                    ', clc$nominal_entry, clc$normal_usage_entry, 2,
          clc$automatically_log, clc$linked_call, ^ocp$_bind_module],
          {} ['BINM                           ', clc$abbreviation_entry, clc$normal_usage_entry, 2,
          clc$automatically_log, clc$linked_call, ^ocp$_bind_module],
          {} ['CHACD                          ', clc$abbreviation_entry, clc$normal_usage_entry, 3,
          clc$automatically_log, clc$linked_call, ^ocp$_change_command_description],
          {} ['CHAFD                          ', clc$abbreviation_entry, clc$normal_usage_entry, 4,
          clc$automatically_log, clc$linked_call, ^ocp$_change_function_descriptio],
          {} ['CHAMA                          ', clc$abbreviation_entry, clc$normal_usage_entry, 5,
          clc$automatically_log, clc$linked_call, ^ocp$_change_module_attribute],
          {} ['CHANGE_COMMAND_DESCRIPTION     ', clc$nominal_entry, clc$normal_usage_entry, 3,
          clc$automatically_log, clc$linked_call, ^ocp$_change_command_description],
          {} ['CHANGE_COMMAND_DESCRIPTIONS    ', clc$alias_entry, clc$normal_usage_entry, 3,
          clc$automatically_log, clc$linked_call, ^ocp$_change_command_description],
          {} ['CHANGE_FUNCTION_DESCRIPTION    ', clc$nominal_entry, clc$normal_usage_entry, 4,
          clc$automatically_log, clc$linked_call, ^ocp$_change_function_descriptio],
          {} ['CHANGE_FUNCTION_DESCRIPTIONS   ', clc$alias_entry, clc$normal_usage_entry, 4,
          clc$automatically_log, clc$linked_call, ^ocp$_change_function_descriptio],
          {} ['CHANGE_MODULE_ATTRIBUTE        ', clc$nominal_entry, clc$normal_usage_entry, 5,
          clc$automatically_log, clc$linked_call, ^ocp$_change_module_attribute],
          {} ['CHANGE_MODULE_ATTRIBUTES       ', clc$alias_entry, clc$normal_usage_entry, 5,
          clc$automatically_log, clc$linked_call, ^ocp$_change_module_attribute],
          {} ['CHANGE_PROGRAM_DESCRIPTION     ', clc$nominal_entry, clc$normal_usage_entry, 6,
          clc$automatically_log, clc$linked_call, ^ocp$_change_program_description],
          {} ['CHAPD                          ', clc$abbreviation_entry, clc$normal_usage_entry, 6,
          clc$automatically_log, clc$linked_call, ^ocp$_change_program_description],
          {} ['COMBINE_MODULE                 ', clc$nominal_entry, clc$normal_usage_entry, 7,
          clc$automatically_log, clc$linked_call, ^ocp$_combine_module],
          {} ['COMBINE_MODULES                ', clc$alias_entry, clc$normal_usage_entry, 7,
          clc$automatically_log, clc$linked_call, ^ocp$_combine_module],
          {} ['COMM                           ', clc$abbreviation_entry, clc$normal_usage_entry, 7,
          clc$automatically_log, clc$linked_call, ^ocp$_combine_module],
          {} ['CREATE_COMMAND_DESCRIPTION     ', clc$nominal_entry, clc$normal_usage_entry, 8,
          clc$automatically_log, clc$linked_call, ^ocp$_create_command_description],
          {} ['CREATE_FORM_MODULE             ', clc$nominal_entry, clc$normal_usage_entry, 9,
          clc$automatically_log, clc$linked_call, ^ocp$_create_form_module],
          {} ['CREATE_FUNCTION_DESCRIPTION    ', clc$nominal_entry, clc$normal_usage_entry, 10,
          clc$automatically_log, clc$linked_call, ^ocp$_create_function_descriptio],
          {} ['CREATE_LINKED_MODULE           ', clc$nominal_entry, clc$normal_usage_entry, 11,
          clc$automatically_log, clc$program_call, 'OCP$CREATE_LINKED_MODULE'],
          {} ['CREATE_MESSAGE_MODULE          ', clc$nominal_entry, clc$normal_usage_entry, 12,
          clc$automatically_log, clc$linked_call, ^ocp$_create_message_module],
          {} ['CREATE_MODULE                  ', clc$nominal_entry, clc$normal_usage_entry, 13,
          clc$automatically_log, clc$linked_call, ^ocp$_create_module],
          {} ['CREATE_PROGRAM_DESCRIPTION     ', clc$nominal_entry, clc$normal_usage_entry, 14,
          clc$automatically_log, clc$linked_call, ^ocp$_create_program_description],
          {} ['CRECD                          ', clc$abbreviation_entry, clc$normal_usage_entry, 8,
          clc$automatically_log, clc$linked_call, ^ocp$_create_command_description],
          {} ['CREFD                          ', clc$abbreviation_entry, clc$normal_usage_entry, 10,
          clc$automatically_log, clc$linked_call, ^ocp$_create_function_descriptio],
          {} ['CREFM                          ', clc$abbreviation_entry, clc$normal_usage_entry, 9,
          clc$automatically_log, clc$linked_call, ^ocp$_create_form_module],
          {} ['CRELM                          ', clc$abbreviation_entry, clc$normal_usage_entry, 11,
          clc$automatically_log, clc$program_call, 'OCP$CREATE_LINKED_MODULE'],
          {} ['CREM                           ', clc$abbreviation_entry, clc$normal_usage_entry, 13,
          clc$automatically_log, clc$linked_call, ^ocp$_create_module],
          {} ['CREMM                          ', clc$abbreviation_entry, clc$normal_usage_entry, 12,
          clc$automatically_log, clc$linked_call, ^ocp$_create_message_module],
          {} ['CREPD                          ', clc$abbreviation_entry, clc$normal_usage_entry, 14,
          clc$automatically_log, clc$linked_call, ^ocp$_create_program_description],
          {} ['DELETE_MODULE                  ', clc$nominal_entry, clc$normal_usage_entry, 15,
          clc$automatically_log, clc$linked_call, ^ocp$_delete_module],
          {} ['DELETE_MODULES                 ', clc$alias_entry, clc$normal_usage_entry, 15,
          clc$automatically_log, clc$linked_call, ^ocp$_delete_module],
          {} ['DELM                           ', clc$abbreviation_entry, clc$normal_usage_entry, 15,
          clc$automatically_log, clc$linked_call, ^ocp$_delete_module],
          {} ['DISNL                          ', clc$abbreviation_entry, clc$normal_usage_entry, 16,
          clc$automatically_log, clc$linked_call, ^ocp$_display_new_library],
          {} ['DISPLAY_NEW_LIBRARY            ', clc$nominal_entry, clc$normal_usage_entry, 16,
          clc$automatically_log, clc$linked_call, ^ocp$_display_new_library],
          {} ['GENERATE_LIBRARY               ', clc$nominal_entry, clc$normal_usage_entry, 17,
          clc$automatically_log, clc$linked_call, ^ocp$generate],
          {} ['GENL                           ', clc$abbreviation_entry, clc$normal_usage_entry, 17,
          clc$automatically_log, clc$linked_call, ^ocp$generate],
          {} ['QUI                            ', clc$abbreviation_entry, clc$normal_usage_entry, 18,
          clc$automatically_log, clc$linked_call, ^ocp$_quit],
          {} ['QUIT                           ', clc$nominal_entry, clc$normal_usage_entry, 18,
          clc$automatically_log, clc$linked_call, ^ocp$_quit],
          {} ['REOM                           ', clc$abbreviation_entry, clc$normal_usage_entry, 19,
          clc$automatically_log, clc$linked_call, ^ocp$_reorder_module],
          {} ['REORDER_MODULE                 ', clc$nominal_entry, clc$normal_usage_entry, 19,
          clc$automatically_log, clc$linked_call, ^ocp$_reorder_module],
          {} ['REORDER_MODULES                ', clc$alias_entry, clc$normal_usage_entry, 19,
          clc$automatically_log, clc$linked_call, ^ocp$_reorder_module],
          {} ['REPLACE_MODULE                 ', clc$nominal_entry, clc$normal_usage_entry, 20,
          clc$automatically_log, clc$linked_call, ^ocp$_replace_module],
          {} ['REPLACE_MODULES                ', clc$alias_entry, clc$normal_usage_entry, 20,
          clc$automatically_log, clc$linked_call, ^ocp$_replace_module],
          {} ['REPM                           ', clc$abbreviation_entry, clc$normal_usage_entry, 20,
          clc$automatically_log, clc$linked_call, ^ocp$_replace_module],
          {} ['SATER                          ', clc$abbreviation_entry, clc$normal_usage_entry, 21,
          clc$automatically_log, clc$linked_call, ^ocp$_satisfy_external_reference],
          {} ['SATISFY_EXTERNAL_REFERENCE     ', clc$nominal_entry, clc$normal_usage_entry, 21,
          clc$automatically_log, clc$linked_call, ^ocp$_satisfy_external_reference],
          {} ['SATISFY_EXTERNAL_REFERENCES    ', clc$alias_entry, clc$normal_usage_entry, 21,
          clc$automatically_log, clc$linked_call, ^ocp$_satisfy_external_reference],
          {} ['SETDO                          ', clc$abbreviation_entry, clc$normal_usage_entry, 22,
          clc$automatically_log, clc$linked_call, ^ocp$_set_display_option],
          {} ['SET_DISPLAY_OPTION             ', clc$nominal_entry, clc$normal_usage_entry, 22,
          clc$automatically_log, clc$linked_call, ^ocp$_set_display_option],
          {} ['SET_DISPLAY_OPTIONS            ', clc$alias_entry, clc$normal_usage_entry, 22,
          clc$automatically_log, clc$linked_call, ^ocp$_set_display_option]];

  PROCEDURE [XREF] ocp$generate
    (    parameter_list: clt$parameter_list;
     VAR status: ost$status);

  PROCEDURE [XREF] ocp$_add_module
    (    parameter_list: clt$parameter_list;
     VAR status: ost$status);

  PROCEDURE [XREF] ocp$_bind_module
    (    parameter_list: clt$parameter_list;
     VAR status: ost$status);

  PROCEDURE [XREF] ocp$_change_command_description
    (    parameter_list: clt$parameter_list;
     VAR status: ost$status);

  PROCEDURE [XREF] ocp$_change_function_descriptio
    (    parameter_list: clt$parameter_list;
     VAR status: ost$status);

  PROCEDURE [XREF] ocp$_change_module_attribute
    (    parameter_list: clt$parameter_list;
     VAR status: ost$status);

  PROCEDURE [XREF] ocp$_change_program_description
    (    parameter_list: clt$parameter_list;
     VAR status: ost$status);

  PROCEDURE [XREF] ocp$_combine_module
    (    parameter_list: clt$parameter_list;
     VAR status: ost$status);

  PROCEDURE [XREF] ocp$_create_command_description
    (    parameter_list: clt$parameter_list;
     VAR status: ost$status);

  PROCEDURE [XREF] ocp$_create_form_module
    (    parameter_list: clt$parameter_list;
     VAR status: ost$status);

  PROCEDURE [XREF] ocp$_create_function_descriptio
    (    parameter_list: clt$parameter_list;
     VAR status: ost$status);

  PROCEDURE [XREF] ocp$_create_message_module
    (    parameter_list: clt$parameter_list;
     VAR status: ost$status);

  PROCEDURE [XREF] ocp$_create_module
    (    parameter_list: clt$parameter_list;
     VAR status: ost$status);

  PROCEDURE [XREF] ocp$_create_program_description
    (    parameter_list: clt$parameter_list;
     VAR status: ost$status);

  PROCEDURE [XREF] ocp$_delete_module
    (    parameter_list: clt$parameter_list;
     VAR status: ost$status);

  PROCEDURE [XREF] ocp$_display_new_library
    (    parameter_list: clt$parameter_list;
     VAR status: ost$status);

  PROCEDURE [XREF] ocp$_reorder_module
    (    parameter_list: clt$parameter_list;
     VAR status: ost$status);

  PROCEDURE [XREF] ocp$_replace_module
    (    parameter_list: clt$parameter_list;
     VAR status: ost$status);

  PROCEDURE [XREF] ocp$_satisfy_external_reference
    (    parameter_list: clt$parameter_list;
     VAR status: ost$status);

  PROCEDURE [XREF] ocp$_set_display_option
    (    parameter_list: clt$parameter_list;
     VAR status: ost$status);

?? POP ??


{ table function_table t=f s=local
{ function $module_list                ocp$$module_list cm=xref
{ function $module_attributes          ocp$$module_attributes cm=xref
{ tablend

?? PUSH (LISTEXT := ON) ??

  VAR
    function_table: [STATIC, READ] ^clt$function_processor_table := ^function_table_entries,

    function_table_entries: [STATIC, READ] array [1 .. 2] of clt$function_proc_table_entry := [
          {} ['$MODULE_ATTRIBUTES             ', clc$nominal_entry, clc$normal_usage_entry, 2,
          clc$linked_call, ^ocp$$module_attributes],
          {} ['$MODULE_LIST                   ', clc$nominal_entry, clc$normal_usage_entry, 1,
          clc$linked_call, ^ocp$$module_list]];

  PROCEDURE [XREF] ocp$$module_attributes
    (    parameter_list: clt$parameter_list;
     VAR work_area {input, output} : ^clt$work_area;
     VAR result: ^clt$data_value;
     VAR status: ost$status);

  PROCEDURE [XREF] ocp$$module_list
    (    parameter_list: clt$parameter_list;
     VAR work_area {input, output} : ^clt$work_area;
     VAR result: ^clt$data_value;
     VAR status: ost$status);

?? POP ??
?? OLDTITLE ??
?? NEWTITLE := 'ocp$_create_object_library', EJECT ??

{ PURPOSE:
{   The purpose of this procedure is to initiate the CREATE_OBJECT_LIBRARY utility.

  PROGRAM ocp$_create_object_library
    (    parameter_list: clt$parameter_list;
     VAR status: ost$status);

{   PROCEDURE (ocm$creol) create_object_library, creol (
{     status)

?? PUSH (LISTEXT := ON) ??
?? FMT (FORMAT := OFF) ??

  VAR
    pdt: [STATIC, READ, cls$declaration_section] record
      header: clt$pdt_header,
      names: array [1 .. 1] of clt$pdt_parameter_name,
      parameters: array [1 .. 1] of clt$pdt_parameter,
      type1: record
        header: clt$type_specification_header,
      recend,
    recend := [
    [1,
    [89, 3, 21, 12, 37, 40, 116],
    clc$command, 1, 1, 0, 0, 0, 0, 1, 'OCM$CREOL'], [
    ['STATUS                         ',clc$nominal_entry, 1]],
    [
{ PARAMETER 1
    [1, clc$normal_usage_entry, clc$non_secure_parameter,
    $clt$parameter_spec_methods[clc$specify_by_name],
    clc$pass_by_reference, clc$immediate_evaluation, clc$standard_parameter_checking, 3,
  clc$optional_parameter, 0, 0]],
{ PARAMETER 1
    [[1, 0, clc$status_type]]];

?? FMT (FORMAT := ON) ??
?? POP ??

    CONST
      p$status = 1;

    VAR
      pvt: array [1 .. 1] of clt$parameter_value;

?? NEWTITLE := 'condition_handler', EJECT ??

{ PURPOSE:
{   The purpose of this procedure is to handle the terminate break and
{   block exit conditions.


    PROCEDURE condition_handler
      (    condition: pmt$condition;
           condition_descriptor: ^pmt$condition_information;
           stack_frame_save_area_p: ^ost$stack_frame_save_area;
       VAR handler_status: ost$status);

      VAR
        ignore_status: ost$status;

      ocp$close_all_open_files (ocv$open_file_list);
      ocp$return_files;
      IF (status.normal) AND (ocv$nlm_list^.f_link^.name <> osc$null_name) THEN
        osp$set_status_condition (oce$w_library_not_generated, status);
      IFEND;
      clp$end_utility (utility_name, ignore_status);
    PROCEND condition_handler;
?? OLDTITLE ??
?? EJECT ??

    VAR
      ignore_status: ost$status;

    status.normal := TRUE;
    utility_attributes [1].command_table := command_table;
    utility_attributes [2].function_processor_table := function_table;

    clp$evaluate_parameters (parameter_list, #SEQ (pdt), NIL, ^pvt, status);
    IF NOT status.normal THEN
      RETURN;
    IFEND;

    ocp$initialize_oc_environment (status);
    IF NOT status.normal THEN
      RETURN;
    IFEND;

    osp$establish_block_exit_hndlr (^condition_handler);
    IF NOT status.normal THEN
      RETURN;
    IFEND;

    clp$begin_utility (utility_name, utility_attributes, status);
    IF NOT status.normal THEN
      RETURN;
    IFEND;

    clp$include_file (command_file, '', utility_name, status);
    IF NOT status.normal THEN
      RETURN;
    IFEND;

    osp$disestablish_cond_handler;
    ocp$close_all_open_files (ocv$open_file_list);
    ocp$return_files;
    IF (ocv$nlm_list^.f_link^.name <> osc$null_name) THEN
      osp$set_status_condition (oce$w_library_not_generated, status);
    IFEND;
    clp$end_utility (utility_name, ignore_status);

  PROCEND ocp$_create_object_library;
?? OLDTITLE ??
?? NEWTITLE := 'ocp$_quit', EJECT ??

{ PURPOSE:
{   This procedure is the command processor for the quit subcommand
{   of the CREATE_OBJECT_LIBRARY utility.

  PROCEDURE ocp$_quit
    (    parameter_list: clt$parameter_list;
     VAR status: ost$status);

{  PROCEDURE (ocm$creol_qui) quit, qui ()

?? PUSH (LISTEXT := ON) ??
?? FMT (FORMAT := OFF) ??

  VAR
    pdt: [STATIC, READ, cls$declaration_section] record
      header: clt$pdt_header,
    recend := [
    [1,
    [89, 3, 21, 15, 0, 53, 974],
    clc$command, 0, 0, 0, 0, 0, 0, 0, 'OCM$CREOL_QUI']];

?? FMT (FORMAT := ON) ??
?? POP ??
    status.normal := TRUE;

{ An "empty" PDT and PVT=NIL indicate that the command has no parameters.

    clp$evaluate_parameters (parameter_list, #SEQ (pdt), NIL, NIL, status);
    IF NOT status.normal THEN
      RETURN;
    IFEND;

    clp$end_include (utility_name, status);

  PROCEND ocp$_quit;
?? OLDTITLE ??
MODEND ocm$create_object_library;
