ADDSET (2) 11/13/78 ADDSET (2) NAME addset - put c in array(j) if it fits, increment j SYNOPSIS stat = addset(c, array, j, maxsize) character c, array(ARB) integer j # j is incremented integer maxsize integer stat returned as YES/NO DESCRIPTION Adds a character at a time to a specified position of an array and increments the index. It also checks that there's enough room to do so. The array is an ascii character array stored one character per word. 'c' is a single ascii character. YES is returned if the routine succeeded, otherwise NO. SEE ALSO scopy, stcopy, addstr, concat DIAGNOSTICS None -1- CANT (2) 11/13/78 CANT (2) NAME cant - print 'name: can't open' and terminate execution SYNOPSIS call cant(name) character name(ARB) DESCRIPTION On ERROUT, prints the filename specified by 'name' followed by the message "can't open" and terminates execution. All open files are closed. Name is an ascii character array terminated with an EOS marker. Cant is essentially: call putlin (name, ERROUT) call remark (": can't open.") call endst(ERR) SEE ALSO error, remark DIAGNOSTICS None -1- CHCOPY (2) 03/23/80 CHCOPY (2) NAME CHCOPY - copy character into array, bump pointer SYNOPSIS subroutine chcopy(c, buf, i) character c, buf(ARB) integer i DESCRIPTION `chcopy' copies `c' into `buf(i)', increments `i' and places an EOS in this next free location. SEE ALSO stcopy - copy string, advancing pointer BUGS -1- CLOWER (2) 11/13/78 CLOWER (2) NAME clower - fold c to lower case SYNOPSIS c = clower(c) character c DESCRIPTION Fold character c to lower case, if not already there. If c is not alphabetic, returns it unchanged. SEE ALSO fold, upper, lower, clower DIAGNOSTICS None -1- CONCAT (2) 7/23/80 CONCAT (2) NAME concat - concatenate 2 strings together SYNOPSIS call concat(buf1, buf2, outstr) character buf1(ARB), buf2(ARB), outstr(ARB) DESCRIPTION Copies the arrays buf1 and buf2 into the array outstr. All arrays are ascii character arrays stored one character per array element. SEE ALSO scopy, stcopy, addset, addstr DIAGNOSTICS None -1- CTOI (2) 11/13/78 CTOI (2) NAME ctoi - convert string at in(i) to integer, increment i SYNOPSIS n = ctoi(in, i) character in(ARB) integer i # i is incremented integer n is returned as the converted integer DESCRIPTION Converts a character string to an integer. Starts looking at position i of in. Plus and minus signs are not allowed. Leading blanks and tabs are ignored; any subsequent digits are converted to the correct numeric value. The first non-digit seen terminates the scan; upon return, i points to this position. n is returned as the value of the integer. The in array is an ascii character array terminated with an EOS marker (or a non-numeric character). Zero is returned if no digits are found. SEE ALSO itoc DIAGNOSTICS There are no checks for machine overflow. -1- CUPPER (2) 11/13/78 CUPPER (2) NAME cupper - convert character to upper case SYNOPSIS c = cupper(c) character c DESCRIPTION Converts ascii character c to upper case, if not already there. Non-alphabetic characters are returned unchanged. SEE ALSO upper, clower, fold, lower DIAGNOSTICS None -1- DELETE (2) 03/23/80 DELETE (2) NAME DELETE - remove a symbol from a symbol table SYNOPSIS subroutine delete (symbol, table) character symbol (ARB) pointer table DESCRIPTION 'Delete' removes the character-string symbol given as its first argument from the symbol table given as its second argument. All information associated with the symbol is lost. The symbol table specified must have been generated by the routine 'mktabl'. If the given symbol is not present in the symbol table, 'delete' does nothing; this condition is not considered an error. IMPLEMENTATION 'Delete' calls 'stlu' to determine the location of the given symbol in the symbol table. If present, it is unlinked from its hash chain. The dynamic storage space allocated to the symbol's node is returned to the system by a call to 'dsfree'. CALLS stlu, dsfree SEE ALSO enter (2), lookup (2), mktabl (2), rmtabl (2), dsget (2), dsfree (2), dsinit (2), sctabl (2) -1- DSFREE (2) 03/23/80 DSFREE (2) NAME DSFREE - free a block of dynamic storage SYNOPSIS subroutine dsfree (block) pointer block DESCRIPTION 'Dsfree' returns a block of storage allocated by 'dsget' to the available space list. The argument must be a pointer returned by 'dsget'. See the remarks under 'dsget' for required initialization measures. IMPLEMENTATION 'Dsfree' is an implementation of Algorithm B on page 440 of Volume 1 of The Art of Computer Programming, by Donald E. Knuth. The reader is referred to that source for detailed information. 'Dsfree' and 'dsget' maintain a list of free storage blocks, ordered by address. 'Dsfree' searches the list to find the proper location for the block being returned, and inserts the block into the list at that location. If blocks on either side of the newly-returned block are available, they are coalesced with the new block. If the block address does not correspond to the address of any allocated block, 'dsfree' remarks "attempt to free unallocated block" and returns. BUGS The algorithm itself is not the best. SEE ALSO dsget (2), dsinit (2) -1- DSGET (2) 03/23/80 DSGET (2) NAME DSGET - obtain a block of dynamic storage SYNOPSIS pointer function dsget (w) integer w DESCRIPTION 'Dsget' searches its available memory list for a block that is at least as large as its first argument. If such a block is found, its index in the memory list is returned; otherwise, the value LAMBDA is returned. In order to use 'dsget', the following declaration must be present: DS_DECL (mem, MEMSIZE) where MEMSIZE is supplied by the user, and may take on any positive value between 6 and 32767, inclusive. Furthermore, memory must have been initialized with a call to 'dsinit': call dsinit (MEMSIZE) IMPLEMENTATION 'Dsget' is an implementation of Algorithm A' on pages 437-438 of Volume 1 of The Art of Computer Programming, by Donald E. Knuth. The reader is referred to that source for detailed information. 'Dsget' searches a linear list of available blocks for one of sufficient size. If none are available, a null pointer (LAMBDA) is returned; otherwise, the block found is broken into two pieces, and the index (in array 'mem') of the piece of the desired size is returned to the user. The remaining piece is left on the available space list. Should this procedure cause a block to be left on the available space list that is smaller than a threshhold size, the few extra words are awarded to the user and the block is removed entirely, thus speeding up the next search for space. CALLS BUGS It is somewhat annoying for the user to have to declare the storage area, but Fortran prevents effective use of pointers, so this inconvenience is necessary for now. Note that the storage area is declared as _i_n_t_e_g_e_r_, not _c_h_a_r_a_c_t_e_r_, which may be cause for caution in some implementations. SEE ALSO dsfree (2), dsinit (2) -1- DSINIT (2) 03/23/80 DSINIT (2) NAME DSINIT - initialize dynamic storage space SYNOPSIS subroutine dsinit (w) integer w DESCRIPTION 'Dsinit' initializes an area of storage in the common block CDSMEM so that the routines 'dsget' and 'dsfree' can be used for dynamic storage allocation. The memory to be managed must be supplied by the user, by a declaration of the form: DS_DECL (mem, MEMSIZE) which turns into something similar to integer mem (MEMSIZE) common /cdsmem/ mem The memory size must then be passed to 'dsinit' as its argument: call dsinit (MEMSIZE) IMPLEMENTATION 'Dsinit' sets up an available space list consisting of two blocks, the first empty and the second containing all remaining memory. The first word of memory (below the available space list) is set to the total size of memory; this information is used only by the dump routines 'dsdump' and 'dsdbiu'. CALLS error SEE ALSO dsget (2), dsfree (2) -1- ENTER (2) 03/23/80 ENTER (2) NAME ENTER - place symbol in symbol table SYNOPSIS integer function enter (symbol, info, table) character symbol (ARB) integer info (ARB) pointer table DESCRIPTION 'Enter' places the character-string symbol given as its first argument, along with the information given in its second argument, into the symbol table given as its third argument. The symbol table used must have been created by the routine 'mktabl'. The size of the info array must be at least as large as the symbol table node size, determined at table creation time. Should the given symbol already be present in the symbol table, its information field will simply be overwritten with the new information. 'Enter' uses the dynamic storage management routines, which require initialization by the user; see 'dsinit' for further details. If the symbol and associated information were successfully entered into the table, the value of OK is returned; otherwise, ERR is returned. IMPLEMENTATION 'Enter' calls 'stlu' to find the proper location for the symbol. If the symbol is not present in the table, a call to 'dsget' fetches a block of memory of sufficient size, which is then linked onto the proper chain from the hash table. Once the location of the node for the given symbol is known, the contents of the information array are copied into the node's information field. CALLS stlu, dsget SEE ALSO lookup (2), delete (2), mktabl (2), rmtabl (2), dsget (2), dsfree (2), dsinit (2), sctabl (2) -1- EQUAL (2) 11/13/78 EQUAL (2) NAME equal - compare str1 to str2; return YES if equal SYNOPSIS stat = equal(str1, str2) character str1(ARB), str2(ARB) integer stat is returned as YES/NO DESCRIPTION Compares two strings, returning YES if they are the same, NO if they differ. Each string is an ascii character array terminated with an EOS marker. SEE ALSO strcmp DIAGNOSTICS None -1- ERROR (2) 7/23/80 ERROR (2) NAME error - print single-line message and terminate execution SYNOPSIS call error (message) integer message #message is a hollerith array DESCRIPTION Error writes the message onto the standard error file ERROUT. A NEWLINE is always generated, even though one may not appear in the message. Endst is called and execution ceases. Error is essentially a call to 'remark' and then to 'endst'. The message array is a Fortran hollerith string in the format generated by the Ratfor quoted string capability. On some systems, it may be necessary to terminate the string with a '.' or other end-of-string marker. SEE ALSO remark, putlin, prompt, endst DIAGNOSTICS None -1- FCOPY (2) 11/13/7 FCOPY (2) NAME fcopy - copy file in to file out SYNOPSIS call fcopy (in, out) integer in, out DESCRIPTION Assuming that both files are opened, positioned, and ready to go, the routine copies lines from the current file position until an EOF is reached on file 'in'. 'in' and 'out' are file identifiers returned by open or create. IMPLEMENTATION 'Fcopy' simply makes repeated calls to getlin and putlin. SEE ALSO open, create, getlin, putlin DIAGNOSTICS None -1- FMTDAT (2) 09/25/80 FMTDAT (2) NAME FMTDAT - convert date information to character string SYNOPSIS subroutine fmtdat (date, time, now, form) character date (ARB), time (ARB) integer now (7), form DESCRIPTION 'Fmtdat' is used to convert date information (such as that provided by 'getnow') into human-readable graphics. The first argument is a character string to receive the representation of the current date. The second argument is a character string to receive the representation of the current time. The third argument is a date specification in the same 7-word integer array format as is returned by 'getnow' (year including century, month, day, hour, minute, second, millisecond). The fourth argument selects the format of the character representations; a value of DIGIT causes the date to formatted as MM/DD/YY, whereas a value of LETTER causes the format to be DD-MMM-YY, where MMM is the first three letters of the month name. IMPLEMENTATION Simple integer-to-character conversions. ARGUMENTS MODIFIED date, time SEE ALSO getnow (2), date (1) -1- FOLD (2) 11/13/78 FOLD (2) NAME fold - convert string to lower case SYNOPSIS call fold (str) character str(ARB) DESCRIPTION Converts the array 'str' to lower case characters. Non-alphabetic characters are left unchanged. The 'str' array is ascii characters terminated by an EOS marker. (This routine is exactly the same as 'lower'.) SEE ALSO clower, cupper, upper, lower DIAGNOSTICS None -1- GETC (2) 11/10/78 GETC (2) NAME getc - read character from standard input SYNOPSIS c = getc (c) character c DESCRIPTION Getc reads the next character from the standard input. The character is returned in ascii format both as the functional return and in the parameter c. If the end of a line has been encountered, NEWLINE is returned. If the end of the file has been encountered, EOF is returned. If the input file is not ascii, characters are mapped into their corresponding ascii format. SEE ALSO getch, getlin DIAGNOSTICS None -1- GETWRD (2) 11/13/78 GETWRD (2) NAME getwrd - get non-blank word from in(i) into out, increment i SYNOPSIS size = getwrd(in, i, out) character in(ARB), out(ARB) integer i # i is incremented integer size is returned as the length of the word found DESCRIPTION Starting at position 'i' in array 'in', skips any leading blanks and tabs and returns the next word and its length. A word is any series of characters terminated by a BLANK, TAB, or NEWLINE. The terminator is not returned as part of the word. 'i' is incremented to the position just past the end of the word. The word is returned in array 'out'. Both 'in' and 'out' are ascii character arrays terminated with an EOS marker. SEE ALSO skipbl DIAGNOSTICS None -1- IMGET (2) 03/23/80 IMGET (2) NAME IMGET - fetch next token from in-memory sort area SYNOPSIS integer function imget(table, buf) pointer table character buf(ARB) DESCRIPTION `imget' fetches the next token from the in-memory sort area pointed to by `table', which was returned as the function value if an `iminit' call. If there is another token which has not been fetched yet, it is returned in `buf' and a value of OK is returned as the value of the function; otherwise, the value EOF is returned. SEE ALSO iminit - initialize in-memory sort area imput - put another token into in-memory sort area imsort - sort tokens in in-memory sort area BUGS -1- IMINIT (2) 03/23/80 IMINIT (2) NAME IMINIT - initialize in-memory sort area SYNOPSIS pointer function iminit(memsiz, avetok) integer memsiz, avetok DESCRIPTION `iminit' initializes the dynamic storage region (via a `dsinit' call) and allocates a block of pointers for future use by `imget', `imput' and `imsort'. The pointer to this block of pointers is returned as the value of the function. The program calling `iminit' must have made the following declaration DS_DECL(Mem,memsiz) to cause the memory area used by the dynamic storage routines to be allocated. `avetok' is an estimate of the average length of the tokens which will be inserted into the dynamic memory via `imput' calls. SEE ALSO dsinit - initialize dynamic storage region imput - put token into in-memory sort area imget - fetch token from in-memory sort area imsort - sort tokens in in-memory sort area BUGS -1- IMPATH (2) 03/23/80 IMPATH (2) NAME IMPATH - return standard search path SYNOPSIS subroutine impath(path) character path(arith(3,*,FILENAMESIZE)) DESCRIPTION `impath' returns the standard search path for known files to the user in `path'. The standard search path is current working directory, user's home directory, ~usr/ and ~bin/. The format of the search path may be discerned by reading the manual entry for `loccom'. SEE ALSO loccom - locate command along search path BUGS -1- IMPUT (2) 03/23/80 IMPUT (2) NAME IMPUT - place token into in-memory sort area SYNOPSIS integer function imput(table, buf) pointer table character buf(ARB) DESCRIPTION `imput' places the token passed in `buf' into the in-memory sort area pointed to by `table', which was returned as the function value of an `iminit' call. If there is room for the token, a value of OK is returned as the function value; otherwise, a value of ERR is returned. SEE ALSO iminit - initialize in-memory sort area imget - fetch next token from in-memory sort area imsort - sort tokens in in-memory sort area BUGS -1- IMSORT (2) 03/23/80 IMSORT (2) NAME IMSORT - sort tokens in in-memory sort area SYNOPSIS subroutine imsort(table) pointer table DESCRIPTION `imsort' sorts the string tokens stored in the in-memory sort area pointed to by `table', which was returned as the function value of a previous `iminit' call. The strings are sorted according to the ASCII collating sequence, with all characters being significant. Upon completion, the tokens may be fetched via `imget' calls in sorted order. SEE ALSO iminit - initialize in-memory sort area imput - place tokens into in-memory sort area imget - fetch next token from in-memory sort area BUGS -1- INDEX (2) 11/13/78 INDEX (2) NAME index - find character c in string str SYNOPSIS loc = index(str, c) character str(ARB), c integer loc is returned as the location is str where c was located DESCRIPTION Returns the index of the first character in 'str' that matches 'c', or zero if 'c' isn't in the array. 'Str' is an ascii character array terminated with an EOS marker. 'c' is a single ascii character. SEE ALSO match, getpat DIAGNOSTICS None -1- INIHLP (2) 03/23/80 INIHLP (2) NAME INIHLP - initialize help facility on help archive SYNOPSIS integer function inihlp(file, ptrara, ptrsiz, unit) integer ptrsiz, unit linepointer ptrara(ptrsiz) character file(FILENAMESIZE) DESCRIPTION `inihlp' opens `file' at READ access, and notes the disk address of each archive header in the linepointer array, `ptrara'. If the number of headers is larger than `ptrsiz', only `ptrsiz' addresses are noted. The ratfor unit for using `mrkhlp' and `puthlp' is returned in `unit'. If the file could not be opened, ERR is returned as the function value; otherwise, OK is returned. SEE ALSO mrkhlp - mark elements matching pattern puthlp - output elements specified in pointer array markl - note disk address of current record BUGS -1- ITOC (2) 11/13/78 ITOC (2) NAME itoc - convert integer to character string SYNOPSIS length = itoc(int, str, size) integer int, size character str(ARB) integer length returned as the number of characters needed DESCRIPTION Converts an integer 'int' to characters in array 'str', which is at most 'size' characters long. 'length' is returned as the number of characters the integer took, not including the EOS marker. Characters are stored in ascii character arrays terminated with an EOS marker. Negative numbers are handled correctly. SEE ALSO ctoi, putdec, putint DIAGNOSTICS None -1- LENGTH (2) 11/13/78 LENGTH (2) NAME length - compute length of string SYNOPSIS n = length(str) character str(ARB) integer n returned as the number of characters in str DESCRIPTION Computes the length of a character string, excluding the EOS. The string is an ascii character array terminated with an EOS marker. SEE ALSO DIAGNOSTICS None -1- LOGPMT (2) 03/23/80 LOGPMT (2) NAME LOGPMT - `prompt' with history mechanism SYNOPSIS integer function logpmt(pstr, buf, fd) character pstr(ARB), buf(MAXLINE) integer fd DESCRIPTION `logpmt' is semantically the same as `prompt', with the addition that is keeps a log of each line returned to the user, and permits the user to recall and edit lines previously entered. The writeup for `hsh', the history shell, may be consulted for the syntax of the history manipulating commands. SEE ALSO prompt - prompt for input form teletype channels rawpmt - `prompt' with raw I/O capabilities BUGS -1- LOOKUP (2) 03/23/80 LOOKUP (2) NAME LOOKUP - retrieve information from a symbol table SYNOPSIS integer function lookup (symbol, info, table) character symbol (ARB) integer info (ARB) pointer table DESCRIPTION 'Lookup' examines the symbol table given as its third argument for the presence of the character-string symbol given as its first argument. If the symbol is not present, 'lookup' returns 'NO'. If the symbol is present, the information associated with it is copied into the information array passed as the second argument to 'lookup', and 'lookup' returns 'YES'. The symbol table used must have been created by the routine 'mktabl'. The size of the information array must be at least as great as the symbol table node size, specified at its creation. Note that all symbol table routines use dynamic storage space, which must have been previously initialized by a call to 'dsinit'. IMPLEMENTATION 'Lookup' calls 'stlu' to determine the location of the symbol in the table. If 'stlu' returns NO, then the symbol is not present, and 'lookup' returns NO. Otherwise, 'lookup' copies the information field from the appropriate node of the symbol table into the information array and returns YES. ARGUMENTS MODIFIED info CALLS stlu SEE ALSO enter (2), delete (2), mktabl (2), rmtabl (2), sctabl (2), dsinit (2), dsget (2), dsfree (2) -1- MKTABL (2) 03/23/80 MKTABL (2) NAME MKTABL - make a symbol table SYNOPSIS pointer function mktabl (nodesize) integer nodesize DESCRIPTION 'Mktabl' creates a symbol table for manipulation by the routines 'enter', 'lookup', 'delete', and 'rmtabl'. The symbol table is a general means of associating data with a symbol identified by a character string. The sole argument to 'mktabl' is the number of (integer) words of information that are to be associated with each symbol. The function return is the address of the symbol table in dynamic storage space (see 'dsinit' and 'dsget'). This value must be passed to the other symbol table routines to select the symbol table to be manipulated. Note that dynamic storage space must be initialized by a call to 'dsinit' before using any symbol table routines. IMPLEMENTATION 'Mktabl' calls 'dsget' to allocate space for a hash table in dynamic memory. Each entry in the hash table is the head of a linked list (with zero used as a null link) of symbol table nodes. 'Mktabl' also records the nodesize specified by the user, so 'enter' will know how much space to allocate when a new symbol is entered in the table. CALLS dsget SEE ALSO enter (2), lookup (2), delete (2), rmtabl (2), dsget (2), dsfree (2), dsinit (2), sctabl (2) -1- MRKHLP (2) 03/23/80 MRKHLP (2) NAME MRKHLP - mark help elements matching pattern SYNOPSIS integer function mrkhlp(unit, ptrara, key, outara) linepointer ptrara(ARB), outara(ARB) integer unit character key(ARB) DESCRIPTION `mrkhlp' goes through the set of archive modules pointed to by `ptrara' and copies those which match the pattern specified by `key' into `outara', terminating the list with an element having the value NULLPOINTER. If the key is one of the strings "%" or "?", all elements in `ptrara' are copied into `outara'; otherwise, only the module with a name which matches `key' exactly (via an `equal' call) is copied. If none of the modules match `key', ERR is returned; otherwise, OK is returned. SEE ALSO inihlp - initialize help archive for processing puthlp - output help archive modules specified equal - determine if two character strings are strictly equal BUGS -1- NGETCH (2) 03/23/80 NGETCH (2) NAME NGETCH - get a (possibly pushed back) character SYNOPSIS character function ngetch(c, fd) character c integer fd DESCRIPTION `ngetch' fetches the next character into the variable `c' and also returns it as its value. If there are any characters on the push back buffer, the most recently pushed back character will be returned and removed from the buffer. SEE ALSO putbak - push character onto push back buffer pbstr - push string onto push back buffer pbinit - initialize push back buffer BUGS -1- PBINIT (2) 03/23/80 PBINIT (2) NAME PBINIT - initialize push-back buffer SYNOPSIS subroutine pbinit DESCRIPTION `pbinit' permits the user to initialize the push-back buffer without knowledge of its implementation. After initialization, `ngetch', `putbak' and `pbstr' may be used. SEE ALSO ngetch - fetch a possibly pushed back character putbak - push character onto push-back buffer pbstr - push string back onto push-back buffer BUGS -1- PBSTR (2) 03/23/80 PBSTR (2) NAME PBSTR - push string onto push back buffer SYNOPSIS subroutine pbstr(in) character in(ARB) DESCRIPTION `pbstr' pushes the characters in the string `in' onto the push back buffer, from which they will be retrieved via future `ngetch' calls. If there is insufficient room in the buffer for the characters, an error message to that effect is displayed and the program terminated. SEE ALSO pbinit - initialize push back buffer putbak - push character onto push back buffer ngetch - get a (possibly pushed back) character BUGS -1- PUTBAK (2) 03/23/80 PUTBAK (2) NAME PUTBAK - push character onto push back buffer SYNOPSIS subroutine putbak(c) character c DESCRIPTION `putbak' pushes `c' onto the push back buffer, from which it will be removed via a future `ngetch' call. If there is no room for the character, an error message will be displayed to that effect and the program terminated. SEE ALSO pbinit - initialize push back buffer pbstr - push string onto push back buffer ngetch - get a (possibly pushed back) character BUGS -1- PUTC (2) 11/10/78 PUTC (2) NAME putc - write character to standard output SYNOPSIS call putc (c) character c DESCRIPTION Putc writes a character onto the standard output file (STDOUT). If c is a NEWLINE character, the appropriate action is taken to indicate the end of the record on the file. The character is assumed to be in ascii format; however, if the output file is not ascii, characters are mapped into their corresponding format. SEE ALSO putch, putlin DIAGNOSTICS None -1- PUTDEC (2) 11/13/78 PUTDEC (2) NAME putdec - write integer n in field width >=w SYNOPSIS call putdec(n, w) integer n, w DESCRIPTION This routine writes onto the standard output the number 'n' as a string of at least 'w' characters, including a sign if 'n' is negative. If fewer than 'w' characters are needed, blanks are inserted to the left to make up the count; if more than 'w' are needed, more are provided. SEE ALSO itoc, putint DIAGNOSTICS None -1- PUTHLP (2) 03/23/80 PUTHLP (2) NAME PUTHLP - output marked modules from help archive SYNOPSIS subroutine puthlp(unit, outara, key, out, putout) linepointer outara(ARB) integer unit, out character key(ARB) external putout DESCRIPTION `puthlp' outputs the help archive entries marked in `outara' onto ratfor unit `out' using the external routine `putout' via calls of the form call putout(buf, out) in a format depending upon `key'. If `key' is the string "%", only the first line of each marked entry is output; otherwise, the second through n-th lines of each entry is output. SEE ALSO inihlp - initialize help archive mrkhlp - mark help archive entries matching pattern BUGS -1- PUTINT (2) 7/23/80 PUTINT (2) NAME putint - write integer n onto file fd in field width >=w SYNOPSIS call putint(n, w, fd) integer n, w, fd DESCRIPTION This routine writes on the file specified by 'fd' the number 'n' as a string of at least 'w' characters, including a sign if 'n' is negative. If fewer than 'w' characters are needed, blanks are inserted to the left to make up the count; if more than 'w' are needed, more are provided. If 'w' is negative, the number is left-justified in the field. 'Fd' is a a file descriptor as returned by open or create. SEE ALSO itoc, putdec DIAGNOSTICS None -1- PUTSTR (2) 7/23/80 PUTSTR (2) NAME putstr - write str onto file fd in field width >=w SYNOPSIS call putstr(str, w, fd) character str(ARB) integer w, fd DESCRIPTION Putstr writes the character string 'str' onto the file specified by 'fd', in a field at least 'w' characters long. If fewer than 'w' characters are needed, blanks are inserted to the left to make up the count; if more than 'w' are needed, more are provided. If 'w' is negative, the characters are left-justified in the field. 'Fd' is a a file descriptor as returned by open or create. SEE ALSO putch, putlin, remark, error DIAGNOSTICS None -1- QUERY (2) 09/25/80 QUERY (2) NAME QUERY - print command usage information on request SYNOPSIS subroutine query (usage) hollerith_string usage (ARB) DESCRIPTION Many Software Tools commands will supply usage information when invoked with a single argument consisting only of a question mark. 'Query' exists to simplify this convention for the programmer. The sole argument is a period-terminated hollerith literal, such as that passed to 'error'. When called, 'query' checks to see that the command calling it was invoked with exactly one argument, and that that argument is a question mark. If so, the usage message is passed along to 'error' and the command terminates. If not, 'query' returns quietly. IMPLEMENTATION Two calls to 'getarg', some tests, and a call to 'error'. CALLS error SEE ALSO error (2) -1- RAWPMT (2) 03/23/80 RAWPMT (2) NAME RAWPMT - `prompt' with raw I/O capabilities SYNOPSIS integer function rawpmt(pstr, buf, fd) character pstr(ARB), buf(MAXLINE) integer fd DESCRIPTION `rawpmt' is semantically the same as `prompt' with the addition of providing word rubout and TENEX-style file recognition through the use of RAW terminal I/O. The writeup on `rsh', the raw shell may be consulted for the exact form of the special commands to cause `rawpmt' to perform these deeds. SEE ALSO `prompt' - prompt for input from teletype channels logpmt - `prompt' with history capabilities BUGS -1- RMTABL (2) 03/23/80 RMTABL (2) NAME RMTABL - remove a symbol table SYNOPSIS subroutine rmtabl (table) pointer table DESCRIPTION 'Rmtabl' is used to remove a symbol table created by 'mktabl'. The sole argument is the address of a symbol table in dynamic storage space, as returned by 'mktabl'. 'Rmtabl' deletes each symbol still in the symbol table, so it is normally not necessary to empty a symbol table before deleting it. However, if the information associated with a symbol includes a pointer to dynamic storage space, the space will not be reclaimed. (This problem can be averted by scanning the symbol table with 'sctabl' and freeing dynamic objects, then removing the symbol table with 'rmtabl'.) Please see the manual entry for 'dsinit' for instructions on initializing the dynamic storage space used by the symbol table routines. IMPLEMENTATION 'Rmtabl' traverses each chain headed by the hash table created by 'mktabl'. Each symbol table node encountered along the way is returned to free storage by a call to 'dsfree'. Once all symbols are removed, the hash table itself is returned by a similar call. CALLS dsfree SEE ALSO mktabl (2), enter (2), lookup (2), delete (2), dsget (2), dsfree (2), dsinit (2), sctabl (2) -1- SCOPY (2) 11/13/78 SCOPY (2) NAME scopy - copy string at from(i) to to(j) SYNOPSIS call scopy(from, i, to, j) character from(ARB), to(ARB) integer i, j DESCRIPTION Copies the (sub)string of 'from', starting in location 'i', into array 'to', starting at 'j'. SEE ALSO stcopy, addset, addstr, concat DIAGNOSTICS None -1- SCTABL (2) 03/16/80 SCTABL (2) NAME SCTABL - scan all symbols in a symbol table SYNOPSIS integer function sctabl (table, symbol, info, posn) pointer table, posn integer info (ARB) character symbol (ARB) DESCRIPTION 'Sctabl' provides a means of accessing all symbols present in a symbol table (c.f. 'mktabl') without knowledge of the table's internal structure. After a simple initialization (see below), successive calls to 'sctabl' return symbols and their associated information. When the return value of 'sctabl' is EOF, the entire table has been scanned. The first argument is the index in dynamic storage of the symbol table to be accessed. (This should be the value returned by 'mktabl'.) The second and third arguments receive the character text of and integer information associated with the symbol currently under scan. The fourth argument is used to keep track of the current position in the symbol table. It must be initialized to zero before 'sctabl' is called for the first time for a given scan. The function return is EOF when the entire table has been scanned, not EOF otherwise. IMPLEMENTATION If 'posn' is zero, 'sctabl' assigns to it a pointer to a two word context block which was allocated along with the symbol table hash table entries. These words are used to keep track of (1) the hash table bucket currently in use and (2) the position in the bucket's list of the next symbol. If a symbol is available in the current list, 'sctabl' returns its data and records the position of the next symbol in the list; otherwise, it moves to the next bucket and examines that list. If there are no more buckets in the symbol table, EOF is returned as the function value. Incidentally, 'posn' is set to zero when the end of the table is encountered. ARGUMENTS MODIFIED symbol, info, posn CALLS -1- SCTABL (2) 03/16/80 SCTABL (2) dsget, dsfree BUGS A call to 'enter' must be made to update the information associated with a symbol. If new symbols are entered or old symbols deleted during a scan, the results are unpredictable. The argument order is bogus; all the other symbol table routines have the table pointer as the last argument. SEE ALSO lookup (2), delete (2), mktabl (2), rmtabl (2), dsget (2), dsfree (2), dsinit (2) -2- STRCPY (2) 03/23/80 STRCPY (2) NAME STRCPY - copy one string to another SYNOPSIS subroutine strcpy(from, to) character from(ARB), to(ARB) DESCRIPTION `strcpy' simply copies the `from' string to the `to' string. It is exactly equivalent to "scopy(from, 1, to, 1)" but substantially easier to type and usually generates more compact and efficient Fortran code. SEE ALSO scopy - copy one string to another BUGS -1- TBINIT (2) 03/23/80 TBINIT (2) NAME TBINIT - initialize simple lookup table SYNOPSIS subroutine tbinit(size) integer size DESCRIPTION `tbinit' causes a symbol table to be created for the user by calling `mktabl' in anticipation of calling `tbinst' and `tblook', thus providing the same functionality as the old `lookup' and `instal' routines from rat4 without forcing the user to worry about the dynamic storage manipulation routines. `size' is the size of the dynamic storage region declared in the caller via DS_DECL(Mem,size) SEE ALSO tbinst - install (name,defn) pair in lookup table tblook - lookup name in table and return defn if found BUGS -1- TBINST (2) 03/23/80 TBINST (2) NAME TBINST - install (name,defn) pair in lookup table SYNOPSIS subroutine tbinst(name, defn) character name(ARB), defn(ARB) DESCRIPTION `tbinst' installs the (name,defn) pair in the lookup table initialized by a `tbinit' call. If there is no room in the table, the message "in tbinst: no room for new definition." is displayed and control returned to the user. SEE ALSO tbinit - initialize simple lookup table tblook - look up name in simple lookup table BUGS -1- TBLOOK (2) 03/23/80 TBLOOK (2) NAME TBLOOK - look up name in simple lookup table SYNOPSIS integer function tblook(name, defn) character name(ARB), defn(ARB) DESCRIPTION `tblook' looks up `name' in the lookup table. If found, its definition is copied into `defn' and the value YES returned as the function value; otherwise, NO is returned. SEE ALSO tbinit - initialize simple lookup table tbinst - install (name,defn) pair into lookup table BUGS -1-