?? LEFT := 1, RIGHT := 110 ??
MODULE nam$access_object_library;
?? RIGHT := 110 ??
?? NEWTITLE := '  Global Declarations Referenced by this module' ??
?? PUSH (LISTEXT := ON) ??
*copyc nae$file_access_me_conditions
?? POP ??
*copyc amp$return
*copyc clp$find_scl_proc_in_library
*copyc osp$append_status_file
*copyc osp$set_status_abnormal
*copyc pfp$attach
*copyc pfp$convert_pft$path_to_fs_path
*copyc pmp$close_object_library
*copyc pmp$find_entry_point_in_library
*copyc pmp$find_module_in_library
*copyc pmp$get_unique_name
*copyc pmp$open_object_library
?? OLDTITLE ??
?? NEWTITLE := '  Global Declarations Declared by this module', EJECT ??

  VAR
    highest_cycle: [READ] pft$cycle_selector := [pfc$highest_cycle],
    share_selections: [READ] pft$share_selections := [pfc$read],
    usage_selections: [READ] pft$usage_selections := [pfc$read];

?? NEWTITLE := '[XDCL] nap$open_entry_point', EJECT ??

  PROCEDURE [XDCL] nap$open_entry_point
    (    library_path: pft$path;
         entry_point_name: pmt$program_name;
     VAR file_identifier: amt$file_identifier;
     VAR entry_point_module: ^SEQ ( * );
     VAR local_file_name: amt$local_file_name;
     VAR status: ost$status);

    VAR
      library: ^SEQ ( * ),
      name: ost$name,
      local_status: ost$status,
      module_address: pmt$object_library_address;

    pmp$get_unique_name (name, status);
    pfp$attach (name, library_path, highest_cycle, osc$null_name, usage_selections, share_selections,
          pfc$no_wait, status);
    IF status.normal THEN
      pmp$open_object_library (name, file_identifier, library, status);
      IF status.normal THEN
        pmp$find_entry_point_in_library (library, entry_point_name, module_address, status);
        IF status.normal THEN
          IF module_address.kind = llc$load_module THEN
            entry_point_module := module_address.load_module;
            local_file_name := name;
          ELSE
            pmp$close_object_library (file_identifier, local_status);
            amp$return (name, local_status);
            osp$set_status_abnormal (nac$status_id, nae$ep_not_on_load_module, entry_point_name, status);
          IFEND;
        ELSE
          pmp$close_object_library (file_identifier, local_status);
          amp$return (name, local_status);
        IFEND;
      ELSE
        amp$return (name, local_status);
      IFEND;
    IFEND;

  PROCEND nap$open_entry_point;

?? OLDTITLE ??
?? TITLE := '[XDCL] nap$open_module', EJECT ??

  PROCEDURE [XDCL] nap$open_module
    (    library_path: pft$path;
         module_name: pmt$program_name;
     VAR file_identifier: amt$file_identifier;
     VAR object_module: ^SEQ ( * );
     VAR local_file_name: amt$local_file_name;
     VAR status: ost$status);

    VAR
      library: ^SEQ ( * ),
      name: ost$name,
      local_status: ost$status,
      module_address: pmt$object_library_address;

    pmp$get_unique_name (name, status);
    pfp$attach (name, library_path, highest_cycle, osc$null_name, usage_selections, share_selections,
          pfc$no_wait, status);
    IF status.normal THEN
      pmp$open_object_library (name, file_identifier, library, status);
      IF status.normal THEN
        pmp$find_module_in_library (module_name, library, module_address, status);
        IF status.normal THEN
          IF module_address.kind = llc$load_module THEN
            object_module := module_address.load_module;
            local_file_name := name;
          ELSE
            pmp$close_object_library (file_identifier, local_status);
            amp$return (name, local_status);
            osp$set_status_abnormal (nac$status_id, nae$module_not_a_load_module, module_name, status);
          IFEND;
        ELSE
          pmp$close_object_library (file_identifier, local_status);
          amp$return (name, local_status);
        IFEND;
      ELSE
        amp$return (name, local_status);
      IFEND;
    IFEND;

  PROCEND nap$open_module;

?? OLDTITLE ??
?? TITLE := '[XDCL] nap$open_procedure', EJECT ??

  PROCEDURE [XDCL] nap$open_procedure
    (    library_path: pft$path;
         procedure_name: ost$name;
     VAR file_identifier: amt$file_identifier;
     VAR scl_procedure: ^clt$scl_procedure;
     VAR local_file_name: amt$local_file_name;
     VAR status: ost$status);

    VAR
      library: ^SEQ ( * ),
      library_path_string: fst$path,
      library_path_size: fst$path_size,
      local_status: ost$status,
      name: ost$name;

    pmp$get_unique_name (name, status);
    pfp$attach (name, library_path, highest_cycle, osc$null_name, usage_selections, share_selections,
          pfc$no_wait, status);
    IF status.normal THEN
      pmp$open_object_library (name, file_identifier, library, status);
      IF status.normal THEN
        clp$find_scl_proc_in_library (library, name, procedure_name, scl_procedure, status);
        IF status.normal THEN
          IF scl_procedure <> NIL THEN
            local_file_name := name;
          ELSE
            pmp$close_object_library (file_identifier, local_status);
            amp$return (name, local_status);
            pfp$convert_pft$path_to_fs_path (library_path, library_path_string, library_path_size);
            osp$set_status_abnormal (nac$status_id, nae$procedure_not_on_library, procedure_name, status);
            osp$append_status_file (osc$status_parameter_delimiter,
                  library_path_string (1, library_path_size), status);
          IFEND;
        ELSE
          pmp$close_object_library (file_identifier, local_status);
          amp$return (name, local_status);
        IFEND;
      ELSE
        amp$return (name, local_status);
      IFEND;
    IFEND;

  PROCEND nap$open_procedure;

?? OLDTITLE ??
MODEND nam$access_object_library;
