%ì VAX-11 Librarian V03-00TiÔØÆŒ DƒÔØÆŒ·,¸5 Clib­`ú™\'ŒŒ1 Clib 2 SummaryF The Standard I/O library is available either as an object libraryF or as a shared resident library. See Intro for usage instruction.F Items connected via ____'s are combined topics under the heading of the first subject. $ Standard Library Summary exit ( errcode) fclose ( *ioptr:byte) feof ( *ioptr:byte) ferror ( *ioptr:byte) fflush ( *ioptr:byte) fgetc ( *ioptr:byte).  fgets ( *string:byte , n , *ioptr:byte)L fopen ( *filename:byte , *type:byte , *class:byte , user) is variableF fprintf ( *ioptr:byte , *format:byte) is variable fputc ( c , *ioptr:byte)* fputs ( *string:byte , *ioptr:byte)- freopen ( filename , type , *ioptr:byte)H fscanf ( *ioptr:byte , *format:byte) is variable getc ( *ioptr:byte) getchar gets ( *string:byte), printf ( *format:byte) is variable putc ( c , *ioptr:byte) putchar ( c) puts ( *string:byte)- scanf ( *format:string) is variableG sprintf ( *string:byte , *format:byte) is variable ungetc ( c , *ioptr:byte)% access ( *filename:byte , mode). atodesc ( *ascii:byte , *descriptor:byte) atof ( *string:byte)K cat ( *out:byte , *string:byte) is variable compile ( *regexp:byte)% cmap ( *filename:byte , size)% cmapzero( *filename:byte , size)- cmapcluster ( value , space) is variable cunmap ( *ptr:byte , size). desctoa ( *descriptor:byte , *ascii:byte)6 eq ( *stringa:byte , *stringb:byte , length)1 etoa ( number , *out:byte , prec , width)' fields ( *string:byte , vector[])( filetime( *ioptr:byte , timebuf[2])1 ftoa ( number , *out:byte , prec , width) fullname( *ioptr:byte)< getargs ( argc , argv[] , sb1 , sb2 , flag) is variable isambx ( *ioptr:byte) isasys ( *ioptr:byte) isatty ( *ioptr:byte) match ( *string:byte) max ( x , y) min ( x , y)- moveb ( *from:byte , *To:byte , nchar) mytty ( *ttyname:byte) nargs nextf ( *ioptr:byte)+ pos ( *in:byte , *of:byte , start)+ recmp ( *regexp:byte , *string:byte)# repos ( *in:byte , *of:byte)9 reseg ( *out:byte , *in:byte , *of:byte , inverse) search ( * string:byte)3 seg ( *string:byte , *in:byte , from , To)* setpmt ( *ioptr:byte , *string:byte)% settmo ( *ioptr:byte , seconds) setraw ( *ioptr:byte)# setchar ( *ioptr:byte , chars) stolower( *string:byte) stoupper( *string:byte)1 strcopy ( *tostring:byte , *fromstring:byte) strlen ( *string:byte)# val ( *string:byte , base) 2 IntroNAME INTROSYNOPSIS$ #include jplclib:stdio.h (for C)$ Standard  (for Z) Use_Stdio DESCRIPTIONG This documents the JPL C runtime library. It is intended to beG compatible with `A new input-output package' on unix as far as isG pratical and still compatible with other i/o created under VMS. It1 was created with the following goals in mind.G 1. It should permit an efficient implementation of unix styleG i/o on an VMS system. Thus it needs to do its own disk buffering.G 2. It should be compatible with RMS. This means, forG example, that it must support version numbers for filesG in all VMS cases. This sometimes will require additionalG parameters or allow for more options than the standard unix routines.G 3. (Note that in some cases features are not yet implemented.G They will be denoted by a (*) in the left margin if theG entire routine is unimplemented, or along side the= portion of text where a feature is not implemented.), The supported command line features are:$ file redirect output (create next higher version)6 >>file redirect output appended to fileF >=file redirect output into file (or create if no file)C ?file redirect error (create next higher version)6 ??file redirect error appended to fileF ?=file redirect error into file (or create if no file)@ see note below on redirecting this streamE "..." quoted arguments (for imbeded spaces, tabs etc)6 Each program using the library must have the line:/ #include G which defines certain macros and variables. The library containingG the routines is jplclib:runtime.olb which is included in the link./  jplclib:cheaderG This module contains the program start address which calls theG user at function main passing the standard argc and argvG parameters. The program is then declared to be a foreign commandF to DCL and the file redirection notation can be used. TheG The program CC will compile and link a c program. It will alsoG generate a link command file which will contains commands toG either link directly to the library, or to the memory residentG shared library. The latter is much more efficient in terms of bothG link time and the size of the resulting task image. It isG recomended since as fixes are made to the library, the image thatG dynamically links to this shared library need not beG relinked. Also, the amount of memory utilized by the running program is lessened.< EOF The value as returned by the VMS file system for end of file.( NULL The value of a null pointer.E FILE A type definition for a file variable. Note that the userE would always declare any file variable as a pointer, e.g. FILE *fd;( NoteG When redirecting the standard error stream to a file and a fatalG error occurs, the error file may not get properly cloosed. This+ could cause the loss of error messages. 2 fopenNAME fopenSYNOPSISG FILE *fopen(filename,type,class[,user]) char *filename, *type *class DESCRIPTIONG Fopen opens the file and, if needed, allocates a buffer for it.G Filename is a character string specifying the name. Type is aG character string (not a single characataer). It may be "r","w",G "u", or "a" to indicate intent to read, write, update or append.G The value returned is a file pointer. If it is NULL the attempt at  open failed.G The value of class may be "r" or "u"(*). If "r", then record i/oG is used otherwise unstructured (an array of bytes) i/o isG implemented. "u" i/o uses multiple buffers which are linked in aE least recently used list such that disk i/o is kept to a minimum.G When the type is spelled out (e.g. "read", "write" etc.) then ifG an error occurs on the open, a message will be output to the terminal.G When the type is w rite, a new version of a file is alwaysG created. When the type is update, an attempt on the old file isG tried first followed by a creation if no file existed. If the oldG file exists but cannot be accessed, then an error condition is raised.G When a 4th argument is provided, it is assumed to be the addressG of a user open routine. It will get called just prior to the, actual open with the following sequence:; (*useropen) (filename,ioptr,type,class)G where filename, type, and class are as specified in the fopenG call. The ioptr is a pointer to a structure whose format is defined in stdio.h.2 getcNAME getcSYNOPSIS int getc(ioptr) FILE *ioptr! int fgetc(ioptr) FILE *ioptr DESCRIPTIONG returns the next character from the stream named by ioptr, whichG is a pointer to a file such as returned by fopen, or the variableG stdin.  The integer EOF is returned on end-of-file or when anG error occurs. The null character '\O' is a legal character for8 unstructered i/o, but is not possible in record i/o.2 putcNAME putcSYNOPSIS& fputc(c,ioptr) FILE *ioptr int c& putc(c,ioptr) FILE *ioptr int c DESCRIPTIONG These write the character c on the output stream named by ioptr,G which is a value returned from fopen or perhaps stdout or stderr.G The value 1 is returned if all is ok, or a small negative value is returned on error. 2 fcloseNAME fcloseSYNOPSIS& fclose(ioptr) FILE *ioptr int c DESCRIPTIONG The file corresponding to ioptr is closed after any buffers areG emptied. A buffer allocated by the IO system is freed. Fclose is3 automatic on normal termination of the program. 2 fflushNAME fflushSYNOPSIS fflush(ioptr) FILE *ioptr DESCRIPTIONG Any buffered i!nformation on the (output) stream named by ioptr isC written out (but the file otherwise remains in the same state.)2 exitNAME exitSYNOPSIS exit(errcode) int errcode; DESCRIPTIONG Exit terminates the process and returns its argument as status toG the parent. All open files are automatically closed before the actual exit.2 feofNAME feofSYNOPSIS feof(ioptr) FILE *ioptr DESCRIPTIONG returns non-zero when end-of-file has occurred on the specified input stream. 2 ferrorNAME ferrorSYNOPSIS ferror(ioptr) FILE *ioptr DESCRIPTIONG returns a negative number when an error has occurred after call toG fopen or 1 if all is ok. This value is in an external variableG which is set by the fopen routine and remains available until another fopen call. 2 getcharNAME getcharSYNOPSIS getchar() putchar(c) DESCRIPTION8 This is a macro which is identical to getc(stdin) or9 This is a macro which is identical to putc(c,stdout).2 getsNAME getsSYNOPSIS char *gets(s) char *s DESCRIPTIONG reads characters up to a new-line from the standard input. TheG new-line character is replaced by a null character. It is theG user's re- sponsibility to make sure that the character array s isG large enough. Gets returns its argument, or NULL if end-of-file orG error occurred. Note that this routine is not compatible with5 fgets; it is included for downward compatibility. 2 fgetsNAME fgetsSYNOPSIS/ char *fgets(s,n,ioptr) char *s; FILE *ioptr DESCRIPTIONG reads up to n characters from the stream ioptr into the characterG pointer s. The read terminates with a new-line character. TheG new-line character is placed in the buffer followed by a nullG character. The first argument, or NULL if error or end-of-file occurred, is returned.2 putsNAME putsSYNOPSIS puts(s) char*s DESCRIPTIONG writes the null-terminated string (character array) s on theG standard output. A new-line is appended. No value is returned.G Note that this routine is not compatible with fputs; it is( included for downward compatibility. 2 fputsNAME fputsSYNOPSIS& fputs(s,ioptr) char*s; FILE *ioptr DESCRIPTIONG writes the null-terminated string (character array) s on theA stream ioptr. No new-line is appeneded. No value is returned. 2 ungetcNAME ungetcSYNOPSIS ungetc(c,ioptr) FILE *ioptr DESCRIPTIONG The argument character c is pushed back on the input stream namedG by ioptr. Only one character may be pushed back. This is only> implemented for "r" class files (see fopen 3rd parameter). 2 printfNAME printfSYNOPSIS% printf(format,al,...) char*format: fprintf(ioptr,format,al,...) FILE *ioptr; char *format- sprintf(s,format,al,...) char *s, *format DESCRIPTIONG Printf writes on the standard output. Fprintf writes on the namedG output stream. Sprintf puts characters in the character array (string) named by s. Usage. printf(format, arg1, ...);, char *format;4  fprintf(iov, format, arg1, ...);) FILE *iov;, char *format;7 sprintf(buffer, format, arg1, ...);, char *buffer;, char *format; DescriptionJ printf() converts, formats, and prints its arguments, underJ control of the first argument, writing output via putchar().J fprintf() writes its output to th e indicated file. sprintf()9 writes its output to the indicated string buffer.J The first argument is a character string which contains two typesJ of objects: plain characters, which are simply copied to theJ output stream, and conversion specifications, each of which causesJ conversion and printing of the next successive argument to printf.J Each conversion specification is introduced by the character %.% Following the %, there m ay beJ - an optional minus sign "-" which specifies left adjustment of9 the converted argument in the indicated field.J - an optional digit string specifying field width; if theJ converted argument has fewer characters than the field width,J it will be blank-padded on the left (or right, if theJ left-adjustment indicator has been given) to make up the fieldJ width. If the field width is specified as !'*' or '?', the next5 argument is used. (Note: '?' is obsolete.)J - an optional period "." which serves to separate the field width& from the next digit string;J - an optional digit string (precision) which specifies the numberJ of digits to appear after the decimal point for e- andJ f-conversion, or the maximum number of characters to be printedJ from a string. If the precision is specified as '*' or '?', the! " next argument is used.J - a character which indicates the type of conversion to be applied.< The conversion characters and their meanings are$ d Signed-decimal& u Unsigned-decimal o Octal? X Hexadecimal, 10-15 are represented by A-F? x Hexadecimal, 10-15 are represented by a-fJ The integer argument is converted to decimal, #octal, orJ hexadecimal notation respectively. Any of the conversionJ characters may be preceeded by 'l' to signal "long" integerJ argument. Note that the Unix usage of capital letters to5 represent long arguments is not supported.J f The argument is converted to decimal notation in theJ style "[-]ddd.dd" where the number of d's after theJ decimal point equals the prec $ision specification forJ the argument. If precision is missing, 6 digits areJ given; if explicitly 0, no digits and no decimalJ point are printed. The argument should be float or double.J e The float or double argument is converted in theJ style "[-]d.ddde+-dd" where there is one digit beforeJ the decimal point and the number after i %s equal toJ the precision specified for the argument; if theA precision is missing, 6 digits are produced.1 g Floating point of some sort.J c The argument character is printed. (Note that 'lc'4 takes a long integer argument.)J r Remote format. The next printf() argument is theJ format. Note that this is not a subroutine. TheA & current format is not processed further. For$ example:- bug(args)% {H error("Error at %r", &args);% }D This routine might be called as follows:G bug("Error %d at %s\n", val, name);J s The argument is taken to be a ' string (characterJ pointer) and characters from the string are printedJ until a null character or until the number ofJ characters indicated by the precision specificationJ is reached; however if the precision specification isH 0 or missing all characters up to null are printed.= The following are available, but are VMS specific., # External formatter. S (ee belowD D The argument is Vms descripter. It is probed to see if it is valid.J m The argument is a long integer which is a VMSJ returned error code. The output is the ascii text. associated with the code.J : Takes a pointer to a 64 bit time array and convertsJ it to ascii time and date. If the pointer is 0, then@ the current time and )date are used instead.J v Takes an integer with a value from 0 to 32767 and6 converts it to english (ordinal).J V Takes an integer with a value from 0 to 32767 and7 converts it to english (cardinal).J t this is equivalent to \t, but is for languages that; do not support the C escape sequences.A n This is equivalent to \n for similar reaso *ns.J If no recognizable character appears after the %, thatJ character is printed; thus % may be printed by the use of theJ string %%. In no case does a non-existant or small field widthJ cause truncation of a field; padding takes place only if theJ specified field width exceeds the actual width. CharactersB generated by printf() are printed by calling putchar().' %r may be non-transportable. 3 exte +rnal4 The following routine supports external formating.0 set_format(fmt_number , action_routine_addr) F External formatting is supported by the # format code. The userF enters a format code of %[w.d]#dd where dd is a (leading zero if" necessary) number from 00 to 99.  F The [w.d] is optional width and precision arguments as per usual. InF order to setup an external format, the user must call set_format withF fmt=the format number and addr=address of external routine ,to handleF the format. When sprint detects the # format code, it will dispatchF if there is a format addr available that is non zero (if zero, aF fatal error message is output). The user action routine is called as follows:  B extern_format_routine[arg,outbuf,inbuf,addr_of_arg,cts] is local where! arg = the argument value8 outbuf = the place that the format must go (asciz)B inbuf = pointer to the dd part following the # in the input< addr_of_arg= address o -f the argument value in the arg list% cts = current character count F The action routine normally returns a value of inbuf+2. This movesF the input format pointer to just after the #dd part. However, theF action routine may access additional information from the formatF string by using the inbuf argument and may "eat" any additional textF by returning inbuf+2+additional. It is also possible to reuse the; argument if a scan back is made to the % that started it. .2 scanfNAME scanfSYNOPSIS$ scanf(format,al,...) char*format8 fscanf(ioptr,format,al,...) FILE *ioptr;char *format DESCRIPTIONJ Scanf reads from the standard input. Fscanf reads from the namedJ input stream. Scanf reads from the character string supplied as s.J The specifications are identical to those of the Portable Library.J Scanf reads characters, interprets them according to a format, andJ stores the results in its argume /nts. It expects as arguments aJ control string format, described below, and a set of arguments,J each of which must be a pointer, indicating where the converted input should be stored.J Scanf returns as its value the number of successfully matched andJ assigned input items. This can be used to decide how many inputJ items were found. On end of file, EOF is returned; note that thisJ is different from O, which means that the ne0xt input characterA does not match what was called for in the control string. Usage+ scanf(fmt, pointer(s));F char *fmt; /* Format string */0 fscanf(fd, fmt, pointer(s));F FILE *fd; /* Input file pointer */F char *fmt; /* Format string */1 sscanf(buf, fmt, pointer(s));F (*) ch1ar *buf; /* Input text buffer */F char *fmt; /* Format string */ DescriptionL Using the format string, these functions parse the input file (orL given text file), storing the results in the pointer arguments.0 The three routines differ as follows:G scanf Reads from the standard input file.B fscanf Reads from the indicated file.? 2 sscanf Reads from the text buffer.L The format string may contain control characters to direct the0 conversion of the input textual data:J ' ' Blanks, tabs, or newlines are ignored in formatB strings. To match whitespace, use "%[ \t\n]".J x An ordinary character (not %) must match the next% input character.J % Conversion specific 3ations consist of a '%', anJ optional '*' (to supress assignment), an optionalJ maximum numeric field width, and a conversion specifier.L Unless value assignment was supressed by the '*' format modifier,L the next field is converted and stored in the variable pointed toL by the corresponding argument. An input field is defined as aL string of non-space characters, ex4tending to the firstL inappropriate character or until the field width (if given) is exhausted.= The following conversion characters are specified:J % A single '%' is expected in the input, no assignment is done.J d An integer of the specified class (decimal, octal, orJ o hexadecimal) is expected. The corresponding argumentJ x should be an integer 5 pointer. If the format speciferJ is given in upper-case, or preceeded by 'l', a longJ integer will be stored. For example, "%ld" isJ identical to "%D". Leading whitespace will beJ ignored. A null field is not converted. Scanf()J returns a count of the number of fields converted,E but does not indicate which fields were ignored.J s 6 A character string is expected. The input field willJ be terminated by a space, tab, or newline. TheJ corresponding argument should point to a buffer largeJ enough to contain the text and a terminating NULL.8 Leading whitespace will be ignored.J c A single character is read. Leading white space isJ not supressed -- to read the next non-blankJ 7 character, use "%1s". If a field width is given theJ corresponding argument is a pointer to a vector ofJ characters and the indicated number of characters are read.< e A floating-point number is converted and stored< f appropriately. If the format indicator isJ capitalized, or preceeded by 'l', a double- precisionJ floating-point number will 8be stored. TheJ floating-point format is the same as in the CJ language: an optionally signed string of digitsJ possibly containing a decimal point, followed by anJ optional exponent field which consists of an 'E' orC 'e' followed by an optionally signed integer. J [ ] A string not to be delimited by white-spaceJ characters. U 9nless the first character is '^', theJ format constitutes an acceptance list: the inputJ field is all characters until the first characterJ which is not in the set within brackets. Note that7 leading whitespace is not ignored.J If the first character after the left bracket is '^',J the format defines a stop list: the input field isJ all : characters until the first character specified1 within the bracketed string.J The corresponding argument points to a character@ vector. The result will be null-terminated.J Scanf() returns the number of successfully matched andJ assigned input items. If the end of input was reached, EOF* (-1) is returned. For example:" main() ; {6 register int c;6 int i;= char text[10];B c = scanf("%d%9s", &i, &text);A printf("i = %d, text = %s\n",5 i, text); }E If the input line is "150 foobar", the program will print:2 < i = 150, text = foobar! For example, the call3 int i; float x; char name [50];3 scanf ("%d%f%s", &i, &x, name); with the input line+ 25 54.32E-1 thompsonG will assign to i the value 25, x the value 5.432, and name, will contain "thompson\O". Or,2 int i; float x; char name [50]B scanf ("%2d%f%*d %[1234567890]",&i, &x, na =me); with input$ 56789 0123 56a72G will asisgn 56 to i, 769.0 to x, skip "0123", and place theG string "56\O" in name. The next call to getchar will retrunG 'a'. NOTE: A bug exists such that if %[] is used and wouldG otherwise return a null string, the argument does not getG the \0. If this format is used, it is suggested that theG string be initialized to a null first. Thus in the> exampleA above, the following should precede the call to scanf/ name[0] = '\0'; DiagnosticsL Scanf() returns -1 if an end of file (end of string)L condition exists and no data was stored. It returns -2L if a palpably incorrect format, such as "%" is encountered. 2 setcharNAME setcharSYNOPSISA int setchar(iopt ?r,char,value) FILE *ioptr; int char, value DESCRIPTIONG This specifies additional characteristics for raw inputG from a terminal. Currently, two values for char areG possible. The value TTYNOECHO if set to a 1, will turn offG echo. If set to a zero, then echo will take place again. TheG default is echo. The value TTYKILL if set to 1 (the default)G causes the input routine to exit on the input of a control @ c.G This is a debugging feature that protects the developerG from accidental lockup (program will not exit and allG interupts are blocked out for process). When value is 1A the corresponding characteristic is set, when 0, it is reset. 2 setrawNAME setrawSYNOPSIS$ int setraw(ioptr) FILE *ioptr; DESCRIPTIONG Sets the stream to raw i/o for terminal use. This is done afterG the open (which mustA be specified as class "r"). Since bufferingG is still performed, the terminal must be opened twice if bothG input and output is desired. Thus if both input and output areG to be raw, then two fopens and two ioptrs must be set up.G However, both raw and regular input may be performed on the sameG terminal by having more than one file open to the terminal. OnG output, the characters may be any ascii eight bit values. TheG characteBrs are buffered until a fflush(ioptr) is called. On input,G characters are read 1 at a time and thus each getc returnsG immediately with the character. See the routine setchar for? setting up raw input flags for no echo and control-c exits.2 regular_expressionsNAME reSYNOPSISD reseg(out,in,of,inverse) char out(),in(),of(); int inverse;1 repos(in,of) char in(),of();0 match(string) char string[ C];0 compile(regexp) char regexp();9 recmp(regexp,string) char regexp(),string(); DESCRIPTION Regular Expression RoutinesH reseg(out,in,of,inverse) char out(),in(),of(); int inverse;H This routine uses the regular expression OF to search IN forH a substring. It then extracts the matching string and placesH it into OUT which is then null terminated. If the fourthH parameter exists, then reseg Dextracts everything but theH matched pattern. Returns the length of out. See recmp for7 pattern matching using regular expressions.+ repos(in,of) char in(),of();H This routine returns the position (1..n) of the regularH expression pattern OF in the string in. See recmp forH pattern matching using regular expressions. If it returns 0H then the pattern was not found. Note that C indices are ze EroH origin and this routine returns 1 origin indices. ThisH choice is to allow logical tests since if, for, etc. all test for non zero.8 recmp(regexp,string) char regexp(),string();H Takes the regular expression in regexp compiles it into theH global string PBUF and then compares the input string> against it. If a match, then 1 is returned else 0./ compile(regexp) char regexp() F;H Separately compiles the input regular expression into theB global character string `PBUF' for later use in match./ match(string) char string[];H Compares the input string against PBUF and returns 1 if aH match otherwise it returns 0. On a match the globalH variables __loc1,__loc2 contain the address in string whereH the match occured and the address of then next characterH G beyond where the match ended. Thus, __loc2 - __loc1 computes$ the length of the match.4 Recognized regular expression patterns are:F c Matches the character itself (c is any non special? character). Letters are matched caselessly.I [c..c] character class (matches any of the characters inside! the brackets.L [^c..c] Negated character character class (matches any character, H not inside the brackets.1 . Matches any single character.O @ Matches any letter a-z or A-Z (setable ranges - see below)C # Matches any number 0-9 (setable ranges)J * Closure, Matches 0 or more occurances of the preceding' regular expression.K ^ Anchors the string to the beginning, i.e. the remainingI regular expression must match at the b Ieginning of the string.M $ Anchors the string to the end, i.e. the preceding regularC expression must match upto the end of the line.I \c Matches c where c is any character at all, i.e. turns; off the special meanings of characters.J white space (a blank or ascii space ) is equivalent to" space or tabs.H The variables __num1, __num2 and __alfJ1,__alf2 contain `0',H `9' and `a', `z' for ranges of numbers and letters. The #H and @ metacharacters use these for the range of charactersH they compare. Note that alpha folds all characters to lowerH case before a compare. Thus # can be utilized for any rangeH of ascii characters while @ is more restrictive. The userH must change these ranges before any calls to regularA expression routines, and tKhey stay set forever after. 2 accessNAME accessSYNOPSIS2 access(file,mode) char file[]; int mode; DESCRIPTIONG Access checks the given FILE name for accessibility according toG MODE. Currently only a value of mode 0 is implemented and testsG for simply the existance of the file. 0 is returned if the file9 exists else -1 if not and the error code is in errno. 2 atodescNAME atodescSYNOPSIS" atodesc(a,d)L char a[], d[]; DESCRIPTIONG This takes a char array (null terminated) and creates aG descriptor in d which should be allocated as a char array largeG enough to hold the string a along with 12 additional bytes for theG descriptor. Then the descriptor is used by passing theG address of d to some Dec routine that requires strings as descriptors.2 atofNAME atofSYNOPSIS& double atof(str) char Mstr[]; DESCRIPTIONG converts a string of characters representing a floating point. quantity and returns a double float value.2 catNAME catSYNOPSIS1 cat(out,str,...,0) char out[]; str[]; DESCRIPTIONG Str is copied onto the end of out along with all the strings in@ the parameter list until the value 0 which ends the process.2 cmapNAME cmapSYNOPSIS8 int *cmap(name,size) char *name; int size;8 N int *cmapzero(name,size) char *name; int size;2 int *cunmap(ptr,size) int *ptr, size;C int cmapcluster(value,{space}) int value; unsigned int space; DESCRIPTIONF These routines provide easy mapping to files. However, there is aF limitation at present, only 1 file can be mapped using theseF routines. Cmap, given the name of a file will either create it orF map to it given the size in bytes. It will return a pointer to theF location in dynaOmic storage where one then can access the data inF the file. Cmapzero is the same, except that the data in the fileF is not read initially, rather it is set to a block of zeros.F Cunmap will undo the mapping using the ptr and original size.F Cmapcluster sets the default cluster size for read faults. TheF default before this call is the device or system default. If theF space parameter is provided to cmapcluster, then the address spaceF (po or p1 space) iPs extracted from this value and determines where- the allocated virtual memory comes from. 2 cspawnNAME cspawnSYNOPSIS; int cspawn(commandline,symbols,action,account,listfile)A char *commandline,*symbols,*listfile; int action,account; DESCRIPTIONG This routine provides a method of spawning a subprocessG with or without waiting. The process spawned is always theG system loginout process. Thus any command that may be ty Qped atG the terminal may be spawned by this routine. Since theG environment of a process is not passed onto its child, there is aG method for reconstruction of this environment. The user isG given a second command line argument string that is normally used! to reload symbol definitions./ A description of the arguments follows:2 commandline = asciz string to be executedJ symbols = 0 or a string containing the comm Rand to be executedJ which loads symbol definitions (but anythingJ really) This command is issued while loginout'sJ output file is still set to null, so it will never$ echo (verify)0 action = 0 = normal, wait for done% 1 = don't waitE 2 = don't wait and suppress process id messageJ account = 0 for don't care; else addres Ss of block to receive0 84 byte accounting record= outputfile = 0= null device for nowait (nla0:)K "file" the file to get output from this process WhenK this file is given, the $set no verify is( suppressedJ Each of the last 4 arguments are optional, and default to 0.C Defaulting means calling the routine with fewer parameters.A Returns T if action = wait, 1 for success, 0 for failureA action = nowait process id, or 0 for failure 2 desctoaNAME desctoaSYNOPSIS% desctoa(d,a) DESC d; char a[]; DESCRIPTIONG Takes a DEC descriptor and copies the string into the char array aG and null terminates it. The descriptor need not be contiguous withG the data as is created in the atodesc routine described above, butG may be any static descriptor as createdU by Dec routines. The format of a descriptor is:! struct DESC {( short length;' char class;& char type;) char *string; }2 eqNAME eqSYNOPSIS! eq(a,b,n) char *a,*b; int n; DESCRIPTIONG compares n chars returns 0=if the strings are different and 1 if? they are identical. This version of Veq is case insensitive.2 etoaNAME etoaSYNOPSISG etoa(number,out,prec,width) double number; char out[]; int prec,width;G ftoa(number,out,prec,width) double number; char out[]; int prec,width; DESCRIPTIONG These are used by printf to format a floating point NUMBER toG ascii in the string OUT according to WIDTH and PRECISION quantifiers. 2 fieldsNAME fieldsSYNOPSIS2 fields(sWtring,vector) char *string, *vector[] DESCRIPTIONG This routine finds character fields and returns pointers to them.G It also places a null at the end of each field (thus it destroys the original string).$ fields are delimeted by: whitespace comma slash back slash colon, fields can be quoted as follows: {...}/ ^x...x where x is arbitraryX "..." '...'2 fullname___filetimeNAMESYNOPSISA fullname (ioptr) char *fullname(ioptr) FILE *ioptr;> filetime(ioptr,timebuf) FILE *ioptr; int timebuf[2]; DESCRIPTIONG fullname returns a pointer to a null terminated string containingG the full pathname for the file opened on access path ioptr.G Filetime, returns into timebuf a VMS 64 bit time value for the last update of the file. 2 YgetargsNAME getargsSYNOPSIS3 getargs(argc,argv,flag_routine,arg_routine[,1]) DESCRIPTIONG Where argc and argv are the pair of parameters that the mainG function are called with. Flag_routine is called as follows, once4 per flag (an argument that begins with -x or +x)9 flag_routine(flagchar,argstring,flagtype) char flagchar;C char argstring[];G Argstring is all the text beyond the flag Zcharacter. The flagchar@ is passed by value while the argument string is a reference.@ arg_routine is called once per argument, as follows:5 arg_routine(argn,argstring) int argn;= char argstring[];G argstring is the entire argument, argn is 0..n for each argument/ except that flag arguments are not counted.G The following example shows a pair of routines which simply printE out the options an[d string arguments the program was called with.3 external routine(); routine2();# main(argc,argv) {@ getargs(argc,argv,routine,routine2);% return 1; }= routine(flagis,argis,tp) char flagis; char argis[],tp; {H printf("flag=(%c) data= (%s)",flagis,argis); }C \ routine2(argno,argis) int argno; char argis[]; {B printf("arg %d is (%s) ",argno,argis); }G If the optional 5th argument is specified, then the treatment ofG the flag routine is somewhat different. In this case the flagG routine must return a value of 0 or 1. If 0 is returned, then theG action is as before. However, if a 1 is returned, then this causesG the flag routine to be rec ]alled for the same argument but theG pointer to the flag is incremented by 1. This permits arguments toG be concatonated (e.g. -abc is equivalent to -a -b -c). When thereG are no more characters in the current argument, the value of 1 returned is ignored. 2 hashingG This set of routines implements a dynamic hash table package. TheG routine stabinit creates and initializes a hash table returning aG pointer to be used to refer in subsequent cal ^ls to this table. AnyG number of tables are permitted. A symbol is simply a variableG length string of ascii characters that has a non zero valueG associated with it. Zero is used to indicate that a symbol has noG value (not in the hash table). Entries may be inserted, deleted,D looked up etc. The value stored may be an integer or a pointer. 3 stabinit - - - - - - - - - - - - - - -J char *stabinit(entries) which initializes a symbol table _ andJ int entries; returns a pointer to an internal table toJ - - - - - - - - - - - - - - - be used for all subsequent calls. TheJ value returned will be denoted here asJ returns pointer to sym block the stable. Entries is the number ofJ cells in the direct table. Colisions are: handled by a linked list. 3 sinstall - - - - - - - - - - - - - - -M PSYMBLOCK sins`tall(stable,sym,p) This routine takes the stable pointer toJ char *stable,*sym,*p; be a hash table Which it should insert aJ - - - - - - - - - - - - - - - symbol into. The symbol is assumed to notJ be there already. It hashes the symbolJ returns pointer to symbol sees if there is a colision, and if soI block links this symbol in with any precedingJ one. The hash location is a a longwordJ pointer to a list of doubly linked symbolH blocks. P is a non-zero datum associatedC with sym; its returned via slookup. 3 slookup - - - - - - - - - - - - - - -J char *slookup(stable,symbol) This returns the data value contained inJ char *stable,*symbol; the data portion of the symbol block. IfJ - - - - - - - - - - - - - - - the symbol is not in the table, then NULLJb is returned. Note that install will notJ also sets the hash index permit a value of NULL to be stored thereJ and the block addr into since that value could then corrupt theJ stable (for internal use) symbol table mechanism. It is assumedJ that a valid address (pointer) willJ always be there. Install will error exitC if a NULL value i cs to be inserted. 3 sdelete - - - - - - - - - - - - - - -J sdelete(stable,symbol) This deletes the symbol from the table.J char *stable,*symbol; If symbol is 0/1 then all entries in theJ - - - - - - - - - - - - - - - stable are removed and the stable blockG returns 1 = ok is effectively deleted (for symbol=0).B 0 = no symbol found (only entries deleted if symbol=1) 3 sdump - - - - - - - - - - - - - - -J sdump(stable,routine) d This calls routine for each symbol in theG char *stable,*routine; table. The call to routine is with theJ - - - - - - - - - - - - - - - address of the symbol string and the data6 value cell. Called as: 7 routine(symbol,value,hashvalue,sblockptr,stable)  - - - - - - - - - - - - - - -K listing() A default routine for sdump. Lists symbolsL - - - - - - - - - - - - - - - on the stderr stream. When routine ise NULL.   3 formats ( - - - - - - - - - -' Hash table format) - - - - - - - - - -- (Note: spare cells not shown)   Hash Table (stable) ---------------------- |stats, sizes, etc. | 1-k | | ---------------------- 3 ... symbol block; ---------------------- ----------------------L |loc for f this sym | n ---> | data value (p) | <--> next symbol; ---------------------- ----------------------: | stats, misc info |: ... ----------------------; | string containing |; ---------------------- -- --; | |last | symbol (symbol) |; ---------------------- ---------------------- 2 isatty__g___isambx_____isasysNAME isa???SYNOPSIS$ isatty(ioptr) FILE *ioptr;$ isambx(ioptr) FILE *ioptr;$ isasys(ioptr) FILE *ioptr; DESCRIPTIONG These all return a 0 or 1 for the truth of the question beingG asked. Isatty determines if the file opened is actually aG terminal, isambx returns true if the file is a mailbox device, andG isasys returns true if the file is a process permanent file (i.e. it has the name !hSYS$...)2 myttyNAME myttySYNOPSIS' mytty(ttyname) char ttyname[]; DESCRIPTIONI Returns to the string ttyname a null terminated string with theI name of the terminal from which the program was run. This is: useful for generating unique file or mailbox names.2 nargsNAME nargsSYNOPSIS nargs() DESCRIPTION? This routine returns the number of arguments for+ the function in whicih nargs is invoked.2 moveb______initbNAME moveb initb movetcSYNOPSIS? moveb(from,to,nchar) char from[],to[]; int nchar;? initb(ival,to,nchar) char ival, to[]; int nchar; movetc(from,too,n,tbl) DESCRIPTIONG Moveb moves NCHAR characters of text from array FROM to array TO.G Absolutely no checking is performed, the implementation is using aG single hardware instruction to perform the move. This is a vjeryG fast routine. For more information check the hardware manual forG the movc3 instruction. Note that in particular, overlapping of& FROM and TO are handled correctly.G Initb initializes an array of bytes to ival. TO is the array,% whose length is NCHAR bytes long.2 posNAME posSYNOPSIS+ pos(in,of,st) char in[],of[]; int st; DESCRIPTIONG finds position inside IN of the string OF starting the search atG positionk ST. It returns 0 if not found else position. Note that% one orgin idices are used for ST.9 e.g. pos("in-here","he",1) returns 49 pos("abc-abc","ab",3) returns 59 pos("abc-abc","ab",7) returns 02 rawmtNAME rawmtSYNOPSIS. stat := mtput(ioptr,buffer,buffersize)6 stat := mtget(ioptr,buffer,buffersize,&insize)2 stat := mtfunc(ioptr,function,parm1,parm2) DESCRIPTIONF l This is the raw io for magtape. It uses the fopen and set rawF features but only to get at the unit. Then the user must directly& call any of: mtget, mtput, mtfunc. / Some error checking is done on get and put. 3 example example: K io := fopen("mt:","write") -- write allows both read and writeB setrawmt(io) -- but causes eof on close) stat := mtput(io,buf,100,&insize)  J io := fopen("mt:","read"m) -- read allows both read and write? setrawmt(io) -- no auto eof on close mtfunc(io,#io$_rewind)$ mtfunc(io,#io$_skiprecord,5)" mtfunc(io,#io$_skipfile,1)- stat := mtfunc(io,#io$_skiprecord,-1) 2 settmoNAME settmoSYNOPSIS4 settmo(ioptr,seconds) FILE *ioptr; int seconds; DESCRIPTIONG This routine allows the user to set a time out value in the rab.G It also then sets the record optionns to tmo to enable timeout.G Usually this option is used with a mailbox. It allows the user toG write to a mailbox without waiting for something else in theG system to read from the mailbox. If this is the intended use then" seconds should be set to zero. 2 setpmtNAME setpmtSYNOPSIS8 setpmt(ioptr,string) FILE *ioptr; char string[]; DESCRIPTIONG This routine sets the prompt address and size into the the rabG control blocok. It allows the user to specify that if the inputG file is a terminal, then all input should be preceded by a prompt. 2 searchNAME searchSYNOPSIS# char *nextf(ioptr) FILE *ioptr;' FILE *search(string) char string[]; DESCRIPTIONG Search initializes a search loop. Returns a FILE pointer. ThisG pointer is used in subsequent NEXT calls to get file name strings.@ String is a wild card pattern VMS style. e.g. "[root...]p*.c"G Nextf returns a pointer to a null terminated string which is theG full file name for the next string in the search path OR NULL ifG no more files to be found. Only on the last entry is the data+ structures for this search deallocated.G For example, the following program will print a directory list on the standard output file. #include 4 main(argc,argv) int argc; char *argv[];{$ FILE *ioptr; char *fqile;, ioptr = search(argv[1]);( if (ioptr == NULL) {P exit(1); /* no files at all, or bad syntax */ } for (;;){, file = nextf(ioptr);+ if (file == NULL) {? break; /* no more files */ }, printf("%s\n",file); } }rG Warning, do not modify the string returned as a pointer. This willG cause rms to fail in some situations. Always, copy the string into( a local area before messing with it.2 segNAME segSYNOPSIS4 seg(s,in,from,too) char *s,*in; int from,too; DESCRIPTIONG extracts segment in IN positions FROM to TO. Result into s,@ returns length of s. One origin indices are used throughout. 2 stolowerNAME stolowerSYNOPSIS!s char *stolower(a) char a[];! char *stoupper(a) char a[]; DESCRIPTIONG These both operate directly on the string A in place. They convertG it either to UPPER or LOWER case as per name. Each return theirG argument A such that they may be used in a call that requires A but in a particular case. Example:F printf("message in lower=%s\n",stolower(message)); 2 strcopyNAME strcopySYNOPSIS st!trcopy(a,b) char a[],b[] DESCRIPTION* copies b into a; b must be big enough. 2 strlenNAME strlenSYNOPSIS strlen(s) char *s; DESCRIPTION3 Returns the length of a null terminated string. 2 translateNAME translateSYNOPSISB translate(instring,outstring) char instring[],outstring[]; DESCRIPTIONF Searches the logical name tables for instring, and places theF result in outstring if it exists, otherwise outstruing is set to aF null string. In either case, the function returns outstring. Note. that case of the instring is significant. 2 valNAME valSYNOPSIS& val(s,base) char *s; int base; DESCRIPTIONG returns the binary value of the ascii string in s. Base may beG 2-16. and may have a '-' sign for two's compliment of resultant value. 2 UnixStrs3 strcat /*H * Concatenate s2 on the end of s1. S1's space must be large enovugh. * Return s1. */ char * strcat(s1, s2)  3 strcatn /*H * Concatenate s2 on the end of s1. S1's space must be large enough.% * At most n characters are moved. * Return s1. */ char * strcatn(s1, s2, n) 3 strcmp /*7 * Compare strings: s1>s2: >0 s1==s2: 0 s1s2: >0 s1==s2: 0 s1s2: >0 s1==s2: 0 s1 open the file for update rather than a new version 3 set_cmd. function set_cmd(cmd:byte,text[]:bytes)ŒE sets buffer cmd to text. if the buffer already exists, it( is overwritten (efectively). 3 get_cmd! function get_cmd(cmd:byte)A Returns a pointer to the text string for bufferA "cmd". If no buffer exists, then returns NULL (0). 3 del_cmd! function del_cmd(cmd:byte)A Deletes the buffer for "cmd". If the buffer wasA found and successfully deleted, 1 is returned. IfA the buffer was not found, or an attempt to deleteA buffer 'a' occurs then nothing is deleted and a 0 is returned. 3 get_lh function get_lh()A This returns the pointer to the buffer listhead.A It permits the user to do anything to the list ofA command definitions. see savebuf.h for buffer definitions. 3 set_call_back+ function set_call_back(code,rŽoutine)A This function permits the caller to get controlA on certain control character inputs. The callerA provides a code (0..31) (32=rubout) to which aA routine will be called on the occurrance of theA input control character. The calling sequence to the caller is: : routine(string,outbuf,dispbuf,prompt,term) where:D string - the c urrently input string, null terminated- outbuf - a replacement stringD dispbuf- a string to output if requested (on return)@ prompt - the current prompt being used for input1 term - the terminator character9 The routine can return 3 values as follow:E 0 - causes the control character to be eaten butE nothing else happens. outbuf and dispbuf areE ign ored. This esentially permits transparentE nooping of the char except for the fact that theE routine called my do things to global variables as it pleases. E 1 - a control sequence is output which returns theE cursor to column 1, a clear to end of line isE output, and then the outbuf is displayed. outbufE also replaces the currently input line ‘ and the< cursor is placed at the end of the line. E 2 - outbuf replaces inbuf. Dispbuf is output exactlyE as it is setup, no additional cursor movement isE performed. This permits total control by the user.E This buffer can contain anything to reformat the display. E 3 - Causes a normal processing to be done on this keyE as though there w ’ere a temporary clearing of theE call_back dispatch. This is used where the programE examines the input buffer and decides that thereE is nothing special to be done and reverts to theE action which would have occured had there been no' call_back dispatch. E 4 - This causes the current buffer to become theE output buffer with the last character in th “eE buffer treated as the terminator character (itE must be 0..31). This terminator character isE deleted from the buffer and processing continuesC as though the user had entered this terminator. 3 out_string+ function out_string(string[,length])A This takes string and outputs it to the terminalA without any carriage control added. If length isA su”pplied, then it is the assumed length of string2 (else string is null terminated). 2 Standard_in_out_errorF These routines return the value of the cell stdin, stdout, stderr,F or stdcmd. They are used in places where one uses a ioptr. For! example: getc(valof_stdin()) valof_stdin valof_stdout valof_stderr valof_stdcmdF These routines return the address of where the 4 cells are in theF event one would wish to change there contents. • All this is- required to permit shared pic libraries. addr_stdin addr_stdout addr_stderr addr_stdcmd 2 computeF This set of routines implements an internal arithmetic expressionF evaluator. It accepts a string with an expression and produces aF value. There can also be upto 26 variables (a..z) and the callerF can specify synonyms for these. A formated error string can beF sent to a user specified error routine. Assignments are permittedF –and the package keeps 26 internal double precision values. ThereF are two routines to retreive and set these internal values whichD correspond to variables a,b,c...z (or the associated synonyms). 3 compute_exprC compute_expr(string[]:byte, astring[]:byte, flag, err , value[])9 char string[],astring[]; int flag,*err(); double *value;0 string - is an asciz input string> astring - is an asciz associated variable string> flag - 0 = no — verbose 1 = verbose (debugging)9 err - routine to call with error stringH value - is the address of a 8 byte (double) return valueF This routine computes the value of the string in "string"F returning a value in value. The function returns 0/1 according toF whether any errors occured. All computations are performed in! double precision arithmetic. 4 string: String is an asciz expression as input to any of the desk calculato˜rs. 5 operators- = assignment a=b, ~ ones compliment ~a- ^ exclusive or a^b- & bitwise and a&b- | bitwise or a|b- + add a-b- / divide a/b- * muliply a*b- % remainder a%b- - subtract a-b 5 func™tionsThe following function ABS(x)0 MAX(x,y,z...) maximum of n arguments0 MIN(x,y,z...) minimum of n arguments! SIGN(x) 1 or -1 SIN(x) COS(x) TAN(x)+ INT(x) integer part of x* POWER(x,y) x to the y power 4 astringF This is a string which specifies which of the variables a..z have synonyms. The format is:  "a=aname b=bname ..."? Only the variables with synonym names need to šbe included. 3 get_vars" get_vars(here) double here[26];F This routine copies all 26 internal variables into the user specified array. 3 set_vars" set_vars(here) double here[26];F This routine copies into all 26 internal variables the user specified array. 2 waitK function wait(ftime,ast,astprm) ;wait floating point time ast and astprm are optional. ftime is floating point time 2 zfloats3 add_f function ›add_f(b,a) computes b + a3 cmp_f function cmp_f(a,b) compares a to b a < b -1 a = b 0 a > b 13 sub_f function sub_f(b,a) computes b - a3 mul_f function mul_f(b,a) computes b * a3 div_f function div_f(b,a) computes b / a3 int_f function int_f(a) computes int(float)3 flt_f function flt_f(a) computes float(int) 2 lowlevel function _put(io,str,size)# function _get(io,str,size,insize) 2 mapping 3 mapfile( œfunction mapfile(filename[]:byte,extent,, uflags,cluster,output[],status[],verbose) FILENAME - is ascizI EXTENT - is in bytes, (if larger than file, then minimum is used)? FLAGS - is the flags argument, or -1 to accept defaultI CLUSTER - is the cluster size to use, 0 = sysgen parm, else 1..127 I OUTPUT - address of mapped section if successful (else undefined)8 STATUS - on an error, this is the message numberD VERBOSE - is an debugging parm 1 = print status and debugging9 0 = suppress status = it returns a control block address which is used when laterL unmapping the region. If it could not map the region, then a 0 is returned ? if the input parameters are invalid, this routine calls error 3 options4function mapfile_options(space1,space2,mod,gsection); mapfile_options - preset varying options for file mapping D All parameters are required, but if entered as -1 they ž are ignored& (i.e.) they don's set those options. 1 space1 - address for beginning of range1 space2 - address for end of range+ mod - mode 0=kernel 3=user etc9 gsection- asciz name of global section to set up A If gsection is specified, then defaults for the flag in mapfileF are changed to include the gbl attribute. If specified but "" (null)A then it cancels the global section settings (flags default too) H If space1&2 are set,Ÿ then if expreg is not used in flags, these valuesK specify the absolute bounds for the section, which must be page alligned.G If expreg is used, then it determines only if p0 or p1 space is used.3 unmap#function unmapfile(control,verbose)> unmapfile - undo the mapping to a file, return control block B CONTROL - pointer to the control block returned by mapfile? VERBOSE - 0 = do not report status on stderr, 1 = do so 3 extend=function extendfile(name[]:byt e,size,delta,*oldsize,*newsize)' extendfile - extend the size of a file - name - asciz name of file to be extended size - number of blocks@ delta - if 0 then extend file to size, 1 extend by size blks? oldsize - address of a long to store old file size (optional)E newsize - address of a long to store new file size (optional)3 savefunction mapfile_saveC This saves the current mapfile options. It is a 1 level stack. 3 restorefunction mapfile_restore¡F This restores the current mapfile options from the save area. It is a 1 level stack. 2 desc_new 3 descriptor descriptor(string[]:byte)E Allocates a descriptor and sets it according to the asciz stringE parameter. Statically saves the last 25 string descriptors in aE ring buffer. This is used for temporary descriptors in calls toE system stuff. After 25 descriptors have been allocated, the 1st isA returned to storage pool and a new descriptor is all¢ocated ... 9 The input string is not modified, i.e. only referenced. 3 get_descEfunction get_desc(addr,len) ;len optional, get_desc("str") 1 shot use register *n{ n := new(12) if nargs() >= 25 set_desc(n,addr,len) ;force length5 elseif nargs() >= 1 ;if just addr set_desc(n,addr) fi return n} 3 set_desc'function set_desc(desc,addr[]:byte,len) register *n{ £n := desc if nargs() >= 3 n[0,word] := len else) n[0,word] := strlen(addr) fi n[1,long] := addr# n[2,byte] := #dsc$k_dtype_t# n[3,byte] := #dsc$k_class_s return n}2 crc_162 result := crc_16(address_in , size , initial_crc); returns a 16 bit value (high order bits 16-31 are cleared)2 quadsfunction time_quad(*a:byte,b)function clr_quad(a[2])function neg_quad(a[2])function add_qua¤d(a,b)function sub_quad(a,b)Kfunction cmp_quad(a,b) ;return -1..+1 [-1=> a a=b] else +12 stubsFA stub library is invoked via: .stub_library(libraryname,s1,s2,...,sN)GThere is also the macro LIBRARY which is defined to be the stub library@to be used by default. There is a macro SSLIB which is invoked:  SSLIB({s1,s2,...,sN})3 clib.wait(seconds,ast_routine,ast_parm) is variable!moveb(*from:byte,*To:byte,nbytes)initb(value,*To:byte,nbytes)exit(errcode) ¥ ;fclose(*ioptr:byte) ;feof(*ioptr:byte) ;ferror(*ioptr:byte) ;fflush(*ioptr:byte) ;fgetc(*ioptr:byte) ;!fgets(*string:byte,n,*ioptr:byte)=fopen(*filename:byte,*type:byte,*class:byte,user) is variable=fprintf(*ioptr:byte,*format:byte) is variablefputc(c,*ioptr:byte) ;fputs(*string:byte,*ioptr:byte)"freopen(filename,type,*ioptr:byte)>fscanf(*ioptr:byte,*format:byte) is variablegetc(*ioptr:byte) ;getchar ¦ ;gets(*string:byte) ;$printf(*format:byte) is variableputc(c,*ioptr:byte) ;putchar(c) ;puts(*string:byte) ;$scanf(*format:string) is variable>sprintf(*string:byte,*format:byte) is variableungetc(c,*ioptr:byte) ;access(*filename:byte,mode)%atodesc(*ascii:byte,*descriptor:byte)atof(*string:byte) ;>cat(*out:byte,*string:byte) is variablecompile(*regexp:byte) ;cmap(*filename:b§yte,size);cmapzero(*filename:byte,size)$cmapcluster(value,space) is variablecunmap(*ptr:byte,size) ;%desctoa(*descriptor:byte,*ascii:byte)&eq(*stringa:byte,*stringb:byte,length)!etoa(number,*out:byte,prec,width)fields(*string:byte,vector[]) filetime(*ioptr:byte,timebuf[2])!ftoa(number,*out:byte,prec,width)fullname(*ioptr:byte) ;@getargs(argc,argv[],sb1,sb2,flag) is variableisambx(*ioptr:byte) ;isasys(*ioptr:byte) ;isatty(*ioptr:byte) ;R¨item_list(req_item,req_buffer[]:byte,code,len,addr[]:byte,*lenaddr) is defaultablematch(*string:byte) ;max(x, y) ;min(x, y) ;mytty(*ttyname:byte) ;nargs ;nextf(*ioptr:byte) ;pos(*in:byte,*of:byte,start) recmp(*regexp:byte,*string:byte)repos(*in:byte,*of:byte) ;*reseg(*out:byte,*in:byte,*of:byte,inverse)search(*string:byte) ;"seg(*string:byte,*in:byte,from,To) setpmt(*ioptr:byte,*string:byte)settmo(*ioptr:byte,s©econds)setraw(*ioptr:byte) ;setchar(*ioptr:byte,chars)stolower(*string:byte) ;stoupper(*string:byte) ;(strcopy(*tostring:byte,*fromstring:byte)strlen(*string:byte) ;val(*string:byte,base) ;3 ss5sys$adjstk(acmode,adjust,newadr) is defaultable,risky.sys$adjwsl(pagcnt,wsetlm) is defaultable,risky;sys$alloc(devnam,phylen,phybuf,acmode) is defaultable,risky3sys$ascefc(efn,name,prot,perm) is defaultable,risky<sys$asctim(timlen,timbuf,timadr,cvtflg) is defaultable,risky ª:sys$assign(devnam,chan,acmode,mbxnam) is defaultable,risky.sys$bintim(timbuf,timadr) is defaultable,risky=sys$brdcst(msgbuf,devnam, flags, carcon) is defaultable,risky%sys$cancel(chan) is defaultable,risky'sys$canexh(desblk) is defaultable,risky.sys$cantim(reqidt,acmode) is defaultable,risky.sys$canwak(pidadr,prcnam) is defaultable,risky#sys$clref(efn) is defaultable,risky.sys$cmexec(routin,arglst) is defaultable,risky.sys$cmkrnl(routin,arglst) is defaultable,risky<sys$cntreg(pagcnt,re«tadr,acmode,Region) is defaultable,risky<sys$crelog(tblflg,lognam,eqlnam,acmode) is defaultable,riskyOsys$crembx(prmflg,chan,maxmsg,bufquo,promsk,acmode,lognam) is defaultable,riskymsys$creprc(pidadr,image,input,output,error,prvadr,quota,prcnam,baspri,uic,mbxunt,stsflg) is defaultable,risky4sys$cretva(inadr,retadr,acmode) is defaultable,riskygsys$crmpsc(inadr,retadr,acmode,flags,gsdnam,ident,relpag,chan,pagcnt,vbn,prot,pfc) is defaultable,risky$sys$dacefc(efn) is defaultable,risky.sys$dalloc ¬(devnam,acmode) is defaultable,risky%sys$dassgn(chan) is defaultable,risky5sys$dclast(astadr,astprm,acmode) is defaultable,risky3sys$dclcmh(addres,prvhnd,type) is defaultable,risky'sys$dclexh(desblk) is defaultable,risky5sys$dellog(tblflg,lognam,acmode) is defaultable,risky%sys$delmbx(chan) is defaultable,risky.sys$delprc(pidadr,prcnam) is defaultable,risky4sys$deltva(inadr,retadr,acmode) is defaultable,risky6sys$deq(lkid,valblk,acmode,flags) is defaultable,risky3sys$dgblsc(flags,gsdna ­m,ident) is defaultable,risky-sys$dismou(devnam,flags) is defaultable,risky%sys$dlcefc(name) is defaultable,risky\sys$enq(efn,lkmode,lksb,flags,resnam,parid,astadr,astprm,blkast,acmode) is defaultable,risky]sys$enqw(efn,lkmode,lksb,flags,resnam,parid,astadr,astprm,blkast,acmode) is defaultable,risky#sys$exit(code) is defaultable,risky<sys$expreg(pagcnt,retadr,acmode,Region) is defaultable,risky<sys$fao(ctrstr,outlen,outbuf ) is defaultable,variable,risky:sys$faol(ctrstr,outlen,outbuf,prml®st) is defaultable,risky3sys$forcex(pidadr,prcnam,code) is defaultable,riskyAsys$getchn(chan,prilen,pribuf,scdlen,scdbuf) is defaultable,riskyCsys$getdev(devnam,prilen,pribuf,scdlen,scdbuf) is defaultable,riskyRsys$getdvi(efn,chan,devnam,itmlst,iosb,astadr,astprm,nullarg) is defaultable,riskyMsys$getjpi(efn,pidadr,prcnam,itmlst,iosb, astadr,astprm) is defaultable,riskyAsys$getmsg(msgid,msglen,bufadr,flags,outadr) is defaultable,riskyJsys$getsyi(efn,null0,null1,itmlst,iosb,astadr,astprm) is ¯ defaultable,risky'sys$gettim(timadr) is defaultable,risky'sys$hiber is defaultable,risky;sys$input(chan,length,buffer,iosb,efn) is defaultable,risky4sys$lckpag(inadr,retadr,acmode) is defaultable,risky4sys$lkwset(inadr,retadr,acmode) is defaultable,riskyNsys$mgblsc(inadr,retadr,acmode,flags,gsdnam,ident,relpag) is defaultable,risky&sys$mount(itmlst) is defaultable,risky.sys$numtim(timbuf,timadr) is defaultable,risky@sys$output(chan, length, buffer, iosb, efn) is defaultable,risky °&sys$purgws(inadr) is defaultable,risky=sys$putmsg(msgvec,actrtn,facnam, actprm) is defaultable,riskyPsys$qio(efn,chan,func,iosb,astadr,astprm,p1,p2,p3,p4,p5,p6) is defaultable,riskyQsys$qiow(efn,chan,func,iosb,astadr,astprm,p1,p2,p3,p4,p5,p6) is defaultable,risky*sys$readef(efn,state) is defaultable,risky.sys$resume(pidadr,prcnam) is defaultable,risky<sys$schdwk(pidadr,prcnam,daytim,reptim) is defaultable,risky'sys$setast(enbflg) is defaultable,risky#sys$setef(efn) is defaultable,risky< ±sys$setexv(vector,addres,acmode,prvhnd) is defaultable,risky'sys$setime(timadr) is defaultable,risky9sys$setimr(efn,daytim,astadr,reqidt) is defaultable,risky.sys$setpra(astadr,acmode) is defaultable,risky9sys$setpri(pidadr,prcnam,pri,prvpri) is defaultable,risky'sys$setprn(prcnam) is defaultable,risky@sys$setprt(inadr,retadr,acmode,prot,prvprt) is defaultable,risky<sys$setprv(enbflg,prvadr,prmflg,prvprv) is defaultable,risky'sys$setrwm(watflg) is defaultable,risky'sys$setsfm(enbflg) is ²defaultable,risky'sys$setswm(swpflg) is defaultable,risky,sys$sndacc(msgbuf,chan) is defaultable,risky'sys$snderr(msgbuf) is defaultable,risky,sys$sndopr(msgbuf,chan) is defaultable,risky,sys$sndsmb(msgbuf,chan) is defaultable,risky.sys$suspnd(pidadr,prcnam) is defaultable,riskyIsys$trnlog(lognam,rsllen,rslbuf,table,acmode,dsbmsk) is defaultable,risky4sys$ulkpag(inadr,retadr,acmode) is defaultable,risky4sys$ulwset(inadr,retadr,acmode) is defaultable,risky-sys$unwind(depadr,newpc) is defa³ultable,riskyRsys$updsec(inadr,retadr,acmode,updflg,efn,iosb,astadr,astprm) is defaultable,risky$sys$waitfr(efn) is defaultable,risky,sys$wake(pidadr,prcnam) is defaultable,risky)sys$wfland(efn,mask) is defaultable,risky(sys$wflor(efn,mask) is defaultable,risky3 screenscr_init(terminal_type_code)scr_push ;scr_pop ;scr_save_window ;scr_restore_window(window);Bscr_write_window(req_window,left,right,top,bottom) is variableŽscr_menu ´_pick(req_menu[],req_text1[]:byte,req_text2[]:byte,req_left,req_right,req_top,req_bottom,border,suppress,start,*action) is defaultablescr_home ;scr_clear ;.scr_bottom(n) is variable!scr_window(left,right,top,bottom)scr_nufram ;scr_init(type) ;scr_putc(c) ;$scr_printf(*format:byte) is variable$scr_center(*format:byte) is variablescr_moveb(*from:byte,n) ;scr_goto(col,lin) ;(µscr_go(col,lin) is defaultable%scr_ceol(col,lin) is variable&scr_ceop(col,pline) is variablescr_fullwindow ;&scr_border(shrink) is variable&scr_borderwindow(shrink) is variablescr_scroll ;scr_getline(lin,here[]:byte,pn)scr_copyline(from,To,offset)!scr_getabsline(lin,here[]:byte,n)scr_moveabscur(col,row) ;scr_movecur(col,row) ;&scr_getc(echo) is variablescr_str(descripter[]:long);6scr_get_term(f¶ile[]:byte,addr[]:byte) is variable!scr_getstring(col,lin,max_length)zscr_get_window(*outstring:byte,text[]:byte,left,right,top,bottom,suppress,*action,action_parm,border,under) is defaultable 2 itemlst/stub item_list(req_item,req_buffer[]:byte,code,0 len,addr[]:byte,*lenaddr) is defaultable! item_list(item=1, buffer = mybuffer, code = #jpi$_diocnt, addr = void(&diocnt) )! item_list(item=2, buffer · = mybuffer, code = #jpi$_biocnt, addr = void(&biocnt) )! item_list(item=3, buffer = mybuffer, code = #jpi$_tqlm, addr = void(&tqlm) )! item_list(item=4, len = 128, lenaddr = &lenimage, buffer = mybuffer,! code = #jpi$_imagname,# addr = void(&image_name) )! item_list(item=5,% code = 0, ;end list buffer = mybuffer)ww