Trailing-Edge
-
PDP-10 Archives
-
walsh_goodStuff_1600
-
more-uns/pascal.man
There is 1 other file named pascal.man in the archive. Click here to see a list.
PASCAL MANUAL FOR THE PDP-10
NOTE: FOR THE DEC-20, THE "PASCAL" ON SYS: IS ACTUALLY THE COMPILER REFERRED TO HEREIN AS "PASREL".
THE ORIGINAL PASCAL COMPILER (WHICH WROTE ONLY .SHR/.LOW FILES) HAS BEEN ELIMINATED.
ALSO, THE CORE ARGUMENT TO THE SAVE AND RUN MONITOR COMMANDS MENTIONED HEREIN IS NOT NEEDED.
FOR INFORMATION ON HOW TO PROGRAM IN PASCAL, THE FOLLOWING BOOK IS SUGGESTED:
LECTURE NOTES IN COMPUTER SCIENCE - PASCAL USER MANUAL AND REPORT
BY KATHLEEN JENSEN AND NIKLAUS WIRTH
THE UNIVERSITY OF HAMBURG'S PASCAL COMPILER FOR THE PDP-10 IS NOW AVAILABLE TO USERS. THE PASCAL
IMPLEMENTATION FOR THE DECSYSTEM-10 HAS BEEN CONSIDERABLY IMPROVED AND ENLARGED (FROM VERSIONS RELEASED BUT,
OF COURSE, NOT AVAILABLE HERE BEFORE). IT NOW SUPPORTS ALL PHASES IN THE GENERATION, DEBUGGING AND
MAINTENANCE OF PASCAL PROGRAMS.
1. THE EDITING PHASE: BY THE FORMATTING FEATURES OF PCROSS.
2. THE COMPILATION PHASE BY OFFERING:
2.1 A COMPILER NAMED "PASREL" GENERATING RELOCATABLE OBJECT CODE COMPATIBLE WITH LINK-10. OUTPUT FROM
THIS COMPILER WILL AUTOMATICALLY DIRECT THE LOADER TO SEARCH THE FORTRAN LIBRARY FOR STANDARD
FUNCTIONS SIN, COS ETC. IF NECESSARY. EXTERNAL PROCEDURES (E.G. WRITTEN IN MACRO-10 OR SEPARATELY
COMPILED PASCAL PROCEDURES) CAN BE LINKED ON. A SOURCE LEVEL DEBUG OPTION IS AVAILABLE (SEE 7.).
3. THE DEBUGGING PHASE: BREAK POINTS CAN BE SET AT RUNTIME BASED ON SOURCE PROGRAM LINE NUMBERS. AFTER A PROGRAM
STOPS AT SUCH A BREAK POINT, VARIABLE LOCATIONS CAN BE INSPECTED AND MODIFIED USING THE SOURCE PROGRAM
IDENTIFIERS (SEE 7.).
4. THE MAINTENANCE PHASE: THE PROGRAM PCROSS GENERATES
- AN INDENTATED SOURCE PROGRAM LISTING WITH EXTENSION ".CRL"
- MARKERS IN THE LEFT MARGIN FOR EACH START AND TERMINATION OF NESTED STATEMENTS
- A CROSSREFERENCE LIST OF ALL SOURCE PROGRAM IDENTIFIERS
- A SURVEY OF THE STATIC PROCEDURE NESTING
- FOR EACH PROCEDURE, A LIST OF WHICH PROCEDURES IT ACTIVATES AND BY WHICH PROCEDURES IT IS
ACTIVATED.
- AN INDENTATED SOURCE PROGRAM FILE WITH THE EXTENSION ".NEW"
5. THE FOLLOWING SECTION SUMMARIZES NEW FEATURES AVAILABLE IN BOTH COMPILERS:
5.1 THE "EOL" CHARACTER AS SUCH NO LONGER EXISTS. THUS THE FOLLOWING ARE NEEDED:
"EOLN(<FILE IDENTIFIER>)" IS A FUNCTION WHICH RETURNS THE VALUE TRUE IF THE FILE POINTER FOR THE
FILE INDICATED POINTS TO AN END-OF-LINE (<CARRIAGE RETURN><LINEFEED>). IF IT IS TRUE THEN THE
CURRENT CHARACTER IS A BLANK. FURTHER READS WILL READ THE BLANK AND THE FUNCTION WILL BECOME FALSE.
"READLN(<FILE IDENTIFIER>)" SKIPS OVER THE REST OF THE CURRENT LINE UNTIL THE NEXT END-OF-LINE IS DETECTED.
IT ACCEPTS FURTHER ARGUMENTS IN THE SAME MANNER AS "READ". FOR EXAMPLE:
READLN(INDISK,REALVAL,INTVAL,CHARVAL);
(SAME AS "READ(INDISK,REALVAL,INTVAL,CHARVAL);
READLN(INDISK);")
READLN(TTY,INTVAL);
READLN; (SAME AS "READLN(INPUT)")
"WRITELN(<FILE IDENTIFIER>)" WRITES AN END-OF-LINE ON THE FILE SPECIFIED BY <FILE IDENTIFIER>.
IT ALSO ACCEPTS FURTHER ARGUMENTS, JUST LIKE "WRITE". EXAMPLES:
WRITELN(OUTFILE,'GARBAGE LINE');
(SAME AS "WRITE(OUTFILE,'GARBAGE LINE');
WRITELN(OUTFILE);")
WRITELN(TTY,INTVAL,' APPEARS TO BE TOO SMALL');
WRITELN; (SAME AS "WRITELN(OUTPUT);")
5.2 "PAGE(<FILE IDENTIFIER>)" APPENDS A <CARRIAGE RETURN><FORM FEED> TO THE "FILE OF CHAR" DENOTED BY
<FILE IDENTIFIER>. IF NO <FILE IDENTIFIER> (AND PARENTHESES) IS SPECIFIED, THEN OUTPUT IS ASSUMED.
<FORM FEED> ADVANCES TO THE BEGINNING OF THE NEXT PAGE.
5.3 THE PROCEDURES "PACK" AND "UNPACK" HAVE BEEN IMPLEMENTED WITH AN OPTIONAL FOURTH ARGUMENT. THESE
PROCEDURES ARE MUCH MORE EFFECTIVE IN PACKING OR UNPACKING LARGER ARRAYS THAN A FOR-LOOP USING INDEXED ACCESS
TO COMPONENTS OF SUCH AN ARRAY.
PACK(A,I,Z,J); MEANS:
FOR L := LMIN(Z) TO LMIN(Z)+J-1 DO Z[L] := A [L-LMIN(Z)+I];
WHERE "Z" IS A PACKED ARRAY AND "A" IS AN UNPACKED ARRAY OF THE SAME BASE-TYPE. IN ENGLISH, "J" ELEMENTS
OF "A" ARE PACKED INTO "Z" STARTING AT "Z[LMIN(Z)]" (THE FIRST ELEMENT OF "Z").
UNPACK(Z,J,A,I); MEANS:
FOR L := LMIN(A) TO LMIN(A)+I-1 DO A[L] := Z[L-LMIN(A)+J];
WHERE "Z" IS AGAIN THE PACKED ARRAY, AND "A" THE UNPACKED ARRAY. IN ENGLISH, "I" ELEMENTS OF "Z" STARTING AT
"Z[J]" ARE UNPACKED INTO THE FIRST "I" ELEMENTS OF "A".
5.4 THE FOLLOWING CONVENTIONS ARE FOLLOWED FOR SOURCE SYMBOLS:
OR LOGICAL OR
AND LOGICAL AND
NOT LOGICAL NEGATION
# NOT EQUAL ("<>" IS NOT IMPLEMENTED AS SUCH)
<= LESS THAN OR EQUAL
>= GREATER THAN OR EQUAL
% OPENING COMMENT BRACKET
(* DITTO
\ CLOSING COMMENT BRACKET
*) DITTO
:= BECOMES
5.5 "PCROSS" AND BOTH COMPILERS ACCEPT THE GENERAL FILE SPECIFICATION ALLOWED BY THE TOPS-10 MONITOR.
5.5.1 ALL FILES (EXCEPT THE STANDARD FILES, "INPUT", "TTY", AND "OUTPUT") MUST BE DECLARED. FILE DECLARATIONS
MUST BE IN THE MAIN PROGRAM (THEY ARE VARAIBLES!). THE FIRST SIX CHARACTERS OF THE FILE IDENTIFIER ARE
USED FOR THE FILE NAME, AND THE NEXT 3 CHARACTERS ARE USED FOR THE EXTENSION NAME. (SEE THE "RESET"
AND "REWRITE" OPTION IN SECTION 5.12).
5.5.2 TO READ AN INPUT FILE (EXCEPT "INPUT", AND "TTY") THE FILE BE RESET. TO WRITE TO A FILE, THE FILE MUST
MUST BE "REWRITE" BEFOREHAND (EXCEPT "OUTPUT" AND "TTY"). (SEE THE PASCAL REPORT FOR THE MEANINGS OF
"RESET" AND "REWRITE") THE STANDARD FILES "INPUT", "OUTPUT" AND "TTY" ARE OPENED AUTOMATICALLY BY
DEFAULT, AND BY DEFAULT THEY HAVE THE ACTUAL FILE NAMES "INPUT", "OUTPUT", AND "TTY".
THIS DEFAULT CAN BE OVERRIDDEN BY RESETTING "INPUT" OR REWRITING "OUTPUT". THE FILE "TTY"
MUST NOT BE THE ARGUMENT OF "RESET" OR "REWRITE" OR ANY PROCEDURE WRITTEN BY THE USER.
5.5.3 THE FILE IDENTIFIER MUST BE SPECIFIED AS THE FIRST PARAMETER IN THE PROCEDURES "READ", "READLN",
"WRITE", AND "WRITELN", AND THE FUNCTION "EOLN" (EXCEPT FOR THE FILES "INPUT" AND "OUTPUT").
5.6 CONSTANT SUBRANGES MAY BE GIVEN IN SETS, E.G.:
VAR S:SET OF CHAR;
S:=['A'..'C'] INSTEAD OF S:=['A','B','C']
NOTE THAT THE SUBRANGE MUST BE OF THE APPROPRIATE BASE TYPE.
5.7 AN "OTHERS" BRANCH MAY BE SPECIFIED IN CASE-STATEMENTS. THE SYNTAX IS GIVEN BELOW IN BACKUS-NAUR FORM:
(NOTE THAT BELOW WE USE "(*" AND "*)" TO INDICATE THAT WHAT IS ENCLOSED MAY OCCUR ZERO OR MORE TIMES)
<CASE STATEMENT> ::= CASE <EXPRESSION> OF <CASE LIST> END
<CASE LIST> ::= <EXPLICIT PART>
OR <EXPLICIT PART> ; OTHERS: <STATEMENT>
<EXPLICIT PART> ::= <CASE LIST ELEMENT> (* ; <CASE LIST ELEMENT> *)
<CASE LIST ELEMENT> ::= <CASE LABEL LIST> : <STATEMENT>
<CASE LABLE LIST> ::= <CASE LABEL> (* , <CASE LABEL> *)
<CASE LABEL> ::= <CONSTANT>
EXAMPLE:
VAR C:CHAR;....
CASE C OF
'A' : WRITELN('ALPHA');
'B' : WRITELN('BETA');
OTHERS : WRITELN('C# ''A'' AND C# ''B'');
END %CASE STATEMENT\
ALSO THE SYNTAX OF THE VARIANT PART OF RECORD TYPES IS:
<VARIANT PART> ::= CASE <TAGFIELD> : <TYPE IDENTIFIER> OF <VARIANT> (* ; <VARIANT> *)
OR CASE <TYPE IDENTIFIER> OF <VARIANT> (* ; <VARIANT> *)
5.8 COMPILER OPTIONS:
5.8.1 %$C+\ GENERATES INSTRUCTIONS FOR RUNTIME CHECKS AT ARRAY INDICES AND ASSIGNMENT TO SCALAR
SUBRANGES AND VARIABLES.
%$C-\ SUPPRESSES CODE GENERATION FOR RUNTIME CHECKS
DEFAULT: C+ AVAILABLE IN BOTH COMPILERS.
5.8.2 %$O+\ APPENDS THE SYMBOLIC VERSION OF THE OBJECT CODE GENERATED TO THE SOURCE PROGRAM
LISTING FOR EACH PROCEDURE AND ADDS THE STARTING ADDRESS OF THE OBJECT CODE FOR EACH
PROGRAM SOURCE LINE.
%$O-\ NO SYMBOLIC OBJECT CODE LISTING
DEFAULT: O- AVAILABLE IN BOTH COMPILERS.
SINCE THE RUNTIME ERRORS STILL GIVE ONLY THE OBJECT CODE ADDRESS BESIDES THE MESSAGE
IDENTIFYING THE ERROR, COMPILE THE PROGRAM WITH THIS COMPILER OPTION "O+" IN ADDITION TO
"C+" IN ORDER TO LEARN FROM THIS LISTING, TO WHICH SOURCE PROGRAM LINE THE ERROR ADDRESS
BELONGS.
5.8.3 %$M+\ MEANS THE COMPILER SHOULD EXPECT A MAIN PROGRAM IN THIS COMPILATION.
%$M-\ MEANS NO MAIN PROGRAM IN THIS COMPILATION. (SEE 5.14)
DEFAULT: M+ ONLY AVAILABLE IN "PASREL".
5.8.4 %$D+\ COMPILES THE PROGRAM FOR USE WITH DEBUG (ON LIBRARY FILE).
%$D-\ COMPILES WITHOUT DEBUG FEATURES.
DEFAULT: D- ONLY AVAILABLE IN "PASREL".
5.8.5 %$L+\ TURNS ON THE LISTING OF THE SOURCE FILE. AFTER THIS OPTION IS TURNED ON, THE LINE
CONTAINING THE "%$L+" WILL BE PRINTED (ALL OF THE LINE INCLUDING THE LINE NUMBER).
%$L-\ TURNS OFF THE LISTING OF THE SOURCE FILE. LINES CONTAINING ERRORS WILL BE PRINTED ANYWAY,
WITH DIAGNOSTICS AND LINE NUMBER. ALL ERRORS WILL BE REPORTED TO "TTY" IN ALL CASES, WITH LINE
NUMBERS. THIS OPTION DOES NOT TURN OFF THE "O+" OPTION.
DEFAULT: L+ AVAILABLE IN BOTH COMPILERS.
THE "L-" OPTION SHOULD BE USED IF FOR SOME REASON DISK SPACE IS TO BE KEPT TO
A MINIMUM.
5.8.6 ALL OPTIONS EXCEPT "M" MAY BE TOGGLED ON AND OFF SEVERAL TIMES IN ONE SOURCE FILE. THE
CORRESPONDING OPTION IS THEN EFFECTIVE ONLY BETWEEN TIMES IT IS TURNED ON AND THEN TURNED OFF
(OR UNTIL THE PROGRAM END).
5.8.7 COMPILER OPTIONS MAY BE GIVEN SEVERAL AT A TIME, IN THE SYNTAX GIVEN IN THE FOLLOWING EXAMPLE:
%$C+,L-,O- COMMENT LINE HERE IF DESIRED\
OPTION STRING STARTS WITH "%$" AND IF AN OPTION LETTER WITH A "+" OR "-" FOLLOWS, THEN THAT OPTION
IS SET. THEN IF A COMMA AND ANOTHER OPTION LETTER APPEARS WITH A "+" OR A "-" THEN
IT IS SET. THIS CONTINUES UNTIL:
NO COMMA FOLLOWS OR
NO OPTION LETTER FOLLOWS THE COMMA OR
NO "+" OR "-" FOLLOWS THE OPTION LETTER
THE REST OF THE STRING IS A COMMENT, AND MUST BE CLOSED WITH A CLOSING COMMENT DELIMITER.
5.9 THE FOLLOWING STANDARD FUNCTIONS AND PROCEDURES ARE IMPLEMENTED FOR BOTH COMPILERS:
FUNCTIONS PROCEDURES
--------- ----------
ABS GET
SQR PUT
ODD RESET (WITH OPTIONAL FOURTH PARAMETER)
SUCC REWRITE (WITH OPTIONAL FOURTH PARAMETER)
PRED NEW (BUT NOT "DISPOSE")
ORD (IMPLEMENTED FOR ALL SCALAR TYPES EXCEPT REAL)
CHR READ
TRUNC WRITE
EOF PACK (WITH OPTIONAL FOURTH PARAMETER)
ROUND UNPACK (WITH OPTIONAL FOURTH PARAMETER)
THE FOLLOWING STANDARD FUNCTIONS ARE AVAILABLE TO BOTH COMPILERS:
FUNCTION RESULT TYPE YEILDING
-------- ----------- --------
TIME INTEGER TIME IN MILLISECONDS
RUNTIME INTEGER CPU-TIME IN MILLISECONDS
5.10 FOR INITIALISATION OF GLOBAL VARIABLES AT COMPILE TIME, USE "INITPROCEDURE". IT IS SIMILAR TO A NORMAL
PROCEDURE IN SYNTAX. IN ONE, YOU MAY ONLY HAVE ASSIGNMENT STATEMENTS, WHICH ASSIGN VALUES
TO GLOBAL VARIABLES (ONLY THOSE VAIRABLES IN THE MAIN PROGRAM). ASSIGNMENTS ARE ILLEGAL FOR PACKED
STRUCTURE COMPONENTS. ALL INITPROCEDURES MUST APPEAR AFTER THE VARIABLE DECLARATIONS AND
BEFORE THE PROCEDURE DECLARATIONS OF THE MAIN PROGRAM. USE THE FOLLOWING SYNTAX GRAPH:
I
I--> VAR ---...--I
I--<-------------I
I
I--<---------------------------------------------------------------------<--I
I I
I I--<------ ; <-------I I
I I I I
I I ASSIGNMENT I I
I--> INITPROCEDURE --> ; --> BEGIN --I-> WITH CONSTANT --I--> END --> ; ---I
I VALUES ONLY
I---<-------------------<---I
I---> PROCEDURE ---> ... ---I
I
EXAMPLE:
VAR I,J:INTEGER; A:ARRAY[1..3] OF CHAR;
INITPROCEDURE;
BEGIN
I:=3;
J:=7;
A[1]:='C';
A[3]:='$'
END;
PROCEDURE T;
...
5.11 THE "LOOP" STATEMENT IS AVAILABLE. ITS SYNTAX IS AS FOLLOWS: (AGAIN "(*" AND "*)" MEAN ZERO OR MORE TIMES)
<LOOP STATEMENT> ::= LOOP
<STATEMENT> (* ; <STATEMENT> *)
EXIT IF <EXPRESSION>;
<STATEMENT> (* ; <STATEMENT> *)
END
SEMANTICS: (MEANING!)
THE STATEMENTS BETWEEN THE "LOOP" AND THE "EXIT" ARE EXECUTED. THEN THE FOLLOWING STATEMENTS ARE
EXECUTED ONLY IF THE EXPRESSION (OF TYPE BOOLEAN!) IS FALSE. AT THE "END", EXECUTION GOES BACK TO
THE TOP OF THE "LOOP", AND PROCEEDS AS BEFORE.
5.12 THE STANDARD PROCEDURES "RESET" AND "REWRITE" CAN BE USED WITH UP TO FOUR OPTIONAL ARGUMENTS
ALLOWING FULL FILE SPECIFICATIONS AT RUNTIME. THE FOLLOWING DESSCIBES THE OPTIONAL PARAMETERS:
RESET(FILEIDENTIFIER,NAMEEXT,PROTECTION,PROJPROGRAMMERNUM,DEVICEMNEMONIC)
REWRITE(FILEIDENTIFIER,NAMEEXT,PROTECTION,PROJPROGRAMMERNUM,DEVICEMNEMONIC)
THESE PROCEDURES MAY BE CALLED WITH THE FIRST 1,2,3,4 OR ALL 5 PARAMETERS. THE TYPES AND DEFAULTS ARE
GIVEN BELOW:
1) FILE IDENTIFIER AS DECLARED IN MAIN PROGRAM.
2) PACKED ARRAY [1..9] OF CHAR
THE FIRST 6 CHARACTERS ARE THE ACTUAL NAME USED FOR THE FILE. THE NEXT 3 CHARACTERS
ARE THE ACTUAL EXTENSION USED FOR THE FILE. THE DEFAULT OPTION IS TO EXCLUDE THIS PARAMETER
AND THE FILE NAME USED WILL BE TAKEN AS THAT DERIVED FROM THE FIRST 6 CHARACTERS
OF THE FILE IDENTIFIER AND THE EXTENSION WILL BE THE NEXT 3 CHARACTERS OF THE FILE IDENTIFIER
3) PROTECTION CODE, AN EXPRESSION OF TYPE INTEGER. (SEE THE DEC SYSTEM-10 ASSEMBLY LANGUAGE
HANDBOOK, MONITOR CALLS, SECTION 4.4) A VALUE OF 0 PROVIDES THE DEFAULT FOR THE SYSTEM
(FOR THIS ONE, <055>). THE PROTECTION MUST BE THREE LEFT JUSTIFIED OCTAL DIGITS, FOLLOWED BY
ZEROES.
4) PROJECT-PROGRAMMER NUMBER, AN EXPRESSION OF TYPE INTEGER. IN THE RIGHT HALFWORD,
THE PROJECT NUMBER, AND IN THE LEFT HALF WORD, THE PROGRAMMER INITIALS IN THE
FORM OF SIX BITS PER LETTER, AND EACH BIT FIELD CONTAINS THE POSITION OF THE LETTER
IN THE ALPHABET PLUS 20 OCTAL. THIS IS THE ASCII CHARACTER CODE MINUS 60 OCTAL. DEFAULT IS THE
USERS OWN PROJECT PROGRAMMER NUMBER.
5) DEVICE NMEMONIC, A "PACKED ARRAY [1..6] OF CHAR", GIVES THE DEVICE FOR THE FILE. THE
DEFAULT IS "'DSK '".
5.13 PASCAL PROGRAMS TO BE COMPILED BY "PASREL" MAY USE THE FOLLOWING ADDITIONAL STANDARD FUNCTIONS (ALL
THESE FUNCTIONS AND THEIR ARGUMENTS ARE TYPE REAL) FROM THE FORTLIB (USING THE CORRESPONDING FORTRAN
NAMES) ON THE LOGICAL DEVICE SYS:.
SIN COS ARCTAN EXP SQRT
SIND COSD TANH LN RANDOM
ARCSIN ARCCOS LOG SINH COSH
ALSO THE FUNCTION: DATE
OF TYPE "PACKED ARRAY [1..9] OF CHAR" WHICH YIELDS THE CURRENT DATE IN THE FORM OF:
"DD-MMM-YY" WITH "DD" = DAY NUMBER, "MMM" = MONTH ABBREVIATION, "YY" = YEAR NUMBER.
5.14 FOLLOWING THE HEAD OF A PROCEDURE/FUNCTION DECLARATION BY:
EXTERN <LANGUAGE SYMBOL>;
WILL DIRECT THE COMPILER TO PROVIDE FOR LINKAGE TO AN EXTERNAL PROCEDURE/FUNCTION.
<LANGUAGE SYMBOL>::="" OR "FORTRAN" OR "ALGOL" OR "COBOL".
THE LANGUAGE SYMBOL DETERMINES THE CONVENTIONS FOR PARAMETER PASSING TO AN EXTENAAL PROCEDURE/
FUNCTION. IF NO IDENTIFIER IS PROVIDED, THEN PASCAL IS ASSUMED. IF ANY OF THE THREE NONEMPTY LANGUAGE
SYMBOLS IS INDICATED, THE LOADER IS DIRECTED TO SEARCH THE CORRESPONDING LIBRARY ON THE LOGICAL DEVICE
SYS: IF THE PROCEDURE/FUNCTION IS NOT PROVIDED IN THE LOAD MODULES.
IF A GRUOP OF PASCAL PROCEDURES WITHOUT A MAIN PROGRAM HAS TO BE COMPILED SEPARATELY, USE "%$M-\"
AT THE BEGINNING OF THE CORRESPONDING PASCAL SOURCE FILE. IN THIS CASE THE OUTERMOST PROCEDURE/FUNCTION
NAMES WILL AUTOMATICALLY BE DECLARED AS ENTRY BY THE COMPILER. DON'T FORGET
TO INCLUDE THEIR ".REL" FILES WHEN LOADING!
AN EXAMPLE OF USING EXTERNAL PROCEDURES FROM THE FORTRAN LIBRARY:
TYPE
T1 = PACKED ARRAY]1..9] OF CHAR;
T2 = PACKED ARRAY [1..5] OF CHAR;
VAR
DATUM: T1;
HOURS: T2;
SECONDS: T2;
(* FORTRAN STANDARD PROCEDURE DATE REQUIRES ONE VAR ARGUMENT *)
PROCEDURE DATE (VAR FDATUM: T1); EXTERN FORTRAN;
(* FORTRAN STANDARD PROCEDURE TIME REQUIRES ONE OR TWO ARGUMENTS *)
PROCEDURE TIME (VAR FHOURS, FSECONDS: T2); EXTERN FORTRAN;
BEGIN (* PROGRAM *)
DATE( DATUM ); WRITELN(TTY,DATUM);
TIME( HOURS , SECONDS ); WRITELN(TTY,HOURS,SECONDS); BREAK;
END.
WARNING:
IF A PROCEDURE (EXTERNAL OR NOT) IS GIVEN THE SAME NAME AS A STANDARD (PREDEFINED) PASCAL
PROCEDURE, THEN IT SUPERCEDES THE PASCAL STANDARD ROUTINE FOR PLACES WHERE THE SCOPE OF THE
NAME EXTENDS.
5.15 "BREAK(<FILE IDENTFIER>)" FORCES THE CURRENT BUFFER CONTENTS TO BE OUTPUT TO THE FILE SPECIFIED BY
BY <FILE IDENTIFIER>. IF NO <FILE IDENTIFIER> IS SPECIFIED (AND NO PARENTHESES) THEN "TTY" IS ASSUMED.
THIS FEATURE IS USEFUL, TOO, FOR INTER-COMPUTER COMMUNICATION AT THE PASCAL LEVEL. THIS PROCEDURE IS
A BASIC MUST FOR TELETYPE OUTPUT. IF NOT USED THEN THE OUTPUT WRITTEN TO THE FILE "TTY"
WILL REMAIN IN A BUFFER UNTIL THE BUFFER IS FULL. THIS SELDOM IS DESIRED!
5.16 STRINGS ARE IMPLEMENTED. THEY ARE PACKED ARRAYS [1..STRINGLENGTH] OF CHAR. THEY MAY BE USED
TO ASSIGN VALUES TO SUCH ARRAYS. IF THE VARIABLE ARRAY IS NOT PACKED, THEN THE ASSIGNMENTHAS A
TYPE CONFLICT. FOR A CORRECT EXAMPLE:
VAR STRING:PACKED ARRAY [1..12] OF CHAR;
STRING:='WOW STRINGS!'
5.17 INDEXING INTO PACKED ARRAYS IS ALLOWED.
5.18 ASCII CHARACTERS WITH OCTAL CODES <40 OR >172 ARE SKIPPED. THE EXCEPTIONS ARE THE LINEFEED (CODE=12)
WHICH IS USED FOR THE END-OF-LINE, AND THE TAB CHARACTER (CODE=11,^I). THE TAB CHARACTER IS REPLACED BY
THE PROPER NUMBER (AT LEAST ONE) OF BLANKS TO MAKE THE COLUMN NUMBER FOR THE NEXT CHARACTER EQUAL TO ONE
MODULO EIGHT. THE LOWER CASE LETTERS ARE TRANSLATED TO UPPER CASE BY THE RUNTIME SUPPORT ROUTINES.
THIS IS TRUE OF BOTH THE COMPILERS, AND PROGRAMS COMPILED.
5.19 AN OCTAL OUTPUT FORMAT IS PROVIDED. IT HAS THE SYNTAX FOLLOWED IN THE EXAMPLE:
WRITE(INTVAL:FIELDLENGTH:O);
THIS WILL WRITE OUT "FIELDLENGTH" OCTAL DIGITS. THE ":O" IS WHAT INDICATES THE OUTPUT IS TO BE
IN OCTAL. OTHER FORMATTED I/O IS AS DESCRIBED IN THE PASCAL REPORT. THE DEFAULT FIELDWIDTH FOR INTEGERS
IS 12 DIGITS.
5.20 AT THE BEGINNING OF THE EXECUTION OF EVERY PROGRAM (INCLUDING THE COMPILER!) THERE IS A "*" PRINTED. THIS
IS A PROMPT FOR THE INITIALIZATION OF THE "TTY" FILE. USUALLY IT IS USED AS A PROMPT FOR FILE
NAMES TO BE USED BY THE PROGRAM. IF YOUR PROGRAM EXPECTS NO INPUT BEFORE ANY OUTPUT ON "TTY", THEN
RESPOND WITH A <CARRIAGE RETURN>. THEN AT THE START OF YOUR PROGRAM, "EOLN(TTY)" WILL BE TRUE, AND THE
NEXT CHARACTER READ WILL BE A BLANK.
5.21 ALSO AVAILABLE FOR "HEAP" GARBAGE COLLECTION (IN ITS MOST PRIMATIVE FORM) ARE "MARK" AND "RELEASE". THEY
ARE STANDARD PROCEDURES IN BOTH COMPILERS. THEY EACH TAKE AN INTEGER ARGUMENT. "MARK(IVAL)" PLACES THE
CURRENT ADDRESS OF THE BOTTOM (FWA) OF THE "HEAP" INTO THE INTEGER VARIABLE "IVAL". "RELEASE(IVAL)"
RECLAIMS ALL OF THE "HEAP" ALLOCATED (VIA "NEW") SINCE THE SETTING OF "IVAL" BY "MARK". AT THIS POINT
NO POINTERS SHOULD BE POINTING INTO THIS PART OF THE "HEAP" (OR IF THEY ARE, THEN THEY SHOULD NOT BE
USED AGAIN WITHOUT REASSIGNMENT).
5.22 THINGS YOU SHOULD ALREADY KNOW:
5.22.1 UNLESS INITIALIZED IN AN INITPROCEDURE, ALL VARIABLES HAVE NO DETERMINABLE PREASSIGNED VALUES.
UNITIALISED POINTERS OR NIL POINTERS WILL GIVE AN ILLEGAL MEMORY REFERENCE IF USED (ERROR MESSAGE
"ILL. MEM. REF.").
5.22.2 POINTERS ARE BOUND TO THEIR TYPES. THAT IS, THEY MAY ONLY BE USED FOR POINTING TO WHAT THEY ARE
DECLARED TO POINT TO. THEY MAY NOT BE ASSIGNED VALUES FROM POINTERS OF OTHER TYPE, OR COMPARED
WITH POINTERS OF OTHER TYPES.
5.22.3 UNLIKE ALGOL60, THE RELATIONAL OPERATORS HAVE THE LOWEST SPOT IN THE OPERATOR HIERARCHY. THUS
IT IS A GOOD IDEA TO PARENTHESIZE EXPRESSIONS CONTAINING RELATIONAL OPERATORS. (THE RELATIONAL
OPERATORS ARE: ">",">=","<","<=","=","#","IN")
5.22.4 IF THE "O+" OPTION IS ON THEN THE SOURCE LINE NUMBERS ARE THE OCTAL ADDRESSES OF THE BEGINNING OF
THE CODE FOR THE CORRESPONDING LINE.
6. USING THE COMPILERS AND "PCROSS":
6.1 TO USE THE CROSSREFERENCE LISTING PROGRAM:
.R PCROSS
FILE: <FILENAME> AFTER "FILE:" IS TYPED BY 'PCROSS", GIVE SOURCE FILENAME IN THE FORMAT:
DEVICE:FILNAM.EXT[PROJECT#,PROGRAMMER #INITIALS]
EVERYTHING EXCEPT FILNAM MAY BE OMITTED. DEFAULTS ARE:
DEVICE ="DSK:"
.EXT =".PAS"
[PROJ.,PROG] =THAT OF USER
NOTE THAT IF A FILE HAS A NULL EXTENSION, THEN YOU MUST SPECIFY THAT
BY ENDING THE NAME WITH A POINT. OTHERWISE, THE DEFAULT OF ".PAS" IS
ASSUMED. ALSO THESE PROGRAMS WILL TRY TO WRITE THEIR OUTPUT FILES
TO THE SAME DEVICE AS THEY ARE READING THEIR INPUT FILES, SO RANDOM ACCESS
DEVICE TYPES ARE SUGGESTED.
6.2 TO USE "PASREL":
.R PASREL
*<FILENAME> SOURCE FILE SPECIFICATION (SEE "PCROSS")
(NO) ERROR DETECTED
HIGHSEG : M K "M" INDICATES THE SIZE OF THE HIGH SEGMENT (CODE) IN K-WORDS.
LOWSEG : N K "N" INDICATES THE SIZE OF THE LOW SEGMENT (DATA) IN K-WORDS.
A LISTING IS MADE ON <FILENAME>.LST AND THE RELOCATABLE FILE IS <FILENAME>.REL.
RUNTIME : T "T" INDICATES THE CPU-TIME USED FOR COMPILATION
EXIT
.LOAD <FILENAME> LOAD THE PROGRAM.
LINK LOADING
EXIT
.SAVE <FILENAME> W THE TOTAL CORE REQUIREMENT "W" MUST BE GIVEN. W>= M + N + 4 K-WORDS.
IF NO DEBUG OPTION HAS BEEN SPECIFIED IN THE SOURCE PROGRAM. THE SAVE-FILE
CAN BE MADE SHARRABLE BY USING THE MONITOR COMMAND "SSAVE <FILENAME> W".
JOB SAVED
.RUN <FILENAME> EXECUTE THE PROGRAM.
7. DEBUG OPTION:
7.1 INDICATE DEBUG OPTION IN (PART OF THE) SOURCE PROGRAM TO "%$D+\"> IF NO DEBUGGING IS REQUIRED IN LATER
PARTS, FOLLOW THE SECTION TO BE DEBUGGED BY "%$D-\" SINCE THIS WILL SAVE CORE AND RUNTIME IN THOSE SECTIONS
NOT TO BE DEBUGGED.
7.2 USE "PASREL" ETC. (SEE BELOW) TO GENERATE AN EXECUTABLE SAVE FILE, GIVING W>=M+N+8 TO ALLOW WORKING SPACE FOR
THE DEBUG CODE.
7.3 GET THE LISTING OF THE COMPILED PROGRAM IN OREDER TO KNOW EXACTLY WHERE TO SET BREAKPOINTS BY:
.PRINT <FILENAME>.LST
7.4 .RUN <FILENAME> BEGIN EXECUTION OF THIS PROGRAM
* ANSWER WITH A CARRIAGE RETURN
$STOP AT MAIN BEGIN ENTER BREAKPOINTS USING THE FOLLOWING COMMANDS
7.5 $ STOP <LINE> SET A STOP AT THE SOURCE LINE INDICATED BY LINE NUMBER <LINE>.
<LINE>::=<LINENUMBER> OR <LINE NUMBER>/PAGENUMBER>
<LINENUMBER>::=<UNSIGNED INTEGER>
<PAGENUMBER>::=<UNSIGNED INTEGER>
IF NO PAGENUMBER (OR SLASH) IS GIVEN, "/1" IS ASSUMED.
7.6 $ STOP NOT <LINE> DELETE BREAKPOINT AT LINE <LINE>.
7.7 $ STOP LIST LIST ALL CURRENT BREAKPOINTS ON THE TERMINAL.
7.8 $ <VARIABLE>= GIVE THE CURRENT CONTENTS OF THE LOCATION INDICATED BY THE SOURCE IDENTIFIER
(POSSIBLY EXPANDED BY QUALIFIERS); THE SCOPE RULES APPLYING TO THE
SOURCE LINE CORRESPONDING TO THE CURRENT BREAKPOINT, UNIQUELY DETERMINING
THE VARIABLE LOACTION OF THE IDENTIFIER GIVEN. ALL QUALIFIERS LEGAL IN
PASCAL MAY BE USED (I.E. POINTERS, RECORD FIELDS, ARRAY COMPONENTS).
$FORMULA.KIND=
$ ANDNODE IN THIS EXAMPLE WE EXAMINE PART OF A RECORD,
$FORMULA=
$ RECORD AND THEN ALL OF THE RECORD!
$ NEGATED : FALSE
$ KIND : ATOM
$ SVAR : ' '
$ END
7.9 $ <VARIABLE>:= <VARIABLE OR CONSTANT>
THE VARIABLE OR CONSTANT VALUE ON THE RIGHT HAND SIDE IS ASSIGNED AS THE
CURRENT VALUE OF THE VARIABLE INDICATED ON THE LEFT HAND SIDE.
7.10 $ TRACE BACKTRACE OF PROCEDURE CALLS FROM THE BREAKPOINT TO MAIN PROGRAM.
EXPOSES ACTIVATING PROCEDURES WITH LINENUMBER/PAGENUMBER OF ACTIVATION
POINTS
7.11 $ END LEAVE DEBUG MODE AND CONTINUE EXECUTION OF THE PROGRAM. IF ANY BREAKPOINT IS
REACHED, THE MESSAGE...
$ STOP AT <LINE>
APPEARS ON THE TERMINAL.
7.12 ASYNCHRONOUS STOP IF THE PROGRAM HAS BEEN COMPILED WITH THE DEBUG OPTION, IT'S EXECUTION CAN
^C^C BE INTERRUPTED BY TWO SUCCESSIVE CONTROL-C'S
.DDT TYPING "DDT" WILL THEN TRANSFER CONTROL TO THE DEBUGGING MODE.
$ STOP BETWEEN <LINE1> AND <LINE2> WILL APPEAR ON THE TERMINAL TO INDICATE WHERE THE PROGRAM HAS BEEN
INTERRUPTED. USE OF COMMANDS DESCRIBED IN 7.5 THROUGH 7.11 IS NOW POSSIBLE.
NOTES:
NOT YET IMPLEMENTED:
- FORMAL PROCEDURE/FUNCTION ARGUMENTS (FUNCTIONS AND PROCEDURES CANNOT BE PASSED AS PARAMETERS)
- BRANCH OUT OF A PROCEDURE/FUNCTION (LABEL DECLARATION IS NOT REQUIRED)
NOTED BUGS:
- IF A PACKED VARIABLE IS ITSELF PART OF A PACKED VARIABLE (RECORD OR ARRAY) THEN ASSIGNMENT TO AND
COMPARISON WITH THE FORMER VARIABLE MAY BE FAULTY.
- IF A SEQUENCE OF "*" IMMEDIATELY PRECEDES THE CLOSING COMMENT SYMBOL "*)" THE CLOSING
COMMENT SYMBOL MAY NOT BE RECOGNIZED.
- "PCROSS" DOES NOT RECOGNIZE THE SYNTAX FOR EXTERNAL PROCEDURES.