#-h- acopy 630 asc 03-aug-83 01:35:44 tools (lblh csam sventek) Acopy (3) 15-Mar-82 Acopy (3) NAME Acopy - copy n characters from one file to another SYNOPSIS subroutine acopy(ifd, ofd, n) integer n filedes ifd, ofd DESCRIPTION `acopy' copies `n' characters from `ifd' to `ofd', both of which are assumed open. If an EOF is encountered on `ifd' before `n' characters have been copied, the routine simply returns. SEE ALSO DIAGNOSTICS none -1- #-h- adddi 950 asc 03-aug-83 01:35:45 tools (lblh csam sventek) Adddi (3) 15-Mar-82 Adddi (3) NAME Adddi - add double integers together SYNOPSIS adddi(dbl1,dbl2) integer dbl1(2), dbl2(2) expands into: { dbl2(1) = dbl2(1) + dbl1(1) dbl2(2) = dbl2(2) + dbl1(2) if (dbl2(2) >= 10000) { dbl2(1) = dbl2(1) + 1 dbl2(2) = dbl2(2) - 10000 } } DESCRIPTION Invocation of this macro causes the first double integer argument to be added to the second. If a carry is necessary, it is performed. See the entry for `initdi' for more information on double integers. SEE ALSO initdi(3), incrdi(3), decrdi(3), subdi(3) DIAGNOSTICS -1- #-h- addset 904 asc 03-aug-83 01:35:45 tools (lblh csam sventek) Addset (3) 13-Nov-78 Addset (3) 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(3), stcopy(3), concat(3) DIAGNOSTICS None -1- #-h- addstr 1051 asc 03-aug-83 01:35:45 tools (lblh csam sventek) Addstr (3) 17-Sep-81 Addstr (3) NAME Addstr - add string s to str(j) if it fits, increment j SYNOPSIS stat = addstr(s, str, j, maxsize) character s(ARB), str(ARB) integer j # j is incremented integer maxsize integer stat returned as YES/NO DESCRIPTION Copies the string 's' to array 'str', starting in location 'j'. `j' is incremented to point to the next free position in 'str'. If the addition of `s' to `str' will exceed its maximum length (maxsize), no copying is done and the status NO is returned. Both `s' and `str' are ascii character arrays stored one character per array element. YES is returned if the routine succeeded, otherwise NO. SEE ALSO scopy(3), stcopy(3), addset(3), concat(3) DIAGNOSTICS None -1- #-h- adrfil 544 asc 03-aug-83 01:35:46 tools (lblh csam sventek) Adrfil (3) 15-Mar-82 Adrfil (3) NAME Adrfil - get name of user-information database file SYNOPSIS subroutine adrfil(file) character file(FILENAMESIZE) DESCRIPTION `adrfil' returns the local file specification for the user-information database file, known as "~msg/address". SEE ALSO mailid(2), homdir(2) DIAGNOSTICS none -1- #-h- agetch 988 asc 03-aug-83 01:35:46 tools (lblh csam sventek) Agetch (3) 14-Mar-82 Agetch (3) NAME Agetch - get next character from an archive module SYNOPSIS character function agetch(c, fd, size) character c filedes fd integer size(2) DESCRIPTION `agetch' fetches the next character from the archive module opened on `fd' and returns it in the variable `c' and as the value of the function. The `size' argument is that returned by an `aopen' or `agethd' call, and is decremented by `agetch' to reflect the decrease in size of the remainder of the module. If the end of the module is detected, or a true end of file is detected on `fd', the value EOF is returned. SEE ALSO agethd(3), agtlin(3), aopen(3), askip(3) DIAGNOSTICS Returns EOF if end of module is detected. -1- #-h- agethd 1188 asc 03-aug-83 01:35:47 tools (lblh csam sventek) Agethd (3) 14-Mar-82 Agethd (3) NAME Agethd - get next archive header from file SYNOPSIS integer function agethd(fd, buf, size, fsize) filedes fd character buf(MAXLINE) integer size(2), fsize(2) DESCRIPTION `agethd' reads the next line from the archive module represented by the file descriptor `fd' and the size `fsize'. If the line is of the form of an archive header, the name of the module is placed in `buf', and the size of the module is placed in `size', with `fsize' decremented to represent the decrease in size of the containing module. The value OK is returned if successful. If an end of module is detected, the value EOF is returned, and if the line read is not of the proper format, a value of ERR is returned. SEE ALSO agetch(3), agtlin(3), aopen(3), askip(3) DIAGNOSTICS Returns EOF on end of module and ERR if improper archive format. -1- #-h- agtlin 905 asc 03-aug-83 01:35:47 tools (lblh csam sventek) Agtlin (3) 14-Mar-82 Agtlin (3) NAME Agtlin - get next line from an archive module SYNOPSIS integer function agtlin(buf, fd, size) character buf(MAXLINE) filedes fd integer size(2) DESCRIPTION `agtlin' fetches the next line of input from the archive module represented by the arguments `fd' and `size'. If another line is found, it is placed in `buf', `size' is decremented by the number of characters in the line, and this number is returned as the value of the function. If an end of module is detected, a value of EOF is returned. SEE ALSO agetch(3), agethd(3), aopen(3), askip(3) DIAGNOSTICS Returns EOF if end of module is detected. -1- #-h- alldig 552 asc 03-aug-83 01:35:48 tools (lblh csam sventek) Alldig (3) 15-Mar-82 Alldig (3) NAME Alldig - determine if string is all digits SYNOPSIS integer function alldig(str) character str(ARB) DESCRIPTION `alldig' determines if the given string is all digits. If this is true, the value YES is returned, otherwise, NO. SEE ALSO type(3) DIAGNOSTICS A value of NO is returned if not all digits. -1- #-h- amatch 1299 asc 03-aug-83 01:35:48 tools (lblh csam sventek) Amatch (3) 23-Jul-80 Amatch (3) NAME Amatch - look for pattern matching regular expression SYNOPSIS integer function amatch(line, from, pat, tagbeg, tagend) character line(ARB) integer from, pat(MAXPAT) integer tagbeg(10), tagend(10) (element "i+1" returns start or end, respectively, of "i"th tagged sub-pattern) DESCRIPTION Amatch scans 'line' starting at location 'from', looking for a pattern which matches the regular expression coded in 'pat'. If the pattern is found, the next available location in `line' is returned. If the pattern is not found, amatch returns 0. The regular expression in 'pat' must have been previously encoded by 'getpat' or 'makpat'. (For a complete description of regular expressions, see the writeup on the editor.) Amatch is a special-purpose version of match, which should be used in most cases. SEE ALSO match(3), getpat(3), makpat(3), ed(1) DIAGNOSTICS A value of 0 is returned if the pattern does not match. -1- #-h- aopen 1602 asc 03-aug-83 01:35:49 tools (lblh csam sventek) Aopen (3) 14-Mar-82 Aopen (3) NAME Aopen - open archive module for reading SYNOPSIS filedes function aopen(name, fd, size) character name(FILENAMESIZE) filedes fd integer size(2) DESCRIPTION `aopen' opens the archive module specified in `name' for reading with subsequent calls to `agetch' and `agtlin'. If the open is successful, the resulting file descriptor is placed in `fd', as well as returned as the function value; the size of the module is placed in the variable `size'. Failure is signalled by returning a value of ERR. The format of the name specification is quite straight-forward; the syntax is: filename[`module]... If no module names are specified, `aopen' is equivalent to an `open' call at READ access, and an "infinite" module size is placed in `size'. EXAMPLES character c character agetch integer size(2) filedes fd filedes aopen string name "rlib.w`lib.r`arsubs.r`aopen" if (aopen(name, fd, size) == ERR) call cant(name) while (agetch(c, fd, size) != EOF) call putch(c, STDOUT) call close(fd) SEE ALSO agetch(3), agethd(3), agtlin(3), askip(3) DIAGNOSTICS Returns ERR if the specified archive module cannot be opened. -1- #-h- argtab 696 asc 03-aug-83 01:35:49 tools (lblh csam sventek) Argtab (3) 15-Mar-82 Argtab (3) NAME Argtab - fetch tab information from command line SYNOPSIS subroutine argtab(buf) character buf(MAXLINE) DESCRIPTION `argtab' reads the command line arguments, using `getarg', and copies those arguments which `detab' and `entab' understand into `buf', separated by blank characters. This is in preparation for calling `settab' to set the TAB stops. SEE ALSO settab(3), detab(1), entab(1), getarg(2) DIAGNOSTICS none -1- #-h- askip 1371 asc 03-aug-83 01:35:50 tools (lblh csam sventek) Askip (3) 14-Mar-82 Askip (3) NAME Askip - skip rest of archive module contents SYNOPSIS subroutine askip(fd, size, fsize) filedes fd integer size(2), fsize(2) DESCRIPTION `askip' skips the number of characters indicated by `size' in the archive module specified by `fd' and `fsize'. `fsize' is decreased by the number of characters skipped. This routine is handy when using `aopen' to open a nested archive, and then scanning the archive modules at that level for the ones of interest. EXAMPLES character buf(MAXLINE) integer size(2), fsize(2) integer agethd filedes fd filedes aopen string name "rlib.w`lib.r" string line "The modules contained in rlib.w`lib.r are:@n" if (aopen(name, fd, fsize) == ERR) call cant(name) call putlin(line, STDOUT) while (agethd(fd, buf, size, fsize) == OK) { call putlin(buf, STDOUT) call putch('@n', STDOUT) call askip(fd, size, fsize) } call close(fd) SEE ALSO agetch(3), agethd(3), agtlin(3), aopen(3) DIAGNOSTICS -1- #-h- badarg 571 asc 03-aug-83 01:35:50 tools (lblh csam sventek) Badarg (3) 15-Mar-82 Badarg (3) NAME Badarg - output "invalid argument" message SYNOPSIS subroutine badarg(arg) character arg(ARB) DESCRIPTION `badarg' displays the following message on Error Output: ? Ignoring invalid argument `' where is replaced by the contents of `arg'. SEE ALSO getarg(2) DIAGNOSTICS none -1- #-h- bubble 606 asc 03-aug-83 01:35:51 tools (lblh csam sventek) Bubble (3) 15-Mar-82 Bubble (3) NAME Bubble - bubble sort integers SYNOPSIS subroutine bubble(v, n) integer n, v(n) DESCRIPTION `bubble' performs a bubble sort on the integers v(1) ... v(n). As is well known, the bubble sort algorithm should only be used for very small arrays. If larger arrays need to be sorted, see the entry on `shell'. SEE ALSO shell(3) DIAGNOSTICS none -1- #-h- cant 639 asc 03-aug-83 01:35:51 tools (lblh csam sventek) Cant (3) 13-Nov-78 Cant (3) NAME Cant - print "Can't open" message and terminate execution SYNOPSIS call cant(name) character name(ARB) DESCRIPTION Prints an error message (on ERROUT) indicating file "name" could not be opened. All open files are closed and execution is terminated. Name is an ascii character array terminated with an EOS marker. SEE ALSO error(3), remark(2) DIAGNOSTICS None -1- #-h- catsub 1262 asc 03-aug-83 01:35:52 tools (lblh csam sventek) Catsub (3) 15-Mar-82 Catsub (3) NAME Catsub - add replacement text to new buffer SYNOPSIS subroutine catsub(lin, from, to, sub, new, k, maxnew) integer from, to, k, maxnew character lin(MAXLINE), new(maxnew), sub(ARB) DESCRIPTION The string represented by lin(from) ... lin(to-1) is replaced according to the instructions in `sub'(which has been generated via a call to `getsub' or `maksub'); the replacement text is appended to `new' starting at position `k'. `k' is incremented as the substitutions are added, and points to the EOS location `new' upon return. `maxnew' represents the maximum size of `new'. If an illegal tagged pattern (section) has been specified in `sub', the error message ? In CatSub: illegal section. is displayed to the user on Error Output. SEE ALSO getpat(3), makpat(3), amatch(3), getsub(3), maksub(3) DIAGNOSTICS If an illegal section is specified, a comment to that effect is displayed on Error Output. -1- #-h- chcopy 671 asc 03-aug-83 01:35:52 tools (lblh csam sventek) Chcopy (3) 15-Mar-82 Chcopy (3) NAME Chcopy - copy character into buffer, increment pointer, EOS terminate 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 after `c' in `buf'. This routine assumes that there is enough room in `buf' for BOTH the character and the EOS. SEE ALSO addset(3), stcopy(3), scopy(3) DIAGNOSTICS none -1- #-h- clower 484 asc 03-aug-83 01:35:53 tools (lblh csam sventek) Clower (3) 13-Nov-78 Clower (3) 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(3), upper(3), clower(3) DIAGNOSTICS None -1- #-h- concat 732 asc 03-aug-83 01:35:53 tools (lblh csam sventek) Concat (3) 23-Jul-80 Concat (3) 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. It is perfectly legal for `buf1' and `outstr' to be the same arrays, which results in `buf2' being appended to `buf1'. SEE ALSO scopy(3), stcopy(3), addset(3) DIAGNOSTICS None -1- #-h- ctoc 1192 asc 03-aug-83 01:35:54 tools (lblh csam sventek) Ctoc (3) 23-Mar-80 Ctoc (3) NAME Ctoc - copy string-to-string, observing length limits SYNOPSIS integer function ctoc (from, to, len) integer len character from (ARB), to (len) DESCRIPTION 'Ctoc' copies an EOS-terminated unpacked string from one array to another, observing a maximum-length constraint on the destination array. The function return is the number of characters copied (i.e., the length of the string in the parameter 'to'). Note that the other string copy routine, 'scopy', is not protected; if the length of the source string exceeds the space available in the destination string, some portion of memory will be garbled. IMPLEMENTATION A simple loop copies characters from 'from' to 'to' until an EOS is encountered or all the space available in the destination array is used up. ARGUMENTS MODIFIED to SEE ALSO scopy(3), ctoi(3) -1- #-h- ctodi 704 asc 03-aug-83 01:35:54 tools (lblh csam sventek) Ctodi (3) 15-Mar-82 Ctodi (3) NAME Ctodi - convert character string to double integer array SYNOPSIS subroutine ctodi(buf, i, di) character buf(ARB) integer i, di(2) DESCRIPTION `ctodi' converts the numeric string starting at `buf(i)' into a double integer array, as described in `initdi'. The index `i' is left at the next character after the converted numeric string. SEE ALSO ditoc(3), initdi(3), incrdi(3), decrdi(3), adddi(3), subdi(3) DIAGNOSTICS none -1- #-h- ctoi 1100 asc 03-aug-83 01:35:55 tools (lblh csam sventek) Ctoi (3) 13-Nov-78 Ctoi (3) 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 Ctoi converts the character string at "in(i)" into an integer. A leading minus sign ('-') is 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(3) DIAGNOSTICS There are no checks for machine overflow. -1- #-h- cupper 515 asc 03-aug-83 01:35:55 tools (lblh csam sventek) Cupper (3) 13-Nov-78 Cupper (3) NAME Cupper - convert character to upper case SYNOPSIS c = cupper(c) character c DESCRIPTION CUPPER converts ascii character c to upper case, if not already there. Non-alphabetic characters are returned unchanged. SEE ALSO upper(3), clower(3), fold(3) DIAGNOSTICS None -1- #-h- decrdi 890 asc 03-aug-83 01:35:56 tools (lblh csam sventek) Decrdi (3) 15-Mar-82 Decrdi (3) NAME Decrdi - decrement double integer array SYNOPSIS decrdi(dblint) integer dblint(2) expands into: { dblint(2) = dblint(2) - 1 if (dblint(2) < 0) { dblint(1) = dblint(1) - 1 dblint(2) = 9999 } } DESCRIPTION Invocation of this macro causes the double integer argument to be decremented by one, with an appropriate carry occurring, if necessary. See the entry for `initdi' for more information on the double integer construct. SEE ALSO initdi(3), incrdi(3), adddi(3), subdi(3) DIAGNOSTICS -1- #-h- delete 1268 asc 03-aug-83 01:35:56 tools (lblh csam sventek) Delete (3) 23-Mar-80 Delete (3) 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(3), lookup(3), mktabl(3), rmtabl(3), stlu(3), dsget(3), dsfree(3), dsinit(3), sctabl(3) -1- #-h- disize 803 asc 03-aug-83 01:35:57 tools (lblh csam sventek) Disize (3) 15-Mar-82 Disize (3) NAME Disize - determine size of file as double integer array SYNOPSIS integer function disize(file, di) character file(FILENAMESIZE) integer di(2) DESCRIPTION `disize' opens `file', counts the number of characters as a double integer, closes the file, and returns the value OK. If the file could not be opened, a value of ERR is returned. Consult the entry for `initdi' for more information on double integers. SEE ALSO fsize(3), initdi(3) DIAGNOSTICS A value of ERR is returned if the file could not be opened. -1- #-h- ditoc 783 asc 03-aug-83 01:35:57 tools (lblh csam sventek) Ditoc (3) 15-Mar-82 Ditoc (3) NAME Ditoc - convert a double integer array to a character string SYNOPSIS integer function ditoc(di, buf, size) integer di(2), size character buf(size) DESCRIPTION `ditoc' converts the double integer in `di' into a character string in buf. The length of the generated string is returned as the value of the function. The entry on `initdi' can be consulted for more information on double integers. SEE ALSO ctodi(3), itoc(3), initdi(3), incrdi(3), decrdi(3), adddi(3), subdi(3) DIAGNOSTICS none -1- #-h- dopack 955 asc 03-aug-83 01:35:58 tools (lblh csam sventek) Dopack (3) 14-Mar-82 Dopack (3) NAME Dopack - pack words at TAB stops and flush line, if required SYNOPSIS subroutine dopack(word, nxtcol, rightm, buf, fd) filedes fd integer nxtcol, rightm character word(ARB), buf(MAXLINE) DESCRIPTION `dopack' packs `word' into `buf', aligning word at the next available tab stop, which are taken to be every 16 characters. If `buf' cannot be added to without exceeding `rightm', `buf' will be flushed to `fd' and `word' packed into `buf' starting in column 1. At least one word is packed into `buf', regardless of length, to assure that some progress is made in outputting the data. SEE ALSO inpack(3), flpack(3) DIAGNOSTICS none -1- #-h- dsdecl 1258 asc 03-aug-83 01:35:58 tools (lblh csam sventek) Dsdecl (3) 15-Mar-82 Dsdecl (3) NAME Dsdecl - declare storage for Dynamic Memory routines SYNOPSIS DS_DECL(Mem,MEM_SIZE) expands into: integer Mem(MEM_SIZE) character cMem(arith(MEM_SIZE,*,CHAR_PER_INT)) equivalence (Mem(1),cMem(1)) common / cdsmem / Mem DESCRIPTION This macro invocation must appear in the program units which invoke any of the following routines: dsinit, iminit, tbinit. This macro causes the common block which is used by the dynamic storage routines to be generated into the program with a size determined by the constant MEM_SIZE. The same value of MEM_SIZE must be used in the calls to dsinit, iminit and tbinit as is used in the DS_DECL declaration. The user must have defined MEM_SIZE prior to the invocation of DS_DECL, usually via a statement of the form define(MEM_SIZE,4000) for example. SEE ALSO dsinit(3), iminit(3), tbinit(3) DIAGNOSTICS -1- #-h- dsfree 1496 asc 03-aug-83 01:35:59 tools (lblh csam sventek) Dsfree (3) 23-Mar-80 Dsfree (3) 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 to the user. BUGS/DEFICIENCIES The algorithm itself is not the best. SEE ALSO dsget(3), dsinit(3) -1- #-h- dsget 2119 asc 03-aug-83 01:35:59 tools (lblh csam sventek) Dsget (3) 23-Mar-80 Dsget (3) 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 constant 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 value of 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. BUGS/DEFICIENCIES 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. SEE ALSO dsfree(3), dsinit(3), dsdecl(3) -1- #-h- dsinit 1151 asc 03-aug-83 01:36:00 tools (lblh csam sventek) Dsinit (3) 23-Mar-80 Dsinit (3) 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) The memory size must 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(3), dsfree(3), dsdecl(3) -1- #-h- entdef 949 asc 03-aug-83 01:36:00 tools (lblh csam sventek) Entdef (3) 14-Mar-82 Entdef (3) NAME Entdef - enter a new symbol definition, discarding any old one SYNOPSIS subroutine entdef(name, defn, table) character name(ARB), defn(ARB) pointer table DESCRIPTION `entdef' enters a (name,defn) pair into the symbol table `table'. If any old definitions for `name' exist, they are purged. `table' must have been obtained by a call to `mktabl'. If the (name,defn) pair cannot be stored in the table, the error message in entdef: no room for new definition. is displayed on error output. SEE ALSO mktabl(3), ludef(3) DIAGNOSTICS If the symbol definition cannot be entered, an error message is displayed to the user. -1- #-h- enter 1916 asc 03-aug-83 01:36:01 tools (lblh csam sventek) Enter (3) 23-Mar-80 Enter (3) 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. If the symbol is successfully entered in the table, the value of OK is returned; otherwise, the value ERR is returned. 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. 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(3), delete(3), mktabl(3), rmtabl(3), stlu(3), dsget(3), dsfree(3), dsinit(3), sctabl(3) -1- #-h- equal 622 asc 03-aug-83 01:36:01 tools (lblh csam sventek) Equal (3) 13-Nov-78 Equal (3) 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(3) DIAGNOSTICS None -2- #-h- error 1004 asc 03-aug-83 01:36:02 tools (lblh csam sventek) Error (3) 23-Jul-80 Error (3) 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(2), putlin(2), prompt(2), endst(2) DIAGNOSTICS None -1- #-h- esc 1473 asc 03-aug-83 01:36:02 tools (lblh csam sventek) Esc (3) 23-Jul-80 Esc (3) NAME Esc - map array(i) into escaped character, if appropriate SYNOPSIS character function esc(array, i) character array(ARB) integer i # i will be incremented DESCRIPTION This function checks array(i) for the existence of an escape character (as defined by ESCAPE in the general symbol definitions). If an escape is found and is appropriate, array(i+1) is returned as the escaped character. If no escape is found, the character `array(i)' is returned. Those characters which have special meaning are: b backspace (BS) ^H f formfeed (FF) ^L l linefeed (LF) ^J n newline (LF) ^J r return (CR) ^M t tab (HT) ^I In addition, specifying '@ddd', where '0' <= d <= '7', results in the encoding of a character with that octal representation. Therefore, a ^Z character (SUB or 8%026) could be specified as '@026'. If the character after the escape is not one of the above or a string of digits, then that character is returned, unchanged. SEE ALSO index(3), type(3) DIAGNOSTICS None -1- #-h- exppth 1290 asc 03-aug-83 01:36:03 tools (lblh csam sventek) Exppth (3) 15-Mar-82 Exppth (3) NAME Exppth - generate pointers to the path fields in a filename SYNOPSIS subroutine exppth(path, depth, ptr, buf) character path(FILENAMESIZE), buf(FILENAMESIZE) integer depth, ptr(MAXDIRECTS) DESCRIPTION Given a filename in path format in the array `path', `exppth' scans the pathname, filling in pointers to each path field in `ptr', and returns the number of path fields found in `depth'. EXAMPLES integer depth, ptr(MAXDIRECTS) character scr(FILENAMESIZE) string path "~bin/symbols" call exppth(path, depth, ptr, scr) Upon return from exppth, ptr(1) is 1, ptr(2) is 5, and depth is 2. The calling program can now access the individual path fields via invocations of the following form: i = ptr(2) junk = gtftok(path, i, scr) The second path field ("symbols") is now in `scr', awaiting further processing. SEE ALSO gtftok(3) DIAGNOSTICS none -1- #-h- fcopy 740 asc 03-aug-83 01:36:04 tools (lblh csam sventek) Fcopy (3) 13-Nov-78 Fcopy (3) 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(2), create(2), getlin(2), putlin(2) DIAGNOSTICS None -1- #-h- flpack 559 asc 03-aug-83 01:36:04 tools (lblh csam sventek) Flpack (3) 14-Mar-82 Flpack (3) NAME Flpack - flush any packed words SYNOPSIS subroutine flpack(nxtcol, rightm, buf, fd) filedes fd integer nxtcol, rightm character buf(MAXLINE) DESCRIPTION `flpack' writes `buf' to `fd' if there is any data packed into `buf', and resets nxtcol to 1. SEE ALSO inpack(3), dopack(3) DIAGNOSTICS none -1- #-h- fmtdat 1360 asc 03-aug-83 01:36:04 tools (lblh csam sventek) Fmtdat (3) 25-Sep-80 Fmtdat (3) NAME Fmtdat - convert date information to character string SYNOPSIS subroutine fmtdat (date, time, now, form) character date (10), time (9) 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; if form == LETTER, the date is formatted as dd-Mmm-yy; if form == DIGIT, `date' is formatted as mm/dd/yy. `time' is formatted as hh:mm:ss. IMPLEMENTATION Simple integer-to-character conversions. ARGUMENTS MODIFIED date, time SEE ALSO getnow(2), date(1) -1- #-h- fold 584 asc 03-aug-83 01:36:05 tools (lblh csam sventek) Fold (3) 13-Nov-78 Fold (3) 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. SEE ALSO clower(3), cupper(3), upper(3) DIAGNOSTICS None -1- #-h- fsize 929 asc 03-aug-83 01:36:05 tools (lblh csam sventek) Fsize (3) 15-Mar-82 Fsize (3) NAME Fsize - determine size of file in characters SYNOPSIS integer function fsize(file) character file(FILENAMESIZE) DESCRIPTION `fsize' opens the file, counts the number of characters using `getch', and closes the file, returning the number of characters found as an integer. Caution must be exercised on 16-bit machines, as any files containing more than 32767 characters will not be accounted for correctly. It is probably better to use `disize' as a rule, since the 16-bit limit will only affect files with more than 327,679,999 characters. SEE ALSO disize(3) DIAGNOSTICS Returns ERR if the file cannot be opened. -1- #-h- fskip 557 asc 03-aug-83 01:36:06 tools (lblh csam sventek) Fskip (3) 15-Mar-82 Fskip (3) NAME Fskip - skip n characters on open file SYNOPSIS subroutine fskip(fd, n) filedes fd integer n DESCRIPTION `n' characters are skipped on the file open on unit `fd'. SEE ALSO acopy(3) DIAGNOSTICS If an EOF is encountered before the number of characters has been skipped, the routine simply returns. -1- #-h- getc 821 asc 03-aug-83 01:36:06 tools (lblh csam sventek) Getc (3) 10-Nov-78 Getc (3) 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(2), getlin(2) DIAGNOSTICS None -1- #-h- getpat 1429 asc 03-aug-83 01:36:07 tools (lblh csam sventek) Getpat (3) 23-Jul-80 Getpat (3) NAME Getpat - prepare regular expression for pattern matching SYNOPSIS integer function getpat(arg, pat) character arg(ARB) integer pat(MAXPAT) DESCRIPTION Getpat is used to translate a regular expression into a format convenient for subsequent pattern matching via 'match' or 'amatch'. (For a complete description of regular expressions, see the writeup on the editor.) A typical scenario for pattern-matching might be: stat = getpat(pattern_you_want_located, pattern_array) YES/NO = match(input_line, pattern_array) The pattern array should be dimensioned at least MAXPAT integers long, a definition available in the standard symbol definitions file. If the pattern can be made, the functions returns the number of integers in "pat"; otherwise it returns ERR. Getpat is essentially a call to makpat with the following parameters: getpat = makpat (arg, 1, EOS, pat) SEE ALSO makpat(3), match(3), amatch(3) DIAGNOSTICS A value of ERR is returned if a failure occurs in the encoding. -1- #-h- getsub 690 asc 03-aug-83 01:36:07 tools (lblh csam sventek) Getsub (3) 15-Mar-82 Getsub (3) NAME Getsub - generate substitution pattern SYNOPSIS integer function getsub(arg, sub) character arg(ARB), sub(MAXPAT) DESCRIPTION This routine is simply a special version of `maksub', and is equivalent to getsub = maksub(arg, 1, EOS, sub) Consult the entry for `maksub' for what these routines do. SEE ALSO maksub(3) DIAGNOSTICS If an error occurs in the encoding, a value of ERR is returned. -1- #-h- getwrd 1035 asc 03-aug-83 01:36:08 tools (lblh csam sventek) Getwrd (3) 13-Nov-78 Getwrd (3) 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(3) DIAGNOSTICS None -1- #-h- gitocf 1086 asc 03-aug-83 01:36:09 tools (lblh csam sventek) Gitocf (3) 15-Mar-82 Gitocf (3) NAME Gitocf - general integer to character conversion with fill characters SYNOPSIS integer function gitocf(int, str, size, base, width, fc) integer int, size, base, width character str(size), fc DESCRIPTION `gitocf' does general formatting of integers to characters in any base and will right justify the number in a field of a given width, padding with the specified fill character. If the base specified is less than 2 or greater than 36, a base of 10 is used. If the resulting string would overflow the size of str, only the rightmost `size-1' characters are returned. The number of characters in the string is returned as the value of the function. If `width' is specified as 0, then no padding is performed. SEE ALSO itoc(3) DIAGNOSTICS none -1- #-h- gtftok 867 asc 03-aug-83 01:36:09 tools (lblh csam sventek) Gtftok (3) 15-Mar-82 Gtftok (3) NAME Gtftok - fetch next path token into buffer, incrementing pointer SYNOPSIS integer function gtftok(buf, i, token) character buf(ARB), token(FILENAMESIZE) integer i DESCRIPTION `gtftok' fetches the next path token starting at `buf(i)' into the array `token', incrementing the pointer `i' to the character which terminated the scan. The length of the token is returned as the function value. Characters which can terminate the scan are '/', '\' and EOS. Upon entry, if `buf(i)' == '/', it is skipped. SEE ALSO exppth(3) DIAGNOSTICS none -1- #-h- gtword 894 asc 03-aug-83 01:36:10 tools (lblh csam sventek) Gtword (3) 15-Mar-82 Gtword (3) NAME Gtword - get next word, subject to size limitations SYNOPSIS integer function gtword(in, i, out, size) integer i, size character in(ARB), out(size) DESCRIPTION `gtword' is similar to `getwrd', except that it will only copy `size-1' characters into `out'. If the next word of input is too big for the buffer, the extra characters are skipped over, leaving `i' pointing at the character which terminated the entire word, not just the portion returned in `out'. The length of the word returned in `out' is returned as the value of the function. SEE ALSO getwrd(3) DIAGNOSTICS none -1- #-h- imget 893 asc 03-aug-83 01:36:10 tools (lblh csam sventek) Imget (3) 23-Mar-80 Imget (3) 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(3), imput(3), imsort(3) DIAGNOSTICS The value EOF is returned if there are no more tokens to fetch. -1- #-h- iminit 1145 asc 03-aug-83 01:36:11 tools (lblh csam sventek) Iminit (3) 23-Mar-80 Iminit (3) 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(3), imput(3), imget(3), imsort(3) DIAGNOSTICS The value LAMBDA is returned if the dynamic storage area is too small. -1- #-h- impath 1738 asc 03-aug-83 01:36:11 tools (lblh csam sventek) Impath (3) 15-Mar-82 Impath (3) NAME Impath - generate search path for known files SYNOPSIS subroutine impath(path) character path(arith(FILENAMESIZE,*,3)) DESCRIPTION `impath' returns a search path for use in `loccom' when searching for known files. The search path returned depends upon whether your system has a tree-structured file system or not. If not, the path returned corresponds to: "@e~/@e~usr/@e~bin/@e@n" while tree-structured systems return: "@e~/tools/@e~usr/@e~bin/@e@n" Consult the entry for `loccom' for more information on the structure of the search path. EXAMPLES The program wishes to spawn the editor for the user. The following code fragment will do the trick, searching for the editor through the standard search path as used by the shell: character image(FILENAMESIZE), pid(PIDSIZE) character path(arith(FILENAMESIZE,*,3)) integer loccom, spawn string edst "ed" string args "ed temp.fil" string suffix IMAGE_SUFFIX call impath(path) if (loccom(ed, path, suffix, image) != BINARY) call error("? Cannot locate editor image file.") if (spawn(image, args, pid, WAIT) == ERR) call error("? Error spawning editor.") SEE ALSO loccom(2) DIAGNOSTICS none -1- #-h- imput 826 asc 03-aug-83 01:36:12 tools (lblh csam sventek) Imput (3) 23-Mar-80 Imput (3) 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(3), imget(3), imsort(3) DIAGNOSTICS If there is no room for the token, a value of ERR is returned. -1- #-h- imrset 680 asc 03-aug-83 01:36:12 tools (lblh csam sventek) Imrset (3) 14-Mar-82 Imrset (3) NAME Imrset - reset in-memory read pointer SYNOPSIS subroutine imrset(table) pointer table DESCRIPTION `imrset' resets the in-memory read pointer, such that the next `imget' call will start reading at the beginning of the in-memory sort area. `table' must have been obtained by a call to `iminit'. This function is equivalent to rewinding an input file. SEE ALSO iminit(3), imget(3) DIAGNOSTICS none -1- #-h- imsort 785 asc 03-aug-83 01:36:13 tools (lblh csam sventek) Imsort (3) 23-Mar-80 Imsort (3) 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(3), imput(3), imget(3) DIAGNOSTICS -1- #-h- imuniq 714 asc 03-aug-83 01:36:13 tools (lblh csam sventek) Imuniq (3) 14-Mar-82 Imuniq (3) NAME Imuniq - unique sorted in-memory array SYNOPSIS subroutine imuniq(table) pointer table DESCRIPTION `imuniq' scans the in-memory array generated via `imput' calls, and possible sorted by a call to `imsort', eliminating adjacent duplicate lines. `table' must have been obtained by a call to `iminit'. This is the same function as provided by the `uniq' utility for files. SEE ALSO iminit(3), imput(3), imsort(3), uniq(1) DIAGNOSTICS none -1- #-h- incrdi 907 asc 03-aug-83 01:36:14 tools (lblh csam sventek) Incrdi (3) 15-Mar-82 Incrdi (3) NAME Incrdi - increment double integer array SYNOPSIS incrdi(dblint) integer dblint(2) expands into: { dblint(2) = dblint(2) + 1 if (dblint(2) >= 10000) { dblint(1) = dblint(1) + 1 dblint(2) = 0 } } DESCRIPTION Invocation of this macro causes the double integer argument to be incremented by one, with the appropriate carry into the high integer, if necessary. See the entry for `initdi' for more information on the double integer structure. SEE ALSO initdi(3), decrdi(3), adddi(3), subdi(3) DIAGNOSTICS -1- #-h- index 708 asc 03-aug-83 01:36:14 tools (lblh csam sventek) Index (3) 13-Nov-78 Index (3) 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(3), getpat(3), indexs(3) DIAGNOSTICS None -1- #-h- indexs 810 asc 03-aug-83 01:36:15 tools (lblh csam sventek) Indexs (3) 15-Mar-82 Indexs (3) NAME Indexs - return index of substring in character string SYNOPSIS integer function indexs(str, sub) character str(ARB), sub(ARB) DESCRIPTION `indexs' scans the string `str' for the first occurrence of the substring `sub', and returns the index into `str' where `sub' starts. If the substring is not found, a value of 0 is returned. The comparison is stricly character by character, as done in `strcmp' or `equal'. SEE ALSO strcmp(3), equal(3), index(3) DIAGNOSTICS If the substring cannot be found, a value of 0 is returned. -1- #-h- inihlp 1028 asc 03-aug-83 01:36:15 tools (lblh csam sventek) Inihlp (3) 23-Mar-80 Inihlp (3) NAME Inihlp - initialize help facility on help archive SYNOPSIS integer function inihlp(file, ptrara, ptrsiz, unit) integer ptrsiz linepointer ptrara(ptrsiz) filedes unit 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(3), puthlp(3), note(2) DIAGNOSTICS If the file cannot be opened, ERR is returned. -1- #-h- initdi 1245 asc 03-aug-83 01:36:16 tools (lblh csam sventek) Initdi (3) 15-Mar-82 Initdi (3) NAME Initdi - initialize double integer array SYNOPSIS initdi(dblint) integer dblint(2) expands into: { dblint(1) = 0 dblint(2) = 0 } DESCRIPTION This macro expansion causes the double integer array argument to be initialized for use in the other double integer macros and routines. The double integer construct is used by all utilities which have to count quantities which might be larger than a 16-bit integer (32767), which seems to be most things of counting interest. The format of the double integers is: * the second element of the array varies from 0 to 9999 * the first element of the array is the carry from the second element In this manner, up to 327,679,999 units of things can be counted before 16-bit architectures overflow. SEE ALSO incrdi(3), decrdi(3), adddi(3), subdi(3), ctodi(3), ditoc(3) DIAGNOSTICS -1- #-h- inpack 780 asc 03-aug-83 01:36:16 tools (lblh csam sventek) Inpack (3) 14-Mar-82 Inpack (3) NAME Inpack - initialize data for packing subroutines SYNOPSIS subroutine inpack(nxtcol, rightm, buf, fd) filedes fd integer nxtcol, rightm character buf(MAXLINE) DESCRIPTION `inpack' initializes the parameters for packing data using `dopack' and `flpack'. These routines pack words into a buffer, aligned in columns starting every 16 characters, using TAB characters to achieve the spacing. `inpack' sets `nxtcol' to 1, and returns. SEE ALSO dopack(3), flpack(3) DIAGNOSTICS none -1- #-h- itoc 888 asc 03-aug-83 01:36:17 tools (lblh csam sventek) Itoc (3) 13-Nov-78 Itoc (3) 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(3), putdec(3), putint(3), gitocf(3) DIAGNOSTICS None -1- #-h- length 564 asc 03-aug-83 01:36:17 tools (lblh csam sventek) Length (3) 13-Nov-78 Length (3) 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- #-h- logpmt 831 asc 03-aug-83 01:36:18 tools (lblh csam sventek) Logpmt (3) 23-Mar-80 Logpmt (3) NAME Logpmt - `prompt' with history mechanism SYNOPSIS integer function logpmt(pstr, buf, fd) character pstr(ARB), buf(MAXLINE) filedes 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(2), rawpmt(3), ledpmt(3), hsh(1) DIAGNOSTICS Same as for prompt(2). -1- #-h- lookup 1755 asc 03-aug-83 01:36:18 tools (lblh csam sventek) Lookup (3) 23-Mar-80 Lookup (3) 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(3), delete(3), mktabl(3), rmtabl(3), stlu(3), sctabl(3), dsinit(3), dsget(3), dsfree(3) -1- #-h- ludef 855 asc 03-aug-83 01:36:19 tools (lblh csam sventek) Ludef (3) 14-Mar-82 Ludef (3) NAME Ludef - look up a defined symbol, returning its definition SYNOPSIS integer function ludef(name, defn, table) character name(ARB), defn(ARB) pointer table DESCRIPTION `ludef' looks up `name' in the symbol table `table', returning its definition in `defn'. If the symbol is found, a value of YES is returned as the function value, otherwise, NO. `defn' is assumed to be large enough to hold the definition stored. `table' must have been obtained by a call to `mktabl'. SEE ALSO mktabl(3), entdef(3) DIAGNOSTICS Returns a value of NO if the symbol cannot be found. -1- #-h- makpat 1481 asc 03-aug-83 01:36:19 tools (lblh csam sventek) Makpat (3) 23-Jul-80 Makpat (3) NAME Makpat - prepare regular expression for pattern matching SYNOPSIS integer function makpat(arg, from, delim, pat) character arg(ARB), delim integer from, pat(MAXPAT) DESCRIPTION Makpat is similar to getpat, but slightly more general purpose. It is used to translate a regular expression into a format convenient for subsequent pattern matching via 'match' or 'amatch'. (For a complete description of regular expressions, see the writeup on the editor.) Makpat scans "arg" starting at location "from" and terminates the scan at the 'delim' character. The characters between arg(from) and the delimiter are then encoded into a pattern suitable for subsequent matching. The function returns an index into arg of the next character past the delimiter, or ERR if there was some problem encoding the pattern. The pattern array should be dimensioned at least MAXPAT integers long, a definition available in the standard symbol definitions file. SEE ALSO getpat(3), match(3), amatch(3) DIAGNOSTICS A value of ERR is returned if a failure occurs in the encoding. -1- #-h- maksub 1006 asc 03-aug-83 01:36:20 tools (lblh csam sventek) Maksub (3) 15-Mar-82 Maksub (3) NAME Maksub - make substitution string SYNOPSIS integer function maksub(arg, from, delim, sub) character arg(ARB), sub(MAXPAT) integer from DESCRIPTION Starting at `arg(from)', a substitution string is encoded into `sub' until the `delim' character is sensed in `arg'. The next available character position in `arg' is returned as the value of the function. If an error occurs in the encoding, a value of ERR is returned. This function is concerned with encoding the ditto character '&' and the tagged patterns (those of the form $1 ;.. $9). it also handles escaped characters (@c). SEE ALSO getsub(3), ed(1) DIAGNOSTICS A value of ERR is returned if the encoding fails for any reason. -1- #-h- match 1260 asc 03-aug-83 01:36:20 tools (lblh csam sventek) Match (3) 23-Mar-80 Match (3) NAME Match - match pattern anywhere on a line SYNOPSIS integer function match (lin, pat) character lin(ARB) integer pat(MAXPAT) DESCRIPTION 'Match' attempts to find a match for a regular expression anywhere in a given line of text. The first argument contains the text line; the second contains the pattern to be matched. The function return is YES if the pattern was found anywhere in the line, NO otherwise. The pattern in 'pat' is a standard Software Tools encoded regular expression. 'Pat' can be generated most conveniently by a call to the routine 'makpat'. IMPLEMENTATION 'Match' calls 'amatch' at each position in 'lin', returning YES whenever 'amatch' indicates it found a match. If the test fails at all positions, 'match' returns NO. CALLS amatch(3) BUGS/DEFICIENCIES Not exactly blindingly fast. SEE ALSO amatch(3), makpat(3), maksub(3), catsub(3), find(1), ch(1), ed(1) -1- #-h- mktabl 1833 asc 03-aug-83 01:36:21 tools (lblh csam sventek) Mktabl (3) 23-Mar-80 Mktabl (3) 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. If an allocation failure occurs, the value LAMBDA is returned. 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(3), lookup(3), delete(3), rmtabl(3), stlu(3), dsget(3), dsfree(3), dsinit(3), sctabl(3) DIAGNOSTICS If an allocation failure occurs, the value LAMBDA is returned. -1- #-h- mrkhlp 1134 asc 03-aug-83 01:36:21 tools (lblh csam sventek) Mrkhlp (3) 23-Mar-80 Mrkhlp (3) NAME Mrkhlp - mark help elements matching pattern SYNOPSIS integer function mrkhlp(unit, ptrara, key, outara) linepointer ptrara(ARB), outara(ARB) filedes 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(3), puthlp(3), equal(3) DIAGNOSTICS If none of the modules match `key', ERR is returned. -1- #-h- ngetch 747 asc 03-aug-83 01:36:22 tools (lblh csam sventek) Ngetch (3) 23-Mar-80 Ngetch (3) NAME Ngetch - get a (possibly pushed back) character SYNOPSIS character function ngetch(c, fd) character c filedes 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(3), pbstr(3), pbinit(3), pbdecl(3) DIAGNOSTICS If an end of file is reached, EOF is returned. -1- #-h- pbdecl 1110 asc 03-aug-83 01:36:22 tools (lblh csam sventek) Pbdecl (3) 15-Mar-82 Pbdecl (3) NAME Pbdecl - declare push-back buffer storage SYNOPSIS PB_DECL(Buffer_size) expands into: integer pbp, pbsize character pbbuf(Buffer_size) common / cpback / pbp, pbsize, pbbuf DESCRIPTION Invocation of this macro causes the buffer and associated variables needed by the push-back buffer routines to be declared. This macro expansion must appear in the modules which invoke the `pbinit' routine. The same value of `Buffer_size' must be used in the `pbinit' call that is used in the PB_DECL declaration. `Buffer_size' must have been defined prior to the expansion of the macro, usually by a statement of the form: define(Buffer_size,512) for example. SEE ALSO pbinit(3) DIAGNOSTICS -1- #-h- pbinit 900 asc 03-aug-83 01:36:23 tools (lblh csam sventek) Pbinit (3) 23-Mar-80 Pbinit (3) NAME Pbinit - initialize push-back buffer SYNOPSIS subroutine pbinit(bufsiz) integer bufsiz 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. The following declaration must be made in the module which calls `pbinit' to create the common block which these routines use: PB_DECL(bufsiz) This declaration causes a character array `bufsiz' characters to be created for use by the routines. SEE ALSO ngetch(3), putbak(3), pbstr(3), pbdecl(3) DIAGNOSTICS -1- #-h- pbstr 848 asc 03-aug-83 01:36:23 tools (lblh csam sventek) Pbstr (3) 23-Mar-80 Pbstr (3) 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(3), putbak(3), ngetch(3), pbdecl(3) DIAGNOSTICS If there is no room for the string, an error message is displayed and the program is terminated. -1- #-h- putbak 772 asc 03-aug-83 01:36:24 tools (lblh csam sventek) Putbak (3) 23-Mar-80 Putbak (3) 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(3), pbstr(3), ngetch(3), pbdecl(3) DIAGNOSTICS If there is no room for the character, an error message is displayed and the program terminated. -1- #-h- putc 759 asc 03-aug-83 01:36:25 tools (lblh csam sventek) Putc (3) 10-Nov-78 Putc (3) 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(2), putlin(2) DIAGNOSTICS None -1- #-h- putdec 698 asc 03-aug-83 01:36:25 tools (lblh csam sventek) Putdec (3) 13-Nov-78 Putdec (3) 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(3), putint(3) DIAGNOSTICS None -1- #-h- puthlp 913 asc 03-aug-83 01:36:26 tools (lblh csam sventek) Puthlp (3) 23-Mar-80 Puthlp (3) NAME Puthlp - output marked modules from help archive SYNOPSIS subroutine puthlp(unit, outara, key, out, putout) linepointer outara(ARB) filedes 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(3), mrkhlp(3) DIAGNOSTICS -1- #-h- putint 883 asc 03-aug-83 01:36:26 tools (lblh csam sventek) Putint (3) 23-Jul-80 Putint (3) 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(3), putdec(3) DIAGNOSTICS None -1- #-h- putlnl 671 asc 03-aug-83 01:36:26 tools (lblh csam sventek) Putlnl (3) 16-Mar-82 Putlnl (3) NAME Putlnl - output line and flush, if necessary SYNOPSIS subroutine putlnl(buf, fd) character buf(ARB) filedes fd DESCRIPTION `putlnl' calls `putlin' to output the line. It then checks to see if the last character in the buffer is a NEWLINE ('@n'); if not, it outputs a NEWLINE character to flush the line. If `buf' is empty, a NEWLINE character is output. SEE ALSO putlin(2) DIAGNOSTICS None -1- #-h- putptr 554 asc 03-aug-83 01:36:27 tools (lblh csam sventek) Putptr (3) 15-Mar-82 Putptr (3) NAME Putptr - output linepointer as a character string SYNOPSIS subroutine putptr(ptr, fd) linepointer ptr filedes fd DESCRIPTION `putptr' formats the linepointer `ptr' using `ptrtoc', and outputs the resulting string to the ratfor unit `fd'. SEE ALSO ptrtoc(2), note(2), seek(2) DIAGNOSTICS none -1- #-h- putstr 910 asc 03-aug-83 01:36:27 tools (lblh csam sventek) Putstr (3) 23-Jul-80 Putstr (3) 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(2), putlin(2), remark(2), error(3) DIAGNOSTICS None -1- #-h- query 1119 asc 03-aug-83 01:36:28 tools (lblh csam sventek) Query (3) 25-Sep-80 Query (3) 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(3) -1- #-h- rmtabl 1610 asc 03-aug-83 01:36:28 tools (lblh csam sventek) Rmtabl (3) 23-Mar-80 Rmtabl (3) 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(3), enter(3), lookup(3), delete(3), dsget(3), dsfree(3), dsinit(3), sctabl(3) -1- #-h- scopy 543 asc 03-aug-83 01:36:29 tools (lblh csam sventek) Scopy (3) 13-Nov-78 Scopy (3) 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(3), addset(3), concat(3) DIAGNOSTICS None -1- #-h- sctabl 2843 asc 03-aug-83 01:36:30 tools (lblh csam sventek) Sctabl (3) 16-Mar-80 Sctabl (3) 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 the location of a two-word block in the table header to it. 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 and 'posn' is set to zero. ARGUMENTS MODIFIED symbol, info, posn CALLS dsget, dsfree BUGS/DEFICIENCIES -1- Sctabl (3) 16-Mar-80 Sctabl (3) 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(3), delete(3), mktabl(3), rmtabl(3), stlu(3), dsget(3), dsfree(3), dsinit(3) -2- #-h- sdrop 847 asc 03-aug-83 01:36:30 tools (lblh csam sventek) Sdrop (3) 23-Mar-80 Sdrop (3) NAME Sdrop - drop characters from a string (APL-style) SYNOPSIS integer function sdrop (from, to, length) character from (ARB), to (ARB) integer length DESCRIPTION 'Sdrop' copies all but 'length' characters from the 'from' string into the 'to' string and returns as its result the number of characters copied. If 'length' is positive, the omitted characters are relative to the beginning of the 'from' string; if it is negative, they are relative to the end of the string. ARGUMENTS MODIFIED to CALLS ctoc, length SEE ALSO stake(3), index(3) -1- #-h- sdupl 780 asc 03-aug-83 01:36:31 tools (lblh csam sventek) Sdupl (3) 14-Mar-82 Sdupl (3) NAME Sdupl - duplicate a string in dynamic storage SYNOPSIS pointer function sdupl(str) character str(ARB) DESCRIPTION `sdupl' allocates space for `str' in dynamic storage, and copies the string into the allocated space. A pointer to the dynamic space is returned as the value of the function. If the allocation fails, a value of LAMBDA is returned. `dsinit' must have been called before this function can be called. SEE ALSO dsinit(3) DIAGNOSTICS Returns a value of LAMBDA if the allocation fails. -1- #-h- settab 837 asc 03-aug-83 01:36:31 tools (lblh csam sventek) Settab (3) 15-Mar-82 Settab (3) NAME Settab - set tab stops SYNOPSIS subroutine settab(buf, tabs) character buf(ARB) integer tabs(MAXLINE) DESCRIPTION `settab' reads the token found in `buf', and generates the tab stops in the array tabs. If `buf' is empty, tabstops are set starting in column 9 and every 8 columns thereafter. Consult the entries for `entab' and `detab' for the actual arguments which can be passed in `buf'. After this call, `tabs' is ready for use in calling the `tabpos' routine. SEE ALSO argtab(3), tabpos(3), entab(1), detab(1) DIAGNOSTICS none -1- #-h- shell 533 asc 03-aug-83 01:36:32 tools (lblh csam sventek) Shell (3) 15-Mar-82 Shell (3) NAME Shell - shell sort integer array SYNOPSIS subroutine shell(v, n) integer n, v(n) DESCRIPTION `shell' performs a shell sort on the array of integers found in v(1) ... v(n). This algorithm is to be preferred over that used in `bubble'. SEE ALSO bubble(3) DIAGNOSTICS none -1- #-h- skipbl 602 asc 03-aug-83 01:36:32 tools (lblh csam sventek) Skipbl (3) 13-Nov-78 Skipbl (3) NAME Skipbl - skip blanks and tabs at str(i) SYNOPSIS call skipbl(str, i) character str(ARB) integer i # i is incremented DESCRIPTION Starting at position 'i' of array 'str', increments i while str(i) is a BLANK or TAB. 'Str' is an ascii character array terminated with an EOS marker. SEE ALSO getwrd(3) DIAGNOSTICS None -1- #-h- stake 847 asc 03-aug-83 01:36:33 tools (lblh csam sventek) Stake (3) 23-Mar-80 Stake (3) NAME Stake - take characters from a string (APL-style) SYNOPSIS integer function stake (from, to, length) character from (ARB), to (ARB) integer length DESCRIPTION 'Stake' copies the number of characters specified by 'length' from the 'from' string into the 'to' string and returns as its result the number of characters copied. If 'length' is positive, the characters are copied from the beginning of 'from'; if it is negative, they are copied from the end of 'from'. ARGUMENTS MODIFIED to CALLS ctoc, length SEE ALSO sdrop(3), index(3) -1- #-h- stcopy 804 asc 03-aug-83 01:36:33 tools (lblh csam sventek) Stcopy (3) 6-Jun-79 Stcopy (3) NAME Stcopy - copy string at from(i) to to(j); increment j SYNOPSIS call stcopy(from, i, to, j) character from(ARB), to(ARB) integer i integer j # j is incremented DESCRIPTION Copies the (sub)string of 'from', starting in location 'i', into array 'to', starting at 'j'. 'j' is incremented to point to the next available position in 'to' (i.e. the EOS marker inserted by the copy). In all other respects, 'stcopy' is similar to 'scopy'. SEE ALSO scopy(3), concat(3), addset(3) DIAGNOSTICS None -1- #-h- stlu 967 asc 03-aug-83 01:36:34 tools (lblh csam sventek) Stlu (3) 14-Mar-82 Stlu (3) NAME Stlu - symbol table lookup primitive SYNOPSIS integer function stlu(symbol, node, pred, table) character symbol(ARB) pointer node, pred, table DESCRIPTION `stlu' looks up the token `symbol' in the symbol table `table', returning a pointer to the symbol in `node' if it found. The variable `pred' is used as a scratch pointer during the search. If the symbol is found, a value of YES is returned, otherwise, NO. `table' is the return value of `mktabl', and the symbol would have been entered by using the `enter' function. SEE ALSO mktabl(3), enter(3) DIAGNOSTICS A value of NO is returned if the symbol cannot be found in the table. -1- #-h- strcmp 636 asc 03-aug-83 01:36:34 tools (lblh csam sventek) Strcmp (3) 23-Jul-80 Strcmp (3) NAME Strcmp - compare 2 strings SYNOPSIS stat = strcmp (str1, str2) character str1(ARB), str2(ARB) integer stat is returned as -1, 0, or +1 DESCRIPTION Strcmp compares its aguments and returns an integer greater than, equal to, or less than 0, depending on whether str1 is lexicographically greater than, equal to, or less than str2. SEE ALSO equal(3) DIAGNOSTICS None -1- #-h- strcpy 472 asc 03-aug-83 01:36:35 tools (lblh csam sventek) Strcpy (3) 26-Oct-81 Strcpy (3) NAME Strcpy - copy string at "from" to "to". SYNOPSIS call strcpy( from, to) character from(ARB), to(ARB) DESCRIPTION Copies the string starting at "from" into "to". SEE ALSO scopy(3), stcopy(3), addset(3), concat(3) DIAGNOSTICS None -1- #-h- strim 890 asc 03-aug-83 01:36:35 tools (lblh csam sventek) Strim (3) 23-Mar-80 Strim (3) NAME Strim - trim trailing blanks and tabs from a string SYNOPSIS integer function strim (str) character str (ARB) DESCRIPTION 'Strim' is used to trim trailing blanks and tabs from the EOS-terminated string passed as its first argument. The function return is the length of the trimmed string, excluding EOS. IMPLEMENTATION One pass is made through the string, and the position of the last non-blank, non-tab character remembered. When the entire string has been scanned, an EOS is planted immediately after the last non-blank. ARGUMENTS MODIFIED str SEE ALSO stake(3), sdrop(3) -1- #-h- subdi 932 asc 03-aug-83 01:36:36 tools (lblh csam sventek) Subdi (3) 15-Mar-82 Subdi (3) NAME Subdi - subtract double integer arrays SYNOPSIS subdi(dbl1,dbl2) integer dbl1(1), dbl2(2) expands into: { dbl2(1) = dbl2(1) - dbl1(1) dbl2(2) = dbl2(2) - dbl1(2) if (dbl2(2) < 0) { dbl2(1) = dbl2(1) - 1 dbl1(1) = dbl1(1) + 10000 } } DESCRIPTION Invocation of this macro causes the first double integer to be subtracted from the second. If a carry is necessary, it is performed. See the entry for `initdi' for more information of double integers. SEE ALSO initdi(3), incrdi(3), decrdi(3), adddi(3) DIAGNOSTICS -1- #-h- tabpos 618 asc 03-aug-83 01:36:36 tools (lblh csam sventek) Tabpos (3) 15-Mar-82 Tabpos (3) NAME Tabpos - determine if at a tab stop SYNOPSIS integer function tabpos(column, tabs) integer column, tabs(MAXLINE) DESCRIPTION This function returns YES/NO depending upon whether `column' corresponds to a tab stop or not. The array `tabs' must have been set up via a call to `settab' before calling `tabpos'. SEE ALSO settab(3), argtab(3) DIAGNOSTICS none -1- #-h- tbinit 880 asc 03-aug-83 01:36:37 tools (lblh csam sventek) Tbinit (3) 23-Mar-80 Tbinit (3) 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(3), tblook(3), dsdecl(3) DIAGNOSTICS -1- #-h- tbinst 803 asc 03-aug-83 01:36:37 tools (lblh csam sventek) Tbinst (3) 23-Mar-80 Tbinst (3) 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(3), tblook(3) DIAGNOSTICS If there is no room for the (name,defn) pair, an error message is displayed and control returned back to the caller. -1- #-h- tblook 669 asc 03-aug-83 01:36:38 tools (lblh csam sventek) Tblook (3) 23-Mar-80 Tblook (3) 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(3), tbinst(3) DIAGNOSTICS If the name is not in the table, a value of NO is returned. -1- #-h- tooldr 1255 asc 03-aug-83 01:36:38 tools (lblh csam sventek) Tooldr (3) 12-Mar-82 Tooldr (3) NAME Tooldr - locate user-specific tool directory SYNOPSIS subroutine tooldr(direct, dtype) character direct(FILENAMESIZE) integer dtype DESCRIPTION `tooldr' returns the directory in which the caller's tools-specific files are kept. If `dtype' has the value LOCAL, then the string is returned in the native operating system format; otherwise, it is returned in pathname format. It is returned as an EOS terminated string. IMPLEMENTATION If the system supports Tree-structured file systems, as evidenced by the definition of TREE_STRUCT_FILE_SYS in `~bin/symbols', then the tools directory is obtained by calling `homdir' and appending the string "tools/" to it. If the system supports a flat file system, `homdir' is simply called. The routine is called by `impath(3)' to build the standard search path for many of the tools. SEE ALSO homdir(2), impath(3) DIAGNOSTICS -1- #-h- type 573 asc 03-aug-83 01:36:39 tools (lblh csam sventek) Type (3) 13-Nov-78 Type (3) NAME Type - determine type of character SYNOPSIS t = type(c) character c character t is returned as LETTER, DIGIT, or c DESCRIPTION This function determines whether the character 'c' is a letter, a digit, or something else; it returns LETTER, DIGIT, or the character itself. SEE ALSO index(3) DIAGNOSTICS None -1- #-h- upper 622 asc 03-aug-83 01:36:39 tools (lblh csam sventek) Upper (3) 13-Nov-78 Upper (3) NAME Upper - convert string to upper case SYNOPSIS call upper(str) character str(ARB) DESCRIPTION Converts the array 'str' to upper case, if not already there. If any characters are non-alphabetic, it leaves them unchanged. 'Str' is an ascii character array terminated with an EOS marker. SEE ALSO cupper(3), fold(3), clower(3) DIAGNOSTICS None -1- #-h- wkday 790 asc 03-aug-83 01:36:39 tools (lblh csam sventek) Wkday (3) 23-Mar-80 Wkday (3) NAME Wkday - get day-of-week corresponding to month, day, year SYNOPSIS integer function wkday (month, day, year) integer month, day, year DESCRIPTION 'Wkday' is used to return the day-of-the-week corresponding to a given date. The three arguments completely specify the date: the month (1-12), day (1-28, 29, 30, or 31), and year (e.g. 1980). The function return is the ordinal number of the day-of-the-week (1 == Sunday, 7 == Saturday). IMPLEMENTATION Zeller's Congruence. SEE ALSO getnow(2), fmtdat(3), date(1) -1- #-h- dstime 976 asc 03-aug-83 01:36:40 tools (lblh csam sventek) Dstime (3) 2-Apr-82 Dstime (3) NAME Dstime - determine if the date is daylight savings time SYNOPSIS integer function dstime(date) integer date(7) DESCRIPTION `Dstime' determines whether the given date (in the format as returned by a `getnow' call) corresponds to daylight savings time. If this is true, a value of YES is returned, otherwise, NO. IMPLEMENTATION If the month specified is > 4 (April) and < 10 (October), then YES. If the month specified is < 4 or > 10, then NO. If the month = 4, and the day is < the last Sunday, then NO, otherwise, YES. If the month = 10, and the day is < the last Sunday, then YES, otherwise, NO. CALLS wkday(3) SEE ALSO getnow(2), wkday(3) -1- #-h- rmdef 600 asc 03-aug-83 01:36:40 tools (lblh csam sventek) Rmdef (3) 17-Dec-82 Rmdef (3) NAME Rmdef - remove a symbol and its definition from a symbol table SYNOPSIS subroutine rmdef(symbol, table) character symbol(ARB) pointer table DESCRIPTION `rmdef' removes a symbol and its definition from the symbol table `table'. `table' must have been obtained by a call to `mktabl'. SEE ALSO mktabl(3), ludef(3), entdef(3) DIAGNOSTICS -1-