

PROC qcm$combine_objects, combine_objects  (
  delete_modules, dm         : file = $local.$null
  object_library, ol         : name = $required
  result_object_library, rol : file = $required
  omit_library, oml          : name or key none = none
  no_libraries_merged, nlm   : var of boolean = $optional
  status                     : var of status = $optional
  )


IF NOT $variable(wev$default_file_server defined) THEN
  VAR
    wev$default_file_server : (ENVIRONMENT) string
  VAREND
  check_default_file_server
IFEND
IF NOT $variable(wev$default_dev_base_family defined) THEN
  VAR
    wev$default_dev_base_family : (ENVIRONMENT) string
  VAREND
  set_environment_defaults
IFEND
VAR
  development_base : file = wev$development_base, $fname(wev$default_dev_base_family//'.INTVE')
  wev$development_base : (ENVIRONMENT) string = $string(development_base)
  server_development_base : file = wev$server_development_base, $fname($string(wev$default_file_server)//..
$trim($substr(wev$development_base, $scan_string('.', wev$development_base), $strlen(wev$development_base))))
  wev$server_development_base : (ENVIRONMENT) string = $string(server_development_base)
VAREND
IF $variable(wev$product_name, declared) <> 'LOCAL' THEN
  IF $variable(wev$product_name, declared) <> 'UNKNOWN' THEN
    create_variable wev$product_name k=string scope=xref
  ELSE
    create_variable wev$product_name k=string s=xdcl v='OS'
  IFEND
IFEND
IF $variable(wev$build_level, declared) <> 'LOCAL' THEN
  IF $variable(wev$build_level, declared) <> 'UNKNOWN' THEN
    create_variable wev$build_level kind=string scope=xref
  ELSE
    create_variable wev$build_level kind=string scope=xdcl value='NONE'
  IFEND
IFEND
IF $variable(wev$feature_catalog, declared) <> 'LOCAL' THEN
  IF $variable(wev$feature_catalog, declared) <> 'UNKNOWN' THEN
    create_variable wev$feature_catalog k=string scope=xref
  ELSE
    create_variable wev$feature_catalog k=string s=xdcl v='NONE'
  IFEND
IFEND
IF $variable(wev$feature_build_level, declared) <> 'LOCAL' THEN
  IF $variable(wev$feature_build_level, declared) <> 'UNKNOWN' THEN
    create_variable wev$feature_build_level k=string scope=xref
  ELSE
    create_variable wev$feature_build_level k=string s=xdcl v='OBJECT'
  IFEND
IFEND
IF $variable(wev$working_catalog, declared) <> 'LOCAL' THEN
  IF $variable(wev$working_catalog, declared) <> 'UNKNOWN' THEN
    create_variable wev$working_catalog k=string scope=xref
  ELSE
    create_variable wev$working_catalog k=string s=xdcl v='NONE'
  IFEND
IFEND
IF $variable(wev$working_build_level, declared) <> 'LOCAL' THEN
  IF $variable(wev$working_build_level, declared) <> 'UNKNOWN' THEN
    create_variable wev$working_build_level k=string scope=xref
  ELSE
    create_variable wev$working_build_level k=string s=xdcl v='OBJECT'
  IFEND
IFEND

  create_variable local_status kind=status
  create_variable ignore_status kind=status
  create_variable file_connection_deleted kind=status
  create_variable path_status kind=status
  create_variable object_library kind=string value=$string($value(object_library))
  create_variable bl_path kind=string value=wev$server_development_base//'.'//wev$product_name//'.'//wev$build_level
  create_variable bl_maint_path kind=string value=bl_path//'.MAINTENANCE'
  create_variable bl_file kind=string value=bl_maint_path//'.'//object_library
  create_variable wc_wbl_maint_path kind=string ..
        value=wev$working_catalog//'.'//wev$working_build_level//'.MAINTENANCE'
  create_variable wc_file kind=string value=wc_wbl_maint_path//'.'//object_library
  create_variable wc_file_exists kind=boolean value=false
  create_variable fc_fbl_maint_path kind=string ..
        value=wev$feature_catalog//'.'//wev$feature_build_level//'.MAINTENANCE'
  create_variable fc_file kind=string value=fc_fbl_maint_path//'.'//object_library
  create_variable fc_file_exists kind=boolean value=false
  create_variable possible_to_change_library kind=boolean
  create_variable delete_modules kind=boolean ..
        value=($path($value(delete_modules), last)<>'$NULL')

proc_block: ..
  BLOCK

    IF wev$feature_catalog <> 'NONE' THEN
      display_catalog c=$fname(fc_fbl_maint_path) do=permits o=$null status=path_status
      IF path_status.normal THEN
        IF $file($fname(fc_file), assigned) THEN
          detach_file $fname(fc_file) status=ignore_status
          fc_file_exists = true
        IFEND
      IFEND
    IFEND

    IF wev$working_catalog <> 'NONE' THEN
      display_catalog c=$fname(wc_wbl_maint_path) do=permits o=$null status=path_status
      IF path_status.normal THEN
        IF $file($fname(wc_file), assigned) THEN
          detach_file $fname(wc_file) status=ignore_status
          wc_file_exists = true
        IFEND
      IFEND
    IFEND

    possible_to_change_library = wc_file_exists OR fc_file_exists OR delete_modules
    IF NOT possible_to_change_library THEN
      EXIT proc_block
    IFEND

    CREATE_OBJECT_LIBRARY

    creol_block: ..
      BLOCK

      establish_base: ..
        BLOCK

          display_catalog c=$fname(bl_maint_path) do=permits o=$null status=path_status
          IF path_status.normal THEN
            IF $file($fname(bl_file), assigned) THEN
              add_modules library=$fname(bl_file) status=local_status
              EXIT creol_block WHEN NOT local_status.normal
              EXIT establish_base
            IFEND
          IFEND
          display_catalog c=$fname(bl_path) do=permits o=$null status=path_status
          IF path_status.normal THEN
            bl_file = bl_path // '.' // object_library
            IF $file($fname(bl_file), assigned) THEN
              add_modules library=$fname(bl_file) status=local_status
              EXIT creol_block WHEN NOT local_status.normal
              EXIT establish_base
            IFEND
          IFEND
          local_status = $status(false, 'WE', wee$missing_object_library, object_library, bl_path, bl_maint_path)
          EXIT creol_block
        BLOCKEND establish_base

        put_line ' Combining libraries onto '//$string($value(result_object_library))//'    From:' ..
              o=$response status=ignore_status
        put_line '        '//bl_file o=$response status=ignore_status


        delete_file_connection sf=$local.$errors file=$local.output status=file_connection_deleted

        IF delete_modules THEN
          include_file $value(delete_modules) status=local_status
          EXIT creol_block WHEN NOT local_status.normal
        IFEND

        IF fc_file_exists THEN
          combine_modules library=$fname(fc_file) status=local_status
          EXIT creol_block WHEN NOT local_status.normal
          put_line '        '//fc_file o=$response status=ignore_status
        IFEND

        IF wc_file_exists THEN
          combine_modules library=$fname(wc_file) status=local_status
          EXIT creol_block WHEN NOT local_status.normal
          put_line '        '//wc_file o=$response status=ignore_status
        IFEND

        IF $string($value(omit_library)) <> 'NONE' THEN
          change_module_attributes m=all ol=$value(omit_library) status=local_status
          EXIT creol_block WHEN NOT local_status.normal
        IFEND


        IF object_library = 'OSF$BOOT_MONITOR' THEN
          reorder_modules dsm$boot_interrupt_handler p=before status=ignore_status
        ELSEIF object_library = 'OSF$MONITOR' THEN
          reorder_modules mtm$monitor_interrupt_handler p=before status=ignore_status
        ELSEIF object_library = 'OSF$SYSTEM_CORE_113' THEN
          reorder_modules sym$job_fixed_template p=before status=ignore_status
        IFEND

        generate_library library=$value(result_object_library) status=local_status
        EXIT creol_block WHEN NOT local_status.normal

      BLOCKEND creol_block

      IF file_connection_deleted.normal THEN
        create_file_connection sf=$local.$errors file=$local.output status=ignore_status
      IFEND
    QUIT

    EXIT proc_block WHEN NOT local_status.normal

  BLOCKEND proc_block

  IF $specified(no_libraries_merged) THEN
    $value(no_libraries_merged) = NOT possible_to_change_library
  IFEND

  EXIT_PROC WITH local_status WHEN NOT local_status.normal

PROCEND qcm$combine_objects
