-
Notifications
You must be signed in to change notification settings - Fork 0
/
pcl.txt
4154 lines (3016 loc) · 137 KB
/
pcl.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
TOPS-20
Extended PROGRAMMABLE COMMAND LANGUAGE
USER'S GUIDE
AND
REFERENCE MANUAL
Ray SCOTT
Extensions by Michel E. DEBAR
12 January 1983
Copyright (C) 1983 Carnegie Mellon University Computation Center
FNDP Computing Centre, Namur Belgium
1. INTRODUCTION
1.1. Programmable Command Language
The PCL Extension to the TOPS-20 EXEC puts a language and executor into the
TOPS-20 EXEC. With this high level language and its extensions, users can
easily to write their own PCL programs which will will look like existing TOPS
commands complete with parameter substitution and TOPS-20 style recognition.
PCL is due to Ray SCOTT from Carnegie Mellon University Computation Center:
Carnegie-Mellon University,
Computation Center,
Schenley Park
5000 Forbes Avenue,
Pittsburgh PA 15213 (phone +1.412.578-26-42).
This manual describes an extended version of PCL, with extensions by Michel E
Debar: FNDP Computing Centre, Rue Grandgagnage, 21 B-5000 Namur Belgium (phone
+32.81.22-06-31, telex 59.222 Fac.Nam. B. Belgium).
You should consult the "TOPS-20 PROGRAMMABLE COMMAND LANGUAGE - User's Guide
and Reference Manual" from CMU for the complete documentation of the official
(non extended) version of PCL. (That manual is on our distribution tape in
<pcl5.doc>pcl.lpt. The present manual is in <pcl5.x-doc>pclx.lpt. )
1.2. PCL Uses
PCL may be used in a variety of different ways. Users might write friendly
front ends to existing programs. The command parsing with recognition makes a
very easy way to do parameter passing to a program. Periodic or repetitive
tasks can be coded in PCL routines which would reduce the amount of typing
needed to accurately execute all the steps necessary to complete a piece of
production.
PCL also will provide a means for implementing completely new functions which
are not possible in the current EXEC. For example, if the user has a graphics
terminal which takes special support then PCL can be used to provide new
support commands.
System administrators can tailor their EXEC to provide local commands that
override the function of standard commands. An administrator may wish to
eliminate the PLOT command if there is no plotter on the system.
1.3. PCL Features
The main features of PCL are:
- ALGOL-like language constructs
- string manipulation
- callable procedures with parameters
- system services
- flexible user interface
- program interface
- input/output capabilities
1.4. Notational conventions
In this document the format of commands is given using simple conventions:
- [...] is used to denote an optional item.
- "integer1 [,integer2 ...]" denotes one more integers, separated by
commas.
- {option1 | option2} denotes alternative items.
2. EXEC INTERFACE
PCL commands can be written with any text editor. The source for these
commands is stored in files with the default type PCL. Source files are
compiled into a command by the new EXEC command DECLARE . Once the command is
successfully compiled, it is stored in the EXEC and becomes a part of the list
of commands that the user has available during that job. If the DECLARE
command detects an error in the PCL source, an error message will be typed on
the terminal along with the line in error and a pointer indicating about where
the error occurred. Once an error is detected the compilation stops at that
point.
Any user command which has the same name as an existing command overlays the
existing command. The new EXEC command ORIGINAL may be used to execute any of
the standard EXEC commands. Commands may be removed with the UNDECLARE
command.
In addition to declaring PCL commands, the user may use the DECLARE command
to declare procedures which may be called from user commands, string variables,
and integer variables. One PCL source file may contain many command,
procedure, and variable declarations. The variables may be given values by
using the SET command with the new options STRING-VARIABLE or INTEGER-VARIABLE.
For example:
@SET STRING-VARIABLE myname (TO) scott
The string variable MYNAME may be accessed from any declared command or
procedure.
A new option to the INFORMATION command, the PCL-OBJECTS option, will show
the user all user defined commands, procedures, and variables.
@INFORMATION (ABOUT) PCL-OBJECTS
Commands: DRP, REMIND, NETMAILCHECK, DIALUPLINE, COURIER
Procedures: MATCH
Variables: String MYNAME, Integer MYJOB
Once the user has a set of procedures and commands defined, these may be
saved in an ENVIRONMENT using the ENVIRONMENT option to the new PRESERVE
command. To recall an environment, use the DECLARE command with the
ENVIRONMENT option. Commands and procedures in environment files are stored in
an internal format, so they are not recompiled when declared. The user may
declare multiple ENVIRONMENT files and the commands from each environment will
be added to the user's EXEC command list. Commands (re)defined are listed on
the user terminal unless you use the /NOCONFIRM option of DECLARE.
3. THE PCL LANGUAGE
3.1. General Command Format
The formal definition of a command is :
COMMAND name;
PCL statement
A simple example would be:
COMMAND simple;
Display "This is a simple command";
If the above 2 lines were in the file simple.pcl then
@DECLARE PCL simple.pcl
would enter the command simple into the users EXEC. If the user types:
@SIMPLE
at the "@" prompt then
This is a simple command
would be typed on the user's terminal.
The most general (and useful) simple definition of a command is:
COMMAND name;
Begin
[INTEGER, STRING and EXTERNAL declarations]
PCL-Statement;
[...;]
End
where any number of PCL statements separated by semi-colons may be between the
BEGIN-END pair. Note that all Integer, String and External statements must
appear before any other PCL statement.
Begin...End may be used to group any number of PCL statements into a single
statement. Note that braces {...} may be used in lieu of Begin..End:
if i > 100 then begin
display "Out of Range";
i = 50;
end;
Statement labels may be up to 40 characters long and are terminated with a
colon. Labels are used by the GOTO statement (see page 32) and by the parse
error handler (see page 11):
if i gtr 100 then goto horror;
...
Horror:
display "Can't proceed";
exit;
Comments may be placed anywhere in PCL source files.
Simple comments start with an exclamation mark and extend to the end of the
current line:
Display "Hi" + !This is a comment
" Mate";
Inline Comments are enclosed between !{...}!. They may appear in the middle
of a line, they may extend over several lines and they may be nested. Inline
comments are useful for commenting out large sections of code, long comments,
and in-line commenting:
!{ Ring the
terminal Bell }!
call $Jsys1 ( 8%74 !{pbout}!, 8%7);
3.2. PCL Constants
PCL knows of only two types of constants: integers and strings.
Integers are signed integers (expressed as 36 bit quantities). Integer
constants are of the form:
Format 1.
number
Format 2.
base%number
The first form is a number in base 10. The second form allows to enter numbers
in any base from 2 to 36. For bases higher than 10 the letters "a" through "z"
are used to enter the digits 10 through 35:
12 (decimal)
8%14 (octal)
16%C (hexadecimal)
8%777777777777 (actually -1)
The system procedures $string and $integer are used to convert numbers to
strings and back, with an optional radix.
Strings are of the form "string". They may be freely concatenated using the
"+" operator. Presently string constants are limited to 512 characters. String
variables do not have that restriction.
3.3. PCL Variables
PCL has two types of variables: string and integer variables. Variables may
be either local to a procedure or global.
Variables to be used in PCL commands must be declared at the beginning of the
command. For example:
COMMAND simple;
BEGIN
STRING name_in_full;
INTEGER count;
EXTERNAL INTEGER screen_size;
...
END
would define the local variables name_in_full (string) and count (integer), and
give the procedure access to a global variable screen_size (integer). Variable
names may be any combination of letters, numbers, and the under-score
character. Names may be up to 40 characters in length.
Variables may be assigned values using a simple assign statement.
COMMAND simple;
BEGIN
STRING name_in_full;
INTEGER count;
count = 3;
name_in_full = "J. Ray Scott";
...
END
Local variables are known only within the command or procedure in which they
are declared.
Global variables are known to any procedure which declares them external.
They may be manipulated either by PCL commands, or by the Exec commands:
@DECLARE INTEGER-VARIABLE or
@DECLARE STRING-VARIABLE (see page 25)
@SET INTEGER-VARIABLE or
@SET STRING-VARIABLE (see page 51)
@INFORMATION (about) VARIABLE variable_name
(see page 35)
If they are to be used by a specific set of library routines, it is best to
declare them as global variables in the PCL source file:
integer screen_size ! global variable
command set-screen;
begin
external integer screen_size;
...
end
3.4. Reserved names
PCL uses a number of reserved names which you may not use outside of their
normal context. For instance, you may not use them as variable names:
ABORT INPUT SYNONYM
ALWAYS INRANGE THEN
BEGIN INTEGER TIME
BINARY INVISIBLE TO
CALL INVOKE TOPROGRAM
CASE KILLPROGRAM TYPEIN
CLEARTYPEOUT LEQ UNTIL
COMMAND LET WHILE
DATE LSS WILD
DCM NEQ WORDS
DEFAULT NOECHO
DEFAULT_DEV NOHELP
DEFAULT_DIR NOINDIRECT
DEFAULT_EXT NOORIGINAL
DEFAULT_GEN NOP
DEFAULT_NAM NORETURN
DELETED OF
DISPLAY ORIGINAL
DO OTHERWISE
DOCOMMAND OUTPUT
ELSE PARSE
END PARSEONLY
EQL PASO
EXIT PASSOUTPUT
EXTERNAL PROCEDURE
FROM PROMPT
GEQ RADIX
GETTYPEOUT RETURN
GOTO SAVE
GTR SELECT
GUIDE SELECTALL
HELP STDHELP
IF STRING
3.5. String Manipulation
Strings may be concatenated using simple addition statements.
conc_string = "Welcome " + name_in_full
other_string = other_string + "appended text."
Substrings may be extracted from strings:
extr_string = conc_string[n:m]
where n is the starting character number and m is the number of characters to
extract. The leftmost character is character position 1. The user may use
th
[n:*] to extract from the n character to the end of the string.
The length of a string may be obtained using the $LENGTH system service.
count = $LENGTH(conc_string)
would assign the length of the string conc_string to the integer variable
count.
A PCL routine may search for a substring of a string by using the $SEARCH
system service:
count = $SEARCH(conc_string,"SCOTT")
would assign the starting location of the string SCOTT to count if it was found
in the string conc_string. If no match is found $search returns 0.
3.6. Logical expressions
Several PCL statements use logical expressions comparing integers or strings.
String comparison is based on the Ascii character sequence. So that "ABC" is
less than "ABD" for instance.
The syntax of a logical expression is:
operand1 logical-operator operand2
where:
operand1,operand2
are both integer expressions or both string expressions
operator
is one of:
- LSS or <
- LEQ or <=
- EQL or =
- NEQ or <>
- GEQ or >=
- GTR or >
3.7. Procedures
The format of a procedure definition in a source file is the same at that of
a command definition except that the word COMMAND is replaced with the word
PROCEDURE. A RETURN statement will return to the calling PCL routine.
PROCEDURE doit;
Begin
...
Return
End
To use the procedure DOIT in a command it must be declared and then called.
COMMAND callit;
Begin
EXTERNAL PROCEDURE doit;
...
CALL doit;
...
End
Parameters to procedures are declared by placing the list of parameters in
parenthesis after the procedure name. The parameters must be typed, i.e., they
must be specified as being either integers or strings.
PROCEDURE doit (INTEGER para_1,para_2; STRING para_1);
Procedures may have a type and thus return a value. To have a typed
procedure the word INTEGER or STRING is placed in front of the PROCEDURE
keyword in the source file. The value to be returned is placed after the
RETURN. This may be any expression of the appropriate type.
INTEGER PROCEDURE upone (INTEGER in);
RETURN in+1
Procedures may modify their arguments (they are Input and Output formals):
PROCEDURE CAT (string s1,s2,s3);
s3 = s1 +s2;
3.8. PCL Flow Control
PCL provides several ways to control the sequence of execution:
- ABORT
- EXIT
- RETURN
- DO, WHILE, UNTIL
- IF ... THEN ... ELSE ...
- CASE
- SELECT
- GOTO
3.8.1. ABORT
Abort stops the execution of a PCL command and returns at Exec command level
after printing an error message preceded by "?". See page 18.
3.8.2. EXIT
Exit stops the execution of a PCL command without printing any message. see
page 29.
3.8.3. RETURN
Return exits from the current PCL procedure and returns to its caller. If
used in a command RETURN acts as EXIT.
3.8.4. DO, WHILE, UNTIL
DO, WHILE, and UNTIL are available for program loops. These may be used in
the following combinations:
1. DO PCL statement WHILE logical expression
2. DO PCL statement UNTIL logical expression
3. WHILE logical expression DO PCL statement
4. UNTIL logical expression DO PCL statement
...
i = 3;
do begin
display i;
i = i - 1;
end
until
i eql 0;
3.8.5. IF
The IF statement will execute a PCL statement if the condition is true. IF
may have an ELSE clause.
IF str_val = "xyz" THEN
PCL statement
ELSE
PCL statement
3.8.6. CASE
The case statement provides a method of selectively executing PCL statements
depending on the value of an integer variable. The variable value is tested for
a match with specified constants. If a match is found the corresponding PCL
statement is executed:
CASE count FROM 1 to 10 of BEGIN
1,2 : BEGIN ... END;
3 TO 6, 10 : BEGIN ... END;
5 : BEGIN ... END;
INRANGE : BEGIN ... END
OUTRANGE : BEGIN ... END
END
3.8.7. SELECT
The SELECT statement is similar to the CASE statement. Instead of choosing
among a set of integer values in a range, SELECT chooses among arbitrary
expressions. The expression and the test values must be of the same type,
either integer or string.
SELECT str_var of BEGIN
"abc" : BEGIN ... END;
"xyz" : BEGIN ... END;
OTHERWISE : Display "Not found"
END
In the above example. If str_var contains the string abc then the statements
in the BEGIN-END pair after "abc": will be executed. If str_var is neither abc
nor xyz then the OTHERWISE clause will be executed, in this case it will
display
Not found
on the terminal and proceed to the next PCL statement after the SELECT
statement.
3.8.8. SELECTALL
The SelectAll statements is basically similar to Select, except that after
executing one case it goes on to try to find more matches:
SELECTALL int_var of begin
1,3 : display "1 or 3";
2,4 : display "2 or 4";
1 TO 2 : display "1 or 2";
ALWAYS : display "Always";
OTHERWISE : display "Neither 1,2,3,4";
end;
If Int_var is 2, this will display "2 or 4", then "1 or 2" and "always".
ALWAYS always gives a match, OTHERWISE matches only if no previous case matched
(for instance if int_var is 5).
3.8.9. GOTO
The GOTO PCL statement causes an unconditional transfer to a label.
COMMAND xfer;
BEGIN
...;
loop1:
...;
GOTO loop1;
...
END
4. SYSTEM SERVICES
Various system services are provided to return specific system information or
perform system functions.
4.1. System Constants
PCL provides pre-defined constants that are useful in writing PCL routines,
or necessary to specify the arguments to some PCL system procedures.
$Append INTEGER - An option to $OPEN for append mode.
$Cr STRING - Contains just a carriage return.
$Crlf STRING - Contains a carriage return and a line feed.
$Input INTEGER - An option to $OPEN for input mode.
$Lf STRING - A string containing a line feed.
$Nul STRING - Read/write string like NUL:, returns a null string.
$Output INTEGER - An option to $OPEN for output mode.
$Parse INTEGER - Specifies the file currently parsed for the
$File_Dev, $File_Dir, $File_Dir, $File_Nam, $File_Typ,
$File_Gen, $Fileinfo_I, $FileInfo_S and $FileSet system
procedures (see page 8).
$Quote STRING - A string containing a double quote character.
Other constants are provided by PCL specifically to ease the use of certain
system procedures: see pages 8, 8.
4.2. System Variables
Some system procedures look like variables and may be used in most statements
where PCL allows to use a variable. Some of these variables may be changed by
the user (eg the prompts).
The restrictions on the use of system variables are:
- they may not be used as the arguments to PARSE options:
PARSE (KEYWORD (WORDS(...),
DEFAULT $ConnectedDirectory ));
is wrong and must be replaced by
mydir = $ConnectedDirectory;
PARSE (KEYWORD (WORDS(...),
DEFAULT mydir));
- a string system variable may not be used as argument to $Strloc.
Most of these restrictions are NOT detected when you declare a PCL statement,
but their violation leads to wrong behaviour when executing the command.
The system service variables are:
$Ac1, $Ac2, $Ac3, $ac4
INTEGER - Contain the first four register values after the last
$Jsys executed.
$Account STRING - The account of the current job.
$ARPAnet_Node STRING - The system's ARPAnet node name. This is a null string
if the system is not on the ARPAnet.
$Atom STRING - After a PARSE statement, contains the text typed in
for most parse types (all but Noise, EOL, Comma, and Token.)
$Batch_Job INTEGER - Non-zero if the job is a batch job.
$Command STRING - Contains the complete text of the last command parsed,
or of the current command up to the last field parsed with a
PARSE PCL statement.
$ConnectedDirectory
STRING - The name of the currently connected directory
$Curtad INTEGER - The current date and time in system internal format.
(Date and Time: Tops 20 stores dates and time internally in a
single integer with in the left half the day counted since the
18th of November 1858, and in the right half the fraction of
the day elapsed since midnight. The fraction is the numerator
of a fraction that has a denominator of 2**18. When entering a
date and time into Tops 20, all usual formats are valid: 3-DEC-
83, 03/DEC/83, 08:51, 16:50, 4:50PM, etc. The system routines
$Curtad, $Date, $InputTad, $OutputTad, $ExpandTad and $MergeTad
deal with dates and times. )
$Date STRING - Current date in DD-MON-YY format
$DECnet_Node STRING - The system's DECnet node name. This is a null string
if the system is not on a DECnet.
$Directory STRING - After executing a parse of Directory(ies) with PARSE
DIRECTORY or DIRECTORYLIST, contains the name of the current
directory parsed, including the angle brackets ("<...>"). (see
page 10).
$EMACSTerminal INTEGER - Returns a 1 if the current terminal can be
"effectively" used by EMACS, 0 if not. [CMU and sites who
customize PCL only].
$FileL STRING - After executing a PARSE FILE statement or some similar
PARSE (INPUTFILE, OUTPUTFILE, FILELIST), this contains the file
name entered in the longest form,
DEV:<DIRECTORY>FILE.EXT.VERSION
$FileN STRING - After parsing a filename this contains the file name
entered in the normal form, FILE.EXT.VERSION
$FileS STRING - After parsing a filename this contains the file name
entered in the form FILE.EXT. It will contain device: and
<directory> if they are different from the connected device and
directory.
$FileV INTEGER - After parsing a filename this contains contains just
the generation number as an integer variable
$JobNo INTEGER - The number of the current job
$JsysOk INTEGER - Set to 1 when $Jsys succeeds, to 0 when it fails.
$LastErrCode INTEGER - The number of the last JSYS error
$LastError STRING - The text of the last JSYS error
$PromptEnb STRING - The standard enabled prompt string, may be changed.
$PromptEnbSub STRING - The standard enabled subcommand prompt string, may be
changed.
$PromptReg STRING - The standard prompt string, which may be changed if
the usual "@" is not suitable:
$PromptReg = "Tops20>";
$PromptSub STRING - The standard subcommand prompt string, may also be
changed.
$TermNumber INTEGER - The number of the controlling terminal
$TermWidth INTEGER - The terminal width of the controlling terminal.
$TermLength INTEGER - The terminal length of the controlling terminal.
$Time STRING - Current time in HH:MM:SS format.
$TType INTEGER - The terminal type index (GTTYP%) of the controlling
terminal.
$Typeahead_Count
INTEGER - The number of characters which have been typed-ahead
on the controlling terminal.
$User STRING - After parsing a user name with PARSE USER or USERLIST
this contains the current User Name parsed, (without angle
brackets "<...>"). (see page 10).
$UserName STRING - The user name of the current job
$Value INTEGER - Contains a number returned by a Parse: The number
typed in for a Number field, the value for a Keyword or Switch,
or the internal date and time for a DayTime.
$Xatom STRING - Contains the atom parsed by the last PARSE statement.
Note that when parsing a Filelist, DirectoryList or UserList,
this does not contain the whole field but only the last atom
actually parsed by the Comnd JSYS.
4.3. System Procedures
PCL provides pre-defined procedures. Some are typed procedures and therefore
may be used like variables in PCL statements. Others return their results in
parameters. In the following list of system procedures, if a procedure returns
a value then STRING or INTEGER precedes the description, otherwise we indicate
PROCEDURE. A simple procedure that does not return a value must be called:
CH = $OPEN ("TEST.DAT", $INPUT);
...
CALL $CLOSE (CH);
$And (int1, int2)
INTEGER - Returns the bitwise AND of the integers int1 and
int2.
$Close (channel)
PROCEDURE - Closes the file that is open on Channel.
$CvItC (integer)
STRING - Returns the character whose value is equal the
Integer. This is useful for manipulating control characters.
$CvCtI (string) INTEGER - Converts the first character in String into an
integer. This is useful for control character manipulation.
$DirectoryInfo_I (directory, code)
INTEGER -
$DirectoryInfo_S (directory, code)
STRING - $DirectoryInfo_I and $DirectoryInfo_S return integer
or string information that may be obtained using the GTDIR or
GTDAL JSYS's (refer to the Tops 20 Monitor Calls Reference
Manual for more details). Directory is the directory name
(string). The CRDIR directory block layout is reproduced in
appendix II.
$DirectoryInfo_I returns an integer. It admits the following
values for Code:
$CDDFE default off-line expunge date and time (-- not
yet implemented in tops20 v5 --)
$CDDNE -- not yet implemented in tops20 v5 --
$CDDPT directory protection
$CDFPT default file protection
$CDLEN default on-line expiration date (-- not yet
implemented in Tops 20 V5 --)
$CDLIQ working disk quota
$CDLLD date last login
$CDLOQ permanent disk quota
$CDMOD directory mode word
$CDNUM directory number
$CDPRV capabilities word
$CDRET default number of generations to keep
$CDSDQ maximum number of subdirectories
$CDUSD Disk space used (as returned by the GTDAL Jsys,
and usually not correct under Tops20 V5).
$DirectoryInfo_S returns a string. It admits the following
values of Code:
$CDCUG subdirectory groups
$CDDAC default account string
$CDDGP directory groups
$CDPSW password string
$CDUGP user groups
The user/directory groups and the subdirectory groups are
returned as a string with all the group numbers separated by
commas. For example:
! User groups
display $directoryinfo_s ("<DOE>", $CDUGP);
! Default account
display $directoryinfo_s ("<DOE>", $CDDAC);
! Protection
display $string ( $Directoryinfo_I("<DOE>", $CDDPT), 8);
Presently there is no $DirectorySet function in PCL.
$Eof (channel) INTEGER - Set to -1 if a $READ reaches an end of file on
Channel, otherwise returns 0.
$ExpandTad (idate, year, month, day of month, day of week, hour, minute)
PROCEDURE - Converts the date and time held in internal format
in Idate into 6 integers representing the year, month, day of
month, day of week, hour and minute. The converse is done by
$MERGETAD.
$File_Dev (fil) STRING
$File_Dir (fil) STRING
$File_Nam (fil) STRING
$File_Typ (fil) STRING
$File_Gen (fil) STRING - $File_Dev through $File_Gen return the part of the
file name of Fil expressing respectively the Device, Directory,
Name, Type and Generation. Fil may be either $parse, or a
channel number, or a file name (see $FileInfo_S 8).
$FileInfo_I (fil, code)
INTEGER
$FileInfo_S (fil, code [,format])
STRING - $FileInfo_I and $FileInfo_S return information about
a file. The file is selected by Fil and the information to
return is selected by Code.
Fil may be:
$Parse the file currently being parsed by a PARSE FILE
or PARSE FILELIST,
a channel number
for a file currently opened by a call to $open,
a filename The filename is given as a string. If some
parts of the file name are omitted they default
to the connected device and directory, null
file type, and highest existing generation. The
name itself may not be defaulted.
$FileInfo_I returns an integer from the file FDB (File
Descriptor Block). For $FileInfo_I code is the index of the
word requested in the FDB (File Descriptor Block). See the
Tops20 Monitor Calls Reference Manual for details. Appendix I
gives the layout of the FDB. PCL constants are provided for
all permissible codes:
$FBADR disk address of file index block
$FileAddress idem
$FBBBT size file had when deleted from disk (in pages)
$FBBK0
$FBBYV file i/o information
$FBCNT count of read/write of the file
$FBCRE date last written either by user or system
("system" write date)
$FileCreation idem
$FBCRV creation date
$FBCTL control word
$FileControl idem
$FBFET off-line expiration date
$FBGEN generation and directory numbers
$FBNET on-line expiration date and time
$FBPRT file access codes
$FileProtection idem
$FBREF date last read
$FileRead idem
$FBSIZ number of bytes in file
$FileSize idem
$FBTDT date file was last written to tape (archiving)
$FBUSW user settable word
$FBWRT date last written by the user
$FileWrite idem
$FileInfo_S returns a string from information pointed to by the
FDB, or the result of a JFNS Jsys call, with specific
formatting bits given by Format (Refer to the Tops 20 Monitor
Call Reference Manual for details): The values of Code for
$FileInfo_S are either FDB offsets, or special values
requesting a specific function):
$FBACT file account
$FileAccount idem
$FBAUT file author
$Author idem
$FBFMT specifies that $FileInfo_s must return the
result of a JFNS Jsys, using the format bits
specified in Format. (An obsolete format of
$FileInfo_S specified that if code was an
integer greater than 63 the result was the
string returned by a JFNS Jsys with the
formatting parameter set to the field code
minus 64.)
$FBLWR last writer of file
$Writer idem
$FileSet allows to change the information read by $FileInfo_I
and $FileInfo_S.
$FileSet (fil, code, mask, value)
PROCEDURE - $FileSet allows to set the information contained in
the FDB (for a complete explanation of the File Descriptor
Block, refer to the Tops20 Monitor Calls Reference Manual).
Presently, features relating to the Archiving system are not
implemented.
Fil is selected as for $FileInfo: $Parse, or channel number, or
filename (see page 8).
Code defines which entry of the FDB we want to change.
Permissible values are the same as for $FileInfo (see page 8).
It is the FDB offset of the entry that we want to modify (see
the list of codes page 8, and appendix I for a description of
the FDB). If the entry is a pointer to a string, the
information to be changed is the string itself, not the
pointer.
Mask is an integer indicating the bit positions that we want to
change. It must contain ones in all positions to be changed. If
the information to be changed is a string, this argument is
ignored.
Value is either an integer or a string, depending on the
information to be changed.
For example:
! Change account
call $FileSet ($parse, $FBACT, -1, "OVERHEAD");
! Zero Read count of File
call $FileSet ("test.pcl", $FBCNT, 8%777777, 0);
$FileInfo_I and $FileInfo_S read the information that may be
changed with $FileSet.
Several fields of the FDB may not be changed, or only
with certain capabilities.
The information in the FDB that is modified by the ARCF
and SFTAD Jsys's is not currently changeable with
$FileSet.
$GetField (ival, pos, wid)
INTEGER - Returns the Wid bits found at bit positions Pos+1 to
Pos+Wid in ival (numbered 0..35 from right to left), stored
right justified in an integer and filled with zeroes to the
left. For example, $Getfield(ival,18,18) returns the left half
of ival. Ival, Pos and Wid are integers. See $SetField for
the reverse operation.
$InputTad (string)
INTEGER - Converts a string time and date into internal format.
The converse is done by $OutputTad.