home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 18 REXX / 18-REXX.zip / instfont.zip / FixFont1.CMD next >
OS/2 REXX Batch file  |  1999-04-20  |  20KB  |  553 lines

  1. /*------------------------------------------------------------------------*\
  2. |                                                                          |
  3. |           FIXFONT1.CMD - Version 1.0 - Version Date 1996-08-11           |
  4. |                                                                          |
  5. \*------------------------------------------------------------------------*/
  6. /*
  7.  
  8.    Move all ?:\PSFONTS entries to M:\FONTS\PSFONTS or M:\FONTS\TRUETYPE
  9.    and update OS2.INI file. FIXFONT2 will remove all unregistered fonts
  10.    from \PSFONTS and FIXFONT3 will update all appropriate Windows INI files.
  11.  
  12.    The directory layout, and the files (by extension) within each are:
  13.  
  14.       ORIG-PS     .AFM .INF .PFB .PFM
  15.  
  16.       PSFONTS     .OFM .PFB
  17.              \PFM .PFM
  18.  
  19.       ORIG-TTF    .TDF .TTF
  20.  
  21.       TRUETYPE    .TTF .FOT (path at '400'x)
  22.  
  23.    1) Check PM-Fonts in OS2.INI. If path contains a drive letter, move OFM
  24.       file to M:\FONTS\PSFONTS and change INI file pointer. Move corresponding
  25.       ?:\PSFONTS\*.PFB and ?:\PSFONTS\PFM\*.pfm file.
  26.  
  27. */
  28. GBL. = ''             /* initialize stem */
  29. parse Arg             GBL.CommandLine
  30. parse Version         GBL.RexxVersion,
  31.                       GBL.RexxVersionLevel,
  32.                       GBL.RexxVersionDay,
  33.                       GBL.RexxVersionMonth,
  34.                       GBL.RexxVersionYear    .
  35. parse Source          GBL.OperatingSystem,
  36.                       GBL.CallingEnvironment,
  37.                       GBL.ProgramPathAndName   /* case is unreliable */
  38.  
  39. parse value DATE('S') with,
  40.    year +4,
  41.    mm   +2,
  42.    dd
  43.  
  44. GBL.List            = 'GBL.'
  45. GBL.Environment     = 'OS2ENVIRONMENT'
  46. GBL.BootDrive       = LEFT( VALUE( 'RUNWORKPLACE',, GBL.Environment ), 2 )
  47. GBL.CurrentDate     = mm || '/' || dd || '/' || year
  48. GBL.Hostname        = VALUE( 'MACHINENAME',, GBL.Environment )
  49. GBL.Ramdrive        = VALUE( 'RAMDRIVE',, GBL.Environment )
  50. GBL.ProgramVersion  = 1.0           /* version / mod of this program */
  51. GBL.ProgramName     = STRIP( FILESPEC( 'N', GBL.ProgramPathAndName ) )
  52. GBL.ProgramPath     = STRIP( FILESPEC( 'D', GBL.ProgramPathAndName ) ||,
  53.                              FILESPEC( 'P', GBL.ProgramPathAndName ) )
  54.  
  55. parse var GBL.ProgramName,
  56.    GBL.ProgramFn  '.',
  57.    GBL.ProgramFe
  58. GBL.ProgramFe  = TRANSLATE( GBL.ProgramFe  )
  59. call TIME 'R'                    /* reset elapsed timer - sssss.uuuuu */
  60. say 'Begin' GBL.ProgramFn || '.' || GBL.ProgramFe  'at' TIME('N')
  61.  
  62. /*------------------------*\
  63. |  Enable trap processing  |
  64. |    if REXXLIB present    |
  65. \*------------------------*/
  66.    SIGNAL ON ERROR
  67.    SIGNAL ON FAILURE
  68.    SIGNAL ON HALT
  69.    SIGNAL ON NOVALUE
  70.    SIGNAL ON SYNTAX
  71.  
  72. crlf           = '0D0A'x
  73. font_home_path = 'M:\FONTS\'
  74.  
  75. GBL.LogFile  =,
  76.    GBL.ProgramPath  ||,
  77.    GBL.ProgramFn    || '.LOG'
  78. if STREAM( GBL.LogFile, 'C', 'QUERY EXISTS' ) ¬= '' then
  79.    do
  80.       log_line = crlf || COPIES( '=', 76 )
  81.       call LINEOUT GBL.LogFile, log_line
  82.    end
  83. log_line = GBL.ProgramFn || '.' || GBL.ProgramFe || ' Started on' DATE() 'at' TIME() ' CPU:' GBL.Hostname '-' GBL.OperatingSystem
  84. call LINEOUT GBL.LogFile, log_line
  85.  
  86. /*--------------------------------------*\
  87. |  Create stem with all PM_Font entries  |
  88. \*--------------------------------------*/
  89. app_name = 'PM_Fonts'
  90. call SysIni 'USER', app_name, 'ALL:', 'font_stem'
  91. if RESULT = 'ERROR:' then
  92.    do
  93.       log_line =,
  94.          'Unable to locate' app_name 'in' VALUE( 'USER_INI',, GBL.Environment )
  95.       call LINEOUT GBL.LogFile, log_line
  96.       say log_line
  97.       call EOJ
  98.    end
  99.  
  100. /*------------------------------------*\
  101. |  Move each font with a drive letter  |
  102. |     in its path to the home path     |
  103. \*------------------------------------*/
  104. do f = 1 to font_stem.0
  105.    font_name = font_stem.f
  106.    font_path_and_name =,
  107.       TRANSLATE( STRIP( SysIni( 'USER', app_name, font_name ), 'T', '00'x ) )
  108.    if font_path_and_name = 'ERROR:' then
  109.       do
  110.          say '   Error retrieving path for' font_name 'from' VALUE( 'USER_INI',, GBL.Environment )
  111.          iterate f
  112.       end
  113.  
  114.    ini_font_drive = FILESPEC( 'D', font_path_and_name )
  115.    ini_font_path  = FILESPEC( 'P', font_path_and_name )
  116.    ini_font_name  = FILESPEC( 'N', font_path_and_name )
  117.    parse value ini_font_name with,
  118.       ini_font_fn '.' ini_font_fe
  119.  
  120.    /* Ignore OS/2 default fonts */
  121.    if ini_font_drive = '' then iterate f
  122.    if RIGHT( font_path_and_name, 4 ) = '.FON' then iterate f
  123.  
  124.    /* Ignore fonts that are in correct directory */
  125.    if LEFT( font_path_and_name, LENGTH(font_home_path) ) = font_home_path then iterate f
  126.  
  127.    /* Setup correct sub-directory */
  128.    if ini_font_fe = 'TTF' then
  129.       do
  130.          font_path = font_home_path || 'TRUETYPE\'
  131.          orig_path = font_home_path || 'ORIG-TTF\'
  132.       end
  133.    else
  134.       do
  135.          font_path = font_home_path || 'PSFONTS\'
  136.          orig_path = font_home_path || 'ORIG-PS\'
  137.       end
  138.  
  139.    /*----------------------------------------*\
  140.    |  Copy font from boot drive to home area  |
  141.    \*----------------------------------------*/
  142.    call SysFileTree ini_font_drive || ini_font_path || ini_font_fn ||'.*',,
  143.                     'old_stem', 'FST'
  144.    do i = 1 to old_stem.0
  145.       parse upper value old_stem.i with,
  146.          old_timestamp,
  147.          old_size,
  148.          old_attr,
  149.          old_path_and_file_name
  150.       old_path_and_file_name = STRIP( old_path_and_file_name )
  151.  
  152.       parse value FILESPEC( 'N', old_path_and_file_name ) with,
  153.          old_fn '.' old_fe
  154.       select
  155.          when old_fe = 'AFM' then
  156.             do
  157.                call STOW_FONT_FILE old_path_and_file_name, orig_path || old_fn'.'old_fe, 'R'
  158.                if RESULT = 0 then
  159.                   do
  160.                      call SysFileDelete old_path_and_file_name
  161.                   end
  162.             end
  163.          when old_fe = 'OFM' then
  164.             do
  165.                call STOW_FONT_FILE old_path_and_file_name, font_path || old_fn'.'old_fe, 'R'
  166.                if RESULT = 0 then
  167.                   do
  168.                      call SysFileDelete old_path_and_file_name
  169.                   end
  170.             end
  171.          when old_fe = 'PFB' then
  172.             do
  173.                call STOW_FONT_FILE old_path_and_file_name, orig_path || old_fn'.'old_fe, 'R'
  174.                call STOW_FONT_FILE old_path_and_file_name, font_path || old_fn'.'old_fe, 'R'
  175.                if RESULT = 0 then
  176.                   do
  177.                      call SysFileDelete old_path_and_file_name
  178.                   end
  179.             end
  180.          when old_fe = 'PFM' then
  181.             do
  182.                call STOW_FONT_FILE old_path_and_file_name, orig_path || old_fn'.'old_fe, 'R'
  183.                call STOW_FONT_FILE old_path_and_file_name, font_path || 'PFM\' || old_fn'.'old_fe, 'R'
  184.                if RESULT = 0 then
  185.                   do
  186.                      call SysFileDelete old_path_and_file_name
  187.                   end
  188.             end
  189.          when old_fe = 'FOT' then
  190.             do
  191.                call STOW_FONT_FILE old_path_and_file_name, font_path || old_fn'.'old_fe, 'R'
  192.                /* FixFont3 will delete the original */
  193.             end
  194.          when old_fe = 'TTF' then
  195.             do
  196.                call STOW_FONT_FILE old_path_and_file_name, orig_path || old_fn'.'old_fe, 'R'
  197.                call STOW_FONT_FILE old_path_and_file_name, font_path || old_fn'.'old_fe, 'R'
  198.                /* FixFont3 will delete the original */
  199.             end
  200.          otherwise
  201.             do
  202.                say COPIES( ' ', 3 ) || old_path_and_file_name 'contains an unknown file extension and is ignored'
  203.                iterate i
  204.             end
  205.       end
  206.    end
  207.  
  208. !tr! = VALUE('TRACE',,GBL.Environment); if !tr! <> '' then do;say 'Trace' !tr! 'started';TRACE(!tr!);nop;end
  209.    /*-----------------------*\
  210.    |  Update INI file entry  |
  211.    \*-----------------------*/
  212.    key_value =,
  213.       font_path || old_fn'.'old_fe
  214.    call SysIni 'USER', app_name, font_name, key_value || '00'x
  215.    if RESULT = 'ERROR:' then
  216.       do
  217.          log_line =,
  218.             'Error updating' VALUE( 'USER_INI',, GBL.Environment )':',
  219.             ' App =' app_name';',
  220.             ' Key =' font_name';',
  221.             ' Key value =' key_value
  222.          call LINEOUT GBL.LogFile, log_line
  223.          call logic_error
  224.       end
  225.  
  226. end
  227.  
  228. call EOJ 0
  229.  
  230. /*------------------------------------------------------------------------*\
  231. |                                                                          |
  232. |                 Copy / replace font file as appropriate                  |
  233. |                                                                          |
  234. \*------------------------------------------------------------------------*/
  235. STOW_FONT_FILE:
  236.    Procedure expose,
  237.       (GBL.List)
  238.  
  239. parse ARG source_path_and_file_name, object_path_and_file_name
  240.  
  241. parse value STREAM( source_path_and_file_name, 'C', 'QUERY DATETIME' ) with,
  242.    source_month '-',
  243.    source_day   '-',
  244.    source_yy    ' ',
  245.    source_time
  246. if source_yy < 80 then source_year = '20' || source_yy
  247. else                   source_year = '19' || source_yy
  248. source_timestamp =,
  249.    source_year ||,
  250.    RIGHT( source_month, 2, '0' ) ||,
  251.    RIGHT( source_day,   2, '0' ) ||,
  252.    source_time
  253.  
  254. if STREAM( object_path_and_file_name, 'C', 'QUERY EXISTS' ) ¬= '' then
  255.    do
  256.       parse value STREAM( object_path_and_file_name, 'C', 'QUERY DATETIME' ) with,
  257.          object_month '-',
  258.          object_day   '-',
  259.          object_yy    ' ',
  260.          object_time
  261.       if object_yy < 80 then object_year = '20' || object_yy
  262.       else                   object_year = '19' || object_yy
  263.       object_timestamp =,
  264.          object_year ||,
  265.          RIGHT( object_month, 2, '0' ) ||,
  266.          RIGHT( object_day,   2, '0' ) ||,
  267.          object_time
  268.  
  269.       if source_timestamp <= object_timestamp then
  270.          do
  271.             return 0
  272.          end
  273.    end
  274.  
  275. /*-------------------------------------------*\
  276. |  FOT files must have internal path updated  |
  277. |         others are simply copied            |
  278. \*-------------------------------------------*/
  279. log_line =,
  280.    LEFT( FILESPEC( 'N', source_path_and_file_name ), 13 )
  281.  
  282. parse upper value FILESPEC( 'N', source_path_and_file_name ) with,
  283.    source_fn '.' source_fe
  284.  
  285. if source_fe ¬= 'FOT' then
  286.    do
  287.       copy_rc = DOSCOPY( source_path_and_file_name, object_path_and_file_name, 'R' )
  288.       if copy_rc = 0 then
  289.          do
  290.             log_line = log_line ||,
  291.                'was copied to'
  292.          end
  293.       else
  294.          do
  295.             log_line = log_line ||,
  296.                'could not be copied to'
  297.          end
  298.    end
  299. else
  300.    do
  301.       fot_size = STREAM( source_path_and_file_name, 'C', 'QUERY SIZE' )
  302.       fot_area = CHARIN( source_path_and_file_name, 1, fot_size )
  303.       call STREAM source_path_and_file_name, 'C', 'CLOSE'
  304.  
  305.       ttf_path_and_file_name =,
  306.          FILESPEC( 'D', object_path_and_file_name ) ||,
  307.          FILESPEC( 'P', object_path_and_file_name ) ||,
  308.          source_fn || '.TTF'
  309.       fot_path_ptr  = X2D( 400 ) + 1
  310.       fot_path_lgth = 96
  311.       fot_area =,
  312.          OVERLAY( COPIES( '00'x, fot_path_lgth ), fot_area, fot_path_ptr )
  313.       fot_area =,
  314.          OVERLAY( ttf_path_and_file_name, fot_area, fot_path_ptr )
  315.       call SysFileDelete object_path_and_file_name
  316.       call CHAROUT object_path_and_file_name, fot_area
  317.       call STREAM object_path_and_file_name, 'C', 'CLOSE'
  318.       log_line = log_line ||,
  319.          'was updated and copied to'
  320.       copy_rc = 0
  321.    end
  322.  
  323. log_line = log_line,
  324.    FILESPEC( 'D', object_path_and_file_name ) ||,
  325.    FILESPEC( 'P', object_path_and_file_name ),
  326.    'from',
  327.    FILESPEC( 'D', source_path_and_file_name ) ||,
  328.    FILESPEC( 'P', source_path_and_file_name )
  329. call LINEOUT GBL.LogFile, log_line
  330.  
  331. return copy_rc
  332.  
  333.  
  334. /*------------------------------------------------------------------------*\
  335. |                                                                          |
  336. |                                End of Job                                |
  337. |                                                                          |
  338. \*------------------------------------------------------------------------*/
  339. EOJ:
  340.    Procedure expose,
  341.       GBL.
  342.  
  343. call STREAM GBL.LogFile, 'C', 'CLOSE'
  344.  
  345. if ARG() = 0 then
  346.    eoj_rc = 0
  347. else
  348.    eoj_rc = ARG(1)
  349.  
  350. elapsed_time = TIME('E')            /* get elapsed time - sssss.uuuuu */
  351. parse value elapsed_time with seconds '.' micro_seconds
  352. if LEFT( micro_seconds, 1, 1 ) >= 5 then
  353.    seconds = seconds + 1
  354. ss = FORMAT( seconds // 60, 2 )
  355. minutes = ( seconds - ss ) / 60
  356. mm = FORMAT( minutes // 60, 2 )
  357. hh = FORMAT( ( minutes - mm ) / 60, 2 )
  358. duration = hh':'mm':'ss
  359.  
  360. say 'EOJ   ' || GBL.ProgramFn || '.' || GBL.ProgramFe 'at' TIME('N') ||,
  361.     ', duration' TRANSLATE( duration, '0', ' ' )
  362. exit eoj_rc
  363.  
  364. /*------------------------------------------------------------------------*\
  365. |                                                                          |
  366. |                              Trap Routines                               |
  367. |                                                                          |
  368. \*------------------------------------------------------------------------*/
  369. ERROR:       call TRAP_PROCESSING_01   SIGL, 'ERROR',   RC
  370. FAILURE:     call TRAP_PROCESSING_01   SIGL, 'FAILURE', RC
  371. HALT:        call TRAP_PROCESSING_01   SIGL, 'HALT',    ''
  372. LOGIC_ERROR: call TRAP_PROCESSING_01   SIGL, 'LOGIC',   ARG( 1 )
  373. NOVALUE:     call TRAP_PROCESSING_01   SIGL, 'NOVALUE', ''
  374. SYNTAX:      call TRAP_PROCESSING_01   SIGL, 'SYNTAX',  RC
  375.  
  376. TRAP_PROCESSING_01:
  377.    SIGNAL ON ERROR   name TRAP_PROCESSING_02 /* prevent recursion */
  378.    SIGNAL ON FAILURE name TRAP_PROCESSING_02 /* prevent recursion */
  379.    SIGNAL ON HALT    name TRAP_PROCESSING_02 /* prevent recursion */
  380.    SIGNAL ON NOVALUE name TRAP_PROCESSING_02 /* prevent recursion */
  381.    SIGNAL ON SYNTAX  name TRAP_PROCESSING_02 /* prevent recursion */
  382.    ?Trap.   = ''     /* Revised 98/12/18 */
  383.    TRAP_DMP = ''     /* .DMP path & file name */
  384.    TRAP_DMP_TIMESTAMP = DATE( ) || COPIES(' ', 2 ) || LEFT( TIME('L'),11 )
  385.  
  386. /*---------------------*\
  387. |  Program path & name  |
  388. \*---------------------*/
  389. parse Source  ?Trap.?OperatingSystem . ?Trap.?ProgramPathAndFileName
  390. parse Version ?Trap.?RexxVersion
  391.  
  392. ?Trap.?LineNumber = ARG( 1 )
  393. if POS( ':', ?Trap.?ProgramPathAndFileName ) > 0 then
  394.    /* get source line if it is available */
  395.    do ?T = 1
  396.       TRAP_SOURCE_LINE.?T =  SOURCELINE( ?Trap.?LineNumber )
  397.       TRAP_SOURCE_LINE.0  = ?T
  398.       if TRAP_SOURCE_LINE.?T == '' then
  399.          do
  400.             TRAP_SOURCE_LINE.?T = 'Source is not available'
  401.             leave
  402.          end
  403.       ?Trap.?LineNumber   = ?Trap.?LineNumber + 1
  404.       if RIGHT( TRAP_SOURCE_LINE.?T, 1 ) ¬== ',' then
  405.          do
  406.             leave
  407.          end
  408.    end
  409. else
  410.    /* program is running in macrospace */
  411.    do
  412.       ?Trap.?ProgramPathAndFileName =,
  413.          STRIP( DIRECTORY( ), 'T', '\' ) || '\' ||,
  414.          ?Trap.?ProgramPathAndFileName
  415.       TRAP_SOURCE_LINE.1 = 'Source line is not available.'
  416.       TRAP_SOURCE_LINE.0 = 1
  417.    end
  418.  
  419. parse value FILESPEC( 'N', ?Trap.?ProgramPathAndFileName ) with,
  420.    ?Trap.?Fn '.' ?Trap.?Fe
  421. TRAP_DMP =,
  422.    FILESPEC( 'D', ?Trap.?ProgramPathAndFileName ) ||,
  423.    FILESPEC( 'P', ?Trap.?ProgramPathAndFileName ) ||,
  424.    ?Trap.?Fn || '.' || 'DMP'
  425.  
  426. /*-------------------------------------------*\
  427. |  Determine whether ANSII or VX-REXX output  |
  428. \*-------------------------------------------*/
  429. ?Trap.?VXREXX = ( RxFuncQuery( 'VRWindow' ) = 0 )
  430. if ?Trap.?VXREXX then
  431.    do
  432.       /* see if Primary Window handle exists */
  433.       ?Trap.?VXREXX = ( LEFT( VRWindow( ), 1 ) = '?' )
  434.    end
  435.  
  436. /*------------------------------------------*\
  437. |  Check for reason NOT to create .DMP file  |
  438. \*------------------------------------------*/
  439. select
  440.    when ARG( 2 ) = 'HALT' then
  441.       do
  442.          TRAP_DMP = ''
  443.       end
  444.    when POS( ':', TRAP_DMP ) = 0 then
  445.       do
  446.          TRAP_DMP = ''
  447.       end
  448.    when ABBREV( ?Trap.?RexxVersion, 'OBJREXX' ) then
  449.       do
  450.          if RxFuncQuery( 'SysDumpVariables' ) <> 0 then
  451.             do
  452.                TRAP_DMP = ''
  453.             end
  454.       end
  455.    when ?Trap.?OperatingSystem = 'OS/2' then
  456.       do
  457.          if RxFuncQuery( 'VARDUMP' ) <> 0 then
  458.             do
  459.                TRAP_DMP = ''
  460.             end
  461.       end
  462.    otherwise
  463.       do
  464.          nop
  465.       end
  466. end
  467.  
  468. /*------------------------*\
  469. |  Build trap message box  |
  470. \*------------------------*/
  471. ?DBL.H     = 'CD'x                 /* ═ double line - horizontal   */
  472. ?DBL.V     = 'BA'x                 /* ║ double line - vertical     */
  473. ?DBL.BL    = 'C8'x                 /* ╚ double line - bottom left  */
  474. ?DBL.BR    = 'BC'x                 /* ╝ double line - bottom right */
  475. ?DBL.TL    = 'C9'x                 /* ╔ double line - top left     */
  476. ?DBL.TR    = 'BB'x                 /* ╗ double line - top right    */
  477. if ?Trap.?OperatingSystem ¬== 'WindowsNT' then
  478.    do
  479.       ?Trap.?RED = '1B'x || '[1;37;41m'  /* bright white on red    */
  480.       ?Trap.?DUL = '1B'x || '[0m'        /* reset to normal        */
  481.    end
  482. ?Trap.?Margin = COPIES( ' ', 2 )
  483.  
  484. TRAP_ERROR_DESCRIPTION =,
  485.    'Error line = ' || ARG( 1 ) || '; ' || ARG( 2 ) || ' trap caught'
  486. if ARG( 3 ) <> '' then
  487.    TRAP_ERROR_DESCRIPTION = TRAP_ERROR_DESCRIPTION ||,
  488.       '  Return code = ' || ARG( 3 )
  489.  
  490. ?T=0
  491. ?T=?T+1; ?Trap.?line.?T = ?Trap.?Fn'.'?Trap.?Fe
  492. ?T=?T+1; ?Trap.?line.?T = TRAP_ERROR_DESCRIPTION
  493. if TRAP_DMP <> '' then
  494.    do
  495. ?T=?T+1; ?Trap.?line.?T = ''
  496. ?T=?T+1; ?Trap.?line.?T = 'See: ' || TRAP_DMP
  497.    end
  498. ?T=?T+1; ?Trap.?line.?T = ''
  499. ?T=?T+1; ?Trap.?line.?T = 'Source line(s) at time of trap:'
  500. do ?S = 1 to TRAP_SOURCE_LINE.0
  501.    ?T=?T+1; ?Trap.?line.?T = ?Trap.?Margin || TRAP_SOURCE_LINE.?S
  502. end
  503.          ?Trap.?line.0 = ?T
  504. if ?Trap.?VXREXX then
  505.    do
  506.       ?Trap.?PrimaryWindowHandle = VRWindow( )
  507.       call VRSet  ?Trap.?PrimaryWindowHandle,,
  508.                   'BackColor',      'White',,
  509.                   'ForeColor',      'Red',,
  510.                   ''
  511.  
  512.       call VRMessageStem ?Trap.?PrimaryWindowHandle,,
  513.                          '?Trap.?line.',,
  514.                          CENTER( ?Trap.?Fn 'Fatal error', 74 ),,
  515.                          'E'
  516.    end
  517. else
  518.    do
  519.       ?Trap.?Width = MAX( 74, LENGTH( TRAP_ERROR_DESCRIPTION ) )
  520.       say ?Trap.?RED || ?DBL.TL || COPIES( ?DBL.H,?Trap.?Width + 2 ) || ?DBL.TR || ?Trap.?DUL
  521.       say ?Trap.?RED || ?DBL.V  || COPIES( ' ',   ?Trap.?Width + 2 ) || ?DBL.V  || ?Trap.?DUL
  522.       do ?T = 1 to ?Trap.?line.0
  523.       say ?Trap.?RED || ?DBL.V    LEFT( ?Trap.?line.?T, ?Trap.?Width )   ?DBL.V  || ?Trap.?DUL
  524.       end
  525.       say ?Trap.?RED || ?DBL.V  || COPIES( ' ',   ?Trap.?Width + 2 ) || ?DBL.V  || ?Trap.?DUL
  526.       say ?Trap.?RED || ?DBL.BL || COPIES( ?DBL.H,?Trap.?Width + 2 ) || ?DBL.BR || ?Trap.?DUL
  527.    end
  528.  
  529. /*---------------------------------*\
  530. |  Create .DMP file if appropriate  |
  531. \*---------------------------------*/
  532. if TRAP_DMP <> '' then
  533.    do
  534.       /* remove meaningless labels from dump for clarity */
  535.       drop ( GBL.DumpExclusionList )
  536.       drop ?dbl. ?Trap. ?S ?T ?tr?
  537.       call SysFileDelete TRAP_DMP
  538.       select
  539.          when RxFuncQuery( 'VARDUMP' ) == 0 then
  540.             do
  541.                call VARDUMP TRAP_DMP  /* write variables to program.DMP file */
  542.             end
  543.          when RxFuncQuery( 'SysDumpVariables' ) == 0 then
  544.             do
  545.                call SysDumpVariables TRAP_DMP  /* write variables to program.DMP file */
  546.             end
  547.          otherwise; nop
  548.       end
  549.    end
  550.  
  551. TRAP_PROCESSING_02:
  552.    exit 255
  553.