Home

AOS Library User`s Manual

image

Contents

1. 123 INDEX e e e o e e e e o e o o e e e e e e e e o e 125 111 Introduction i INTRODUCTION 1 0 Scope of this Manual This manual describes both the standard and the optional library modules available from Advanced Computer Design for use with the the UCSD Pascal Advanced Operating System AOS version 1 0 Users are assumed to have a working Knowledge of UCSD Pascal Of particular importance are the library and separate compilation facilities This manual does not describe these facilities they are fully described in the following manuals AOS System User s Manual Describes the UCSD Pascal system software including the library system and the operation of the Pascal compiler AOS Programmer s Manual Describes the UCSD Pascal language including the separate compilation facilities Other documents of interest include PDQ 3 Hardware User s Manual Describes the physical charac teristics of the PDQ 3 computer AOS Architecture Guide Provides details of the system soft ware to experienced programmers Available in the inde terminate future NOTE This manual describes the library modules available from Advanced Computer Design at the time of printing Addenda will be provided as new modules are developed NOTE The modules described herein are predominantly system ori ented a host of application oriented library modules compatible with the Advanced Operating System are
2. The Program Operators Unit Interface 2 Programming Example o l The Exception Information Unit 0 Using the Exception Information Unit O Segment Decoding l I O Error Name oo e e 2 Execution Error Name o l The Exception Information Unit Interface 2 Programming Example gt 2 The Command I O Unit gt 0 Using the Command I O Unit O Program Chaining gt 1 I O Redirection i l The Command I O Unit interface 2 Programming Example 3 The System Information Unit 0 Using the System Information Uni O Work Text File Name l Work Code File Name o 2 System Unit Number gt 3 System Volume Name e e o 4 Prefixed Volume Name 5 System Date e 1 The System Information Unit Inter 2 Programming Example o 4 The System Utility Unit e e 0 Using the System Utility Unit O System Serial Number l Time Delays 2 Maximum I O Unit Number 1 The System Utility Unit Interface 2 Programming Example Manual PAGE E e gt e e e e WINE E e e e e e U1 e e 9 e o e gt ee os o o e o e e o 6o e o e o o o e e ec e e e 0 9 0 oe o o e e e o o o LO o 9 e e 9 9 9 oe 8 9 6o eo e 9 o e e 9 e e e 0 o e e e 0 e r2 C e eee e e
3. C W Var Count Integer Begin Writeln Type cr for patterns Readln Writeln 7 Count 1 Repeat Writeln Pattern Count With Pat Ptr Do Begin Writeln Comp C If Comp Len lt gt 0 Then Write Comp Pos 9 If Comp Len gt 1 Then Write Comp Len 1 Writeln Writeln Wild W Write Wild Pos 90 If Wild Len gt 1 Then Write Wild Len 10 Writeln Writeln End Pat Ptr Pat Ptr Next Count Count 1 Until Pat Ptr s Nil End of Print Patterns Page 66 Data Manipulation Begin fof Wild_Test Repeat Writeln WildCard Check Write Wildcard String Y Readln W Write Comparison String Readln C Write Want pattern matching information y nl Read Ch Want Patterns Ch In y Y Writeln Writeln If P Match W C Pat Ptr Want Patterns Then Writeln A Match Else Writeln No Match If Want Patterns And Pat Ptr lt gt Nil Then Print Patterns Pat Ptr C W Write Continue y n Read Ch Writeln Writeln Until Ch In n N 1 End of Wild Test o e Page 67 Library User s Manual Page 68 File System Manipulation V FILE SYSTEM MANIPULATION This chapter describes units which perform functions involving the manipulation of the UCSD Pascal file system The directory information unit section 5 0 provides routines that operate on directories and
4. Do One F System Filer Do One S X Do One E System Editor End of Setup Progs Procedure Prompt Var Ch Char Begin Write Chr FF Command C ompile F iler S ubmit E dit eX ecute H alt Repeat Read Keyboard Ch If Ch gt a Then Ch Chr Ord Ch Ord a Ord A Until Cn in C ter S TE Se TH Write Chr FFP If Ch lt gt X Then Writeln End of Prompt Page 13 Library User s Manual Begin of Prog_Test Setup_Progs Prompt Ch While Ch lt gt H Do Begin Case Ch Of ner UE y is E Trash Prog Start Desc Array Ch x Begin Write Execute what file Readln File Name If Not Prog Call File Name Error Trash Then Begin Write Error type lt return gt Readln End of If End fof X End of Case Prompt Ch End of While End Page 14 System Functions 2 1 The Exception Information Unit The exception information unit called kExcep Info allows user programs access to system exception handling information normally available only to the system exception handler The exception information unit provides the following capabilities Error Translations Translation of execution error and I O error numbers into textual format Translation of segment numbers and instruction counters into segment names and procedure offsets User defined execution and I O errors may be
5. It must belong to one of the types included in D Select Page 80 File System Manipulation The linked list contains one record for each file object matched The records are defined as follows P_Pat_Rec_P iS imported from Pattern Match D List P D List D List Record D_Unit Integer D Volume String 71 D VPat P Pat Rec P D Next Entry D List P Case D Is Blkd Boolean Of True D_Start D_Length Integer Case D Kind D Name Type Of D Vol D Temp D Code D Text D Data D Title String 15 D FPat P Pat Rec P D Date D Date Rec Case D Name Type Of D Vol D Num Files Integer D Temp D Code D Text D Data D End Integer End D List The fields in the D List record return the following information for each file object in the D Ptr list D Unit returns the unit number of the unit containing the object D Volume returns the name of the volume containing the object D VPat is a pointer to pattern matching information collected while comparing volumes to the volume id in D Name see section 5 0 0 1 for details on pattern matching info D_VPat is set to NIL if pattern matching information is not requested see section 5 0 2 1 0 3 for details D Next Entry is a pointer to the next directory information record in the list It is set to NIL if the current record is the last record in the list D Is Blkd is set to TRUE if the file object is or resides on a
6. Integer Execute the program described by Prog Desc Function Prog Start Prog Desc Prog Rec Integer Execute the program described by Prog Desc Ignore I O redirection Page ll Library User s Manual Function Prog_Call Var File_Name Var Error Var Err Num Call the program File Name Prog String String Integer Boolean Function Prog Redir Out Direction Boolean Boolean Return the status of I O redirection on a given channel Procedure Prog Exception Err Num Integer Cause a specified execution error Procedure Prog IO Set IO Err Num Integer Set the value of the system IORESULT intrinsic Page 12 System Functions 2 0 2 Programming Example The following program demonstrates the capabilities of the program Operators unit it implements a shell described in the Program mer s Manual Another example appears in chapter 7 of the Programmer s Manual Program Prog_Test Uses Prog_Ops Const FF 12 Var Ch Char File Name Error String Trash Integer Desc Array Array A Z Of Prog Rec Procedure Setup Progs Var Ch Char Procedure Do One Ch Char Name String Var Temp Desc Prog Rec Begin If Prog Setup Name Nil Error Temp Desc Then Begin New Desc Array Ch Desc Array Chl l Temp Desc End of If End of Do One Begin R Prog Setup For Ch A To 2 2 Do Desc Array Ch Nil Do One C System Compiler
7. A Advanced Computer Design AOS Library User s Manual AOS Library User s Manual AOS LIBRARY USER S MANUAL VERSION 1 0 June 1982 Advanced Computer Design PDQ 3 is a registered trademark of Advanced Computer Design Information furnished by ACD is believed to be accurate and reliable However no responsibility is assumed by ACD for its use nor for any infringements of patents or other rights of third parties which may result from its use No license is granted by implication or otherwise under any patent or patent rights of ACD ACD reserves the right to change product specifications at any time without notice DEC is a registered trademark of Digital Equipment Corporation Maynard Mass UCSD Pascal is a registered trademark of the University of California Author Barry Demchak Document Copyright c 1982 Advanced Computer Design All rights reserved Duplication of this work by any means is forbidden without the prior written consent of Advanced Computer Design AOS Library User s TABLE OF CONTENTS SECTION I INTRODUCTION e e e o v e e e e e e O Scope of this Manual o o l Overview e e e e e e e e e e e e e e 2 Notation and Terminology o II SYSTEM FUNCTIONS 0 0 on O The Program Operators Unit o 0 Using the Program Operators Unit O Program Invocation l Program Termination 2 I O Redirection s s o
8. Term Type SC Term Type Term ID SC Term ID In File Qut File In Use Count Out Use Count End ce Integer Page 39 Library User s Manual Function SC_Init Info_Name In_Name Out_Name String Term Type SC Term Type Var Port SC Port Boolean This function initializes a text port on a terminal Info Name contains the name of the MISCINFO file contain ing the terminal characteristics In Name names the keyboard file for the terminal Out Name names the Screen file for the terminal Term Type indicates the type of random cursor addressing necessary for the terminal SC System specifies the current system cursor addressing routine GOTOXY Port is returned containing the text port record If any files cannot be opened Port is undefined and the function result is FALSE Procedure SC New Port Var New Port SC Port Col Row Width Height Integer Sample Port SC Port This procedure declares a new text port whose upper left corner is at the coordinates Col Row on the terminal Screen It has the the dimensions Width by Height The New Port is attached to the same terminal as is associat ed with the Sample Port Procedure SC Out Lock Var Port SC Port This procedure is called when more than one task might access text ports on a given terminal screen It secures the screen for the caller until an SC Out release oc curs Procedure SC_Out_Release Var Por
9. e e e s s0 s Page 125 34 63 74 123 3 3 18 18 18 18 36 75 70 70 75 95 70 75 101 70 75 86 75 80 91 74 76 103 76 104 76 105 75 98 70 71 74 77 15 15 19 15 9 15 16 121 16 7 18 16 16 15 72 75 95 111 73 75 82 101 109 82 111 71 75 77 81 82 88 111 74 82 111 71 82 81 109 111 111 110 111 111 110 110 10 8 34 63 74 81 9 15 16 16 7 8 10 18 19 23 119 28 Library User s Manual II 0 Heap 66000666 060 066066066006 Oe 9 34 63 74 Integer Conversion 442999999 vv D Integer Conversion Unit 0000000000000 48 Intrinsics Library praia ars 0019 22527490426 025 14 110 115 118 IORESULT e e e oo 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 e 0 8 88 o 8 9 16 IV 0 Heap E e oo 0 0 0 e e 0 c 0 6 e e 0 0 0 0 0 0 0 0 eee ee 34 63 74 Keyboard Input L00000100000000000000000 30 Multitasking Support L 00000000000000000 35 76 103 104 105 Numerical FUNCELONS 99 992 99 ss 20797 Num Con Unit e o ec 0 e 9099090609 9999099090999 99999 48 N_Geq_U BUNCE LOM iaa 51 N Int To Str Procedure sessions 50 N_Leqg_U Function 600000000009000000000900 51 N_Max Function 000000000009000009000000900 50 N Max U FUncELOnN asesina OL N Min F unCtlOl 9 933324 43 9299999 9 50 H Min U Function 4 49335949939 39 9 9 4 294 N Str To Int Function 0 0 0000 0 0 0 0 0 00 00 50 N_Uns_To_Str Procedure 000000000000000 90 Pattern Matching Unit e e eo SE SE SE EE SE SE EE
10. o o e The Real Conversion Unit Interfac Programming Example gt Wildcards Using the Pattern Matching Unit gt O Wildcard String Matching The Pattern Matching Unit Interface Programming Example ii e 0 6 9 0 e e e e e 0 o e o e es e o e e e o e e o 0 e e o e e o o 0 e e e e e e e e 3l 3l 34 34 35 36 38 43 AOS Library User s Manual V FILE SYSTEM MANIPULATION e 9 e o e o e e e e o e e e e 69 O The Directory Information Unit e gt 70 O Basic Concepts o o TP OR dw ia Wow wo o4 1 Using the Directory Information Unit cade e ee dw 4 O Unit Initialization 4 6 w a a 0 c o dw xw TA 1 File Name Parsing o e e e e 0 0 0 gt 74 2 Directory Information gt gt 75 3 Directory HanipuldbiOn x X wl e x ee e e 15 4 Multitasking Support e gt e e 76 2 Directory Information Intrinsics o o 77 O D 5caHn Title ss de de ee e Ge LI l D DIT List sei uw X PE A e A 80 2 D Change Name e e e e e 0 88 3 D Chance Date 4 e s w Wow aaa dw wow 99 4 D Rem Files e dw di dl e 49 s o wo ww IO 5 D Change End Aw s X le A ew es d a ws LO GO DINC o e EAS Saa we 409 X D LOCK 4 w m eh Se we i We amp o We I e Xo x 104
11. 28 29 2A mm 9 MH 3 FO U9 N NN O WODANHNDUPWNrONe 5 gt uy O Y Y H A we ec Page 123 100 101 102 103 104 105 106 107 110 111 112 113 114 115 116 117 120 121 122 123 124 125 126 127 130 131 132 133 134 135 136 137 Pr FINK KE SCGUuuuguo rgouxEttuwWaGnuon ummooatum rcu 96 DI 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 140 141 142 143 144 145 146 147 150 151 152 153 154 155 156 157 160 161 162 163 164 165 166 167 170 171 172 173 174 175 176 177 tw HANK KM E lt CTH KR QT ODS KE rub WA MO QQ0m DEL Library User s Manual Page 124 Index ACDHTILIDBABY x6 see 6 owe EA ASCIL Character SEL cusco Backus Naur LOLI qe 67s bee ew 9 95 BMP ia 94 9 494 99 AAA AAA Chain PFOCGGUFE s 9 478 8 9 1 ORC ie Chain Expedite Procedure oooooooo o o Command I O UNIE ques 499 9909391979 cela Comneno TO UNE 24493439999 32 29 95 Cursor POST CLONING s 9394 93 Directory Information 00000000000000 Directory information Unit s DIr lInfo UNIC 4442339999 AAA D Change Date Pu unctrOoD wweees3 9 oe da po D Change End FUNCELON i 3 9 D Change Name Function L000000000000000 Do Dir List PUDCCtIOD Qe 2 2 aaa D Inlt ProGeduUte 444 3449 99 9 9 95 DLOCK Procedure ue e99 399 99 99 49 5 s Di Release Procedur scr 660 66s p
12. D Other No error D NAME was found If D Vol is included in D_Select and a volume matches the file name argument in D NAME the volume is taken off line If D Text D Code D Data or D Temp are included in D Select disk files of those types which match D NAHE are deleted from their directories No such file volume found No match found for D NAME No change made Illegal file name syntax in D NAME No change made Volume unit off line The volume unit speci fied by D NAME was not on line No change made This error occurs only if the volume id in D NAME specifies a single volume which is off line If the volume id in D NAME contains wildcards but does not match any on line volume D Rem Files returns D Not Found Unknown error No change made D Rem Files encountered an unidentified error which pre vented successful completion of the operation Page 99 Library User s Manual 220224441 Programming Example The following program demonstrates the use of D Rem Files Program Rem Test Uses Pattern Match Dir Info Var Result D Result Select D Choice Ch lt Char Rem File String Procedure GiveChoice Choice String Kind D Choice Var Ch Char Begin Write Choice Read Ch Writeln If Ch In y Y Then Select Select Kind End GiveChoice Begin Rem Test Select 1 Writeln D RemFiles Test Repeat Write File s to remove Readln Rem F
13. D Rem Piles Function sac rise D Scan Title FUuNCULON isis EXCEP INFO CODE vc coser enc Exception Information Unit oooooo EBXCeption Procedur i299 ss EXCOPUINEO UNIC 494499 999 934 9 9 WS EXecutlon EYE OL 4 92999 ws ws Execution Error Name lt Execution Option LISE 404499 5 Ex Brr Name Procedure 000000000000000 Dx IO Err N me Procedure i os Ex Stats PEOCOUUTS 4424 95 9 40sec PLLC Date uua 3 4 999 3 9 9 98 8909 9 79 8 File End e e os 9909 e 909 0999909 9999 0979999 Pale Information Unit 533499 9 3 8 9 es Pile DONG i 399993 494 943 92 9 eS Pile Name qua 399999 9 39 9 49 4 E File Name Parsing uscar 25 VE v Pile SEBEIL 244959199 CX d PIDE A VE E ies File CY De 42 95 9 29999944 9 6 93 1 99 File Unit eee ec e eo e 09 999 099 96999 90909 999 99959 File Info Unit c0cc0000000s00i000002000 000 EF Date FUNCELON 4 4 4 999 4 2 9 49 P Fil Trtlo FuDnOCLIOD ansias POISOBIOCKOed Function seed naaa F Lendth FUNCELON 4 999994 9 9 4 99 P otari Punctlo 453949499949 9 3 9 F Unit Function cscvewe severed woeseees FE Vorume PUnGEblO0HN decana GOTOXY e o e so 909 9990909 0999099 e cs e o 6 s 0 Heap 000000000000000000000000000000000 IZO ECTO 44434993 3 3 44 ene be ERLOC Name 133494 094 90 4 9 409 379 9600 V ESO Redirection 3 939 9 9 2 SURE VR ow a t T O ReSult sia X e ra CR RR eee es I O Units e o e e 999909999 999999
14. Packed Array 0 1919 Of Char Procedure Delay Begin Readin In Fyle End of Delay Begin fof Test Port SC New Port Port Columns Rows Width Height Original SC Clr Screen Original With Port Do Writeln Out Fyle Le t Corner at Col Row l Width Width 1 Height s Height 1 Delay Clear screen to s This assumes wraparound on 80 th column FillChar Dots Sizeof Dots Write Out Fyle Dots Port Max Height 1 Port Max Width 1 1 Page 44 Screen Formatting Fill Port with alphas SC_Clr_Screen Port For I 0 To 79 Do Line I Chr 33 I For I 0 To Port Height 1 Do Begin SC Goto XY Port 0 I Write Out Fyle Line Port Width 1 End SC Goto XY Port 0 Port Height Write Out Fyle Line Port Width Delay Ring around the text port We send one too many arrows in each direction to make sure we bump into the edge of the text port SC Home Port For I 0 To Port Height Do SC_Down Port For I 0 To Port Width Do Sc_Right Port For I 0 To Port Height Do SC_Up Port For I 0 To Port Width Do Sc_Left Port Delay Criss cross port with spaces For J 0 To Port Height Do Begin SC Goto XY Port J J If Port Width Port Col lt gt Port Max Width Or J lt gt Port Height Then Write Out Fyle SC Goto XY Port Port Width J J Write Out Fyle End D
15. Port Y Integer The text port described by Port is erased from 0 Y to the end of the text port line and the cursor is repositioned at 0 Y Procedure SC_Erase_To_Eol Var Port SC Port X l Line Integer The cursor is placed at X Line in the text port described by Port The line is erased from this position to the end of the text port line and the cursor is repositioned at X Linel Page Al Library User s Manual Procedure SC_Clr_Screen Var Port SC_Port The cursor is placed at 0 0 in the text port described by Port The text port is erased from this position to the end of the text port and the cursor is repositioned at 0 0 Procedure SC_Eras_Eos Var Port SC Port X Line Integer The cursor is placed at X Line in the text port described by Port The text port is erased from this position to the end of the text port and the cursor is repositioned at X Line Function SC Has Key Var Port SC Port What SC Key Command Boolean Returns TRUE if the terminal keyboard associated with the text port described by Port has the What function Function SC Map Crt Command Var Port SC Port Var K_Ch Char SC Key Command Reads K Ch from the keyboard associated with the text port described in Port and returns the character and a scalar describing the character If the key sequence is prefixed it is returned biased by 128 Note that the second character of an escap
16. SC System causes the screen control unit to use the system GOTOXY intrinsic to position the cursor within a text port SC System should only be used in conjunction with text ports declared on the system console SC Soroc may be used with any terminal compatible with Soroc or Lear Seigler ADM series terminals SC VT52 may be used with any terminal compatible with the DEC VT 52 terminal including the Zenith Z 19 and the DEC VT 100 SC Datamedia may be used with terminals compatible with the Datamedia 1500 and DT 80 Series terminals WARNING As a result of a successful call to the SC Init function screen control information is stored on the system heap The Page 34 Screen Formatting RELEASE intrinsic should not be used to deallocate a heap contain ing this information Terminal operations are screen control functions that do not alter the location of the text port cursor A program may query the screen control unit as to the availability of certain screen control functions and keyboard functions It may also read input from a terminal s keyboard or lock a terminal so no other task can access it The screen control unit provides the SC Scrn Has function to allow the program to determine whether the terminal is capable of performing a certain screen operation Some terminals do not support all of the screen control operations required by the screen control unit The screen control unit simulates unsupported operations by using the su
17. Therefore output and t output options may not be used to manipulate the editor s output stream However since it reads from STANIN input and t input options may be used to manipulate the editor s input stream E Section 2 0 0 0 1 pages 7 8 Section 2 0 0 0 2 pages 8 9 It should be noted that when a program is called the data space amd code segments used by the calling program are left in memory Thus the called program must operate in whatever memory is left
18. comma hyphen tilde and curly brackets A subrange wildcard consists of a character set delimited by curly brackets A character set consists of a list of character separated by commas A character item is either a character or a character range two characters separated by a hyphen A charac ter range implicitly specifies all characters lying between the two Page 61 Library User s Manual characters Consult the ASCII table in Appendix C to determine the ordering of characters Character items preceded by tildes are called negated items Examples of subrange wildcards a D C a d j w z a z j x y Syntax for subrange wildcard lt wild card gt lt item list lt item list gt lt item gt lt item gt lt item gt 232 7 char item char item 3 char range range 235 lt char gt lt char gt lt char gt 232 a printable ASCII character The initial value of the character set depends on the first character item in the list If the first item is negated the set initially contains all characters otherwise the set is initially empty The list of character items is evaluated left to right Characters specified by nonnegated items are included into the set characters specified by negated items are excluded from the set Thus a Character matches the subrange wildcard if it matches one of the nonnegated items but does not match any of the negated choices For example the
19. 1 Wild Len is 1 Comp Pos is l Comp Len is 4 matches BOOT D_FPat returns a pointer to the following information l Wild Pos is 1 Wild Len is 4 Comp Pos is 1 Comp Len is 4 TEST matches TEST 2 Wild Pos is 5 Wild Len is 5 Comp Pos is 5 Comp Len is 1 1 9 matches 5 3 Wild_Pos is 10 Wild_Len is l Comp Pos is 6 Comp Pos is 5 matches CODE Page 83 Library User s Manual A similar list is returned for WORK TEST5 TEXT NOTE If the volume id in D Name consists of a unit number e g 5 the volume assigned to the unit is defined to match the volume id in D Name The Pos and Len pointers are set as in the following example D Name is set to 5 A disk volume named FOON resides in unit 5 l Wild Pos is 1 Wild Len is 2 Comp Pos is 1 Comp Pos is 4 5 matches FOON NOTE D_FPat and D_VPat never contain invalid information If information is unavailable or has not been requested the pointers are set to NIL D_Dir_List returns a value of type D_Result D_Dir_List can return all scalar values defined in D_Result except D_Exists the values have the following meanings D_Okay No error All D_Ptr information is valid D_Not_ Found No such file volume found No match found for D Name D Dir List sets D Ptr to NIL D Name Error Illegal syntax in D Name D Dir List sets D Ptr to NIL D Off Line Volume unit off line The volume specified by D Name was not on line This erro
20. 454549 49 37 SC Clr Screen Procedure 00000000000000 37 SC Cntrl Unit E e o 0 0 0 0 0 0 E 0 e 0 0 e 0 s 0 a 31 Page 126 Index SC Down PIOCedufeGe v9 V 3 vss 30 SC Erase To Eol Procedure 00000000000 37 SC Eras EOS Procedure Z4 9 2 toe 37 OC GOLO AY PLOGGOUIOC 4 5 9 dc c 20 SC Has Rev FUNCULON i444 93 DI SC Home Procedure 433549949 20 SC Init FUNCEULO 4334 2993 2 5 we eee soo SC in Look ProCcedUrGe 34 35 9 499 22 SC In Release Procedure ceccvecccvvseees 35 SC Lert Procedure setas see 9 a u SC Map CRT Command Function oooorn 36 SC New Port Procedure ses 38 SC Out LOCK Procedure suso cs DI SC Out Release Procedure c2 39 SC Prompt EUHCELlON 2493994349999 9 247 SC RigUt Procedure ize 9 vcr DO Sc Sern das FUNCTION 4399499 9339 9 94 9 9 299 SC Up PrIOCedUuLfe i499 9 939 wes segment DECOALAD escasas LO Shell uid 34 99 cia SI Code Tid Procedure 4443 9 22 SI Codo Vid Procedure 9235 9 9 A2 SI G t Date Procedure e 9 sees eee 23 SI Get Pref Vol Procedure scrcccceces 23 SI Get Sys Vol Procedure 000000000000 23 SI Set Date Procedure session 23 SI Set Prer Vol Procedure 4 5 4 4 23 SI Sys Unit Function Lesrc00s0c0c0c000000000 22 SI Text Tid Procedure 442944 ww 22 SI Text Vid Procedure 44 49 22 Spool File Function 49993 sensa 24 216 Spool Restart Procedure oooorr orooorr 117 Spool_ Status Function o o co s 117 Spool
21. New Date A record of type D Date Rec which contains the new date A value of 100 is not accepted by D Change Date in a new date See section 5 0 0 4 for more information D Select A set of file and or volume types as described in section 5 0 0 3 All scalar types except D Free and D Temp apply to D Change Date Disk free spaces identified by the D Free scalar do not contain file dates Temporary status for files is specified by a special value in the file date field Thus D Free and D Temp are ignored if they are included in D Select Page 95 Library User s Manual D_Change_Date returns a value of type D Result D_Change_Date can return all scalar values defined in D Result except D Exists the values have the following meanings D Okay No error D_Name was found and D New Date was written to the directory for the specified file or disk volume D Not Found No such file volume found No match found for D Name No change made D Name Error Illegal syntax in D Name No change made D Off Line Volume unit off line Volume unit specified by D Name was not on line No change made This error occurs only if the volume id in D Name specifies a single volume which is off line If the volume name in D Name contains wildcards and does not match any on line volumes D Change Date returns D Not Found D Other Unknown error No change made D Change Date encountered an unidentified error which pre vented successful completi
22. a programming example 4 1 0 Reals A real number is defined as a rational number which lies in the range 3 0E38 3 0E38 and is accurate to seven digits Real numbers are stored as signed binary values in variables of type real Values stored in this fashion are referred to as numerical reals Real numbers may also be stored as character strings in variables of type string Values stored in this fashion are referred to as character string reals There are two kinds of character string representations for real numbers fixed point format and floating point format Page 54 Data Manipulation A real number displayed in floating point format consists of a Signed fraction with absolute value less than 9 99 anda Signed integer specifying an integral power of ten Character string reals displayed in floating point format have the following form lt floating point format lt mantissa part exponent part mantissa part lt lt sign gt lt mantissa gt lt mantissa gt lt whole part gt lt decimal part gt so ee li lt whole part gt lt digit string gt lt decimal part gt digit string o ee u exponent part e lt exponent gt E lt exponent gt ee lt exponent gt 2 lt sign gt digit lt digit gt lt digit string gt digit sign lt digit gt c 01 1121314 516171819 NOTE One restriction on this grammar is that lt whole part gt
23. and lt decimal part gt cannot both be empty A real number displayed in fixed point format consists of a signed fraction Character string reals displayed in fixed point format have the following form lt fixed point format lt mantissa part NOTE The syntax specification presented in this document and thus recognized by the real conversion unit is a superset of the standard Pascal syntax for real numbers Examples of character string reals displayed in both fixed and floating point format Fixed point format Floating point format 123 1 23e2 123 456 1 23456E 02 1234567 1 234567E5 5432 5 432e 1 Page 55 Library User s Manual The real conversion unit is available as an option with the AOS It is imported into a program by the USES Real_Con statement see the Programmer s Manual for details The Real Con unit may be installed in either the intrinsics library the system library or a user library All imported identifiers begin with RZ to prevent conflicts with program identifiers The real conversion unit maintains no global variables but does use the number conversion unit Num Con section 4 0 in its implementation section 4 1 1 0 Real Conversion The R_Real_To_Str and R_Str_To_Real routines perform type conver Sion between real and string values 4 1 1 0 0 Real to String Conversion The R_Real_To_Str procedure accepts four parameters The first parameter is a real variable containing th
24. asynchronously with respect to the execution of the program The print spooler unit provides the following capabilities Text file queueing and concurrent printing Print suspend and resume functions Spooler status functions The print spooler unit is provided with each AOS release It is imported into a program by the USES Spooler statement see the Programmer s Manual for details It may be installed in the intrinsics library the system library or the user library All imported identifiers begin with Sp to prevent conflicts with program identifiers The routines provided by this unit are described below The print spooler unit maintains 700 words of global variables It uses no other units The print spooler is implemented as a concurrent task that is started during the execution of the Spool Unit initialization section The task is terminated during the execution of the unit termination section after all print requests have been satisfied Since the system prevents program termination until all of a program s tasks have terminated a program that uses the print spooler unit cannot terminate until all print requests have been processed NOTE The printer spooler task executes at priority 64 Since most user programs execute at priority 128 the printer spooler task is locked out during compute bound operations The SU Delay intrinsic see section 2 4 0 1 may be used to suspend compute bound tasks for short peri
25. available from other sources Page 1 Library User s Manual l l Overview The UCSD Pascal System was designed for use as a Simple program development system rather than a general purpose operating system consequently much useful system information is inaccessible to user programs The most common solution to this problem is to structure user programs so they can directly access the operating system s data structures A better solution is to construct UCSD Pascal units which provide routines for accessing system informa tion in a controlled manner The interfaces provided by well de signed units make system information access a much safer and easier operation to perform Program development using units is faster and more reliable than traditional methods Large and complex collections of routines may be organized into unit libraries for subsequent incorporation into user programs Valuable programmer time is conserved by eliminat ing the re creation of pre existing routines Units available from Advanced Computer Design are organized into five classifications System Functions Includes program execution from a host program program chaining I O redirection control system variable access and miscellaneous system functions Screen Formatting Includes screen and keyboard primitives for multiterminal and multiprocessing use All screen commands are supported within user defined text windows Data Manipulation Include
26. block structured unit Records describing serial volumes have D_IsBlked set to FALSE the remaining fields are unde fined Page 81 Library User s Manual The following fields exist only in records describing file objects stored on disk units i e D Is Blkd is TRUE D Start contains the starting block number of the file object If the object is of type D Vol this value is interpreted as the block number of the first block on the volume e g 0 for disk volume D Length contains the length in blocks of the file object If the object is of type D Vol this value is interpreted as the total number of blocks on the volume e g 494 for single density 8 floppy disk D Kind indicates the type of the file object described by the current record See section 5 0 0 3 for more information The following fields exist only in records describing disk file objects other than unused disk areas i e D Kind in D Vol D Temp D Code D Text D_Datal D Title contains the file title of the object For objects of type D Vol this field contains the empty string D FPat is a pointer to pattern matching information collected while comparing file names to the file id in D Name see section 5 0 0 1 for details on pattern matching info D FPat is set NIL if pattern matching information is not requested or if the file id in D Name is empty D Date contains the file date section 5 0 0 4 for the current object i D_Num_Files is va
27. call to SC Goto XY Note that this is also true after calling SC Home SC Clr Line SC Erase To Eol SC Clr Screen SC Eras Eos and SC Prompt Note that when more than one task accesses text ports on a single terminal screen the SC Out Lock or SC In Lock procedures may be necessary in order to ensure mutually exclusive access to the terminal WARNING Passing text port records by value is NOT recommended since this results in the creation of text port records that have not been initialized by the SC New Port procedure Page 38 Screen Formatting 3 0 2 The Screen Control Unit Interface The interface section of the screen control unit is presented here for reference Unit SC_Cntrl Inte Type rface SC_Term_Id SC_CHSet SC_Long_String SC_Term_Type SC_Scrn_Command SC_Key_Command SC_Key_Set SC_Port Note that all identifiers begin with SC_ Integer Set Of Char String 255 SC System SC Soroc SC VT52 SC Datamedia SC WHome SC Eras S SC Erase Eol SC Clear Lne SC Clear Scn SC Up Cursor SC Down Cursor SC Left Cursor SC Right Cursor SC Backspace Key SC Eof Key SC Etx Key SC Escape Key SC Del Key SC Up Key SC Down Key SC Left Key SC Right Key SC Unknown Set Of SC Key Command Record Text Port Attributes Height Width Row Col Cur X Cur Y Terminal Attributes Max Height Max Width Integer Slow XY Crt Boolean
28. cvuus numerical functions pro vided by the integer conversion unit The N Min and N Max functions accept two signed integer parameters and return an integer result N Min returns the lesser of the two parameters N Max returns the greater of the two parameters Page 50 Data Manipulation 4 0 1 1 1 Unsigned Integer Min and Max The N MinU and N_Max_U functions accept two unsigned integer parameters and return an integer result N Min U returns the lesser of the two parameters N Max U returns the greater of the two parameters 4 0 1 1 2 Unsigned Integer Comparison The N_Leg_U and N GeqU functions accept two unsigned integer parameters and return a Boolean result N_Leq_U returns TRUE if the first parameter is less than or equal to the second parameter otherwise it returns FALSE N Geq U returns TRUE if the first parameter is greater than or equal to the second parameter otherwise it returns FALSE Page 51 Library User s Manual 440 2 The Integer Conversion Unit Interface This section displays the text of the interface section belonging to the integer conversion unit The interface section text may also be viewed with the Libmap utility see the System User s Manual for details Note that all identifiers begin with N Unit Num_Con Interface Function N Str To Int Str String Index Integer Var Num Integer Integer Converts the string Str to an integer Num beginning at the character StrlIndex I
29. e Page 97 Library User s Manual 2 0 2 4 D Rem Piles syntax String D Choice D_Result Function D Rem Files D Name D Select The D Rem Files function removes file objects whose names match the file name argument contained in D Name and types match the elements included in D_Select The file name argument may contain wild cards Disk files are permanently deleted from their directories Volumes are taken off line but not altered in any way off line disk volumes may be brought back on line merely by referencing them while off line serial volumes remain inaccessible until the system is reinitialized D Rem Piles accepts the following parameters D Name A string containing the name of the file s or 7 volume s to be removed D_Select A set of file objects to be removed Removal of file objects is subject to the criteria described in section 5 0 0 3 The definition of the set is as follows D Name Type D Vol D_Code D Text D Data D Free D Temp D Choice Set Of D Name Type All scalar types except D Free apply to D Rem Files Disk free spaces cannot be removed from the directory thus D Free is ignored if it is included in D_Select Page 98 File System Manipulation D Rem Files returns a value of type D Result D Rem Files can return all scalar values defined in D Result except D Exists the values have the following meanings D Okay D Not Found D Name Error D O Line
30. e eee o o e e o o o o o o o o o o e e o 9 o o e 9 e o o e e o o o e e o pu LO e e e e 0 e e ace e 0 e ec s e o eee es ec 9 o e e o e 9 9 o oe o e e e e o 9 9 o e 9 eee 9 9 o e e 0 o o ee o NO h2 C e the e e o e e o o o 0 0 o 9 e o ee s 9 o e e o o o e e o 9 o e 0 ec 9 e o o 0 e 9 o o o o No NI III 0 AOS Library User s Manual SCREEN FORMATTING e e e e e e gt o The Screen Control Unit o 0 l Terminals e 4 d gt o o o Using the Screen Control Unit 0 Terminal Initialization l Terminal Operations 2 Text Port Operations 3 Multiple Text Ports on a Single The Screen Control Unit Interface Programming Example Ho e e e o e IV DATA MANIPULATION e 4 o 0 The Integer Conversion Unit 0 1 2 3 The Real Conversion Unit gt gt 0 1 WIN T 0 i 2 3 he Pattern Matching Unit IntegerS eo 0 e e o o o Using the Integer Conversion Unit O Integer Conversion gt l Numerical Functions gt The Integer Conversion Unit Interface Programming Example ReaLlS sa e e A i Using the Real Conversion Unit O Real Conversion i 1 Numerical Functions
31. external files The file information unit section 5 1 provides routines that return information on file variables declared within a program Page 69 Library User s Manual 5 0 The Directory Information Unit The directory information unit named Dir_Info contains routines which provide user programs with access to file system information previously accessible only to system programs The directory information unit provides the following capabilities Directory Information Access For any on line disk unit Dir_ Info returns the volume name volume date number of disk files on volume amount of unuSed Space and attributes of individual disk files Dir Info provides routines for changing the date or name of a disk file or volume removing files from a volume and taking volumes off line Wildcards Most Dir Info routines recognize the wildcard conven tion established by the pattern matching unit section 4 2 in their file name arguments Error Handling Dir Info defines a standard error result simi lar to UCSD Pascal I O results for routines involved with file names and directory searches Dir Info provides routines for protecting file system information from contention between concurrent tasks These routines ensure that only one task can modify file system information at a time Section 5 0 0 presents concepts needed for using the directory information unit Section 5 0 1 provides an overview of the Di
32. function returns the value Sp Queued The file name parameter contains the name of the text file including the TEXT suffix to be listed The printer paper page size and the size of the desired print area are expressed as a number of lines of print This allows the print spooler to operate correctly with different types of printer paper Most printer paper accomodates 66 lines per page The standard print area for this paper contains 60 lines The print spooler uses linefeeds to skip the remaining 6 lines Continuous printing may be achieved by specifying the same values for the page size and the print area The I O unit number should address a serial output volume Different print requests may name different serial output devices Note that print requests are processed one at a time Thus addressing two print requests to different devices does not result in simultaneous output to both devices WARNING No validation is performed on the I O unit number If it addresses a block structured device valuable data may be overwrit ten The UNITSTATUS intrinsic see the Programmer s Manual may be used to verify that an I O unit addresses a serial output device Page 116 I O Routines NOTE A file queued for printing should not be removed or relocated until it has been completely printed The volume containing the file should remain online throughout this period 6 0 0 2 Spool Stop and Spool Restart The Spool_Stop procedure susp
33. information on D_Scan_Title Page 74 File System Manipulation S 0 1 2 Directory Information The D Dir List function creates a list of records containing directory information on volumes and disk files This information includes volume names and unit numbers of blocked and unblocked on line units the number of files on blocked units lengths and starting blocks of disk files and unused disk spaces file names and types file dates and file ends The function result is used to flag invalid file name arguments off line volumes or not found files D Dir List optionally provides information describing how the wildcard file name argument matched files and or volumes See section 5 0 2 1 for more information on D Dir List Dir Info provides four routines for manipulating directory informa tion D Change Name D Change Date D Change End and D Rem Files The D Change Name function accepts two main parameters the name of an existing file and a new file name The existing file is searched for in the specified disk directory if found its name is changed to the new file name Volume names are changed in similar fashion by passing only volume id s in the file name arguments D Change Name optionally prevents the deletion of existing files having the same file name as the new file name The function result is used to flag invalid file names not found files or the success of the name change See section 5 0 2 2 for more informa t
34. information returned by some Dir Info routines is stored in linked lists on the system heap The dynamic variable management intrinsics MARK RELEASE and DISPOSE can be used to deallocate these data structures Note that careless use of MARK and RELEASE may result in undefined pointer values NOTE Two copies of the directory information unit exist one compatible with hosts using the II 0 heap intrinsics and one compatible with hosts using the IV 0 heap intrinsics The II 0 compatible copy is provided in the ACD LIBRARY file the IV 0 compatible copy is provided in the ACD H LIBRARY file Both the II 0 compatible copy and the IV Q compatible copy are called Dir Info The heap usage of a given copy of the directory information unit may be determined using the Libmap utility documented in the System User s Manual 5 0 QU i I iti li ti When the Dir_Info unit is used under the Advanced Operating System unit initialization is performed automatically When using this unit under other versions of UCSD Pascal the D_Init procedure must be called before any of the Dir_Info routines are used See section 5 0 2 6 for more information on D_Init 2 0 1 1 File Name Parsing The D_Scan_Title function parses file name arguments according to the syntax rules for UCSD file names and returns the file name s volume id title type and length specifier The function result is used to flag invalid file name arguments See section 5 0 2 0 for more
35. intrinsics and one compatible with hosts using the IV 0 heap intrinsics The II 0 compatible copy is provided in the ACD LIBRARY file the IV 0 com patible copy is provided in the ACD H LIBRARY file Both the II 0 compatible copy and the IV 0 compatible copy are called Pattern Match The heap usage of a given copy of the pattern matching unit may be determined using the Libmap utility documented in the System User s Manual The P Match function serves as a general purpose pattern matcher for string variables The two main parameters are a wildcard string and a literal string A wildcard string is a character string which may contain the wildcards defined in section 4 2 0 The characters in a literal string are treated literally P Match determines whether the literal string matches the wildcard string If the strings match P Match returns TRUE otherwise it returns FALSE NOTE P Match cannot match two wildcard strings the characters in the test string are treated literally P Match optionally provides information describing how the strings were matched i e which character strings in the test string matched the wildcards in the wildcard string This information is returned as a linked list on the system heap Page 63 Library User s Manual 4 2 2 The Pattern Matching Unit Interface This section displays and discusses the text of the interface section belonging to the pattern matching unit The interface section text may also
36. name and the segment relative byte offset into a procedure number and a procedure relative byte offset The segment name procedure number and byte offset are returned in the remaining three parameters Page 15 Library User s Manual This procedure is useful in printing status and diagnostic reports relating to the progress of program execution Segment numbers and byte offsets are available in P Machine mark stack records See the Architecture Guide for details 2 1 0 1 1 0 Error Name The Ex_IO_Err_Name segment procedure accepts an integer value and a string variable as parameters It translates an I O error number contained in the integer parameter to a text string describing the error The textual form is returned in the string parameter This procedure is useful in providing a meaningful user interface in programs that perform their own I O checking Such programs may use this procedure to translate a bad IORESULT into text before reporting an I O error to the user NOTE The system exception handler calls Ex_IO_Err_Name when constructing the excecution error message for an I O error User defined 1 0 errors may be added to the Pascal system by modifying this procedure to return text for currently unallocated error numbers These I O errors may be generated by user provided system drivers and by use of the Prog IO Set procedure of the program operators unit see section 2 0 The Ex Err Name segment procedure accepts two int
37. o D ReLGase e we de eo Swe uw o Xe OX e cw dE de d 3 The Directory Information Unit Interface 107 The File Informati n Unit s e e w woo wo cw o LOS 0 Using the File Information Unit amp a x 110 O Resident Volume e gt gt 110 E RESIASHE DATE 4 4 we io te ets tee NP ee e DO 2 dillo 4 09 AA lo We et wt wc Se del d 3 Bate e a Bo Ww da a e deo Oe bbb 4 henge uw do wail aah Wo Gk See UE 4o wee WO ee Ger qe uw e 5 Starting BLOCK s 4 amp 4009 0 a a wwe we de Lll l The File Information Unit Interface gt 2 Programming Example VI I O ROUTINES o 0 e e o o o e e e e e o o e e o o LES He Print Spooler Unit We ed Wow e e LI O Using the Print Spooler Unit o o 0 115 O Print Spooler Status Results 116 l Spool File e SC de a de d Wc og ws ALG 2 Spool Stop and Spool Restart di he Iw de lE dU DEI 3 Spool Status de We ow a LI l The Print Spooler Unit Interface 9 e 9 ll 2 Progranming Example ux ww e o a w 110 APPENDICES o e e e e e e e e e L e e e o o L o A o 119 Appendix A Standard I O Results su e e s 119 Appendix B Standard Execution Errors 121 Appendix C ASCII Character Set o k a
38. of a program that outputs files to a printer Note that if the Spool_Unit is installed in the intrinsics library the program may terminate before the print request queue is exhausted This allows concurrent printing and system operation Program Dump Files Uses Spool Unit Const Lines In Page 66 Print Per Page 60 Leave 6 lines Out Unit 6 Printer Var Name String Procedure Get Pile Name Var Name String Begin Writeln Write File to print Readln Name End Get File Name Begin Dump Files Spool Stop Get File Name Name While Length Name lt gt 0 Do Begin Get_File_Name Name Case Spool File Name Print Per Page Lines In Page Out Unit Of Sp Not Pound Writeln Name not found Sp Full Writeln Queue is full Sp Queued Writeln Name queued End Case End While Spool Restart End Dump Files Page 118 Appendices APPENDIX Az STANDARD IZQ RESULTS 0 No error l Bad Block Parity error CRC 2 Bad Unit Number 3 Bad Mode Illegal operation 4 Undefined hardware error 5 Lost unit Unit is no longer on line 6 Lost file File is no longer in directory 7 Bad Title Illegal file name 8 No room insufficient space 9 No unit No such volume on line 10 No file No such file on volume 11 Duplicate file 12 Not closed attempt to open an open file 13 Not open attempt to access a closed file 14 Bad format error in reading real or integer 15 Ring bu
39. procedures are SC Le ft move cursor left SC Right move cursor right SC Up move cursor up SC Down move cursor down SC Home move cursor to 0 0 SC Goto XY move cursor to X Y All procedures require a text port record as a parameter The procedures will not move the cursor outside of the text port attempts to do so cause the cursor to stick at the edge of the text port The SC Goto XY procedure moves the cursor to a specific position in the text port It requires the coordinates of the new cursor position as a parameter Page 36 Screen Formatting 3 0 1 2 1 Screen Clearing The screen clearing operations are SC Clr Line Clears line from 0 Y SC Erase To Eol Clears line from X Y SC Clr Screen Clears screen from 0 0 SC Eras Eos Clears screen from X Y All procedures require a text port record as a parameter Some procedures require a coordinate as a parameter with others the coordinate is implied The cursor is placed at the specified text port coordinates The screen control unit attempts to perform the operation with the screen functions available on the terminal If the terminal does not support the screen operation the operation is simulated by writing blank characters and then re positioning the cursor at the specified text port coordinates 3 0 1 2 2 Prompt Lines The SC Prompt function provides prompt line support when using text ports The function accepts a prompt line of
40. stop Procedure sessions Ll SDOOI UNhIt UNIG aras naaa HS STANOUTE 4 2479398993 9 99 as LO Suspend Redir Procedure desir 9 19 Suspend T Procedure 5 29 9 sas 19 SU Delay Procedure c0000c00000000000000 2751195 SU Max Unit FU lCLtlOh ss cris sa 28 SU Ser Num Function sotana LL System Boot Unit eoeccocccecceceeccocs 22 System Boot Volume 0c00000000000000000 23 System Date Lee000000000c0c00000000000000 23 System Information Unit e asis 21 System LIDT rary sesion scsi 22 2 90 56 63 4 110 LL5 System Serial Number 0000c0000000000000 27 System UtILLEY UNIC siae 27 System Workfile x uo we 22 SISTE PASCAL isso o uvas wv as LO Sys Info Unit 0000 0 o 0 9999090 90999909292929 21 Sys_Util Unit 90990099999 e 0 s 0 27 Terminal o o e e 0 99 09 e 997999 999999099 99790986 32 e Terminal Initialization os 24 Text Port 9 9499 44 AAA 32 38 Text Port Operations cecccccveccecccese 36 Page 127 Library User s Manual Time DELAYS v9 9c 27 Unsigned Integer 0 00c0c00c000000000000000 DU Unsigned Integer Comparison o ooooooo Dl User Library 0 e 0 0 e 0 0 ceo 0 e 0 e 0 0 cs 0 0 so 0 000 22 124 5505003 74 110 115 Wildcard 2 646 se S6 wit ewe es 2 c 90502 70 891 92 92 90 Page 128 ADDENDA FOR THE LIBRARY USER S MANUAL Bection 2 0 0 0 0 page 7 The editor does not write to either the pre declared file OUTPUT or to the STANOUT unit
41. units which perform functions related to program execution operating system variables and I O redirection The program operators unit section 2 0 and the exception informa tion unit section 2 1 are normally used by the operating system but may be also used by user programs The program operators unit allows the execution of a program as a procedure of the host The exception information unit translates execution error and I O error numbers into error text The command I O unit section 2 2 provides routines related to program chaining and I O redirection The system information unit section 2 3 allows access to operat ing system workfile file system and date variables The system utility unit section 2 4 provides miscellaneous routines Page 5 Library User s Manual 240 The Program Operators Unit The program operators unit called Prog Ops provides program invocation and termination routines normally available only to the operating system Using the facilities of the program operators unit a program may execute other programs as if they were procedures The program operators unit provides the following capabilities Program Invocation Setup and execute a program Raise Exception Invoke the system execution error pro cessor Indicate whether the standard 1 0 stream for the current program has been modified The Prog_Ops routines are described in section 2 0 0 Section 2 0 1 contains a copy of the Prog_Ops u
42. variable used to pass the execution option list may also be used to return the textual error message It is not necessary to declare two string variables for use as parameters to Prog Call 220 0 0 2 Prog Setup Prog Execute and Prog Start The Prog Setup segment function is called to set up the runtime Structures necessary to execute a program It accepts a string value a pointer value a string variable and a program descriptor variable as parameters The first string contains an execution option list If the program named in the execution option list does not exist or not all of its used units are available a textual error message is returned in the second string parameter and the function result is returned FALSE If there is no code file name in the execution list any I O redirection options are processed the second string parameter is returned empty and the function result is returned FALSE Otherwise the program s runtime structures are created on the system heap the program descriptor is returned and the function result is returned TRUE The program runtime structures include the global variable space for each unit used by the program and 20 words for each segment or unit declared No program or unit code segments are loaded If the value of the pointer parameter is Nil the structures are created on the top of the current heap Otherwise the RELEASE intrinsic is called using the value of the po eh argument then the st
43. EE EE e o e o 60 70 74 Pattern Match Unit s s is i soarsss s 060 70 74 Prefix Volume o e eo 990 9 S o s e s o 3 Print Spooler Status 00000000000000000 116 Print Spooler Unit 0c0c0c0c0c0c0c0000c000c0000 115 Program Chaining ccoo 19 Program Descriptor Record 0000000000 0 7 Program Invocation weccccccccccccccsese Program Operators Unit 000000000000000 0 Program Termination 00000000000000000 Y Prog_Call Function o oe oconsnnnnrnsrrsos Prog Exception Procedure 00000000000 s Y Prog Execute Function 000000000000000 9 6 1 6 6 3 Co NI Prog 10 Set Procequre se Prog Ops Unit sexis is acres Prog Redir FPUNCCION asso sviene Prog Setup F ulctlOl 3229 9 9 ewes Prog Start Function 44999 999 39 Prompt Lines v9 999 99 990099 9099990999999 P Match Function e o 0 0 0 e e 0 e 0 e 0 e e 0 0 s0 0 0 63 Real Conversion Unit seccvdvsecesccceeos D heal COM Unit suinetti DA Resident Unit eo ce co 9 0909099 0909 9 909 99099 999 999 90999 110 Resident VOLUME 54959499549 v v LLO Resume Redir Procedure 00000000000000 19 Resume T Procedure e e e oc ec e e e 909 99999099909 19 R Max FUNCCLON 4 999949 DI R MIH FUNCELON diia ao DI R_Real_To_Str Procedure 000000000900s DO R Str TO Real FUNGELTON 2999 4 9 DI Screen Clearing oe ose DI Screen Control Unit sessione 3999 es 31 Screen Coordinates se tini Se SC CLE Line PEOCOQUES
44. Error D Rem Old If set to TRUE D Rem Old indicates that an existing file or volume designated by the file name in D New Name may be removed in order to change the file name If set to FALSE the presence of an existing file or volume with the same name as D New Name aborts the name change and D Change Name returns D Exists as a func tion result Page 88 File System Manipulation D Change Name returns a value of type D Result D Change Name can return all scalar values defined in D Result the values have the following meanings D Okay D Not Found D Exists D Name Error D Off Line D Other No error D Old Name was found and its name changed No such file volume found No match found for D Old Name No change made The name change was blocked by the presence of an existing file with the same name as D_New_ Name No change made Illegal file name syntax in D_Old_Name or D New Name No change made Volume unit off line Volume unit specified by D Old Name was not on line No change made Unknown D Change Name encountered an error it could not identify No change made Page 89 Library User s Manual 329 2 2 1 Programming Example The following program demonstrates the use of D_Change_Name Program Change_Test Uses Pattern_Match Dir_Info Var Rem_Old Boolean Old New String Ch Char Rslt D Result Begin Writeln D_ChangeName Test Repeat Writeln Write Name to cha
45. O error number Segment Procedure Ex Err Name Xeq Err IO Err Integer Var S String Return text describing an execution error number 2 1 2 Programming Example The following program demonstrates the capabilities of the tion information unit Program Excep_Test Uses Excep_Info Var I Integer S String Begin For I 0 To 255 Do Begin Unitclear I If IO_Result lt gt 0 Then Ex IO Err Name IO Result S Else S no error Writeln Unit I Unitclear result S End End fof Excep Test Page 17 excep Library User s Manual 2 2 The Command 1 0 Unit The command I O unit called Command_I0 provides routines that control I O redirection and maintain a queue of programs for sequential execution The command I O unit provides the following capabilities Program Chaining Maintain a queue of programs to be executed one after another I O Redirection Control Suspend and resume input and output I O redirection The Command IO routines are described in section 2 2 0 Section 2 2 1 contains a copy of the Command_IO unit interface Section A programming example using the Command IO unit appears in section 224445 2 2 0 Using the Command I O Unit The command I O unit is provided with all AOS releases It is imported into a program by the USES Command IO statement see the Programmer s Manual for details The command I O unit may reside in the intrinsics library the system
46. Unit The system utility unit called Sys_Util allows user programs access to miscellaneous system variables and functions This unit may appear in the intrinsic library the system library or a user library The system utility unit provides the following capabilities Syste I b Obtain the serial number of the current system Time Delay Suspend the current task for a given time period Maxim it Indicate the highest I O unit number available The Sys_Util routines are described in section 2 4 0 Section 2 4 1 contains a copy of the Sys Util unit interface section A programming example using the Sys Util unit appears in section 250142 The system utility unit is provided with each AOS release It is imported into a program by the USES Sys Util statement see the Programmer s Manual for details It may be installed in the intrinsics library the system library or a user library All imported identifiers begin with SU_ to prevent conflicts with program identifiers The routines provided by this unit are described below The system utility unit maintains no global variables and uses no other units 2 4 0 0 System Serial Number Each PDQ 3 computer is assigned a unique system serial number The SU Ser Num function returns an integer function result whose value is the serial number of the current system An application program nay check this serial number to guarantee that the program cannot be transported to any PDQ 3 ot
47. Vol Title In There is no Work Codefile Vid Vo1 Tid Title th Title lt gt 0 Then ln The Work Textfile is Vol Title ln There is no Work Textfile e SI_Get_Sys_Vol Vol Writeln The System was booted on volume Vol on unit SI Sys Unit SI Get Pref Vol Vol Writeln Writeln Write Readln Delete If Leng Begin The Prefix volume is Vol New Prefix Vol Vol Pos Vol 1 th Vol In 1 71 Then SI_Set_Pref_Vol Vol SI Get Pref Vol Vol Wri End Else Write teln The Prefix volume is Vol of If ln No change made Page 25 Library User s Manual Writeln SI_Get_Date Date Writeln The current date is Date Month Date Day Date Year Repeat Write Set for tomorrow s date Read Ch Until CH Im bys Xt ut SRL Writeln If Ch In y Y Then With Date Do Begin Day Day 1 If Month In 1 3 5 7 8 10 12 And Day 32 Or Month In 4 6 9 11 And Day 31 Or Month 2 And Day 29 Then Begin Day 1 If Honth 12 Then Begin Year Year 1 Month 1 End of If 12 Else Month lt Month 1 End fof If Month SI Set Date Date SI Get Date Date Writeln The new date is Date Month Date Day Date Year End of If Ch Else Vriteln No change made End of Sys Test Page 26 System Functions 2 4 The System Utility
48. Writeln File length D Length If D Kind D Vol Then Writeln Files on volume D Num Files Else Writeln Last block size D End End If D Is Blkd End With Ptr Writeln Write Type cr for rest of list Readln Writeln Ptr Ptr D Next Entry Until Ptr Nil End Print Info Page 86 File System Manipulation Begin D_Test Repeat Mark Heap Ptr Select Writeln Directory Lister Write Volume and or file name to match Readln Match Write Return pattern matching information y n Read Ch Writeln Want Patterns Ch In y Y l If Want Patterns Then Result D ScanTitle Match Volume Title Typ Segs Writeln Types y n 1 GiveChoice Directories D_Vol GiveChoice Text Files D Text l GiveChoice Code Files D_Code GiveChoice Data Files D Datal GiveChoice Temp Files D_Temp GiveChoice Free Space D Freel Result D DirList Match Select Ptr Want Patterns Writeln If Ptr lt gt Nil Then Print Info Ptr Else Case Result Of D Name Error Writeln Error in file name D Off Line Writeln Volume off line D Not Found Writeln File not found D Other Writeln Miscellaneous error End cases Writeln Repeat Write Continue Read Ch Writeln Until CH IH n SN det NT Writeln Release Heap Ptr Until Ch In n N End D Test P
49. added to the Pascal system by modifying the kExcep Info unit The Excep Info unit source is available from ACD The Excep Info routines are described in section 2 1 0 Section 2 1 1 contains a copy of the Excep Info unit interface section A programming example using the Excep Info unit appears in section 201 2 The exception information unit is imported into a program by the USES Excep Info statement see the Programmer s Manual for details All imported identifiers begin with Ex to prevent conflicts with program identifiers The routines provided by this unit are described below This unit normally exists without an interface section in the system support library A copy of the unit with an interface section is available in the EXCEP INFO CODE file provided on the AOS release disk The copy resident in the system support library must be removed and the copy resident in the EXCEP INFO CODE file must be transferred to the intrinsics library using the Library utility see the System User s Manual before it may be used by a user program The system utility unit maintains no global variables and uses no other units 2 1 0 0 Segment Decoding The Ex_Stats procedure translates runtime segment execution infor mation into a form that can be used in conjunction with program listings It accepts two integer value parameters containing a segment number and a byte offset into the segment It translates the segment number into a segment
50. age 87 Library User s Manual Syntax Function D Change Name D Old Name D New Name D Rem Old String Boolean D Result D Change Name searches for the volume or file designated by the file name contained in D Old Name and changes its name to the file name contained in D New Name D Change Name only changes one file name at a time and thus does not accept file names containing wildcards however it can be combined with other Dir Info routines to create user defined file name changing routines which accept wildcards see section 5 0 0 1 for details D Change Name accepts the following parameters D Old Name A string containing the name of the file to be changed If the file name is invalid D Change Name returns D Name Error Note that wildcard characters are treated literally D New Name A string containing the replacement file name If the file name is invalid D Change Name returns D Name Error Note that wildcard char acters are treated literally If D Old Name contains an empty file title D Change Name changes the name of the volume specified by D Old Name to the volume name in D New Name any file title in D New Name is ignored If D Old Name contains an nonempty file title D Change Name changes the name of the disk file specified by D Old Name to the file title in D New Name any volume name in D New Name is ignored If the file id in D New Name is empty D Change Name returns D Name
51. al is implicit in this specifi cation A text port record must be initialized for each terminal before the screen control unit can operate on the terminal NOTE Two copies of the screen control unit exist one compatible with hosts using the II 0 heap intrinsics and one compatible with hosts using the IV 0 heap intrinsics The II 0 compatible copy is provided in the ACD LIBRARY file the IV 0 compatible copy is provided in the ACD H LIBRARY file Both the II 0 compatible copy and the IV 0 compatible copy are called SC Cntrl The heap usage of a given copy of the screen control unit may be determined using the Libmap utility documented in the System User s Manual 3 0 1 0 Terminal Initialization The SC Init function initializes a terminal for use by the screen control unit The screen file name the keyboard file name the MISCINFO file name and the terminal type are passed as parameters The SC Init function creates a text port containing the entire terminal screen and places the text port cursor in the upper left corner 0 Ol If any of the file parameters cannot be opened the function returns FALSE otherwise the text port record is returned and the function value returns TRUE Note that SC Init should only be called once for a given terminal NOTE The terminal type parameter indicates the random cursor positioning sequence appropriate for the terminal screen it may have the value SC System SC Soroc SOC VT52 or SC Datamedia
52. ansfer functions for variables of types string and integer The real conversion unit section 4 1 provides type transfer functions for variables of types string and real The pattern matching unit section 4 2 provides routines that compare strings containing wildcards to strings containing text Page 47 Library User s Manual 4 0 The Integer Conversion Unit The integer conversion unit named Num_Con contains routines capable of translating integers between numerical and character string representations Commonly used numerical functions are also provided The integer conversion unit provides the following capabilities String to integer and integer to string conversion Integer min and max functions Unsigned integer comparison operators Section 4 0 0 presents concepts needed for using the integer conversion unit Section 4 0 1 provides a detailed description of each function Section 4 0 2 displays the text comprising the integer conversion unit s interface section Section 4 0 3 con tains a programming example 440 0 Integers An integer is defined as a whole number in the range 32768 32767 Integers are stored as two s complement binary values in variables of type integer Values stored in this fashion are referred to as integers Integers can also be stored as character Strings in variables of type string Values stored in this fashion are referred to as character string integers Character string integer
53. arried out within the text port Note that the mutual exclusion procedures SC Out Lock and SC_In_ Lock are not used since no more than one task ever writes to a given terminal Program Tester Uses SC Cntr1 Var P Processid Process SC Test In Name Out Name String This process declares text ports on the terminal described by In Name and Out Name It then proceeds to test the key sequences and then the text ports Var Original Port SC Port Junk Boolean Out Fyle Text In Fyle Interactive Procedure Test Keyboard Port SC Port This procedure tests each of the pre defined key sequences Var Current Key SC_Key_Command Procedure Verify Name String Var Ch Char Begin Write Out Fyle Type the Name key If Current Key SC Map Crt Command Port Ch Then Writeln Out Fyle Correct Else Writeln Out Fyle Incorrect key typed Ord Ch Current Key Succ Current Key End of Verify Page 43 Library User s Manual Begin of Test_Keyboard Current Key SC_Backspace_Key Verify Backspace Verify Eof Verify Etx Verify Escape Verify Delete Verify Up Verify Down Verify Left Verify Right End of Test Keyboard Procedure Test Port Columns ROWS Width Height Integer Const Eol 13 Var I J Integer Ch Char Port SC_Port Line Packed Array 0 79 Of Char Dots
54. at Patl Posl Lenl If D FPat lt gt Nil Then Begin D FPat D_FPat Next Find Equal D Title Name D_FPat Pat2 Pos2 Len2 New D Title Last Pos Pos2 Len2 Mid Pos Posl Len2 Last Equal Last Pos Lenl For I Posl To Mid Pos 1 Do New I Pat2 I Posl 11 lst s For I Mid Pos To Last Equal 1 Do New I D Titlel I Len2 Lenll For I Last Equal To Last Pos 1 Do New I Patl I Last Equal 11 2nd s New Concat D Volume New Title Concat D Volume D Title Result D ChangeName Title New True Write Title gt New Case Result Of D Name Error Write Error in file name D Off Line Write Volume off line D Not Found Write File not found D Other Write Miscellaneous error End cases Writeln End if D FPat End with End i Change Function Display S Match Volume Name String Select D Choice D List P Var Ch Char Ptr D List P Want Patterns Boolean Result D Result Begin Display Writeln Writeln S Write Display pattern matching information Read Ch Writeln Want Patterns Ch In y Y Result D DirList Match Select Ptr True If Ptr lt gt Nil Then Print Info Ptr Want Patterns Volume Name Else Case Result Of D Name Error Writeln Error in file name Page 93 Library User s Manual D Off Line Writeln Volume off line D No
55. available are similar to those provided on the UNIX tm operating system from Bell Laboratories Section 4 2 0 presents the concepts needed for using the pattern matching unit Section 4 2 1 provides a detailed description of the pattern matching function Section 4 2 2 displays the text comprising the pattern matching unit s interface section Section 4 2 3 contains a programming example 4 2 0 Wildcards Wildcards are character sequences which are treated specially when encountered in a character string they are named wildcards because of their ability to match whole classes of character sequences rather than a single character sequence For instance the string az matches all character strings starting with the letter a because is defined as a wildcard which matches any character sequence This section describes the wildcard conventions recognized by the pattern matching unit Characters treated specially are described in section 4 2 0 0 The wildcard character matches any single character it is described in section 4 2 0 1 The wildcard is similar to the wildcard but restricts the set of matching characters to the range specified in the wildcard itself Subrange wildcards are described in section 4 2 0 2 The wildcard character matches any sequence of characters including the empty sequence it is described in section 4 2 0 3 4 2 0 0 Special Characters The Pattern_Match wildcard convention defines the followin
56. be at least this size otherwise unpredictable results may occur Attempts to convert character string reals into numerical reals whose values lie outside the range of the floating point Page 56 Data Manipulation implementation may cause execution errors This problem occurs when the exponent value of a real number is positive and lt exponent value gt lt format specifier gt gt 38 du 2 The R Str To Real function accepts three parameters and returns an integer result The first parameter is a string variable contain ing a character string real The second parameter is an integer expression specifying the starting position of the character string real in the string parameter If R Str To Real finds a valid character string real within the string parameter it returns the corresponding numerical real in the third parameter which is a real variable The function returns an index into the string parameter which points to the character immediately following the character string real If the string does not contain a valid character string real the function returns the value of the second parameter The syntax for character string reals parsed by R Str To Real is a superset of the format described in section 4 1 0 leading blank characters are ignored Character string reals are terminated either by the first nonconforming character or by the end of the string expression Note that the conversion of a character strin
57. be viewed with the Libmap utility see the System User s Manual for details Note that all identifiers begin with P Unit Pattern Match Interface Type P Pat_Rec_P P Pat Rec P_Pat_Rec Record Comp_Pos Comp_Len Wild_Pos Wild_Len Integer Next P_Pat_Rec_P End of P_Pat_Rec Function P_Match Wild Comp String Var P Ptr P Pat Rec P P Info Boolean Boolean Compares the Wild string possibly containing wildcards to the Comp literal string and returns TRUE if they match If P Info is True P_Ptr is returned pointing to a list of records containing information on how Wild and Comp were matched otherwise P_Ptr is returned Nil If P_Info is passed TRUE P_Match returns pattern matching infor mation P Ptr is a pointer to a linked list of records of type P Pat Rec containing the starting positions and lengths of corres ponding character patterns in Wild and Comp The Comp Pos and Wild Pos fields are the starting positions of corresponding character patterns in Comp and Wild respectively Comp Len and Wild Len are the pattern lengths Next points to the next pattern record in the list its value is NIL in the last pattern record The patterns occur in the list in the order in which they were matched in the strings If the strings do not match or the list was not requested i e P Info is passed FALSE P Ptr is returned NIL Page 64 Data Manipulation Example of pattern record li
58. ction to a remote port superseding output to the printer If the second program suspends its redirection using the Suspend Redir procedure output reverts to the printer Page 19 Library User s Manual This section displays the text of the interface section belonging to the Command I O unit The interface Section text may also be viewed with the Libmap utility see the System User s Manual for details Unit Command IO Interface Procedure Chain Prog Name String Append Prog Name to the end of the chain queue Procedure Chain Expedite Prog Name String Insert Prog Name at the beginning of the chain queue Procedure Exception Kill Chain Boolean Suspend all I O redirection and T file processing Procedure Suspend T Suspend all T file processing Procedure Resume T Resume T file processing Procedure Suspend Redir Suspend all redirection processing Procedure Resume Redir Resume redirection processing fee The following program demonstrates the capabilities of the command I O unit Program Chain Test Uses Command IO Var Name String Procedure Get Name Var Name String Begin Write Chain what file lt return gt to exit Readln Name End of Get Name Begin Get Name Name While Length Name lt gt 0 Do Begin Chain Name Get Name Name End of While End fof Chain_Test Page 20 System Functions 22 3 The System Information Unit The
59. d Record Month 0 12 Day 002 31 Year 0 100 End D_DateRec A year value of 100 in a file date record indicates that the object is a temporary disk file This is a UCSD Pascal file system convention Page 72 File System Manipulation 5 0 0 5 File End Data may be entered into disk files by uSing either the standard Pascal procedure PUT or the UCSD Pascal intrinsic BLOCKWRITE The last block of a file created using PUT may be only partially full of valid data because a record written using PUT may not occupy an entire block The last block of a file created using BLOCKWRITE is considered full of valid data A file end attribute is associated with each disk file it indicates the number of valid bytes 1 512 of data in the last block of the file The file end may be determined using the Dir List routine it may be modified using the D Change End routine 5 0 0 6 Error Results All Dir Info routines which access file system information return a value reflecting the result of the file system operation This result indicates either that the routine finished without errors or that an error occurred valid information is not returned when routines return a result value indicating the occurrence of an error Conditions causing errors include The specified files volumes or unused spaces can not be found in the disk directory The specified unit is off line The file name argument has improper syntax T
60. d value End cases Writeln Write Continue Read Ch Writeln Until Ch In n N 1 End End Test Page 102 File System Manipulation Syntax Procedure D_Init Initialization of the Dir_Info unit is performed automatically when running under the Advanced Operating System However when running under other UCSD Pascal systems D_Init must be called before any Dir_Info routines may be used failure to do so may result in unexpected program behavior Page 103 Library User s Manual 2e0 2 7 D Lock Syntax Procedure D Lock D Lock grants exclusive directory access rights to the task that executes it however a task may have to wait until another task releases the directory lock before it may continue execution past its call to D_Lock See section 5 0 2 8 0 for an example of D Lock NOTE D Lock calls should always be matched with D Release calls to prevent system deadlocks The Dir_Info routines D Lock and D Release are provided for use in multitasking environments When used properly they ensure mutual ly exclusive access to directory information See section 5 0 1 4 for more information on multitasking routines Page 104 File System Manipulation 32a0 240 D Release syntax Procedure D_Release D Release releases exclusive access rights to the directory Tasks already waiting for directory access are automatically awakened when the directory becomes available by a call to D_Relea
61. dressed by 0 01 the lower right corner is addressed by lt width gt lt height gt 1 Each text port maintains its own text port cursor It is possible to declare any number of text ports on a single screen Text ports may occupy all or any part of a terminal screen and may overlap other text ports on the screen Page 32 Screen Formatting 3 0 0 0 0 Text Port Records Text port information is stored in a text port record Text port records specify a text port s attributes and current state during Screen control operations The type declaration for a text port record is defined in the interface section of the screen control unit it contains information describing a text port and its host terminal SC Port Record Text Port Attributes Height Width Row Col Cur X Cur Y Terminal Attributes Max Height Max Width Integer Slow XY Crt Boolean Term Type SC Term Type Term ID SC Term ID In File Out File r Overhead Information In_Use_Count Out_Use_Count Integer End fof SC Port The text port attributes define a particular text port The Height and Width are the zero based dimensions of the text port e g a text port containing 24 lines has a Height of 23 The Row and Col specify the terminal screen coordinates of the upper left corner of the text port Cur X and Cur Y are the text port relative coordinates of the text port s cursor The terminal attributes describe the terminal on which th
62. e by 128 If the prompt line is broken up because it is too long for the text port a is appended to the list of commands A input causes a new subset of commands to be displayed in place of the Paae 37 Library User s Manual prompt line This continues until all commands have been display ed at which time the initial prompt line is redisplayed 3 0 1 3 Multiple Text Ports on a Single Terminal Further text ports may be declared on a terminal screen by calling the SC_New_Port procedure This procedure accepts the Row Col Height and Width of the new text port as parameters It also requires a text port record belonging to a text port previously created on the terminal screen It returns a text port record describing the new text port Note that if any part of the new text port is outside of the terminal screen the new text port is truncated so that it lies entirely on the terminal screen Most terminal screens have a Single cursor When multiple text ports exist on a terminal screen multiple cursors may be simulated bv ca _ ae SC_Goto_XY procedure before accessing the text port this is necessary when writing to the text port or calling SC Right SC Left SC Down and SC_Up While the cursor position for a text port is maintained in the text port record the terminal screen s cursor may reside in another text port on the screen Thus the terminal screen cursor is guaranteed to coincide with the text port cursor after a
63. e number of the unit containing the external file is returned in the integer parameter Page 110 File System Manipulation 2 1 0 2 Title F_File_Title accepts a block file and a string variable as parameters and returns a file status result The file title of the external file is returned in the string parameter If the external file is a volume F_File_Title returns an empty file title 5 1 0 3 Date F Date accepts a block file and a date record as parameters and returns a file status result The date record is declared in the interface section as follows Type F Date Rec Packed Record Month 0 12 Day 0 31 Year 0 100 End F Date Rec The current date of the external file is returned in the date record parameter If the external file is a volume the returned date record contains all 0 s If the external file is a temporary disk file the month and day fields contain 0 s and the year field contains 100 5 1a40 4 Length F Length accepts a block file and an integer variable as paramet ers and returns a file status result The number of blocks of data in the external file is returned in the integer parameter Note that this value may differ from the amount of disk space allocated for a disk file when a file is being generated If the external file is a disk volume containing a disk directory F Length returns the total number of blocks on the volume If the external file is a volume lacking a disk director
64. e numerical real to be converted The second parameter is an integer variable whose value determines the format of the resulting character string real it is known as the format specifier The third parameter is an integer variable whose value determines the number of significant digits in the character string real it is known as the precision The fourth parameter is a String variable used to return the character string real If the value in the format specifier is less than one the character string real is returned in floating point format otherwise fixed point format is returned and the value of the format specifier determines the number of digits to the right of the decimal point The precision specifier determines the number of significant digits contained in the character string real If the format specifier specifies more digits after the decimal point than the total number of significant digits as specified by the precision specifier the end of the character string real is padded with blank characters to make up the difference The conversion of numerical reals into character string reals is subject to a few restrictions violation of which may cause system Crashes or execution errors When the value of a numerical real is less than 1 and greater than 1 the resulting fixed format real can temporarily occupy a string of size lexponent precision specifier 3 The string variable passed to the R Real To Str must
65. e sequence is returned in K_Ch Function SC_Prompt Var Port SC_Port Line SC_Long_String X_Cursor Y_Cursor X_Pos Where Integer Match Chars SC CHSet Match Keys SC Key Set Break Char gt Char Char This function displays the prompt line in the text port described by Port at X Pos Where If the prompt line is too long for the text port it is broken up into several chunks It can only be broken where the Break Char occurs After the prompt is displayed the text port cursor is placed at X Cursor Y Cursor Note that if X Cursor lt 0 the cursor is placed after the last character in the prompt Line If the set Match Keys lt gt characters are read from the keyboard associated with the text port until a key sequence is read that is in Match Keys If the match is SC Unknown the character must occur in the set Match Chars Page 42 Screen Formatting 3 0 3 Programming Example The following program demonstrates most of the functions of the screen control unit It starts one task for each of two terminals Each task starts by exercising keyboard sequences Each task then demonstrates the text port operations on each of several text ports A text port is created on a region of the screen The entire screen is filled with characters providing a backdrop to make text port operations more easily visible The text port is first filled with characters The various text port operations are then c
66. e text port is declared Max Height and Max Width contain the zero based dimensions of the terminal screen Slow is set to TRUE if the transmission speed to the terminal is slow enough that some prompts should be abbreviated XY Crt is set to TRUE if the terminal supports random cursor addressing The screen control unit uses Term ID to identify the proper command and key sequences for the terminal Term Type indicates the terminal type In File and Out File specify the I O unit numbers of the text port s keyboard and screen devices respectively The overhead information describes the state of the text port It is used internally by the screen control unit and provides no direct function to the program Page 33 Library User s Manual 3 0 1 Using the Screen Control Unit The screen control unit is available as an option with the AOS It is imported into a program with the USES SC Cntrl1 statement see the Programmer s Manual for details The screen control unit may be installed in the intrinsics library the system library or the user library All imported identifiers begin with SC to prevent conflicts with program identifiers The screen control unit maintains 2 words of global variables and uses no other units 88 words are allocated on the system heap each time the SC_Init function section 3 0 1 0 is called success fully All screen control operations require a text port record as a parameter The destination termin
67. eger values and a string variable as parameters It translates an I O error number and an execution error number contained in the integer parameters to a text string describing the error The textual form is returned in the string parameter The I O error number parameter is meaningful only when the execution error number is 10 User I O Error otherwise it is ignored NOTE The system exception handler calls Ex_Err_Name when con structing the excecution error message for an execution error User defined execution errors may be added to the Pascal system by modifying this procedure to return text for currently unallocated error numbers These execution errors may be generated by use of the Prog_Exception procedure of the program operators unit see section 2 0 Page 16 System Functions This section displays the text of the interface section belonging to the exception information unit The interface section text may also be viewed with the Libmap utility see the System User s Manual for details Note that all identifiers begin with Ex to prevent conflicts with host program identifiers Unit Excep Info Interface Type Ex Alpha Packed Array 1 8 Of Char Procedure Ex Stats Seg Num Seg IPC Integer Var Seg Name Ex Alpha Var Proc Num IPC Integer Translate runtime information into compiled listing form Segment Procedure Ex IO Err Name IO Err Integer Var S String Return text describing an I
68. elay Wipe out right half For J 0 To Port Height Do SC Erase To Eol Port Port Width J J Delay l Wipe out lower half SC_Eras_Eos Port Port Width Div 2 Port Height Div 2 Delay Wipe out whole thing For J Port Height Div 2 Downto 0 Do SC Clr Line Port J Delay Page 45 Library User s Manual Check out prompts Ch SC_Prompt Port Concat Command A ssem C omp F ile G omp H alt X ecute A l 1l 0 0 A de rPe iG y CI SC Unknown SC Goto XY Port Port Width Div 2 Port Height Div 2 Write Out Fyle Ch Delay End of Test Port Begin of SC Test Rewrite Out Fyle Out Name Reset In Fyle In Name Junk SC_Init SYSTEM MISCINFO In Name Out Name SC VT52 Original Test Keyboard Original Test Port 0 0 79 23 Test Port 10 10 10 10 Test Port 0 0 ll ll Test Port 68 0 11 11 Test Port 0 12 11 11 Test Port 68 12 11 11 Test Port 9 0 37 11 Test Port 9 12 37 11 Test Port 0 0 79 11 Test Port O 12 79 11 End of SC Test Begin Start SC Test SYSTERM CONSOLE P 4000 Start SC Test REMIN1 REMOUT1 P 4000 End Page 46 Data Manipulation iV DATA MANIPULATION This chapter describes units which perform functions involving the manipulation of integer real and string data The integer conversion unit section 4 0 provides type tr
69. em information unit maintains no global variables and uses no other units 2 3 0 0 Work Text File Name The SI_Text_Vid and SI_Text_Tid procedures return the volume name and file title of the work text file SI Text Vid accepts a string variable as a parameter the volume name of the work text file is returned in the string parameter If a work text file does not exist SI Text Vid returns an empty string SI Text Tid accepts a string variable as a parameter the file title of the work text file is returned in the string parameter If a work text file does not exist SI Text Tid returns an empty string The SI Code Vid and SI Code Tid procedures return the volume name and file title of the work code file SI Code Vid accepts a string variable as a parameter the volume name of the work code file is returned in the string parameter If a work code file does not exist SI Code Vid returns an empty string SI Code Tid accepts a string variable as a parameter the file title of the work code file is returned in the string parameter If a work code file does not exist SI Code Tid returns an empty string 2 3 0 2 System Unit Number The SI Sys Unit function returns an integer function result The unit number of the device containing the system volume is returned as the function value Page 22 System Functions 223290 3 System Volume Name The SI_Get_Sys_Vol procedure accepts a string variable as a parameter the volume name o
70. ends printing by the print spooler Print requests continue to be accepted until the print request queue is full The Spool Restart resumes printing by the print spooler 6 0 0 3 Spool Status The Spool_Status function returns a result of type SP Result The current status of the print spooler is returned as the function value A value of SP Go indicates that the print spooler is either processing a print request or ready to process one A value of SP Stop indicates that the print spooler is suspended see section 640 0627 6 0 1 The Print Spooler Unit Interface This section displays the text of the interface section belonging to the print spooler unit The interface section text may also be viewed with the Libmap utility see the System User s Manual for details Note that all identifiers begin with Sp to prevent conflicts with host program identifiers Unit Spool Unit Interface Type Sp Result Sp Go Sp Stop Sp Queued Sp Full Sp Not Found Function Spool Status Sp Result Gives the status of the spooler Procedure Spool Restart Re starts the spooler if it is suspended Procedure Spool Stop fStops the spooler if it isn t already Function Spool File Name String Print Space Page Size Dest Integer Sp Result Queues a file for the spooler to print Page 117 Library User s Manual 6 0 2 Programming Example The following program demonstrates the use of the Spool_Unit in the construction
71. epeatedly execution overhead may be reduced by using the R compile option or the MEMLOCK intrinsic see the Programmer s Manual to make the Prog_Execute segment memory resident NOTE The P PP L and PL I O redirection options are executed by both the Prog Setup and the Prog Execute functions These functions set the prefix volume according to any P or PP options PP takes precedence over P and then process the rest of the execution option list Before the functions terminate the prefix volume is set according to any P option that may occur in the execution option list it is restored to its original value of no P option exists The L and PL options are processed after the prefix options and follow the same rules The additional variable space required to implement the O PO I PI TO PTO Tl and PTI options is not allocated until the Prog_Execute function is called See the System User s Manual for further details WARNING Program descriptors referencing a deallocated heap space must not be used Fatal system crashes may result 2 0 0 1 Program Termination Abnormal program termination occurs as the result of an execution error Execution errors are normally detected by either the operating system or the processor The Prog Exception and Prog IO Set procedures are used to flag execution errors in user defined circumstances The Prog Exception procedure accepts an integer value as a parame ter It uses t
72. f the system volume is returned in the string parameter 2 2320 4 Prefixed Volume Name The SI Get Pref Vol and SI Set Pref Vo procedures access and modify the system s prefixed volume name The prefixed volume name is normally set with either the filer s P refix command or the P redirection option The default value for the prefixed volume name is the System volume name SI Get Pref Vol accepts a string variable aS a parameter the prefixed volume name is returned in the string parameter SI Set Pref Vol accepts a string expression as a parameter the system s prefixed volume name is set to the string parameter value 2 3 0 5 System Date The SI Get Date and SI Set Date procedures access and modify the system date The date record is declared in the interface section as follows Type SI Date Rec Packed Record Month 0 12 Day s 0 31 Year 0 99 End SI Date Rec SI Get Date accepts a date record variable as a parameter the System date is returned in the record parameter SI Set Date accepts a date record variable as a parameter the system date is set to the value passed in the record parameter Page 23 Library User s Manual This section displays the text of the interface section belonging to the system information unit The interface section text may also be viewed with the Libmap utility see the System User s Manual for details Note that all identifiers begin with SI to prevent conflicts with host pr
73. f there is a valid integer in the string the value of the function is the index in the String after the last character in the integer format otherwise the function value is Index Procedure N_Int_To_Str I Integer Var S String Converts the integer I to a string S Function N Min X Y Integer Integer Returns the smaller of the two integers X and Y Function N Max X Y Integer Integer Returns the larger of the two integers X and Y Function N Leq U X Y Integer Boolean Returns TRUE if unsigned integer X lt unsigned integer Y Function N Geq U X Y Integer Boolean Returns TRUE if unsigned integer X gt unsigned integer Y Function N Min U X Y Integer Integer Returns the smaller of the two unsigned integers X and Y Function N_Max_U X Y Integer Integer Returns the larger of the two unsigned integers X and Y Procedure N Uns To Str I Integer Var S String Converts the unsigned integer I to a string S Page 52 Data Manipulation The following program demonstrates the capabilities of the integer conversion unit Program Num_Demo Uses Num_Con This program accepts a string containing integers parses them finds the minimum and maximum values and prints the numbers separated by s Var Convert_Num In_String Out_String String Index Largest Next Index Number Smallest Integer Begin Writeln Write Type your inte
74. ffer overflow 16 Write Protect attempted write to protected disk 17 Illegal block number 18 Illegal buffer address Page 119 Library User s Manual Page 120 Appendices APPENDIX B STANDARD EXECUTION ERRORS 10 CO J OY Mia 0 MN HH No error Invalid index value out of range No segment bad code file Exit from uncalled procedure Stack overflow Integer overflow Divide by zero Invalid memory reference bus timed out User Break System I O error User I O error Unimplemented instruction Floating Point math error String too long Illegal heap operation Page 121 Library User s Manual Page 122 APPENDIX C ASCII CHARACTER SET HA E a A ps U 4 WN I2 O iO co 1 OY Ui CO FO I2 OD NO P p EH O 0 0 10 MN N N WN e NO N N ny PO Co YOU WW N I2 WO 000 001 002 003 004 005 006 007 010 011 012 013 014 015 016 017 020 021 022 023 024 025 026 027 030 031 032 033 034 035 036 307 00 01 02 03 04 05 06 07 08 09 0A 0B OC OD OE OF 10 11 12 13 14 15 16 17 18 19 1A 1B lC 1D lE 1F NUL SOH STX ETX EOT ENQ ACK Appendices 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 22 23 54 55 56 57 28 59 60 61 62 63 040 040 042 043 044 045 046 047 050 051 052 053 054 055 056 057 060 061 062 063 064 064 066 067 070 071 072 073 074 075 076 077 20 21 22 23 24 25 26 27
75. formation on block files Resident Volume Name The name of the volume containing the external file and whether or not the volume is a disk volume Resident Disk Unit The number of the unit containing the external file Title The file title of the external file Date The date assigned to the external file Starting Block The absolute block number of the first block in the external file Length The number of blocks of data in the external file Section 5 1 0 describes the File Info routines Chapter 5 1 1 displays the text comprising the file information unit s interface section Chapter 5 1 2 contains a programming example NOTE File Info only accepts block files as arguments other file types are not accepted See the Programmer s Manual for a description of block files and the System User s Manual for a description of the file system This section uses the term title to specify the file title and suffix combined this differs from the terminology used in the System User s Manual Page 109 Library User s Manual This section describes how to use the file information unit See section 5 1 1 for type and routine declarations and section 5 1 2 for a programming example The file information unit is available as an option with the AOS It is imported into a program by the USES File_Info statement see the Programmer s Manual for details It may reside in the intrinsics library the system library or a user l
76. g charac ters as special characters question mark equals sign z curly brackets and j comma en tilde backslash Special characters may only be used as parts of wildcards however a literal occurrence of a special character can be represented by a two character sequence consisting of a backslash followed by the Special character A backslash indicates that the following character is to appear literally in the character string for instance xx yy is treated as the literal character string xx yy rather than a wildcard string Page 60 Data Manipulation NOTE Literal occurrences of backslashes i e are specified by pairs of backslashes i e Examples of backslash in wildcards ab def matches ab def ab a z de f matches ab de f abN def matches ab def 4 2 0 Question Mark Wildcard A question mark matches any single character Examples of wildcard Pattern ab def Matches abbdef abrdef Nonmatches abdef abjkdef abef An equals sign matches any sequence of characters including the empty sequence Examples of wildcard Pattern ab def Matches abcdefg abdef abcccdef Nonmatches abcef 4 2 0 3 Subrange Wildcard The subrange wildcard matches a Single character from the character set specified in the subrange The following special characters are used to construct subrange wildcards
77. g real into a numerical real may cause an execution error if the value of the numerical real exceeds the range of real variables The R Min and R Max functions accept two real parameters and return a real result R_Min returns the lesser of the two parameters R Max returns the greater of the two parameters Page 57 Library User s Manual This section displays the text of the interface section belonging to the real conversion unit The interface section text may also be viewed with the Libmap utility see the System User s Manual for details Note that all identifiers begin with R Unit Real Con Interface Function R Str To Real Str String Index Integer Var Num Real Integer Converts the string Str to a real Num starting at the S Index If there is a valid real in the string the value of the function is the index in the string after the last character in the real format otherwise the function value is Index Procedure R_Real_To_Str R Real D P Integer Var Return String Converts the real number R to a string Return with P significant digits If D lt 1 the floating point format is used If D gt 0 the fixed point format is used and D is the number of decimal digits Function R Min X Y Real Real Returns the smaller of the two reals X and Y Function R Max X Y Real Real Returns the larger of the two reals X and Y Page 58 Data Manipulation 4 1 3 Prog
78. gers separated by lt blank gt s Readln In String Largest Maxint Smallest Maxint Out String Index lt 1 Next_Index N_Str_To_Int In_String Index Number While Next_Index lt gt Index Do Begin l N Int To Str Number Convert Num Out String Concat Out String Convert Num Largest N Max Largest Number Smallest N Min Smallest Number Index Next Index Next Index N Str To Int In String Index Number End of If If Next_Index lt gt 1 Then Begin 7 Delete Out String Length Out String 1 2 Writeln Reconstructed numbers Out String Writeln Largest signed number was Largest Smallest signed number was Smallest End of If Else Writeln No valid integers were found End of Num Demo Page 53 Library User s Manual 4 1 The Real Conversion Unit The real conversion unit named Real Con contains routines capable of translating reals between numerical and character string repre Sentations Commonly used numerical functions are also provided The real conversion unit provides the following capabilities String to real and real to string conversion Real min and max functions Section 4 1 0 presents concepts needed for using the real conver sion unit Section 4 1 1 provides a detailed description of each function Section 4 1 2 displays the text comprising the real conversion unit s interface section Section 4 1 3 contains
79. he integer parameter as the execution error number in a call to the system exception handler The system then behaves as if an execution error of that type had occurred The Prog IO Set procedure accepts an integer value as a parameter It sets the value of the IORESULT function see the Programmer s Manual to the value of the integer parameter An I O execution error is programmed by calling the Prog IO Set procedure immediate ly before a Prog Exception 10 I O error call The program termination routines may be used i n conjunction with modifications to the exception information unit section 2 1 to define and implement user defined execution and I O errors Page 9 Library User s Manual 2 0 0 2 1 0 Redirection The Prog Redir function indicates whether I O redirection options are in effect for either the OUTPUT or INPUT files The function accepts a boolean parameter whose value is TRUE for information on output redirection and FALSE for information on input redirection The value of the function is returned TRUE if I O redirection is in effect for the specified channel otherwise the function value is returned FALSE This routine is useful in implementing the system GOTOXY intrinsic see the System User s Manual Normally a cursor positioning Sequence is written to the system console through the FASTCON device unit 21 If Prog Redir TRUE reveals that console output has been redirected the cursor positioning sequence
80. he right hand side The vertical bar I separates possible choices for substitution the example above indicates that trout salmon or tuna may be substituted for fish An item enclosed in square brackets may be optionally substituted into a textual expression for instance microlcomputer repre sents the text strings computer and microcomputer An item enclosed in curly brackets may be substituted zero or more times into a textual expression The following expression repre Sents responses to jokes possessing varying degrees of humor joke response ha In many instances the notation described above is used informally to describe the form required by a language construct Here are Some typical examples Start lt process statement lt pid gt lt stacksize gt lt priority gt Concat lt string gt lt string gt The syntax for Pascal s If statement is If lt Boolean expression gt Then lt statement gt Else lt statement gt Pascal reserved words and identifiers are printed beginning with Capital Letters while standard terms are underlined The following terms are used in the description of the UCSD Pascal System intrinsics library system library user library system support library and drivers library These refer to the library system described in the System User s Manual Page 3 Library User s Manual Page 4 System Functions il SYSTEM FUNCTIONS This chapter describes
81. he specified file name conflicts with an existing file In no cases can an error cause abnormal termination of a function errors which cannot be identified explicitly by the routine are flagged by returning a result indicating that an unknown error has occurred Dir Info defines a scalar type to describe the possible errors encountered Type D_Result D_Okay D Not Found D Exists D Name Error D_Off_ Line D Other Details on error results and the status of the returned directory information in the presence of an error can be found in section Sedai Page 73 Library User s Manual This section provides a functional overview of the directory information unit s capabilities See section 5 0 2 for programming examples and detailed descriptions of Dir_Info routines The directory information unit is available as an option with the AOS It is imported into a program with the USES Pattern_Match Dir_Info statement see the Programmer s Manual for details The directory information unit may be installed in the intrinsics library the system library or the uSer library All identifiers imported from Dir Info begin with D to prevent conflicts with program identifiers Identifiers imported from Pattern Match begin with P The directory information unit maintains 3 words of global varia bles It also uses the pattern matching unit Pattern Match described in section 4 2 in its interface section NOTE The directory
82. her than the one for which it is Sold See the Hardvare User s Manual for further details 2 4 9 1 Time Delays The SU_Delay procedure accepts an integer parameter specifying the number of 60ths of a second to delay further execution of the Current task The delay count may range between 1 and 32767 other values cause a delay of 1 60th of a second Any number of tasks may be delayed at any time Page 27 Library User s Manual NOTE If the system clock driver is not installed use of the SU_Delay procedure causes no delay and sets the value of the IORESULT intrinsic described in the Programmer s Manual to 2 otherwise the IORESULT is set to 0 2 4 0 2 Maximum I O Unit Number The SU Hax Unit function returns the physical unit number of the highest numbered system I O device in the current system I O configuration Page 28 System Functions 2 4 1 The System Utility Unit Interface This section displays the text of the interface section belonging to the system utility unit The interface section text may also be viewed with the Libmap utility see the System User s Manual for details Note that all identifiers begin with SU_ to prevent conflicts with host program identifiers Unit Sys_Util Interface Function SU Ser Num Integer Returns system serial number Procedure SU Delay Delay Count Integer Delays current task for Delay Count 60ths of a sec Procedure SU Max Unit Integer Returns the highe
83. his section displays the text of the interface section belonging to the directory information unit The interface section text may also be viewed with the Libmap utility see the System User s Manual for details Note that all identifiers begin with D The P Pat Rec P identifier is declared in the Pattern Match unit it is a pointer to a list of pattern information records Unit Dir Info Interface Uses Pattern Match Type D Date Rec Packed Record Month 0 12 Day Us Year 0 100 End D Name Type D Vol D Code D Text D Data D Temp D Free D Choice Set of D Name Type D List P D List D List Record D Unit Integer D Volume String 7 D VPat P Pat Rec P D Next Entry D List P Case D Is Blkd Boolean Of True D Start D Length Integer Case D Kind D Name Type Of D Vol D Temp D Code D Text D Data D Title Stringl15 D FPat P Pat Rec P D Date D Date Rec Case D Name Type of D Vol D Num Files Integer D Temp D Code D Test D Data D End Integer End D Result D Okay D Not Found D Exists D Name Error D Off Line D Other Page 107 Library User s Manual Function D_Dir_List D_Name String D Select D Choice Var D Ptr D List P D PInfo Boolean D Result Creates a pointer to a list of names of specified NameTypes D Select matching specified D Name wildcard characters allowed Includes information about patter
84. ibrary All imported identifiers begin with F_ to prevent conflicts with program identifiers The file information unit uses no global variables and no other units All File_Info routines return a value reflecting the result of the operation The result indicates either that the operation was successful or that the specified file is not open File_Info defines a scalar type to describe the file status result Type F Result F_Okay F_Not_Open NOTE When al File_Info routine returns a file status result indicating a closed file the other information returned is not valid 2al 0 0 Resident Volume The F Volume and F_Is_Blocked routines return information describ ing the name and type respectively of the volume containing the external file F Volume accepts a block file and a string variable as parameters and returns a file status result The volume name of the external file is returned in the string parameter If the external file lacks a defined volume name FP Volume returns a volume id con structed from a unit number e g 3 F Is Blocked accepts a block file and a boolean variable as parameters and returns a file status result The boolean parame ter is set to TRUE if the volume containing the external file is a block structured i e disk volume otherwise it is set to FALSE 22 1 0 1 Resident Unit F_Unit accepts a block file and an integer variable as parameters and returns a file status result Th
85. ided into a group of logically independent screens known as text ports Text ports are functionally equivalent to entire terminal screens with respect to screen control operations SC Cntrl provides a routine for displaying user defined prompt lines on text ports Long prompt lines may be automatically divided into a number of sections similar to UCSD Pascal system prompts Mt SC Cntrl routines are designed to support multitasking and multiterminal environments Text ports and keyboards can be treated as critical resources to protect them from task contention Section 3 0 0 describes the f1 utal concepts used in the screen control unit Section 3 0 1 describes how to use the screen control facilities Section 3 0 2 presents the unit s interface declarations Section 3 0 3 gives programming examples demonstrat ing the use of the screen control unit Page 31 Library User s Manual 3 0 0 Terminals A terminal is a serial I O device It is accessed through two serial files the input file and the output file The output file is known as the terminal Screen the input file is known as the keyboard The input file is assumed to be non echoing Here are some examples of terminals System Console SYSTERM CONSOLE Standard I O STANIN STANOUT Remote Console REMIN REMOUT A terminal is characterized by its MISCINFO file and its terminal type The MISCINFO file is created by the SETUP utility see the System User s Manual f
86. ile Writeln Types I y n 1 GiveChoice Directories D Voll GiveChoice Temp Files D Templ GiveChoice Text Files D Text GiveChoice Code Files D Codel GiveChoice Data Files D Datal Result D RemFiles Rem File Select Case Result Of D Okay Writeln files removed D Name Error Writeln error in file name D Off Line Writeln volume off line D Not Found Writeln file not found D Other Writeln miscellaneous error End cases Writeln Write Continue Read Ch Writeln Until Ch In n N 1 End Rem Test Page 100 File System Manipulation syntax String Integer D_Result Function D_Change_End D_File_Name D New End D Change End searches for a file designated by the file name contained in D_File_Name and changes the number of valid data bytes in its last block to the value contained in New_End D_Change_End only operates on disk files changing only one at a time Thus it does not accept file names containing wildcards however it may be combined with other Dir_Info routines to create user defined file name changing routines which accept wildcards see section 5 0 2 2 2 for an example D Change End accepts the following parameters D File Name A string containing the name of the disk file to be changed If the file name is either invalid or empty D Change End returns D Name Error Note that wildcard characters are in terpreted l
87. ion on D Change Name NOTE D Change Name does not recognize wildcards in its file name arguments wildcard characters are treated literally The D Change Date function changes the file date for all files and or volumes whose names match the file name argument The function result is used to flag invalid file name arguments off line volumes or not found files See section 5 0 2 3 for more information on D Change Date The D Change End function accepts two parameters the name of an existing file and a new file end The existing file is searched for in the specified disk directory if found the current file end is changed to the specified file end The function result is used to flag invalid file names not found files or the success of the end change D Change End is documented further in section 5 0 2 5 NOTE D Change End does not recognize wildcards in its file name arguments wildcard characters are treated literally It operates on disk files exclusively The D Rem Files function removes files or volumes whose file names match the specified file name argument A removed disk file is permanently deleted from the directory A removed volume is taken Page 75 Library User s Manual off line so that it no longer appears in the volume table as displayed in the filer s V olume command disk volumes come back on line when they are referenced but serial volumes are inaccessi ble until the system is reinitialized The functi
88. iterally D New End An integer containing the number of valid bytes in the last record of the file designated by D File Name Change End returns D Other if this value is not between 1 and 512 D Change End returns a value of type D Result D Change End can return only some of the scalar values defined in D Result these values have the following meanings D Okay No error D Old Name was found and its name changed D Not Found No such file volume found No match found for D Old Name No change made D Name Error Illegal file name syntax in D Old Name or D New Name io change made D Off Line Volume unit off line Volume unit specified by D Old Name was not on line No change made D Other Invalid range or Unknown Either D New End was not in the range 1 512 or the error could not be identified No change made Page 101 Library User s Manual 220 2 5 1 Programming Example The following program demonstrates the use of D_Change_End Program End_Test Uses Pattern Match Dir Info Var New End Integer Name String Ch Char Begin Writeln D Change End Test Repeat Writeln Write Name to change Readln Name Write New end of file Readln New End Case D_ChangeEnd Name New End Of D Okay Writeln No error D Off Line Writeln Volume off line D Name Error Writeln Error in file name D Not Found Writeln File not found D Other Writeln Bad en
89. library or a user library The routines provided by this unit are described below The command I O unit maintains no global variables and uses no other units m TED n The command I O unit provides two routines used for program Chaining Program chaining occurs when the system automatically executes a sequence of programs in succession The Chain and Chain_Expedite procedures are used to specify the program sequence which is maintained in the chain queue Both procedures accept a string value parameter con li Execution option List It may contain either the name of a code file containing a program a list of I O redirection options or both The execution option list is formatted and interpreted in the same way as an input to the system X ecute command see the System User s Manual Examples of execution option lists are Backup Format I 4 ssyy System Compiler I Test O Bucket Prose I File Names Text 82 05 22 O List Text TO 1 The Chain procedure places an execution option list at the end of the chain queue The Chain_Expedite procedure places an execution option list at the beginning of the chain queue A call to either the Chain or the Chain_Expedite procedure with an empty execution option list clears the chain queue Page 18 System Functions The execution option list at the beginning of the chain queue is processed after the termination of the currently executing program It is processed without redi
90. lid only for objects of type D_Vol it contains the number of files in the volume s directory D_End is valid only for objects of type D_Temp D_Text D_Code and D_Data It is the number of valid data bytes in the last record of the file Page 82 File System Manipulation File information is returned in a linked list accessed by D_Ptr starting with information on the lowest numbered I O unit whose volume name matches D Name If D Vol is in D Select a volume entry is emitted File entries and unused entries specified in D Select are emitted in block number order This pattern is repeated for each I O unit in ascending unit number order 5 0 2 1 0 3 D PInfo When set to TRUE the D PInfo parameter indicates that pattern matching information should be returned in a linked list accessed by D Ptr This information is collected by the P Match function of the Pattern Match unit in the process of comparing volume and file id s and is useful for determining how the wildcards in D Name were expanded Information is returned in two pointers one for volume names matched named D VPat and one for file id s matched named D FPat Example of pattern record lists D Name is set to TEST 1 9 Two volumes contain files which match D Name BOOT contains TEST5 CODE WORK contains TEST5 TEXT For BOOT TEST5 CODE D Volume is BOOT D Title is TEST5 CODE and D VPat returns a pointer to the following information l Wild Pos is
91. me id or if the volume id is D Volume is assigned the system s prefix volume name If the volume id is or D Volume is as signed the system s boot volume name Volume names as signed to D Volume may contain only upper case characters and no blank characters D Title A string which returns the file title contained in D Name If D Name does not contain a file title D Title is assigned the empty string File titles assigned to D Title contain only upper case characters and do not contain blank characters D Type A scalar which returns a value indicating the file type of the file name contained in D Name Definition of D Type s scalar type D NameType D Vol D Code D Text D Data D Temp D Free Page 77 Library User s Manual D Type is set to D Vol if the file title in D Name is empty D_Tvpe is set to D Code if the file title is terminated by CODE or to D Text if the file title is terminated by TEXT or BACK If none of the above holds true D Type is set to D_Data See section 5 0 0 3 for more information on file types D Segs An integer which is assigned a value indicating the presence of a file length specifier in D Name The value returned in D Segs is as signed as follows Length Specifier D Segs Value lt number gt lt number gt lt not present gt 0 D Scan Title returns a function result of type D Result see section 5 0 0 6 for more information The only scalar value
92. n matching if requested by D_PInfo Function D_Scan_Title D_Name String Var D VolID D TitleID String Var D Type D Name Type Var D Segs Integer D Result Parses the file name in D Name into volume title type and length specifier Function D Change Name D Old Name D New Name String D Rem Old Boolean D Result Changes file name in D Old Name to name in D New Name removing already existing files of name in D New Name if D Rem Old is set Function D Change Date D Name String D NewDate D Date Rec D Select D Choice D Result Changes date of directory or file name in D Name to date specified by D NewDate D Name may contain wildcards Function D Rem Piles D Name String D Select D Choice D Result Removes file of specified name wildcards allowed Function D Change End D FPile Name String D New End Integer D Result Changes the number of valid data bytes in the last block of the file name in D File Name to the value of D New End Procedure D Init Initializes Dir Info unit Procedure D Lock Procedure D Release Provide means to limit use of DirInfo routines to one task at a time in multitasking environments Page 108 File System Manipulation This file information unit named File Info allows user programs to obtain block file attributes normally accessible only to system programs The file information unit provides the following in
93. nge Readln Old Write New name Readln New Write Remove existing files of that name y n Read Ch Writeln Rem Old Ch In y Y 1 Case D ChangeName Old New Rem Old Of D Okay Writeln No error D Off Line Writeln Volume off line D Name Error Writeln Error in file name D Not Found Writeln File not found D Other Writeln Miscellaneous error End cases Writeln Write Continue Read Ch Writeln Until Ch In n N End Change Test 5 0 2 2 2 Wildcard File Name Replacement D Change Name does not accept wildcard file name arguments howev er it may be combined with the pattern matching information returned by D Dir List to implement a wildcard file name changing routine Note that this routine must use directory locks in multitasking environments For example assume that the user has the following files TESTl TEXT TEST12 CODE TEST DATA eee and would like to change them to OLD1A TEXT OLD12A CODE OLDA DATA This can be performed by using D Dir List to search for the file Page 90 File System Manipulation name TEST The pattern matching information returned by D Dir List can be used to create new file titles in this case TEST is replaced with Old and the first is replaced with the concatenation of the pattern matched by the and the literal string A The part of each file title matched by the peri
94. nit interface section A programming example using the Prog Ops unit appears in section 2 0 2 NOTE Use of the Prog_Ops unit requires familiarity with the system I O redirection facilities See the System User s Manual and the Programmer s Manual for details EE P mn 3 The program operators unit is provided with all AOS releases It is imported into a program by the USES Prog Ops statement see the Programmer s Manual for details Prog Ops must be installed in the intrinsics library All imported identifiers begin with Prog to prevent conflicts with program identifiers The rou tines provided by this unit are described below The program operators unit maintains no global variables and uses no other units mE Ea The program operators unit contains four routines used for program invocation The Prog_Call routine may be called to setup and execute a given program The Prog_Setup routine prepares a program for subsequent execution The Prog Start and Prog Execute routines execute a program that has already been prepared by the Prog Setup routine These routines may be called from anywhere within a user program Programs invoked by calls to the program operators execute as if they were procedures of the calling program NOTE Code segments and global data spaces for units used by programs are not shared among nested program invocations unless the units are installed in the intrinsics library Page 6 System Functio
95. ns WARNING The program invocation routines are not designed for use in tasks or in multitasking programs These routines may not be used to implement a multiuser or multiprogramming system 2 0 0 0 0 Program Specifiers When calling the Prog Call or Prog Setup routines a program is specified by an execution option list It may contain either the name of a code file containing a program a list of I O redirection options or both The execution option list is formatted and interpreted in the same way as an input to the system exX ecute command see the System User s Manual Examples of execution option lists include Backup Format I 4 ssyy System Compiler I Test O Bucket Prose IsFile Names Text 82 05 22 O List Text TO 1 When calling the Prog_Start and Prog_Execute routines a program is specified by a program descriptor record This record is initial ized by the Prog_Setup routine and contains all information necesSary to process an execution option list passed to Prog_Setup The declaration for a program descriptor is presented below Prog Rec Record Heap Base Integer User_Vect Integer Unit List Integer Redir_Rec Prog Red Rec End of Prog Rec A program descriptor refers to an area on the system heap containing the structures necessary to execute a program A pointer to the base of these structures is contained in Heap_Base The User Vect and Unit List fields point to the program r
96. od and the second wildcard is unchanged D Change Name is called with the modified file title for each file matched by D Dir List The following program demonstrates the use of D Change Name and D Dir List in the construction of a specialized file name changing utility The program accepts a file name argument containing two z wildcards for each file which matches the argument the file title is changed by swapping the string patterns matched by the two z wildcards Program Wild Change Uses Pattern Match Dir Info Var Heap Ptr Integer Typ D Name Type Segs Integer Select D Choice Volume Name Match String Result D Result Ch 2 Char Ptr D List P Procedure GiveChoice Choice String Kind D Choice Var Ch Char Begin Write Choice Read Ch Writeln If Ch In y Y Then Select Select Kind End GiveChoice Procedure Print Patterns Pat Ptr D Pat Rec P es oo Comp Wild String Var Count Integer Begin Count 1 Writeln type cr for patterns Readln Writeln Repeat Writeln Pattern Count With Pat Ptr Do Begin Writeln Comp Comp If Comp Len lt gt 0 Then Write Comp Pos 9 If Comp Len gt 1 Tr zice s Comp Len 1 Writeln Writeln Wild Wild Write Wild Pos 9 If Wild Len gt 1 Then wWrite Wild Len 1 Writeln Writeln End Page 91 Library User s Manual Pat Ptr Pat P
97. ods of time NOTE When the print spooler is installed in the intrinsics library the spooler task 1S initiated at system bootstrap time and terminated at system halt time Programs that use the print spooler under these conditions may terminate and other programs may execute without waiting for the print spooler to process all Page 115 Library User s Manual print requests 6 0 0 0 Print Spooler Status Results Some Spool_Unit routines return a value reflecting the result of the operation The result indicates either the status of the print spooler or whether the operation was successful Spool_Unit defines a scalar type to describe the spooler status result Sp_Result Sp_Go Sp_Stop Sp_Queued Sp Full Sp Not Found The meanings of these scalars are described along with the routines that return them The Spool File function submits a print request and returns a result indicating the disposition of the request Spool File accepts four parameters the name of the text file to list the printer paper page size the size of the print area on each page and the I O unit number of the print device If the specified text file cannot be opened the function returns the value Sp Not Found Otherwise an attempt is made to queue the print request for processing If the print request queue is full 10 entries are allowed the print request is denied 3 ooi File returns the value Sp Full If the print request is accepted the
98. ogram identifiers Unit Sys_Info Interface Type SI_Date_Rec Packed Record Day 0 31 Year 0 99 End SI_Date_Rec Procedure SI_Code_Vid Var SI_Vol String Returns name of volume holding current workfile code Procedure SI Code Tid Var SI Title String Returns title of current workfile code Procedure SI Text Vid Var SI Vol String Returns name of volume holding current workfile text Procedure SI Text Tid Var SI Title String Returns title of current workfile text Function SI Sys Unit Integer Returns number of boot unit Procedure SI Get Sys Vol Var SI Vol String Returns system volume name Procedure SI Get Pref Vol Var SI Vol String Returns prefix volume name Procedure SI Set Pref Vol SI Vol String Sets prefix volume name Procedure SI Get Date Var SI_Date SI Date Rec Returns current system date Procedure SI Set Date Var SI Date SI Date Rec Sets current system date Page 24 System Functions 22322 Programming Example The following information un Program S program demonstrates the capabilities of the system lt ys Test Uses Sys Info Var Ch Date Vol Title Begin SI Code SI Code If Leng Write Else Write SI Text SI Text If Leng Write Else Write Writeln Char SI Date Rec String Vid Vol Tid Title th Title lt gt 0 Then ln The Work Codefile is
99. on of the operation Da0 22 3 Programming Example The following program demonstrates the use of D_Change_Date Program Date_ Test Uses Pattern_Match Dir_Info Var Result D Result Ch Char M D Y Integer New Date D_Date_Rec Select D Choice File Name String Procedure GiveChoice Choice String Kind D Choice Var Ch Char Begin Write Choice Read Ch Writeln If Ch In y Y Then Select Select Kind End GiveChoice Page 96 File System Manipulation Begin Date_Test Select Writeln D_ChangeDate Test Repeat Writeln Write File to change Readln File Name Writeln Types y n 1 GiveChoice Directories D Voll GiveChoice Text Files D Text GiveChoice Code Files D_Code GiveChoice Data Files D Datal Writeln New date Write Month 1 12 Write Day 1 31 Write Year 0 99 With New_Date Do Begin Month M Day D Year Y End With New Date Writeln Result D ChangeDate File Name New Date Select Case Result Of D Okay Writeln date changed D Name Error Writeln error in file name D Off Line Writeln volume off line D Not Found Writeln file not found D Other Writeln miscellaneous error End cases Writeln Write Continue Read Ch Writeln Until Ch In n N 1 End Date Test Readln M Readln D Readln Y ee 0 co
100. on result is used to flag invalid file name arguments not found files or off line volumes See section 5 0 2 4 for more information on D Rem Files Dir Info provides three routines for protecting directory informa tion from task contention D Init D Lock and D Release These routines ensure that directory information is properly treated as a shared resource in multitasking environments D Init initializes the synchronization mechanism used to protect the directory D Lock grants exclusive directory access to the task that executes it however a task may be suspended until another task releases the directory lock before it can continue execution past its call to D Lock D Release releases directory access to whatever task that may desire it Tasks already waiting for directory access are automa tically awakened when the directory becomes available by a call to D Release NOTE It is the programmer s responsibility to ensure protection of the directory in multitasking environments Each task must call D Lock before accessing the directory and then call D Release when it is finished accessing the directory NOTE All Dir Info routines and file system intrinsics e g RESET contain internal locks to ensure their own mutually exclu Sive access to directory information Calls to D Lock and D Re lease are necessary only when executing a series of Dir Info routines which must not be interrupted by other tasks Note that task
101. or details it describes the fixed functions of the terminal hardware The file contains a description of the command sequences necessary to perform various terminal functions e g home clear screen It also contains a description of the key Seguences emitted by certain keys on the terminal keyboard e g cursor up cursor down Note that some terminals may not provide command sequences for all the terminal functions defined in the MISCINFO file The terminal type indicates the command sequence necessary to position the screen cursor at given screen coordinates this is called random cursor addressing A screen has a height in lines and a width in columns The column number is called the X coordinate and the line number is called the Y coordinate A screen position is specified by the coordinate Ix yl i e lt column gt lt line gt Note that all coordinates and dimensions are zero based thus a screen containing 24 lines and 80 columns is said to have a height of 23 and a width of 79 Its upper left corner is 0 0 and its lower right corner is 79 23 3 0 0 0 Text Ports All screen control operations are performed on text ports A text port is a rectangular subset of a screen and is defined by three attributes The terminal on which it appears The screen coordinates of its upper left corner The dimensions of the text port Text ports simulate terminal screens The upper left corner of a text port is ad
102. pported operations where possible The function accepts a text port record and the desired operation identified by a scalar of type SC_Scrn_Command as parameters The function returns TRUE if the terminal supports the desired command otherwise it returns FALSE The SC_Has_Key function is provided to allow a program to determine whether the keyboard is capable of generating a certain key sequence The function accepts a text port record and the desired key sequence identified by a scalar of type SC Key Command as parameters The function returns TRUE if the keyboard can generate the desired sequence otherwise it returns FALSE n IR ME The SC Out Lock and SC Out Release SC In Lock and 3SC In Release procedures are used in multitasking environments to protect text ports from contention between tasks These procedures accept a text port record as a parameter The SC Out Lock procedure guarantees that only one task can write to the terminal screen associated with the specified text port If another task has locked the screen the calling task must wait until the other task releases the terminal The SC_Out_Release procedure releases a terminal screen so that tasks waiting for access to the screen can proceed The SC In Lock and SC In Release procedures provide analagous functions for the terminal keyboard Note that when more than one task accesses text ports on a single terminal all tasks must use these procedures to guarantee m
103. r gt NOTE Volume names and file titles may contain wildcards Unit numbers and colons separating volume id s and file id s must appear literally they must be independent of any wildcard NOTE All Dir Info routines except D Scan Title ignore file length specifiers NOTE File name conventions in Dir Info differ slightly from UCSD Pascal file name conventions in cases where the UCSD conventions are inconsistent Dir Info considers an empty file name argument to specify the prefix volume i e file id gt is empty implying a volume reference and volume id is empty implying the prefixed volume An empty string is not a valid file name in UCSD Pascal Dir Info interprets wildcard file names of the form lt vol name z to be valid volume specifiers This is consistent with Dir_Info s definition of the wildcard but inconsis tent with the UCSD Filer s interpretation of the wildcard the Filer does not accept file names of this form as volume specifiers 5 0 0 3 File Type Selection Some Dir_Info routines accept a file type parameter named D_Se lect which is used to specify the file objects to be accessed File objects include volumes unused areas on disk volumes temporary files text files code files and data files The file type parameter is necessary because file names are not sufficient to completely specify all types of file objects e g unused disk Page 71 Library U
104. r occurs only when the volume id in D Name does not contain wildcards i e a single volume is specified and it is off line If the volume name in D Name contains wildcards but does not match any on line volumes D Dir List returns D Not Found D Ptr is set to NIL D Other Unknown error D Dir List encountered an error it could not identify but which interrupted normal execution of the function D Ptr is set to NIL Page 84 File System Manipulation 3 0 241 1 Programming Example The following program is a general purpose directory lister it accepts a string containing wildcards and creates a list of matching files and if requested pattern matching information for the files Note that the program uses the MARK and RELEASE intrinsics to remove D Dir List information from the heap after the information has been used Program D Test Uses Pattern Match Dirinfo Var Select D Choice Want Patterns Boolean Heap Ptr Integer segs Integer Typ D Name Type Volume Title Match String Result D Result Ch Char Ptr D List P Procedure GiveChoice Choice String Kind D Choice Var Ch Char Begin Write Choice Read Ch Writeln If Ch In y Y Then Select Select Kind End GiveChoice Procedure Print Patterns Pat Ptr D Pat Rec P Comp Wild String Var Count Integer Begin Count 1 Writeln type cr for patterns Readln Writeln Repea
105. r_Info routines Section 5 0 2 describes the routines in detail and provides programming examples Section 5 0 3 displays the text comprising the directory information unit s interface section This section describes the concepts and features needed to use the directory information unit 5 0 0 1 Wildcards Most Dir_Info routines allow wildcards in their file name argu ments Wildcards are character sequences which are treated speci ally when encountered in a character string they are named wildcards because of their ability to match whole classes of character sequences rather than a single character sequence The wildcard convention observed by the Dir Info routines is described in the documentation for the pattern matching unit section 4 2 NOTE The D Change Name D Change End and D Scan Title routines do not recognize wildcards in their file name arguments wildcard Page 70 File System Manipulation characters are treated literally 229 0 2 File Name Arguments Most Dir_Info routines accept file name arguments The file name specifies the volume and or file to be accessed by the routine See the System User s Manual for a complete description of UCSD Pascal files and file names File name syntax lt file name gt TI volume id gt lt file id volume id 2 lt unit number volume name gt ob La lt file id gt lt title gt lt suffix gt lt specifier gt lt specifier gt lt numbe
106. ramming Example The following program demonstrates the capabilities of the real conversion unit Program Real_Demo Uses Real_Con This program accepts a string containing reals parses them finds the minimum and maximum values and prints the numbers separated by s Var Convert Num In String Out String String 255 Index Next Index Integer Largest Number Smallest Real Begin Writeln Write Type your reals separated by lt blank gt s Readln In String Largest 1 0E38 Smallest 1 0E38 Out String Index 1 Next Index R Str To Real In String Index Number While Next Index lt gt Index Do Begin R Real To Str Number 0 6 Convert Num Out String Concat Out String Convert Num Largest R Max Largest Number Smallest R Min Smallest Number Index Next Index Next Index R Str To Real In String Index Number End of If If Next_Index lt gt 1 Then Begin Delete Out String Length Out String 1 2 Writeln Reconstructed numbers Out String Writeln Largest number was Largest Smallest number was Smallest End fof If Else Writeln No valid reals were found End of Real Demo Page 59 Library User s Manual 4 2 The Pattern Matching Unit The pattern matching unit named Pattern Match contains routines capable of comparing strings containing wildcards to strings containing text The wildcards
107. returned F Not Open and File Unit is undefined Function F_Volume Var Fid F_File_Type Var File Volume String F_Result Returns the name of the volume containing the file attached to the Fid identifier If there is no file opened to Fid the function result is returned F Not Open and File Volume is undefined Function F File Title Var Fid F File Type Var File Title String F Result Returns the title with suffix of the file attached to the Fid identifier If there is no file opened to Fid the function result is returned F Not Open and File Title is undefined Page 112 File System Manipulation Function F_Start Var Fid F File Type Var File Start Integer F Result Returns the length in blocks of the file attached to the Fid identifier If there is no file opened to Fid the function result is returned F Not Open and File Start is undefined Function F Is Blocked Var Fid F File Type Var F_Is_Blkd Boolean F Result Returns a boolean that is TRUE if the file attached to the Fid identifier is located on a block structured unit If there is no file opened to Fid the function result is returned FP Not Open Function F Date Var Fid F File Type Var File Date F Date Rec F Result Returns a record indicating the last access date for the file attached to the Fid identifier If there is no file opened to Fid the function result is returned FP Not Open Page 113 Libra
108. ructures are created on the top of the resulting heap This is useful in recyling the heap space occupied by the runtime structures of programs previously processed by Prog Setup Either the Prog Start function or the Prog Execute segment function may be used to execute a program already setup by the Prog Setup routine Both functions accept a program descriptor as a parame ter They execute the program associated with it The Prog Exe cute function processes any I O redirection options before program execution the Prog Start function does not The function result is returned containing the number of any execution error that terminates the program 0 is returned if no execution error is encountered The Prog Start function may be used when the Redir_Rec field of the program descriptor contains Nil The Prog_Execute segment function Page 8 System Functions should be used when this field is non Nil Using Prog Start whenever possible avoids the unnecessary allocation of memory space to code that processes I O redirection directives when no I O redirection options are specified The Prog Setup function may used in conjunction with Prog Start or Prog Execute to minimize the time required to repeatedly call a program Calling the Prog Call function for each execution results in significantly more setup overhead than calling Prog Setup once and calling Prog Execute or Prog Start for each execution In cases where the Prog Execute is called r
109. ry User s Manual 2 1 2 Programming Example The following program demonstrates the capabilities information unit SI Program File Demo Uses File Info Var Fid File Name Title Volume String Start Blocks Unit Num Integer Is Blocked Boolean Date F Date Rec Junk F Result Begin Write File Name Readln Name If Length Name 0 Then Exit File_Demo Reset Fid Name If F Volume Fid Volume FP Okay Then Begin Junk F Is Blocked Fid Is Blocked Junk F Unit Fid Unit Num Junk F Pile Title Fid Title Junk F Date Fid Date Junk F_Length Fid Blocks Junk F_Start Fid Start Writeln Write Volume Unit Unit Num If Is Blocked Then Begin Writeln blocked Writeln Title Blocks 7 of the Date Month 4 Date Day Date Year Start 6 End fof If Is_Blocked Else Writeln serial End of If F_Volume Else Writeln No such file End of File Demo Page 114 file I O Routines VI I O ROUTINES This chapter describes a unit which performs printer spooling 6 0 The Print Spooler Unit The print spooler unit named Spool Unit contains routines that list the contents of a specified text file on a specified serial output device The spooler queues print requests received while it is processing other print requests Queued requests are processed on a first come first served basis Printing is performed
110. s The character string integer corresponding to the value of the integer expression is returned in the string variable The N_Uns_To_Str procedure accepts an unsigned integer expression and a variable of type string as parameters The character string integer corresponding to the value of the unsigned integer expres sion is returned in the string variable The N Str To Int function accepts three parameters and returns an integer result The first parameter is a string variable contain ing a character string integer The second parameter is an integer expression specifying the starting position of the character string integer in the string parameter If N Str To Int finds a valid character string integer within the string parameter it returns the corresponding numerical integer in the third parameter which is an integer variable The function returns an index into the String parameter which points to the character immediately follow ing the character string integer If the string does not contain a valid character string integer the function returns the value of the second parameter The syntax for character string integers parsed by N Str To Int is a superset of the format described in section 4 0 0 leading blank characters are ignored Character string integers are defined to terminate either at the first nonconforming character or at the end of the string expression 4 0 1 1 Numerical Functions This section describes the misce
111. s returned by D_Scan_Title are D_Okay and D_Name Error they have the Following meanings D_Okay No Error All information returned by D_Scan_ Title is valid D Name Error Illegal file name syntax in D Name The infor mation returned by D Scan Title is invalid Page 78 File System Manipulation 29 2 0 Programming Example The following program demonstrates the use of D_Scan_Title Program Scan_Test Uses Pattern_Match Dir_Info Var Name Volume Title String Typ D Name Type Seg Flag Integer Result D Result Ch Char Begin Writeln D_ScanTitle Test Repeat Writeln Write File name to parse Readln Name Result D_ScanTitle Name Volume Title Typ Seg_Flag Writeln parsed Writeln Volume name Writeln File name Write File type Case Typ D_Text Writeln text file D_Code Writeln code file D_Data Writeln data file End Cases If Seg Flag lt gt 0 Then Writeln Segment flag Seg Flag Writeln Write Continue Read Ch Writeln Until Ch In n N End Scan Test Volume Title E e se se th Page 79 Library User s Manual 5 Q 2 D Di r I j st syntax Function D Dir List D Name String D Select D Choice Var D Ptr D List P D PInfo Boolean D Result D Dir List creates a list of records containing directory infor mation on volumes and disk files This information incl
112. s have the following form lt integer gt sign digit digit sign lt digit gt 0 5 Examples of character string integers 32768 1 l 0 16 4 0 0 0 Unsigned Integers Unsigned integers are defined to contain values in the range 0 65535 They are represented as 16 bit binary values and are Stored in variables of type integer They differ from signed integers only in use and interpretation They are identical in the Page 48 Data Manipulation range 0 32767 however unsigned values in the range 32768 65535 are treated by integer operations as signed values in the range 32767 1 Since the div mod gt gt lt and lt operators do not work correctly with large unsigned integers some useful unsigned integer functions are provided in the number conversion unit Page 49 Library User s Manual The integer conversion unit is available as an option with the AOS It is imported into a program by the USES Num Con statement see the Programmer s Manual for details The Num_Con unit may be installed in either the intrinsics library the system library or a user library All imported identifiers begin with N_ to prevent conflicts with program identifiers The integer conversion unit maintains no global variables and uses no other units 4 0 1 0 Integer Conversion The N_Int_To_Str procedure accepts a Signed integer expression and a variable of type string aS parameter
113. s must not call standard file system intrinsics after locking the directory only Dir Info routines can be used to access directories locked by D Lock NOTE Tasks which call Dir Info routines must contain sufficient Stack space to execute the routines without causing stack over flows Calls to D Scan Title consume approximately 800 words of Stack space Calls to D_Dir_List D Change Name D Change Date and D Rem Files consume approximately 2000 words of stack space Calls to D Init D Lock and D Release use negligible amounts of Stack space Page 76 File System Manipulation This section provides detailed descriptions of the Dir Info rou tines See section 5 0 1 for an overview of the routines Each sub section contains a programming example demonstrating the use of the routine Syntax Function D Scan Title D Name String Var D Volume D Title String Var D Type D NameType Var D Segs Integer D Result D Scan Title parses the UCSD Pascal file name passed in D Name and returns the file name s volume id file title file type and file length specifier The function result indicates the validity of the file name argument See section 5 0 0 2 for more information on file name arguments D Scan Title accepts the following parameters D Name A string containing a UCSD Pascal file name Wildcards are ignored D_Volume A string which returns the volume id contained in D_Name I D_Name contains no volu
114. s wildcard pattern matching inte ger and real format conversions and miscellaneous numeri cal operators Includes extended access to both external and internal files Routines are provided that read directories remove files and change file names dates and lengths I O Routines Includes an asynchronous printer spooler Chapter 2 describes the system functions including the Prog_Ops Excep Info Command IO Sys Info and Sys Util units Chapter 3 describes the screen formatting unit SC Cntrl Chapter 4 describ es the data manipulation units including the Pattern Match Num Con and Real Con units Chapter 5 describes the file system manipulation units including the Dir Info and File Info units Chapter 6 describes the print spooler unit Spool Unit Page 2 Introduction l 2 Notation and Terminology This section describes the notation and terminology used in this manual to describe UCSD Pascal A variant of Backus Naur form BNF is used as a notation for describing the form of language constructs Meta words are words which represent a class of words they are delimited by angular brackets lt and Thus the words trout salmon and tuna are acceptable substitutions for the meta word lt fish gt here is an expression describing the substitution lt fish gt trout salmon tuna The symbol indicates that the meta word on the left hand side may be substituted with an item from t
115. se The Dir Info routines D Lock and D Release are provided for use in multitasking environments When used properly they ensure mutual ly exclusive access to directory information See section 5 9 1 4 for more information on multitasking routines Page 105 Library User s Manual 529 2 8 0 Programming Example The following program demonstrates the use of D_Lock and D_Release Program Protect Test Uses Pattern Match Dir Info Const Stack_Size 2000 Var Pid Processid Old New String Date D Date Rec M D Y Integer Ch Char Process Change And Check Old New String Date D Date Rec Var Result D Result Begin Change And Check LOCK beginning of critical section Result D ChangeDate Old Date D Vol D Datal If Result D Okay Then Result D ChangeName Old New True D Release end of critical section End Change And Check Begin Protect Test Repeat Write Old file name Readln 0ld Write New file name Readln New Writeln New date Write Month Readln M Write Day Readln D Write Year Readiln Y With Date Do Begin Month M Day D Year Y End Start Change And Check Old New Date Pid Stack_Size Write Start another Read Ch Writeln Until Ch In n N End Protect Test Page 106 File System Manipulation 3 0 3 The Directory Information Unit Interface T
116. ser s Manual areas Both the file name argument and the D Select parameter are used by the routines which generate directory information to determine the file objects on which to return information See section 5 0 2 1 for details Dir Info defines a scalar type which is used to specify file objects D Select is declared as a set of this type a file object is selected by including its corresponding scalar in D Select File object types D NameType D Choice D_Vol D_Code D Text D Data D Temp D Free Set Of D NameType The scalar values are defined as follows D Vol Select all volumes matching the file name argument Note that while volume names may contain wildcards unit numbers must be specified literally D Free Select all unused areas of disk space on the volumes matching the ilo ale argument D Temp Select all temporary files matching the file name argument Files are considered temporary if they have been opened but not yet locked by a program D Text Select all text files matching the file name argu ment D Code Select all code files matching the file name argu ment D_Data Select all data files matching the file name argu ment 2 0 0 4 File Dates Disk files and disk volumes are assigned file dates File dates are stored in records of type D_Date_Rec and are accessed and modified by the Dir Info routines D_Dir_List and D Change Date D Date Rec is declared as follows D DateRec Packe
117. should be written to the STANOUT device unit 22 instead Page 10 System Functions 2 0 1 The Program Operators Unit Interface This section displays the text of the interface section belonging to the program operators unit The interface section text may also be viewed with the Libmap utility see the System User s Manual for details Note that all identifiers begin with Prog_ to prevent conflicts with host program identifiers NOTE This unit is normally used by the operating system to perform system functions Not all parts of the unit interface are explained in this document Users may experiment with these parts at their own risk Unit Prog Ops Interface Type Prog String String 255 Prog_Ptr Integer Prog Str P Prog Str Rec Prog Str Rec Record Next Str Prog Str P Is T File Is Literal Boolean Name String End of Prog Str Rec Prog Red Rec Record In File Name Out File Name Prog Px Name Prog Red P Prog Red Rec Px Name Prog Lib Name Lib Name Prog Str P End of Prog Red Rec Prog Rec Record Heap Base Prog Ptr User Vect Prog Ptr Unit List Prog Ptr Redir Rec Prog Red P End of Prog Rec Segment Function Prog Setup File Name Prog String Heap Dest Prog Ptr Var Error String Var Prog Desc Prog Rec Boolean Create runtime structures for the program File Name Segment Function Prog Execute Prog Desc Prog Rec
118. splaying the system prompt program chaining appears transparent to the user An attempt to process an excecution option list that references a nonexecutable program causes the chain queue to be cleared l NOTE The chain queue is allocated at system bootstrap time The chain queue size may be configured using the Setup utility described in the System User s Manual NOTE When the chain queue is full calls to the Chain and Chain_Expedite procedures are ignored 2 240 1 IZO Redirection The command I O unit provides five procedures to control I O redirection The Exception procedure accepts a boolean value parameter It suspends all redirection and T file processing for both the INPUT and OUTPUT files If the boolean parameter is true the chain queue is cleared The Suspend_T and Resume_T procedures stop and restart T file processing for both the INPUT and OUTPUT files The Suspend_Redir and Resume_Redir procedures stop and resume redirection for the INPUT and OUTPUT files NOTE Suspension of I O redirection and T file processing applies only to the redirection options processed in the invocation of the current program Redirection options in effect before the invoca tion of the current program are not affected For example consider an executing program whose output is redirected to the printer It may execute a program using the Prog Call procedure provided by the program operators unit see section 2 0 and Specify output redire
119. st Wild contains ab a m f Comp contains abcdefg If P Info is passed TRUE the pattern record list returned is l Wild_Pos 1 Wild Len 1 Comp Pos 1 Comp Len 0 matches the empty string 2 Wild Pos 2 Wild Len 2 Comp Pos 1 Comp Len 2 ab matches ab 3 Wild Pos 4 Wild Len 5 Comp Pos 3 Comp Len 1 a m matches c 4 Wild_Pos 9 Wild Len 1 Comp Pos 4 Comp Len 2 matches de 5 Wild_Pos 10 Wild_Len Comp Pos 6 Comp Len matches f 6 Wild_Pos ll Wild Len Comp Pos 7 Comp Len matches g e I C Il NOTE When the wildcard in Wild matches an empty string in Comp Comp Len is set to 0 and Comp Pos is set to the position of the next pattern in Comp i e the position where a nonempty pattern would have occurred Be sure to check the validity of Comp_Pos indices before using them to reference characters in Comp otherwise range errors may occur Page 65 Library User s Manual 4 2 3 Programming Example The following program is an example of a String comparison routine which uses P Match The program reads two strings and prints the result of the comparison if requested it also prints information describing how the patterns matched Program Wild Test Uses Pattern Match Var Ch Pat Ptr Want Patterns Procedure Print Patterns Pat_Ptr String Char P Pat Rec P Boolean P Pat Rec P String
120. st I O unit number 2 4 2 Programming Example The following program demonstrates the capabilities of the system information unit Program Util_Test Uses Sys_Util Var I Integer Begin Writeln The last I O unit is SU Max Unit For I 0 To 9 Do Begin Writeln Delaying I seconds System serial number is SU Ser Num SU Delay I 60 End End of Util Test Page 29 Library User s Manual Page 30 Screen Formatting III SCREEN FORMATTING This chapter describes units which perform functions related to CRT screen formatting The SC_Cntrl unit section 3 0 provides routines that perform screen control operations on a number of terminals simultaneously 3 0 The Screen Control Unit The screen control unit named SC_Cntrl provides user programs access to terminal handling information normally accessible only to system programs The screen control unit s interface consists of a complete set of terminal independent screen control operations along with other useful terminal operations The screen control unit provides the following capabilities Cursor movement operations including cursor home X Y cursor positioning and cursor up down left right Screen Clearing Screen erase operations including clear line erase to end of line clear screen and erase to end of Screen Keyboard input may be mapped into terminal inde pendent screen commands A single terminal screen may be div
121. subrange a z 7r represents the set of char acters from a to z excluding r NOTE Subrange wildcards must contain nonempty character sets otherwise a file name error occurs Blank characters within subrange wildcards are ignored NOTE Wildcard characters can be specified in character sets with the backslash notation described in section 4 2 0 0 Examples of subrange wildcard Pattern ab a r j k def Matches abbdef abrdef Nonmatches abjdef abkdef abzdef Page 62 Data Manipulation 4 2 1 Using the Pattern Matching Unit The pattern matching unit is available as an option with the AOS It is imported into a program by the USES Pattern Match Statement see the Programmer s Manual for details The Pattern Match unit may be installed in either the intrinsics library the System library or a user library All imported identifiers begin with P to prevent conflicts with program identifiers The pattern matching unit maintains no global variables and uses no other units NOTE Some pattern matching information returned by the Pattern Match unit is stored in a linked list on the system heap The dynamic variable management intrinsics MARK RELEASE and DISPOSE can be used to deallocate these data structures Note that careless use of these intrinsics may result in undefined pointer values NOTE Two copies of the pattern matching unit exist one compatible with hosts using the II 0 heap
122. system information unit called Sys Info allows user programs to obtain and in some cases modify system information previously accesSible only to system programs The system information unit provides the following capabilities Obtain the volume names and file titles of the work text and work code files Obtain the volume name and unit number of the system volume Prefixed Volume Access and modify the prefixed volume name System Date Access and modify the system date The Sys_Info routines are described in section 2 3 0 Section 2 3 1 contains a copy of the Sys Info unit interface section A programming example using the Sys Info unit appears in section 2 3 2 NOTE Sys Info accesses global file system information See the System User s Manual for a description of the file system This document uses the term title to specify the file title and suffix combined this differs from the terminology used in the System User s Manual Page 21 Library User s Manual 2 3 0 Using the System Information Unit The system information unit is available as an option with the AOS It is imported into a program by the USES Sys_Info statement see the Programmer s Manual for details It may be installed in the intrinsics library the system library or the user library All imported identifiers begin with SI to prevent conflicts with program identifiers The routines provided by this unit are described below The syst
123. t SC_Port This procedure is called to release a terminal screen secured by a SC Out Lock call Procedure SC In Lock Var Port SC Port This procedure is called when more than one task might access text ports on a given terminal keyboard It secures the keyboard for the caller until an SC In Re lease occurs Procedure SC In Release Var Port SC Port This procedure is called to release a terminal secured by a SC In Lock call Page 40 Screen Formatting Function SC Scrn Has Var Port SC Port What SC Scrn Command Boolean This function returns TRUE if the terminal associated with the text port described by Port has the What function Procedure SC Left Var Port SC_Port The cursor is placed one position to the left in the text port described by Port Procedure SC Right Var Port SC Port The cursor is placed one position to the right in the text port described by Port Procedure SC Up Var Port SC Port The cursor is placed one position up in the text port described by Port Procedure SC Down Var Port SC Port The cursor is placed one position down in the text port described by Port Procedure SC Home Var Port SC Port The cursor is placed at 0 0 in the text port described by Port Procedure SC Goto XY Var Port SC Port X Line Integer The cursor is placed at X Line in the text port described by Port Procedure SC Clr Line Var Port SC
124. t Found Writeln File not found D Other Writeln Miscellaneous error End cases Display Ptr End Display Begin Wild Change Writeln Repeat Mark Heap Ptr Select 1 Write File title to match must contain two Readln Match Result D ScanTitle Match Volume Name Typ Segs Writeln Types y n 3 GiveChoice Directories D Voll GiveChoice Text Files D Text l GiveChoice Code Files D Codel GiveChoice Data Files D_Datal Ptr Display Old Files Match Volume Name Select If Ptr lt gt Nil Then Begin Repeat Change Ptr Name Ptr Ptr D Next Entry Until Ptr Nil Write Redisplay files Read Ch Writeln If Ch In y Y Then Ptr Display New Files Match Volume Name Select End Writeln Repeat Write Continue Read Ch Writeln Until Ch In n N y Y Writeln Release Heap_Ptr Until Ch In n N End Wild Change Page 94 File System Manipulation Syntax Function D_Change_Date D_Name String D_New_Date D_Date_Rec D_Select D Choice D Result D Change Date changes the file date of volumes and files whose names match the file name argument contained in D Name D Change Date accepts wildcards in its file name argument D Change Date accepts the following parameters D Name A string which contains a valid file name The file name may contain wildcards D
125. t Writeln Pattern Count With Pat Ptr Do Begin Writeln Comp Comp If Comp Len lt gt 0 Then Write Comp Pos 9 If Comp Len gt 1 Then Write Comp Len 10 Writeln Writeln Wild Wild Write Wild Pos 9 If Wild Len gt 1 Then Write Wild Len 1 Writeln Writeln End Pat Ptr Pat Ptr Next Count Count 1 Until Pat Ptr Nil End Print Patterns Page 85 Library User s Manual Procedure Print Info Ptr D List P Begin Repeat With Ptr Do Begin If D Is Blkd Then Case D Kind Of D Free Write Free space on D Vol Write Volume D Temp Write Temporary file on D Text Write Text file on D Code Write Code file on D Data Write Data file on End Cases Else Write Unblocked volume Writeln D Volume If Want Patterns And D_VPat lt gt Nil Then Begin Writeln Writeln Volume patterns Print_Patterns D_VPat D Volume Volume End Writeln Unit number D Unit If D Is Blkd Then Begin If Not D Kind In D Vol D Freel Writeln File name If D Kind lt gt D Free Then Begin If Want Patterns And D FPat lt gt Nil Then Begin Writeln File name patterns Print Patterns D FPat D Title Title Title End With D Date Do Writeln File date Month Day Year End If D Kind Writeln Starting block D Start
126. the format lt header gt command command command version Here is an example of a prompt line Command A ssem F ile E dit R un H alt 1 01 The prompt is placed at a specified position in the text port If the prompt is long enough that it would extend past the end of the text port the SC Prompt function breaks the prompt up at some specified break character usually and displays the header and lt version gt parts along with as many commands as can fit on the line After the prompt is written the cursor may be placed either at the end of the prompt line or at another location in the text port The SC Prompt function returns a key sequence read from the keyboard in response to the prompt Two sets are passed to SC_Prompt aS parameters If the primary acceptance set of type SC_Key_Command is empty the prompt line is displayed and SC_ Prompt returns an undefined character value otherwise SC_Prompt continues to read keys from the keyboard until a key sequence is read whose corresponding scalar is found in the primary acceptance set If the primary acceptance set contains the SC Unknown scalar and the key sequence read from the keyboard does not correspond to any of the keys enumerated in the SC Key Command type then the key must be found in the secondary acceptance set of type CHAR Note that escape sequences are specified in the secondary acceptance set by biasing the second character of the sequenc
127. tr Next Count Count 1 Until Pat Ptr Nil End Print Patterns Procedure Print Info Ptr D List P Want Patterns Boolean Volume Name String Begin Repeat Writeln MATCHED FILE With Ptr Do Begin Write D Volume If D Is Blkd Then If Length D Title gt 0 Then Write D Title Writeln If Want Patterns And D VPat lt gt Nil Then Begin Writeln Writeln Volume patterns Print Patterns D VPat D Volume Volume End If D Is Blkd Then If Want Patterns And D_FPat lt gt Nil Then Begin Writeln File name patterns Print Patterns D FPat D Title Name End End With Ptr Writeln Write Type cr for rest of list Readln Writeln Ptr Ptr D Next Entry Until Ptr Nil End Print Info Procedure Change Ptr D List P Name String Var I Posl Lenl Pos2 Len2 Last Pos Mid Pos Last Equal Integer Patl Pat2 Title New String Procedure Pind Equal D Title Name String Var Pat Ptr D Pat Rec P Var Pat String Var Pos Len Integer Begin While Name Pat Ptr Wild Pos lt gt And Pat Ptr Next lt gt Nil Do Pat Ptr Pat Ptr Next With Pat Ptr Do Begin If Comp Len 0 Then Pat Else Pat Copy D Title Comp Pos Comp Len Pos Comp Pos Page 92 File System Manipulation Len Comp Len End End Find_Equal Begin Change With Ptr Do Begin Find Equal D Title Name D_FP
128. udes volume names and unit numbers of blocked and unblocked on line units number of files on blocked units lengths and starting blocks of disk files and unused disk spaces file names and types file dates and file ends The function result value indicates invalid file name arguments off line volumes or not found files D Dir List optionally provides information describing how the wildcard file name argument matched files and or volumes D Dir List accepts a string containing a file name and a set specifying the file types on which to return information D Dir List returns a pointer to a linked list of directory information records Each record contains the name of a file or volume which matches the file name argument and also is one of the types specified in the file type set The D Name parameter contains a file name which may contain wildcards The D Select parameter is a set specifying the directory objects for which information is to be returned by D Dir List See section 5 0 0 3 for more information on directory object selection andrade da dal D Ptr The D_Ptr parameter is assigned a pointer to a linked list of records containing directory information for all specified file objects In order to have information returned describing it a file object must meet the following criteria It must reside on a volume which matches the volume id in D Name If the object is a disk file it must match the file id in D Name
129. untime structures The Redir Rec field points to a list of I O redirec tion options to be processed before program execution If no I O redirection options were specified in the original execution option list this field contains Nil NOTE 1 0 redirection options are effective only when applied to programs that perform I O through the predeclared INPUT and OUTPUT files Unit I O and I O performed on local file variables are not affected by redirection options i e Since the system editor performs unit I 0 editor input must come from the keyboard rather than from an alternate input file See the System User s Manual and the Programmer s Manual for further details alee The Prog_Call function attempts to set up and execute a program Page 7 Library User s Manual It returns a boolean function result indicating whether or not the program was executed Prog_Call accepts two variable strings and one variable integer as parameters The first string contains an execution option list If the code file named in the execution option list does not exist or not all of the units used by the program are available a textual error message is returned in the Second string parameter and the function result is returned FALSE Otherwise the program is executed and the function result is returned TRUE Any execution error causing program termination is returned in the integer parameter 0 is returned for normal program termination NOTE The string
130. utually exclusive terminal access All text port operations contain internal locks to ensure their own mutually exclusive access to text ports Calls to the SC Out Lock and SC In Lock procedures are necessary only when executing se Page 35 Library User s Manual quences of text port operations that cannot be interrupted by other tasks 3 0 1 1 2 Keyboard Input The SC_Map_CRT_Command function reads a key sequence from the keyboard associated with a specified text port and returns a scalar of type SC_Key_Command describing the key sequence A character containing the actual key sequence is also returned if the key generated an escape sequence the character returned is the character value of the second character of the key sequence biased by 128 The key is not echoed to the screen The SC_Map_CRT_Command procedure protects the keyboard from access by other tasks until the input operation is complete This guarantees that keys generating multicharacter Sequences are pro cessed before other tasks are allowed to read from the keyboard 3 0 1 2 Text Port Operations Text port operations fall into three categories cursor position ing screen clearing and prompt line support All operations are limited to the screen area specified by the text port Coordinates passed to the procedures performing text port operations are relative to the upper left corner of the text port 320214220 Cursor Positioning The cursor positioning
131. y F Length returns MAXINT as the file length 5 1 0 5 Starting Block F Start accepts a block file and an integer variable as parameters and returns a file status result The block number of the first block in the external file is returned in the integer parameter If the external file is a disk file the starting block number is relative to the first block on the enclosing disk volume If the external file is a volume F Start returns 0 as the starting block Page 111 Library User s Manual This section displays the text of the interface section belonging to the file information unit The interface Section text may also be viewed with the Libmap utility see the System User s Manual for details Note that all identifiers begin with F_ to prevent conflicts with host program identifiers Unit FileInfo Interface Type F_Result F File Type F Date Rec F_Okay F Not Open File Packed Record Month 0 12 Day 03 31 Year 0 100 End F Date Rec Function F Length Var Fid F File Type Var File Length Integer F Result Returns the length of the file attached to the Fid identifier If there is no file opened to Fid the function result is returned F Not Open and File Length is undefined Function F_Unit Var Fid F File Type Var File Unit Integer F Result Returns the unit containing the file attached to the Fid identifier If there is no file opened to Fid the function result is

Download Pdf Manuals

image

Related Search

Related Contents

d-Color MF201  Chamberlain 3280C User's Manual  Aube Technologies TH303 User's Manual  取扱説明書(2.3 MB)  SÉRIE 211  User manual  Dynatrap DT1200 Use and Care Manual  BIO SYSTEM II + AIR + CROMOTERAPIA  User Manual - MONTSERRAT  de handleiding  

Copyright © All rights reserved.
Failed to retrieve file