home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
OS/2 Shareware BBS: 18 REXX
/
18-REXX.zip
/
listin.zip
/
LISTINI.CMD
< prev
next >
Wrap
OS/2 REXX Batch file
|
1994-12-25
|
73KB
|
1,049 lines
/*------------------------------------------------------------------------*\
| |
| LISTINI.CMD - Version 2.2 - Version Date 1994-12-25 |
| Copyright (C) 1994 by C F S Nevada, Inc. |
| |
| by Dick Goran - Voice 702-732-9616 |
| - FAX 702-732-3847 |
| - CIS 71154,2002 |
| - Internet dgoran@cfsrexx.com |
| |
| 03/30/94 - Shift "partial" right |
| |
| 12/25/94 - Ignore the "colors" application names if the environment |
| variable COLORS=NO has been set. |
| |
| ------------------------------------------------------------------------ |
| REXXLIB.DLL - OS/2 REXX external function library |
| (c) Copyright 1992-94 Quercus Systems |
\*------------------------------------------------------------------------*/
parse Version REXX_Version . /* 0020 */
parse Source OS_Name, /* 0021 */
Calling_Environment, /* 0022 */
program_path_and_name /* 0023 */
GBL.environment = 'OS2ENVIRONMENT' /* 0024 */
GBL.program_name = FILESPEC( 'N', program_path_and_name ) /* 0025 */
GBL.program_path = FILESPEC( 'D', program_path_and_name ) ||, /* 0026 */
FILESPEC( 'P', program_path_and_name ) /* 0027 */
GBL.program_version = 2.2 /* version / mod of this program */
call TIME 'E' /* set elapsed timer - sssss.uuuuu */
/* 0030 */
say 'Begin' GBL.program_name 'at' TIME('N') /* 0031 */
call REGISTER_REQUIRED_FUNCTIONS /* 0032 */
/* 0033 */
SIGNAL ON ERROR /* trap object time errors */
SIGNAL ON FAILURE /* trap object time errors */
SIGNAL ON HALT /* trap object time errors */
SIGNAL ON NOVALUE /* trap object time errors */
SIGNAL ON SYNTAX /* trap object time errors */
/*01---------------------------------------------------*
* *
* Get optional input parameters: *
* *
* 1) SHORT | long - short vs. long form output *
* 2) file_name - output file name *
* 3) INI file name *
* *
* default: S, LISTINI.SHT, BOTH *
* *
*-----------------------------------------------------*/
syslst_format = 'S' /* default is short form output */ /* 0051 */
syslst = 'LISTINI.SHT' /* default is ?:\program_path\LISTINI.??? */
/* 0053 */
/*---------------------------*\ /* 0054 */
| Processs input parameters | /* 0055 */
\*---------------------------*/ /* 0056 */
parse upper arg input_parameters /* 0057 */
parse value input_parameters with short_vs_long, /* 0058 */
',' output_device, /* 0059 */
',' ini_arg_name /* 0060 */
/* 0061 */
/*----------------------------------*\ /* 0062 */
| Format of output - SHORT or long | /* 0063 */
\*----------------------------------*/ /* 0064 */
select /* 0065 */
when ABBREV( 'LONG', short_vs_long, 1 ) then /* 0066 */
do /* 0067 */
syslst_format = 'L' /* 0068 */
syslst = LEFT( GBL.program_name, LENGTH(GBL.program_name) - 3 ) ||,
'LNG' /* 0070 */
end /* 0071 */
when ABBREV( 'SHORT', short_vs_long, 1 ) then /* 0072 */
do /* 0073 */
syslst_format = 'S' /* 0074 */
syslst = LEFT( GBL.program_name, LENGTH(GBL.program_name) - 3 ) ||,
'SHT' /* 0076 */
end /* 0077 */
when short_vs_long = '' then nop /* 0078 */
otherwise /* 0079 */
do /* 0080 */
say ' ' /* 0081 */
say 'Parameters required as follws:' /* 0082 */
say ' ' /* 0083 */
call LIST_SOURCE_STATEMENTS 01 /* 0084 */
end /* 0085 */
end /* 0086 */
/* 0087 */
/*--------------------------------*\ /* 0088 */
| Validate output device or file | /* 0089 */
\*--------------------------------*/ /* 0090 */
output_device = STRIP(output_device) /* 0091 */
char_1 = LEFT( output_device, 1 ) /* get leading character of file name */
if ( char_1 = '"' ) | ( char_1 = "'" ) then /* 0093 */
output_device = STRIP( output_device, 'B', char_1 ) /* 0094 */
/* 0095 */
/* assure that 2nd parameter was not omitted accidentally */ /* 0096 */
if output_device \= '' then /* 0097 */
do /* 0098 */
if RIGHT( output_device, 4 ) = '.INI' then /* 0099 */
do /* 0100 */
ini_arg_name = output_device /* 0101 */
output_device = '' /* 0102 */
say ini_arg_name 'is assumed to be the Ini file name' /* 0103 */
say '^C to quit or <Enter> to continue' /* 0104 */
pull /* 0105 */
end /* 0106 */
else /* 0107 */
do /* 0108 */
syslst = output_device /* 0109 */
end /* 0110 */
end /* 0111 */
/* 0112 */
/*-------------------------------------------*\ /* 0113 */
| Determine which INI files to use as input | /* 0114 */
\*-------------------------------------------*/ /* 0115 */
ini_arg_name = STRIP(ini_arg_name) /* 0116 */
ini_attributes_and_file_name = '' /* attributes of user specified INI file */
/* 0118 */
char_1 = LEFT( ini_arg_name, 1 ) /* get leading character of file name */
if ( char_1 = '"' ) | ( char_1 = "'" ) then /* 0120 */
ini_arg_name = STRIP( ini_arg_name, 'B', char_1 ) /* 0121 */
/* 0122 */
select /* 0123 */
when ini_arg_name = '' then /* 0124 */
ini_file_name = 'BOTH' /* 0125 */
when ini_arg_name = 'BOTH' then /* 0126 */
ini_file_name = 'BOTH' /* 0127 */
when ini_arg_name = 'USER' then /* 0128 */
ini_file_name = VALUE( 'USER_INI',, GBL.environment ) /* 0129 */
when ini_arg_name = 'SYSTEM' then /* 0130 */
ini_file_name = VALUE( 'SYSTEM_INI',, GBL.environment ) /* 0131 */
otherwise /* 0132 */
do /* 0133 */
call SysFileTree ini_arg_name, 'ini_file_stem' /* 0134 */
if ini_file_stem.0 ¬= 1 then /* 0135 */
do /* 0136 */
say ' Unable to locate' ini_arg_name /* 0137 */
call EOJ /* 0138 */
end /* 0139 */
parse value ini_file_stem.1 with, /* 0140 */
ini_file_date, /* 0141 */
ini_file_time, /* 0142 */
ini_file_size, /* 0143 */
ini_file_attr, /* 0144 */
ini_file_name /* 0145 */
ini_file_name = STRIP( ini_file_name ) /* 0146 */
if SUBSTR( ini_file_attr, 3, 1 ) = 'H' then /* 0147 */
do /* 0148 */
'@attrib' '"'ini_file_name'"' '-h' /* 0149 */
end /* 0150 */
end /* 0151 */
end /* 0152 */
/* 0153 */
syslst_device_type = STREAM( syslst, 'C', 'Query Exists' ) /* /* 0154 */
device vs. file ID */
syslst_line_ct = 999 /* nbr of lines on current page */
syslst_line_max = 59 /* default is 60 lines per page */
syslst_line_width = 76 /* arbitrary (not exactly) page width */
syslst_page_ct = 0 /* current page number */
col_1_width = 20 + 1 /* print column width - incl space delimiter */
col_2_width = 20 + 1 /* print column width - incl space delimiter */
col_3_width = LENGTH("Len='....'x ") /* 0162 */
col_4_width = syslst_line_width -, /* 0163 */
(col_1_width + col_2_width + col_3_width) /* 0164 */
short_hex_prefix = COPIES( ' ', col_1_width + col_2_width + col_3_width - 1 ) ||,
'|' /* 0166 */
long_hex_prefix = COPIES( ' ', 11 ) /* 0167 */
/* 0168 */
/* used for hex display of data */ /* 0169 */
contig_hex_tt = XRANGE('01'x, '21'x) /* 0170 */
spread_hex_tt = XRANGE('01'x, '08'x) || '21'x ||, /* 0171 */
XRANGE('09'x, '10'x) || '21'x ||, /* 0172 */
XRANGE('11'x, '18'x) || '21'x ||, /* 0173 */
XRANGE('19'x, '20'x) /* 0174 */
/* 0175 */
tt_128 = COPIES( '.', 32 ) || XRANGE('20'X, '7F'X) || COPIES( '.', 128 )
tt_256 = '2E01 0203 0405 062E 2E2E 2E0B 0C2E 0E0F'X ||, /* 0177 */
'1011 1213 1415 1617 1819 1A2E 1C1D 1E1F'X ||, /* 0178 */
XRANGE('20'X, 'FE'X) || '.' /* 0179 */
/* 0180 */
/*------------------------*\ /* 0181 */
| setup centered heading | /* 0182 */
\*------------------------*/ /* 0183 */
heading_1 = DATE('U') TIME('N') /* left side of heading */
title_1_ini_name = ini_file_name /* 0185 */
if title_1_ini_name = 'BOTH' then /* 0186 */
do /* 0187 */
title_1_ini_name =, /* 0188 */
FILESPEC( 'D', VALUE( 'USER_INI',, GBL.environment ) ) ||,
FILESPEC( 'P', VALUE( 'USER_INI',, GBL.environment ) ) ||,
'*.INI' /* 0191 */
end /* 0192 */
title_1 = TRANSLATE( GBL.program_name ) GBL.program_version ||, /* 0193 */
' - List of ' ||, /* 0194 */
title_1_ini_name /* 0195 */
title_1_space_count = MAX( 1, ( syslst_line_width -, /* 0196 */
LENGTH(heading_1) - 8 -, /* 0197 */
LENGTH(title_1) ) % 2 ) /* 0198 */
title_1_spaces = COPIES( ' ', title_1_space_count ) /* 0199 */
heading_1 = heading_1 || title_1_spaces || title_1 || title_1_spaces || 'Page'
if LEFT( ini_file_name, 2 ) = ':\' then /* 0201 */
do /* 0202 */
heading_1a = CENTER(, /* 0203 */
ini_file_name ||, /* 0204 */
COPIES( ' ', 3 ) ||, /* 0205 */
STREAM( ini_file_name, 'C', 'QUERY DATETIME' ),
, LENGTH(heading_1) ) /* 0207 */
end /* 0208 */
else /* 0209 */
heading_1a = '' /* 0210 */
heading_2 = LEFT( 'Application Name', col_1_width ) ||, /* 0211 */
LEFT( 'Key Name', col_2_width ) ||, /* 0212 */
LEFT( 'Length', col_3_width ) ||, /* 0213 */
LEFT( 'Contents', col_4_width ) /* 0214 */
heading_3 = COPIES( '-', col_1_width - 2 ) || COPIES( ' ', 2 ) ||,
COPIES( '-', col_2_width - 2 ) || COPIES( ' ', 2 ) ||,
COPIES( '-', col_3_width - 2 ) || COPIES( ' ', 2 ) ||,
COPIES( '-', col_4_width ) /* 0218 */
/* 0219 */
/*---------------------------------*\ /* 0220 */
| delete output file if it exists | /* 0221 */
\*---------------------------------*/ /* 0222 */
call SysFileDelete syslst /* erase any previous file */
call STREAM syslst, 'C', 'OPEN' /* create file entry */ /* 0224 */
say 'Listing ' ||, /* 0225 */
title_1_ini_name ||, /* 0226 */
' on ' ||, /* 0227 */
STREAM( syslst, 'C', 'QUERY EXISTS' ) /* 0228 */
/* 0229 */
/*---------------------------*\ /* 0230 */
| Get All Application Names | /* 0231 */
\*---------------------------*/ /* 0232 */
Apps. = '' /* 0233 */
Both_Index. = '' /* 0234 */
System_Apps. = '' /* 0235 */
User_Apps. = '' /* 0236 */
/* 0237 */
if ini_file_name = 'BOTH' then /* 0238 */
do /* 0239 */
/*--------------------------------------------------*\ /* 0240 */
| Build index from both OS2SYS.INI & OS2.INI | /* 0241 */
\*--------------------------------------------------*/ /* 0242 */
call SysIni 'SYSTEM', 'ALL:', 'System_Apps' /* 0243 */
do i = 1 to System_Apps.0 /* 0244 */
application_name = System_Apps.i /* 0245 */
Both_Index.application_name = 'S ' /* 0246 */
end /* 0247 */
call SysIni 'USER', 'ALL:', 'User_Apps' /* 0248 */
do i = 1 to User_Apps.0 /* 0249 */
application_name = User_Apps.i /* 0250 */
if Both_Index.application_name = '' then /* 0251 */
do /* 0252 */
Both_Index.application_name = 'U ' /* 0253 */
end /* 0254 */
else /* 0255 */
do /* 0256 */
Both_Index.application_name = 'B ' /* 0257 */
end /* 0258 */
end /* 0259 */
end /* 0260 */
/* 0261 */
call SysIni ini_file_name, 'ALL:', 'Apps' /* 0262 */
if RESULT \= '' then /* 0263 */
do /* 0264 */
say 'SysIni returned' RESULT 'from ALL query' /* 0265 */
call EOJ /* 0266 */
end /* 0267 */
if Apps.0 = 0 then /* 0268 */
do /* 0269 */
Say ini_file_name 'exists but contains no keys' /* 0270 */
call EOJ /* 0271 */
end /* 0272 */
if RxFuncQuery('ARRAYSORT') = 0 then /* 0273 */
do /* 0274 */
/* sort application names */ /* 0275 */
call ARRAYSORT 'Apps', 1, Apps.0 /* 0276 */
end /* 0277 */
/* 0278 */
/* find longest application name */ /* 0279 */
apps_max_name_length = 0 /* for displaying names consistently */
do i = 1 to Apps.0 /* 0281 */
apps_max_name_length = MAX( apps_max_name_length, LENGTH(Apps.i) )
end /* 0283 */
/* 0284 */
/*------------------------------------------------------------------------*\
| |
| Get Keys For All Applications and Produce Listing File |
| |
\*------------------------------------------------------------------------*/
bksp = '08'x /* 0290 */
progress_list = '─\|/' /* 0291 */
progress_subscript = 1 /* 0292 */
ignore_colors = ( TRANSLATE( VALUE( 'COLORS',, GBL.environment ) ) = 'NO' )
/* 0294 */
do app_number = 1 to Apps.0 /* 0295 */
application_name = Apps.app_number /* 0296 */
if ignore_colors then /* 0297 */
if LEFT( application_name, 3 ) = 'PM_', /* 0298 */
&, /* 0299 */
RIGHT( application_name, 6 ) = 'Colors' then iterate /* 0300 */
/* 0301 */
call CHAROUT 'CON:', 'Processing ' ||, /* 0302 */
LEFT( application_name, apps_max_name_length ) ||,
COPIES( ' ', 2 ) /* 0304 */
call SysCurState 'OFF' /* 0305 */
call SysIni ini_file_name, application_name, 'ALL:', 'Keys' /* 0306 */
if RESULT \= '' then /* 0307 */
do /* 0308 */
say 'SysIni returned ' ||, /* 0309 */
RESULT ||, /* 0310 */
' from ' ||, /* 0311 */
application_name ||, /* 0312 */
' query' /* 0313 */
call EOJ /* 0314 */
end /* 0315 */
/* 0316 */
if ( RxFuncQuery('ARRAYSORT') = 0 ) & ( keys.0 > 1 ) then /* 0317 */
do /* 0318 */
/* sort key names */ /* 0319 */
call ARRAYSORT 'Keys', 1, Keys.0 /* 0320 */
end /* 0321 */
/* 0322 */
/* Prefix System, User or Both */ /* 0323 */
output_line = Both_Index.application_name ||, /* 0324 */
application_name /* 0325 */
/* 0326 */
/*---------------------------------------*\ /* 0327 */
| Process each key for this application | /* 0328 */
\*---------------------------------------*/ /* 0329 */
do key_number = 1 to Keys.0 /* 0330 */
call CHAROUT 'CON:', bksp ||, /* 0331 */
SUBSTR( progress_list, progress_subscript, 1 )
progress_subscript = progress_subscript + 1 /* 0333 */
if progress_subscript > LENGTH(progress_list) then /* 0334 */
progress_subscript = 1 /* 0335 */
/* 0336 */
key_value = SysIni( ini_file_name, application_name, Keys.key_number )
hex_key_length = D2X( LENGTH(key_value), 4 ) /* 0338 */
if LENGTH(output_line) < col_1_width then /* 0339 */
do /* 0340 */
/* pad output line */ /* 0341 */
output_line = LEFT( output_line , col_1_width ) /* 0342 */
end /* 0343 */
else /* 0344 */
do /* 0345 */
/* print long line first */ /* 0346 */
call PRINT_ROUTINE /* 0347 */
output_line = COPIES( ' ', col_1_width ) /* 0348 */
end /* 0349 */
/* 0350 */
output_line = output_line ||, /* 0351 */
TRANSLATE( Keys.key_number, tt_256 ) /* 0352 */
if LENGTH(output_line) < (col_1_width + col_2_width) then /* 0353 */
do /* 0354 */
/* pad output line */ /* 0355 */
output_line = LEFT(output_line,, /* 0356 */
col_1_width + col_2_width ) /* 0357 */
end /* 0358 */
else /* 0359 */
do /* 0360 */
/* print long line first */ /* 0361 */
call PRINT_ROUTINE /* 0362 */
output_line = COPIES( ' ', col_1_width + col_2_width )
end /* 0364 */
/* 0365 */
output_line = output_line ||, /* 0366 */
"Len='" ||, /* 0367 */
hex_key_length ||, /* 0368 */
"'x" ||, /* 0369 */
COPIES( ' ', 2 ) /* 0370 */
/* 0371 */
single_line_key_value = key_value /* 0372 */
if ( LENGTH(key_value) > 1 ) & ( RIGHT( key_value, 1 ) = '00'x ) then
do /* 0374 */
single_line_key_value = LEFT( key_value, LENGTH(key_value) - 1 )
end /* 0376 */
printable_key_value = TRANSLATE( single_line_key_value, tt_128 )
if ( printable_key_value = single_line_key_value ) &, /* 0378 */
( LENGTH(printable_key_value) <= col_4_width ) then /* 0379 */
do /* 0380 */
call FORMAT_SINGLE_LINE_KEYS /* 0381 */
end /* 0382 */
else /* 0383 */
if ( syslst_format = 'S') | ( LENGTH(key_value) <= 8 ) then
do /* 0385 */
call FORMAT_SINGLE_LINE_KEYS /* 0386 */
end /* 0387 */
else /* 0388 */
call FORMAT_MULTI_LINE_KEYS /* 0389 */
output_line = '' /* 0390 */
end /* 0391 */
call LINEOUT 'CON:', bksp || ' - completed.' /* 0392 */
call SysCurState 'ON' /* 0393 */
/* 0394 */
end /* 0395 */
/* 0396 */
if LEFT( syslst_device_type, 4 ) = '\DEV' then /* 0397 */
call CHAROUT syslst, '0C'x /* eject page */
call CHAROUT syslst /* close output file */
/* 0400 */
if ini_attributes_and_file_name <> '' then /* 0401 */
do /* 0402 */
ini_attributes = STRIP( LEFT( ini_attributes_and_file_name,,
LENGTH( ini_attributes_and_file_name ) -,
LENGTH( ini_file_name ) ) ) /* 0405 */
if POS( 'S', ini_attributes ) > 0 then /* 0406 */
'@attrib ' || ini_file_name || ' +s' /* 0407 */
if POS( 'H', ini_attributes ) > 0 then /* 0408 */
'@attrib ' || ini_file_name || ' +h' /* 0409 */
end /* 0410 */
call EOJ /* 0411 */
/* 0412 */
/*------------------------------------------------------------------------*\
| |
| Key Values Will Fit On Same Line |
| |
\*------------------------------------------------------------------------*/
FORMAT_SINGLE_LINE_KEYS: /* 0418 */
if printable_key_value = single_line_key_value then /* 0419 */
do /* 0420 */
output_line = output_line ||, /* 0421 */
LEFT( printable_key_value, MIN( col_4_width,, /* 0422 */
LENGTH(printable_key_value) ) )
if RIGHT( key_value, 1 ) = '00'x then /* 0424 */
output_line = output_line || '.' /* 0425 */
call PRINT_ROUTINE /* 0426 */
return /* 0427 */
end /* 0428 */
/* 0429 */
temp_key_value = LEFT( key_value, MIN( 8, LENGTH(key_value) ) ) /* 0430 */
hex_string = TRANSLATE( spread_hex_tt,, /* 0431 */
C2X(temp_key_value),, /* 0432 */
contig_hex_tt ) /* 0433 */
output_line = output_line ||, /* 0434 */
'''' ||, /* 0435 */
STRIP(hex_string) /* 0436 */
if temp_key_value <> key_value then /* 0437 */
do /* 0438 */
output_line = output_line || COPIES( ' ', 1 ) /* 0439 */
end /* 0440 */
output_line = output_line ||, /* 0441 */
'''x' /* 0442 */
call PRINT_ROUTINE /* 0443 */
return /* 0444 */
/* 0445 */
/*------------------------------------------------------------------------*\
| |
| Key Values Will Require Multiple Print Lines |
| |
\*------------------------------------------------------------------------*/
FORMAT_MULTI_LINE_KEYS: /* 0451 */
call PRINT_ROUTINE /* 0452 */
/* 0453 */
hex_displacement = 0 /* 0454 */
prev_character_string = '' /* 0455 */
sameness_switch = 0 /* 0456 */
/* 0457 */
/* check for special hex display lengths */ /* 0458 */
partial_key_switch = 'partial' /* 0459 */
select /* 0460 */
when application_name = 'PM_Abstract:Icons' then /* 0461 */
key_value = LEFT( key_value, 72 ) /* 0462 */
otherwise /* 0463 */
partial_key_switch = '' /* 0464 */
end /* 0465 */
/* 0466 */
do until key_value = '' /* 0467 */
parse value key_value with leading_token 17 key_value /* 0468 */
/* 0469 */
temp_character_string = LEFT( leading_token, 16 ) /* 0470 */
if temp_character_string <> prev_character_string then /* 0471 */
do /* 0472 */
temp_hex_string = TRANSLATE( spread_hex_tt,, /* 0473 */
C2X(temp_character_string),,
contig_hex_tt ) /* 0475 */
word_count = ( LENGTH(leading_token) - 1 ) % 4 /* 0476 */
byte_count = LENGTH(leading_token) - ( 4 * word_count ) /* 0477 */
temp_hex_length = ( 9 * word_count ) + ( 2 * byte_count )
output_line = COPIES( ' ', 06 ) ||, /* 0479 */
'+' || D2X( hex_displacement, 4 ) ||, /* 0480 */
COPIES( ' ', 3 ) ||, /* 0481 */
'| ' ||, /* 0482 */
LEFT( temp_hex_string, temp_hex_length ) ||,
COPIES( ' ', 35 - temp_hex_length ) ||, /* 0484 */
' |' ||, /* 0485 */
COPIES( ' ', 2 ) ||, /* 0486 */
TRANSLATE( temp_character_string, tt_128 ) /* 0487 */
if key_value = '' then /* 0488 */
output_line = OVERLAY( partial_key_switch,, /* 0489 */
output_line,, /* 0490 */
syslst_line_width -, /* 0491 */
LENGTH(partial_key_switch) + 1 )
call PRINT_ROUTINE /* 0493 */
sameness_switch = 0 /* 0494 */
end /* 0495 */
else /* 0496 */
if sameness_switch = 0 then /* 0497 */
do /* 0498 */
output_line = COPIES( ' ', 06 ) ||, /* 0499 */
'+' || D2X( hex_displacement, 4 ) ||, /* 0500 */
COPIES( ' ', 3 ) ||, /* 0501 */
'| ' ||, /* 0502 */
LEFT( 'same', 35 ) ||, /* 0503 */
' |' /* 0504 */
call PRINT_ROUTINE /* 0505 */
sameness_switch = 1 /* 0506 */
end /* 0507 */
/* 0508 */
hex_displacement = hex_displacement + 16 /* 0509 */
prev_character_string = temp_character_string /* 0510 */
end /* 0511 */
return /* 0512 */
/* 0513 */
/*------------------------------------------------------------------------*\
| |
| List program source comments |
| |
\*------------------------------------------------------------------------*/
LIST_SOURCE_STATEMENTS: /* 0519 */
parse arg comment_group /* 0520 */
comment_group_switch = 0 /* 0521 */
asterisk_slash = '*' || '/' /* keep 2 characters separated */
slash_asterisk = '/' || '*' /* keep 2 characters separated */
do forever /* 0524 */
if LINES(program_path_and_name) = 0 then CALL EOJ 255 /* 0525 */
input_line = LINEIN(program_path_and_name) /* 0526 */
slash_asterisk_pos = POS( slash_asterisk, input_line ) /* 0527 */
if slash_asterisk_pos > 0 then /* 0528 */
if SUBSTR( input_line,, /* 0529 */
slash_asterisk_pos + 2,, /* 0530 */
LENGTH(comment_group) ) = comment_group then /* 0531 */
comment_group_switch = 1 /* 0532 */
if comment_group_switch = 1 then /* 0533 */
say input_line /* 0534 */
if comment_group_switch = 1 then /* 0535 */
if POS( asterisk_slash, input_line ) > 0 then CALL EOJ 255 /* 0536 */
end /* 0537 */
/* 0538 */
/*------------------------------------------------------------------------*\
| |
| Print Routine - Includes Headings |
| |
\*------------------------------------------------------------------------*/
PRINT_ROUTINE: /* 0544 */
if syslst_line_ct > syslst_line_max then /* 0545 */
do /* 0546 */
syslst_page_ct = syslst_page_ct + 1 /* 0547 */
syslst_line_ct = 0 /* 0548 */
if syslst_page_ct = 1 | (LEFT( syslst_device_type, 4 ) = '\DEV') then
do /* 0550 */
call LINEOUT syslst, heading_1 || FORMAT( syslst_page_ct, 4 )
if heading_1a <> '' then /* 0552 */
do /* 0553 */
call LINEOUT syslst, heading_1a /* 0554 */
syslst_line_ct = syslst_line_ct + 1 /* 0555 */
end /* 0556 */
call LINEOUT syslst, ' ' /* 0557 */
call LINEOUT syslst, heading_2 /* 0558 */
call LINEOUT syslst, heading_3 /* 0559 */
end /* 0560 */
syslst_line_ct = syslst_line_ct + 4 /* 0561 */
end /* 0562 */
call LINEOUT syslst, output_line /* 0563 */
syslst_line_ct = syslst_line_ct + 1 /* 0564 */
return /* 0565 */
/* 0566 */
/*------------------------------------------------------------------------*\
| |
| Register external function routines |
| |
\*------------------------------------------------------------------------*/
REGISTER_REQUIRED_FUNCTIONS: /* 0572 */
/* 0573 */
/*----------------------------------------*\ /* 0574 */
| Load REXXUtil External Function Module | /* 0575 */
\*----------------------------------------*/ /* 0576 */
function_name = 'SysLoadFuncs' /* 0577 */
entry_name = 'SysLoadFuncs' /* 0578 */
module = 'RexxUtil' /* 0579 */
anticipated_return = '' /* 0580 */
call REGISTER_ROUTINE function_name module entry_name anticipated_return
/* 0582 */
/*-----------------------------------*\ /* 0583 */
| Load the REXXLIB Function Package | /* 0584 */
\*-----------------------------------*/ /* 0585 */
if REXX_Version = 'REXX/Personal' then /* 0586 */
do /* 0587 */
module = 'qrexxlib' /* 0588 */
end /* 0589 */
else /* 0590 */
do /* 0591 */
module = 'rexxlib' /* 0592 */
end /* 0593 */
entry_name = 'rexxlibregister' /* 0594 */
function_name = 'RexxLibRegister' /* 0595 */
anticipated_return = '1' /* 0596 */
call REGISTER_ROUTINE function_name module entry_name anticipated_return
/* 0598 */
return /* 0599 */
/* 0600 */
/* 0601 */
/*---------------------*\ /* 0602 */
| Register Subroutine | /* 0603 */
\*---------------------*/ /* 0604 */
REGISTER_ROUTINE: /* 0605 */
parse ARG function_name, /* 0606 */
module, /* 0607 */
entry_name, /* 0608 */
anticipated_return /* 0609 */
/* 0610 */
if RxFuncQuery(function_name) = 0 then return /* function registered */
/* 0612 */
if LENGTH(module) > 8 then /* 0613 */
do /* 0614 */
dll_drive = FILESPEC( 'D', module ) /* 0615 */
dll_path = STRIP( FILESPEC( 'P', module ), 'T', '\' ) /* 0616 */
module = FILESPEC( 'N', module ) /* 0617 */
'@' || dll_drive /* 0618 */
'@cd' dll_drive || dll_path /* 0619 */
end /* 0620 */
else /* 0621 */
do /* 0622 */
dll_drive = '' /* 0623 */
end /* 0624 */
/* 0625 */
parse var module module_fname '.' module_fext /* 0626 */
if RxFuncAdd( function_name, module_fname, entry_name ) = 0 then /* 0627 */
do /* 0628 */
register_call = 'call' function_name /* 0629 */
interpret register_call /* 0630 */
if WORD( RESULT, 1 ) <> WORD( anticipated_return, 1 ) then /* 0631 */
do /* 0632 */
Say function_name 'returned' RESULT '-', /* 0633 */
anticipated_return 'was expected'
exit 255 /* 0635 */
end /* 0636 */
end /* 0637 */
else /* 0638 */
do /* 0639 */
Say 'RxFuncAdd returned' RESULT 'registering' module /* 0640 */
exit 254 /* 0641 */
end /* 0642 */
if dll_drive <> '' then /* 0643 */
do /* 0644 */
'@' || LEFT( program_path_and_name, 2 ) /* 0645 */
end /* 0646 */
return /* 0647 */
/* 0648 */
/* 0649 */
!tr! = VALUE('TRACE',,'OS2Environment'); if !tr! <> '' then do; TRACE(!tr!); nop; end
/*------------------------------------------------------------------------*\
| |
| End of Job |
| |
\*------------------------------------------------------------------------*/
EOJ: /* 0656 */
Procedure /* 0657 */
/* 0658 */
if ARG() = 0 then /* 0659 */
eoj_rc = 0 /* 0660 */
else /* 0661 */
eoj_rc = ARG(1) /* 0662 */
/* 0663 */
elapsed_time = TIME('E') /* get elapsed time - sssss.uuuuu */
parse value elapsed_time with seconds '.' micro_seconds /* 0665 */
if SUBSTR( micro_seconds, 1, 1 ) >= 5 then /* 0666 */
seconds = seconds + 1 /* 0667 */
ss = FORMAT( seconds // 60, 2 ) /* 0668 */
minutes = ( seconds - ss ) / 60 /* 0669 */
mm = FORMAT( minutes // 60, 2 ) /* 0670 */
hh = FORMAT( ( minutes - mm ) / 60, 2 ) /* 0671 */
duration = hh':'mm':'ss /* 0672 */
/* 0673 */
parse Source . . program_path_and_name /* 0674 */
program_name = FILESPEC( 'N', program_path_and_name ) /* 0675 */
say 'EOJ ' program_name 'at' TIME('N') ||, /* 0676 */
', duration' TRANSLATE( duration, '0', ' ' ) /* 0677 */
exit eoj_rc /* 0678 */
/* 0679 */
/*------------------------------------------------------------------------*\
| |
| Trap Routines |
| |
\*------------------------------------------------------------------------*/
ERROR: call TRAP_PROCESSING SIGL, 'ERROR', RC /* 0685 */
FAILURE: call TRAP_PROCESSING SIGL, 'FAILURE', RC /* 0686 */
HALT: call TRAP_PROCESSING SIGL, 'HALT', '' /* 0687 */
NOVALUE: call TRAP_PROCESSING SIGL, 'NOVALUE', '' /* 0688 */
SYNTAX: call TRAP_PROCESSING SIGL, 'SYNTAX', RC /* 0689 */
/* 0690 */
/* Rev. 95/06/27 */ /* 0691 */
TRAP_PROCESSING: /* 0692 */
parse Source . . TRAP.path_and_program /* 0693 */
trap.line_nbr = ARG(1) /* 0694 */
if POS( ':', TRAP.path_and_program ) > 0 then /* 0695 */
/* get source line if it is available */ /* 0696 */
do t = 1 /* 0697 */
trap_source_line.t = SOURCELINE( trap.line_nbr ) /* 0698 */
trap_source_line.0 = t /* 0699 */
trap.line_nbr = trap.line_nbr + 1 /* 0700 */
if RIGHT( SOURCELINE( trap.line_nbr ), 1 ) ¬= ',' then /* 0701 */
do /* 0702 */
if t > 1 then /* 0703 */
do /* 0704 */
t = t + 1 /* 0705 */
trap_source_line.t = SOURCELINE( trap.line_nbr )
trap_source_line.0 = t /* 0707 */
end /* 0708 */
leave /* 0709 */
end /* 0710 */
end /* 0711 */
else /* 0712 */
/* program is running in macrospace */ /* 0713 */
do /* 0714 */
TRAP.path_and_program = VALUE( 'TEMP',, 'OS2ENVIRONMENT' ) ||,
'\' || TRAP.path_and_program /* 0716 */
trap_source_line.1 = 'Source line is not available.' /* 0717 */
trap_source_line.0 = 1 /* 0718 */
end /* 0719 */
/* 0720 */
parse value FILESPEC( 'N', TRAP.path_and_program ) with, /* 0721 */
TRAP.fn '.' TRAP.fe /* 0722 */
trap_file_name = FILESPEC( 'D', TRAP.path_and_program ) ||, /* 0723 */
FILESPEC( 'P', TRAP.path_and_program ) ||, /* 0724 */
TRAP.fn || '.' || 'DMP' /* 0725 */
/* 0726 */
/*------------------------------------------*\ /* 0727 */
| check for reason not to create .DMP file | /* 0728 */
\*------------------------------------------*/ /* 0729 */
if ARG(2) = 'HALT' then /* 0730 */
do /* 0731 */
trap_file_name = '' /* 0732 */
end /* 0733 */
if RxFuncQuery( 'VARDUMP' ) <> 0 then /* 0734 */
do /* 0735 */
trap_file_name = '' /* 0736 */
end /* 0737 */
if POS( ':', trap_file_name ) = 0 then /* 0738 */
do /* 0739 */
trap_file_name = '' /* 0740 */
end /* 0741 */
/* 0742 */
/*------------------------*\ /* 0743 */
| Build trap message box | /* 0744 */
\*------------------------*/ /* 0745 */
dbl.h = 'CD'x /* ═ double line - horizontal */
dbl.v = 'BA'x /* ║ double line - vertical */
dbl.bl = 'C8'x /* ╚ double line - bottom left */
dbl.br = 'BC'x /* ╝ double line - bottom right */
dbl.tl = 'C9'x /* ╔ double line - top left */
dbl.tr = 'BB'x /* ╗ double line - top right */
trap.red = '1B'x || '[1;37;41m' /* bright white on red */
trap.dul = '1B'x || '[0m' /* reset to normal */
/* 0754 */
say ' ' /* 0755 */
trap_error_description =, /* 0756 */
'Error line = ' || ARG(1) ||, /* 0757 */
'; ' ||, /* 0758 */
ARG(2) ||, /* 0759 */
' error.' /* 0760 */
if ARG(3) <> '' then /* 0761 */
trap_error_description = trap_error_description ||, /* 0762 */
' Return code = ' || ARG(3) /* 0763 */
trap.width = MAX( 74, LENGTH( trap_error_description ) ) /* 0764 */
say trap.red || dbl.tl || COPIES( dbl.h,trap.width + 2 ) || dbl.tr
say trap.red || dbl.v || COPIES( ' ', trap.width + 2 ) || dbl.v
say trap.red || dbl.v CENTER( TRAP.fn'.CMD',trap.width ) dbl.v
say trap.red || dbl.v CENTER( trap_error_description, trap.width ) dbl.v
if trap_file_name <> '' then /* 0769 */
do /* 0770 */
say trap.red || dbl.v || COPIES( ' ', trap.width + 2 ) || dbl.v
say trap.red || dbl.v CENTER( 'See: ' || trap_file_name,, /* 0772 */
trap.width ) dbl.v /* 0773 */
end /* 0774 */
say trap.red || dbl.v || COPIES( ' ', trap.width + 2 ) || dbl.v
say trap.red || dbl.bl || COPIES( dbl.h,trap.width + 2 ) || dbl.br
say trap.red || COPIES( ' ', trap.width + 4 ) /* 0777 */
say trap.red || LEFT( 'Source line at time of trap:', trap.width + 4 )
do t = 1 to trap_source_line.0 /* 0779 */
say trap.red || LEFT( ' ' || trap_source_line.t, trap.width + 4 )
end /* 0781 */
say trap.red || COPIES( ' ', trap.width + 4 ) /* 0782 */
/* 0783 */
/*---------------------------------*\ /* 0784 */
| Create .DMP file if appropriate | /* 0785 */
\*---------------------------------*/ /* 0786 */
if trap_file_name <> '' then /* 0787 */
do /* 0788 */
call SysFileDelete trap_file_name /* 0789 */
/* remove meaningless labels from dump for clarity */ /* 0790 */
drop dbl. TRAP. RC RESULT SIGL !tr! /* 0791 */
call VARDUMP trap_file_name /* write variables to program.DMP file */
end /* 0793 */
exit 253 /* 0794 */
/*--------- REXX Cross Reference - Created: 07/09/95 7:05pm ----------*\
J:\REXXPROG\LISTINI\LISTINI.CMD - Directory time stamp 12/25/94 2:02a
---- VARIABLES ----
!tr! 0650< 0650 0650 0791
Apps. 0233<
Apps.0 0268 0276 0281 0295
Apps.app_number 0296
Apps.i 0282
Both_Index. 0234<
Both_Index.application_name
0246< 0251 0253< 0257< 0324
Calling_Environment
0022
GBL.environment 0024< 0129 0131 0189 0190 0293
GBL.program_name 0025< 0031 0069 0069 0075 0075 0193
GBL.program_path 0026<
GBL.program_version
0028< 0193
Keys.0 0320 0330
Keys.key_number 0337 0352
OS_Name 0021
RC 0685 0686 0689 0791
RESULT 0263 0265 0307 0310 0631 0633 0640 0791
REXX_Version 0020 0586
SIGL 0685 0686 0687 0688 0689 0791
System_Apps. 0235<
System_Apps.0 0244
System_Apps.i 0245
TRAP. 0791
TRAP.fe 0722
TRAP.fn 0722 0725 0767
TRAP.path_and_program
0693 0695 0715< 0716 0721 0723 0724
User_Apps. 0236<
User_Apps.0 0249
User_Apps.i 0250
Version 0020
X 0176 0176 0177 0178 0179 0179
anticipated_return 0580< 0581 0596< 0597 0609 0631 0634
app_number 0295
application_name 0245< 0250< 0296< 0298 0300 0303 0306 0312
0325 0337 0461
apps_max_name_length
0280< 0282< 0282 0303
asterisk_slash 0522< 0536
bksp 0290< 0331 0392
byte_count 0477< 0478
char_1 0092< 0093 0093 0094 0119< 0120 0120 0121
col_1_width 0160< 0164 0165 0211 0215 0339 0342 0348
0353 0357 0363
col_2_width 0161< 0164 0165 0212 0216 0353 0357 0363
col_3_width 0162< 0164 0165 0213 0217
col_4_width 0163< 0214 0218 0379 0422
comment_group 0520 0531 0531
comment_group_switch
0521< 0532< 0533 0535
contig_hex_tt 0170< 0433 0475
dbl. 0791
dbl.bl 0748< 0776
dbl.br 0749< 0776
dbl.h 0746< 0765 0776
dbl.tl 0750< 0765
dbl.tr 0751< 0765
dbl.v 0747< 0766 0766 0767 0767 0768 0768 0771
0771 0772 0773 0775 0775
dll_drive 0615< 0618 0619 0623< 0643
dll_path 0616< 0619
duration 0672< 0677
elapsed_time 0664< 0665
entry_name 0578< 0581 0594< 0597 0608 0627
eoj_rc 0660< 0662< 0678
function_name 0577< 0581 0595< 0597 0606 0611 0627 0629
0633
heading_1 0184< 0197 0200< 0200 0207 0551
heading_1a 0203< 0210< 0552 0554
heading_2 0211< 0558
heading_3 0215< 0559
hex_displacement 0454< 0480 0500 0509< 0509
hex_key_length 0338< 0368
hex_string 0431< 0436
hh 0671< 0672
i 0244 0249 0281
ignore_colors 0293< 0297
ini_arg_name 0060 0101< 0103 0116< 0116 0119 0121< 0121
0124 0126 0128 0130 0134 0137
ini_attributes 0403< 0406 0408
ini_attributes_and_file_name
0117< 0401 0403 0404
ini_file_attr 0144 0147
ini_file_date 0141
ini_file_name 0125< 0127< 0129< 0131< 0145 0146< 0146 0149
0185 0201 0204 0206 0238 0262 0270 0306
0337 0405 0407 0409
ini_file_size 0143
ini_file_stem.0 0135
ini_file_stem.1 0140
ini_file_time 0142
input_line 0526< 0527 0529 0534 0536
input_parameters 0057 0058
key_number 0330
key_value 0337< 0338 0372 0373 0373 0375 0375 0384
0424 0430 0430 0437 0462< 0462 0467 0468
0468 0488
keys.0 0317
leading_token 0468 0470 0476 0477
long_hex_prefix 0167<
micro_seconds 0665 0666
minutes 0669< 0670 0671
mm 0670< 0671 0672
module 0579< 0581 0588< 0592< 0597 0607 0613 0615
0616 0617< 0617 0626 0640
module_fext 0626
module_fname 0626 0627
output_device 0059 0091< 0091 0092 0094< 0094 0097 0099
0101 0102< 0109
output_line 0324< 0339 0342< 0342 0348< 0351< 0351 0353
0356< 0356 0363< 0366< 0366 0390< 0421< 0421
0425< 0425 0434< 0434 0439< 0439 0441< 0441
0479< 0489< 0490 0499< 0563
partial_key_switch 0459< 0464< 0489 0492
prev_character_string
0455< 0471 0510<
printable_key_value
0377< 0378 0379 0419 0422 0423
program_name 0675< 0676
program_path_and_name
0023 0025 0026 0027 0525 0526 0645 0674
0675
progress_list 0291< 0332 0334
progress_subscript 0292< 0332 0333< 0333 0334 0335<
register_call 0629< 0630
sameness_switch 0456< 0494< 0497 0506<
seconds 0665 0667< 0667 0668 0669
short_hex_prefix 0165<
short_vs_long 0058 0066 0072 0078
single_line_key_value
0372< 0375< 0377 0378 0419
slash_asterisk 0523< 0527
slash_asterisk_pos 0527< 0528 0530
spread_hex_tt 0171< 0431 0473
ss 0668< 0669 0672
syslst 0052< 0069< 0075< 0109< 0154 0223 0224 0228
0398 0399 0551 0554 0557 0558 0559 0563
syslst_device_type 0154< 0397 0549
syslst_format 0051< 0068< 0074< 0384
syslst_line_ct 0156< 0545 0548< 0555< 0555 0561< 0561 0564<
0564
syslst_line_max 0157< 0545
syslst_line_width 0158< 0163 0196 0491
syslst_page_ct 0159< 0547< 0547 0549 0551
t 0697 0699 0703 0705< 0705 0707 0779
temp_character_string
0470< 0471 0474 0487 0510
temp_hex_length 0478< 0483 0484
temp_hex_string 0473< 0483
temp_key_value 0430< 0432 0437
title_1 0193< 0198 0200
title_1_ini_name 0185< 0186 0188< 0195 0226
title_1_space_count
0196< 0199
title_1_spaces 0199< 0200 0200
trap.dul 0753<
trap.line_nbr 0694< 0698 0700< 0700 0701 0706
trap.red 0752< 0765 0766 0767 0768 0771 0772 0775
0776 0777 0778 0780 0782
trap.width 0764< 0765 0766 0767 0768 0771 0773 0775
0776 0777 0778 0780 0782
trap_error_description
0756< 0762< 0762 0764 0768
trap_file_name 0723< 0732< 0736< 0738 0740< 0769 0772 0787
0789 0792
trap_source_line.0 0699< 0707< 0718< 0779
trap_source_line.1 0717<
trap_source_line.t 0698< 0706< 0780
tt_128 0176< 0377 0487
tt_256 0177< 0352
with 0058 0140 0468 0665 0721
word_count 0476< 0477 0478
x 0170 0170 0171 0171 0171 0172 0172 0172
0173 0173 0173 0174 0174 0290 0373 0398
0424 0746 0747 0748 0749 0750 0751 0752
0753
---- LABELS ----
EOJ 0138 0266 0271 0314 0411 0525 0536 0656:
ERROR 0034 0685:
FAILURE 0035 0686:
FORMAT_MULTI_LINE_KEYS
0389 0451:
FORMAT_SINGLE_LINE_KEYS
0381 0386 0418:
HALT 0036 0687:
LIST_SOURCE_STATEMENTS
0084 0519:
NOVALUE 0037 0688:
PRINT_ROUTINE 0347 0362 0426 0443 0452 0493 0505 0544:
REGISTER_REQUIRED_FUNCTIONS
0032 0572:
REGISTER_ROUTINE 0581 0597 0605:
SYNTAX 0038 0689:
TRAP_PROCESSING 0685 0686 0687 0688 0689 0692:
---- FUNCTIONS ----
ABBREV 0066 0072
ARG 0659 0662 0694 0730 0757 0759 0761 0763
ARRAYSORT 0276 0320
C2X 0432 0474
CENTER 0203 0767 0768 0772
CHAROUT 0302 0331 0398 0399
COPIES 0165 0167 0176 0176 0199 0205 0215 0215
0216 0216 0217 0217 0218 0304 0348 0363
0370 0439 0479 0481 0484 0486 0499 0501
0765 0766 0771 0775 0776 0777 0782
D2X 0338 0480 0500
DATE 0184
FILESPEC 0025 0026 0027 0189 0190 0615 0616 0617
0675 0721 0723 0724
FORMAT 0551 0668 0670 0671
LEFT 0069 0075 0092 0119 0201 0211 0212 0213
0214 0298 0303 0342 0356 0375 0397 0403
0422 0430 0462 0470 0483 0503 0549 0645
0778 0780
LENGTH 0069 0075 0162 0197 0198 0207 0282 0334
0338 0339 0353 0373 0375 0379 0384 0404
0405 0423 0430 0476 0477 0492 0531 0613
0764
LINEIN 0526
LINEOUT 0392 0551 0554 0557 0558 0559 0563
LINES 0525
MAX 0196 0282 0764
MIN 0422 0430
OVERLAY 0489
POS 0406 0408 0527 0536 0695 0738
RIGHT 0099 0300 0373 0424 0701
RxFuncAdd 0627
RxFuncQuery 0273 0317 0611 0734
SOURCELINE 0698 0701 0706
STREAM 0154 0206 0224 0228
STRIP 0091 0094 0116 0121 0146 0403 0436 0616
SUBSTR 0147 0332 0529 0666
SysCurState 0305 0393
SysFileDelete 0223 0789
SysFileTree 0134
SysIni 0243 0248 0262 0306 0337
TIME 0029 0031 0184 0664 0676
TRACE 0650
TRANSLATE 0193 0293 0352 0377 0431 0473 0487 0677
VALUE 0129 0131 0189 0190 0293 0650 0715
VARDUMP 0792
WORD 0631 0631
XRANGE 0170 0171 0172 0173 0174 0176 0179
\*------------------- End of REXX Cross Reference -------------------*/