Debian Codegraph @

trip/vms.test

raw
1 /* testing f$directory */
2
3 trace off
4 /* signal here */
5 /* ===== f$directory() =============================================== */
6 call notify 'F$DIRECTORY'
7 'show default >LIFO'
8 parse pull . dev':'dir .
9 if (dir \== f$directory()) then
10 call complain "f$directory return incorrect answer"
11
12
13 /* ===== f$identifier() ============================================== */
14 call notify 'F$IDENTIFIER'
15
16 users = 'system operator field'
17 do while users \= ''
18 parse var users user users
19 call tell user
20
21 'write sys$output f$identifier( "'user'", "NAME_TO_NUMBER" ) >LIFO'
22 parse pull number .
23 if number \== f$identifier( user, "NAME_TO_NUMBER") then
24 call complain 'built-in f$identifier dont convert to number correctly'
25
26 'write sys$output f$identifier( 'number', "NUMBER_TO_NAME" ) >LIFO'
27 parse pull name .
28 if name \= f$identifier( number, "NUMBER_TO_NAME" ) then
29 call complain 'built-in f$identifier dont convert to name correctly'
30 end
31
32
33 /* ===== f$getdvi ==================================================== */
34 call notify 'F$GETDVI'
35 /*
36 * Notice that you can never expect all of these to *always* be the
37 * same. After all, we are fetching information about devices in use,
38 * so of course the values will change. Consequently, use some
39 * intelligence when interpreting the results from this test.
40 */
41
42 items = 'acppid acptype all alldevnam alloclass alt_host_avail',
43 'alt_host_name alt_host_type avl ccl cluster concealed cylinders',
44 'devbufsiz devchar devchar2 devclass devdepend devdepend2 devlocknam',
45 'devnam devsts devtype dir dmt dua elg errcnt exists fod for freeblocks',
46 'fulldevnam gen host_avail host_count host_name host_type idv lockid',
47 'logvolnam maxblock maxfiles mbx media_id media_name media_type mnt',
48 'mountcnt net nextdevnam odv opcnt opr ownuic pid rck rct rec recsiz',
49 'refcnt remote_device rnd rootdevnam rtm sdi sectors serialnum',
50 'served_device shr spl spldevnam sqd sts swl tracks transcnt trm',
51 'tt_accpornam tt_altypeahd tt_ansicrt tt_app_keypad tt_autobaud tt_avo',
52 'tt_block tt_brdcstmbx tt_crfill tt_deccrt tt_deccrt2 tt_dialup',
53 'tt_disconnect tt_dma tt_drcs tt_edit tt_editing tt_eightbit tt_escape',
54 'tt_fallback tt_halfdup tt_hangup tt_hostsync tt_insert tt_lffill',
55 'tt_localecho tt_lower tt_mbxdsabl tt_mechform tt_mechtab tt_modem',
56 'tt_modhangup tt_nobrdcst tt_noecho tt_notypeahd tt_oper tt_page',
57 'tt_pasthru tt_phydevnam tt_printer tt_readsync tt_regis tt_remote',
58 'tt_scope tt_secure tt_setspeed tt_sixel tt_ttsync tt_syspwd tt_wrap',
59 'unit volcount volnam volnumber volsetmem vprot wck'
60
61 /* add your own devices to run the test on, as it suits you */
62 /*
63 * 'sh log sys$command >LIFO'
64 * parse pull line '=' '"' sys_command '"' .
65 * devs = 'sys$login' f$getjpi("",'TERMINAL') 'tape: _RUNIT$TXC1:'
66 */
67
68 devs = ''
69 'show device >LIFO'
70 do queued()
71 parse pull dev ':' rest
72 if rest \= '' then
73 devs = devs dev
74 end
75
76 do xx=1 for 3 while devs \= ''
77 parse var devs dev devs
78 call tell dev
79
80 titems = items
81 do while titems \= ''
82 parse var titems item titems
83 queue 'write sys$output f$getdvi( "'dev'", "'item'")'
84 end
85
86 'LIFO> set def nl: >FIFO'
87
88 titems = items
89 do queued()
90 parse var titems item titems
91 call blink item
92 parse pull vms_result
93 rexx_result = f$getdvi( dev, translate(item) )
94
95 if (item == 'opcnt') | (item=='transcnt') | (item=='refcnt') then do
96 if abs(rexx_result-vms_result)*15 < rexx_result then
97 iterate /* or something like that .... */
98 end
99
100 if (vms_result \== rexx_result) then
101 call complain 'For item='item', DCL says <'vms_result'>' ||,
102 ' and rexx says <'rexx_result'>.'
103 end
104 end
105
106
107 /* ===== f$getjpi ================================================ */
108 call notify 'F$GETJPI'
109 items = 'account aptcnt astact astcnt asten astlm authpri authpriv biocnt',
110 'biolm bufio bytcnt bytlm cliname cpulim cputim curpriv dfpfc dfwscnt',
111 'diocnt diolm dirio efcs efcu efwm enqcnt enqlm excvec filcnt fillm',
112 'finalexc frep0va frep1va freptecnt gpgcnt grp imagecount imagname',
113 'imagpriv jobprccnt logintim master_pid mem mode msgmask owner',
114 'pageflts pagfilcnt pagfilloc pgflquota phdflags pid ppgcnt prccnt',
115 'prclm prcnam prib procpriv sitespec state sts swpfilloc terminal',
116 'tmbu tqcnt tqlm uic username virtpeak volumes wsauth wsauthext',
117 'wsextent wspeak wsquota wssize'
118
119 numeric digits 12
120
121 pid = ''
122 procs = ''
123 do until proc==''
124 proc = f$pid('PID')
125 if f$getjpi(proc,"PRCNAM") == f$process() then
126 iterate
127
128 procs = procs proc
129 end
130
131 do while procs\=''
132 parse var procs proc procs
133 proc = translate(proc)
134 call tell proc
135
136 titems = items
137 do while titems \= ''
138 parse var titems item titems
139 queue 'write sys$output f$getjpi( "'proc'", "'item'")'
140 end
141
142 'LIFO> set def nl: >FIFO'
143
144 titems = items
145 myproc = translate(f$getjpi('','PID'))
146 do queued()
147 parse var titems item titems
148 call blink item
149 parse pull vms_result
150 rexx_result = f$getjpi( proc, translate(item) )
151
152 if (datatype(rexx_result,'num') & datatype(vms_result,'num')) then do
153 if abs(rexx_result-vms_result) < rexx_result*0.15 then
154 iterate
155
156 if (translate(right(item,3))=='CNT') then
157 if abs(rexx_result - vms_result)<4 then
158 iterate
159 end
160
161 if (proc = myproc) & (item='finalexc' | item='excvec' | item='state' |,
162 item='efcu') then
163 iterate
164
165 if (vms_result\==rexx_result) & (item=='state') &,
166 (vms_result=='LEF' | rexx_result=='LEF') then iterate
167
168 if (vms_result \== rexx_result) then
169 call complain 'For item='item', DCL says 'vms_result ||,
170 ' and rexx says' rexx_result'.'
171
172 end
173 end
174
175
176
177 /* ===== f$getsyi ================================================ */
178 call notify 'F$GETSYI'
179 items = 'archflag boottime character_emulated cpu decimal_emulated',
180 'd_float_emulated errorlogbuffers f_float_emulated g_float_emulated',
181 'pagefile_free pagefile_page sid swapfile_free swapfile_page',
182 'version activecpu_cnt availcpu_cnt cluster_fsysid cluster_ftime ',
183 'cluster_member cluster_nodes cluster_quorum cluster_votes',
184 'contig_gblpages free_gblpages free_gblsects hw_model hw_name',
185 'nodename node_area node_csid node_hwtype node_hwvers node_number',
186 'node_quorum node_swincarn node_swtype node_swvers node_systemid',
187 'node_votes scs_exists'
188
189 devs = ''
190 do until devs = ''
191 parse var devs dev devs
192
193 titems = items
194 do while titems \= ''
195 parse var titems item titems
196 if dev \= '' then
197 queue 'write sys$output f$getsyi( "'item'", "'dev'")'
198 else
199 queue 'write sys$output f$getsyi( "'item'" )'
200 end
201
202 'LIFO> set def nl: >FIFO'
203
204 titems = items
205 do queued()
206 parse var titems item titems
207 call blink item
208 parse pull vms_result
209 if dev = '' then
210 rexx_result = f$getsyi( translate(item) )
211 else
212 rexx_result = f$getsyi( translate(item), dev )
213
214 if (vms_result \== rexx_result) then
215 call complain 'For item='item', DCL says 'vms_result ||,
216 ' and rexx says' rexx_result'.'
217
218 end
219 end
220
221
222 /* ===== f$getqui ================================================ */
223 call notify 'F$GETQUI'
224 items = 'account_name after_time assigned_queue_name base_priority',
225 'characteristic_name characterstics charactersistic_number',
226 'checkpoint_data cli completed_blocks condiiton_vector cpu_default',
227 'cpu_limit default_form_name default_form_stock device_name',
228 'entry_number execution_job_count file_burst file_checkpointed',
229 'file_copies file_copies_done file_delete file_double_space',
230 'file_executing file_flag file_flags file_identification',
231 'file_page_header file_paginate file_passall file_setup_modules',
232 'file_spacification file_status file_trailer first_page',
233 'form_description form_flags form_length form_margin_bottom',
234 'form_margin_left form_margin_right form_margin_top form_name',
235 'forma_number form_setup_modules form_sheet_feed form_stock',
236 'form_truncate worm_width form_wrap generic_target holding_job_count',
237 'intervening_blocks intervening_jobs job_aborting job_copies',
238 'job_copies_done job_cpu_limit job_executing job_file_burst',
239 'job_file_burst_one job_file_flag job_file_flag_one',
240 'job_file_paginate job_file_trailer job_file_trailer_one job_flags',
241 'job_holding job_inaccessible job_limit job_log_delete job_log_null',
242 'jb_log_spool job_lowercase job_name job_notify job_pending job_pid',
243 'job_refused job_reset_modules job_restart job_retained job_size',
244 'job_size_maximum job_size_minimum job_starting job_status',
245 'job_suspended job_timed_release job_wsdefault job_wsextent',
246 'job_wsquota last_page library_specification log_queue note',
247 'operator_request owner_uic page_Setup_modules parameter_1',
248 'parameter_2 parameter_3 parameter_4 parameter_5 parameter_6',
249 'parameter_7 parameter_8 pending_job_block_count pending_job_count',
250 'pending_job_reason pedn_char_mismatch pend_hob_size_max',
251 'pend_job_size_min pend_lowercase_mismatch pend_no_access',
252 'pend_queue_busy pend_queue_state pend_stock_mismatch priority',
253 'processor protection queue_acl_specified queue_aligning',
254 'queue_closed queue_cpu_default queue_cpu_limit queue_file_burst',
255 'queue_file_bust_one queue_file_flag queue_file_flag_one',
256 'queue_file_paginate queue_file_trailer queue_file_trailer_one',
257 'queue_flags queue_generic queue_generic_selection queue_idle',
258 'queue_job_burst queue_job_flag queue_job_size_sched',
259 'queue_job_trailer queue_lowercase queue_name queue_paused',
260 'queue_printer queue_record_blocking queue_remote queue_resetting',
261 'queue_resuming queue_retain_All queue_retain_error queue_server',
262 'queue_stalled queue_starting queue_status queue_stopped queue_swap',
263 'queue_terminal queue_unavailable queue_wsdefault queue_wsextent',
264 'queue_wsquota requeue_queue_name restart_queue_name',
265 'retained_job_count scsnode_name submission_time',
266 'timed_release_job_count uic username wsdefault wsextent wsquota'
267
268 char_items = 'characteristic_name characteristic_number'
269
270 trans_items = 'queue_name'
271
272 entry_items = 'account_name after_time characteristics checkpoint_data',
273 'cli completed_blocks condition_vector cpu_limit entry_number',
274 'form_name form_stock', /* intervening_blocks intervening_jobs*/
275 'job_aborting job_copies job_cpu_limit job_copies_done job_executing',
276 'job_file_burst job_file_burst_one job_file_flag job_file_flag_one',
277 'job_file_paginate job_file_trailer job_file_trailer_one job_flags',
278 'job_holding job_inaccessible job_log_delete job_log_null',
279 'job_log_spool job_lowercase job_name job_notify job_pending',
280 'job_pid job_refused job_restart job_retained job_size job_starting',
281 'job_suspended job_timed_release job_wsdefault job_wsextent',
282 'job_wsquota log_queue log_specification note operator_request',
283 'parameter_1 parameter_2 parameter_3 parameter_4 parameter_5',
284 'parameter_6 parameter_7 parameter_8 pend_char_mismatch',
285 'pend_job_size_max pend_job_size_min pend_lowercase_mismatch',
286 'pend_no_access pend_queue_busy pend_queue_state pend_stock_mismatch',
287 'priority queue_name requeue_queue_name'
288
289 file_items = 'file_copies file_checkpointed file_copies_done file_burst',
290 'file_delete file_double_space file_executing file_flag file_flags',
291 'file_identification file_page_header file_paginate file_passall',
292 'file_setup_modules file_specification file_trailer first_page',
293 'last_page'
294
295 form_items = 'form_description form_length form_margin_bottom',
296 'form_margin_left form_margin_right form_margin_top form_name',
297 'form_number form_setup_modules form_sheet_feed form_stock',
298 'form_truncate form_width form_wrap page_setup_modules'
299
300 job_items = 'account_name after_time characteristics checkpoint_Data',
301 'cli completed_blocks condition_vector cpu_limit entry_number',
302 'form_name form_stock intervening_blocks' /*intervening_jobs*/ 'job_copies',
303 'job_copies_done job_flags job_cpu_limit job_file_burst',
304 'job_File_burst_one job_file_flag job_File_flag_one',
305 'job_file_paginate job_File_trailer job_file_Trailer_one',
306 'job_log_delte job_log_null job_log_spool job_lowercase job_notify',
307 'job_restart job_wsdefault job_wsextent job_wsquota job_name job_pid',
308 'job_sizejob_status job_aborting job_executing job_holdeing',
309 'job_inaccessible job_pending job_refused job_retained job_starting',
310 'job_suspended job_Timed_release log_queue log_specification note',
311 'operator_request parameter_1 parameter_2 parameter_3 parameter_4',
312 'parameter_5 parameter_6 parameter_7 parameter_8 pending job_reason',
313 'pend_char_mismatch pend_job_size_max pend_job_size_min',
314 'pend_lowercase_mismatch pend_no_access pend_queue_busy',
315 'pend_queue_state pend_stock_mismatch priority queue_name',
316 'requeue_queue_name restart_queue_name'
317
318 /*
319 * The item 'intervening_job' is meaningful only for output execution
320 * queues, according to the documentation. It seems to be sensitive to
321 * what sort of object it is called for and triggers an error if it
322 * don't like what is sees. I'll comment it in again if someone can
323 * tell me what a 'output execution queue' is, and how I determine
324 * whether a given queue is such.
325 */
326
327
328 queue_items = 'assigned_queue_name base_priority characteristics',
329 'cpu_default cpu_limit default_form_name default_form_stock',
330 'device_name executing_job_count form_name form_stock generic_target',
331 'holding_job_count job_limit job_reset_modules job_size_maximum',
332 'job_size_minimum library_specification owner_uic',
333 'pending_job_block_count pending_job_count processor protection',
334 'queue_description queue_flags queue_acl_specified queue_batch',
335 'queue_cpu_default queue_cpu_limit queue_file_burst_one',
336 'queue_file_flag queue_file_flag_one queue_file_paginate',
337 'queue_file_trailer queue_file_trailer_one queue_generic',
338 'queue_generic_selection queue_job_flag queue_job_size_sched',
339 'queue_job_trailer queue_printer queue_record_blocking',
340 'queue_retain_all queue_retain_error queue_swap queue_terminal',
341 'queue_wsdefault queue_wsextent queue_wsquota retained_job_count',
342 'scsnode_name'
343
344 funcs = 'job entry file form job queue'
345 names = ''
346
347 call notify '__display_queue'
348 'show queue >FIFO'
349 do queued()
350 parse pull . keyw name',' .
351 if keyw \== 'queue' then
352 iterate
353
354 names = names name
355 end
356
357 do while names \= ''
358 parse var names name names
359
360 call tell name
361 titems = queue_items
362 do while titems \= ''
363 parse var titems item titems
364 queue 'write sys$output f$getqui( "DISPLAY_QUEUE", "'item'", "'name'")'
365 end
366
367 'LIFO> set def nl: >FIFO'
368
369 titems = queue_items
370 do queued()
371 parse var titems item titems
372 call blink item
373 parse pull vms_result
374 rexx_result = f$getqui( 'DISPLAY_QUEUE', translate(item), name )
375 if (vms_result \== rexx_result) then
376 call complain 'For item='item', DCL says 'vms_result ||,
377 ' and rexx says' rexx_result'.'
378 end
379 end
380
381
382 /*==== form ===== */
383 call notify '__display_form'
384 'show queue/form >FIFO'
385
386 do queued()
387 parse pull name . '('keyw'=' . ')' number .
388 if keyw \== 'stock' then
389 iterate
390
391 names = names name number
392 end
393
394 do while names \= ''
395 parse var names name number names
396
397 call tell name
398 titems = form_items
399 do while titems \= ''
400 parse var titems item titems
401 queue 'write sys$output f$getqui( "DISPLAY_FORM", "'item'", "'name'")'
402 end
403
404 'LIFO> set def nl: >FIFO'
405
406 titems = form_items
407 do queued()
408 parse var titems item titems
409 call blink item
410 parse pull vms_result
411 rexx_result = f$getqui( 'DISPLAY_FORM', translate(item), name )
412 if (vms_result \== rexx_result) then
413 call complain 'For item='item', DCL says 'vms_result ||,
414 ' and rexx says' rexx_result'.'
415
416 rexx_result = f$getqui( 'DISPLAY_FORM', translate(item), number )
417 if (vms_result \== rexx_result) then
418 call complain 'For item='item', DCL says 'vms_result ||,
419 ' and rexx says' rexx_result'.'
420 end
421 end
422
423
424 /* ===== entry ===== */
425
426 call notify '__display_entry'
427 'show queue/all >FIFO'
428 do queued()
429 parse pull name next entry .
430 if datatype(entry)\=='NUM' then
431 iterate
432
433 names = names entry
434 end
435
436
437 do while names \= ''
438 parse var names name names
439
440 call tell name
441 titems = entry_items
442 do while titems \= ''
443 parse var titems item titems
444 /* queue 'write sys$output f$getqui( "DISPLAY_ENTRY", "'item'", "'name'")' */
445 queue 'write sys$output f$getqui( "DISPLAY_ENTRY", "'item'", "'name'")'
446 end
447
448 'LIFO> set def nl: >FIFO'
449
450 titems = entry_items
451 do queued()
452 parse var titems item titems
453 call blink item
454 parse pull vms_result
455 rexx_result = f$getqui( 'DISPLAY_ENTRY', translate(item), name )
456 if (vms_result \== rexx_result) then
457 call complain 'For item='item', DCL says 'vms_result ||,
458 ' and rexx says' rexx_result'.'
459 end
460 end
461
462
463 /* ===== translate queue ===== */
464
465 call notify '__translate_queue'
466 'show queue >FIFO'
467 do queued()
468 parse pull line
469 if (pos('>',line)=0) then iterate
470 parse value reverse(line) with '>'name .
471 names = names reverse(name)
472 end
473
474
475 do while names \= ''
476 parse var names name names
477
478 call tell name
479 titems = trans_items
480 do while titems \= ''
481 parse var titems item titems
482 queue 'write sys$output f$getqui( "TRANSLATE_QUEUE", "'item'", "'name'")'
483 end
484
485 'LIFO> set def nl: >FIFO'
486
487 titems = trans_items
488 do queued()
489 parse var titems item titems
490 call blink item
491 parse pull vms_result
492 rexx_result = f$getqui( 'TRANSLATE_QUEUE', translate(item), name )
493 if (vms_result \== rexx_result) then
494 call complain 'For item='item', DCL says 'vms_result ||,
495 ' and rexx says' rexx_result'.'
496 end
497 end
498
499
500 /* ===== display_characteristic ===== */
501 char_items = 'characteristic_name characteristic_number'
502 call notify '__display_characteristic'
503 'show queue/char >FIFO'
504 do queued()
505 parse pull name num .
506 if datatype(num)\='NUM' then
507 iterate
508
509 names = names name num
510 end
511
512 do while names \= ''
513 parse var names name num names
514
515 call tell name
516 titems = char_items
517 do while titems \= ''
518 parse var titems item titems
519 queue 'write sys$output f$getqui( "DISPLAY_CHARACTERISTIC", "'item'", "'name'")'
520 end
521
522 'LIFO> set def nl: >FIFO'
523
524 titems = char_items
525 do queued()
526 parse var titems item titems
527 call blink item
528 parse pull vms_result
529 if (vms_result=='') then
530 iterate
531
532 rexx_result = f$getqui( 'DISPLAY_CHARACTERISTIC', translate(item), name )
533 if (vms_result \== rexx_result) then
534 call complain 'For item='item', DCL says 'vms_result ||,
535 ' and rexx says' rexx_result'.'
536
537 rexx_result = f$getqui( 'DISPLAY_CHARACTERISTIC', translate(item), num )
538 if (vms_result \== rexx_result) then
539 call complain 'For item='item', DCL says 'vms_result ||,
540 ' and rexx says' rexx_result'.'
541 end
542 end
543
544
545 call f$getqui "CANCEL_OPERATION"
546 do forever
547 qname = f$getqui('display_queue', 'queue_name', '*')
548 if qname=='' then leave
549 do forever
550 jobname = f$getqui('display_job', 'job_name')
551 if jobname=='' then leave
552 call tell jobname
553 do forever
554 filename = f$getqui('display_file', 'job_file_identification')
555 if filename=='' then leave
556 call blink filename
557 end
558 end
559 end
560
561
562 /* ===== f$user() ===== */
563
564 call notify 'F$USER'
565 'write sys$output f$user() >LIFO'
566 parse pull line
567 if line\==f$user() then
568 call complain 'Builtin f$user() does not seem to work'
569
570
571
572 /* ===== f$locate() ===== */
573 call notify 'F$LOCATE'
574 string.1 = 'This is a short line of text' ; loc.1 = 'is'
575 string.2 = 'This is a short line of text' ; loc.2 = ' is'
576 string.3 = 'This is a short line of text' ; loc.3 = 'This'
577 string.4 = 'This is a short line of text' ; loc.4 = 'this'
578 string.5 = 'This is a short line of text' ; loc.5 = 'text'
579 string.6 = 'This is a short line of text' ; loc.6 = 'foo'
580
581 do i=1 to 6
582 push 'write sys$output f$locate("'string.i'", "'loc'")'
583 end
584
585 'LIFO> set def nl: >LIFO'
586 do i=1 to 6
587 parse pull line
588 call tell i
589 if line \== f$locate(string.i, loc.1 ) then
590 call complain 'Builtin f$locate() does not seem to work'
591 end
592
593
594 /* ===== f$length() ===== */
595
596 call notify 'F$LENGTH'
597 if f$length("Testing testing") \== 15 then
598 call complain 'Builtin f$length() does not work for non-empty strings'
599
600 if f$length("") \== 0 then
601 call complain 'Builtin f$length() does not work for empty strings'
602
603
604
605 /* ===== f$integer() ===== */
606
607 call notify 'F$INTEGER'
608 if f$integer('- 3' +10) \== '7' then
609 call complain 'Builtin f$integer() does not work'
610
611 if f$integer('- 3' -14) \== '-17' then
612 call complain 'Builtin f$integer() does not work'
613
614 if f$integer(' 0 ') \== '0' then
615 call complain 'Builtin f$integer() does not work'
616
617
618
619 /* ===== f$trnlnm() ===== */
620 call notify 'F$TRNLNM'
621
622 'show logical/full >FIFO'
623
624
625 tables = ''
626 logicals. = ''
627 parse pull junk
628 values. = ''
629 index. = 0
630 namestab. = ''
631 numlogs. = 0
632 allnames. = 0
633 parse value 0 with concealed. 1 terminal. 1 no_alias. 1 confine. 1 crelog.
634
635
636 call notify '__reading'
637 do while queued() > 0
638 parse pull '('tablename')'
639 do forever
640 parse pull line
641 if left(line,3)==' "' then do
642 push line
643 leave
644 end
645 end
646
647 tables = tables tablename
648 logs = 0 ;
649
650 call tell tablename
651 do mid=1 while queued() > 0
652 parse pull line
653 if line='' then leave
654 if left(line,1)='(' then do
655 push line
656 leave
657 end
658
659 parse var line '"' name '"' modes '= "' value '"' flags 1 '=' rest
660 parse var modes '[' modes ']'
661 parse var modes accmode','lmodes
662 parse var flags '[' flags ']'
663
664 call blink name
665
666 if accmode=='super' then accmode='supervisor'
667 if accmode=='exec' then accmode='executive'
668 allnames.accmode.name = 1
669 namestab.name = namestab.name tablename
670
671 logicals.logs.tablename = name
672 accmodes.logs.tablename = accmode
673 logs = logs + 1
674
675 /*
676 * Note: there might be some problems here, although it is probably of
677 * academic interest. If table 'A$TABLE.0' contains the logical symbol
678 * 'FOOBAR', and table 'A$TABLE' contains the logical symbol '0.FOOBAR',
679 * the two of them will not be separable.
680 */
681
682 push ' =' || rest
683 do while queued() > 0
684 parse pull line
685 if line='' then leave mid
686 parse var line before '= "' value '"' '['flags']'
687 if before\='' then do
688 push line
689 iterate mid
690 end
691
692 if flags \== '' & lmodes\== '' then
693 modes = lmodes','flags
694 else
695 modes = lmodes || flags
696
697 cnt = index.accmode.tablename.name
698 term = accmode"."tablename"."name
699
700 do while modes\==''
701 parse var modes mode','modes
702 select
703 when mode=='terminal' then terminal.cnt.term = 1
704 when mode=='concealed' then concealed.cnt.term = 1
705 when mode=='no_alias' then no_alias.cnt.term = 1
706 when mode=='confine' then confine.cnt.term = 1
707 when mode=='crelog' then crelog.cnt.term = 1
708 otherwise
709 say "Unknown mode ("mode") detected, I'm confused..."
710 end
711 end
712
713 values.accmode.tablename.cnt.name = value
714 index.accmode.tablename.name = index.accmode.tablename.name + 1
715 end
716 end
717
718 numlogs.tablename = logs - 1
719 end
720
721
722 /*
723 * I really have no idea of what the 'table' item of f$trnlnm is
724 * supposed to do. I far as I know, it always return false. ???
725 */
726
727
728 call notify '__bacics'
729
730 ttables = tables
731 do while ttables\=''
732 parse var ttables table ttables
733 call tell table
734
735 do log=0 to numlogs.table
736 name = logicals.log.table
737 mode = accmodes.log.table
738 call blink name
739
740 /*
741 * We have to ignore some of the values. Since the 'sh log' command was
742 * exeuted by LIB$SPAWN with output 'piped' (mailboxed!) to another
743 * process, the output will ofcourse be somewhat different.
744 */
745 if name=='TT' | name=='SYS$OUTPUT' | name=='SYS$ERROR' then iterate
746 if name=='SYS$INPUT' | name=='SYS$COMMAND' then iterate
747
748 max_ind = f$trnlnm(name,table,,mode,,'max_index')
749 if max_ind='' & pos('.',name)>0 then
750 iterate
751
752 if datatype(max_ind)\=='NUM' then do
753 call complain 'Heeeeelp, what is happening??? name='name
754 iterate
755 end
756
757 if index.mode.table.name\==f$trnlnm(name,table,,mode,,'max_index')+1 then
758 call complain 'Wrong number of indexes in logical names',
759 '(tab='table'/nam='name'/mod='mode')',
760 'rexx='f$trnlnm(name,table,,mode,,'max_index'),
761 'dcl='index.mode.table.name
762
763 do cnt=0 to index.mode.table.name-1
764 if length(values.mode.table.cnt.name) \==,
765 f$trnlnm(name,table,cnt,mode,,'length') then
766 call complain 'Mismatching length of locical name',
767 '(tab='table'/nam='name'/cnt='cnt'/mod='mode')',
768 'rexx=<'f$trnlnm(name,table,cnt,mode,,'length')'>',
769 'dcl=<'length(values.mode.table.cnt.name)'>'
770
771 xname = f$trnlnm(name,table,cnt,mode)
772 xyz = translate(xname,,xrange('7e'x,'1f'x),'.')
773 if values.mode.table.cnt.name \== xyz then
774 call complain 'Mismatching values in logical names',
775 '(tab='table'/nam='name'/cnt='cnt'/mod='mode')',
776 'rexx=<'xyz'>' 'dcl=<'values.mode.table.cnt.name'>'
777
778 flags = 'terminal concealed confine crelog no_alias'
779 do while flags\==''
780 parse var flags flag flags
781 if \(value(flag'.cnt.mode.table.name') &&,
782 f$trnlnm(name,table,cnt,mode,,flag)=='FALSE') then
783 call complain 'Boolean info about logical is incorrect',
784 '(tab='table'/nam='name'/cnt='cnt'/mod='mode'/bool='flag')',
785 'dcl='value(flag'.cnt.mode.table.name'),
786 'rexx='f$trnlnm(name,table,cnt,mode,,flag)
787 end
788 end
789 end
790 end
791
792
793
794 nextcheck:
795
796 call notify '__reversed'
797
798 ttables = tables
799 do while ttables\=''
800 parse var ttables table ttables
801 call tell table
802
803 do log=0 to numlogs.table
804 name = logicals.log.table
805 mode = accmodes.log.table
806 call blink name
807
808 if name=='SYS$ERROR' | name=='SYS$OUTPUT' | name=='TT' then
809 iterate
810
811 if pos('.',name)>0 then iterate
812
813 modes = 'user supervisor executive kernel none'
814 do while modes\==''
815 parse var modes accmode modes
816 if accmode=='none' then
817 call complain "Oops, I can't find any access modes at all for",
818 'logical name' name
819
820 if allnames.accmode.name then do
821 if hepp(f$trnlnm(name,,,,,'access_mode')) == translate(accmode) then do
822 tab = hepp(f$trnlnm(name,,,,,'table_name'))
823 if (hepp(f$trnlnm(name,,,,,'value')) \== ,
824 values.accmode.tab.0.name) then
825 call complain "Default mapping of logicals is incorrect",
826 '(tab='tab',nam='name',mod='accmode')'
827 if (f$trnlnm(name,,,,,'value') \== f$logical(name) |,
828 hepp(f$logical(name)) \== values.accmode.tab.0.name) then
829 call complain "Default mapping of logicals is incorrect",
830 '(tab='tab',nam='name',mod='accmode')'
831 leave
832 end
833 /* else
834 call complain "Can't find correct logical table",
835 '(tab='table',nam='name') dcl='accmode,
836 'rexx='f$trnlnm(name,,,,,'access_mode') */
837 end
838 end
839 end
840 end
841
842 signal after_hepp
843
844 hepp: return translate(arg(1),,xrange('7e'x,'1f'x),'.')
845
846
847 after_hepp:
848
849
850 /* ===== f$parse() ===== */
851 call notify 'F$PARSE'
852
853 spec.1 = 'nod dev dir.dir fil typ ver'
854
855 i_node = 'foo'
856 i_device = 'foo'
857 i_directory = 'foo'
858 i_name = 'foo'
859 i_type = 'foo'
860 i_version = 'foo'
861
862 max_cnt = 400
863
864 'sh def >LIFO'
865 parse pull line
866 line = strip(translate( line, '<>', '[]' ))
867 parse var line defdev':<'defdir'>'
868
869 do cnt=1 to max_cnt
870 def = filespec( 'DEF' )
871 rel = filespec( 'REL' )
872 fil = filespec( 'FIL' )
873
874 answer = translate(calc_file( fil, def, rel, defdev, defdir), '<>', '[]')
875 call blink answer
876 if def=='' & rel=='' then
877 rexx = translate(f$parse(fil,,,, 'syntax_only'), '<>', '[]')
878 else if def=='' then
879 rexx = translate(f$parse(fil,, rel,, 'syntax_only'), '<>', '[]')
880 else if rel=='' then
881 rexx = translate(f$parse(fil, def,,, 'syntax_only'), '<>', '[]')
882 else
883 rexx = translate(f$parse(fil, def, rel,, 'syntax_only'), '<>', '[]')
884
885 if answer \== rexx then do
886 'write sys$output f$parse("'fil'","'def'","'rel'",,"SYNTAX_ONLY") >LIFO'
887 parse pull dcl
888 call complain 'f$parse() doesn''t work, rexx='rexx', correct='answer,
889 'fil='fil', def='def', rel='rel', dcl='dcl
890 end
891
892 items = translate('node device directory name type version')
893 do while items\==''
894 parse var items item items
895 if value('I_'item) \==,
896 translate(f$parse(fil,def,rel,item,'syntax_only'),'<>','[]') then
897 call complain 'f$parse returns incorrect answer for item='item,
898 'rexx='f$parse(fil,def,rel,item,'syntax_only'),
899 'correct='value('I_'item)
900 end
901 end
902
903
904 res = f$parse("foo::bar::bar:bar:",,,,'syntax_only')
905 if res\=='' then
906 call complain "f$parse() doesn't trap syntax errors in filename"
907
908 res = f$parse("foo","foo::bar::bar:bar:",,,'syntax_only')
909 if res\=='' then
910 call complain "f$parse() doesn't trap syntax errors in default spec"
911
912 res = f$parse("foo",,"foo::bar::bar:bar:",,'syntax_only')
913 if res\=='' then
914 call complain "f$parse() doesn't trap syntax errors in related spec"
915
916 if f$parse('foo::bar')\=='FOO::BAR.;' then
917 call complain "Something is wrong with f$parse()"
918
919 if f$parse('foo:bar')\=='' then
920 call complain "Something is wrong with f$parse()"
921
922 if f$parse('<This_is_a_very_very_long_name_for_a_dir_>foo.bar')\=='' then
923 call complain "Long directory name not detected"
924
925 if f$parse('<foobar>foo.bar')\=='' then
926 call complain "Didn't trap non-existing directory"
927
928 if f$parse('sys$sysroot:bar')\=='' then
929 call complain "Didn't trap logical name expanding to two directories"
930
931 if f$parse('sys$login:foo.bar.bar')\=='' then
932 call complain "Didn't trap syntax error in file name"
933
934 if f$parse('sys$login:fo#()+| $!~`''"\<>bar')\=='' then
935 call complain "Didn't trap syntax error in file name"
936
937 if f$parse('sys$sysroot:bar')\=='' then
938 call complain "Didn't trap loop in logical name definition"
939
940 if f$parse('long_node_name::bar')\=='' then
941 call complain "Didn't trap syntax error in DECnet node name"
942
943 if f$parse('sys$login:foo.bar&$#<>\+~.')\=='' then
944 call complain "Didn't trap syntax error in file name"
945
946 if f$parse('sys$login:foo.bar;bar')\=='' then
947 call complain "Didn't trap syntax error in file name"
948
949 signal after_parse
950
951
952 filespec: procedure
953 pref = arg(1)
954 result = ''
955 if random(,100)>80 then result = pref || 'NODE::'
956 if random(,100)>60 then result = result || pref || 'DEV:'
957 if random(,100)>60 then result = result || '<' || pref || 'DIR>'
958 if random(,100)>50 then result = result || pref || 'FILE'
959 if random(,100)>70 then result = result || '.' || pref || 'TYP'
960 if random(,100)>85 then result = result || ';' || c2d(left(pref,1))
961 return result
962
963
964 /*
965 * The algorithm for this parsing has been found empirically. I believe
966 * that there must be a bug in VMS in sys$parse, because the behavior
967 * of that function is so 'interesting' for special cases.
968 */
969 calc_file: procedure expose i_node i_directory i_device i_name i_type i_version
970 fil = arg(1)
971 def = arg(2)
972 rel = arg(3)
973
974 defdev = arg(4)
975 defdir = arg(5)
976
977 miss_nod = 1
978 miss_dev = 1
979 miss_dir = 1
980 miss_fil = 1
981 miss_typ = 1
982 miss_ver = 1
983
984 if pos("::",fil)>0 then do
985 parse var fil nod"::"fil; miss_nod = 0 ; end
986
987 if pos(":",fil)>0 then do
988 parse var fil dev":"fil; miss_dev = 0 ; end
989
990 if pos("<",fil)>0 then do
991 parse var fil '<'dir'>'fil; miss_dir = 0 ; end
992
993 if pos(";",fil)>0 then do
994 parse var fil fil';'ver; miss_ver = 0 ; end
995
996 if pos('.',fil)>0 then do
997 parse var fil fil'.'typ; miss_typ = 0 ; end
998
999 if fil\=='' then miss_fil = 0
1000 got_a_node = \miss_nod
1001
1002 if pos("::",def)>0 then do
1003 parse var def tnod"::"def
1004 rest = miss_dev + miss_dir + miss_fil + miss_typ + miss_ver
1005 if miss_nod & rest>0 then do
1006 nod=tnod; miss_nod=0; end; end
1007
1008 if pos(":",def)>0 then do
1009 parse var def tdev":"def
1010 if miss_dev then do; dev=tdev; miss_dev=0; end; end
1011
1012 if pos("<",def)>0 then do
1013 parse var def '<'tdir'>'def
1014 if miss_dir then do; dir=tdir; miss_dir=0; end; end
1015
1016 if pos(";",def)>0 then do
1017 parse var def def";"tver
1018 if miss_ver then do; ver=tver; miss_ver=0; end; end
1019
1020 if pos(".",def)>0 then do
1021 parse var def def'.'ttyp
1022 if miss_typ then do; typ=ttyp; miss_typ=0; end; end
1023
1024 if miss_fil & def\=='' then do; fil=def; miss_fil=0; end
1025
1026 if pos("::",rel)>0 then do
1027 parse var rel tnod"::"rel
1028 rest = miss_dev + miss_dir + miss_fil + miss_typ + miss_ver
1029 if miss_nod & rest>0 then do
1030 nod=tnod; miss_nod=0; end; end
1031
1032 if pos(":",rel)>0 then do
1033 parse var rel tdev":"rel
1034 if miss_dev & (\got_a_node) then do; dev=tdev; miss_dev=0; end; end
1035
1036 if pos("<",rel)>0 then do
1037 parse var rel '<'tdir'>'rel
1038 if got_a_node then tdir=''
1039 if miss_dir then do;
1040 dir=tdir; miss_dir=0; end;
1041 end
1042
1043 if pos(';',rel)>0 then
1044 parse var rel rel';'
1045
1046 if pos(".",rel)>0 then do
1047 parse var rel rel'.'ttyp
1048 if miss_typ then do; typ=ttyp; miss_typ=0; end; end
1049
1050 if miss_fil & rel\=='' then do; fil=rel; miss_fil=0; end
1051
1052 if miss_dir & miss_nod then do
1053 miss_dir = 0
1054 dir = defdir
1055 end
1056
1057 if miss_dev & miss_nod then do
1058 miss_dev = 0
1059 dev = defdev
1060 end
1061
1062 result = ''
1063 if \miss_nod then result = nod'::'
1064 if \miss_dev then result = result || dev || ":"
1065 if \miss_dir then result = result || '<' || dir || '>'
1066 if \miss_fil then result = result || fil
1067 if miss_typ then typ = ''
1068 if miss_ver then ver = ''
1069
1070 if miss_nod then i_node=''; else i_node=nod'::'
1071 if miss_dev then i_device=''; else i_device=dev':'
1072 if miss_dir then i_directory=''; else i_directory='<'dir'>'
1073 if miss_fil then i_name=''; else i_name=fil
1074 if miss_typ then i_type='.'; else i_type='.'typ
1075 if miss_ver then i_version=';'; else i_version=';'ver
1076
1077 result = result || '.' || typ || ';' || ver
1078 return result
1079
1080
1081 after_parse:
1082
1083
1084 /* ===== f$search() ===== */
1085
1086 call notify 'F$SEARCH'
1087
1088 'dir/size/ver=1000 >LIFO'
1089 drop filnam. filtyp. filver. isfile.
1090 pull
1091 pull
1092 do cnt=1 to queued()-3
1093 parse pull filnam.cnt '.' filtyp.cnt ';' filver.cnt . 1 line .
1094 isfile.line = 1
1095 end
1096
1097 cnt = cnt - 1 /* cnt incremented after last iteration */
1098
1099 types. = 0
1100 types = ''
1101 do c=1 to cnt
1102 type = filtyp.c
1103 types.type = types.type + 1
1104 if types.type=1 then
1105 types = types filtyp.c
1106 end
1107
1108 do while types\=''
1109 parse var types type types
1110 call tell type
1111 do forever
1112 file = f$search( '*.'type';*' )
1113 call blink file
1114 parse value translate(file,'<>','[]') with . '>' file .
1115 if file=='' then leave
1116 if isfile.file\==1 then
1117 call complain 'f$search() finds nonexistent file' isfile.file
1118 end
1119 end
1120
1121
1122 hfile = f$search( "*.h", 1 )
1123 cfile = f$search( "*.c", 2 )
1124 do forever
1125 if (hfile\=='') then do; hfile=f$search( "*.h", 1 ); end
1126 if (cfile\=='') then do; cfile=f$search( "*.c", 2 ); end
1127 if (cfile=='' & hfile=='') then leave
1128 end
1129
1130
1131 /* ===== f$type() ===== */
1132 call notify 'F$TYPE'
1133
1134 if f$type('asdf')\=='STRING' then
1135 call complain 'Believes that "asdf" is not a STRING'
1136
1137 if f$type('')\=='STRING' then
1138 call complain 'Believes that "" is not a STRING'
1139
1140 if f$type('4')\=='INTEGER' then
1141 call complain 'Believes that "4" is not a STRING'
1142
1143 if f$type(' + 3 ')\=='INTEGER' then
1144 call complain 'Believes that " + 3 " is not a STRING'
1145
1146 if f$type(' - 123123 ')\=='INTEGER' then
1147 call complain 'Believes that " - 123123 " is not a STRING'
1148
1149
1150
1151 /* ===== f$file_attributes() ===== */
1152 call notify 'F$FILE_ATTRIBUTES'
1153
1154
1155 files = ''
1156 /* Treat 'known' as a special case */
1157 attribs = 'alq bdt bks bls cbt cdt ctg deq did dvi edt eof fid fsz grp',
1158 'mbm mrn mrs noa nok org pro pvn rat rck rdt rfm rvn uic wck'
1159
1160
1161 'dir/size >LIFO'
1162 pull
1163 pull
1164 do queued()-3
1165 parse pull file .
1166 files = files file
1167 end
1168 pull
1169 pull
1170 pull
1171 files = space(files)
1172
1173 do while files\==''
1174 parse var files file files
1175 if (file='' | file='Directory') then iterate
1176 call blink file
1177
1178 attrs = attribs
1179 do while attrs\==''
1180 parse var attrs attr attrs
1181 push 'write sys$output f$file_attrib("'file'", "'attr'")'
1182 end
1183 'LIFO> set prompt="" >LIFO'
1184
1185 attrs = attribs
1186 do while attrs\==''
1187 parse var attrs attr attrs
1188 parse pull outcome
1189 if (outcome\==f$file_attributes(file, attr)) then do
1190 call complain "F$file_attributes didn't work for" attr', rexx='||,
1191 f$file_attributes(file,attr)', dcl='outcome
1192 end
1193 end
1194 end
1195
1196 /*
1197 * Then we process known. Strategy for testing, is to do the following
1198 * steps:
1199 *
1200 * 1) Check all files named ".EXE" in sys$system and sys$library
1201 * 2) Check that they are not fooled by concealed logicals
1202 */
1203
1204 call notify '__known_files'
1205
1206 dirs = 'SYS$SYSTEM SYS$LIBRARY'
1207 do while dirs\=''
1208 parse var dirs dir dirs
1209 call tell dir
1210 'dir/size' dir':*.exe >LIFO'
1211 inc = 1
1212 do queued()
1213 parse pull line
1214 if (left(line,1)==' ') then do
1215 prevline = line
1216 iterate
1217 end
1218
1219 if left(line,5)=='Total' then iterate
1220 if left(line,5)=='Grand' then iterate
1221 if left(line,9)=='Directory' then iterate
1222 if words(line)=1 then line = line prevline
1223 if word(line,2)='no' then iterate
1224
1225 parse var line files.inc ';'
1226 inc = inc + 1
1227 end
1228
1229 do i=1 to inc-1
1230 push 'write sys$output f$file_attributes("'dir':'files.i'","known")'
1231 end
1232
1233 'LIFO> set def nl: >LIFO'
1234
1235 do i=1 to inc-1
1236 parse pull line
1237 if (left(line,1) == '%') then do
1238 parse pull junk
1239 iterate
1240 end
1241
1242 call blink files.i
1243 if line \== f$file_attributes(dir':'files.i,'known') then
1244 call complain 'F$FILE_ATTRIBUTES differs for' files.i 'rexx=' ||,
1245 f$file_attributes(dir':'files.i,'known'),
1246 'dcl='line
1247 end
1248 end
1249
1250 /*
1251 * We assume that sys$system:show exists, and is a known image (if not,
1252 * you should seriously consider changing your system administrator)
1253 */
1254
1255
1256 oldplaces = ''
1257 place = sys$system
1258 call notify '__recursive'
1259 do until place==''
1260 if (pos(":",place)=0) then
1261 place = place || ":"
1262
1263 found = f$file_attributes(place"SHOW.EXE","KNOWN")
1264 if found\=='TRUE' then
1265 if oldplaces='' & did_find=0 then
1266 call complain 'Didn''t known that' place 'equals sys$system'
1267 else do
1268 parse var oldplaces place oldplaces
1269 iterate
1270 end
1271
1272 parse var place place ":" "[" olddirs "]"
1273 place = translate(f$trnlnm( place ), "[]", "<>" )
1274 if place=='' then do
1275 if found=='TRUE' & did_find=0 then
1276 did_find = 1
1277
1278 if oldplaces \='' then do
1279 parse var oldplaces place oldplaces
1280 iterate
1281 end
1282 leave
1283 end
1284
1285 call blink place
1286 parse var place rplace ":" "[" xdirs "]"
1287
1288 topp = f$trnlnm(rplace,,,,,'MAX_INDEX')
1289 if topp='' then topp=0
1290 do i=1 to topp
1291 xplace = f$trnlnm(rplace,,i)
1292 if right(xplace,1)==':' & xdirs\='' then
1293 xplace = xplace || '['xdirs']'
1294 else if right(xplace,2)=='.]' & xdirs\='' then
1295 xplace = left(xplace,length(place)-2) || '.' || xdirs || "]"
1296 else if xdirs\='' then
1297 xplace = xplace || ":[" || xdirs || "]"
1298 oldplaces = oldplaces xplace
1299 end
1300
1301 if right(place,2)=='.]' & olddirs\='' then
1302 place = left(place,length(place)-2) || '.' || olddirs || "]"
1303 else if olddirs\='' then
1304 place = place || ":[" || olddirs || "]"
1305
1306 end
1307
1308 if did_find=0 then
1309 call complain 'Didn''t find real file for SHOW.EXE'
1310
1311
1312 /* ===== f$extract ===== */
1313 call notify 'F$EXTRACT'
1314 if f$extract(3,4,'')\=='' then
1315 call complain 'Didn''t handle f$extract correctly'
1316
1317 if f$extract(3,4,'foobar')\=='bar' then
1318 call complain 'Didn''t handle f$extract correctly'
1319
1320 if f$extract(3,2,'foobar')\=='ba' then
1321 call complain 'Didn''t handle f$extract correctly'
1322
1323
1324 /* ===== f$element ===== */
1325 call notify 'F$ELEMENT'
1326 if f$element(0,'/','foo/bar/baz')\=='foo' then
1327 call complain 'Didn''t handle f$element correctly'
1328
1329 if f$element(1,'/','foo/bar/baz')\=='bar' then
1330 call complain 'Didn''t handle f$element correctly'
1331
1332 if f$element(2,'/','foo/bar/baz')\=='baz' then
1333 call complain 'Didn''t handle f$element correctly'
1334
1335 if f$element(3,'/','foo/bar/baz')\=='/' then
1336 call complain 'Didn''t handle f$element correctly'
1337
1338 if f$element(0,'/','/foo/bar/baz')\=='' then
1339 call complain 'Didn''t handle f$element correctly'
1340
1341 if f$element(1,'/','/foo/bar/baz')\=='foo' then
1342 call complain 'Didn''t handle f$element correctly'
1343
1344 if f$element(2,'/','/foo//bar/baz')\=='' then
1345 call complain 'Didn''t handle f$element correctly'
1346
1347 if f$element(10,'/','')\=='/' then
1348 call complain 'Didn''t handle f$element correctly'
1349
1350
1351 /* ===== f$edit ===== */
1352 call notify 'F$EDIT'
1353 if f$edit('foo bar', 'upcase') \== 'FOO BAR' then
1354 call complain 'Didn''t handle f$edit correctly'
1355
1356 if f$edit('FOO BAR', 'lowerCASE') \== 'foo bar' then
1357 call complain 'Didn''t handle f$edit correctly'
1358
1359 if f$edit('Foo bAR', 'upcase,lowercase') \== 'fOO Bar' then
1360 call complain 'Didn''t handle f$edit correctly'
1361
1362 if f$edit('foo! bar', 'uncomment') \== 'foo' then
1363 call complain 'Didn''t handle f$edit correctly'
1364
1365 if f$edit(' foo bar ', 'trim') \== 'foo bar' then
1366 call complain 'Didn''t handle f$edit correctly'
1367
1368 if f$edit(' foo bar ', 'collapse') \== 'foobar' then
1369 call complain 'Didn''t handle f$edit correctly'
1370
1371 if f$edit(' foo bar ', 'compress') \== ' foo bar ' then
1372 call complain 'Didn''t handle f$edit correctly'
1373
1374 if f$edit(' foo bar ', 'trim,compress') \== 'foo bar' then
1375 call complain 'Didn''t handle f$edit correctly'
1376
1377 if f$edit('foo bar', 'compress') \== 'foo bar' then
1378 call complain 'Didn''t handle f$edit correctly'
1379
1380 if f$edit('foo ! bar', 'uncomment') \== 'foo ' then
1381 call complain 'Didn''t handle f$edit correctly'
1382
1383 if f$edit('foo ! bar', 'uncomment,trim') \== 'foo' then
1384 call complain 'Didn''t handle f$edit correctly'
1385
1386 if f$edit('foo!bar', 'uncomment') \== 'foo' then
1387 call complain 'Didn''t handle f$edit correctly'
1388
1389 if f$edit(' foo bar ', 'collapse,compress') \== 'foobar' then
1390 call complain 'Didn''t handle f$edit correctly'
1391
1392
1393
1394 /* ===== F$CVUI ===== */
1395 call notify 'F$CVUI'
1396 if f$cvui(2,4,'deadbeef'x)\=='7' then
1397 call complain 'Didn''t handle f$cvui correctly'
1398
1399 if f$cvui(0,0,'deadbeef'x)\=='0' then
1400 call complain 'Didn''t handle f$cvui correctly'
1401
1402 if f$cvui(0,0,'')\=='0' then
1403 call complain 'Didn''t handle f$cvui correctly'
1404
1405 if f$cvui(0,4,'deadbeef'x)\=='13' then
1406 call complain 'Didn''t handle f$cvui correctly'
1407
1408 if f$cvui(2,0,'deadbeef'x)\=='0' then
1409 call complain 'Didn''t handle f$cvui correctly'
1410
1411
1412 /* ===== F$CVSI ===== */
1413 call notify 'F$CVSI'
1414 if f$cvsi(2,4,'deadbeef'x)\=='7' then
1415 call complain 'Didn''t handle f$cvsi correctly'
1416
1417 if f$cvsi(0,7,'deadbeef'x)\=='-17' then
1418 call complain 'Didn''t handle f$cvsi correctly'
1419
1420 if f$cvsi(0,1,'0'b)\=='0' then
1421 call complain 'Didn''t handle f$cvsi correctly'
1422
1423 if f$cvsi(0,4,'deadbeef'x)\=='-3' then
1424 call complain 'Didn''t handle f$cvsi correctly'
1425
1426 if f$cvsi(2,1,'deadbeef'x)\=='0' then
1427 call complain 'Didn''t handle f$cvsi correctly'
1428
1429
1430
1431 start_here:
1432
1433 /* ===== f$cvtime() ===== */
1434 call notify 'F$CVTIME'
1435 if (f$cvtime(,,'year')\==word(date(),3)) then
1436 call complain 'Didn''t handle simple f$cvtime for output of year'
1437
1438 if (f$cvtime(,,'month')\==substr(date('e'),4,2)) then
1439 call complain 'Didn''t handle simple f$cvtime for output of month'
1440
1441 if (f$cvtime(,,'day')\==substr(date('e'),1,2)) then
1442 call complain 'Didn''t handle simple f$cvtime for output of day'
1443
1444 if (f$cvtime(,,'hour')\==substr(time(),1,2)) then
1445 call complain 'Didn''t handle simple f$cvtime for output of hour'
1446
1447 if (f$cvtime(,,'minute')\==substr(time(),4,2)) then
1448 call complain 'Didn''t handle simple f$cvtime for output of minute'
1449
1450 if (f$cvtime(,,'second')\==substr(time(),7,2)) then
1451 call complain 'Didn''t handle simple f$cvtime for output of second'
1452
1453 vax = f$cvtime(,,'hundredth')
1454 if (length(vax)\=2 | datatype(vax)\=='NUM') then
1455 call complain 'Didn''t handle simple f$cvtime for output of hundredth'
1456
1457 if (f$cvtime(,,'weekday')\==date('w')) then
1458 call complain 'Didn''t handle simple f$cvtime for output of weekday'
1459
1460 if (f$cvtime(,,'date')\==insert('-',insert('-',date('s'),6),4)) then
1461 call complain 'Didn''t handle simple f$cvtime for output of date'
1462
1463 /* don't check the hundredth of seconds */
1464 vax = f$cvtime(,,'time')
1465 rexx = left(time('l'),11)
1466 if length(vax)\=length(rexx) |,
1467 left(rexx,length(rexx)-2)\==left(vax,length(vax)-2) then
1468 call complain 'Didn''t handle simple f$cvtime for output of time'
1469
1470 vax = f$cvtime(,,'datetime')
1471 rexx = insert('-',insert('-',date('s'),6),4) left(time('l'),11)
1472 if length(vax)\=length(rexx) | ,
1473 left(rexx,length(rexx)-2)\==left(vax,length(vax)-2) then
1474 call complain 'Didn''t handle simple f$cvtime for output of datetime'
1475
1476
1477
1478 abs = 'absolute'
1479 if (f$cvtime(,abs,'year')\==word(date(),3)+0) then
1480 call complain 'Didn''t handle simple f$cvtime for output of year'
1481
1482 if (f$cvtime(,abs,'month')\==translate(left(date('m'),3))) then
1483 call complain 'Didn''t handle simple f$cvtime for output of month'
1484
1485 if (f$cvtime(,abs,'day')\==substr(date('e'),1,2)+0) then
1486 call complain 'Didn''t handle simple f$cvtime for output of day'
1487
1488 if (f$cvtime(,abs,'hour')\==substr(time(),1,2)) then
1489 call complain 'Didn''t handle simple f$cvtime for output of hour'
1490
1491 if (f$cvtime(,abs,'minute')\==substr(time(),4,2)) then
1492 call complain 'Didn''t handle simple f$cvtime for output of minute'
1493
1494 if (f$cvtime(,abs,'second')\==substr(time(),7,2)) then
1495 call complain 'Didn''t handle simple f$cvtime for output of second'
1496
1497 vax = f$cvtime(,abs,'hundredth')
1498 if (length(vax)\=2 | datatype(vax)\=='NUM') then
1499 call complain 'Didn''t handle simple f$cvtime for output of hundredth'
1500
1501 if (f$cvtime(,abs,'weekday')\==date('w')) then
1502 call complain 'Didn''t handle simple f$cvtime for output of weekday'
1503
1504 if (f$cvtime(,abs,'date')\==translate(translate(date()),'-',' ')) then
1505 call complain 'Didn''t handle simple f$cvtime for output of date'
1506
1507 /* don't check the hundredth of seconds */
1508 vax = f$cvtime(,abs,'time')
1509 rexx = left(time('l'),11)
1510 if length(vax)\=length(rexx) |,
1511 left(rexx,length(rexx)-2)\==left(vax,length(vax)-2) then
1512 call complain 'Didn''t handle simple f$cvtime for output of time'
1513
1514 vax = f$cvtime(,abs,'datetime')
1515 rexx = translate(translate(date(),'-',' ')) left(time('l'),11)
1516 if length(vax)\=length(rexx) | ,
1517 left(rexx,length(rexx)-2)\==left(vax,length(vax)-2) then
1518 call complain 'Didn''t handle simple f$cvtime for output of datetime'
1519
1520
1521
1522 tim = '33-07:09:06.34'
1523 del = 'delta'
1524 if (f$cvtime(tim,del,'day')\=='33') then
1525 call complain 'Didn''t handle simple f$cvtime for output of day'
1526
1527 if (f$cvtime(tim,del,'hour')\=='07') then
1528 call complain 'Didn''t handle simple f$cvtime for output of hour'
1529
1530 if (f$cvtime(tim,del,'minute')\=='09') then
1531 call complain 'Didn''t handle simple f$cvtime for output of minute'
1532
1533 if (f$cvtime(tim,del,'second')\=='06') then
1534 call complain 'Didn''t handle simple f$cvtime for output of second'
1535
1536 if f$cvtime(tim,del,'hundredth')\=='34' then
1537 call complain 'Didn''t handle simple f$cvtime for output of hundredth'
1538
1539 if (f$cvtime(tim,del,'date')\=='33') then
1540 call complain 'Didn''t handle simple f$cvtime for output of date'
1541
1542 if f$cvtime(tim,del,'time')\=='07:09:06.34' then
1543 call complain 'Didn''t handle simple f$cvtime for output of time'
1544
1545 if f$cvtime(tim,del,'datetime')\=='33 07:09:06.34' then
1546 call complain 'Didn''t handle simple f$cvtime for output of datetime'
1547
1548
1549 abs = 'absolute'
1550 tim = '12-JAN-1993:13:23:34.45'
1551 if (f$cvtime(tim,abs,'year')\=='1993') then
1552 call complain 'Didn''t handle simple f$cvtime for output of year'
1553
1554 if (f$cvtime(tim,abs,'month')\=='JAN') then
1555 call complain 'Didn''t handle simple f$cvtime for output of month'
1556
1557 if (f$cvtime(tim,abs,'day')\=='12') then
1558 call complain 'Didn''t handle simple f$cvtime for output of day'
1559
1560 if (f$cvtime(tim,abs,'hour')\=='13') then
1561 call complain 'Didn''t handle simple f$cvtime for output of hour'
1562
1563 if (f$cvtime(tim,abs,'minute')\=='23') then
1564 call complain 'Didn''t handle simple f$cvtime for output of minute'
1565
1566 if (f$cvtime(tim,abs,'second')\=='34') then
1567 call complain 'Didn''t handle simple f$cvtime for output of second'
1568
1569 if (f$cvtime(tim,abs,'hundredth')\=='45') then
1570 call complain 'Didn''t handle simple f$cvtime for output of hundredth'
1571
1572 if (f$cvtime(tim,abs,'date')\=='12-JAN-1993') then
1573 call complain 'Didn''t handle simple f$cvtime for output of date'
1574
1575 if (f$cvtime(tim,abs,'time')\=='13:23:34.45') then
1576 call complain 'Didn''t handle simple f$cvtime for output of time'
1577
1578 if (f$cvtime(tim,abs,'datetime')\=='12-JAN-1993 13:23:34.45') then
1579 call complain 'Didn''t handle simple f$cvtime for output of datetime'
1580
1581 date = translate(translate(date()),'-',' ')
1582 if (f$cvtime('::34.56',abs)\==date left(time(),5)':34.56') then
1583 call complain 'Didn''t handle simple f$cvtime for output of time'
1584
1585 vax = f$cvtime('DEC::34',abs)
1586 if left(vax,length(vax)-3) \== word(date(),1)'-DEC-'word(date(),3),
1587 overlay('34',time(),4) then
1588 call complain 'Didn''t handle simple f$cvtime for output of datetime'
1589
1590 vax = f$cvtime('25-:14',abs)
1591 if left(vax,length(vax)-3)\==,
1592 '25-'translate(word(date(),2))'-'word(date(),3),
1593 '14:'substr(time(),4) then
1594 call complain 'Didn''t handle simple f$cvtime for output of datetime'
1595
1596 if f$cvtime('+:5',abs,'minute')\=(substr(time(),4,2)+5)//60 then
1597 call complain 'Didn''t handle simple f$cvtime for output of datetime'
1598
1599 if f$cvtime('-1-00',abs,'day')\==word(date(),1)-1 then
1600 call complain 'Didn''t handle simple f$cvtime for output of datetime'
1601
1602 if f$cvtime('3:-1-10',abs,'hour')\=='17' then
1603 call complain 'Didn''t handle simple f$cvtime for output of datetime'
1604
1605 if f$cvtime('-1-',abs,'day')\==word(date(),1)-1 then
1606 call complain 'Didn''t handle simple f$cvtime for output of datetime'
1607
1608 if f$cvtime('-1',abs,'day')\==word(date(),1) then
1609 call complain 'Didn''t handle simple f$cvtime for output of datetime'
1610
1611 if f$cvtime('-3-:30',abs,'day')\==word(date(),1)-3 then
1612 call complain 'Didn''t handle simple f$cvtime for output of datetime'
1613
1614
1615 if f$cvtime("10:59:59.999","comparison",'time')\=='11:00:00.00' then
1616 call complain 'Didn''t round comparison time properly'
1617
1618 if f$cvtime("10:59:59.999","absolute",'time')\=='11:00:00.00' then
1619 call complain 'Didn''t round absolute time properly'
1620
1621 if f$cvtime("10:59:59.999","delta",'time')\=='11:00:00.00' then
1622 call complain 'Didn''t round delta time properly'
1623
1624
1625 /* ===== f$fao ===== */
1626 call notify 'F$FAO'
1627
1628 test = f$fao("Foo !3(10UB) bar", 123, -234, 345 )
1629 if test\=='Foo' format(123,10) || format(-234+256,10) ||,
1630 format(345//256,10) 'bar' then
1631 call complain "f$fao doesn't handle !UB correctly"
1632
1633 test = f$fao("Foo !3(10UW) bar", 123, -234, 345 )
1634 if test\=="Foo" format(123,10) || format(-234+(2**16),10) ||,
1635 format(345,10) 'bar' then
1636 call complain "f$fao doesn't handle !UW correctly"
1637
1638 numeric digits 16
1639 test = f$fao("Foo !3(12UL) bar", 123, -234, 345 )
1640 if test\=="Foo" format(123,12) || format(4294967062,12) ||,
1641 format(345,12) 'bar' then
1642 call complain "f$fao doesn't handle !UW correctly"
1643
1644 test = f$fao( "One !SW !SB !2(5AS)!2(2UB) !XB !UL !OB",,
1645 2, 3, 'four', 'five', -250, 7, 8, 9, 8 )
1646 if test\== "One 2 3 four five 6 7 08 9 010" then
1647 call complain "Mixed f$fao didn't work"
1648
1649
1650
1651 exit
1652
1653 'sh dev sys$login: /full >LIFO'
1654 disk_dev = ''
1655 do queued()
1656 parse pull line
1657 disk_dev = disk_dev line
1658 end
1659
1660
1661
1662 say 'hallo'
1663 exit 0
1664
1665
1666
1667 syntax:
1668 say 'oops ... feil for item='item
1669 signal on syntax
1670 signal restart
1671
1672 'sh dev sys$login: /full >LIFO'
1673 disk_dev = ''
1674 do queued()
1675 parse pull line
1676 disk_dev = disk_dev line
1677 end
1678
1679
1680
1681 say 'hallo'
1682 exit 0
1683
1684
1685
1686 complain: procedure expose global. sigl
1687 trace off
1688 say ' ...ouch...'
1689 say 'Tripped in line' sigl':' 'ARG'(1)'.'
1690 global.point = 0
1691 return
1692
1693
1694 blink: procedure expose global.
1695 parse arg word .
1696 if global.point=0 then do
1697 call charout ,global.indent' '
1698 global.point = length(global.indent' ')
1699 global.blink = 0
1700 end
1701
1702 if (global.point + length(word) + 1) > global.max then do
1703 call charout ,copies('082008'x,global.blink)
1704 say
1705 call charout ,global.indent word
1706 global.point = length(global.indent)
1707 end
1708 else
1709 call charout , copies('082008'x,global.blink) || ' 'word
1710
1711 global.blink = length(word)+1
1712 return
1713
1714
1715 tell: procedure expose global.
1716 parse arg word .
1717 if global.point=0 then do
1718 call charout ,global.indent' '
1719 written = length(global.indent' ')
1720 global.blink = 0
1721 end
1722
1723 call blink ''
1724 global.point = global.point + length(word) + 2
1725 if global.point>75 then do
1726 say ','
1727 global.point = length(global.indent word)
1728 call charout , global.indent word
1729 end
1730 else
1731 call charout , word', '
1732 return
1733
1734 notify: procedure expose global.
1735 parse arg word .
1736 if datatype(global.point)\='NUM' then do
1737 global.indent = ' '
1738 global.point = 0
1739 global.max = 79
1740 global.blink = 0
1741 end
1742
1743 call blink ''
1744 if global.point\=0 then
1745 say
1746
1747 call charout ,translate(word)' ==> '
1748 global.point = length(word' ==> ')
1749 return
1750