/* CLIB LIST - List of some C routines contained in the shared library. *** TYPE DEFINITIONS *** 1. SIXBIT A word containing left-justified SIXBIT characters. 2. FILESPEC A block of four SIXBIT words, representing an ITS file specification. */ # define sixbit int struct _filespec {sixbit dev, fn1, fn2, dir;}; # define filespec struct _filespec /********************************************************************** PARAMETER AND RETURNED VALUE TYPE DEFINITIONS */ char c; /* an ASCII character */ int i; /* an integer */ int *p; /* an integer pointer */ int b; /* a boolean */ char *s, *s1, *s2; /* strings */ int rc; /* a return code, zero if OK, non-zero otherwise */ char *fn; /* a string representing an ITS file name or a path name */ int fd; /* a "file descriptor," used by the portable I/O stuff */ char c6; /* a SIXBIT character */ sixbit w; /* a SIXBIT word */ filespec *f; /* a pointer to a FILESPEC block */ int ch; /* an ITS channel or (returned) negative ITS failure code */ int fdate; /* date as stored in ITS file dir */ int pg; /* a page number */ int *pbp; /* pointer to a PDP-10 byte pointer */ /********************************************************************** A LISTING OF THE ROUTINES */ /* "Portable" I/O Routines */ fd = copen (fn, mode, options); /* open file */ /* mode is either 'r' - read 'w' - write 'a' - append options is usually omitted but "s" means I/O to string (pass string as fn) and "b" means binary I/O returns -1 if open fails */ extern int cin; /* standard input - pre-existing */ extern int cout; /* standard output - pre-existing */ extern int cerr; /* standard error ouput - pre-existing */ c = cgetc (fd); /* get character; returns 0 if eof */ c = cputc (c, fd); /* put character */ b = ceof (fd); /* test for end of file */ cclose (fd); /* close file */ c = getchar (); /* equivalent to cgetc(cin) */ putchar (c); /* equivalent to cputc(c,cout) */ gets (s1); /* read string (line) from cin */ puts (s1); /* put string and newline to cout */ cprint (fd, format, arg...); /* formatted print routine */ /* the format is a string which may contain format items of the form %nf, where n is an optional decimal integer (the minimum field width) and f is one of the following characters: d - print next arg (an integer) in decimal o - print next arg (an integer) in octal s - print next arg (a string) c - print next arg (a character) The file descriptor FD can be omitted, in which case COUT is used. */ i = cgeti (fd); /* get integer (binary input) */ i = cputi (i, fd); /* put integer (binary output) */ cexit (cc); /* terminate job, closing all files */ /* returning from "main" is equivalent */ b = istty (fd); /* test if file is a TTY */ ch = itschan (fd); /* return actual ITS channel */ /* STRING Routines */ i = slen (s); /* find string length */ stcpy (s1, s2); /* copy string from S1 to S2 */ b = stcmp (s1, s2); /* compare strings */ /* SIXBIT Routines */ c6 = ccto6 (c); /* convert ASCII char to SIXBIT char */ c = c6toc (c6); /* convert SIXBIT char to ASCII char */ w = csto6 (s1); /* convert ASCIZ string to SIXBIT word */ c6tos (w, s1); /* convert SIXBIT word to ASCII string */ /* ITS Filename Routines */ fparse (s1,f); /* convert file name or path name to FILESPEC */ prfile (f,s1); /* convert FILESPEC to file name (ASCII string) */ /* ITS I/O Routines */ ch = mopen (f, mode); /* open file, handle TTY specially */ rc = mclose (ch); /* close channel, unless TTY */ spctty (c); /* output ^P code to TTY */ ch = fopen (s1, mode); /* open channel given filename or pathname, if error return negative ITS failure code */ ch = open (f, mode); /* open channel given filespec if error return negative ITS failure code */ delete (fname); /* delete the file named FNAME */ /* Byte Pointer Hacking */ ildb (pbp); idpb (i, pbp); /* Interfaces to ITS System Calls */ rc = sysopen (ch, f, mode); /* open specific channel, if error return negative ITS failure code */ sysdel (f); /* delete the file specified by F */ ch = chnloc (); /* find an available channel */ rc = close (ch); /* close a channel */ uclose (ch); /* close a job */ i = status (ch); /* return channel status */ n = fillen (ch); /* return ITS file length */ access (ch, i); /* set file access pointer */ reset (ch); /* reset channel */ i = uiiot (ch); /* unit input IOT */ uoiot (ch, i); /* unit output IOT */ n_read = sysread (ch, p, n_words); /* block input IOT */ n_written = syswrite (ch, p, n_words); /* block output IOT */ fdate = rfdate (ch); /* read file creation date */ fdate = sfdate (ch, fdate); /* set file creation date */ w = rsname (); /* return SNAME */ w = runame (); /* return UNAME */ ssname (w); /* set SNAME */ sleep (n); /* sleep for n 30th seconds */ rc = sysload (job_ch, prog_ch); /* load program into job */ rc = atty (ch); /* give TTY to inferior */ rc = dtty (ch); /* take TTY from inferior */ valret (s); /* .VALUE a string (or 0) */ t = etime(); /* return system elapsed time in 1/60 sec units*/ t = cputm(); /* return job CPU time in 1/60 sec units */ t = getcpu(); /* return job CPU time in 4.096 usec units */ rc = corblk (mode, dest, destpg, src, srcpg); cortyp (pg, &resultblock); rc = pageid (idn, pg); /* USET hacking */ what = rsuset (where); what = wsuset (where, what); what = ruset (who, where); what = wuset (who, where, what); /* TRANSL hacking */ rc = tranad (job, from_file_spec, to_file_spec, flags); rc = trancl (job, flags); rc = trandl (job, file_spec, flags); /* storage allocation */ p = salloc (n); /* allocate n words, return pointer to it */ sfree (p); /* free storage allocated by salloc */ s = calloc (n); /* allocate n characters, return ptr to it */ cfree (s); /* free storage allocated by calloc */ /* interrupt hacking */ previous_handler = on (interrupt_number, new_handler); signal (interrupt_number); /* miscellaneous routines */ i = wfnz (p); /* wait for word pointed to by P to become non-zero; then return that value */