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



{ PURPOSE:
{   To bind multiple modules together into a
{   single new module.  The code sections of
{   the old modules are reordered according to
{   the order parameter from the bind_module
{   command.

?? NEWTITLE := 'Global Declarations Referenced by This Module', EJECT ??
?? PUSH (LISTEXT := ON) ??
*copyc cle$ecc_expression_result
*copyc cle$ecc_parameter_list
*copyc llt$object_library_header
*copyc occ$retain
*copyc oce$library_generator_errors
*copyc oct$bound_module_components
*copyc oct$changed_info
*copyc oct$code_section_ids
*copyc oct$component_list
*copyc oct$debug_table
*copyc oct$display_toggles
*copyc oct$external_declaration_list
*copyc oct$external_reference_list
*copyc oct$header
*copyc oct$module_description
*copyc oct$name_list
*copyc oct$new_library_module_list
*copyc oct$open_file_list
*copyc ost$status
?? POP ??
*copyc clp$convert_string_to_file
*copyc clp$evaluate_parameters
*copyc clp$read_variable
*copyc ocp$add_an_nlm
*copyc ocp$close_all_open_files
*copyc ocp$generate_message
*copyc ocp$initialize_olg_working_heap
*copyc ocp$obtain_code_section_ids
*copyc ocp$obtain_header
*copyc ocp$obtain_library_list
*copyc ocp$obtain_object_file
*copyc ocp$obtain_xdcl_list
*copyc ocp$obtain_xref_list
*copyc ocp$search_nlm_tree
*copyc ocp$search_object_file
*copyc ocp$search_object_file
*copyc ocp$search_xdcl_list
*copyc osp$append_status_parameter
*copyc osp$set_status_abnormal
*copyc osp$set_status_condition
*copyc pmp$continue_to_cause
*copyc pmp$disestablish_cond_handler
*copyc pmp$establish_condition_handler
*copyc pmp$get_legible_date_time
*copyc ocv$nlm_list
*copyc ocv$olg_scratch_seq
*copyc ocv$olg_working_heap
*copyc ocv$open_file_list

?? OLDTITLE ??
?? NEWTITLE := 'Global Declarations Declared by This Module', EJECT ??

  VAR
    object_type_checking: [STATIC, READ] string (6) := 'OBJECT';

?? OLDTITLE ??
?? NEWTITLE := '[XDCL] ocp$_bind_module', EJECT ??

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


{ PROCEDURE (ocm$creol_binm) bind_module, binm (
{   mode, m: key
{       continue, quit
{     keyend = $required
{   name, n: program_name = $optional
{   file, f: file = $optional
{   starting_procedure, sp: program_name = $optional
{   section_order, so: (BY_NAME) list of record
{       section_name: program_name
{       section_ordinal: integer
{     recend = $optional
{   preset_value, pv: (BY_NAME) key
{       (zero, z)
{       (floating_point_indefinite, fpi)
{       (infinity, i)
{       (alternate_ones, ao)
{     keyend = $optional
{   include_binary_section_maps, ibsm: (BY_NAME) boolean = $optional
{   output, o: (BY_NAME) file = $optional
{   status)

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

  VAR
    pdt: [STATIC, READ, cls$declaration_section] record
      header: clt$pdt_header,
      names: array [1 .. 17] of clt$pdt_parameter_name,
      parameters: array [1 .. 9] of clt$pdt_parameter,
      type1: record
        header: clt$type_specification_header,
        qualifier: clt$keyword_type_qualifier,
        keyword_specs: array [1 .. 2] of clt$keyword_specification,
      recend,
      type2: record
        header: clt$type_specification_header,
      recend,
      type3: record
        header: clt$type_specification_header,
      recend,
      type4: record
        header: clt$type_specification_header,
      recend,
      type5: record
        header: clt$type_specification_header,
        qualifier: clt$list_type_qualifier_v2,
        element_type_spec: record
          header: clt$type_specification_header,
          qualifier: clt$record_type_qualifier,
          field_spec_1: clt$field_specification,
          element_type_spec_1: record
            header: clt$type_specification_header,
          recend,
          field_spec_2: clt$field_specification,
          element_type_spec_2: record
            header: clt$type_specification_header,
            qualifier: clt$integer_type_qualifier,
          recend,
        recend,
      recend,
      type6: record
        header: clt$type_specification_header,
        qualifier: clt$keyword_type_qualifier,
        keyword_specs: array [1 .. 8] of clt$keyword_specification,
      recend,
      type7: record
        header: clt$type_specification_header,
      recend,
      type8: record
        header: clt$type_specification_header,
      recend,
      type9: record
        header: clt$type_specification_header,
      recend,
    recend := [
    [1,
    [90, 2, 12, 9, 57, 48, 683],
    clc$command, 17, 9, 1, 0, 0, 0, 9, 'OCM$CREOL_BINM'], [
    ['F                              ',clc$abbreviation_entry, 3],
    ['FILE                           ',clc$nominal_entry, 3],
    ['IBSM                           ',clc$abbreviation_entry, 7],
    ['INCLUDE_BINARY_SECTION_MAPS    ',clc$nominal_entry, 7],
    ['M                              ',clc$abbreviation_entry, 1],
    ['MODE                           ',clc$nominal_entry, 1],
    ['N                              ',clc$abbreviation_entry, 2],
    ['NAME                           ',clc$nominal_entry, 2],
    ['O                              ',clc$abbreviation_entry, 8],
    ['OUTPUT                         ',clc$nominal_entry, 8],
    ['PRESET_VALUE                   ',clc$nominal_entry, 6],
    ['PV                             ',clc$abbreviation_entry, 6],
    ['SECTION_ORDER                  ',clc$nominal_entry, 5],
    ['SO                             ',clc$abbreviation_entry, 5],
    ['SP                             ',clc$abbreviation_entry, 4],
    ['STARTING_PROCEDURE             ',clc$nominal_entry, 4],
    ['STATUS                         ',clc$nominal_entry, 9]],
    [
{ PARAMETER 1
    [6, clc$normal_usage_entry, clc$non_secure_parameter,
    $clt$parameter_spec_methods[clc$specify_by_name, clc$specify_positionally],
    clc$pass_by_value, clc$immediate_evaluation, clc$standard_parameter_checking, 81, clc$required_parameter,
  0, 0],
{ PARAMETER 2
    [8, clc$normal_usage_entry, clc$non_secure_parameter,
    $clt$parameter_spec_methods[clc$specify_by_name, clc$specify_positionally],
    clc$pass_by_value, clc$immediate_evaluation, clc$standard_parameter_checking, 3, clc$optional_parameter, 0
  , 0],
{ PARAMETER 3
    [2, clc$normal_usage_entry, clc$non_secure_parameter,
    $clt$parameter_spec_methods[clc$specify_by_name, clc$specify_positionally],
    clc$pass_by_value, clc$immediate_evaluation, clc$standard_parameter_checking, 3, clc$optional_parameter, 0
  , 0],
{ PARAMETER 4
    [16, clc$normal_usage_entry, clc$non_secure_parameter,
    $clt$parameter_spec_methods[clc$specify_by_name, clc$specify_positionally],
    clc$pass_by_value, clc$immediate_evaluation, clc$standard_parameter_checking, 3, clc$optional_parameter, 0
  , 0],
{ PARAMETER 5
    [13, clc$normal_usage_entry, clc$non_secure_parameter,
    $clt$parameter_spec_methods[clc$specify_by_name],
    clc$pass_by_value, clc$immediate_evaluation, clc$standard_parameter_checking, 118,
  clc$optional_parameter, 0, 0],
{ PARAMETER 6
    [11, clc$normal_usage_entry, clc$non_secure_parameter,
    $clt$parameter_spec_methods[clc$specify_by_name],
    clc$pass_by_value, clc$immediate_evaluation, clc$standard_parameter_checking, 303,
  clc$optional_parameter, 0, 0],
{ PARAMETER 7
    [4, clc$normal_usage_entry, clc$non_secure_parameter,
    $clt$parameter_spec_methods[clc$specify_by_name],
    clc$pass_by_value, clc$immediate_evaluation, clc$standard_parameter_checking, 3, clc$optional_parameter, 0
  , 0],
{ PARAMETER 8
    [10, clc$normal_usage_entry, clc$non_secure_parameter,
    $clt$parameter_spec_methods[clc$specify_by_name],
    clc$pass_by_value, clc$immediate_evaluation, clc$standard_parameter_checking, 3, clc$optional_parameter, 0
  , 0],
{ PARAMETER 9
    [17, 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$keyword_type], [2], [
    ['CONTINUE                       ', clc$nominal_entry, clc$normal_usage_entry, 1],
    ['QUIT                           ', clc$nominal_entry, clc$normal_usage_entry, 2]]
    ],
{ PARAMETER 2
    [[1, 0, clc$program_name_type]],
{ PARAMETER 3
    [[1, 0, clc$file_type]],
{ PARAMETER 4
    [[1, 0, clc$program_name_type]],
{ PARAMETER 5
    [[1, 0, clc$list_type], [102, 1, clc$max_list_size, 0, FALSE, FALSE],
      [[1, 0, clc$record_type], [2],
      ['SECTION_NAME                   ', clc$required_field, 3], [[1, 0, clc$program_name_type]],
      ['SECTION_ORDINAL                ', clc$required_field, 20], [[1, 0, clc$integer_type], [clc$min_integer
  , clc$max_integer, 10]]
      ]
    ],
{ PARAMETER 6
    [[1, 0, clc$keyword_type], [8], [
    ['ALTERNATE_ONES                 ', clc$nominal_entry, clc$normal_usage_entry, 4],
    ['AO                             ', clc$abbreviation_entry, clc$normal_usage_entry, 4],
    ['FLOATING_POINT_INDEFINITE      ', clc$nominal_entry, clc$normal_usage_entry, 2],
    ['FPI                            ', clc$abbreviation_entry, clc$normal_usage_entry, 2],
    ['I                              ', clc$abbreviation_entry, clc$normal_usage_entry, 3],
    ['INFINITY                       ', clc$nominal_entry, clc$normal_usage_entry, 3],
    ['Z                              ', clc$abbreviation_entry, clc$normal_usage_entry, 1],
    ['ZERO                           ', clc$nominal_entry, clc$normal_usage_entry, 1]]
    ],
{ PARAMETER 7
    [[1, 0, clc$boolean_type]],
{ PARAMETER 8
    [[1, 0, clc$file_type]],
{ PARAMETER 9
    [[1, 0, clc$status_type]]];

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

    CONST
      p$mode = 1,
      p$name = 2,
      p$file = 3,
      p$starting_procedure = 4,
      p$section_order = 5,
      p$preset_value = 6,
      p$include_binary_section_maps = 7,
      p$output = 8,
      p$status = 9;

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

{ These constants are used for the field values in the section_order record.

    CONST
      p$section_name = 1,
      p$section_ordinal = 2;

?? 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);

      IF (condition.selector = ifc$interactive_condition) AND
            (condition.interactive_condition = ifc$terminate_break) THEN

{ Ignore the condition.

        RETURN;
      ELSEIF condition.selector = pmc$block_exit_processing THEN
        ocp$close_all_open_files (ocv$open_file_list);
        ocp$initialize_olg_working_heap;
        RESET ocv$olg_scratch_seq;
      ELSE
        pmp$continue_to_cause (pmc$execute_standard_procedure, handler_status);
      IFEND;
    PROCEND condition_handler;
?? OLDTITLE, EJECT ??

    VAR
      time: ost$time,
      date: ost$date;

?? FMT (FORMAT := OFF) ??
    VAR
      module_header_template: [STATIC] llt$identification :=
        [  *,                              {name}
           llc$object_text_version,        {object_text_version}
           LLC$MI_VIRTUAL_STATE,           {kind}
           [OSC$HMS_TIME, *],              {time_created}
           [OSC$MDY_DATE, *],              {date_created}
           *,                              {attributes}
           0,                              {greatest_section_ordinal}
           LLC$OBJECT_LIBRARY_GENERATOR,   {generator_id}
           'OBJECT LIBRARY GENERATOR ' CAT llc$object_library_version,  {generator_name_vers}
           OSC$NULL_NAME];                 {commentary}
?? FMT (FORMAT := ON) ??

    VAR
      first_pass: [STATIC] boolean := TRUE,
      nlm: [STATIC] ^oct$new_library_module_list,
      end_of_ordered_code_sections: [STATIC] ^oct$code_section_ids,
      number_of_components: [STATIC] 0 .. llc$max_components,
      component_list: [STATIC] oct$component_list,
      procedure_specified: [STATIC] boolean := FALSE;


    VAR
      bound_modules_xdcl_list: oct$external_declaration_list,
      changed_info_entry_points: oct$external_declaration_list,
      component_number: 0 .. llc$max_components,
      current_module: pmt$program_name,
      deferred_entry_point_list: oct$external_declaration_list,
      dummy: integer,
      file_descriptor: ^oct$open_file_list,
      header: oct$header,
      ignore_status: ost$status,
      last_code_section_ids: ^oct$code_section_ids,
      last_component: ^oct$component_list,
      last_library: ^oct$name_list,
      last_xdcl: ^oct$external_declaration_list,
      last_xref: ^oct$external_reference_list,
      library_list: oct$name_list,
      module_already_exists: boolean,
      module_name: pmt$program_name,
      modules_last_library: ^oct$name_list,
      modules_last_xdcl: ^oct$external_declaration_list,
      modules_last_xref: ^oct$external_reference_list,
      modules_library_list: oct$name_list,
      modules_xdcl_list: oct$external_declaration_list,
      modules_xref_list: oct$external_reference_list,
      node: ^clt$data_value,
      ordinal_number: integer,
      program_name: pmt$program_name,
      section_map_file: clt$file,
      section_ordinal_stg: string (5),
      start_proc: pmt$program_name,
      temporary_pointer: ^oct$code_section_ids,
      xdcl_found: boolean;

    VAR
      established_conditions: pmt$condition,
      established_descriptor: pmt$established_handler;



    status.normal := TRUE;
    RESET ocv$olg_scratch_seq;

    established_conditions.selector := pmc$condition_combination;
    established_conditions.combination := $pmt$condition_combination
          [ifc$interactive_condition, pmc$block_exit_processing];

    pmp$establish_condition_handler (established_conditions, ^condition_handler, ^established_descriptor,
          status);
    IF NOT status.normal THEN
      RETURN;
    IFEND;

  /protect/
    BEGIN

    /valid_data_processing/
      BEGIN

        clp$evaluate_parameters (parameter_list, #SEQ (pdt), NIL, ^pvt, status);
        IF NOT status.normal THEN
          IF first_pass THEN
            EXIT /protect/;
          ELSE
            EXIT /valid_data_processing/;
          IFEND;
        IFEND;

        IF first_pass THEN
          pmp$get_legible_date_time (osc$mdy_date, date, osc$hms_time, time, status);
          IF NOT status.normal THEN
            EXIT /protect/;
          IFEND;
          module_header_template.date_created.mdy := date.mdy;
          module_header_template.time_created.hms := time.hms;

          ocp$obtain_object_file (pvt [p$file].value^.file_value^, file_descriptor, status);
          IF NOT status.normal THEN
            EXIT /protect/;
          IFEND;

          program_name := pvt [p$name].value^.program_name_value;
          ocp$search_nlm_tree (program_name, nlm, module_already_exists);
          IF module_already_exists THEN
            osp$set_status_abnormal (oc, oce$e_module_already_on_library, program_name, status);
            EXIT /protect/;
          IFEND;

          ALLOCATE nlm IN ocv$olg_working_heap^;
          IF nlm = NIL THEN
            osp$set_status_condition (oce$e_internal_olg_seg_overflow, status);
            RETURN;
          IFEND;

          nlm^.name := program_name;

          ALLOCATE nlm^.description IN ocv$olg_working_heap^;
          IF nlm^.description = NIL THEN
            osp$set_status_condition (oce$e_internal_olg_seg_overflow, status);
            FREE nlm IN ocv$olg_working_heap^;
            RETURN;
          IFEND;

          nlm^.description^.name := program_name;
          nlm^.description^.source := occ$current;
          nlm^.description^.file := NIL;
          nlm^.description^.kind := occ$bound_module;

          ALLOCATE nlm^.changed_info IN ocv$olg_working_heap^;
          IF nlm^.changed_info = NIL THEN
            osp$set_status_condition (oce$e_internal_olg_seg_overflow, status);
            FREE nlm^.description IN ocv$olg_working_heap^;
            FREE nlm IN ocv$olg_working_heap^;
            RETURN;
          IFEND;

          nlm^.changed_info^.name := NIL;
          nlm^.changed_info^.commentary := NIL;
          nlm^.changed_info^.entry_points := NIL;
          nlm^.changed_info^.starting_procedure := osc$null_name;
          nlm^.changed_info^.new_libraries := TRUE;
          nlm^.changed_info^.library_list := NIL;
          nlm^.changed_info^.debug_tables_to_omit := $oct$debug_tables [];
          nlm^.changed_info^.application_identifier := NIL;
          nlm^.changed_info^.cybil_parameter_checking := '      ';

          ALLOCATE nlm^.description^.bound_module_header IN ocv$olg_working_heap^;
          IF nlm^.description^.bound_module_header = NIL THEN
            osp$set_status_condition (oce$e_internal_olg_seg_overflow, status);
            FREE nlm^.changed_info IN ocv$olg_working_heap^;
            FREE nlm^.description IN ocv$olg_working_heap^;
            FREE nlm IN ocv$olg_working_heap^;
            RETURN;
          IFEND;


          module_header_template.name := nlm^.name;

          nlm^.description^.bound_module_header^.identification := module_header_template;
          nlm^.description^.bound_module_header^.section_map.local_file_name := osc$null_name;
          nlm^.description^.bound_module_header^.xref_list.link := NIL;
          nlm^.description^.bound_module_header^.code_section_ids.link := NIL;
          nlm^.description^.bound_module_header^.components := NIL;
          nlm^.description^.bound_module_header^.preset_value := pmc$initialize_to_zero;
          nlm^.description^.bound_module_header^.preset_specified := FALSE;
          nlm^.description^.bound_module_header^.include_binary_section_maps := FALSE;

          nlm^.f_link := NIL;
          nlm^.b_link := NIL;
          nlm^.r_link := NIL;
          nlm^.l_link := NIL;
          nlm^.t_link := NIL;

          component_list.link := NIL;
          number_of_components := 0;

          bound_modules_xdcl_list.link := NIL;
          library_list.link := NIL;
          last_component := ^component_list;
          last_code_section_ids := ^nlm^.description^.bound_module_header^.code_section_ids;

          FOR file_descriptor^.current_module := 1 TO UPPERBOUND (file_descriptor^.directory^) DO
            IF number_of_components >= llc$max_components THEN
              osp$set_status_condition (oce$e_too_many_components, status);
              EXIT /valid_data_processing/;
            IFEND;

            number_of_components := number_of_components + 1;

            NEXT last_component^.link IN ocv$olg_scratch_seq;
            last_component := last_component^.link;
            IF last_component = NIL THEN
              osp$set_status_condition (oce$e_internal_olg_seg_overflow, status);
              EXIT /valid_data_processing/;
            IFEND;

            last_component^.link := NIL;
            last_component^.module_description := ^file_descriptor^.
                  directory^ [file_descriptor^.current_module];

            IF (last_component^.module_description^.kind <> occ$cpu_object_module) AND
                  (last_component^.module_description^.kind <> occ$load_module) THEN
              osp$set_status_abnormal (oc, oce$e_invalid_module_kind,
                    last_component^.module_description^.name, status);
              EXIT /valid_data_processing/;
            IFEND;

            ocp$obtain_header (last_component^.module_description^, nlm^.changed_info, header, status);
            IF NOT status.normal THEN
              EXIT /valid_data_processing/;
            IFEND;

            IF header.identification.kind = llc$vector_virtual_state THEN
              nlm^.description^.bound_module_header^.identification.kind := llc$vector_virtual_state;
            ELSEIF header.identification.kind = llc$vector_extended_state THEN
              nlm^.description^.bound_module_header^.identification.kind := llc$vector_extended_state;
            IFEND;

            IF llc$nonbindable IN header.identification.attributes THEN
              osp$set_status_abnormal (oc, oce$e_module_not_bindable,
                    last_component^.module_description^.name, status);
              EXIT /valid_data_processing/;
            IFEND;

            IF llc$object_cybil_checking IN header.identification.attributes THEN
              nlm^.changed_info^.cybil_parameter_checking := object_type_checking;
            IFEND;

            ocp$obtain_xdcl_list ({changed_info} NIL, occ$retain, {obtain_deferred_entry_points} FALSE,
                  last_component^.module_description^, modules_xdcl_list, start_proc,
                  deferred_entry_point_list, status);
            IF start_proc <> osc$null_name THEN
              nlm^.changed_info^.starting_procedure := start_proc;
            IFEND;
            IF NOT status.normal THEN
              EXIT /valid_data_processing/;
            IFEND;

            ocp$obtain_xref_list (last_component^.module_description^, modules_xref_list, occ$retain, status);
            IF NOT status.normal THEN
              EXIT /valid_data_processing/;
            IFEND;

            ocp$obtain_code_section_ids (last_component^.module_description^, last_code_section_ids^, status);
            IF NOT status.normal THEN
              EXIT /valid_data_processing/;
            IFEND;

            WHILE last_code_section_ids^.link <> NIL DO
              last_code_section_ids := last_code_section_ids^.link;
            WHILEND;

            ocp$obtain_library_list (last_component^.module_description^, NIL, modules_library_list,
                  occ$retain, status);
            IF NOT status.normal THEN
              EXIT /valid_data_processing/;
            IFEND;
            modules_last_xdcl := modules_xdcl_list.link;

            WHILE modules_last_xdcl <> NIL DO
              ocp$search_xdcl_list (modules_last_xdcl^.name, ^bound_modules_xdcl_list, xdcl_found, last_xdcl);
              IF xdcl_found THEN
                osp$set_status_abnormal (oc, oce$e_xdcl_already_exists, modules_last_xdcl^.name, status);
                EXIT /valid_data_processing/;
              IFEND;

              last_xdcl^.link := modules_last_xdcl;
              modules_last_xdcl := modules_last_xdcl^.link;
              last_xdcl^.link^.link := NIL;
            WHILEND;

            modules_last_xref := modules_xref_list.link;
            WHILE modules_last_xref <> NIL DO
              last_xref := ^nlm^.description^.bound_module_header^.xref_list;
              WHILE (last_xref^.link <> NIL) AND (last_xref^.link^.name <> modules_last_xref^.name) DO
                last_xref := last_xref^.link;
              WHILEND;

              IF last_xref^.link = NIL THEN
                last_xref^.link := modules_last_xref;
                modules_last_xref := modules_last_xref^.link;
                last_xref^.link^.link := NIL;
              ELSE
                modules_last_xref := modules_last_xref^.link;
              IFEND;
            WHILEND;


            modules_last_library := modules_library_list.link;
            WHILE modules_last_library <> NIL DO
              last_library := ^library_list;
              WHILE (last_library^.link <> NIL) AND (last_library^.link^.name <> modules_last_library^.name)
                    DO
                last_library := last_library^.link;
              WHILEND;

              IF last_library^.link = NIL THEN
                last_library^.link := modules_last_library;
                modules_last_library := modules_last_library^.link;
                last_library^.link^.link := NIL;
              ELSE
                modules_last_library := modules_last_library^.link;
              IFEND;
            WHILEND;
          FOREND;

          nlm^.changed_info^.entry_points := bound_modules_xdcl_list.link;
          nlm^.changed_info^.library_list := library_list.link;

          first_pass := FALSE;
          end_of_ordered_code_sections := ^nlm^.description^.bound_module_header^.code_section_ids;
?? EJECT ??
        ELSE { NOT first_pass
          IF pvt [p$name].specified THEN
            osp$set_status_abnormal (oc, cle$doubly_defined_parameter, 'NAME', status);
            EXIT /valid_data_processing/;
          IFEND;

          IF pvt [p$file].specified THEN
            osp$set_status_abnormal (oc, cle$doubly_defined_parameter, 'FILE', status);
            EXIT /valid_data_processing/;
          IFEND;
        IFEND;

        IF pvt [p$starting_procedure].specified THEN
          IF procedure_specified THEN
            osp$set_status_abnormal (oc, cle$doubly_defined_parameter, 'STARTING_PROCEDURE', status);
            EXIT /valid_data_processing/;
          IFEND;

          procedure_specified := TRUE;
          program_name := pvt [p$starting_procedure].value^.program_name_value;

          changed_info_entry_points.link := nlm^.changed_info^.entry_points;

          ocp$search_xdcl_list (program_name, ^changed_info_entry_points, xdcl_found, last_xdcl);
          IF NOT xdcl_found THEN
            osp$set_status_abnormal (oc, oce$e_xdcl_doesnt_exist, program_name, status);
            EXIT /valid_data_processing/;
          IFEND;

          nlm^.changed_info^.starting_procedure := program_name;
        IFEND;

        node := pvt [p$section_order].value;
        WHILE node <> NIL DO
          module_name := node^.element_value^.field_values^ [p$section_name].value^.program_name_value;
          ordinal_number := node^.element_value^.field_values^ [p$section_ordinal].value^.integer_value.value;

          last_code_section_ids := end_of_ordered_code_sections;

          WHILE ((last_code_section_ids^.link^.name <> module_name) OR
                (last_code_section_ids^.link^.section_ordinal <> ordinal_number)) AND
                (last_code_section_ids^.link^.link <> NIL) DO
            last_code_section_ids := last_code_section_ids^.link;
          WHILEND;

          IF (last_code_section_ids^.link^.name = module_name) AND
                (last_code_section_ids^.link^.section_ordinal = ordinal_number) THEN
            temporary_pointer := last_code_section_ids^.link;
            last_code_section_ids^.link := temporary_pointer^.link;
            temporary_pointer^.link := end_of_ordered_code_sections^.link;
            end_of_ordered_code_sections^.link := temporary_pointer;
            end_of_ordered_code_sections := temporary_pointer;
          ELSE
            STRINGREP (section_ordinal_stg, dummy, ordinal_number);
            osp$set_status_abnormal (oc, oce$e_code_section_not_found, section_ordinal_stg (1, dummy),
                  status);
            osp$append_status_parameter (osc$status_parameter_delimiter, module_name, status);
            EXIT /valid_data_processing/;
          IFEND;
          node := node^.link;
        WHILEND;

        IF pvt [p$preset_value].specified THEN
          nlm^.description^.bound_module_header^.preset_specified := TRUE;
          IF pvt [p$preset_value].value^.keyword_value = 'ZERO' THEN
            nlm^.description^.bound_module_header^.preset_value := pmc$initialize_to_zero;
          ELSEIF pvt [p$preset_value].value^.keyword_value = 'FLOATING_POINT_INDEFINITE' THEN
            nlm^.description^.bound_module_header^.preset_value := pmc$initialize_to_indefinite;
          ELSEIF pvt [p$preset_value].value^.keyword_value = 'INFINITY' THEN
            nlm^.description^.bound_module_header^.preset_value := pmc$initialize_to_infinity;
          ELSE {IF pvt [p$preset_value].value^.keyword_value = 'ALTERNATE_ONES' THEN
            nlm^.description^.bound_module_header^.preset_value := pmc$initialize_to_alt_ones;
          IFEND;

        ELSE
          nlm^.description^.bound_module_header^.preset_value := pmc$initialize_to_zero;
        IFEND;

        IF pvt [p$include_binary_section_maps].specified THEN
          nlm^.description^.bound_module_header^.include_binary_section_maps :=
                pvt [p$include_binary_section_maps].value^.boolean_value.value;
        IFEND;

        IF pvt [p$output].specified THEN
          clp$convert_string_to_file (pvt [p$output].value^.file_value^, section_map_file, status);
          IF NOT status.normal THEN
            EXIT /valid_data_processing/;
          IFEND;
          nlm^.description^.bound_module_header^.section_map.local_file_name :=
                section_map_file.local_file_name;
        IFEND;

        IF pvt [p$mode].value^.keyword_value <> 'QUIT' THEN
          EXIT /protect/;
        ELSE


          last_component := component_list.link;

          ALLOCATE nlm^.description^.bound_module_header^.components: [1 .. number_of_components] IN
                ocv$olg_working_heap^;
          IF nlm^.description^.bound_module_header^.components = NIL THEN
            osp$set_status_condition (oce$e_internal_olg_seg_overflow, status);
            RETURN;
          IFEND;
          FOR component_number := 1 TO number_of_components DO
            nlm^.description^.bound_module_header^.components^ [component_number] :=
                  last_component^.module_description;
            last_component := last_component^.link;
            component_list.link := last_component;
          FOREND;

          ocp$add_an_nlm (ocv$nlm_list^.b_link, nlm);

          first_pass := TRUE;
          procedure_specified := FALSE;

          EXIT /protect/; { This is the normal RETURN path when MODE=QUIT.
        IFEND;

      END /valid_data_processing/;


      FREE nlm IN ocv$olg_working_heap^;
      first_pass := TRUE;
      procedure_specified := FALSE;
    END /protect/;
    pmp$disestablish_cond_handler (established_conditions, ignore_status);

  PROCEND ocp$_bind_module;
?? OLDTITLE ??

MODEND ocm$bind_module;
