./ 775 0 0 0 5242462463 4066 ./a.out.h 666 0 0 5016 2455551130 5347 /* * Header prepended to each a.out file. */ struct exec { long a_magic; /* magic number */ unsigned long a_text; /* size of text segment */ unsigned long a_data; /* size of initialized data */ unsigned long a_bss; /* size of uninitialized data */ unsigned long a_syms; /* size of symbol table */ unsigned long a_entry; /* entry point */ unsigned long a_trsize; /* size of text relocation */ unsigned long a_drsize; /* size of data relocation */ }; #define OMAGIC 0407 /* old impure format */ #define NMAGIC 0410 /* read-only text */ #define ZMAGIC 0413 /* demand load format */ /* * Macros which take exec structures as arguments and tell whether * the file has a reasonable magic number or offsets to text|symbols|strings. */ #define N_BADMAG(x) \ (((x).a_magic)!=OMAGIC && ((x).a_magic)!=NMAGIC && ((x).a_magic)!=ZMAGIC) #define N_TXTOFF(x) \ ((x).a_magic==ZMAGIC ? 1024 : sizeof (struct exec)) #define N_SYMOFF(x) \ (N_TXTOFF(x) + (x).a_text+(x).a_data + (x).a_trsize+(x).a_drsize) #define N_STROFF(x) \ (N_SYMOFF(x) + (x).a_syms) /* * Format of a relocation datum. */ struct relocation_info { int r_address; /* address which is relocated */ unsigned int r_symbolnum:24, /* local symbol ordinal */ r_pcrel:1, /* was relocated pc relative already */ r_length:2, /* 0=byte, 1=word, 2=long */ r_extern:1, /* does not include value of sym referenced */ :4; /* nothing, yet */ }; /* * Format of a symbol table entry; this file is included by * and should be used if you aren't interested the a.out header * or relocation information. */ struct nlist { union { char *n_name; /* for use when in-core */ long n_strx; /* index into file string table */ } n_un; unsigned char n_type; /* type flag, i.e. N_TEXT etc; see below */ char n_other; /* unused */ short n_desc; /* see */ unsigned long n_value; /* value of this symbol (or sdb offset) */ }; #define n_hash n_desc /* used internally by ld */ /* * Simple values for n_type. */ #define N_UNDF 0x0 /* undefined */ #define N_ABS 0x2 /* absolute */ #define N_TEXT 0x4 /* text */ #define N_DATA 0x6 /* data */ #define N_BSS 0x8 /* bss */ #define N_COMM 0x12 /* common (internal to ld) */ #define N_FN 0x1f /* file name symbol */ #define N_EXT 01 /* external bit, or'ed in */ #define N_TYPE 0x1e /* mask for all the type bits */ /* * Sdb entries have some of the N_STAB bits set. * These are given in */ #define N_STAB 0xe0 /* if any of these bits set, a SDB entry */ /* * Format for namelist values. */ #define N_FORMAT "%08x" solute */ #define N_TEXT 0x4 /* text */ #define N_DATA 0x6 /* data */ #define N_BSS 0x8 /* bss */ #define N_COMM 0x12 /* common (internal to ld) */ #define N_FN 0x1f /* file name symbol */ #define N_EXT 01 /* external bit, or'ed in */ #define N_TYPE 0x1e /* mask for all the type bits */ /* * Sdb entries have some of the N_STAB bits set. * These are given in */ #define N_STAB 0xe0 /* if any of these bits set, a SDB entry */ /* * Format for namelist values. */ #define N_./ar.h 664 0 0 347 3733576441 4717 #define ARMAG "!\n" #define SARMAG 8 #define ARFMAG "`\n" struct ar_hdr { char ar_name[16]; char ar_date[12]; char ar_uid[6]; char ar_gid[6]; char ar_mode[8]; char ar_size[10]; char ar_fmag[2]; }; #define SAR_HDR 60 xternal bit, or'ed in */ #define N_TYPE 0x1e /* mask for all the type bits */ /* * Sdb entries have some of the N_STAB bits set. * These are given in */ #define N_STAB 0xe0 /* if any of these bits set, a SDB entry */ /* * Format for namelist values. */ #define N_./assert.h 664 0 0 160 4207037776 5607 #ifndef NDEBUG #define assert(e) (void)((e)||_assert(__FILE__,__LINE__)) #else #define assert(e) (void)1 #endif te[12]; char ar_uid[6]; char ar_gid[6]; char ar_mode[8]; char ar_size[10]; char ar_fmag[2]; }; #define SAR_HDR 60 xternal bit, or'ed in */ #define N_TYPE 0x1e /* mask for all the type bits */ /* * Sdb entries have some of the N_STAB bits set. * These are given in */ #define N_STAB 0xe0 /* if any of these bits set, a SDB entry */ /* * Format for namelist values. */ #define N_./core.h 666 0 0 352 2502606461 5230 /* machine dependent stuff for core files */ #define TXTRNDSIZ 1024L #define stacktop(siz) (0x80000000L-8*0x200) #define stackbas(siz) (0x80000000L-8*0x200-siz) #define FPOFFSET 07660 #define APOFFSET 07654 #define DATAOFFSET 01140 rnal bit, or'ed in */ #define N_TYPE 0x1e /* mask for all the type bits */ /* * Sdb entries have some of the N_STAB bits set. * These are given in */ #define N_STAB 0xe0 /* if any of these bits set, a SDB entry */ /* * Format for namelist values. */ #define N_./ctype.h 666 0 0 1350 3166606104 5444 #define _U 01 #define _L 02 #define _N 04 #define _S 010 #define _P 020 #define _C 040 #define _B 0100 #define _X 0200 extern char _ctype[]; #define isalpha(c) ((_ctype+1)[c]&(_U|_L)) #define isupper(c) ((_ctype+1)[c]&_U) #define islower(c) ((_ctype+1)[c]&_L) #define isdigit(c) ((_ctype+1)[c]&_N) #define isxdigit(c) ((_ctype+1)[c]&_X) #define isspace(c) ((_ctype+1)[c]&_S) #define ispunct(c) ((_ctype+1)[c]&_P) #define isalnum(c) ((_ctype+1)[c]&(_U|_L|_N)) #define isprint(c) ((_ctype+1)[c]&(_P|_U|_L|_N|_B)) #define isgraph(c) ((_ctype+1)[c]&(_P|_U|_L|_N)) #define iscntrl(c) ((_ctype+1)[c]&_C) #define isascii(c) ((unsigned char)(c)<=0177) #define _toupper(c) ((c)-'a'+'A') #define _tolower(c) ((c)-'A'+'a') #define toascii(c) ((c)&0177) islower(c) ((_ctype+1)[c]&_L) #define isdigit(c) ((_ctype+1)[c]&_N) #define isxdigit(c) ((_ctype+1)[c]&_X) #define isspace(c) ((_ctype+1)[c]&_S) #define ispunct(c) ((_ctype+1)[c]&_P) #define isalnum(c) ((_ctype+1)[c]&(_U|_L|_N)) #define isprint(c) ((_ctype+1)[c]&(_P|_U|_L|_N|_B))./curses.h 664 0 0 10446 3733046651 5655 /* 5/15/81 (Berkeley) @(#)curses.h 1.8 */ # ifndef WINDOW # include # include # define bool char # define reg register # define TRUE (1) # define FALSE (0) # define ERR (0) # define OK (1) # define _SUBWIN 01 # define _ENDLINE 02 # define _FULLWIN 04 # define _SCROLLWIN 010 # define _FLUSH 020 # define _STANDOUT 0200 # define _NOCHANGE -1 # define _puts(s) tputs(s, 0, _putchar); typedef struct sgttyb SGTTY; /* * Capabilities from termcap */ extern bool AM, BS, CA, DA, DB, EO, GT, HZ, IN, MI, MS, NC, OS, UL, XN; extern char *AL, *BC, *BT, *CD, *CE, *CL, *CM, *DC, *DL, *DM, *DO, *ED, *EI, *HO, *IC, *IM, *IP, *LL, *MA, *ND, *SE, *SF, *SO, *SR, *TA, *TE, *TI, *UC, *UE, *UP, *US, *VB, *VE, *VS, PC; /* * From the tty modes... */ extern bool NONL, UPPERCASE, normtty, _pfast; struct _win_st { short _cury, _curx; short _maxy, _maxx; short _begy, _begx; short _flags; bool _clear; bool _leave; bool _scroll; char **_y; short *_firstch; short *_lastch; }; # define WINDOW struct _win_st extern bool My_term, _echoit, _rawmode, _endwin; extern char *Def_term, ttytype[]; extern int LINES, COLS, _tty_ch, _res_flg; extern SGTTY _tty; extern WINDOW *stdscr, *curscr; /* * Define VOID to stop lint from generating "null effect" * comments. */ # ifdef lint int __void__; # define VOID(x) (__void__ = (int) (x)) # else # define VOID(x) (x) # endif /* * psuedo functions for standard screen */ # define addch(ch) VOID(waddch(stdscr, ch)) # define getch() VOID(wgetch(stdscr)) # define addstr(str) VOID(waddstr(stdscr, str)) # define getstr(str) VOID(wgetstr(stdscr, str)) # define move(y, x) VOID(wmove(stdscr, y, x)) # define clear() VOID(wclear(stdscr)) # define erase() VOID(werase(stdscr)) # define clrtobot() VOID(wclrtobot(stdscr)) # define clrtoeol() VOID(wclrtoeol(stdscr)) # define insertln() VOID(winsertln(stdscr)) # define deleteln() VOID(wdeleteln(stdscr)) # define refresh() VOID(wrefresh(stdscr)) # define inch() VOID(winch(stdscr)) # define insch(c) VOID(winsch(stdscr,c)) # define delch() VOID(wdelch(stdscr)) # define standout() VOID(wstandout(stdscr)) # define standend() VOID(wstandend(stdscr)) /* * mv functions */ #define mvwaddch(win,y,x,ch) VOID(wmove(win,y,x)==ERR?ERR:waddch(win,ch)) #define mvwgetch(win,y,x) VOID(wmove(win,y,x)==ERR?ERR:wgetch(win)) #define mvwaddstr(win,y,x,str) VOID(wmove(win,y,x)==ERR?ERR:waddstr(win,str)) #define mvwgetstr(win,y,x) VOID(wmove(win,y,x)==ERR?ERR:wgetstr(win)) #define mvwinch(win,y,x) VOID(wmove(win,y,x) == ERR ? ERR : winch(win)) #define mvwdelch(win,y,x) VOID(wmove(win,y,x) == ERR ? ERR : wdelch(win)) #define mvwinsch(win,y,x,c) VOID(wmove(win,y,x) == ERR ? ERR:winsch(win,c)) #define mvaddch(y,x,ch) mvwaddch(stdscr,y,x,ch) #define mvgetch(y,x) mvwgetch(stdscr,y,x) #define mvaddstr(y,x,str) mvwaddstr(stdscr,y,x,str) #define mvgetstr(y,x) mvwgetstr(stdscr,y,x) #define mvinch(y,x) mvwinch(stdscr,y,x) #define mvdelch(y,x) mvwdelch(stdscr,y,x) #define mvinsch(y,x,c) mvwinsch(stdscr,y,x,c) /* * psuedo functions */ #define clearok(win,bf) (win->_clear = bf) #define leaveok(win,bf) (win->_leave = bf) #define scrollok(win,bf) (win->_scroll = bf) #define flushok(win,bf) (bf ? (win->_flags |= _FLUSH):(win->_flags &= ~_FLUSH)) #define getyx(win,y,x) y = win->_cury, x = win->_curx #define winch(win) (win->_y[win->_cury][win->_curx]) #define raw() (_tty.sg_flags|=RAW, _pfast=_rawmode=TRUE, ioctl(_tty_ch, TIOCSETP,&_tty)) #define noraw() (_tty.sg_flags&=~RAW,_rawmode=FALSE,_pfast=!(_tty.sg_flags&CRMOD),ioctl(_tty_ch, TIOCSETP,&_tty)) #define crmode() (_tty.sg_flags |= CBREAK, _rawmode = TRUE, ioctl(_tty_ch, TIOCSETP,&_tty)) #define nocrmode() (_tty.sg_flags &= ~CBREAK,_rawmode=FALSE,ioctl(_tty_ch, TIOCSETP,&_tty)) #define echo() (_tty.sg_flags |= ECHO, _echoit = TRUE, ioctl(_tty_ch, TIOCSETP, &_tty)) #define noecho() (_tty.sg_flags &= ~ECHO, _echoit = FALSE, ioctl(_tty_ch, TIOCSETP, &_tty)) #define nl() (_tty.sg_flags |= CRMOD,_pfast = _rawmode,ioctl(_tty_ch, TIOCSETP, &_tty)) #define nonl() (_tty.sg_flags &= ~CRMOD, _pfast = TRUE, ioctl(_tty_ch, TIOCSETP, &_tty)) #define savetty() (ioctl(_tty_ch, TIOCGETP, &_tty), _res_flg = _tty.sg_flags) #define resetty() (_tty.sg_flags = _res_flg, ioctl(_tty_ch, TIOCSETP, &_tty)) WINDOW *initscr(), *newwin(), *subwin(); char *longname(), *getcap(); # endif ty)) #define noecho() (_tty.sg_flags &= ~ECHO, _echoit = FALSE, ioctl(_tty_ch, TIOCSETP, &_tty)) #define nl() (_tty.sg_flags |= CRMOD,_pfast = _rawmode,ioctl(_tty_ch, TIOCSETP, &_tty)) #define nonl() (_tty.sg_flags &./dbm.h 666 0 0 606 2455551130 5043 #define PBLKSIZ 1024 #define DBLKSIZ 4096 #define BYTESIZ 8 #define NULL ((char *) 0) long bitno; long maxbno; long blkno; long hmask; char pagbuf[PBLKSIZ]; char dirbuf[DBLKSIZ]; int dirf; int pagf; int dbrdonly; typedef struct { char *dptr; int dsize; } datum; datum fetch(); datum makdatum(); datum firstkey(); datum nextkey(); datum firsthash(); long calchash(); long hashinc(); #define nl() (_tty.sg_flags |= CRMOD,_pfast = _rawmode,ioctl(_tty_ch, TIOCSETP, &_tty)) #define nonl() (_tty.sg_flags &./dir.h 666 0 0 134 2455551130 5053 #ifndef DIRSIZ #define DIRSIZ 14 #endif struct dir { ino_t d_ino; char d_name[DIRSIZ]; }; bitno; long maxbno; long blkno; long hmask; char pagbuf[PBLKSIZ]; char dirbuf[DBLKSIZ]; int dirf; int pagf; int dbrdonly; typedef struct { char *dptr; int dsize; } datum; datum fetch(); datum makdatum(); datum firstkey(); datum nextkey(); datum firsthash(); long calchash(); long hashinc(); #define nl() (_tty.sg_flags |= CRMOD,_pfast = _rawmode,ioctl(_tty_ch, TIOCSETP, &_tty)) #define nonl() (_tty.sg_flags &./dk.h 664 0 0 1671 3401551235 4716 /* * This file defines message structures and codes * used in talking to the DK controller */ /* * Principal message structure. */ struct dialout { char type; /* message type */ char srv; /* service requested */ short param0; /* parameters */ short param1; short param2; short param3; short param4; short param5; }; /* * dialout structure as received with * cmcld on (includes channel) */ struct listenin { short l_lchan; char l_type; char l_srv; short l_param0; short l_param1; short l_param2; short l_param3; short l_param4; short l_param5; }; /* * message types */ #define T_SRV 1 /* request for server process */ #define T_CHG 3 /* status change on a channel */ #define T_LSTNR 4 /* keep-alive */ #define T_REPLY 10 /* reply from controller */ /* * T_CHG codes */ #define D_CLOSE 1 /* close a channel */ #define D_ISCLOSED 2 /* channel is closed */ #define D_OPEN 3 /* channel is open */ #define D_FAIL 5 n; char l_type; char l_srv; short l_param0; short l_param1; short ./dkerr.h 664 0 0 1554 3676074141 5441 /* * return codes from tdkdial subroutine */ #define NORM 0 /* OK */ #define ILLEG 1 /* arg count or other syntax error */ #define NOUID 2 /* can't find /etc/passwd entry */ #define NOREP 3 /* no reply from remote */ #define NODIAL 4 /* can't find dkdial */ #define NOOCHAN 5 /* can't find outgoing channel */ #define NOMGR 6 /* can't open chan 1 to mgr */ #define NODIALT 7 /* no dialtone */ #define ERRBASE 8 /* 8+n is message type n from mgr */ #define TDKERR 010 /* controller went wrong somewhere */ #define BUSY 011 /* destination is there but busy now */ #define NONET 012 /* network resource is currently unavailable */ #define NODEST 013 /* destination is currently unavailable */ #define INTERT 014 /* illegal destination name */ #define NETBUSY 015 /* network overload */ #define EXISTS 016 /* server already exists */ #define NOPERM 017 /* permission denied */ ine NODIALT 7 /* no dialtone */ #define ERRBASE 8 /* 8+n is message type n from mgr */ #define TDKERR 010 /* controller went wrong somewhere */ #def./dumprestor.h 666 0 0 1233 2455551131 6523 #define NTREC 10 #define MLEN 16 #define MSIZ 4096 #define TS_TAPE 1 #define TS_INODE 2 #define TS_BITS 3 #define TS_ADDR 4 #define TS_END 5 #define TS_CLRI 6 #define MAGIC (int)60011 #define CHECKSUM (int)84446 struct spcl { int c_type; time_t c_date; time_t c_ddate; int c_volume; daddr_t c_tapea; ino_t c_inumber; int c_magic; int c_checksum; struct dinode c_dinode; int c_count; char c_addr[BSIZE]; } spcl; struct idates { char id_name[16]; char id_incno; time_t id_ddate; }; #define DUMPOUTFMT "%-16s %c %s" /* for printf */ /* name, incno, ctime(date) */ #define DUMPINFMT "%16s %c %[^\n]\n" /* inverse for scanf */ 5 #define TS_CLRI 6 #define MAGIC (int)60011 #define CHECKSUM (int)84446 struct spcl { int c_type; time_t c_date; time_t c_ddate; int c_volume; daddr_t c_tapea; ino_t c_inumber; int c_magic; int c_checksum; struct dinode c_dinode; int c_count; char c_addr[BSIZE]; } spcl; struct idates { char id_name[16]; char id_incno; time_t id_ddate./errno.h 664 0 0 2005 4671525702 5447 /* * Error codes */ #define EPERM 1 #define ENOENT 2 #define ESRCH 3 #define EINTR 4 #define EIO 5 #define ENXIO 6 #define E2BIG 7 #define ENOEXEC 8 #define EBADF 9 #define ECHILD 10 #define EAGAIN 11 #define ENOMEM 12 #define EACCES 13 #define EFAULT 14 #define ENOTBLK 15 /* obsolescent */ #define EHASF 15 #define EBUSY 16 #define EEXIST 17 #define EXDEV 18 #define ENODEV 19 #define ENOTDIR 20 #define EISDIR 21 #define EINVAL 22 #define ENFILE 23 #define EMFILE 24 #define ENOTTY 25 #define ETXTBSY 26 #define EFBIG 27 #define ENOSPC 28 #define ESPIPE 29 #define EROFS 30 #define EMLINK 31 #define EPIPE 32 #define ELOOP 35 #define ECONC 36 #define EGREG 37 /* secure unix */ #define ELAB 38 /* security label violation */ #define ENOSYS 39 /* unknown system call */ #define ENLAB 40 /* kernel out of label space */ #define EPRIV 41 /* insufficient privilege */ /* math software */ #define EDOM 33 #define ERANGE 34 #ifndef KERNEL extern int errno; extern int sys_nerr; extern char *sys_errlist[]; #endif /* KERNEL */ EFBIG 27 #define ENOSPC 28 #define ESPIPE 29 #define EROFS 30 #define EMLINK 31 #define EPIPE 32 #define ELOOP 35 #define ECONC 36 #define EGREG 37 /* secure unix */ #define ELAB 38 /* security label violation */ #define ENOSYS 39 /* unknown system call */ #define ENLAB 40 /* kernel out of label space */ #define EPRIV 41 /* insufficient privilege */ /* math software */ #define EDOM 33 #define ERANGE 34 #ifndef KERNEL extern int errno; extern int sys_nerr; extern char *sys_errlist[]; #endif /* KERNE./execargs.h 666 0 0 60 2502551071 6051 char **execargs = (char**)(0x7ffffffc-8*0x200); 29 #define EROFS 30 #define EMLINK 31 #define EPIPE 32 #define ELOOP 35 #define ECONC 36 #define EGREG 37 /* secure unix */ #define ELAB 38 /* security label violation */ #define ENOSYS 39 /* unknown system call */ #define ENLAB 40 /* kernel out of label space */ #define EPRIV 41 /* insufficient privilege */ /* math software */ #define EDOM 33 #define ERANGE 34 #ifndef KERNEL extern int errno; extern int sys_nerr; extern char *sys_errlist[]; #endif /* KERNE./frame.h 666 0 0 576 2455551131 5402 /* * Definition of the vax calls/callg frame. */ struct frame { int fr_handler; u_int fr_psw:16, /* saved psw */ fr_mask:12, /* register save mask */ :1, fr_s:1, /* call was a calls, not callg */ fr_spa:2; /* stack pointer alignment */ int fr_savap; /* saved arg pointer */ int fr_savfp; /* saved frame pointer */ int fr_savpc; /* saved program counter */ }; efine EDOM 33 #define ERANGE 34 #ifndef KERNEL extern int errno; extern int sys_nerr; extern char *sys_errlist[]; #endif /* KERNE./fstab.h 664 0 0 1630 4203223740 5410 /* * fstab(5) (which filesystems are there?) and * mtab(5) (which filesystems are mounted?) * * bugs: swapping has nothing to do with filesystems */ /* * fstab things */ #define FSTAB "/etc/fstab" #define FSNMLG 32 #define FSTABNARGS 5 struct fstab{ char fs_spec[FSNMLG]; /* file to be mounted */ char fs_file[FSNMLG]; /* mount point */ int fs_ftype; /* file system type */ int fs_flags; /* integer flags */ int fs_passno; /* pass number on parallel fsck */ }; /* * special filesystem values * all < 0 */ #define FSNONE (-1) /* ignore; use to comment out */ #define FSSWAP (-2) /* swap area */ struct fstab *getfsent(); struct fstab *getfsspec(); struct fstab *getfsfile(); int setfsent(); int endfsent(); /* * mtab things */ struct mtab { char file[FSNMLG]; /* mount point */ char spec[FSNMLG-1]; /* file */ char type; /* filsys type */ }; #define MTAB "/etc/mtab" /* the file */ integer flags */ int fs_passno; /* pass number on parallel fsck */ }; /* * special filesystem value./grp.h 664 0 0 312 3617451430 5064 struct group { /* see getgrent(3) */ char *gr_name; char *gr_passwd; int gr_gid; char **gr_mem; }; extern struct group *getgrent(); extern struct group *getgrgid(); extern struct group *getgrnam(); ; int endfsent(); /* * mtab things */ struct mtab { char file[FSNMLG]; /* mount point */ char spec[FSNMLG-1]; /* file */ char type; /* filsys type */ }; #define MTAB "/etc/mtab" /* the file */ integer flags */ int fs_passno; /* pass number on parallel fsck */ }; /* * special filesystem value./rf.h 664 0 0 6524 4622073054 4735 /* * remote file access library * for building file system daemons */ typedef struct { char *fs; /* fs-specific local data */ long ino; char dev; char type; /* directory or regular */ short mode; short nlink; short uid, gid; short rdev; /* is this useful? */ long size; long ta; long tm; long tc; } Rfile; extern int fserrno; extern int rfdebug; extern char *rfclient; /* * service routines * provided by the user, * but this is what they should look like */ Rfile *fsinit(); /* (int argc, char **argv) */ Rfile *fswalk(); /* (Rfile *dir, char *name) */ Rfile *fscreate(); /* (Rfile *dir, char *newname, int mode, uid, gid) */ int fsdelete(); /* (Rfile *dir, char *name) */ int fslink(); /* (Rfile *dir, char *newname, Rfile *ofile) */ int fsmkdir(); /* (Rfile *dir, char *name) */ int fsrmdir(); /* (Rfile *dir, char *name, int mode, uid, gid) */ int fsdone(); /* (Rfile *f) -- discard this Rfile */ int fsstat(); /* (Rfile *f) -- fill it in with stat info */ int fsread(); /* (Rfile *f, long off, char *buf, int len) */ int fswrite(); /* (Rfile *f, long off, char *buf, int len) */ int fsdirread(); /* (Rfile *f, long off, char *buf, int len, long *newoff) */ int fsupdate(); /* (Rfile *f, Rfile *attr) -- copy attributes from attr */ /* mode, size, uid, gid, ta, tm */ /* * permission mapping */ /* * local name to local ID mapping */ typedef struct { char name[9]; short id; } Idmap; /* * local name to remote name mapping; * used only for exception list */ typedef struct { char sname[9]; char cname[9]; int sid; } Namemap; Idmap *rfmkidmap(); /* (char *filename, Namemap *exlist) */ extern Idmap *rfuidmap, *rfgidmap; extern int rfuid, rfgid; extern int rfotherdeny; #define RFNOID (-1) /* unmapped user- or group-id */ /* * file modes * these correspond to V7 Unix * only the low nine bits (permissions) are used by the library * other bits will be passed literally to the client * if it expects unix-like modes */ #define RFPRD 04 /* read permission */ #define RFPWR 02 /* write permission */ #define RFPEX 01 /* execute permission */ #define RFPDS RFPEX /* directory search permission */ #define RFPOTHER 0 /* shift to make `other' permissions */ #define RFPGROUP 3 /* shift to make `group' permissions */ #define RFPOWNER 6 /* shift to make `owner' permissions */ /* * file types * other types are just not allowed for now * (but some protocols may sneak them through in the mode) */ #define RFTREG 0 /* regular file */ #define RFTDIR 1 /* directory */ /* * error codes in fserrno * these intentionally match Unix errno values, * and in fact errno values will usually do, * but the library doesn't promise to preserve * exact values that aren't here */ #define RFEOWNER 1 /* not file owner */ #define RFENOENT 2 /* no such file or directory */ #define RFEIO 5 /* general I/O error */ #define RFENXIO 6 /* no such file address */ #define RFEACCES 13 /* no permission */ #define RFEBUSY 16 /* something is in use and can't be used again */ #define RFEEXIST 17 /* file exists when it shouldn't */ #define RFEXDEV 18 /* link across devices (or just not allowed) */ #define RFENOTDIR 20 /* not a directory and should be */ #define RFEISDIR 21 /* is a directory and shouldn't be */ #define RFEINVAL 22 /* invalid arg or function; catchall for internal errors */ #define RFENOSPC 28 /* no space on disk or in buffer (dirread) */ file address */ #define RFEACCES 13 /* no permission */ #define RFEBUSY 16 /* something is in use and can't be used again */ #define RFEEXIST 17 /* file exists when it sh./huff.h 664 0 0 301 4472714252 5226 /* Written by James Johnston, AT&T Bell Labs, 6/2/87. */ typedef struct node { char * datump; struct node * to, * from, * ldad, * rdad, * kid; float prob; } NODE; extern NODE *huff(); #define RFEINVAL 22 /* invalid arg or function; catchall for internal errors */ #define RFENOSPC 28 /* no space on disk or in buffer (dirread) */ file address */ #define RFEACCES 13 /* no permission */ #define RFEBUSY 16 /* something is in use and can't be used again */ #define RFEEXIST 17 /* file exists when it sh./lastlog.h 666 0 0 67 2455551132 5731 struct lastlog { time_t ll_time; char ll_line[8]; }; */ typedef struct node { char * datump; struct node * to, * from, * ldad, * rdad, * kid; float prob; } NODE; extern NODE *huff(); #define RFEINVAL 22 /* invalid arg or function; catchall for internal errors */ #define RFENOSPC 28 /* no space on disk or in buffer (dirread) */ file address */ #define RFEACCES 13 /* no permission */ #define RFEBUSY 16 /* something is in use and can't be used again */ #define RFEEXIST 17 /* file exists when it sh./local/ 777 0 0 0 3242510233 5145 ./local/uparm.h 664 0 0 103 2530045336 6505 #define E_TERMCAP "/etc/termcap" #define usrpath(file) "/usr/file" ¥CÕ´ÿ¥C÷´ÿT>à´ÿø´ÿ T>ü´ÿµÿ`#$3242510233"<,µÿø´ÿloca 5145"<Hµÿµÿ Ƽ+üÿÿoTµÿ£5ÀÀ+£†pµÿ^%´Ó,./math.h 664 0 0 1266 3727034337 5263 extern double fabs(), floor(), ceil(), fmod(); extern double frexp(), ldexp(), modf(); extern double sqrt(), hypot(), atof(), strtod(); extern double sin(), cos(), tan(), asin(), acos(), atan(), atan2(); extern double exp(), log(), log10(), pow(); extern double sinh(), cosh(), tanh(); extern double gamma(); extern double besj0(), besj1(), besjn(), besy0(), besy1(), besyn(); extern double frand(); extern double erf(), erfc(); #define MAXFLOAT 170141173319264429905852091742258462720.0 #define MAXDOUBLE 170141183460469229370504062281061498880.0 #define HUGE MAXFLOAT /* kludge */ #define HUGE_VAL MAXDOUBLE #define PI 3.1415926535897932384626433832795028841971693993751 #define PI2 (2*PI) s(), atan(), atan2(); extern double exp(), log(), log10(), pow(); extern double sinh(), cosh(), tanh(); extern double gamma(); extern double besj0(), besj1(), besjn(), besy0(), besy1(), besyn(); extern double frand(); extern double erf(), erfc(); #define MAXFLOAT 170141173319264429905852091742258462720.0 #define MAXDOUBLE 17014./mp.h 664 0 0 1071 5033435536 4736 typedef struct { int len; short *val; } mint; #define odd(x) ((x->len == 0 || !(x->val[0] & 1))? 0: 1) #define shfree(u) hfree((short *)u) #ifndef vax struct half { short high; big-endian assumed (also check ifdefs in .c) short low; }; #else struct half { short low; short high; }; #endif extern mint *itom(); extern short *xalloc(); typedef struct { mint *a; mint *b; } form; #define idform(f) (f->a->len == 1 && f->a->val[0] == 1) extern short primetab[]; /* all short primes */ extern unsigned char prbits[]; /* the first 10,000 primes, 16 odds to a byte */ dd(x) ((x->len == 0 || !(x->val[0] & 1))? 0: 1) #define shfree(u) hfree((short *)u) #ifndef vax struct half { short high; big-endian assumed (also check ifdefs in .c) short low; }; #else struct half { short low; short high; }; #endif extern mint *itom(); extern short *xalloc(); typedef struct { mint *a; mint *b; } form; #define idform(f) (f->a->len == 1 && f->a->val[0] == 1) extern short primetab[]; /* all short primes */ extern unsigned char pr./signal.h 664 0 0 4266 4170003270 5573 #ifndef NSIG #define NSIG 32 #define SIGHUP 1 /* hangup */ #define SIGINT 2 /* interrupt */ #define SIGQUIT 3 /* quit */ #define SIGILL 4 /* illegal instruction (not reset when caught) */ #define SIGTRAP 5 /* trace trap (not reset when caught) */ #define SIGIOT 6 /* IOT instruction */ #define SIGEMT 7 /* EMT instruction */ #define SIGFPE 8 /* floating point exception */ #define K_INTOVF 1 /* integer overflow */ #define K_INTDIV 2 /* integer divide by zero */ #define K_FLTOVF 3 /* floating overflow */ #define K_FLTDIV 4 /* floating/decimal divide by zero */ #define K_FLTUND 5 /* floating underflow */ #define K_DECOVF 6 /* decimal overflow */ #define K_SUBRNG 7 /* subscript out of range */ #define SIGKILL 9 /* kill (cannot be caught or ignored) */ #define SIGKIL 9 #define SIGBUS 10 /* bus error */ #define SIGSEGV 11 /* segmentation violation */ #define SIGSYS 12 /* bad argument to system call */ #define SIGPIPE 13 /* write on a pipe with no one to read it */ #define SIGALRM 14 /* alarm clock */ #define SIGTERM 15 /* software termination signal from kill */ #define SIGSTOP 17 /* sendable stop signal not from tty */ #define SIGTSTP 18 /* stop signal from tty */ #define SIGCONT 19 /* continue a stopped process */ #define SIGCHLD 20 /* to parent on child stop or exit */ #define SIGTTIN 21 /* to readers pgrp upon background tty read */ #define SIGTTOU 22 /* like TTIN for output if (tp->t_local<OSTOP) */ #define SIGTINT 23 /* to pgrp on every input character if LINTRUP */ #define SIGXCPU 24 /* exceeded CPU time limit */ #define SIGXFSZ 25 /* exceeded file size limit */ #define SIGLAB 26 /* file label changed; secure unix only (not reset) */ typedef int (*SIG_TYP)(); #ifndef KERNEL SIG_TYP signal(); #endif #define BADSIG (SIG_TYP)-1 #define SIG_DFL (SIG_TYP)0 #define SIG_IGN (SIG_TYP)1 #ifdef KERNEL #define SIG_CATCH (SIG_TYP)2 #endif #define SIG_HOLD (SIG_TYP)3 #define SIGISDEFER(x) (((int)(x) & 1) != 0) #define SIGUNDEFER(x) (SIG_TYP)((int)(x) &~ 1) #define DEFERSIG(x) (SIG_TYP)((int)(x) | 1) #define SIGNUMMASK 0377 /* to extract pure signal number */ #define SIGDOPAUSE 0400 /* do pause after setting action */ #define SIGDORTI 01000 /* do ret+rti after setting action */ #endif TYP signal(); #endif #define BADSIG (SIG_TYP)-1 #define SIG_DFL (SIG_TYP)0 #define SIG_IGN (SIG_TYP)1 #ifdef KERNEL #define SIG_CATCH (SIG_TYP)2 #endif #define SIG_HOLD (SIG_TYP)3 #define SIGISDEFER(x) (((int)(x) & 1) != 0) #define SIGUNDEFER(x) (SIG_TYP)((int)(x) &~ 1) #define DEFERSIG(x) (SIG_TYP)((int)(x) | 1) #define S./nlist.h 666 0 0 2100 2455551132 5443 /* * Format of a symbol table entry; this file is included by * and should be used if you aren't interested the a.out header * or relocation information. */ struct nlist { char *n_name; /* for use when in-core */ unsigned char n_type; /* type flag, i.e. N_TEXT etc; see below */ char n_other; /* unused */ short n_desc; /* see */ unsigned long n_value; /* value of this symbol (or sdb offset) */ }; #define n_hash n_desc /* used internally by ld */ /* * Simple values for n_type. */ #define N_UNDF 0x0 /* undefined */ #define N_ABS 0x2 /* absolute */ #define N_TEXT 0x4 /* text */ #define N_DATA 0x6 /* data */ #define N_BSS 0x8 /* bss */ #define N_COMM 0x12 /* common (internal to ld) */ #define N_FN 0x1f /* file name symbol */ #define N_EXT 01 /* external bit, or'ed in */ #define N_TYPE 0x1e /* mask for all the type bits */ /* * Sdb entries have some of the N_STAB bits set. * These are given in */ #define N_STAB 0xe0 /* if any of these bits set, a SDB entry */ /* * Format for namelist values. */ #define N_FORMAT "%08x" solute */ #define N_TEXT 0x4 /* text */ #define N_DATA 0x6 /* data */ #define N_BSS 0x8 /* bss */ #define N_COMM 0x12 /* common (internal to ld) */ #define N_FN 0x1f /* file name symbol */ #define N_EXT 01 /* external bit, or'ed in */ #define N_TYPE 0x1e /* mask for all the type bits */ /* * Sdb entries have some of the N_STAB bits set. * These are given in */ #define N_STAB 0xe0 /* if any of these bits set, a SDB entry */./olddump.h 666 0 0 2555 2455551133 5775 #define MAXSIZE 500 /* max size in blocks of dumped files */ #define NILIST 100 /* max files extracted at once */ #define BFACT 20 /* tape blocking factor */ int tden 1600; /* tape density */ int tlen 2200; /* tape length (feet) */ char *dump_cmd[] = { /* default args for dump */ "dump", "i", "/dev/rp0", 0 }; char *rest_cmd[] = { /* defaults for restor */ "restor", "t", 0 }; char *tape "/dev/rmt1"; char dfile[] "/dev/dtab"; char tfile[] "/tmp/dtmp"; char name[100]; #define NDTAB 10 struct { char dt_name[16]; time_t dt_date; } dtab[NDTAB]; struct thdr { ino_t isize; ino_t maxi; daddr_t fsize; time_t cdate; time_t ddate; long tsize; int nflg; }; struct fhdr { short xmagic; ino_t xino; short xmode; short xnlink; short xuid; short xgid; daddr_t xaddr; off_t xsize; time_t xatime; time_t xmtime; time_t xctime; }; #define FMAGIC 012345 #define SMAGIC 031415 #define DAPTB 127 /* (BSIZE-2*sizeof(short))/sizeof(daddr_t)) */ FILE *tmpf; long getsize() { register c; long j; c = getc(tmpf); if(c == EOF) return((long)-1); if(c <= 253) return((long)c); if(c == 255) return((long)-1); j = 0; for(c=0;c<3;c++) j = (j<<8) + (getc(tmpf)&0377); return(j); } putsize(s) long s; { if(s <= 253) { putc((char)s, tmpf); return; } putc(254, tmpf); putc((char)(s>>16), tmpf); putc((char)(s>>8), tmpf); putc((char)s, tmpf); } 012345 #define SMAGIC 031415 #define DAPTB 127 /* (BSIZE-2*sizeof(short))/sizeof(daddr_t)) */ FILE *tmpf; long getsize() { register c; long j;./pagsiz.h 664 0 0 634 3472176304 5603 #define NBPG 512 #define PGOFSET (NBPG-1) /* byte offset into page */ #define PGSHIFT 9 /* LOG2(NBPG) */ #define CLSIZE 2 #define CLOFSET (CLSIZE*NBPG-1) /* for clusters, like PGOFSET */ #define BITFS(dev) ((dev) & 64) #define BSIZE(dev) (BITFS(dev)? 4096: 1024) #define BMASK(dev) (BITFS(dev)? 07777: 01777) #define BSHIFT(dev) (BITFS(dev)? 12: 10) #define PAGSIZ (NBPG*CLSIZE) #define PAGRND ((PAGSIZ)-1) /* (BSIZE-2*sizeof(short))/sizeof(daddr_t)) */ FILE *tmpf; long getsize() { register c; long j;./pwd.h 664 0 0 500 3610550560 5062 struct passwd { /* see getpwent(3) */ char *pw_name; char *pw_passwd; int pw_uid; int pw_gid; int pw_quota; char *pw_comment; char *pw_gecos; char *pw_dir; char *pw_shell; }; extern struct passwd *getpwent(); extern struct passwd *getpwuid(); extern struct passwd *getpwnam(); extern struct passwd *pwdecode(); e BSHIFT(dev) (BITFS(dev)? 12: 10) #define PAGSIZ (NBPG*CLSIZE) #define PAGRND ((PAGSIZ)-1) /* (BSIZE-2*sizeof(short))/sizeof(daddr_t)) */ FILE *tmpf; long getsize() { register c; long j;./ranlib.h 666 0 0 1104 2455551133 5565 /* * Structure of the __.SYMDEF table of contents for an archive. * __.SYMDEF begins with a word giving the number of ranlib structures * which immediately follow, and then continues with a string * table consisting of a word giving the number of bytes of strings * which follow and then the strings themselves. * The ran_strx fields index the string table whose first byte is numbered 0. */ struct ranlib { union { off_t ran_strx; /* string table index of */ char *ran_name; /* symbol defined by */ } ran_un; off_t ran_off; /* library member at this offset */ }; * __.SYMDEF begins with a word giving the number of ranlib structures * which immediately follow, and then continues with a string * table consisting of a word giving the number of bytes of strings * which follow and then the strings themselves. * The ran_strx fields index the string table whose first byte is numbered 0. */ struct ranlib { union { off_t ran_strx; /* string table index of */ char *ran_name; /* symbol defined by */./saio.h 666 0 0 1527 2455551133 5262 /* %M% %I% %G% */ /* * header file for standalone package */ /* * io block: includes an * inode, cells for the use of seek, etc, * and a buffer. */ struct iob { char i_flgs; struct inode i_ino; int i_unit; daddr_t i_boff; daddr_t i_cyloff; off_t i_offset; daddr_t i_bn; char *i_ma; int i_cc; char i_buf[BSIZE]; }; #define F_READ 01 #define F_WRITE 02 #define F_ALLOC 04 #define F_FILE 010 /* * dev switch */ struct devsw { char *dv_name; int (*dv_strategy)(); int (*dv_open)(); int (*dv_close)(); }; struct devsw devsw[]; /* * request codes. Must be the same a F_XXX above */ #define READ 1 #define WRITE 2 #define NBUFS 4 char b[NBUFS][BSIZE]; daddr_t blknos[NBUFS]; #define NFILES 4 struct iob iob[NFILES]; #define PHYSUBA0 0x20006000 #define PHYSMBA0 0x20010000 #define PHYSMBA1 0x20012000 #define PHYSUMEM 0x2013e000 READ 01 #define F_WRITE 02 #define F_ALLOC 04 #define F_FILE 010 /* * dev switch */ struct devsw { char *dv_name; int (*dv_strategy)(); int (*dv_open)(); int (*dv./sccs.h 666 0 0 62 2455551133 5213 #define SCCSID(arg) static char Sccsid[] = "arg"; t codes. Must be the same a F_XXX above */ #define READ 1 #define WRITE 2 #define NBUFS 4 char b[NBUFS][BSIZE]; daddr_t blknos[NBUFS]; #define NFILES 4 struct iob iob[NFILES]; #define PHYSUBA0 0x20006000 #define PHYSMBA0 0x20010000 #define PHYSMBA1 0x20012000 #define PHYSUMEM 0x2013e000 READ 01 #define F_WRITE 02 #define F_ALLOC 04 #define F_FILE 010 /* * dev switch */ struct devsw { char *dv_name; int (*dv_strategy)(); int (*dv_open)(); int (*dv./setjmp.h 666 0 0 31 2455551133 5556 typedef int jmp_buf[10]; c char Sccsid[] = "arg"; t codes. Must be the same a F_XXX above */ #define READ 1 #define WRITE 2 #define NBUFS 4 char b[NBUFS][BSIZE]; daddr_t blknos[NBUFS]; #define NFILES 4 struct iob iob[NFILES]; #define PHYSUBA0 0x20006000 #define PHYSMBA0 0x20010000 #define PHYSMBA1 0x20012000 #define PHYSUMEM 0x2013e000 READ 01 #define F_WRITE 02 #define F_ALLOC 04 #define F_FILE 010 /* * dev switch */ struct devsw { char *dv_name; int (*dv_strategy)(); int (*dv_open)(); int (*dv./sgtty.h 664 0 0 64 4433575514 5441 /* * compatibility hack */ #include codes. Must be the same a F_XXX above */ #define READ 1 #define WRITE 2 #define NBUFS 4 char b[NBUFS][BSIZE]; daddr_t blknos[NBUFS]; #define NFILES 4 struct iob iob[NFILES]; #define PHYSUBA0 0x20006000 #define PHYSMBA0 0x20010000 #define PHYSMBA1 0x20012000 #define PHYSUMEM 0x2013e000 READ 01 #define F_WRITE 02 #define F_ALLOC 04 #define F_FILE 010 /* * dev switch */ struct devsw { char *dv_name; int (*dv_strategy)(); int (*dv_open)(); int (*dv./libc.h 664 0 0 1724 4612623450 5234 /* system calls */ extern unsigned alarm(); extern void nap(), pause(); extern char *sbrk(); extern void exit(), _exit(); extern long lseek(); extern void nice(); extern void profil(); extern unsigned long settod(); extern void sync(); extern long time(); /* libc et al */ extern long lcm(); extern double atof(), strtod(); extern long atol(); extern char *crypt(); extern char *ctime(); extern char *ecvt(), *fcvt(), *gcvt(); extern char *galloc(); extern char *getenv(); extern char *getlogin(); extern char *getpass(); extern char *getwd(), *getcwd(); extern char *malloc(), *realloc(), *calloc(); extern char *memcpy(), *memchr(), *memccpy(), *memset(), *memmove(); extern char *mktemp(); extern double frand(); extern char *setfields(); extern char *strcpy(), *strncpy(), *strcat(), *strncat(), *strchr(), *strrchr(); extern char *strpbrk(), *strtok(), *strdup(); extern int atoi(); extern char *tgetstr(), tgoto(); extern char *ttyname(), *cttyname(); #define NONEXIT 33 nv(); extern char *getlogin(); extern char *./stab.h 664 0 0 4542 3433447401 5255 /* * For transcendental debugger pi(1). * * This file gives definitions supplementing for permanent * symbol table entries. These must have one of the N_STAB bits on, * and are subject to relocation according to the masks in . * * stabs for text symbols (must be 0x?4): */ #define N_BFUN 0x24 /* procedure: name,,0,lineno,address */ #define N_FUN 0x24 #define N_NARGS 0x34 /* function call: ,,0,nbytes,address */ #define N_SLINE 0x44 /* src line: ,,0,lineno,address */ #define N_SO 0x64 /* source file: name,,0,lineno,address */ #define N_SOL 0x84 /* #include file: name,,0,lineno,address */ #define N_ESO 0x94 /* end source file: name,,0,lineno,address */ #define N_ENTRY 0xa4 /* alternate entry: name,,0,lineno,address */ #define N_RFUN 0xb4 /* return from function: ,,0,lineno,address */ #define N_LBRAC 0xc4 /* left bracket: ,,0,level,address */ #define N_RBRAC 0xd4 /* right bracket: ,,0,level,address */ #define N_EFUN 0xf4 /* end of function: name,,0,lineno,address */ /* * stabs for data symbols (must be 0x?6): */ #define N_STSYM 0x26 /* static symbol: name,,0,type,address */ /* * stabs for bss symbols (must be 0x?8): */ #define N_LCSYM 0x28 /* .lcomm symbol: name,,0,type,address */ #define N_ECOML 0xe8 /* end common (local name): ,,address */ /* * stabs for non-relocated stuff: */ #define N_GSYM 0x20 /* global symbol: name,,0,type,0 */ #define N_FNAME 0x22 /* procedure name (f77 kludge): name,,0 */ #define N_STFUN 0x32 /* static function: name,,0,type,0 */ #define N_RSYM 0x40 /* register sym: name,,0,type,register */ #define N_BSTR 0x5c /* begin structure: name,,0,type,length */ #define N_ESTR 0x5e /* end structure: name,,0,type,length */ #define N_SSYM 0x60 /* structure elt: name,,0,type,offset */ #define N_SFLD 0x70 /* structure field: name,,0,type,offset */ #define N_LSYM 0x80 /* local sym: name,,0,type,offset */ #define N_PSYM 0xa0 /* parameter: name,,0,type,offset */ #define N_BCOMM 0xe2 /* begin common: name,, */ #define N_ECOMM 0xe4 /* end common: name,, */ #define N_VER 0xf0 /* symbol table version number */ #define N_TYID 0xfa /* struct, union, or enum name */ #define N_DIM 0xfc /* dimension for arrays */ #define N_LENG 0xfe /* second stab entry with length information */ /* * for the berkeley pascal compiler, pc(1): */ #define N_PC 0x30 /* global pascal symbol: name,,0,subtype,line */ pe,offset */ #define N_PSYM 0xa0 /* parameter: name,,0,type,offset */ #define N_BCOMM 0xe2 /* begin common: name,, */ #define N_ECOMM 0xe4 /* end common: n./CC/ 755 0 0 0 5516116340 4343 ./CC/fstream.h 664 0 0 5600 4554416204 6250 /*ident "@(#)ctrans:incl/fstream.h 1.1.1.2" */ /************************************************************************** Copyright (c) 1984 AT&T All Rights Reserved THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T The copyright notice above does not evidence any actual or intended publication of such source code. *****************************************************************************/ #ifndef FSTREAMH #define FSTREAMH #include class filebuf : public streambuf { /* a stream buffer for files */ public: static const int openprot ; /* default protection for open */ public: filebuf() ; filebuf(int fd); filebuf(int fd, char* p, int l) ; int is_open() { return opened ; } int fd() { return xfd ; } filebuf* open(const char *name, int om, int prot=openprot); filebuf* attach(int fd) ; filebuf* close() ; ~filebuf() ; public: /* virtuals */ virtual int overflow(int=EOF); virtual int underflow(); virtual int sync() ; virtual streampos seekoff(streamoff,ios::seek_dir,int) ; virtual streambuf* setbuf(char* p, int len) ; protected: int xfd; int mode ; char opened; streampos last_seek ; char* in_start; int last_op(); char lahead[2] ; }; class fstreambase : virtual public ios { public: fstreambase() ; fstreambase(const char* name, int mode, int prot=filebuf::openprot) ; fstreambase(int fd) ; fstreambase(int fd, char* p, int l) ; ~fstreambase() ; void open(const char* name, int mode, int prot=filebuf::openprot) ; void attach(int fd); void close() ; void setbuf(char* p, int l) ; filebuf* rdbuf() { return &buf ; } private: filebuf buf ; protected: void verify(int) ; } ; class ifstream : public fstreambase, public istream { public: ifstream() ; ifstream(const char* name, int mode=ios::in, int prot=filebuf::openprot) ; ifstream(int fd) ; ifstream(int fd, char* p, int l) ; ~ifstream() ; filebuf* rdbuf() { return fstreambase::rdbuf(); } void open(const char* name, int mode=ios::in, int prot=filebuf::openprot) ; } ; class ofstream : public fstreambase, public ostream { public: ofstream() ; ofstream(const char* name, int mode=ios::out, int prot=filebuf::openprot) ; ofstream(int fd) ; ofstream(int fd, char* p, int l) ; ~ofstream() ; filebuf* rdbuf() { return fstreambase::rdbuf(); } void open(const char* name, int mode=ios::out, int prot=filebuf::openprot) ; } ; class fstream : public fstreambase, public iostream { public: fstream() ; fstream(const char* name, int mode, int prot=filebuf::openprot) ; fstream(int fd) ; fstream(int fd, char* p, int l) ; ~fstream() ; filebuf* rdbuf() { return fstreambase::rdbuf(); } void open(const char* name, int mode, int prot=filebuf::openprot) ; } ; #endif filebuf* rdbuf() { return fstreambase::rdbuf(); } void open(const char* name, int mode=ios::out, int prot=filebuf::openp./CC/iomanip.h 664 0 0 6507 4372224547 6257 /*ident "@(#)ctrans:incl/iomanip.h 1.1.1.2" */ /************************************************************************** Copyright (c) 1984 AT&T All Rights Reserved THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T The copyright notice above does not evidence any actual or intended publication of such source code. *****************************************************************************/ #ifndef IOMANIPH #define IOMANIPH #include #define SMANIP(T)name2(smanip_,T) #define SAPP(T)name2(sapply_,T) #define IMANIP(T)name2(imanip_,T) #define OMANIP(T)name2(omanip_,T) #define IOMANIP(T)name2(iomanip_,T) #define IAPP(T)name2(iapply_,T) #define OAPP(T)name2(oapply_,T) #define IOAPP(T)name2(ioapply_,T) #define IOMANIPdeclare(T) \ class SMANIP(T) { \ ios& (*fct)(ios&,T) ; \ T arg ; \ public: \ SMANIP(T)(ios& (*f)(ios&, T), T a) : \ fct(f), arg(a) { } \ friend istream& operator>>(istream& i, SMANIP(T)& m) { \ ios* s = &i ; \ (*m.fct)(*s,m.arg) ; return i ; } \ friend ostream& operator<<(ostream& o, SMANIP(T)& m) { \ ios* s = &o ; \ (*m.fct)(*s,m.arg) ; return o ; } \ } ; \ class SAPP(T) { \ ios& (*fct)(ios&, T) ; \ public: \ SAPP(T)(ios& (*f)(ios&,T)) : fct(f) { } \ SMANIP(T) operator()(T a) { \ return SMANIP(T)(fct,a) ; } \ } ; \ class IMANIP(T) { \ istream& (*fct)(istream&,T) ; \ T arg ; \ public: \ IMANIP(T)(istream& (*f)(istream&, T), T a ) : \ fct(f), arg(a) { } \ friend istream& operator>>(istream& s, IMANIP(T)& m) { \ return(*m.fct)(s,m.arg) ; \ } \ } ; \ class IAPP(T) { \ istream& (*fct)(istream&, T) ; \ public: \ IAPP(T)(istream& (*f)(istream&,T)) : fct(f) { } \ IMANIP(T) operator()(T a) { \ return IMANIP(T)(fct,a) ; } \ } ; \ class OMANIP(T) { \ ostream& (*fct)(ostream&,T) ; \ T arg ; \ public: \ OMANIP(T)(ostream& (*f)(ostream&, T), T a ) : \ fct(f), arg(a) { } \ friend ostream& operator<<(ostream& s, OMANIP(T)& m) { \ return(*m.fct)(s,m.arg) ; \ } \ } ; \ class OAPP(T) { \ ostream& (*fct)(ostream&, T) ; \ public: \ OAPP(T)(ostream& (*f)(ostream&,T)) : fct(f) { } \ OMANIP(T) operator()(T a) { \ return OMANIP(T)(fct,a) ; } \ } ; \ class IOMANIP(T) { \ iostream& (*fct)(iostream&,T) ; \ T arg ; \ public: \ IOMANIP(T)(iostream& (*f)(iostream&, T), T a ) : \ fct(f), arg(a) { } \ friend istream& operator>>(iostream& s, IOMANIP(T)& m) { \ return(*m.fct)(s,m.arg) ; \ } \ friend ostream& operator<<(iostream& s, IOMANIP(T)& m) { \ return(*m.fct)(s,m.arg) ; \ } \ } ; \ class IOAPP(T) { \ iostream& (*fct)(iostream&, T) ; \ public: \ IOAPP(T)(iostream& (*f)(iostream&,T)) : fct(f) { } \ IOMANIP(T) operator()(T a) { \ return IOMANIP(T)(fct,a) ; } \ } ; \ IOMANIPdeclare(int) ; IOMANIPdeclare(long) ; SMANIP(int) setbase(int b) ; /* 10, 8, 16 or 0 */ SMANIP(long) resetiosflags(long b) ; SMANIP(long) setiosflags(long b) ; SMANIP(int) setfill(int f); SMANIP(int) setprecision(int p); SMANIP(int) setw(int w) ; #endif \ } ; \ class IOAPP(T) { \ iostream& (*fct)(iostream&, T) ; \ public: \ IOAPP(T)(iostream& (*f)(iostream&,T)) : fct(f) { } \ IOMANIP(T) operator()(T a./CC/String.h 664 0 0 24210 4554422444 6076 #ifndef STRING_DOT_H #define STRING_DOT_H #define _const const #include #include #ifdef BSD extern "C" { extern char* bcopy(const char* from, char* to, int); /* vomit */ extern int bcmp(const char* from, const char* to, int); /* only for == */ } #define memcpy(t,f,n) bcopy(f,t,n) #else extern "C" { extern char* memcpy(char* to, const char* from, int); extern int memcmp(const char* to, const char* from, int); } #endif #include #include #include #ifndef GENERICH #include #endif #ifndef TRUE #define FALSE 0 #define TRUE (!FALSE) #endif #ifndef BIT_DEFINED #define BIT_DEFINED typedef int bit; #endif inline int min(int i, int j) { return idummy == empty_dummy; } Charfield *myField() _const; Rep *canCat(int); // returns a new Rep if this can be catenated Rep *newSub(int offset, int length); /* the following are from String(3) */ int strchr(char) _const; // position of first occurrence of char int strrchr(char) _const; // ... last ... (-1 if char not there) int strpbrk(const Rep&) _const; int strspn(const Rep&) _const; int strcspn(const Rep&) _const; }; // Strings are at the bottom working up, and Reps are at the top working down struct Charfield { Charfield *next; MtRep *emptyHead; /* of list of free Reps with no space */ Rep *lastRep; char *field; /* beginning of characters */ char *end; /* ... of data area */ char *firstFree; int usedSpace; Charfield(); Charfield(unsigned int); int compactify(unsigned int); /* return TRUE if no use */ Rep *newRep(unsigned int); char *getSpace(int); /* new String space for old Rep */ void putMt(MtRep *); Rep *getMt(); }; extern Rep *nullRep; /* the null String */ extern Rep *oneChar; /* all one-character Strings */ extern Charfield *currfield; extern char *Memcpy(char *to, const char *from, int); inline ostream& operator<<(ostream& oo, Rep& r) { oo.write(r.start, r.len); // ark return oo; // ark } class String { static GPT handler; static bit startedUp; void error(int = 0, char * = 0) _const; Rep *d; friend SubString; friend Subchar; public: String(); String(char); String(char, char); String(char, char, char); String(char, char, char, char); String(const char *); String(const char *, unsigned); String(const String& s) { d = s.d; d->refIncr(); } String(const SubString&); String(Rep& r) { d = &r; r.refIncr(); } ~String() { d->refDecr(); } friend int stat(const String&, struct stat*); friend int system(const String&); friend int access(const String&, int); friend int acct(const String&); friend int chdir(const String&); friend int chmod(const String&, int); friend int chown(const String&, int, int); friend int creat(const String&, int); friend int link(const String&, const String&); friend int mknod(const String&, int, int); friend int open(const String&, int); friend int unlink(const String&); friend int read(int, String&, int); friend int write(int, const String&); friend FILE* fopen(const String&, const String&); friend FILE* fdopen(int, const String&); friend FILE* freopen(const String&, const String&, FILE*); friend FILE* popen(const String&, const String&); friend puts(const String&); friend fputs(const String&, FILE*); friend inline ostream& operator<<(ostream&, const String&); friend istream& operator>>(istream&, String&); friend String operator+(const char, const String&); friend String operator+(const char*, const String&); friend Rep; friend Regexp; friend void startUp(); unsigned length () _const { return d->length(); } operator void*() { return length() ? this : 0; } int hashval() _const { return d->hashval(); } int compare(const String& oo) _const { return d == oo.d ? 0 : d->compare(*oo.d); } int compare(const char *p) _const { return d->compare(p); } bit operator==(const String& oo) _const { return d == oo.d ? 1 : (*d == *oo.d); } bit operator>(const String& oo) _const { return compare(oo) > 0; } bit operator>=(const String& oo) _const { return compare(oo) >= 0; } bit operator<=(const String& oo) _const { return compare(oo) <= 0; } bit operator<(const String& oo) _const { return compare(oo) < 0; } bit operator!=(const String& oo) _const { return d == oo.d ? 0 : !(*d == *oo.d); } bit operator==(const char* p) _const { return compare(p) == 0; } bit operator>(const char* p) _const { return compare(p) > 0; } bit operator>=(const char* p) _const { return compare(p) >= 0; } bit operator<=(const char* p) _const { return compare(p) <= 0; } bit operator<(const char* p) _const { return compare(p) < 0; } bit operator!=(const char* p) _const { return compare(p) != 0; } // match returns the first differing position int match(const String& s) _const { return d == s.d ? length() : d->match(*s.d); } int match (const char* p) _const { return d->match(p); } String operator+(const String&) _const; /* catenate */ String operator+(const char*) _const; /* catenate */ String operator+(const char) _const; /* catenate */ String& operator=(const char); String& operator=(const char *); String& operator=(const String& oo); String& put(const char); /* append or put */ String& put(const char*); /* append or put */ String& put(const String&); /* append or put */ String& operator+=(const char c) { return put(c); } String& operator+=(const String& oo) { return put(oo); } String& operator+=(const char *s) { return put(s); } bit getX(char&); /* get or lop */ bit get() { char c; return getX(c); } String& unget(const char); /* prepend */ String& unget(const String&); /* prepend */ bit unputX(char&); /* remove from back */ bit unput() { char c; return unputX(c); } bit firstX(char&) _const; bit lastX(char&) _const; SubString& operator() (const unsigned start, const unsigned length); Subchar& operator[] (const unsigned); /* character selection */ void dump(char *) _const; GPT sethandler(GPT); /* the following are from String(3) */ /* position of first occurrence of char */ int strchr(const char c) _const { return d->strchr(c); } /* ... last ... (-1 if char not there) */ int strrchr(const char c) _const { return d->strrchr(c); } int strpbrk(const String& oo) _const { return d->strpbrk(*oo.d); } int strspn(const String& oo) _const { return d->strspn(*oo.d); } int strcspn(const String& oo) _const { return d->strcspn(*oo.d); } }; inline bit operator==(const char* p, const String& s) { return s.compare(p) == 0; } inline bit operator>(const char* p, const String& s) { return s < p; } inline bit operator>=(const char* p, const String& s) { return s >= p; } inline bit operator<=(const char* p, const String& s) { return s >= p; } inline bit operator<(const char* p, const String& s) { return s > p; } inline bit operator!=(const char* p, const String& s) { return s != p; } inline ostream& operator<<(ostream& oo, const String& ss) { return oo << *ss.d; } class SubString { friend String; static String *ss; static int oo; static int ll; static GPT handler; void error(int = 0, char * = 0); SubString(const SubString&); SubString(String &ii, int off, int len) { this = 0; ss = ⅈ oo = off; ll = len; } ~SubString() { this = 0; } public: void operator=(const String&); GPT sethandler(GPT); String *it() _const { return ss; } int offset() _const { return oo; } int length() _const { return ll; } }; class Subchar { friend String; static String *ss; static int oo; /* position in the String */ static GPT handler; void error(int = 0, char * = 0); Subchar(const Subchar&); Subchar(String &ii, int off) { this = 0; ss = ⅈ oo = off; } ~Subchar() { this = 0; } public: char operator=(const char); operator char() { return *(ss->d->start + oo); } GPT sethandler(GPT); String *it() { return ss; } int offset() { return oo; } }; inline int length(const String &s) { return s.length(); } inline int hashval(const String &s) { return s.hashval(); } inline int compare(const String &s,const String &t) { return s.compare(t); } inline int strchr(const String& s, const char c) { return s.strchr(c); } inline int strrchr(const String& s, const char c) { return s.strrchr(c); } inline int strpbrk(const String& s, const String& t) { return s.strpbrk(t); } inline int strspn(const String& s, const String& t) { return s.strspn(t); } inline int strcspn(const String& s, const String& t) { return s.strcspn(t); } String sgets(istream&); int fgets(String&, int, FILE*); int gets(String&); #endif ing &s,const String &t) { return s.compare(t); } inline int strchr(const String& s, const char c) { return s.strchr(c); } inline int strrchr(const String& s, const char c) { return s.strrchr(c); } inline int strpbrk(const String& s, const String& t) { return s.strpbrk(t); } inline int strspn(const String& s, const String& t) { return s.strspn(t); } inline int strcspn(const ./CC/bignum.h 664 0 0 23264 4551460464 6122 // // C++ multiple precision integer arithmetic library. // #ifndef BIGNUM_H #define BIGNUM_H #include typedef void (*OutFn)(char); class INT_REP { short refcnt; // Reference count. long *wt; // First unused space. long *beg; // Start of allocated memory. long *last; // End of allocated memory. INT_REP (INT_REP *); // Duplicate INT_REP. void More (); // Realloc. void Zero(); // Zero out everything. void Print(iostream &); // Print using iostream. void Print(OutFn, int); // Print using user supplied fn. void Prt(); // Print internal representation. void Chsign (); // Change sign. void StripZero(); // Strip redundant zeros. void StripMinus(); // Strip redundant -1's. int Twos(); int Length() { return (wt-beg); } int isNegative() { return ((wt > beg) && (*(wt-1) < 0)); } int isZero () { return (wt == beg); } int isNonzero () { return (wt != beg); } int isOdd () { return (*beg & 0x1); } // Assuming positive. int isEven () { return (!(*beg & 0x1)); } // Assuming positive. void SetZero () { wt = beg; } void Putc(long c) { if (wt==last) More(); *wt++ = c; } void Alterc(int c, long *p) { if (p == last) More(); *p++ = c; if (p > wt) wt = p; } void FillDec(char *, char *); void FillHex(char *, char *); void FillOct(char *, char *); void FillLong(unsigned long); INT_REP *PutDec(); INT_REP *PutHex(); INT_REP *PutOct(); int Store(char *, int, int); int Comp(INT_REP *); long Trunc(int &); INT_REP *Add(INT_REP *); INT_REP *Sub(INT_REP *); INT_REP *Mult(INT_REP *); INT_REP *DivMod(INT_REP *, int); INT_REP *Div(INT_REP *b) { return DivMod(b,0); } INT_REP *Mod(INT_REP *b) { return DivMod(b,1); } INT_REP *Exp(INT_REP *b); INT_REP *GCD(INT_REP *b); INT_REP *And(INT_REP *); INT_REP *Or(INT_REP *); INT_REP *Xor(INT_REP *); INT_REP *Not(); INT_REP *LeftShift(long); INT_REP *RightShift(long); INT_REP *LeftShift(INT_REP *); INT_REP *RightShift(INT_REP *); public : static void IRMorehd (); INT_REP (int, int = 1); // Create INT_REP of specified size. INT_REP (long); // Create INT_REP of long. INT_REP (char *); // Create INT_REP from ascii representation. ~INT_REP (); friend class INT; friend INT_REP *IRAllocRep (); friend INT operator >> (INT b, long a); friend INT operator << (INT b, long a); }; extern INT_REP ZeroRep; class INT { INT_REP *rep; INT Reset (INT_REP *newrep) { rep->refcnt--; if (rep->refcnt == 0) delete rep; rep = newrep; rep->refcnt++; return (*this); } void Print(iostream &i) // Print decimal representation on iostream. { rep->Print(i); } public : INT(long i) // Initialized to i. { rep = new INT_REP (i); if (rep) rep->refcnt++; } INT () // Initialized to zero. { rep = &ZeroRep; rep->refcnt++; } INT (INT_REP *r) // For return values from INT_REP operations. { rep = r; if(r) r->refcnt++; } INT (INT &a) // For assignment. { rep = a.rep; if(rep) rep->refcnt++; } INT (char *s) // Character representation, in decimal, octal or hex. { rep = new INT_REP (s); if(rep) rep->refcnt++; } ~INT () { rep->refcnt--; if(rep->refcnt == 0) delete rep; } // Assignment operators. INT operator= (INT &a) { return (Reset (a.rep)); } INT operator+= (INT &a) { return (Reset (rep->Add(a.rep))); } INT operator-= (INT &a) { return (Reset (rep->Sub(a.rep))); } INT operator*= (INT &a) { return (Reset (rep->Mult(a.rep))); } INT operator/= (INT &a) { return (Reset (rep->Div(a.rep))); } INT operator%= (INT &a) { return (Reset (rep->Mod(a.rep))); } INT operator|= (INT &a) { return (Reset (rep->Or(a.rep))); } INT operator&= (INT &a) { return (Reset (rep->And(a.rep))); } INT operator^= (INT &a) { return (Reset (rep->Xor(a.rep))); } INT operator<<= (INT &a) { return (Reset (rep->LeftShift(a.rep))); } INT operator>>= (INT &a) { return (Reset (rep->RightShift(a.rep))); } // Increment/decrement. INT operator++ () { INT_REP orep(1l); return (Reset (rep->Add(&orep))); } INT operator-- () { INT_REP orep(-1l); return (Reset (rep->Add(&orep))); } // Binary arithmetic operators. INT operator + (INT b) { return INT(rep->Add(b.rep)); } INT operator - (INT b) { return INT(rep->Sub(b.rep)); } INT operator * (INT b) { return INT(rep->Mult(b.rep)); } INT operator / (INT b) { return INT(rep->Div(b.rep)); } INT operator % (INT b) { return INT(rep->Mod(b.rep)); } // Logical operators. int operator <= (INT b) { return (rep->Comp(b.rep) == 1 ? 0 : 1); } int operator >= (INT b) { return (rep->Comp(b.rep) == -1 ? 0 : 1); } int operator < (INT b) { return (rep->Comp(b.rep) == -1 ? 1 : 0); } int operator > (INT b) { return (rep->Comp(b.rep) == 1 ? 1 : 0); } int operator == (INT b) { return (rep->Comp(b.rep) == 0 ? 1 : 0); } int operator != (INT b) { return (rep->Comp(b.rep) == 0 ? 0 : 1); } int operator ! () { return (rep->isZero() ? 1 : 0); } int operator || (INT b) { return (rep->isNonzero()>0 ? 1 : (b.rep->isNonzero()>0 ? 1 : 0)); } int operator && (INT b) { return (rep->isZero() ? 0 : (b.rep->isZero() ? 0 : 1)); } // Bitwise operators. INT operator >> (INT b) { return INT(rep->RightShift(b.rep)); } INT operator << (INT b) { return INT(rep->LeftShift(b.rep)); } INT operator | (INT b) { return INT(rep->Or(b.rep)); } INT operator & (INT b) { return INT(rep->And(b.rep)); } INT operator ^ (INT b) { return INT(rep->Xor(b.rep)); } INT operator ~ () { return INT(rep->Not()); } // Miscellaneous. INT operator - () // Unary minus. { INT_REP *b = new INT_REP(rep); b->Chsign(); return INT(b); } INT Exp (INT b) // Exponentiate this to the given power. { return INT(rep->Exp(b.rep)); } INT GCD (INT b) // GCD of this and parameter. { return INT(rep->GCD(b.rep)); } long Long(int &error) // Convert this to signed long; { return (rep->Trunc(error)); } // if bits are lost, error will be nonzero. operator void * () { return (rep->isZero() ? (void *)0 : (void *)rep); } // Output. int Dec (char *buf, int buflen = -1) { return (rep->Store (buf, buflen, 0)); } int Oct (char *buf, int buflen = -1) { return (rep->Store (buf, buflen, 1)); } int Hex (char *buf, int buflen = -1) { return (rep->Store (buf, buflen, 2)); } void Dec (OutFn fn) { rep->Print (fn, 0); } void Oct (OutFn fn) { rep->Print (fn, 1); } void Hex (OutFn fn) { rep->Print (fn, 2); } friend iostream & operator << (iostream &i, INT n) { n.Print(i); return(i); } #ifdef DEBUG void Prt() // Print internal representation. { rep->Prt(); } #endif DEBUG // Friends. friend INT operator >> (INT b, long a); friend INT operator << (INT b, long a); }; /* Mixed long and INT functions. */ // Binary arithmetic operators. inline INT operator + (long a, INT b) { return (INT(a) + b); } inline INT operator + (INT b, long a) { return (INT(a) + b); } inline INT operator - (long a, INT b) { return (INT(a) - b); } inline INT operator - (INT b, long a) { return (INT(a) - b); } inline INT operator * (long a, INT b) { return (INT(a) * b); } inline INT operator * (INT b, long a) { return (INT(a) * b); } inline INT operator / (long a, INT b) { return (INT(a) / b); } inline INT operator / (INT b, long a) { return (INT(a) / b); } inline INT operator % (long a, INT b) { return (INT(a) % b); } inline INT operator % (INT b, long a) { return (INT(a) % b); } // Logical operators. inline int operator <= (long a, INT b) { return (INT(a) <= b); } inline int operator <= (INT b, long a) { return (INT(a) <= b); } inline int operator >= (long a, INT b) { return (INT(a) >= b); } inline int operator >= (INT b, long a) { return (INT(a) >= b); } inline int operator < (long a, INT b) { return (INT(a) < b); } inline int operator < (INT b, long a) { return (INT(a) < b); } inline int operator > (long a, INT b) { return (INT(a) > b); } inline int operator > (INT b, long a) { return (INT(a) > b); } inline int operator == (long a, INT b) { return (INT(a) == b); } inline int operator == (INT b, long a) { return (INT(a) == b); } inline int operator != (long a, INT b) { return (INT(a) != b); } inline int operator != (INT b, long a) { return (INT(a) != b); } inline int operator || (long a, INT b) { return (a ? 1 : (b ? 1 : 0)); } inline int operator || (INT b, long a) { return (b ? 1 : (a ? 1 : 0)); } inline int operator && (long a, INT b) { return (a==0 ? 0 : (b ? 1 : 0)); } inline int operator && (INT b, long a) { return (!b ? 0 : (a==0 ? 0 : 1)); } // Bitwise operators. inline INT operator >> (long a, INT b) { return (INT(a)>>b); } inline INT operator >> (INT b, long a) { return INT(b.rep->RightShift(a)); } inline INT operator << (long a, INT b) { return (INT(a)<LeftShift(a)); } inline INT operator | (long a, INT b) { return (INT(a) | b); } inline INT operator | (INT b, long a) { return (INT(a) | b); } inline INT operator & (long a, INT b) { return (INT(a) & b); } inline INT operator & (INT b, long a) { return (INT(a) & b); } inline INT operator ^ (long a, INT b) { return (INT(a) ^ b); } inline INT operator ^ (INT b, long a) { return (INT(a) ^ b); } // Miscellaneous functions. overload Exp; overload GCD; inline INT Exp (long a, INT b) { return (INT(a).Exp(b)); } inline INT Exp (INT b, long a) { return (b.Exp(INT(a))); } inline INT GCD (long a, INT b) { return (b.GCD(INT(a))); } inline INT GCD (INT b, long a) { return (b.GCD(INT(a))); } #endif BIGNUM_H or & (INT b, long a) { return (INT(a) & b); } inline INT operator ^ (long a, INT b) { return (INT(a) ^ b); } inline INT operator ^ (INT b, long a) { return (INT(a) ^ b); } // Miscellaneous functions. overload Exp; overload GCD; inline INT Exp (long a, INT b) { return (INT(a).Exp(b)); } inline INT Exp (INT b, long a./CC/osfcn.h 664 0 0 203 4352272117 5670 #ifndef __OSFCN_H #define __OSFCN_H 1 #include extern int open(const char*, int, int); // System V simulator #endif { return (b.GCD(INT(a))); } #endif BIGNUM_H or & (INT b, long a) { return (INT(a) & b); } inline INT operator ^ (long a, INT b) { return (INT(a) ^ b); } inline INT operator ^ (INT b, long a) { return (INT(a) ^ b); } // Miscellaneous functions. overload Exp; overload GCD; inline INT Exp (long a, INT b) { return (INT(a).Exp(b)); } inline INT Exp (INT b, long a./CC/sys/ 775 0 0 0 5356371752 5177 ./CC/sys/stat.h 664 0 0 2101 4427751014 6371 #ifndef __STAT_H #define __STAT_H 1 struct stat { dev_t st_dev; ino_t st_ino; unsigned short st_mode; short st_nlink; short st_uid; short st_gid; dev_t st_rdev; off_t st_size; time_t st_atime; time_t st_mtime; time_t st_ctime; }; #define S_IFMT 0170000 /* type of file */ #define S_IFDIR 0040000 /* directory */ #define S_IFCHR 0020000 /* character special */ #define S_IFBLK 0060000 /* block special */ #define S_IFREG 0100000 /* regular */ #define S_IFLNK 0120000 /* symbolic link */ #define S_ISUID 0004000 /* set user id on execution */ #define S_ISGID 0002000 /* set group id on execution */ #define S_IREAD 0000400 /* read permission, owner */ #define S_IWRITE 0000200 /* write permission, owner */ #define S_IEXEC 0000100 /* execute/search permission, owner */ #define S_ICCTYP 0007000 /* type of concurrent access */ #define S_ISYNC 0001000 /* 1 writer and n readers (synchronized access) */ #define S_IEXCL 0003000 /* 1 writer or n readers (exclusive access) */ extern "C" { int fstat(int, struct stat*); int stat(const char*, struct stat*); } #endif 0002000 /* set group id on execution */ #define S_IREAD 0000400 /* read permission, owner */ #define S_IWRITE 0000200 /* write permission, owner */ #define S_IEXEC 0000100 /* execute/search permission, owner */ #define S_ICCTYP 0007000 /* type of concurrent access */ #define S_ISYNC 0001000 /* 1 writer and n readers (synchronized access) */ #define S_IEXCL 0003000 /* 1 writer or n readers (exclusive access) */ extern "C" { int fstat(int./CC/sys/times.h 664 0 0 413 4303065640 6517 /* * Structure returned by times() */ struct tms { time_t tms_utime; /* user time */ time_t tms_stime; /* system time */ time_t tms_cutime; /* user time, children */ time_t tms_cstime; /* system time, children */ }; extern "C" { extern int times(tms*); } n, owner */ #define S_ICCTYP 0007000 /* type of concurrent access */ #define S_ISYNC 0001000 /* 1 writer and n readers (synchronized access) */ #define S_IEXCL 0003000 /* 1 writer or n readers (exclusive access) */ extern "C" { int fstat(int./CC/sys/types.h 664 0 0 3341 5356371711 6575 #ifndef __SYS_TYPES #define __SYS_TYPES /* * Basic system types and related macros */ /* * hardware parameters */ #define NBBY 8 /* number of bits in a byte */ #define NBPW sizeof(int) /* number of bytes in an integer */ #define NBPG 512 /* bytes per hardware page */ #define PGOFSET (NBPG-1) /* byte offset into page */ #define PGSHIFT 9 /* LOG2(NBPG) */ /* Core clicks (512 bytes) to segments and vice versa */ #define ctos(x) (x) #define stoc(x) (x) /* Core clicks (512 bytes) to disk blocks */ #define ctod(x) (x) /* clicks to bytes */ #define ctob(x) ((x)<<9) /* bytes to clicks */ #define btoc(x) ((((unsigned)(x)+511)>>9)) typedef unsigned char u_char; typedef unsigned short u_short; typedef unsigned int u_int; typedef unsigned long u_long; typedef long daddr_t; typedef char * caddr_t; typedef u_short ino_t; typedef long swblk_t; typedef unsigned size_t; typedef long time_t; typedef long label_t[14]; typedef u_short dev_t; typedef long off_t; typedef struct { unsigned long lo; long hi; } llong_t; /* major part of a device */ #define major(x) ((int)(((unsigned)(x)>>8)&0377)) /* minor part of a device */ #define minor(x) ((int)((x)&0377)) /* make a device number */ #define makedev(x,y) ((dev_t)(((x)<<8) | (y))) /* * Set of fds used with the select system call. * assumed that NOFILE <= 128 */ #define FDWORDS (128+NBPW*NBBY-1)/(NBPW*NBBY) typedef struct fd_set { unsigned int fds_bits[FDWORDS]; } fd_set; #define FD_SET(n,s) (s).fds_bits[(n)/(NBPW*NBBY)] |= 1<<((n)%(NBPW*NBBY)) #define FD_CLR(n,s) (s).fds_bits[(n)/(NBPW*NBBY)] &= ~(1<<((n)%(NBPW*NBBY))) #define FD_ISSET(n,s) ((s).fds_bits[(n)/(NBPW*NBBY)] & (1<<((n)%(NBPW*NBBY)))) #define FD_ZERO(s) {int i; for(i=0;i /* Some inlines use memcpy */ /* If EOF is defined already verify that it is -1. Otherwise * define it. */ #ifdef EOF # if EOF!=-1 # define EOF (-1) # endif #else # define EOF (-1) #endif /* Don't worry about NULL not being 0 */ #ifndef NULL # define NULL 0 #endif #define zapeof(c) ((c)&0377) /* extracts char from c. The critical requirement is * zapeof(EOF)!=EOF * ((c)&0377) and ((unsigned char)(c)) are alternative definitions * whose efficiency depends on compiler environment. */ typedef long streampos ; typedef long streamoff ; class streambuf ; class ostream ; class ios { public: /* Some enums are declared in ios to avoid pollution of * global namespace */ enum io_state { goodbit=0, eofbit=1, failbit=2, badbit=4, hardfail=0200}; /* hard fail can be set and reset internally, * but not via public function */ enum open_mode { in=1, out=2, ate=4, app=010, trunc=020, nocreate=040, noreplace=0100} ; enum seek_dir { beg=0, cur=1, end=2 } ; /* flags for controlling format */ enum { skipws=01, /* skip whitespace on input */ left=02, right=04, internal=010, /* padding location */ dec=020, oct=040, hex=0100, /* conversion base */ showbase=0200, showpoint=0400, uppercase=01000, showpos=02000, /* modifiers */ scientific=04000, fixed=010000, /* floating point notation */ unitbuf=020000, stdio=040000 /* stuff to control flushing */ } ; static const long basefield ; /* dec|oct|hex */ static const long adjustfield ; /* left|right|internal */ static const long floatfield ; /* scientific|fixed */ public: ios(streambuf*) ; virtual ~ios() ; long flags() { return x_flags ; } long flags(long f); long setf(long setbits, long field); long setf(long) ; long unsetf(long) ; int width() { return x_width ; } int width(int w) { int i = x_width ; x_width = w ; return i ; } ostream* tie(ostream* s); ostream* tie() { return x_tie ; } char fill(char) ; char fill() { return x_fill ; } int precision(int) ; int precision() { return x_precision ; } int rdstate() { return state ; } operator void*() { if (state&(failbit|badbit|hardfail)) return 0 ; else return this ; } int operator!() { return state&(failbit|badbit|hardfail); } int eof() { return state&eofbit; } int fail() { return state&(failbit|badbit|hardfail); } int bad() { return state&badbit ; } int good() { return state==0 ; } void clear(int i =0) { state = (i&0377) | (state&hardfail) ; ispecial = (ispecial&~0377) | state ; ospecial = (ospecial&~0377) | state ; } streambuf* rdbuf() { return bp ;} public: /* Members related to user allocated bits and words */ long & iword(int) ; void* & pword(int) ; static long bitalloc() ; static long xalloc() ; private: /*** privates for implemting allocated bits and words */ static long nextbit ; static long nextword ; int nuser ; union ios_user_union* x_user ; void uresize(int) ; public: /* static member functions */ static void sync_with_stdio() ; protected: enum { skipping=01000, tied=02000 } ; /*** bits 0377 are reserved for userbits ***/ streambuf* bp; void setstate(int b) { state |= (b&0377) ; ispecial |= b&~skipping ; ispecial |= b ; } int state; int ispecial; int ospecial; int isfx_special; int osfx_special; int delbuf; ostream* x_tie; long x_flags; short x_precision; char x_fill; short x_width; static void (*stdioflush)() ; void init(streambuf*) ; /* Does the real work of a constructor */ ios() ; /* No initialization at all. Needed by * multiple inheritance versions */ int assign_private ; /* needed by with_assgn classes */ private: ios(ios&) ; /* Declared but not defined */ void operator=(ios&) ; /* Declared but not defined */ public: /* old stream package compatibility */ int skip(int i) ; }; class streambuf { short alloc; short x_unbuf; char* x_base; char* x_pbase; char* x_pptr; char* x_epptr; char* x_gptr; char* x_egptr; char* x_eback; int x_blen; private: streambuf(streambuf&); /* Declared but not defined */ void operator=(streambuf&); /* Declared but not defined */ public: void dbp(); protected: char* base() { return x_base ; } char* pbase() { return x_pbase ; } char* pptr() { return x_pptr ; } char* epptr() { return x_epptr ; } char* gptr() { return x_gptr ; } char* egptr() { return x_egptr ; } char* eback() { return x_eback ; } char* ebuf() { return x_base+x_blen ; } int blen() { return x_blen; } void setp(char* p, char* ep) { x_pbase=x_pptr=p ; x_epptr=ep ; } void setg(char* eb,char* g, char* eg) { x_eback=eb; x_gptr=g ; x_egptr=eg ; } void pbump(int n) { x_pptr+=n ; } void gbump(int n) { x_gptr+=n ; } void setb(char* b, char* eb, int a = 0 ) { if ( alloc && x_base ) delete x_base ; x_base = b ; x_blen= (eb>b) ? (eb-b) : 0 ; alloc = a ; } int unbuffered() { return x_unbuf; } void unbuffered(int unb) { x_unbuf = (unb!=0) ; } int allocate() { if ( x_base== 0 && !unbuffered() ) return doallocate() ; else return 0 ; } virtual int doallocate(); public : virtual int overflow(int c=EOF); virtual int underflow(); virtual int pbackfail(int c); virtual int sync(); virtual streampos seekoff(streamoff,ios::seek_dir,int =ios::in|ios::out); virtual streampos seekpos(streampos, int =ios::in|ios::out) ; virtual int xsputn(const char* s,int n); virtual int xsgetn(char* s,int n); int in_avail() { return x_gptr=x_egptr) ? underflow() : zapeof(*x_gptr); } int snextc() { return (++x_gptr>=x_egptr) ? x_snextc() : zapeof(*x_gptr); } int sbumpc() { return ( x_gptr>=x_egptr && underflow()==EOF ) ? EOF : zapeof(*x_gptr++) ; } void stossc() { if ( x_gptr++ > x_egptr ) underflow() ; } int sputbackc(char c) { if (x_gptr > x_eback ) { if ( *--x_gptr == c ) return zapeof(c) ; else return zapeof(*x_gptr=c) ; } else { return pbackfail(c) ; } } int sputc(int c) { return (x_pptr>=x_epptr) ? overflow(zapeof(c)) : zapeof(*x_pptr++=c); } int sputn(const char* s,int n) { if ( n <= (x_epptr-x_pptr) ) { memcpy(x_pptr,s,n) ; pbump(n); return n ; } else { return xsputn(s,n) ; } } int sgetn(char* s,int n) { if ( n <= (x_egptr-x_gptr) ) { memcpy(s,x_gptr,n) ; gbump(n); return n ; } else { return xsgetn(s,n) ; } } virtual streambuf* setbuf(char* p, int len) ; streambuf* setbuf(unsigned char* p, int len) ; streambuf* setbuf(char* p, int len, int count) ; /* obsolete third argument */ /*** Constructors -- should be protected ***/ streambuf() ; streambuf(char* p, int l) ; streambuf(char* p, int l,int c) ; /* 3 argument form is obsolete. * Use strstreambuf. */ virtual ~streambuf() ; private: int x_snextc() ; }; class istream : virtual public ios { public: /* Constructor */ istream(streambuf*) ; virtual ~istream() ; public: int ipfx(int noskipws=0) { if ( noskipws?(ispecial&~skipping):ispecial) { return do_ipfx(noskipws) ; } else return 1 ; } void isfx() { } istream& seekg(streampos p) ; istream& seekg(streamoff o, ios::seek_dir d) ; streampos tellg() ; istream& operator>> (istream& (*f)(istream&)) { return (*f)(*this) ; } istream& operator>> (ios& (*f)(ios&) ) ; istream& operator>>(char*); istream& operator>>(unsigned char*); istream& operator>>(unsigned char& c) { if ( ipfx(0) ) { if ( bp->in_avail() ) { c = bp->sbumpc() ; } else xget((char*)&c) ; } return *this ; } istream& operator>>(char& c) { if ( ipfx(0) ) { if ( bp->in_avail() ) { c = bp->sbumpc() ; } else xget((char*)&c) ; } return *this ; } istream& operator>>(short&); istream& operator>>(int&); istream& operator>>(long&); istream& operator>>(unsigned short&); istream& operator>>(unsigned int&); istream& operator>>(unsigned long&); istream& operator>>(float&); istream& operator>>(double&); istream& operator>>(streambuf*); istream& get(char* , int lim, char delim='\n'); istream& get(unsigned char* b,int lim, char delim='\n'); istream& getline(char* b, int lim, char delim='\n'); istream& getline(unsigned char* b, int lim, char delim='\n'); istream& get(streambuf& sb, char delim ='\n'); istream& get(unsigned char& c) { if ( ipfx(1) && bp->in_avail()) { x_gcount = 1 ; c = bp->sbumpc() ; } else { xget((char*)&c) ; } return *this ; } istream& get(char& c) { if ( ipfx(1) && bp->in_avail()) { x_gcount = 1 ; c = bp->sbumpc() ; } else { xget(&c) ; } return *this ; } int get() { int c ; if ( !ipfx(1) ) return EOF ; else { c = bp->sbumpc() ; if ( c == EOF ) setstate(eofbit) ; return c ; } } int peek() { if ( ipfx(-1) ) return bp->sgetc() ; else return EOF ; } istream& ignore(int n=1,int delim=EOF) ; istream& read(char* s,int n); istream& read(unsigned char* s,int n) { return read((char*)s,n) ; } int gcount() ; istream& putback(char c); int sync() { return bp->sync() ; } protected: int do_ipfx(int noskipws) ; void eatwhite() ; istream() ; private: int x_gcount ; void xget(char* c) ; public: /*** Obsolete constructors, carried over from stream package ***/ istream(streambuf*, int sk, ostream* t=0) ; /* obsolete, set sk and tie * via format state variables */ istream(int size ,char*,int sk=1) ; /* obsolete, use strstream */ istream(int fd,int sk=1, ostream* t=0) ; /* obsolete use fstream */ }; class ostream : virtual public ios { public: /* Constructor */ ostream(streambuf*) ; virtual ~ostream(); public: int opfx() /* Output prefix */ { if ( ospecial ) return do_opfx() ; else return 1 ; } void osfx() { if ( osfx_special ) do_osfx() ; } ostream& flush() ; ostream& seekp(streampos p) ; ostream& seekp(streamoff o, ios::seek_dir d) ; streampos tellp() ; ostream& put(char c) { if ( opfx() ) { if ( bp->sputc(c) == EOF ) { setstate(eofbit|failbit) ; } osfx() ; } return *this ; } ostream& operator<<(char c) { put(c) ; osfx() ; return *this ; } ostream& operator<<(unsigned char c) { put(c) ; osfx() ; return *this ; } ostream& operator<<(const char*); ostream& operator<<(int a); ostream& operator<<(long); ostream& operator<<(double); ostream& operator<<(float); ostream& operator<<(unsigned int a); ostream& operator<<(unsigned long); ostream& operator<<(void*); ostream& operator<<(streambuf*); ostream& operator<<(short i) { return *this << (int)i ; } ostream& operator<<(unsigned short i) { return *this << (int)i ; } ostream& operator<< (ostream& (*f)(ostream&)) { return (*f)(*this) ; } ostream& operator<< (ios& (*f)(ios&) ) ; ostream& write(const char* s,int n) { if ( !state ) { if ( bp->sputn(s,n) != n ) setstate(eofbit|failbit); } return *this ; } ostream& write(const unsigned char* s, int n) { return write((const char*)s,n); } protected: /* More ostream members */ int do_opfx() ; void do_osfx() ; ostream() ; public: /*** Obsolete constructors, carried over from stream package ***/ ostream(int fd) ; /* obsolete use fstream */ ostream(int size ,char*) ; /* obsolete, use strstream */ } ; class iostream : public istream, public ostream { public: iostream(streambuf*) ; virtual ~iostream() ; protected: iostream() ; } ; class istream_withassign : public istream { public: istream_withassign() ; virtual ~istream_withassign() ; istream_withassign& operator=(istream&) ; istream_withassign& operator=(streambuf*) ; } ; class ostream_withassign : public ostream { public: ostream_withassign() ; virtual ~ostream_withassign() ; ostream_withassign& operator=(ostream&) ; ostream_withassign& operator=(streambuf*) ; } ; class iostream_withassign : public iostream { public: iostream_withassign() ; virtual ~iostream_withassign() ; iostream_withassign& operator=(ios&) ; iostream_withassign& operator=(streambuf*) ; } ; extern istream_withassign cin ; extern ostream_withassign cout ; extern ostream_withassign cerr ; extern ostream_withassign clog ; ios& dec(ios&) ; ostream& endl(ostream& i) ; ostream& ends(ostream& i) ; ostream& flush(ostream&) ; ios& hex(ios&) ; ios& oct(ios&) ; istream& ws(istream&) ; static class Iostream_init { static int stdstatus ; /* see cstreams.c */ static int initcount ; friend ios ; public: Iostream_init() ; ~Iostream_init() ; } iostream_init ; #endif erator=(streambuf*) ; } ; extern istream_withassign cin ; extern ostream_withassign cout ; extern ostream_withassign cerr ; extern ostream_withassign clog ; ios& dec(ios&) ; ostre./CC/pipestream.h 664 0 0 2024 4371154121 6747 /*ident "@(#)ctrans:incl/pipestream.h 1.1.1.1" */ /************************************************************************** Copyright (c) 1984 AT&T All Rights Reserved THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T The copyright notice above does not evidence any actual or intended publication of such source code. *****************************************************************************/ #ifndef PIPESTREAMH #define PIPESTREAMH #include class pipebuf : public streambuf { public: pipebuf() ; pipebuf(char* p, int l) ; int full() ; int empty() ; public: /* virtuals */ virtual streambuf* setbuf(char* p, int l) ; virtual int overflow(int); virtual int underflow(); virtual int pbackfail(int); protected: void normalize() ; }; class pipestream : public iostream { public: pipestream(); pipestream(char* p, int l) ; ~pipestream() ; pipebuf* rdbuf() ; private: pipebuf buf ; } ; #endif AMH #include class pipebuf : public streambuf { public: pipebuf() ; pipebuf(char* p, int l) ; int full() ; int empty() ; public: /* virtuals */ virtual streambuf* setbuf(char* p, int l) ; virtual int overflow(int); virtual int underflow(); virtual int pbackfail(int); protected: void normalize() ; }; class pipestream : public iostream { public: pipestream(); pipestream(char* p, int l) ; ~pipestream() ; pipebuf* rdbuf() ; private: pipebuf ./CC/stdiostream.h 664 0 0 2177 4554416203 7152 /*ident "@(#)ctrans:incl/stdiostream.h 1.1.1.2" */ /************************************************************************** Copyright (c) 1984 AT&T All Rights Reserved THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T The copyright notice above does not evidence any actual or intended publication of such source code. *****************************************************************************/ #ifndef STDSTREAMH #define STDSTREAMH #include #include class stdiobuf : public streambuf { /*** stdiobuf is obsolete, should be avoided ***/ public: // Virtuals virtual int overflow(int=EOF); virtual int underflow(); virtual int sync() ; virtual streampos seekoff(streamoff,ios::seek_dir,int) ; virtual int pbackfail(int c); public: stdiobuf(FILE* f) ; FILE* stdiofile() { return fp ; } virtual ~stdiobuf() ; private: FILE* fp ; int last_op ; char buf[2]; }; class stdiostream : public ios { public: stdiostream(FILE*) ; ~stdiostream() ; stdiobuf* rdbuf() ; private: stdiobuf buf ; }; #endif e, should be avoided ***/ public: // Virtuals virtual int overflow(int=EOF); virtual int underflow(); virtual int sync() ; virtual streampos seekoff(streamoff,ios::seek_dir,int) ; virtual int pbackfail(int c); public: stdiobuf(FILE* f) ; FILE* stdiofile() { return fp ; } virtual ~stdiobuf() ; private: FILE* fp ; int last_op ; char buf[2]; }; class stdiostrea./CC/stream.h 664 0 0 3256 4554416202 6105 /*ident "@(#)ctrans:incl/stream.h 1.1.5.1" */ /************************************************************************** Copyright (c) 1984 AT&T All Rights Reserved THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T The copyright notice above does not evidence any actual or intended publication of such source code. *****************************************************************************/ #ifndef STREAMH #define STREAMH #include #include #include #ifndef NULL #define NULL 0 #endif extern char* oct(long, int =0); extern char* dec(long, int =0); extern char* hex(long, int =0); extern char* chr(int, int =0); /* chr(0) is the empty string "" */ extern char* str(const char*, int =0); extern char* form(const char* ...); /* printf format * Things may go terribly wrong (maybe even core * dumps, if form tries to create a string with * more than "max_field_width" characters. */ /* WS used to be a special in streams. The WS manipulator * is implemented differently but may be extracted from an istream * with the same effect as the old form. */ extern istream& WS(istream&) ; extern void eatwhite(istream&) ; static const int input = (ios::in) ; static const int output = (ios::out) ; static const int append = (ios::app) ; static const int atend = (ios::ate) ; static const int _good = (ios::goodbit) ; static const int _bad = (ios::badbit) ; static const int _fail = (ios::failbit) ; static const int _eof = (ios::eofbit) ; typedef ios::io_state state_value ; #endif y but may be extracted from an istream * with the same effect as the old form. */ extern istream& WS(istream&) ; extern void eatwhite(istream&) ; static const int input = (ios::in) ; static const int output = (ios::out) ; static const int append = (ios::app) ; static const int atend = (ios::ate) ; static const int _good = (ios::good./CC/streamdefs.h 664 0 0 4211 4377603325 6746 /*ident "@(#)ctrans:lib/stream/streamdefs.h 1.1.2.1" */ /************************************************************************** Copyright (c) 1984 AT&T All Rights Reserved THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T The copyright notice above does not evidence any actual or intended publication of such source code. streamdefs.h: *****************************************************************************/ // This file contains #defines for controlling conditional compilation // of the stream library // The follwing functions adjust for machine dependencies #define BREAKEVEN 10 /* The approximate length of a string * for which it is faster to do a strncpy * than a char by char loop. If BREAKEVEN is 0 * then strncpy is always better. If it is <0 then * loop is always better, (e.g. if strncopy does * a char by char copy anyway.) */ #define SEEK_ARITH_OK 1 /* System supports arithmetic on stream positions. * I.e. if file is at a position and we read or * write n bytes we can find the new position * by adding n to old position. (Providing * O_APPEND isn't set in on open.) */ static const int PTRBASE = ios::hex ; /* base for output of pointers (void*) */ // There is one important machine dependent feature of this implementation // It assumes that it can always create a pointer to the byte after // a char array used as a buffer, and that pointer will be greater than // any pointer into the array. // My reading of the ANSI standard is that this assumption is permissible, // but I can imagine segmented architectures where it fails. /* #define VSPRINTF vsprintf */ /* If defined, the name of a "vsprintf" function. * If not defined, * various non-portable kludges are used in * oldformat.c */ static const int STREAMBUFSIZE = 1024 ; // The default buffer size. /******* #define O_CREAT 01000 #define O_TRUNC 02000 #define O_EXCL 04000 *******/ /* Used in filebuf.c. Define if your system * needs it to have a value different from * that indicated here, but doesn't * define it in standard system headers */ INTF vsprintf */ /* If defined, the name of a "vsprintf" function. * If not defined, * various non-portable kludges are used in * oldformat.c */ static const int STREAMBUFSIZE = 1024 ; // The default buffer size. /******* #define O_CREAT 01000 #define O_TRUNC 02000 #define O_EXCL 04000 *******/ /* Used in filebuf.c. Define if your syste./CC/strstream.h 664 0 0 3725 4554416202 6637 /*ident "@(#)ctrans:incl/strstream.h 1.1.1.1" */ /************************************************************************** Copyright (c) 1984 AT&T All Rights Reserved THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T The copyright notice above does not evidence any actual or intended publication of such source code. *****************************************************************************/ #ifndef STRSTREAMH #define STRSTREAMH #include class strstreambuf : public streambuf { public: strstreambuf() ; strstreambuf(int) ; strstreambuf(void* (*a)(long), void (*f)(void*)) ; strstreambuf(char* b, int size, char* pstart = 0 ) ; strstreambuf(unsigned char* b, int size, unsigned char* pstart = 0 ) ; void freeze(int n=1) ; char* str() ; ~strstreambuf() ; public: /* virtuals */ virtual int doallocate() ; virtual int overflow(int) ; virtual int underflow() ; virtual streambuf* setbuf(char* p, int l) ; virtual streampos seekoff(streamoff,ios::seek_dir,int) ; private: void init(char*,int,char*) ; void* (*afct)(long) ; void (*ffct)(void*) ; int ignore_oflow ; int froozen ; int auto_extend ; public: } ; class strstreambase : public virtual ios { public: strstreambuf* rdbuf() ; protected: strstreambase(char*, int, char*) ; strstreambase() ; ~strstreambase() ; private: strstreambuf buf ; } ; class istrstream : public strstreambase, public istream { public: istrstream(char* str); istrstream(char* str, int size ) ; ~istrstream() ; } ; class ostrstream : public strstreambase, public ostream { public: ostrstream(char* str, int size, int=ios::out) ; ostrstream() ; ~ostrstream() ; char* str() ; int pcount() ; } ; class strstream : public strstreambase, public iostream { public: strstream() ; strstream(char* str, int size, int mode) ; ~strstream() ; char* str() ; } ; #endif eam : public strstreambase, public istream ./CC/stdio.h 664 0 0 4342 5355370762 5743 /* @(#)stdio.h 84/11/10 */ #ifndef STDIO_H #define STDIO_H 1 #define BUFSIZ 4096 #define _NFILE 120 # ifndef FILE extern struct _iobuf { int _cnt; unsigned char *_ptr; unsigned char *_base; short _flag; char _file; } _iob[_NFILE]; # endif #define _IOREAD 01 #define _IOWRT 02 #define _IONBF 04 #define _IOMYBUF 010 #define _IOEOF 020 #define _IOERR 040 #define _IOSTRG 0100 #define _IOLBF 0200 #define _IORW 0400 #define NULL 0 #define FILE struct _iobuf #define EOF (-1) extern "C" { extern int _flsbuf(unsigned,FILE*); extern int _filbuf(FILE*); } #define stdin (&_iob[0]) #define stdout (&_iob[1]) #define stderr (&_iob[2]) #define getc(p) (--(p)->_cnt>=0? *(p)->_ptr++&0377:_filbuf(p)) #define getchar() getc(stdin) #define putc(x,p) (--(p)->_cnt>=0? ((int)(*(p)->_ptr++=(unsigned)(x))):_flsbuf((unsigned)(x),p)) #define putchar(x) putc(x,stdout) #define feof(p) (((p)->_flag&_IOEOF)!=0) #define ferror(p) (((p)->_flag&_IOERR)!=0) #define fileno(p) ((p)->_file) extern "C" { extern FILE* fopen(const char*, const char*); extern FILE* fdopen(int, const char*); extern FILE* freopen(const char*, const char*, FILE*); extern long ftell(const FILE*); extern char* fgets(char*, int, FILE*); #define P_tmpdir "/tmp/" #define L_tmpnam (sizeof(P_tmpdir) + 15) extern puts(const char*); extern fputs(const char*, FILE*); extern int printf(const char* ...); extern int fprintf(FILE*, const char* ...); extern int sprintf(char*, const char* ...); extern int snprintf(char*, const char* ...); extern int scanf(const char* ...); extern int fscanf(FILE*, const char* ...); extern int sscanf(char*, const char* ...); extern int fread(char*, int, int, FILE*); extern int fwrite(const char*, int, int, FILE*); extern int fclose(FILE*); extern fflush(FILE*); extern clearerr(FILE*); extern int fseek(FILE*, long, int); extern int rewind(FILE*); extern int getw(FILE*); extern int fgetc(FILE*); extern FILE* popen(const char*, const char*); extern int pclose(FILE*); extern int putw(int, FILE*); extern int fputc(int, FILE*); extern setbuf(FILE*, char*); extern int ungetc(int, FILE*); extern int vfprintf(FILE *, const char *, char *); extern int vprintf(const char *, char *); extern int vsprintf(char *, const char *, char *); }; #endif n fflush(FILE*); extern clearerr(FILE*); extern int fseek(FILE*, long, int); extern int rewind(FILE*); extern int getw(FILE*); extern int fgetc(FILE*); extern FILE* popen(const char*, const char*); extern int pclose(FILE*); extern int putw(int, FILE*); extern int fputc(int, FI./CC/sysent.h 664 0 0 3234 4376574342 6147 #ifndef __SYSENT_H #define __SYSENT_H 1 /* some functions from the UNIX manual section 2 INCOMPLETE: contains only declarations of functions that (1) is not declared with their data structures (2) are identically declared in UNIX5.2 and bsd4.2 */ extern "C" { /* extern const char* ctermid(const char*); */ extern int system(const char*); extern int access(const char*, int); extern int acct(const char*); extern alarm(unsigned); /* extern const char* brk(int); */ extern const char* sbrk(int); extern int chdir(const char*); extern int chmod(const char*, int); extern int chown(const char*, int, int); extern int close(int); extern int creat(const char*, int); extern int dup(int); extern int execl(const char* ...); extern int execv(const char*, const char**); extern int execle(const char* ...); extern int execve(const char*, const char**, const char**); extern void exit(int), _exit(int); extern int fork(); extern int getpid(); extern int ioctl(int, int ...); extern int kill(int, int); extern int link(const char*, const char*); extern long lseek(int, long, int); extern int mknod(const char*, int, int); extern int mount(const char*, const char*, int); extern int nice(int); extern int open(const char*, int); extern pause(); extern int pipe(int*); /* extern void profil(const char*, int, int, int); */ extern int setuid(int); extern int setgid(int); extern int sleep(int); extern int stime(long*); extern void sync(); extern int umask(int); extern int umount(const char*); extern int unlink(const char*); extern int wait(int*); extern int read(int, const char*, int); extern int write(int, const char*, int); } #endif char*, const char*, int); extern int nice(int); extern int open(const char*, int); extern pause(); extern int pipe(int*); /* extern void profil(const char*, int, int, int); */ extern int setuid(int); extern int setgid(int); extern int sleep(int); extern int stime(long*); extern void sync(); extern int umask(int); extern int umount(const char./CC/string.h 664 0 0 1460 5516574511 6122 // : the C string functions, UNIX Programmers Manual vol 1 section 3 extern "C" { extern char* strcat(char*, const char*); extern char* strncat(char*, const char*, size_t); extern int strcmp(const char*, const char*); extern int strncmp(const char*, const char*, size_t); extern char* strcpy(char*, const char*); extern char* strncpy(char*, const char*, size_t); extern int strlen(const char*); // bsd: //extern char* index(char*, int); //extern char* rindex(char*, int); extern char* strchr(const char*, int); extern char* strrchr(const char*, int); extern char* strpbrk(const char*, const char*); extern int strspn(const char*, const char*); extern int strcspn(const char*, const char*); extern char* strtok(char*, const char*); extern char* strdup(const char*); } #include cpy(char*, const char*); extern char* strncpy(char*, const char*, size_t); extern int strlen(const char*); // bsd: //extern char* index(char*, int); //extern char* rindex(char*, int); extern char* strch./CC/dir.h 664 0 0 2113 4215602116 5352 /* * This sets the "page size" for directories. * Requirements are DEV_BSIZE <= DIRBLKSIZ <= MINBSIZE with * DIRBLKSIZ a power of two. * Dennis Ritchie feels that directory pages should be atomic * operations to the disk, so we use DEV_BSIZE. */ #define DIRBLKSIZ 512 /* * This limits the directory name length. Its main constraint * is that it appears twice in the user structure. (u. area) */ #define MAXNAMLEN 255 struct direct { u_long d_ino; short d_reclen; short d_namlen; char d_name[MAXNAMLEN + 1]; /* typically shorter */ }; struct _dirdesc { int dd_fd; long dd_loc; long dd_size; char dd_buf[DIRBLKSIZ]; }; #undef DIRSIZ inline int DIRSIZ(direct* dp) { return ~(sizeof(ino_t) - 1) & (sizeof(struct direct) - MAXNAMLEN + dp->d_namlen + sizeof(ino_t) - 1); } typedef struct _dirdesc DIR; /* * functions defined on directories */ extern "C" { extern DIR *opendir(char*); extern direct *readdir(DIR*); extern long telldir(DIR*); extern void seekdir(DIR*,long); extern void closedir(DIR*); } inline void rewinddir(DIR* dirp) { seekdir(dirp, 0); } dd_loc; long dd_size; char dd_buf[DIRBLKSIZ]; }; #undef DIRSIZ inline int DIRSIZ(direct* dp) { return ~(sizeof(ino_t) - 1) & (sizeof(struct direct) - MAXNAMLEN + dp->d_namlen + sizeof(ino_t) - 1); } typedef struct _dirdesc DIR; /* * functions defined on directories */ extern "C" { extern DIR *opendir(char*); extern direct *readdir(DIR*); extern long telldir(DIR*); extern void seekdir(DIR*,long); extern void./CC/pwd.h 664 0 0 621 4215602117 5351 struct passwd { /* see getpwent(3) */ char *pw_name; char *pw_passwd; int pw_uid; int pw_gid; int pw_quota; char *pw_comment; char *pw_gecos; char *pw_dir; char *pw_shell; }; extern "C" { extern struct passwd *getpwent(); extern struct passwd *getpwuid(int); extern struct passwd *getpwnam(char*); extern struct passwd *pwdecode(char*); extern int setpwent(); extern int endpwent(); } har*); extern direct *readdir(DIR*); extern long telldir(DIR*); extern void seekdir(DIR*,long); extern void./CC/signal.h 664 0 0 4422 4420716140 6057 #ifndef NSIG #define NSIG 32 #define SIGHUP 1 /* hangup */ #define SIGINT 2 /* interrupt */ #define SIGQUIT 3 /* quit */ #define SIGILL 4 /* illegal instruction (not reset when caught) */ #define SIGTRAP 5 /* trace trap (not reset when caught) */ #define SIGIOT 6 /* IOT instruction */ #define SIGEMT 7 /* EMT instruction */ #define SIGFPE 8 /* floating point exception */ #define K_INTOVF 1 /* integer overflow */ #define K_INTDIV 2 /* integer divide by zero */ #define K_FLTOVF 3 /* floating overflow */ #define K_FLTDIV 4 /* floating/decimal divide by zero */ #define K_FLTUND 5 /* floating underflow */ #define K_DECOVF 6 /* decimal overflow */ #define K_SUBRNG 7 /* subscript out of range */ #define SIGKILL 9 /* kill (cannot be caught or ignored) */ #define SIGKIL 9 #define SIGBUS 10 /* bus error */ #define SIGSEGV 11 /* segmentation violation */ #define SIGSYS 12 /* bad argument to system call */ #define SIGPIPE 13 /* write on a pipe with no one to read it */ #define SIGALRM 14 /* alarm clock */ #define SIGTERM 15 /* software termination signal from kill */ #define SIGSTOP 17 /* sendable stop signal not from tty */ #define SIGTSTP 18 /* stop signal from tty */ #define SIGCONT 19 /* continue a stopped process */ #define SIGCHLD 20 /* to parent on child stop or exit */ #define SIGTTIN 21 /* to readers pgrp upon background tty read */ #define SIGTTOU 22 /* like TTIN for output if (tp->t_local<OSTOP) */ #define SIGTINT 23 /* to pgrp on every input character if LINTRUP */ #define SIGXCPU 24 /* exceeded CPU time limit */ #define SIGXFSZ 25 /* exceeded file size limit */ typedef void SIG_FUNC_TYP(int); typedef SIG_FUNC_TYP* SIG_TYP; // obsolescent? typedef SIG_FUNC_TYP* SIG_PF; #ifndef KERNEL extern "C" { SIG_FUNC_TYP* signal(int, SIG_FUNC_TYP*); } #endif #define BADSIG (SIG_FUNC_TYP*)-1 #define SIG_DFL (SIG_FUNC_TYP*)0 #define SIG_IGN (SIG_FUNC_TYP*)1 #ifdef KERNEL #define SIG_CATCH (SIG_FUNC_TYP*)2 #endif #define SIG_HOLD (SIG_FUNC_TYP*)3 #define SIGISDEFER(x) (((int)(x) & 1) != 0) #define SIGUNDEFER(x) (SIG_FUNC_TYP*)((int)(x) &~ 1) #define DEFERSIG(x) (SIG_FUNC_TYP*)((int)(x) | 1) #define SIGNUMMASK 0377 /* to extract pure signal number */ #define SIGDOPAUSE 0400 /* do pause after setting action */ #define SIGDORTI 01000 /* do ret+rti after setting action */ #endif _FUNC_TYP*)-1 #define SIG_DFL (SIG_FUNC_TYP*)0 #define SIG_IGN (SIG_FUNC_TYP*)1 #ifdef KERNEL #define SIG_CATCH (SIG_FUNC_TYP*)2 #endif #define SIG_HOLD (SIG_FUNC_TYP*)3 #define SIGISDEFER(x) (((int)(x) & 1) != 0) #define SIGUNDEFER(x)./CC/ipc.h 664 0 0 2170 4352312460 5354 /* information returned by listen */ struct ipcinfo { int rfd; /* fd for reply */ int cfd; /* fd for communications */ char *myname; /* translated part of name */ char *name; /* untranslated part of name */ char *param; /* parameters used to set up call */ char *machine; /* machine id of caller */ char *user; /* user name of caller */ int uid, gid; /* uid, gid of caller */ char flags; /* type of communication */ }; /* communication flags */ #define IPC_OPEN 0x0 #define IPC_CREAT 0x1 #define IPC_HANDOFF 0x2 #define IPC_CAREFUL 0x4 /* library definitions */ extern "C" { extern int ipcopen(const char*, const char*); extern int ipccreat(const char*, const char*); extern ipcinfo* ipclisten(int); extern ipcinfo* ipctrylisten(int); extern int ipcaccept(ipcinfo*); extern int ipcdaccept(ipcinfo*, int, const char*); extern int ipcreject(ipcinfo*, int, const char*); extern int ipclogin(int); extern int ipcrogin(int, int); extern char* ipcpath(const char*, const char*, const char*); extern int ipcexec(const char*, const char*, const char*); } /* import */ extern int errno; extern char* errstr; extern char* ipcname; extern int ipccreat(const char*, const char*); extern ipcinfo* ipclisten(int); extern ipcinfo* ipctrylisten(int); extern int ipcaccept(ipcinfo*); extern int ipcdaccept(ipcinfo*, int, const char*); extern int ipcreject(ipcinfo*, int, const char*); extern int ipclogin(int); extern int ipcrogin(int, int); extern char* ipcpath(const char*, const char*, const char*); extern int ipcex./CC/math.h 664 0 0 1631 5355360172 5542 extern "C" { extern double fabs(double), floor(double), ceil(double), modf(double, double*), frexp(double, int*), ldexp(double, int), sqrt(double), hypot(double, double), cabs(double, double), atof(const char*), sin(double), cos(double), tan(double), asin(double), acos(double), atan(double), atan2(double, double), exp(double), log(double), log10(double), pow(double, double), sinh(double), cosh(double), tanh(double), gamma(double), besj0(double), besj1(double), besjn(int, double), y0(double), besy1(double), besyn(int, double), erf(double), erfc(double), frand(), fmod(double, double); } #define MAXFLOAT 170141173319264429905852091742258462720.0 #define MAXDOUBLE 170141183460469229370504062281061498880.0 #define HUGE MAXFLOAT /* kludge */ #define HUGE_VAL MAXDOUBLE #define PI 3.1415926535897932384626433832795028841971693993751 #define PI2 (2*PI) double), sinh(double), cosh(double), tanh(double), gamma(double), besj0(double), besj1(dou./CC/errno.h 664 0 0 367 4216362200 5710 #include "../errno.h" /* complex */ #define C_COSH_RE 40 #define C_COSH_IM 41 #define C_EXP_RE_POS 42 #define C_EXP_RE_NEG 43 #define C_EXP_IM 44 #define C_LOG_0 45 #define C_SINH_RE 46 #define C_SINH_IM 47 extern "C" { void perror (char*); } 62281061498880.0 #define HUGE MAXFLOAT /* kludge */ #define HUGE_VAL MAXDOUBLE #define PI 3.1415926535897932384626433832795028841971693993751 #define PI2 (2*PI) double), sinh(double), cosh(double), tanh(double), gamma(double), besj0(double), besj1(dou./CC/libc.h 664 0 0 4030 5522770155 5520 /* some functions from the UNIX manual section 3 */ #ifndef __LIBC #define __LIBC #include extern "C" { extern int abort(); extern char* crypt(char*, char*); extern void setkey(char*); extern void encrypt(char*, int); extern char* ecvt(double, int, int*, int*); extern char* fcvt(double, int ,int*, int*); extern char* gcvt(double, int, char*); extern double frexp(double, int*); extern double ldexp(double, int); extern double modf(double, double*); extern char* getenv(char*); extern char* getlogin(); extern char* getpass(char*); extern int getpw(int, char*); extern void l3tol(long*, char*, int); extern void ltol3(char*, long*, int); extern char *malloc(unsigned); extern void free(char *); extern char *realloc(char *, unsigned); extern char *calloc(unsigned, unsigned); extern void cfree(char*); extern char* mktemp(char*); extern void perror(char*); extern void qsort(void*, size_t, size_t, int(*)(const void*, const void*)); extern void swab(char*, char*, int); extern int system(const char*); extern char* ttyname(int); extern int isatty(int); extern int ttyslot(); extern int onexit(auto int(*)()); extern int atexit(auto void(*)()); extern void exit(int); extern void _exit(int); extern int rand(); extern long lrand(); extern double frand(); extern int nrand(int); extern void srand(int); extern print(const char* ...); extern fprint(int, const char* ...); extern sprint(char*, const char* ...); extern int tolower(int); extern int toupper(int); extern int getfields(char *, char**, int); extern int getmfields(char *, char**, int); extern char *setfields(char *); extern int atoi(const char*); extern double atof(const char*); extern long atol(const char*); extern double strtod(const char*, char**); extern long strtol(const char*, char**, int); extern unsigned long strtoul(const char*, char**, int); extern int abs(int); extern long labs(long); extern int gcd(int, int); extern long lcm(int, int); extern int min(int, int); extern int max(int, int); extern int sgn(int); } #endif extern int getmfields(char *, char**, int); extern char *setfields(char *); extern int atoi(const char*); extern double atof(const char*); extern long atol(const char*); extern double strtod(const char*, char**); extern long strtol(const char*, char**, int); extern unsigned long strtoul(const char*, char**, int); extern int abs(int); extern long labs(long); extern int gcd(int, int); extern long lcm(int, int); extern int min(int, int); extern int max(int, int); extern./CC/task.h 664 0 0 27536 4550460410 5577 /*ident "%W%" */ /************************************************************************** Copyright (c) 1984 AT&T All Rights Reserved THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T The copyright notice above does not evidence any actual or intended publication of such source code. *****************************************************************************/ #ifndef TASKH #define TASKH /* HEADER FILE FOR THE TASK SYSTEM */ #include #include #define SIZE 750 class object; class sched; /* : public object */ class timer; /* : public sched */ class task; /* : public sched */ class qhead; /* : public object */ class qtail; /* : public object */ class team; /* o_type() */ typedef enum { OBJECT, TIMER, TASK, QHEAD, QTAIL } objtype; /* sched::s_state */ typedef enum { IDLE=1, RUNNING=2, TERMINATED=4 } statetype; /* type of stack, task::t_mode */ typedef enum { DEDICATED=1, SHARED=2 } modetype; #if defined(_SHARED_ONLY) #define DEFAULT_MODE SHARED #else #define DEFAULT_MODE DEDICATED #endif /* loc on stack */ #define UNTOUCHED 052525 /* error codes */ #define task_error_messages \ macro_start \ macro(0,E_ERROR,"") \ macro(1,E_OLINK,"object::delete(): has chain") \ macro(2,E_ONEXT,"object::delete(): on chain") \ macro(3,E_GETEMPTY,"qhead::get(): empty") \ macro(4,E_PUTOBJ,"qtail::put(): object on other queue") \ macro(5,E_PUTFULL,"qtail::put(): full") \ macro(6,E_BACKOBJ,"qhead::putback(): object on other queue") \ macro(7,E_BACKFULL,"qhead::putback(): full") \ macro(8,E_SETCLOCK,"sched::setclock(): clock!=0") \ macro(9,E_CLOCKIDLE,"sched::schedule(): clock_task not idle") \ macro(10,E_RESTERM,"sched::insert(): cannot schedule terminated sched") \ macro(11,E_RESRUN,"sched::schedule(): running") \ macro(12,E_NEGTIME,"sched::schedule(): clock<0") \ macro(13,E_RESOBJ,"sched::schedule(): task or timer on other queue") \ macro(14,E_HISTO,"histogram::histogram(): bad arguments") \ macro(15,E_STACK,"task::restore() or task::task(): stack overflow") \ macro(16,E_STORE,"new: free store exhausted") \ macro(17,E_TASKMODE,"task::task(): bad mode") \ macro(18,E_TASKDEL,"task::~task(): not terminated") \ macro(19,E_TASKPRE,"task::preempt(): not running") \ macro(20,E_TIMERDEL,"timer::~timer(): not terminated") \ macro(21,E_SCHTIME,"sched::schedule(): runchain corrupted: bad time") \ macro(22,E_SCHOBJ,"sched object used directly (not as base)") \ macro(23,E_QDEL,"queue::~queue(): not empty") \ macro(24,E_RESULT,"task::result(): thistask->result()") \ macro(25,E_WAIT,"task::wait(): wait for self") \ macro(26,E_FUNCS,"FrameLayout::FrameLayout(): function start") \ macro(27,E_FRAMES,"FrameLayout::FrameLayout(): frame size") \ macro(28,E_REGMASK,"task::fudge_return(): unexpected register mask") \ macro(29,E_FUDGE_SIZE,"task::fudge_return(): frame too big") \ macro(30,E_NO_HNDLR,"sigFunc - no handler for signal") \ macro(31,E_BADSIG,"illegal signal number") \ macro(32,E_LOSTHNDLR,"Interrupt_handler::~Interrupt_handler(): signal handler not on chain") \ macro_end(E_LOSTHNDLR) #define macro_start #define macro(num,name,string) const name = num ; #define macro_end(last_name) const MAXERR = last_name; task_error_messages #undef macro_start #undef macro #undef macro_end typedef int (*PFIO)(int,object*); typedef void (*PFV)(); /* print flags, used as arguments to class print functions */ #define CHAIN 1 #define VERBOSE 2 #define STACK 4 /* DATA STRUCTURES */ /* object --> olink --> olink ... | | | ... V V | task task V object --> ... */ class olink /* the building block for chains of task pointers */ { friend object; olink* l_next; task* l_task; olink(task* t, olink* l) { l_task=t; l_next=l; }; }; class object { friend sched; friend task; olink* o_link; static task* thxstxsk; public: object* o_next; virtual objtype o_type() { return OBJECT; } object() { o_link=0; o_next=0; } virtual ~object(); void remember(task* t) { // save for alert o_link = new olink(t,o_link); } void forget(task*); // remove all occurrences of task from chain void alert(); // prepare IDLE tasks for scheduling virtual int pending(); // TRUE if this object should be waited for virtual void print(int, int =0); // 1st arg VERBOSE, CHAIN, or STACK static int task_error(int, object*); // the central error function int task_error(int); // obsolete; use static version static task* this_task() { return thxstxsk; } static PFIO error_fct; // user-supplied error function }; // fake compatibility with previous version #define thistask (object::this_task()) class sched : public object { // only instances of subclasses are used friend timer; friend task; friend object; friend SIG_FUNC_TYP sigFunc; static int keep_waiting_count; static sched* runchain; // list of ready-to-run scheds (by s_time) static sched* priority_sched; // if non-zero, sched to run next static long clxck; static int exit_status; long s_time; /* time to sched; result after cancel() */ statetype s_state; /* IDLE, RUNNING, TERMINATED */ void schedule(); /* sched clock_task or front of runchain */ virtual void resume(); void insert(int,object*); /* sched for d time units, t_alert=obj */ void remove(); /* remove from runchain & make IDLE */ protected: sched() : s_time(0), s_state(IDLE) {} public: static void _print_error(int n); static void setclock(long); static long get_clock() { return clxck; } static sched* get_run_chain() { return runchain; } static int get_exit_status() { return exit_status; } static void set_exit_status( int i ) { exit_status = i; } sched* get_priority_sched() { return priority_sched; } static task* clock_task; // awoken at each clock tick long rdtime() { return s_time; }; statetype rdstate() { return s_state; }; int pending() { return s_state != TERMINATED; } int keep_waiting() { return keep_waiting_count++; } int dont_wait() { return keep_waiting_count--; } void cancel(int); int result(); virtual void setwho(object* t); // who alerted me void print(int, int =0); static PFV exit_fct; // user-supplied exit function }; // for compatibility with pre-2.0 releases, // but conflicts with time.h //#define clock (sched::get_clock()) inline void setclock(long i) { sched::setclock(i); } // for compatibility with pre-2.0 releases #define run_chain (sched::get_run_chain()) class timer : public sched { void resume(); public: timer(int); ~timer(); void reset(int); objtype o_type() { return TIMER; } void setwho(object* t) { } // do nothing void print(int, int =0); }; extern _hwm; class task : public sched { friend sched; static task* txsk_chxin; /* list of all tasks */ static team* team_to_delete; // delete this team after task switch void restore(task*, int =0); /* switch to new task */ int curr_hwm(); /* "high water mark" */ /* (how high stack has risen) */ int swap_stack(int*,int*); /* initialize child stack */ void fudge_return(int*); //used in starting new tasks void copy_share(); // used in starting shared tasks void get_size(); // ditto -- saves size of active stack void resume(); /* simple check for stack overflow--not used for main task */ void settrap(); void checktrap(); /* WARNING: t_framep, th, and t_ap are manipulated as offsets from * task by swap(); those, and t_basep, t_size, and t_savearea are * manipulated as offsets by sswap(). * Do not insert new data members before these. */ int* t_framep; // fp for this task when suspended void* th; /* fudge return from swap */ int* t_ap; /* arg pointer for this task when suspended */ int* t_basep; // addr of stack when running int t_size; /* size of active stack (used for SHARED) * holds hwm after cancel() */ int* t_savearea; // addr of stack when not running (SHARED only) int t_trap; // used for stack overflow check team* t_team; /* stack and info for sharing */ modetype t_mode; /* DEDICATED/SHARED stack */ int t_stacksize; object* t_alert; /* object that inserted you */ protected: task(char* name=0, modetype mode=DEFAULT_MODE, int stacksize=SIZE); public: ~task(); objtype o_type() { return TASK; } task* t_next; /* insertion in "task_chain" */ char* t_name; static task* get_task_chain() { return txsk_chxin; } int waitvec(object**); int waitlist(object* ...); void wait(object* ob); void delay(int); int preempt(); void sleep(object* t =0); // t is remembered void resultis(int); void cancel(int); void setwho(object* t) { t_alert = t; } void print(int, int =0); object* who_alerted_me() { return t_alert; } }; // for compatibility #define task_chain (task::get_task_chain()) // an Interrupt_handler supplies an interrupt routine that runs when the // interrupt occurs (real time). Also the Interrupt_handler can be waited for. class Interrupt_handler : public object { friend class Interrupt_alerter; friend SIG_FUNC_TYP sigFunc; int id; // signal or interrupt number int got_interrupt; // an interrupt has been received // but not alerted Interrupt_handler *old; // previous handler for this signal virtual void interrupt(); // runs at real time public: int pending(); // FALSE once after interrupt Interrupt_handler(int sig_num); ~Interrupt_handler(); }; /* QUEUE MANIPULATION (see queue.c) */ /* qhead <--> oqueue <--> qtail (qhead, qtail independent) oqueue ->> circular queue of objects */ /* qh_modes */ typedef enum { EMODE, WMODE, ZMODE } qmodetype; class oqueue { friend qhead; friend qtail; int q_max; int q_count; object* q_ptr; qhead* q_head; qtail* q_tail; oqueue(int m) { q_max=m; q_count=0; q_head=0; q_tail=0; }; ~oqueue() { (q_count)?object::task_error(E_QDEL,0):0; }; void print(int); }; class qhead : public object { friend qtail; qmodetype qh_mode; /* EMODE,WMODE,ZMODE */ oqueue* qh_queue; public: qhead(qmodetype = WMODE, int = 10000); ~qhead(); objtype o_type() { return QHEAD; } object* get(); int putback(object*); int rdcount() { return qh_queue->q_count; } int rdmax() { return qh_queue->q_max; } qmodetype rdmode() { return qh_mode; } qtail* tail(); qhead* cut(); void splice(qtail*); void setmode(qmodetype m) { qh_mode = m; }; void setmax(int m) { qh_queue->q_max = m; }; int pending() { return rdcount() == 0; } void print(int, int =0); }; class qtail : public object { friend qhead; qmodetype qt_mode; oqueue* qt_queue; public: qtail(qmodetype = WMODE, int = 10000); ~qtail(); objtype o_type() { return QTAIL; } int put(object*); int rdspace() { return qt_queue->q_max - qt_queue->q_count; }; int rdmax() { return qt_queue->q_max; }; qmodetype rdmode() { return qt_mode; }; qtail* cut(); void splice(qhead*); qhead* head(); void setmode(qmodetype m) { qt_mode = m; }; void setmax(int m) { qt_queue->q_max = m; }; int pending() { return rdspace() == 0; } void print(int, int =0); }; struct histogram /* "nbin" bins covering the range [l:r] uniformly nbin*binsize == r-l */ { int l, r; int binsize; int nbin; int* h; long sum; long sqsum; histogram(int=16, int=0, int=16); void add(int); void print(); }; /* the result of randint() is always >= 0 */ #define DRAW (randx = randx*1103515245 + 12345) #define ABS(x) (x&0x7fffffff) #define MASK(x) ABS(x) class randint /* uniform distribution in the interval [0,MAXINT_AS_FLOAT] */ { long randx; public: randint(long s = 0) { randx=s; } void seed(long s) { randx=s; } int draw() { return MASK(DRAW); } float fdraw(); }; class urand : public randint /* uniform distribution in the interval [low,high] */ { public: int low, high; urand(int l, int h) { low=l; high=h; } int draw(); }; class erand : public randint /* exponential distribution random number generator */ { public: int mean; erand(int m) { mean=m; }; int draw(); }; // This task will alert Interrupt_handler objects. class Interrupt_alerter : public task { public: Interrupt_alerter(); }; extern Interrupt_alerter interrupt_alerter; #endif oat fdraw(); }; class urand : public randint /* uniform distribution in the interval [low,high] */ { public: int low, high; urand(int l, int h) { low=l; high=./CC/time.h 664 0 0 625 4215602120 5513 struct tm { /* see ctime(3) */ int tm_sec; int tm_min; int tm_hour; int tm_mday; int tm_mon; int tm_year; int tm_wday; int tm_yday; int tm_isdst; }; extern "C" { extern long time(long*); extern char* ctime(long*); extern tm* localtime(long*); extern tm* gmtime(long*); extern char* asctime(tm*); } /* extern long timezone; extern int daylight; extern char* tzname[2]; void tzset(); */ m distribution in the interval [low,high] */ { public: int low, high; urand(int l, int h) { low=l; high=./CC/regexp.h 664 0 0 463 5355366314 6071 #define NSUBEXP 10 struct regexp { /* see regexp(3) */ char *startp[NSUBEXP]; char *endp[NSUBEXP]; char program[1]; }; extern "C" { extern regexp* regcomp(const char *); extern int regexec(regexp*, const char*); extern void regsub(const regexp*, const char*, char*); extern void regerror(char*); } m*); } /* extern long timezone; extern int daylight; extern char* tzname[2]; void tzset(); */ m distribution in the interval [low,high] */ { public: int low, high; urand(int l, int h) { low=l; high=./CC/complex.h 664 0 0 3522 4205657047 6264 #include #include #include inline double abs(double d) { return fabs(d); } class complex { double re, im; public: complex(double r, double i) { re=r; im=i; } complex(double r) { re=r; im=0; } complex() { re=0; im=0; } friend double real(const complex& a ) { return a.re; } friend double imag(const complex& a ) { return a.im; } friend double abs(complex); friend double norm(complex); friend double arg(complex); friend complex conj(complex a) { return complex(a.re, -a.im); } friend complex cos(complex); friend complex cosh(complex); friend complex exp(complex); friend complex log(complex); friend complex pow(double, complex); friend complex pow(complex, int); friend complex pow(complex, double); friend complex pow(complex, complex); friend complex polar(double, double = 0); friend complex sin(complex); friend complex sinh(complex); friend complex sqrt(complex); friend complex operator+(complex a1, complex a2) { return complex(a1.re+a2.re, a1.im+a2.im); } friend complex operator-(complex a1, complex a2) { return complex(a1.re-a2.re, a1.im-a2.im); } friend complex operator-(complex a) { return complex(-a.re, -a.im); } friend complex operator*(complex, complex); friend complex operator/(complex, complex); friend int operator==(complex a, complex b) { return a.re==b.re && a.im==b.im; } friend int operator!=(complex a, complex b) { return a.re!=b.re || a.im!=b.im; } friend int operator==(complex, complex); friend int operator!=(complex, complex); void operator+=(complex a) { re += a.re; im += a.im; } void operator-=(complex a) { re -= a.re; im -= a.im; } void operator*=(complex); void operator/=(complex); }; ostream& operator<<(ostream&, complex); istream& operator>>(istream&, complex&); void complex_error(int,double); extern int errno; return a.re==b.re && a.im==b.im; } friend int operator!=(complex a, complex b) { return a.re!=b.re || a.im!=b.im; } friend int operator==(complex, complex); friend i./CC/memory.h 664 0 0 474 5516572611 6107 extern "C" { extern void* memccpy(void*, const void*, int, size_t); extern void* memchr(const void*, int, size_t); extern int memcmp(const void*, const void*, size_t); extern void* memcpy(void*, const void*, size_t); extern void* memset(void*, int, size_t); extern void* memmove(void*, const void*, size_t); } ); extern int errno; return a.re==b.re && a.im==b.im; } friend int operator!=(complex a, complex b) { return a.re!=b.re || a.im!=b.im; } friend int operator==(complex, complex); friend i./CC/assert.h 664 0 0 311 4420164666 6066 #ifndef __ASSERT_H #define __ASSERT_H 1 #ifndef NDEBUG extern "C" { int _assert (char*, int); } #define assert(e) (void)((e)||_assert(__FILE__,__LINE__)) #else #define assert(e) (void)1 #endif #endif nst void*, size_t); extern void* memset(void*, int, size_t); extern void* memmove(void*, const void*, size_t); } ); extern int errno; return a.re==b.re && a.im==b.im; } friend int operator!=(complex a, complex b) { return a.re!=b.re || a.im!=b.im; } friend int operator==(complex, complex); friend i./CC/fio.h 664 0 0 3257 5355373274 5403 #define FIOBSIZE 4096 typedef struct Fbuffer { unsigned char *next; /* next char to be used */ unsigned char *end; /* first invalid char */ unsigned char *lnext; /* previous value of next */ unsigned short flags; /* see FIO_.* below */ short oflush; /* if >= 0 fd to flush on read */ long offset; /* seek of end */ unsigned char buf[FIOBSIZE]; } Fbuffer; extern Fbuffer *Ffb[]; #define FIORESET(f) ((f)->next=(f)->lnext=(f)->end=(f)->buf, (f)->flags=0, (f)->oflush= -1) #define FIOSET(f, fd) if((f=Ffb[fd&=0x7f]) == 0){Finit(fd,(char *)0);f=Ffb[fd];} /* FIOLINELEN is length of last input */ #define FIOLINELEN(fd) (((int)(Ffb[fd]->next - Ffb[fd]->lnext))-1) /* FIOSEEK is lseek of next char to be processed */ #define FIOSEEK(fd) (Ffb[fd]->offset - (Ffb[fd]->end - Ffb[fd]->next)) #define FIOFLUSH(fd) if((fd >= 0) && Ffb[fd]) Fflush(fd) #define FIO_RDLAST 0x0001 /* true if last input was rdline */ #define FIO_WRITING 0x0002 /* true if last action was write */ extern "C" { extern void Finit(int, char *); extern char *Frdline(int); extern void Fundo(int); extern int Fgetc(int); extern long Fread(int, char *, long); extern long Fwrite(int, char*, long); extern long Fseek(int, long, int); extern int Fflush(int); extern int Fprint(int, char * ...); extern int Fputc(int, char); extern int Fclose(int); extern void Ftie(int, int); extern void Fexit(int); } #ifdef FIO_IMP /* COUNT is the type of counts to things like read, write, memcpy etc */ #ifdef GNOT #define COUNT long #define FIOMALLOC(n) malloc(n) #define SEEK(a,b,c) seek(a,b,c) #else #define COUNT int #define FIOMALLOC(n) malloc(n) #define SEEK(a,b,c) lseek(a,b,c) #endif extern COUNT read(), write(); #endif Fseek(int, long, int); extern int Fflush(int); extern int Fprint(int, char * ...); extern int Fputc(int, char); extern int Fclose(int); extern void Ftie(int, int); extern void Fexit(int); } #ifdef FIO_IMP /* COUNT is the type of counts to things like read, write, memcpy etc */ #ifdef GNOT #define COUNT long #define FIOMALLOC(n)./CC/getflags.h 664 0 0 366 4376030110 6355 #define NFLAG 128 #define NCMDLINE 512 extern char **flag[NFLAG]; extern char cmdline[NCMDLINE+1]; extern char *cmdname; extern char *flagset[]; extern "C" { extern void usage(const char*); extern int getflags(int, char**, const char*, int); } char * ...); extern int Fputc(int, char); extern int Fclose(int); extern void Ftie(int, int); extern void Fexit(int); } #ifdef FIO_IMP /* COUNT is the type of counts to things like read, write, memcpy etc */ #ifdef GNOT #define COUNT long #define FIOMALLOC(n)./CC/Pool.h 664 0 0 1572 4365742224 5530 #ifndef _POOL_H #define _POOL_H 1 class Block_header { Block_header* next; friend class Block_pool; }; class Block_pool { unsigned sz; Block_header* head; Block_pool(Block_pool&); // copy protection void operator= (Block_pool&); // copy protection public: unsigned size() { return sz; } Block_pool (unsigned); ~Block_pool(); char* expand(); }; class Pool_element_header { Pool_element_header* next; friend class Pool; }; class Pool: private Block_pool { unsigned elsize, count; Pool_element_header* head; Pool(Pool&); // copy protection void operator= (Pool&); // copy protection void grow(); public: Pool(unsigned n); void* alloc() { if (!head) grow(); register Pool_element_header* p = head; head = p->next; return p; } void free(void* b) { register Pool_element_header* p = (Pool_element_header*) b; p->next = head; head = p; } }; #endif header { Pool_element_header* next; friend class Pool; }; class Pool: private Block_pool { unsigned elsize, count; Pool_element_h./CC/setjmp.h 664 0 0 327 4253525542 6074 /* W A R N I N G ! * * If you use setjmp/longjmp, you had better know what you are doing! */ #include "/usr/include/setjmp.h" extern "C" { int setjmp(jmp_buf); void longjmp(jmp_buf, int); } ; head = p->next; return p; } void free(void* b) { register Pool_element_header* p = (Pool_element_header*) b; p->next = head; head = p; } }; #endif header { Pool_element_header* next; friend class Pool; }; class Pool: private Block_pool { unsigned elsize, count; Pool_element_h./CC/list.h 664 0 0 47757 4575771070 5635 #ifndef listdeclare #ifndef GENERICH #include #endif #include #ifndef TRUE #define FALSE 0 #define TRUE (!FALSE) #endif #ifndef NULL #define NULL 0 #endif #ifndef BIT_DEFINED #define BIT_DEFINED typedef int bit; #endif struct lnk { lnk* nxt; lnk* prv; void init(lnk* p, lnk* s) { prv = p; nxt = s; } lnk() {} ~lnk() {} }; struct LstHead { lnk *t; // tail lnk *h() { return t ? t->nxt : 0; } int sz; lnk *cache; // a recently retrieved link int cacheNo; // its index or garbage if cache == NULL int refCount; LstHead() { sz = 0; cache = t = NULL; } virtual ~LstHead(); void insert(lnk*); // used by put() and unget() void unget(lnk* nl) { insert(nl); cacheNo++; } void put(lnk* nl) { insert(nl); t = nl; } lnk* get(); lnk* unput(); lnk* getAt(int); }; struct lstiter; struct List { friend lstiter; lstiter *fI; LstHead *it; virtual void sepWork(); void separate() { if (it->refCount > 1) sepWork(); } int length() const { return it->sz; } List() { fI = NULL; } List(List& x) { fI = NULL; it = x.it; it->refCount++; } ~List(); lnk* tail() const { return it->t; } lnk* head() const { return it->h(); } lstiter* firstIt() { return fI; } void newIt(lstiter*, int=0); void removeIt(lstiter*); operator void*() { return length() ? this : 0; } List& operator=(List&); List& unget(lnk*); List& put(lnk*); lnk* get(); lnk* unput(); }; struct lstiter { friend List; lnk *pred; List *aList; lstiter *nextIt; int index; lstiter(List&, int =0); lstiter(lstiter&); ~lstiter(); List *theList() { return aList; } lstiter& operator=(lstiter&); bit operator==(lstiter& oo) { return aList == oo.aList && index == oo.index; } bit atEnd() { return index == aList->length(); } bit r_atEnd() { return index == 0 ; } lnk* next(); lnk* r_next(); lnk* peek(); lnk* r_peek(); void insert(lnk*); void r_insert(lnk*); lnk* remove(); lnk* r_remove(); void reset(int =0); void r_reset(int i=0) { reset(aList->length() - i); } }; extern "C" { extern int abort(); } #define lnnk(type) name2(type,lnnk) #define list(type) name2(type,_list) #define ListHead(type) name2(type,ListHead) #define listiterator(type) name2(type,_list_iterator) #define listsubitem(type) name2(type,listsubitem) #define plist(type) name2(type,P_list) #define plistiterator(type) name2(type,P_list_iterator) #define plistsubitem(type) name2(type,Plistsubitem) #define CMPF(type) name2(type,CMPFN) #define CMPFP(type) name2(type,CMPFNP) #define listdeclare(type) \ extern GPT errorhandler(list,type); \ extern GPT set_handler(list,type,GPT); \ extern GPT errorhandler(listiterator,type); \ extern GPT set_handler(listiterator,type,GPT); \ class list(type); \ class lnnk(type); \ class ListHead(type); \ class listiterator(type); \ class listsubitem(type); \ typedef int (*CMPF(type))(type&, type&); \ ostream& operator<<(ostream&, list(type)&); \ class lnnk(type) : public lnk { \ friend ListHead(type); \ friend list(type); \ friend listsubitem(type); \ friend listiterator(type); \ friend ostream& operator<<(ostream&, list(type)&); \ friend void voidP_list_sort_internal(voidP_list&, CMPF(voidP)); \ type val; \ lnnk(type)(type& pp) : val(pp) {} \ ~lnnk(type)() {} \ }; \ class ListHead(type) : public LstHead { \ friend list(type); \ ListHead(type)() {} \ ~ListHead(type)(); \ lnnk(type) *tail() { return (lnnk(type)*)t; } \ lnnk(type) *head() { return (lnnk(type)*)h(); } \ bit firstX(type&); \ bit lastX(type&); \ }; \ class list(type) : public List { \ lnnk(type) *tail() const { return (lnnk(type)*)List::tail(); } \ lnnk(type) *head() const { return (lnnk(type)*)List::head(); } \ void init() { it = new ListHead(type); it->refCount = 1; } \ void sepWork(); \ public: \ friend ostream& operator<<(ostream&, list(type)&); \ friend void voidP_list_sort_internal(voidP_list&, CMPF(voidP)); \ list(type)() { init(); } \ list(type)(list(type)& x) : List(x) {} \ ~list(type)() {} \ operator const void*() const { return length() ? this : 0; } \ bit operator==(list(type)&) const; \ bit operator!=(list(type)& x) const { return !(*this == x); } \ list(type)& operator=(list(type)& ll) { return (list(type)&) \ (*(List*)this = (List&)ll); } \ list(type)& put(type &x) { return (list(type)&) \ List::put(new lnnk(type)(x)); } \ list(type)& put(list(type)&); /* append */ \ list(type)& operator+=(list(type)& oo) { return put(oo); } \ list(type)& operator+=(type& t) { return put(t); } \ list(type) operator+(list(type)& ll) { list(type) ans = *this; \ ans += ll; return ans; } \ list(type) operator+(type& t) { list(type) ans = *this; \ ans += t; return ans; } \ bit unputX(type &t); \ bit unput(); \ bit getX(type&); /* get */ \ bit get(); /* get */ \ list(type)& unget(type &x) { return (list(type)&) \ List::unget(new lnnk(type)(x)); } \ list(type)& unget(list(type)&); /* prepend */ \ bit firstX(type& t) { return \ ((ListHead(type)*)it)->firstX(t); } \ bit lastX(type& t) { return \ ((ListHead(type)*)it)->lastX(t); } \ /* getAt(0) returns the head of the list */ \ type getAt(int ii) { return ((lnnk(type)*)it->getAt(ii))->val; } \ inline listsubitem(type) operator[](unsigned ii); \ list(type)(type& x) { init(); put(x); } \ list(type)(type& x, type& y) { init(); put(x); put(y); } \ list(type)(type& x, type& y, type& z) { init(); put(x); put(y); \ put(z); } \ list(type)(type& x, type& y, type& z, type& w) { init(); \ put(x); put(y); put(z); put(w); } \ void sort(CMPF(type)); \ }; \ class listiterator(type) : public lstiter { \ friend listsubitem(type); \ friend list(type); \ public: \ listiterator(type)(list(type)& a, int i=0) : \ lstiter(*(List*)&a, i) {} \ listiterator(type)(listiterator(type)& a) : \ lstiter(*(lstiter*)&a) {} \ ~listiterator(type)() {} \ listiterator(type)& operator=(listiterator(type)& a) { return \ (listiterator(type)&)(*(lstiter*)this = (lstiter&)a); } \ bit nextX(type&); \ bit nextX(type*&); \ bit next() { return lstiter::next() != 0; } \ bit r_nextX(type&); \ bit r_nextX(type*&); \ bit r_next() { return lstiter::r_next() != 0; } \ bit peekX(type&); \ bit peekX(type*&); \ bit peek() { return !atEnd(); } \ bit r_peekX(type&); \ bit r_peekX(type*&); \ bit r_peek() { return !r_atEnd(); } \ /* remove -- deletes current from list */ \ bit remove(); \ bit r_remove(); \ bit removeX(type&); \ bit r_removeX(type&); \ /* insert -- put it at the left of the pointer */ \ void insert(type& x) { lstiter::insert(new lnnk(type)(x)); } \ void r_insert(type& x) { lstiter::r_insert(new lnnk(type)(x)); } \ bit replace(type&); \ bit r_replace(type&); \ }; \ class listsubitem(type) : public listiterator(type) { \ public: \ listsubitem(type)(list(type)& t, unsigned i) : \ listiterator(type)(t, i) {} \ listsubitem(type)(listsubitem(type)& a) : \ listiterator(type)((listiterator(type)&)a) {} \ ~listsubitem(type)() {} \ type& operator=(type& x) { r_replace(x); return x; } \ operator type(); \ }; \ inline listsubitem(type) \ list(type)::operator[](unsigned ii) \ { \ return listsubitem(type)(*this, ii); \ } typedef void* voidP; listdeclare(voidP) #define plistdeclare(type) \ extern GPT errorhandler(Plist,type); \ extern GPT set_handler(Plist,type,GPT); \ extern GPT errorhandler(Plistiterator,type); \ extern GPT set_handler(Plistiterator,type,GPT); \ class plist(type); \ typedef int (*CMPFP(type))(type*&, type*&); \ ostream& operator<<(ostream&, plist(type)&); \ class plistiterator(type); \ class plistsubitem(type); \ class plist(type) : public voidP_list { \ public: \ friend ostream& operator<<(ostream&, plist(type)&); \ plist(type)() {} \ plist(type)(type* x) : voidP_list((voidP) x) {} \ plist(type)(type* x, type* y) : \ voidP_list((voidP) x, (voidP) y) {} \ plist(type)(type* x, type* y, type* z) : \ voidP_list((voidP) x, (voidP) y, (voidP) z) {} \ plist(type)(type* x, type* y, type* z, type* w) : \ voidP_list ((voidP) x, (voidP) y, (voidP) z, (voidP) w) {} \ plist(type)(plist(type)& ll) : \ voidP_list((voidP_list&) ll) {} \ ~plist(type)() {} \ operator const void*() const \ { return voidP_list::operator void*(); } \ bit operator==(plist(type)& ll) { return ((voidP_list&)*this == \ (voidP_list&)ll); } \ plist(type)& operator=(plist(type)& ll) { return (plist(type)&) \ ((voidP_list&)*this = (voidP_list&)ll); } \ plist(type) operator+(plist(type)& ll) { \ return (plist(type)&)((voidP_list&)*this + (voidP_list&)ll); } \ plist(type) operator+(type* t) { \ return (plist(type)&) ((voidP_list&)*this + (voidP)t); } \ plist(type)& put(type *t) { return (plist(type)&) \ voidP_list::put((voidP)t); } \ plist(type)& put(plist(type)& ll) { return (plist(type)&) \ voidP_list::put((voidP_list&)ll); } \ plist(type)& operator+=(plist(type)& oo) { return put(oo); } \ plist(type)& operator+=(type* t) { return put(t); } \ bit unputX(type *&t) { return voidP_list::unputX((voidP&)t); } \ bit unput() { return voidP_list::unput(); } \ bit getX(type *&t) { return voidP_list::getX((voidP&)t); } \ bit get() { return voidP_list::get(); } \ plist(type)& unget(type *x) { return (plist(type)&) \ voidP_list::unget((voidP)x); } \ plist(type)& unget(plist(type)& ll) { return (plist(type)&) \ voidP_list::unget((voidP_list&)ll); } \ bit firstX(type *&t) { return voidP_list::firstX((voidP&)t); } \ bit lastX(type *&t) { return voidP_list::lastX((voidP&)t); } \ /* getAt(0) returns the head of the list */ \ type* getAt(int ii) { return (type *) voidP_list::getAt(ii); } \ inline plistsubitem(type) operator[](unsigned ii); \ void sort(CMPFP(type) pf) { voidP_list::sort((CMPF(voidP))pf); } \ }; \ class plistiterator(type) : public voidP_list_iterator { \ public: \ plistiterator(type)(plist(type)& a, int i=0) : \ ((voidP_list&)a, i) {} \ plistiterator(type)(plistiterator(type)& a) : \ ((voidP_list_iterator&)a) {} \ ~plistiterator(type)() {} \ plistiterator(type)& operator=(plistiterator(type)& a) { return \ (plistiterator(type)&)((voidP_list_iterator&)*this = \ (voidP_list_iterator&)a); } \ bit nextX(type *&t) { return \ voidP_list_iterator::nextX((voidP&)t); } \ bit nextX(type **&t) { return \ voidP_list_iterator::nextX((voidP*&)t); } \ bit next() { return voidP_list_iterator::next(); } \ bit r_nextX(type *&t) { return \ voidP_list_iterator::r_nextX((voidP&)t); } \ bit r_nextX(type **&t) { return \ voidP_list_iterator::r_nextX((voidP*&)t); } \ bit r_next() { return voidP_list_iterator::r_next(); } \ bit peekX(type *&t) { return \ voidP_list_iterator::peekX((voidP&)t); } \ bit peekX(type **&t) { return \ voidP_list_iterator::peekX((voidP*&)t); } \ bit peek() { return voidP_list_iterator::peek(); } \ bit r_peekX(type *&t) { return \ voidP_list_iterator::r_peekX((voidP&)t); } \ bit r_peekX(type **&t) { return \ voidP_list_iterator::r_peekX((voidP*&)t); } \ bit r_peek() { return voidP_list_iterator::r_peek(); } \ bit remove() { return voidP_list_iterator::remove(); } \ bit r_remove() { return voidP_list_iterator::r_remove(); } \ bit removeX(type *&x) { return \ voidP_list_iterator::removeX((voidP&)x); } \ bit r_removeX(type *&x) { return \ voidP_list_iterator::r_removeX((voidP&)x); } \ void insert(type *&x) { voidP_list_iterator::insert((voidP&)x); } \ void r_insert(type *&x) { \ voidP_list_iterator::r_insert((voidP&)x); } \ void replace(type *x) { voidP_list_iterator::replace((voidP)x); } \ void r_replace(type *x) { \ voidP_list_iterator::r_replace((voidP)x); } \ }; \ class plistsubitem(type) : public voidPlistsubitem { \ public: \ plistsubitem(type)(plist(type)& t, int i) : \ voidPlistsubitem ((voidP_list&)t, i) {} \ plistsubitem(type)(plistsubitem(type)&ll) : \ voidPlistsubitem ((voidPlistsubitem&)ll){} \ ~plistsubitem(type)() {} \ type*& operator=(type *&t) { return \ (type*&) ((voidPlistsubitem&)*this =(voidP&)t); } \ operator type*() { return (type*) voidPlistsubitem::operator voidP(); } \ }; \ inline \ plistsubitem(type) \ plist(type)::operator[](unsigned ii) \ { \ return plistsubitem(type)(*this, ii); \ } #define listimplement(type) \ GPT errorhandler(list,type) = genericerror; \ GPT errorhandler(listiterator,type) = genericerror; \ bit \ ListHead(type)::firstX(type& v) \ { \ lnnk(type) *aLink = (lnnk(type) *)LstHead::h(); \ return aLink ? (v = aLink->val, TRUE) : FALSE; \ } \ bit \ ListHead(type)::lastX(type& v) \ { \ lnnk(type) *aLink = (lnnk(type) *)LstHead::t; \ return aLink ? (v = aLink->val, TRUE) : FALSE; \ } \ ListHead(type)::~ListHead(type)() \ { \ lnnk(type) *temp; \ while (temp = (lnnk(type) *)LstHead::get()) \ delete temp; \ } \ bit \ listiterator(type)::remove() \ { \ lnnk(type) *aLink = (lnnk(type) *)lstiter::remove(); \ return aLink ? (delete aLink, TRUE) : FALSE; \ } \ bit \ listiterator(type)::removeX(type &x) \ { \ lnnk(type) *aLink = (lnnk(type) *)lstiter::remove(); \ return aLink ? (x = aLink->val, delete aLink, TRUE) : FALSE; \ } \ bit \ listiterator(type)::r_remove() \ { \ lnnk(type) *aLink = (lnnk(type) *)lstiter::r_remove(); \ return aLink ? (delete aLink, TRUE) : FALSE; \ } \ bit \ listiterator(type)::r_removeX(type &x) \ { \ lnnk(type) *aLink = (lnnk(type) *)lstiter::r_remove(); \ return aLink ? (x = aLink->val, delete aLink, TRUE) : FALSE; \ } \ bit \ listiterator(type)::nextX(type& t) \ { \ return atEnd() ? FALSE : \ (t = ((lnnk(type)*)lstiter::next())->val, TRUE); \ } \ bit \ listiterator(type)::nextX(type*& t) \ { \ return atEnd() ? FALSE : \ (theList()->separate(), t = &((lnnk(type)*)lstiter::next())->val, \ TRUE); \ } \ bit \ listiterator(type)::r_nextX(type& t) \ { \ return r_atEnd() ? FALSE : \ (t = ((lnnk(type)*)lstiter::r_next())->val, TRUE); \ } \ bit \ listiterator(type)::r_nextX(type*& t) \ { \ return r_atEnd() ? FALSE : \ (theList()->separate(), t = &((lnnk(type)*)lstiter::r_next())->val, \ TRUE); \ } \ bit \ listiterator(type)::r_peekX(type& t) \ { \ return r_atEnd() ? FALSE : \ (t = ((lnnk(type)*)lstiter::r_peek())->val, TRUE); \ } \ bit \ listiterator(type)::r_peekX(type*& t) \ { \ return r_atEnd() ? FALSE : \ (theList()->separate(), t = &((lnnk(type)*)lstiter::r_peek())->val, \ TRUE); \ } \ bit \ listiterator(type)::peekX(type& t) \ { \ return atEnd() ? FALSE : \ (t = ((lnnk(type)*)lstiter::peek())->val, TRUE); \ } \ bit \ listiterator(type)::peekX(type*& t) \ { \ return atEnd() ? FALSE : \ (theList()->separate(), t = &((lnnk(type)*)lstiter::peek())->val, \ TRUE); \ } \ bit \ listiterator(type)::replace(type& x) \ { \ return r_atEnd() ? FALSE : \ (theList()->separate(), ((lnnk(type)*)lstiter::r_peek())->val = x, \ TRUE); \ } \ bit \ listiterator(type)::r_replace(type& x) \ { \ return atEnd() ? FALSE : \ (theList()->separate(), ((lnnk(type)*)lstiter::peek())->val = x, \ TRUE); \ } \ bit \ list(type)::operator==(list(type)& x) const \ { \ if ( length() != x.length() ) \ return FALSE; \ if ( length() == 0 ) \ return TRUE; \ lnnk(type) *mine = (lnnk(type) *)head(); \ lnnk(type) *yours = (lnnk(type) *)x.head(); \ for ( int i = length(); i--; ) \ if ( mine->val == yours->val ) { \ mine = (lnnk(type) *)mine->nxt; \ yours = (lnnk(type) *)yours->nxt; \ } else \ return FALSE; \ return TRUE; \ } \ bit \ list(type)::getX(type& t) \ { \ lnnk(type) *aLink = (lnnk(type) *)List::get(); \ return aLink ? (t = aLink->val, delete aLink, TRUE) : FALSE; \ } \ bit \ list(type)::get() \ { \ lnnk(type) *aLink = (lnnk(type) *)List::get(); \ return aLink ? (delete aLink, TRUE) : FALSE; \ } \ bit \ list(type)::unputX(type& t) \ { \ lnnk(type) *aLink = (lnnk(type) *)List::unput(); \ return aLink ? (t = aLink->val, delete aLink, TRUE) : FALSE; \ } \ bit \ list(type)::unput() \ { \ lnnk(type) *aLink = (lnnk(type) *)List::unput(); \ return aLink ? (delete aLink, TRUE) : FALSE; \ } \ list(type)& \ list(type)::put(list(type)& a) \ { \ if (a.length()) { \ type t; \ listiterator(type) ita(a); \ while (ita.nextX(t)) \ put(t); \ } \ return *this; \ } \ list(type)& \ list(type)::unget(list(type)& a) \ { \ if (a.length()) { \ type t; \ listiterator(type) ita(a); \ ita.r_reset(); \ while (ita.r_nextX(t)) \ unget(t); \ } \ return *this; \ } \ listsubitem(type)::operator type() \ { \ type t; \ peekX(t); \ return t; \ } \ void \ list(type)::sepWork() \ { \ it->refCount--; \ ListHead(type) *newLst = new ListHead(type); \ if (tail()) { \ for (lnnk(type) *oldLnk = (lnnk(type) *)head();; \ oldLnk = (lnnk(type) *)oldLnk->nxt) { \ lnnk(type) *newLnk; \ newLst->put(newLnk = new lnnk(type)(oldLnk->val)); \ /* only be one or two listiterators (I hope) */ \ for (listiterator(type) *anIt = \ (listiterator(type) *)firstIt(); anIt; \ anIt = (listiterator(type) *)anIt->nextIt) { \ if (anIt->pred == oldLnk) { \ anIt->pred = newLnk; \ } \ } \ if ( oldLnk == tail() ) \ break; \ } \ } \ it = newLst; \ it->refCount = 1; \ } \ void \ list(type)::sort(CMPF(type) cmp) \ { \ if (length() < 2) return; \ separate(); \ voidP_list_sort_internal(*(voidP_list*)this, (CMPF(voidP))cmp); \ for (listiterator(type) *anIt = \ (listiterator(type) *)firstIt(); anIt; \ anIt = (listiterator(type) *)anIt->nextIt) \ anIt->reset(); \ } #define listoutimplement(type) \ ostream& \ operator<<(ostream& oo, list(type)& ll) \ { \ oo<<"("; \ if ( ll.length() ) { \ listiterator(type) it(ll); \ type t; \ it.nextX(t); \ oo< typedef unsigned long Bits_chunk; static const int Bits_shift = 5; static const int Bits_len = 1 << Bits_shift; static const int Bits_mask = Bits_len - 1; Blockdeclare(Bits_chunk) class Bits { private: Block(Bits_chunk) b; unsigned n; // the chunk number that contains bit n unsigned chunk(unsigned n) const { return n >> Bits_shift; } // the number of chunks needed to contain an n-bit string unsigned bound(unsigned n) const { return (n + Bits_len - 1) >> Bits_shift; } // a pointer to the (non-existent) chunk immediately // after the last one in this Bits Bits_chunk* limit() { return b + bound(n); } const Bits_chunk* limit() const { return b + bound(n); } // turn off unused high-order bits in the high-order chunk void normalize() { register int ct = n & Bits_mask; if (ct) b[chunk(n)] &= ~(~Bits_chunk(0) << ct); } int compare(const Bits&) const; int equal(const Bits&) const; public: Bits() { n = 0; } Bits(Bits_chunk, unsigned = 1); unsigned size() const { return n; } unsigned size(unsigned); friend Bits operator& (const Bits&, const Bits&); friend Bits operator| (const Bits&, const Bits&); friend Bits operator^ (const Bits&, const Bits&); friend Bits operator~ (const Bits&); friend Bits operator<< (const Bits&, int); friend Bits operator>> (const Bits&, int); friend int operator< (const Bits&, const Bits&); friend int operator> (const Bits&, const Bits&); friend int operator<= (const Bits&, const Bits&); friend int operator>= (const Bits&, const Bits&); friend int operator== (const Bits&, const Bits&); friend int operator!= (const Bits&, const Bits&); Bits& operator&= (const Bits&); Bits& operator|= (const Bits&); Bits& operator^= (const Bits&); Bits& operator<<= (int); Bits& operator>>= (int); Bits& compl(); Bits& concat(const Bits&); Bits& set(unsigned i) { if (i < n) b[chunk(i)] |= Bits_chunk(1) << (i&Bits_mask); return *this; } Bits& set(unsigned i, unsigned long x) { if (i < n) { register Bits_chunk* p = &b[chunk(i)]; register Bits_chunk mask = Bits_chunk(1) << (i&Bits_mask); if (x) *p |= mask; else *p &= ~mask; } return *this; } Bits& reset(unsigned i) { if (i < n) b[chunk(i)] &= ~(Bits_chunk(1) << (i&Bits_mask)); return *this; } Bits& compl(unsigned i) { if (i < n) b[chunk(i)] ^= Bits_chunk(1) << (i&Bits_mask); return *this; } unsigned count() const; operator Bits_chunk() const; int operator[] (unsigned i) const { if (i >= n) return 0; else return (b[chunk(i)] >> (i&Bits_mask)) & 1; } unsigned signif() const; unsigned trim() { return size(signif()); } }; inline int operator< (const Bits& a, const Bits& b) { return a.compare(b) < 0; } inline int operator> (const Bits& a, const Bits& b) { return a.compare(b) > 0; } inline int operator<= (const Bits& a, const Bits& b) { return a.compare(b) <= 0; } inline int operator>= (const Bits& a, const Bits& b) { return a.compare(b) >= 0; } inline int operator== (const Bits& a, const Bits& b) { return a.equal(b); } inline int operator!= (const Bits& a, const Bits& b) { return !a.equal(b); } Bits concat(const Bits&, const Bits&); #endif Bits& a, const Bits& b) { return a.compare(b) < 0; } inline int operator> (const Bits& a, const Bits& b) { return a.compare(b) > 0; } inline int operator<= (const Bits& a, const Bits& b) { return a.compare(b) <= 0; } inline int operator>= (const Bits& a, const Bits& b) { return a.compare(b) >= 0; } inline int operator== (const Bits& a, cons./CC/Block.h 664 0 0 6426 4561326374 5656 #ifndef BLOCK_H #define BLOCK_H 1 #ifndef GENERICH #include #endif #define Block(T)name2(Block_,T) #define Blockdeclare(T) \ \ class Block(T) { \ public: \ unsigned size() { return n; } \ unsigned size(unsigned k) { move(new T[k], k); return n; } \ Block(T)() { n = 0; p = 0; } \ Block(T)(unsigned k) { n = 0; p = 0; size(k); } \ Block(T)(const Block(T)& b) { copy(b); } \ ~Block(T)() { delete[n] p; } \ Block(T)& operator=(const Block(T)& b) { \ delete[n] p; \ copy(b); \ return *this; \ } \ operator T*() { return p; } \ operator const T*() const { return p; } \ T* end() { return p + n; } \ const T* end() const { return p + n; } \ T& operator[](int i) { return p[i]; } \ const T& operator[](int i) const { return p[i]; } \ int reserve(unsigned k) { return k> 1) + 1; \ T* np = new T[nn]; \ if (!np) { \ nn = k+1; \ np = new T[nn]; \ } \ move(np, nn); \ return n; \ } \ \ /* Transfer len (or fewer) elements into this Block. */ \ void \ Block(T)::transfer(T* source, unsigned len) \ { \ register T* plim; \ register T* pp = p; \ register T* q = source; \ \ if (n > len) { \ plim = p + len; \ clear(plim, n - len); \ } else \ plim = p + n; \ \ while (pp < plim) \ *pp++ = *q++; \ } \ \ /* \ * The contents of this Block now live in memory starting at np \ * If np is 0, null out this Block. \ */ \ void \ Block(T)::move(T* np, unsigned nn) \ { \ T* oldp = p; \ unsigned oldn = n; \ p = np; \ if (np) { \ n = nn; \ transfer(oldp, oldn); \ } else \ n = 0; \ delete[oldn] oldp; \ } \ \ /* Exchange the contents of this Block with another Block */ \ void \ Block(T)::swap(Block(T)& b) \ { \ T* bp = b.p; \ unsigned bn = b.n; \ b.p = p; \ b.n = n; \ p = bp; \ n = bn; \ } \ \ #endif \ { \ T* oldp = p; \ unsigned oldn = n; \ p = np; \ if (np) { \ n = nn; \ transfer(oldp, oldn); \ } else \ n = 0; \ delete[oldn] oldp; \ } \ \ /./CC/Map.h 664 0 0 16771 4443771544 5367 #ifndef MAP_H #define MAP_H 1 #ifndef GENERICH #include #endif #ifndef __const #ifdef __cplusplus #define __const const #else #define __const #endif #endif #define Map(S,T)name4(Map_,S,_,T) #define Node(S,T)name4(_Node_,S,_,T) #define Mapiter(S,T)name4(Mapiter_,S,_,T) #define Mapdeclare(S,T) \ class Node(S,T) { \ const S key; \ T value; \ Node(S,T)* L; \ Node(S,T)* R; \ Node(S,T)* U; \ char bal; \ Node(S,T)(const S& xs, const T& xt): key (xs), value(xt) \ { L = R = 0; bal = '='; } \ ~Node(S,T)(); \ void attach (Node(S,T)*& p, Node(S,T)* dest) \ { p = dest; if (dest) dest->U = this; } \ friend class Map(S,T); \ friend class Mapiter(S,T); \ }; \ \ static S name2(Map(S,T),_Sdef); \ static T name2(Map(S,T),_Tdef); \ \ class Mapiter(S,T) { \ friend class Map(S,T); \ Map(S,T)* const m; \ Node(S,T)* p; \ Mapiter(S,T) (const Map(S,T)* map, Node(S,T)* n): m(map), p(n) { } \ public: \ Mapiter(S,T) (const Map(S,T)& map): m(&map), p(0) { } \ operator int() __const { return p != 0; } \ S key() __const { return *(p? &p->key: &name2(Map(S,T),_Sdef)); } \ T value() __const { return *(p? &p->value: &name2(Map(S,T),_Tdef)); } \ Mapiter(S,T)& operator++(); \ Mapiter(S,T)& operator--(); \ }; \ \ class Map(S,T) { \ friend class Mapiter(S,T); \ Node(S,T)* head; \ int n; \ T def; \ void clear(); \ void init() { head = 0; n = 0; } \ T& newnode (Node(S,T)*&, const S&, Node(S,T)*); \ void rotL (Node(S,T)*); \ void rotR (Node(S,T)*); \ public: \ Map(S,T)(): def (name2(Map(S,T),_Tdef)) { init(); } \ Map(S,T)(const T& d): def (d) { init(); } \ Map(S,T)(const Map(S,T)&); \ ~Map(S,T)(); \ Map(S,T)& operator= (const Map(S,T)&); \ T& operator[] (const S&); \ int size() __const { return n; } \ Mapiter(S,T) element (const S&) __const; \ Mapiter(S,T) first() __const { return ++Mapiter(S,T) (*this); } \ Mapiter(S,T) last() __const { return --Mapiter(S,T) (*this); } \ }; \ \ \ #define Mapimplement(S,T) \ \ /* \ * Node destructor -- should be inline but cfront \ * lays it down even if not needed \ */ \ \ Node(S,T)::~Node(S,T)() \ { \ delete L; \ delete R; \ } \ \ void \ Map(S,T)::clear() \ { \ delete head; \ init(); \ } \ \ Map(S,T)::~Map(S,T)() \ { \ clear(); \ } \ \ Map(S,T)& \ Map(S,T)::operator= (const Map(S,T)& m) \ { \ if (this != &m) { \ clear(); \ for (Mapiter(S,T) p (m); ++p; ) { \ S s = p.key(); /* sidestep a cfront bug */ \ (*this) [s] = p.value(); \ } \ } \ return *this; \ } \ \ Map(S,T)::Map(S,T) (const Map(S,T)& m): def (m.def) \ { \ init(); \ operator= (m); \ } \ \ T& \ Map(S,T)::newnode (Node(S,T)*& ptr, const S& s, Node(S,T)* parent) \ { \ ptr = new Node(S,T) (s, def); \ T& retval = ptr->value; \ \ ptr->U = parent; \ n++; \ \ /* rebalance */ \ \ /* \ * phase 1 - run up the tree, looking for an unbalanced \ * node and unbalancing all the balanced nodes we traverse \ */ \ Node(S,T)* p = ptr->U; \ Node(S,T)* q = ptr; \ \ while (p && p->bal == '=') { \ p->bal = p->L == q? 'L': 'R'; \ q = p; \ p = p->U; \ } \ \ /* \ * p is now 0 or points at an unbalanced node. If 0, we're done. \ * Otherwise calculate the new balance factor for p. \ */ \ if (p) { \ if (p->bal == (p->L == q? 'R': 'L')) \ p->bal = '='; \ else { \ /* we have become truly unbalanced */ \ if (p->bal == 'R') { \ if (q->bal == 'R') { \ rotL (p); \ p->bal = '='; \ q->bal = '='; \ } else { \ Node(S,T)* r = q->L; \ rotR (q); \ rotL (p); \ switch (r->bal) { \ case 'L': \ p->bal = '='; \ q->bal = 'R'; \ break; \ case 'R': \ p->bal = 'L'; \ q->bal = '='; \ break; \ case '=': \ p->bal = '='; \ q->bal = '='; \ break; \ } \ r->bal = '='; \ } \ } else { \ if (q->bal == 'L') { \ rotR (p); \ p->bal = '='; \ q->bal = '='; \ } else { \ Node(S,T)* r = q->R; \ rotL (q); \ rotR (p); \ switch (r->bal) { \ case 'R': \ p->bal = '='; \ q->bal = 'L'; \ break; \ case 'L': \ p->bal = 'R'; \ q->bal = '='; \ break; \ case '=': \ p->bal = '='; \ q->bal = '='; \ break; \ } \ r->bal = '='; \ } \ } \ } \ } \ \ return retval; \ } \ \ void \ Map(S,T)::rotL (Node(S,T)* p) \ { \ Node(S,T)* q = p->R; \ Node(S,T)* u = p->U; \ p->attach (p->R, q->L); \ q->attach (q->L, p); \ if (!u) \ head = q; \ else if (u->L == p) \ u->L = q; \ else \ u->R = q; \ q->U = u; \ } \ \ void \ Map(S,T)::rotR (Node(S,T)* p) \ { \ Node(S,T)* q = p->L; \ Node(S,T)* u = p->U; \ p->attach (p->L, q->R); \ q->attach (q->R, p); \ if (!u) \ head = q; \ else if (u->R == p) \ u->R = q; \ else \ u->L = q; \ q->U = u; \ } \ \ T& \ Map(S,T)::operator[] (const S& s) \ { \ if (head) { \ Node(S,T)* t = head; \ for(;;) { \ if (s < t->key) { \ if (t->L) \ t = t->L; \ else \ return newnode (t->L, s, t); \ } else if (t->key < s) { \ if (t->R) \ t = t->R; \ else \ return newnode (t->R, s, t); \ } else \ break; \ } \ return t->value; \ } else \ return newnode (head, s, 0); \ } \ \ Mapiter(S,T) \ Map(S,T)::element (const S& s) __const \ { \ Node(S,T)* t = head; \ while (t) { \ if (s < t->key) \ t = t->L; \ else if (t->key < s) \ t = t->R; \ else \ break; \ } \ return Mapiter(S,T) (this, t); \ } \ \ Mapiter(S,T)& \ Mapiter(S,T)::operator++() \ { \ if (p) { \ if (p->R) \ p = p->R; \ else { \ while (p) { \ Node(S,T)* q = p; \ p = p->U; \ if (p && p->L == q) \ return *this; \ } \ } \ } else \ p = m->head; \ \ /* p = low(p) */ \ if (p) \ while (p->L) \ p = p->L; \ \ return *this; \ } \ \ Mapiter(S,T)& \ Mapiter(S,T)::operator--() \ { \ if (p) { \ if (p->L) \ p = p->L; \ else { \ while (p) { \ Node(S,T)* q = p; \ p = p->U; \ if (p && p->R == q) \ return *this; \ } \ } \ } else \ p = m->head; \ \ /* p = low(p) */ \ if (p) \ while (p->R) \ p = p->R; \ \ return *this; \ } \ \ \ #endif \./CC/Regexp.h 664 0 0 564 4420764026 6025 #ifndef CAP_REGEXP_H #define CAP_REGEXP_H 1 #include #include "String.h" class Regexp { String subject; int offset[NSUBEXP]; int len[NSUBEXP]; regexp* prog; public: Regexp(const char*); Regexp(const String&); ~Regexp(); int exec(const String&); int result(unsigned& start, unsigned& length, unsigned = 0); String subst(const String&); }; #endif f (p) \ while (p->R) \ p = p->R; \ \ return *this; \ } \ \ \ #endif \./CC/common.h 664 0 0 1143 4420764026 6075 class istream; class ostream; struct common { virtual int cmp(common& oo) { return this==&oo; } /* cmp performs a three way comparison if an ordering exists: this==arg: return 0, thisarg: return positive otherwise this==arg: return 0, this!=arg: return non-zero */ virtual int operator==(common& oo) { return this==&oo; } virtual char* swho() { return 0; } virtual int iwho() { return 0; } virtual int size() { return sizeof(common); } virtual ostream& write(ostream& s) { return s;} virtual istream& read(istream& s) { return s; } common() {} }; /* cmp performs a three way comparison if an ordering exists: this==arg: return 0, thisarg: return positive otherwise this==arg: return 0, this!=arg: return non-zero */ virtual int operator==(common& oo) { return this==&oo; } virtual char* swho() { return 0; } virtual int iwho() { return 0; } virtual int size() { return sizeof(common); } virtual ostream./CC/generic.h 664 0 0 1320 4420764026 6216 #ifndef GENERICH #define GENERICH 1 #ifdef BSD #define name2(a,b) a\ b #define name3(a,b,c) a\ b\ c #define name4(a,b,c,d) a\ b\ c\ d #else #define name2(a,b) a/**/b #define name3(a,b,c) a/**/b/**/c #define name4(a,b,c,d) a/**/b/**/c/**/d #endif #define declare(a,t) name2(a,declare)(t) #define implement(a,t) name2(a,implement)(t) #define declare2(a,t1,t2) name2(a,declare2)(t1,t2) #define implement2(a,t1,t2) name2(a,implement2)(t1,t2) extern genericerror(int,char*); typedef int (*GPT)(int,char*); #define set_handler(generic,type,x) name4(set_,type,generic,_handler)(x) #define errorhandler(generic,type) name3(type,generic,handler) #define callerror(generic,type,a,b) (*errorhandler(generic,type))(a,b) #endif name4(a,b,c,d) a/**/b/**/c/**/d #endif #define declare(a,t) name2(a,declare)(t) #define implement(a,t) name2(a,implement)(t) #define declare2(a,t1,t2) name2(a,declare2)(t1,t2) #define implement2(a,t1,t2) name2(a,implement2)(t1,t2) extern genericerror(int,char*); typedef int (*GPT)(int,char*); #define./CC/stdarg.h 664 0 0 1141 4420764026 6067 /* stdarg.h */ /* USAGE: f( arg-declarations ... ) { va_list ap; va_start(ap, parmN); // parmN == last named arg // ... type arg = va_arg(ap, type); // ... va_end(ap); } */ #ifndef va_start typedef char *va_list; #define va_end(ap) #ifdef u370 #define va_start(ap, parmN) ap =\ (char *) ((int)&parmN + 2*sizeof(parmN) - 1 & -sizeof(parmN)) #define va_arg(ap, mode) ((mode *)(ap = \ (char *) ((int)ap + 2*sizeof(mode) - 1 & -sizeof(mode))))[-1] #else #define va_start(ap, parmN) ap = (char *)( &parmN+1 ) #define va_arg(ap, mode) ((mode *)(ap += sizeof(mode)))[-1] #endif #endif / parmN == last named arg // ... type arg = va_arg(ap, type); // ... va_end(ap); } */ #ifndef va_start typedef char *va_list; #define va_end(ap) #ifdef u370 #define va_start(ap, parmN) ap =\ (char *) ((int)&parmN + 2*sizeof(parmN) - 1 & -sizeof(parmN)) #define va_arg(ap, mode) ((mode *)(ap = \ (char *) ((int)ap + 2*sizeof(mode) - 1 & -sizeof(mode))))[-1] #else #define va_start(ap, parmN) ap = (./CC/vector.h 664 0 0 5754 4420764026 6123 #ifndef GENERICH #include #endif #define vector(type) name2(type,vector) #define vectordeclare(type) \ extern GPT errorhandler(vector,type); \ extern GPT set_handler(vector,type,GPT); \ class vector(type) { \ type* v; \ int sz; \ public: \ vector(type)(int s) \ { if (s<=0) callerror(vector,type,1,"bad vector size"); \ v = new type[sz=s]; \ } \ ~vector(type)() { delete[sz] v; } \ vector(type)(vector(type)&); \ vector(type)& operator=(vector(type)&); \ int size() { return sz; } \ void set_size(int); \ type& elem(int i) { return v[i]; } \ type& operator[](int i) \ { if (i<0 || sz<=i) \ callerror(vector,type,2,"vector index out of range"); \ return v[i]; \ } \ }; #define vectorimplement(type) \ GPT errorhandler(vector,type) = genericerror; \ vector(type)::vector(type)(vector(type)& a) \ { \ register i = a.sz; \ sz = i; \ v = new type[i]; \ register type* vv = &v[i]; \ register type* av = &a.v[i]; \ while (i--) *--vv = *--av; \ } \ \ vector(type)& vector(type)::operator=(vector(type)& a) \ { \ register i = a.sz; \ if (i != sz) \ callerror(vector,type,3,"different vector sizes in assignment");\ register type* vv = &v[i]; \ register type* av = &a.v[i]; \ while (i--) *--vv = *--av; \ delete[i] v; \ return *this; \ } \ \ void vector(type)::set_size(int s) \ { \ if (s<=0) callerror(vector,type,4,"bad new vector size"); \ type* nv = new type[s]; \ register i = (s<=sz)?s:sz; \ register type* vv = &v[i]; \ register type* av = &nv[i]; \ while (i--) *--vv = *--av; \ delete[sz] v; \ v = nv; \ sz = s; \ } \ \ GPT set_handler(vector,type, GPT a) \ { \ GPT oo = errorhandler(vector,type); \ errorhandler(vector,type) = a; \ return oo; \ } #define stack(type) name2(type,stack) #define stackdeclare(type) \ extern GPT errorhandler(stack,type); \ extern GPT set_handler(stack,type,GPT); \ class stack(type) : vector(type) { \ int t; \ public: \ stack(type)(int s) : (s) { t = 0; } \ stack(type)(stack(type)& a) : ((vector(type)&)a) { t = a.t; } \ void push(type& a) \ { if (t==size()-1) callerror(stack,type,1,"stack overflow"); \ elem(++t) = a; \ } \ type pop() \ { if (t==0) callerror(stack,type,2,"stack underflow"); \ return elem(t--); \ } \ type& top() \ { if (t==0) callerror(stack,type,3,"stack empty"); \ return elem(t); \ } \ }; #define stackimplement(type) \ GPT errorhandler(stack,type); \ GPT set_handler(stack,type, GPT a) \ { \ GPT oo = errorhandler(stack,type); \ errorhandler(stack,type) = a; \ return oo; \ } elem(++t) = a; ./CC/float.h 664 0 0 1615 4434273167 5724 #ifndef __FLOAT #define __FLOAT #define FLT_ROUNDS 1 #define FLT_RADIX 2 #define FLT_DIG 6 #define FLT_EPSILON 1.1920928955078125e-07 #define FLT_MANT_DIG 24 #define FLT_MAX 1.7014117331926443e+38 #define FLT_MAX_10_EXP 38 #define FLT_MAX_EXP 127 #define FLT_MIN 2.9387358770557188e-39 #define FLT_MIN_10_EXP -38 #define FLT_MIN_EXP -127 #define DBL_DIG 16 #define DBL_EPSILON 2.7755575615628914e-17 #define DBL_MANT_DIG 56 #define DBL_MAX 1.7014118346046923e+38 #define DBL_MAX_10_EXP 38 #define DBL_MAX_EXP 127 #define DBL_MIN 2.9387358770557188e-39 #define DBL_MIN_10_EXP -38 #define DBL_MIN_EXP -127 #define LDBL_MANT_DIG DBL_MANT_DIG #define LDBL_EPSILON DBL_EPSILON #define LDBL_DIG DBL_DIG #define LDBL_MIN_EXP DBL_MIN_EXP #define LDBL_MIN DBL_MIN #define LDBL_MIN_10_EXP DBL_MIN_10_EXP #define LDBL_MAX_EXP DBL_MAX_EXP #define LDBL_MAX DBL_MAX #define LDBL_MAX_10_EXP DBL_MAX_10_EXP #endif 28914e-17 #define DBL_MANT_DIG 56 #define DBL_MAX 1.7014118346046923e+38 #define DBL_MAX_10_EXP 38 #define DBL_MAX./CC/limits.h 664 0 0 661 4520643757 6102 #ifndef __LIMITS #define __LIMITS #define CHAR_BIT 8 #define CHAR_MAX 127 #define CHAR_MIN -128 #define INT_MAX 0x7fffffff #define INT_MIN 0x80000000 #define UINT_MAX 0xffffffff #define LONG_MAX 0x7fffffff #define LONG_MIN 0x80000000 #define MB_LEN_MAX 1 #define SCHAR_MAX 127 #define SCHAR_MIN -128 #define SHRT_MAX 32767 #define SHRT_MIN -32768 #define UCHAR_MAX 255 #define ULONG_MAX 0xffffffff #define USHRT_MAX 65535 #endif efine DBL_MAX 1.7014118346046923e+38 #define DBL_MAX_10_EXP 38 #define DBL_MAX./CC/stddef.h 664 0 0 270 4434272752 6043 #ifndef __STDDEF #define __STDDEF #define NULL 0 #define offsetof(ty,mem) ((size_t) &(((ty *)0)->mem)) typedef long ptrdiff_t; typedef unsigned size_t; typedef char wchar_t; #endif fine LONG_MAX 0x7fffffff #define LONG_MIN 0x80000000 #define MB_LEN_MAX 1 #define SCHAR_MAX 127 #define SCHAR_MIN -128 #define SHRT_MAX 32767 #define SHRT_MIN -32768 #define UCHAR_MAX 255 #define ULONG_MAX 0xffffffff #define USHRT_MAX 65535 #endif efine DBL_MAX 1.7014118346046923e+38 #define DBL_MAX_10_EXP 38 #define DBL_MAX./CC/types.h 664 0 0 2645 4420764027 5762 /* * Basic system types and major/minor device constructing/busting macros. */ #ifndef _TYPES_ #define _TYPES_ /* major part of a device */ #define major(x) ((int)(((unsigned)(x)>>8)&0377)) /* minor part of a device */ #define minor(x) ((int)((x)&0377)) /* make a device number */ #define makedev(x,y) ((dev_t)(((x)<<8) | (y))) typedef unsigned char u_char; typedef unsigned short u_short; typedef unsigned int u_int; typedef unsigned long u_long; typedef struct _physadr { int r[1]; } *physadr; typedef long daddr_t; typedef char * caddr_t; typedef u_short ino_t; typedef long swblk_t; typedef long size_t; typedef long time_t; typedef long label_t[14]; typedef u_short dev_t; typedef long off_t; typedef long portid_t; #ifndef NBBY #include #ifndef NBBY #define NBBY 8 /* number of bits in a byte */ #define NBPW sizeof(int) /* number of bytes in an integer */ #endif #endif NBBY /* * Set of fds used with the select system call. * The macros depend on NBPW and NBBY; assume NOFILE <= 128. */ #define FDWORDS (128+NBPW*NBBY-1)/(NBPW*NBBY) typedef struct { unsigned long fds_bits[FDWORDS]; } fd_set; #define FD_SET(n,s) (s).fds_bits[(n)/(NBPW*NBBY)] |= 1<<((n)%(NBPW*NBBY)) #define FD_CLR(n,s) (s).fds_bits[(n)/(NBPW*NBBY)] &= ~(1<<((n)%(NBPW*NBBY))) #define FD_ISSET(n,s) ((s).fds_bits[(n)/(NBPW*NBBY)] & (1<<((n)%(NBPW*NBBY)))) #define FD_ZERO(s) {int i; for(i=0;inext = new link(&oo,0); } common* remove() { if (head) { common* p = head->p; if (head == tail) head = tail = 0; else head=head->next; return p; } else return 0; } common* remove(common& oo); common* first() { return head?head->p:0; } common* last() { return tail?tail->p:0; } int empty() { return head!=0; } }; class set : public list { /* unique elements */ common remove(); public: set(); set(common&); ~set(); int empty(); int insert(common&); common* remove(common&); common* find(char*); common* find(common&); int no_of_mem(); }; struct dlink { dlink* pre, *suc; common* p; dlink(dlink* pr, dlink* su, common* pp) { pre=pr; suc=su; p=pp; } }; class dlist : public common { dlink* head; public: dlist(); dlist(common&); ~dlist(); void insert(); common* remove(); common* remove(common&); common* curr(); common* next(); common* prev(); }; ommon remove(); public: set(); set(common&); ~set(); int empty(); int insert(common&); common* remove(common&); common* find(char*); com./CC/common/sort.h 664 0 0 201 4420764027 7037 overload sort; void sort(common*[]); /* sort a vector of object pointers */ void sort(common[]); /* sort a vector of objects */ { pre=pr; suc=su; p=pp; } }; class dlist : public common { dlink* head; public: dlist(); dlist(common&); ~dlist(); void insert(); common* remove(); common* remove(common&); common* curr(); common* next(); common* prev(); }; ommon remove(); public: set(); set(common&); ~set(); int empty(); int insert(common&); common* remove(common&); common* find(char*); com./CC/common/table.h 664 0 0 1264 4420764027 7171 class vector : public common { common** vec; int size; public: vector(int sz) { size = (sz<=0) ? 1 : sz; vec = new common*[size]; } ~vector() {}; virtual common* range_error() { return 0; } common& operator[](int i) { return (0<=i && i #endif igned long fds_bits[FDWORDS]; } fd_set; #define FD_SET(n,s) (s).fds_bits[(n)/(NBPW*NBBY)] |= 1<<((n)%(NBPW*NBBY)) #define FD_CLR(n,s) (s).fds_bits[(n)/(NBPW*NBBY)] &= ~(1<<((n)%(NBPW*NBBY))) #define FD_ISSET(n,s) ((s).fds_bits[(n)/(NBPW*NBBY)] & (1<<((n)%(NBPW*NBBY)))) #define FD_ZERO(s) {int i; for(i=0;i_cnt>=0? (int)*(p)->_ptr++:_filbuf(p)) #define getchar() getc(stdin) #define putc(x,p) (--(p)->_cnt>=0? ((int)(*(p)->_ptr++=(x))):_flsbuf((x),p)) #define putchar(x) putc(x,stdout) #define feof(p) (((p)->_flag&_IOEOF)!=0) #define ferror(p) (((p)->_flag&_IOERR)!=0) #define fileno(p) ((p)->_file) FILE *fopen(); FILE *fdopen(); FILE *freopen(); FILE *popen(); long ftell(); char *fgets(); #ifndef L_tmpnam #include #endif /*L_tmpnam */ t (&_iob[1]) #define stderr (&_iob[2]) #define getc(p) ./sys/ 775 0 0 0 5624664037 4711 ./sys/acct.h 664 0 0 1502 4564204565 6055 /* * Accounting structures; * these use a comp_t type which is a 3 bits base 8 * exponent, 13 bit fraction ``floating point'' number. */ typedef u_short comp_t; struct acct { char ac_comm[10]; /* Accounting command name */ comp_t ac_utime; /* Accounting user time */ comp_t ac_stime; /* Accounting system time */ comp_t ac_etime; /* Accounting elapsed time */ time_t ac_btime; /* Beginning time */ short ac_uid; /* Accounting user ID */ short ac_gid; /* Accounting group ID */ short ac_mem; /* average memory usage */ comp_t ac_io; /* number of disk IO blocks */ dev_t ac_tty; /* control typewriter */ char ac_flag; /* Accounting flag */ }; #define AFORK 01 /* has executed fork, but no exec */ #define ASU 02 /* used super-user privileges */ #define ASTINY 04 /* done a tiny read from the disk */ / comp_t ac_etime; /* Accounting elapsed time */ time_t ac_btime; /* Beginning time */ short ac_uid; /* Accounting user ID */ short ac_gid; /* Accounting group ID */ short ac_mem;./sys/mg.h 664 0 0 127 4564204565 5530 struct mg { char busy; struct device *addr; struct queue *rq; struct queue *wq; }; _tty; /* control typewriter */ char ac_flag; /* Accounting flag */ }; #define AFORK 01 /* has executed fork, but no exec */ #define ASU 02 /* used super-user privileges */ #define ASTINY 04 /* done a tiny read from the disk */ / comp_t ac_etime; /* Accounting elapsed time */ time_t ac_btime; /* Beginning time */ short ac_uid; /* Accounting user ID */ short ac_gid; /* Accounting group ID */ short ac_mem;./sys/buf.h 664 0 0 10115 4564204565 5737 /* * The header for buffers in the buffer pool and otherwise used * to describe a block i/o request is given here. The routines * which manipulate these things are given in bio.c. * * Each buffer in the pool is usually doubly linked into 2 lists: * hashed into a chain by so it can be located in the cache, * and (usually) on (one of several) queues. These lists are circular and * doubly linked for easy removal. * * There are currently three queues for buffers: * one for buffers which must be kept permanently (super blocks) * one for buffers containing ``useful'' information (the cache) * one for buffers containing ``non-useful'' information * (and empty buffers, pushed onto the front) * The latter two queues contain the buffers which are available for * reallocation, are kept in lru order. When not on one of these queues, * the buffers are ``checked out'' to drivers which use the available list * pointers to keep track of them in their i/o active queues. */ /* * Bufhd structures used at the head of the hashed buffer queues. * We only need three words for these, so this abbreviated * definition saves some space. */ struct bufhd { long b_flags; /* see defines below */ struct buf *b_forw, *b_back; /* fwd/bkwd pointer in chain */ }; struct buf { long b_flags; /* too much goes here to describe */ struct buf *b_forw, *b_back; /* hash chain (2 way street) */ struct buf *av_forw, *av_back; /* position on free list if not BUSY */ #define b_actf av_forw /* alternate names for driver queue */ #define b_actl av_back /* head - isn't history wonderful */ long b_bcount; /* transfer count */ #define b_active b_bcount /* driver queue head: drive active */ short b_error; /* returned after I/O */ dev_t b_dev; /* major+minor device name */ union { caddr_t b_addr; /* low order core address */ int *b_words; /* words for clearing */ struct filsys *b_filsys; /* superblocks */ struct dinode *b_dino; /* ilist */ daddr_t *b_daddr; /* indirect block */ } b_un; daddr_t b_blkno; /* block # on device */ long b_resid; /* words not transferred after error */ #define b_errcnt b_resid /* while i/o in progress: # retries */ #define b_pfcent b_resid /* garbage: don't ask */ struct proc *b_proc; /* proc doing physical or swap I/O */ }; #define BQUEUES 3 /* number of free buffer queues */ #define BQ_LOCKED 0 /* super-blocks &c */ #define BQ_LRU 1 /* lru, useful buffers */ #define BQ_AGE 2 /* rubbish */ #ifdef KERNEL struct buf *buf; /* the buffer pool itself */ char *buffers; int nbuf; short *swsize; int *swpf; struct buf bfreelist[BQUEUES]; /* heads of available lists */ struct buf bswlist; /* head of free swap header list */ struct buf *bclnlist; /* head of cleaned page list */ struct buf *alloc(); struct buf *baddr(); struct buf *getblk(); struct buf *geteblk(); struct buf *bread(); struct buf *breada(); unsigned minphys(); #endif /* * These flags are kept in b_flags. */ #define B_WRITE 0x000000 /* non-read pseudo-flag */ #define B_READ 0x000001 /* read when I/O occurs */ #define B_DONE 0x000002 /* transaction finished */ #define B_ERROR 0x000004 /* transaction aborted */ #define B_BUSY 0x000008 /* not on av_forw/back list */ #define B_PHYS 0x000010 /* physical IO */ #define B_WANTED 0x000040 /* issue wakeup when BUSY goes off */ #define B_AGE 0x000080 /* delayed write for correct aging */ #define B_ASYNC 0x000100 /* don't wait for I/O completion */ #define B_DELWRI 0x000200 /* write at exit of avail list */ #define B_TAPE 0x000400 /* this is a magtape (no bdwrite) */ #define B_UAREA 0x000800 /* add u-area to a swap operation */ #define B_PAGET 0x001000 /* page in/out of page table space */ #define B_DIRTY 0x002000 /* dirty page to be pushed out async */ #define B_PGIN 0x004000 /* pagein op, so swap() can count it */ #define B_INVAL 0x010000 /* does not contain valid info */ #define B_LOCKED 0x020000 /* locked in core (not reusable) */ #define B_HEAD 0x040000 /* a buffer header, not a buffer */ /* * extra goo for swap code * temporary * see bio.c */ struct swapinfo { int swsize; int swpf; }; ea to a swap operation */ #define B_PAGET 0x001000 /* page in/out of page table space */ #define B_DIRTY 0x002000 /* dirty page to be pushed out async */ #define B_PGIN 0x004000 /* pagein op, so swap() can count it */ #define B_INVAL 0x010000 /* does not contain valid info */ #define B_LOCKED 0x020000 /* locked in core (not reusable) */ #define B_HEAD 0x040000 /* a buffer header, not a buffer */ /* * extra goo for swap code./sys/callout.h 664 0 0 763 4574612774 6604 /* * The callout structure is for * a routine arranging * to be called by the clock interrupt * (clock.c) with a specified argument, * in a specified amount of time. * Used, for example, to time tab * delays on typewriters. */ struct callout { int c_time; /* incremental time */ caddr_t c_arg; /* argument to routine */ int (*c_func)(); /* routine */ struct callout *c_next; }; #ifdef KERNEL struct callout *callfree, calltodo; extern struct callout callout[]; int calloutcnt; #endif for swap code./sys/meter.h 664 0 0 274 4564204566 6245 /* * Instrumentation */ #define CPUSTATES 5 #define CP_USER 0 #define CP_NICE 1 #define CP_SYS 2 #define CP_IDLE 3 #define CP_QUEUE 4 #ifdef KERNEL long cp_time[CPUSTATES]; #endif ple, to time tab * delays on typewriters. */ struct callout { int c_time; /* incremental time */ caddr_t c_arg; /* argument to routine */ int (*c_func)(); /* routine */ struct callout *c_next; }; #ifdef KERNEL struct callout *callfree, calltodo; extern struct callout callout[]; int calloutcnt; #endif for swap code./sys/clock.h 664 0 0 2002 4564204566 6233 /* * VAX clock registers */ #define ICCS_RUN 0x00000001 #define ICCS_TRANS 0x00000010 #define ICCS_SS 0x00000020 #define ICCS_IE 0x00000040 #define ICCS_INT 0x00000080 #define ICCS_ERR 0x80000000 #define SECDAY ((unsigned)(24*60*60)) /* seconds per day */ #define SECYR ((unsigned)(365*SECDAY)) /* per common year */ /* * TODRZERO is the what the TODR should contain when the ``year'' begins. * The TODR should always contain a number between 0 and SECYR+SECDAY. */ #define TODRZERO ((unsigned)(1<<28)) #define YRREF 1970 #define LEAPYEAR(year) ((year)%4==0) /* good till time becomes negative */ /* * Start a 60 HZ clock. */ #define CLK60HZ (-16667) /* 16.667 ms */ #define clkstart() {\ mtpr(NICR, CLK60HZ);\ mtpr(ICCS, ICCS_RUN+ICCS_IE+ICCS_TRANS+ICCS_INT+ICCS_ERR);\ } #define clkreld() mtpr(ICCS, ICCS_RUN|ICCS_IE|ICCS_INT|ICCS_ERR) #define CLKBIAS 100 /* when adjusting clock, do so .1ms at a time */ /* * Software clock is software interrupt level 8 */ #define setsoftclock() mtpr(SIRR, 0x8) ) #define YRREF 1970 #define LEAPYEAR(year) ((year)%4==0) /* good till time becomes negative */ /* * Start a 60 HZ clock. */ #define CLK60HZ (-16667) /* 16.667 ms */ #define clkstart() {\ mtpr(NICR, CLK60HZ);\ mtpr(ICCS, ICCS_RUN+ICCS_IE+ICCS_TRANS+ICCS_INT+ICCS_ERR);\ } #define clkreld() mtpr(ICCS, ICCS_RUN|ICCS_IE|ICCS_INT|ICCS_ERR) #define CLKBIAS 100 /* when adjusting clock, do so .1ms at a time */ /* * Software clock is software interrupt level 8 */ #define setsoftclock() mtpr(SIRR, 0x8./sys/cmap.h 664 0 0 2515 4657164720 6071 /* * core map entry * * the 20-bit fields imply a maximum of 1GB with 1K pages * which is scant compensation for the enormous space this * damned structure takes. */ struct cmap { unsigned int c_next:20, /* index of next free list entry */ c_lock:1, /* locked for raw i/o or pagein */ c_want:1, /* wanted */ c_intrans:1, /* intransit bit */ c_free:1, /* on the free list */ c_gone:1, /* associated page has been released */ c_prev:20, /* index of previous */ c_type:2, /* type CSYS or CTEXT or CSTACK or CDATA */ c_page:20, /* virtual page number in segment */ c_ndx:12, /* index of owner proc or text */ c_hlink:20, /* hash link for */ c_blkno:20, /* disk block this is a copy of */ c_mdev:6; /* which mounted dev this is from (NMOUNT) */ }; #define CMHEAD 0 #ifdef KERNEL struct cmap *cmap; struct cmap *ecmap; int ncmap; struct cmap *mfind(); int firstfree, maxfree; int ecmx; /* cmap index of ecmap */ #endif /* bits defined in c_type */ #define CSYS 0 /* none of below */ #define CTEXT 1 /* belongs to shared text segment */ #define CDATA 2 /* belongs to data segment */ #define CSTACK 3 /* belongs to stack segment */ #define pgtocm(x) ((((x)-firstfree) / CLSIZE) + 1) #define cmtopg(x) ((((x)-1) * CLSIZE) + firstfree) /* * magic for c_mdev */ #define MSWAPX 63 /* the swap device */ ruct cmap *ecmap; int ncmap; struct cmap *mfind(); int firstfree, maxfree; int ecmx; /* cmap index of ecmap */ #endif /* bits defined in c_type */ #define CSYS 0 /* none of ./sys/conf.h 664 0 0 3704 4574612774 6104 /* * structures defining driver entry points * tables of pointers to, e.g., struct bdevsw are declared in conf.c * the structures themselves are defined in the drivers that use them * * the init macros are used just to check the number of arguments */ struct bdevsw { int (*d_open)(); int (*d_close)(); int (*d_strategy)(); int d_flags; }; #ifdef KERNEL extern struct bdevsw *bdevsw[]; extern struct bdevsw nullbdev; extern int nblkdev; #define bdinit(open, close, strat, flag) {open, close, strat, flag} #endif /* * Character device switch. */ extern struct cdevsw { int (*d_open)(); int (*d_close)(); int (*d_read)(); int (*d_write)(); int (*d_ioctl)(); int (*d_reset)(); /* ??? */ struct streamtab *qinfo; }; #ifdef KERNEL extern struct cdevsw *cdevsw[]; extern struct cdevsw nullcdev; extern int nchrdev; #define cdinit(open, close, read, write, ioctl) {open, close, read, write, ioctl, nulldev, NULL} #define cstrinit(stream) {nodev, nulldev, nodev, nodev, nodev, nulldev, stream} #endif /* file system types */ struct fstypsw { int (*t_put)(); int (*t_updat)(); int (*t_read)(); int (*t_write)(); int (*t_trunc)(); int (*t_stat)(); int (*t_nami)(); int (*t_mount)(); int (*t_ioctl)(); struct inode * (*t_open)(); int (*t_dirread)(); }; #ifdef KERNEL extern struct fstypsw *fstypsw[]; extern nfstyp; #define fsinit(put, updat, read, write, trunc, stat, nami, mount, ioctl, open, dir) \ {put, updat, read, write, trunc, stat, nami, mount, ioctl, open, dir} #endif /* * stream processor table */ struct streamtab { struct qinit *rdinit; struct qinit *wrinit; }; #ifdef KERNEL extern struct streamtab *streamtab[]; extern struct streamtab nullstream; extern int nstreamtab; #endif /* * Swap device information */ struct swdevt { dev_t sw_dev; daddr_t sw_size; int sw_freed; }; #ifdef KERNEL extern struct swdevt swdevt[]; int nswdevt; extern struct inode *nullopen(); extern int nullnami(); extern int nulldev(), nodev(); #endif mi, mount, ioctl, open, dir} #endif /* * stream processor ./sys/cons.h 664 0 0 1324 4564204566 6110 /* * VAX console interface registers */ #define RXCS_IE 0x00000040 /* receiver interrupt enable */ #define RXCS_DONE 0x00000080 /* receiver done */ #define RXDB_DATA 0x000000ff /* received character */ #define RXDB_ID 0x00000f00 /* channel id */ #define RXDB_ERR 0x80000000 /* receiver error */ #define TXCS_IE 0x00000040 /* transmitter interrupt enable */ #define TXCS_RDY 0x00000080 /* transmitter ready for next char */ #define TXDB_DATA 0x000000ff /* transmitter byte */ #define TXDB_ID 0x00000f00 /* channel id */ #define TXDB_DONE 0xf01 /* software done */ #define TXDB_BOOT 0xf02 /* reboot */ #define TXDB_CWSI 0xf03 /* clear warm start inhibit */ #define TXDB_CCSI 0xf04 /* clear cold-start inhibit */ ne RXDB_ID 0x00000f00 /* channel id */ #define RXDB_ERR 0x80000000 /* receiver error */ #define TXCS_IE 0x00000040 /* transmitter interrupt enable */ #define TXCS_RDY 0x00000080 /* transmitter ready for next char */ #define TXDB_DATA 0x000000ff /* transmitter byte */ #define TXDB_ID 0x00000f00 /./sys/uba.h 664 0 0 1112 4666762051 5711 /* * data structures for the unibus adapter code */ #define UBNMAP 100 struct uba { short flags; short path; /* data paths available */ struct ubadev *addr; /* our registers and address window */ ubm_t *sbmap; /* stream block maps, per buffer */ uaddr_t *sbaddr; /* and unibus addresses */ ubm_t shmap; /* stream block header map */ uaddr_t shaddr; /* stream block header unibus address */ struct map map[UBNMAP]; }; /* * flags */ #define UBINIT 01 /* this adapter has been set up */ #define UBMWANT 02 /* map needed */ #define UBQBUS 04 /* this is not a unibus */ struct uba { short flags; short path; /* data paths available */ struct ubadev *addr; /* our registers and address window */ ubm_t *sbmap; /* stream block maps, per buffer */ uaddr_t *sbaddr; /* and unibus addresses */ ubm_t shmap; /* stream block header map */ uaddr_t shaddr; /* stream block header unibus address */ struct map map[UBNMAP]; }; /* * flags */ #define UBINIT 01 /* this adapter has been set up */ #define ./sys/dir.h 664 0 0 137 4564204566 5705 #ifndef DIRSIZ #define DIRSIZ 14 #endif struct direct { ino_t d_ino; char d_name[DIRSIZ]; }; flags; short path; /* data paths available */ struct ubadev *addr; /* our registers and address window */ ubm_t *sbmap; /* stream block maps, per buffer */ uaddr_t *sbaddr; /* and unibus addresses */ ubm_t shmap; /* stream block header map */ uaddr_t shaddr; /* stream block header unibus address */ struct map map[UBNMAP]; }; /* * flags */ #define UBINIT 01 /* this adapter has been set up */ #define ./sys/dk.h 664 0 0 371 4564204566 5525 /* * for datakit dr11 driver */ struct dk { struct queue *dkrq; char flag; u_char chan; short isize; short ialloc; char icnt; struct block *ibuf; /* current input buffer */ struct block *ofirst, *olast; /* list of blocks to output */ }; fer */ uaddr_t *sbaddr; /* and unibus addresses */ ubm_t shmap; /* stream block header map */ uaddr_t shaddr; /* stream block header unibus address */ struct map map[UBNMAP]; }; /* * flags */ #define UBINIT 01 /* this adapter has been set up */ #define ./sys/dkbad.h 664 0 0 2441 4564204566 6214 /* * Definitions needed to perform bad sector * revectoring ala DEC STD 144. * * The bad sector information is located in the * first 5 even numbered sectors of the last * track of the disk pack. There are five * identical copies of the information, described * by the dkbad structure. * * Replacement sectors are allocated starting with * the first sector before the bad sector information * and working backwards towards the beginning of * the disk. A maximum of 126 bad sectors are supported. * The position of the bad sector in the bad sector table * determines which replacement sector it corresponds to. * * The bad sector information and replacement sectors * are conventionally only accessible through the * 'c' file system partition of the disk. If that * partition is used for a file system, the user is * responsible for making sure that it does not overlap * the bad sector information or any replacement sector.s */ struct dkbad { long bt_csn; /* cartridge serial number */ u_short bt_mbz; /* unused; should be 0 */ u_short bt_flag; /* -1 => alignment cartridge */ struct bt_bad { u_short bt_cyl; /* cylinder number of bad sector */ u_short bt_trksec; /* track and sector number */ } bt_bad[126]; }; #define ECC 0 #define SSE 1 #define BSE 2 #define CONT 3 used for a file system, the user is * responsible for making sure that it does not overlap * the bad sector information or any replacement sector.s */ struct dkbad { long bt_csn; /* cartridge serial number */ u_shor./sys/dmap.h 664 0 0 1317 4564204566 6071 /* * Definitions for the mapping of vitual swap * space to the physical swap area - the disk map. */ #define NDMAP 64 /* size of the swap area map */ struct dmap { swblk_t dm_size; /* current size used by process */ swblk_t dm_alloc; /* amount of physical swap space allocated */ swblk_t dm_map[NDMAP]; /* first disk block number in each chunk */ }; #ifdef KERNEL extern struct dmap zdmap; extern int dmmin; /* size in clicks of dm_map[0] */ extern int dmmax; /* max size of swap alloc, in clicks */ #endif /* * The following structure is that ``returned'' * from a call to vstodb(). */ struct dblock { swblk_t db_base; /* base of physical contig drum block */ swblk_t db_size; /* size of block */ }; ed by process */ swblk_t dm_alloc; /* amount of physical swap space allocated */ swblk_t dm_map[NDMAP]; /* first disk block number in each chunk */ }; #ifdef KERNEL extern struct dmap zdmap; extern int dmmin; /* size in clicks of dm_map[0] */ extern int dmmax; /* max size of swap alloc, in clicks */ ./sys/fblk.h 664 0 0 77 4564204566 6030 struct fblk { int df_nfree; daddr_t df_free[NICFREE]; }; rom a call to vstodb(). */ struct dblock { swblk_t db_base; /* base of physical contig drum block */ swblk_t db_size; /* size of block */ }; ed by process */ swblk_t dm_alloc; /* amount of physical swap space allocated */ swblk_t dm_map[NDMAP]; /* first disk block number in each chunk */ }; #ifdef KERNEL extern struct dmap zdmap; extern int dmmin; /* size in clicks of dm_map[0] */ extern int dmmax; /* max size of swap alloc, in clicks */ ./sys/file.h 664 0 0 1400 4604206703 6046 /* * One file structure is allocated * for each open/creat/pipe call. * Main use is to hold the read/write * pointer associated with each open * file. */ struct file { short f_flag; short f_count; /* reference count */ struct inode *f_inode; /* pointer to inode structure */ llong_t f_offset; /* read/write character pointer */ }; #ifdef KERNEL extern struct file file[]; extern struct file *fileNFILE; extern int filecnt; struct file *falloc(); struct file *allocfile(); /* * inline to speed things up */ #define getf(fd) ((unsigned)(fd)>=NOFILE ? NULL : u.u_ofile[fd]) #endif /* flags */ #define FREAD 01 #define FWRITE 02 #define FPIPE 04 #define FHUNGUP 010 #define FRNBLK 040 /* no block on read */ #define FWNBLK 0100 /* no block on write */ pointer to inode structure */ llong_t f_offset; /* read/write character pointer */ }; #ifdef KERNEL extern struct file file[]; extern struct file *fileNFILE; extern int filecnt; struct file *falloc(); struct file *allocfile(); /* * inline to speed th./sys/filsys.h 664 0 0 3613 4564204567 6463 /* * Structure of the super-block */ struct filsys { unsigned short s_isize; /* size in blocks of i-list */ daddr_t s_fsize; /* size in blocks of entire volume */ short s_ninode; /* number of i-nodes in s_inode */ ino_t s_inode[NICINOD]; /* free i-node list */ char s_flock; /* lock during free list manipulation */ char s_ilock; /* lock during i-list manipulation */ char s_fmod; /* super block modified flag */ char s_ronly; /* mounted read-only flag */ time_t s_time; /* last super block update */ daddr_t s_tfree; /* total free blocks*/ ino_t s_tinode; /* total free inodes */ short s_dinfo[2]; /* interleave stuff */ #define s_m s_dinfo[0] /* only mkfs.c? */ #define s_n s_dinfo[1] #define s_cylsize s_dinfo[0] #define s_aspace s_dinfo[1] char s_fsmnt[14]; /* ordinary file mounted on */ ino_t s_lasti; /* start place for circular search */ ino_t s_nbehind; /* est # free inodes before s_lasti */ union { struct { short S_nfree;/* number of addresses in s_free */ daddr_t S_free[NICFREE];/* free block list */ } R; struct { char S_valid;/* 1 on disk means bit map valid */ char S_flag; #define BITMAP 961 long S_bfree[BITMAP];/* bit map for free data blocks */ } B; struct { char S_valid; char S_flag; /* 1 means bitmap not in S_bfree */ long S_bsize;/* how big the bitmap blocks are */ struct buf * S_blk[BITMAP-1]; } N; } U; }; #define s_nfree U.R.S_nfree #define s_free U.R.S_free #define s_valid U.B.S_valid #define s_bfree U.B.S_bfree /* * fiddle bits in free block bitmap * assume NBBY*sizeof(long) is a power of 2 */ #define BITCELL (NBBY*sizeof(long)) #define BITISFREE(p, i) (p[(i)/BITCELL]&(1<<((i)&(BITCELL-1)))) #define BITFREE(p, i) (p[(i)/BITCELL]|=(1<<((i)&(BITCELL-1)))) #define BITALLOC(p, i) (p[(i)/BITCELL]&=~(1<<((i)&(BITCELL-1)))) #ifdef KERNEL struct filsys *getfs(); #endif buf * S_blk[BITMAP-1]; } N; } U; }; #define s_nfree U.R.S_nfree #define s_free U.R.S_free #define s_valid U.B.S_v./sys/mscp.h 664 0 0 17706 4574612775 6151 /* * DSA Mass Storage Control Protocol packet formats */ typedef union { long SL_l; short SL_s[2]; } _SL; /* * arbitrary (port specific) buffer descriptor * this is arranged for the convenience of non-buffer-using packets * specific port drivers should cast it into whatever * their particular addressing structure requires */ typedef union { long BD_l[3]; short BD_s[6]; struct { long BD_pl; long BD_q[2]; /* quadword at the end */ } BD_x; } BUFDESC; /* * command packet */ struct mscmd { long m_crf; /* reference number */ short m_unit; /* device unit number */ short m__r0; char m_opcd; /* command opcode */ char m__r1; short m_mod; /* modifiers to opcode */ _SL m__u0; #define m_bcnt m__u0.SL_l /* byte count */ #define m_otrf m_bcnt /* or, outstanding reference number */ #define m_rbn m_bcnt /* or, replacement block number */ #define m_vrsn m__u0.SL_s[0] /* or, mscp version number */ #define m_cntf m__u0.SL_s[1] /* and controller flags */ #define m_rcnt m__u0.SL_l /* or, record count */ #define m_unfl m__u0.SL_s[1] /* unit flags */ BUFDESC m_buff; /* buffer descriptor */ #define m_htmo m_buff.BD_s[0] /* or, host timeout interval */ #define m_time m_buff.BD_x.BD_q /* and two longwords of time */ #define m_fcnt m_buff.BD_l[0] /* or, file count */ long m_lbn; /* block number */ #define m_dvpm m_lbn /* device dependent online parameters */ short m_fmt; /* tmscp device format */ }; /* * end/attn message */ struct msend { long m_crf; /* reference number */ short m_unit; /* device unit number */ short m__r0; char m_opcd; /* endcode */ char m_flgs; /* end message flags */ short m_sts; /* status bits */ _SL m__u0; #define m_bcnt m__u0.SL_l /* byte count */ #define m_otfl m__u0.SL_l /* or, outstanding cmd ref number */ #define m_vrsn m__u0.SL_s[0] /* or, mscp version number */ #define m_cntf m__u0.SL_s[1] /* and controller flags */ #define m_mlun m__u0.SL_s[0] /* or, multi-unit code */ #define m_unfl m__u0.SL_s[1] /* and unit flags */ BUFDESC m_buff; /* buffer descriptor */ #define m_cmst m_buff.BD_l[0] /* or, command status */ #define m_unti m_buff.BD_x.BD_q /* and quadword unit id */ #define m_cnti m_buff.BD_x.BD_q /* or quadword controller id */ #define m_ctmo m_buff.BD_s[0] /* or, controller timeout */ long m_fbbk; /* first bad block encountered */ #define m_medi m_fbbk /* or, media type id */ short m_shun; /* shadow unit */ short m__r2; _SL m__u1; #define m_unsz m__u1.SL_l /* unit size */ #define m_trck m__u1.SL_s[0] /* or, track size */ #define m_grp m__u1.SL_s[1] /* and group size */ #define m_menu m__u1.SL_s[0] /* or, format menu (and group size?) */ _SL m__u2; #define m_vser m__u2.SL_l /* volume serial number */ #define m_cyl m__u2.SL_s[0] /* or, cylinder size */ short m_rcts; /* size of RCT */ char m_rbns; /* replacement blocks per track */ char m_rctc; /* number of copies of replacement table */ }; /* * opcodes */ #define OPGUS 03 /* get unit status */ #define OPSCC 04 /* set controller characteristics */ #define OPSEX 07 /* serious exception */ #define OPAVL 010 /* available */ #define OPONL 011 /* online */ #define OPSUC 012 /* set unit characteristics */ #define OPFLS 023 /* flush cache ? */ #define OPRPL 024 /* replace bad block */ #define OPRD 041 /* read */ #define OPWR 042 /* write */ #define OPWRM 044 /* write tape mark */ #define OPPOS 045 /* reposition tape */ #define OPAVA 0100 /* available attn */ #define OPEND 0200 /* end flag */ #define MDPRI 01 /* OPRPL: primary replacement block */ #define MDSPD 01 /* OPAVL: spin down */ #define MDREW 02 /* OPAVL: rewind */ #define MDOBJ 04 /* OPPOS: object count */ #define MDREV 010 /* OPPOS: reverse */ #define MDUNL 020 /* OPPOS: unload */ #define MDXCL 040 /* OPONL: exclusive access */ #define MDIMM 0100 /* some TMSCP: do it now */ #define MDCSX 020000 /* any: clear serious exception */ #define MDCDL 010000 /* many: clear cache data loss woe */ /* * status codes */ #define STMSK 037 /* mask for generic status code */ #define STSUC 0 /* success */ #define STCMD 1 /* invalid command */ #define STABO 2 /* aborted */ #define STOFL 3 /* unit offline */ #define STAVL 4 /* unit available */ #define STMFE 5 /* media format error */ #define STWPR 6 /* write protected */ #define STCMP 7 /* compare error */ #define STDAT 010 /* data error */ #define STHST 011 /* host data access error */ #define STCNT 012 /* controller error */ #define STDRV 013 /* drive error */ #define STTPM 016 /* tape mark encountered */ #define STRDT 020 /* tape record truncated */ #define STPL 021 /* tape position lost */ #define STSEX 022 /* serious exception */ #define STDIA 037 /* internal diagnostic message */ #define STRST 0377 /* our software only -- controller reset */ #define STBCK STDAT /* us design optical disk: blank check */ #define STBK2 0x48 /* someone else's blank check */ /* * end message flags */ #define EFCDL 02 /* TMSCP: cached data lost */ #define EFEOT 010 /* TMSCP: encountered end-of-tape */ #define MSCPVER 0 /* MSCP version number */ /* * controller flags */ #define CFATN 0200 /* enable attention messages */ #define CFMSC 0100 /* enable misc error log messages */ #define CFOTH 040 /* enable other hosts' errors */ #define CFTHS 020 /* enable this host's errors */ /* * unit flags */ #define UFWBK 0100 /* tape: enable write-back */ #define UFWPH 020000 /* write-protected in hardware */ /* * TMSCP densities * m_fmt */ #define TFMASK 0377 /* mask for all tape format bits, without device type */ /* * error log packet */ struct mserl { long l_crf; /* command reference number */ short l_unit; /* unit number */ short l_seq; /* error sequence number */ char l_fmt; /* format of packet */ char l_flgs; short l_evnt; /* event code */ long l_cnti[2]; /* controller id */ char l_csvr; /* ctl software version */ char l_chvr; /* ctl hardware version */ short l_mlun; /* multi-unit code */ long l_unti[2]; /* unit id */ #define l_badr l_unti[0] /* or, bad memory address */ char l_usvr; /* unit software version */ char l_uhvr; /* unit hardware version */ char l_lvl; /* transfer error level */ char l_rtry; /* transfer error retry */ long l_vser; /* volume serial number */ long l_hdcd; /* header code */ long l_sdi[3]; /* sdi info */ }; /* * format codes (l_fmt) */ #define FMCNT 0 /* controller error */ #define FMBAD 1 /* host buffer address error */ #define FMDSK 2 /* disk transfer error */ #define FMSDI 3 /* SDI error */ #define FMSMD 4 /* small disk error */ #define FMTAPE 5 /* tape transfer error */ #define FMSTC 6 /* STI communication error */ #define FMSTD 7 /* STI drive error */ #define FMSTF 8 /* STI formatter error */ #define FMRPL 9 /* bad block replacement by controller */ /* * flags */ #define LFSUC 0200 /* operation successful */ #define LFCON 0100 /* operation continuing */ #define LFRPR 040 /* bad block replacement required */ #define LFRPE 020 /* error during bad block replacement */ #define LFSNR 01 /* sequence number reset */ /* * purely software things: * table of entry points for a port driver * * the idea is * call init at open time * to do io, call get to get a packet; fill it in; * call map to set up io mapping if it's a read or write; * call send to send the mscp packet to the controller. * if there's no map associated, that's it; * the packet is freed when the controller takes it. * if there's a map, the packet isn't freed until unmap is called * to flush and free up the map too */ struct msportsw { int (*mp_init)(); /* init the port, if needed */ struct mscmd *(*mp_get)(); /* get a packet */ int (*mp_map)(); /* store mapping into packet */ int (*mp_send)(); /* send packet */ int (*mp_unmap)(); /* free mapping resources and packet */ }; #ifdef KERNEL extern struct msportsw *msportsw[]; extern int nmsport; #endif /* * address token for class drivers; * indexed by (minor device) unit number */ struct msaddr { char ctl; /* which controller */ char ctype; /* type of controller */ short unit; /* MSCP unit number thereon */ }; #define MSMAXID 2 /* number of connection IDs */ packet */ int (*mp_map)(); /* store mapping into packet ./sys/uda.h 664 0 0 3046 4564204567 5723 /* * defs for the uda50 driver */ /* * per-controller structure */ #define MAXCMD 32 /* no more than this many command packets */ struct ud { struct udcomm *ud_comm; /* virt addr of comm area */ uaddr_t ud_pcomm; /* unibus addr of ring base */ struct udcmd *ud_cpkt; /* virt addr of command packets */ uaddr_t ud_pcpkt; /* unibus addr of command packets */ short ud_cnext; /* index of next cmd descriptor */ short ud_rnext; /* ditto response */ ubm_t ud_cmap[MAXCMD]; /* ub mapping info for transfers */ char ud_cbusy[MAXCMD]; /* busy flags for commands */ char ud_back[MAXCMD]; /* back-index from cmd ring to packets */ struct udrsp *ud_rpkt; /* virt addr of response packets */ struct buf *ud_cbuf; /* buffer for comm/cmds */ ubm_t ud_cbm; /* and its map info */ struct buf *ud_rbuf; /* buffer for responses */ ubm_t ud_rbm; /* and its map info */ int ud_bdpno; /* bdp for transfers */ short ud_flags; /* misc flag bits */ short ud_credits; /* number of flow control credits */ struct device *ud_addr; /* device register address */ }; /* * ud_flags */ #define UINIT 01 /* already did trivial init */ #define UIDONE 02 /* initialization all done */ #define UPWAIT 04 /* waiting for command packet */ #define UFIRST 010 /* let first packet go even if no credits */ #define UTIMER 020 /* timer will kick on next go */ #define UCWAIT 040 /* waiting for credits */ #define UISTART 0100 /* initialization started */ /* * ud_cbusy */ #define FREE 0 #define NABBED 01 #define SENT 02 #define MAPPED 04 #define NOBACK (-1) er address */ }; /* * ud_flags */ #define UINIT 01 /* already did trivial init */ #define UIDONE 02 /* initialization all done */ #define UPWAIT 04 /* waiting for command packet */ #define UFIRST 010 /* let first packet go even if no credits */ #define UTIMER 020 /* timer will kick on next go */ #define UCWAIT 040 /* waiting for credits */ #define UISTART 0100 /* initialization started */ /* * ud_cbusy */ #define FREE 0 #define NABBED 01 #define SENT 02 #./sys/ra.h 664 0 0 1141 4577464571 5555 /* * data structures for the MSCP disk class driver */ #define NRAPART 8 /* eight partitions per drive */ struct radisk { struct msportsw *port; char open; /* partition open */ char pinit; /* partition initialized */ char flags; char rplret; long cmdcrf; /* crf of pending non-xfer command */ char cmdopc; /* opcode too */ struct buf *actf; /* next buffer to send */ struct buf *actl; /* end of list of unsent buffers */ daddr_t nblocks[NRAPART]; /* size of each partition */ daddr_t blkoff[NRAPART]; /* starting block for each partition */ struct ud_unit di; /* hardware parameters */ }; er drive */ struct radisk { struct msportsw *port; char open; /* partition open */ char pinit; /* partition initialized */ char flags; char rplret; long cmdcrf; /* crf of pending non-xfer command */ char cmdopc; /* opcode too */ struct buf *actf; /* next buffer to send */ struct buf *actl; /* end of list of unsent buffers */ daddr_t nblocks[NRAPART]; /* size of each partition */ daddr_t blkoff[NR./sys/dkp.h 664 0 0 1603 4564204567 5725 struct dkp { struct queue *rdq; /* associated read queue */ struct block *inp; /* msg being collected */ struct block *inpe; /* end of msg */ short state; /* flags */ unsigned char trx; /* # bytes in trailer being collected */ unsigned char lastctl; /* last non-URP control received */ short indata; /* # bytes in message being collected */ unsigned char iseq; /* last good input sequence number */ unsigned char lastecho; /* last echo/rej sent */ char WS; /* first non-consumed message */ char WACK; /* first non-acknowledged message */ char WNX; /* next message to be sent */ unsigned char XW; /* size of xmit window */ unsigned char timer; /* timeout for xmit */ unsigned char outcnt; /* count output chars for char mode */ unsigned char trbuf[3]; /* trailer being collected */ short xsize; /* size of each message */ struct block *xb[8]; /* the xmit window buffer */ }; put sequence number */ unsigned char lastecho; /* last echo/rej sent */ char WS; /* first non-consumed message */ char WA./sys/ino.h 664 0 0 1044 4564204567 5733 /* * Inode structure as it appears on * a disk block. */ struct dinode { unsigned short di_mode; /* mode and type of file */ short di_nlink; /* number of links to file */ short di_uid; /* owner's user id */ short di_gid; /* owner's group id */ off_t di_size; /* number of bytes in file */ char di_addr[40]; /* disk block addresses */ time_t di_atime; /* time last accessed */ time_t di_mtime; /* time last modified */ time_t di_ctime; /* time created */ }; /* * the 40 address bytes: * 39 used; 13 addresses * of 3 bytes each. */ on * a disk block. */ struct dinode { unsigned short di_mode; /* mode and type of file */ short di_nlink; /* number of links to file */ short di_uid; /* owner's user id */ short di_gid; /* owner's group id */ off_t di_size; /* number of bytes in file */ char di_addr[40]; /* disk block addresses */ time_t di_atime; /* time last accessed */ time_t di_mtime; /* time last modified */ time_t di_ctime; /* time created */ }; /* * the 40 address bytes: * 39 used; 1./sys/inode.h 664 0 0 11161 4574612775 6272 /* * The I node is the focus of all * file activity in unix. There is a unique * inode allocated for each active file, * each current directory, each mounted-on * file, text file, and the root. An inode is 'named' * by its dev/inumber pair. (iget/iget.c) * Data, from mode on, is read in * from permanent inode on volume. */ #define NADDR 13 struct inode { short i_flag; dev_t i_dev; /* device where inode resides */ char i_fstyp; /* type of its filesystem */ unsigned short i_count; /* reference count */ long i_number; /* i number, 1-to-1 with device address */ unsigned short i_mode; short i_nlink; /* directory entries */ short i_uid; /* owner */ short i_gid; /* group of owner */ off_t i_size; /* size of file */ struct inode *i_mroot; /* if mount point, root inode */ struct inode *i_mpoint; /* inode of mount point */ struct stdata *i_sptr; /* stream associated with this inode */ union { struct { daddr_t I_addr[NADDR]; /* if normal file/directory */ daddr_t I_lastr; /* last read (for read-ahead) */ struct buf *I_bufp; /* buffer for super-block */ } i_f; #define i_addr i_f.I_addr #define i_lastr i_f.I_lastr #define i_bufp i_f.I_bufp struct { daddr_t I_rdev; /* i_addr[0] */ } i_d; #define i_rdev i_d.I_rdev struct { long I_tag; struct inode *I_cip; /* communications */ int I_fsflags; /* in root inode only */ time_t I_atime; time_t I_mtime; time_t I_ctime; dev_t I_rdev; } i_a; /* network filesystems et al */ #define i_tag i_a.I_tag #define i_cip i_a.I_cip #define i_fsflags i_a.I_fsflags #define i_netatime i_a.I_atime #define i_netmtime i_a.I_mtime #define i_netctime i_a.I_ctime #define i_netrdev i_a.I_rdev struct { struct proc *I_proc; /* sanity checking */ int I_sigmask; /* signal trace mask */ } i_p; #define i_proc i_p.I_proc #define i_sigmask i_p.I_sigmask } i_un; struct inode *i_hlink; /* link in hash chain (iget/iput/ifind) */ }; #ifdef KERNEL extern struct inode inode[]; extern struct inode *inodeNINODE; extern int inodecnt; struct inode *rootdir; /* pointer to inode of root directory */ struct inode *ialloc(); struct inode *ifind(); struct inode *iget(); struct inode *iuniq(); struct inode *namei(); struct inode *openi(); #endif /* flags */ #define ILOCK 01 /* inode is locked */ #define IUPD 02 /* file has been modified */ #define IACC 04 /* inode access time to be updated */ #define IWANT 020 /* some process waiting on lock */ #define ITEXT 040 /* inode is pure text prototype */ #define ICHG 0100 /* inode has been changed */ #define IOPEN 0200 /* has been opened; close on last iput */ /* modes */ #define IFMT 0170000 /* type of file */ #define IFDIR 0040000 /* directory */ #define IFCHR 0020000 /* character special */ #define IFBLK 0060000 /* block special */ #define IFREG 0100000 /* regular */ #define IFLNK 0120000 /* symbolic link to another file */ #define ISUID 04000 /* set user id on execution */ #define ISGID 02000 /* set group id on execution */ #define IREAD 0400 /* read, write, execute permissions */ #define IWRITE 0200 #define IEXEC 0100 #define ICONC 0001000 /* this file is protected for concurrent access */ #define ICCTYP 0007000 /* type of concurrent access */ #define ISYNC 0001000 /* 1 writer and n readers (synchronized access) */ #define IEXCL 0003000 /* 1 writer or n readers (exclusive access) */ struct argnamei { /* namei's flag argument */ short flag; /* type of request */ short len; /* length of last component buffer */ union { short mode; /* mode for creating */ struct inode *il; /* for linking */ caddr_t buf; /* where to copy last component for exec */ } un; }; #define NI_SEARCH 0 /* search only (0 value known to nilargnamei, beware) */ #define NI_DEL 1 /* unlink this file */ #define NI_CREAT 2 /* create it if it doesn't exits */ #define NI_NXCREAT 3 /* create it, error if it already exists */ #define NI_LINK 4 /* make a link */ #define NI_MKDIR 5 /* make a directory */ #define NI_RMDIR 6 /* remove a directory */ #ifdef KERNEL extern struct argnamei nilargnamei; #endif struct nx { /* arg to real nami */ struct inode *dp; /* current inode */ char *cp; /* current position in pathname */ char *nbuf; /* pathname being parsed */ short nlen; /* length of pathname buffer */ short nlink; /* symlinks seen so far */ }; /* * some inline subroutines to speed things up */ #ifdef KERNEL #define plock(ip) \ { \ while ((ip)->i_flag & ILOCK) { \ (ip)->i_flag |= IWANT; \ sleep((caddr_t)(ip), PINOD); \ } \ (ip)->i_flag |= ILOCK; \ } #define prele(ip) \ { \ (ip)->i_flag &= ~ILOCK; \ if ((ip)->i_flag&IWANT) { \ (ip)->i_flag &= ~IWANT; \ wakeup((caddr_t)(ip)); \ } \ } #endif ame */ char *nbuf; /* pathname being parsed */ short nlen; /* length of pathname buffer */ short nlink; /* symlinks seen so far */ }; /* * some inline subroutines to speed things up */ #ifdef KERNEL #define plock(ip) \ { \ while ((ip)->i_flag & ILOCK) { \ (ip)->i_flag |= IWANT; \ sleep((caddr_t)(ip), PINOD); \ } \ (ip)->i_flag |= ILOCK; \ } #define prele(ip) \ { \ (ip)->i_flag./sys/dz.h 664 0 0 240 4564204570 5532 struct dz { short state; short flags; struct device *addr; struct block *oblock; struct queue *rdq; char board; char line; char speed; char brking; }; / short nlen; /* length of pathname buffer */ short nlink; /* symlinks seen so far */ }; /* * some inline subroutines to speed things up */ #ifdef KERNEL #define plock(ip) \ { \ while ((ip)->i_flag & ILOCK) { \ (ip)->i_flag |= IWANT; \ sleep((caddr_t)(ip), PINOD); \ } \ (ip)->i_flag |= ILOCK; \ } #define prele(ip) \ { \ (ip)->i_flag./sys/kmc.h 664 0 0 650 4564204570 5674 struct kmc { char k_stat; char k_type; char k_written; struct device *k_addr; int (*k_rint)(); int (*k_xint)(); int (*k_reset)(); }; /* * kmc-related ioctls * should really be in kmcio.h */ #define KSTEP 1 #define KMS 2 #define KCSR 3 #define KSTOP 4 #define KMCLR 5 #define KRUN 6 #define KLU 7 #define KWRCR 8 #define KRESET 9 #define KCSETA (('k'<<8)|1) struct kmcntl { int kmd; short *kcsr; int kval; }; )(ip), PINOD); \ } \ (ip)->i_flag |= ILOCK; \ } #define prele(ip) \ { \ (ip)->i_flag./sys/map.h 664 0 0 414 4564204570 5675 /* * resource maps * see rmap.c */ struct map { int m_size; /* size of this segment of the map */ int m_addr; /* resource-space addr of start of segment */ }; /* * overloaded for first entry */ #define m_end m_size /* number of struct maps in this map */ e KMCLR 5 #define KRUN 6 #define KLU 7 #define KWRCR 8 #define KRESET 9 #define KCSETA (('k'<<8)|1) struct kmcntl { int kmd; short *kcsr; int kval; }; )(ip), PINOD); \ } \ (ip)->i_flag |= ILOCK; \ } #define prele(ip) \ { \ (ip)->i_flag./sys/kdi.h 664 0 0 3357 4564204570 5720 /* * per-channel structure */ struct kdi { struct queue *dkrq; struct block *ibp; struct block *obp; ubm_t imap; ubm_t omap; unsigned short rsize; /* # bytes in last read */ unsigned char chan; unsigned char ostate; unsigned char kno; unsigned char lastctl; }; /* * per-kmc structure */ struct kdikmc { struct kdi *kdi; /* per-channel structures */ char *state; /* per-channel state */ struct buf *buf; /* where the data above is stashed */ ubm_t umap; /* map token for kmc stuff below */ uaddr_t ubad; /* unibus addr of device data */ struct dkmodule *modp; time_t badtime; char init; char bad; char ubno; }; /* * format of UB addresses sent to KMC */ struct kmaddr { unsigned short hi; unsigned short lo; }; /* * KMC init packet */ struct kinit { struct kmaddr cmdaddr; /* UB addr of cmd buf */ struct kmaddr stataddr; /* UB addr of statbuf */ struct kmaddr bufaddr; /* UB addr of KMC workspace */ struct kmaddr csraddr; /* for DR11C - unused */ }; /* * command/status packets */ struct kin { /* KMC command buffer */ unsigned char type; /* command type */ unsigned char serno; /* probably seq number */ unsigned char chan; /* channel number */ unsigned char fill2; /* probably seq number */ unsigned short len; /* byte count */ char ctl; /* possible control byte */ char mode; /* command variant */ struct kmaddr addr; /* UB location of buffer */ }; /* * Big structure with stuff that needs to be accessible on the unibus * one per kmc */ #define NKMB 10 /* number of cmd/status packets */ struct kmcdk { struct kinit kinit; /* the init packet */ struct kin cmd[NKMB]; /* KMC command buffer */ struct kin stat[NKMB]; /* KMC status buffer */ char kmcbuf[16*1024]; /* temp space for KMC */ }; t len; /* byte count */ char ctl; /* possible control byte */ char mode; /* command variant */ struct kmaddr addr; /* UB location of buffer */ }; /* * Big structure with stuff that needs to be accessible on the unibus * one per kmc */ #define NKMB 10 /* numb./sys/bvp.h 664 0 0 11553 4564204570 5755 /* * BVP (BI VAX port) definitions * used by the NI (DEBNA) driver, * and perhaps eventually by the BVP MSCP port */ typedef struct quadque { struct quadque *head, *tail; } quadque; /* * port queue block * one per port; * must be page-aligned */ struct pqb { quadque p_cmdq[4]; /* command queues */ quadque p_rspq; /* response queue */ short p_vector; /* interrupt vector, BR */ short p_nodmsk; /* interrupt node mask */ long p_nfreeq; /* number of free queues */ struct fqb *p_fqb; /* fqp virtual address */ char pp_junk0[156]; long p_bvplvl; /* BVP protocol version */ struct pqb *p_pqb; /* pqb virtual self-pointer */ struct bdt *p_bdt; /* bdt virtual address */ long p_bdtlen; /* and size */ struct pte *p_spt; /* system page table phys addr */ long p_sptlen; /* and size */ struct pte *p_gpt; /* global page table phys addr */ long p_gptlen; /* and size */ long p_funcmask; /* ?? */ char pp_junk1[24]; /* stuff filled in by port after init */ short p_maxdg; /* max datagram size */ short p_maxmsg; /* max message size */ long p_ucodetype; long p_ucodevers; long p_hwtype; long p_vers[3]; char p_qelogo[216]; /* `queue entry logout area' */ }; /* * free queue block */ struct fqb { long f_size; /* max size of things in this queue */ long f_junk; /* reserved, apparently */ quadque f_q; /* the free queue itself */ }; #define NFREEQ 1 /* * buffer descriptor */ struct bdt { short b_flags; short b_key; long b_len; /* length of buffer */ struct pte *b_pte; /* relevant page table */ long b_sw; /* reserved for software */ }; #define NBDT 1 /* * bundle of data for one port * the pqb must be page-aligned; * stick this in a buffer, * which means it must all fit in one */ struct bvpdata { struct pqb p; struct fqb f[NFREEQ+1]; /* +1 acct off-by-one mystery in controller */ struct bdt b[NBDT]; }; /* * port registers */ struct bvpregs { long ctrl; long stat; long err; long data; /* on NI port only: */ long pudr; unsigned char addr[6]; /* ethernet address */ }; #define MSREGS 0xf0 /* offset to storage port registers */ #define NIREGS 0x204 /* offset to NI port registers */ /* * control bits */ #define PCOWN 0x80 /* port own -- here is a command */ #define PCDS 8 /* shift data by eight bits */ #define PCINIT 1 #define PCENAB 2 #define PCCMDQ 6 /* command queue not empty */ #define PCFREQ 7 /* free queue not empty */ /* * status bits */ #define PSOWN 0x80000000 /* port own -- status valid */ #define PSSTD 0x20000000 /* self test done */ #define PSACC 0x10000000 /* adapter can communicate */ #define PSSTAT 0x70000 /* port state: */ #define SUNDEF 0x10000 /* undefined */ #define SINIT 0x20000 /* initialized */ #define SENAB 0x40000 /* enabled */ #define PSERR 0x40 /* error summary */ /* * BVP packet headers */ /* * datagram */ struct bvpdg { quadque q; /* queue linkage */ long bd_sw0; /* for software */ char bd_mbz; /* must be zero */ char bd_sts; /* BVP status */ char bd_opc; /* BVP opcode */ char bd_flag; /* BVP flags */ /* datagram header */ short bd_len; /* length, starting at next byte */ char bd_dgsts; /* datagram status */ char bd_sw1; /* software */ long bd_sw2; /* software */ long bd_ptdb; /* proto type block index */ }; /* * message */ struct bvpmsg { quadque q; /* queue linkage */ long bd_sw0; /* for software */ char bd_mbz; /* must be zero */ char bd_sts; /* BVP status */ char bd_opc; /* BVP opcode */ char bd_flag; /* BVP flags */ /* message header */ short bm_len; /* length, from next byte */ char bm_opc; /* message opcode */ char bm_nists; /* message/NI status */ long bm_sw1; /* software */ }; #define BVPHSIZE 18 /* sizeof(whole packet) == bd_len + BVPHSIZE */ /* * BVP opcodes */ #define BVPSNDDG 1 /* send datagram (or ack) */ #define BVPSNDMSG 2 /* send message */ #define BVPSNDDGI 3 /* send immediate datagram (or ack) */ #define BVPRCVDG 33 /* received datagram */ #define BVPRCVMSG 34 /* received message */ #define BVPRCVDGI 35 /* received immediate datagram */ /* * BVP flags */ #define BVPRSP 01 /* response required */ /* * NI message opcodes */ #define NIWPARAM 3 /* write device parameters */ #define NISTPTDB 7 /* set proto data block */ #define NICLPTDB 8 /* clear proto data block */ /* * status codes */ #define BVPSUC 0 /* BVP success */ #define NISUC 0 /* NI success */ /* * data for STPTDB */ struct stptdb { short pt_proto; /* protocol number */ char pt_fqi; /* free queue index */ char pt_flag; /* flags */ long pt_id; /* id number for this ptdb */ short pt_mcalen; short pt_mcamax; char pt_mcalist[8]; }; /* * pt_flag */ #define PTABM 0x20 /* accept broadcast messages */ #define PTAUP 0x40 /* accept unknown protocols */ #define PTAAM 0x80 /* accept all multicasts */ /* * software data structures */ struct bvp { struct bvpdata *d; struct bvpregs *r; struct biic *rb; struct buf *dbuf; struct bvpregs rsave; /* for debugging */ }; */ char pt_fqi; /* free queue index */ char pt_flag; /* flags */ long pt_id; /* id number for this ptdb */ short pt_mcalen; short pt_mcamax; ./sys/okb.h 664 0 0 1124 4564204570 5712 /* * for datakit simple kmc driver */ /* * per channel */ struct kb { struct queue *dkrq; char flag; u_char chan; struct kb *link; }; /* * per interface */ struct kbkmc { char flags; char kno; /* which kmc is ours */ char ubno; /* which unibus has the kmc */ struct device *addr; /* kmc registers */ struct block *ibuf; /* pending input buffer */ struct block *obuf; /* pending output buffer */ uaddr_t iaddr, oaddr; /* their unibus addresses */ ubm_t imap, omap; /* and map cookies */ struct kb *xfirst, *xlast; /* pending transmit channels */ struct dkmodule *modp; }; ueue *dkrq; char flag; u_char chan; struct kb *link; }; /* * per interface */ struct kbkmc { char flags; char kno; /* which kmc is ours */ char ubno; /* which unibus has the kmc */ struct device *addr; /* kmc registers */ struct block *ibuf; /* pending input buffer */ struct block *obuf; /* pending output buffer */ uaddr_t iaddr, oaddr; /* their unibus addresses */ ubm_t imap, omap; /* and map cookies */ st./sys/pioctl.h 664 0 0 1317 4564204570 6435 #define PIOC ('p'<<8) #define PIOCGETPR (PIOC|1) /* read struct proc */ #define PIOCOPENT (PIOC|2) /* open text file for reading */ #define PIOCEXCLU (PIOC|3) /* mark text for exclusive use */ #define PIOCSTOP (PIOC|4) /* send STOP signal and... */ #define PIOCWSTOP (PIOC|5) /* wait for process to STOP */ #define PIOCRUN (PIOC|6) /* make process runnable */ #define PIOCSMASK (PIOC|7) /* set signal trace bit mask */ #define PIOCCSIG (PIOC|8) /* clear current signal */ #define PIOCKILL (PIOC|9) /* send signal */ #define PIOCSEXEC (PIOC|10) /* stop on exec */ #define PIOCREXEC (PIOC|11) /* run on exec */ #define PIOCNICE (PIOC|12) /* set nice priority */ #define PIOCSSIG (PIOC|13) /* set current signal */ CSTOP (PIOC|4) /* send STOP signal and... */ #define PIOCWSTOP (PIOC|5) /* wait for process to STOP */ #define PIOCRUN (PIOC|6) /* make process runnable */ #define PIOCSMASK (PIOC|7) /* set signal trace bit mask */ #define PIOCCSIG (PIOC|8) /* clear current signal */ #define PIOCKILL (PIOC|9) /* send s./sys/mount.h 664 0 0 362 4564204570 6264 /* * mount structure * used to keep track of fs filesystems * also used, stupidly, by the vm code */ struct mount { struct inode *m_dev; /* special file where filesystem lives */ struct inode *m_mroot; /* root of this filesystem */ }; and... */ #define PIOCWSTOP (PIOC|5) /* wait for process to STOP */ #define PIOCRUN (PIOC|6) /* make process runnable */ #define PIOCSMASK (PIOC|7) /* set signal trace bit mask */ #define PIOCCSIG (PIOC|8) /* clear current signal */ #define PIOCKILL (PIOC|9) /* send s./sys/msgbuf.h 664 0 0 357 4564204570 6411 #define MSG_MAGIC 0x063060 #define MSG_BSIZE (NBPG*CLSIZE - 2 * sizeof (long)) struct msgbuf { long msg_magic; long msg_bufx; char msg_bufc[MSG_BSIZE]; }; #ifdef KERNEL extern struct msgbuf *msgbuf; extern struct pte *msgbufmap; #endif }; and... */ #define PIOCWSTOP (PIOC|5) /* wait for process to STOP */ #define PIOCRUN (PIOC|6) /* make process runnable */ #define PIOCSMASK (PIOC|7) /* set signal trace bit mask */ #define PIOCCSIG (PIOC|8) /* clear current signal */ #define PIOCKILL (PIOC|9) /* send s./sys/mtio.h 664 0 0 3123 4564204570 6110 /* * Structures and definitions for mag tape io control commands */ /* mag tape io control commands */ #define MTIOCTOP (('m'<<8)|1) /* do a mag tape op */ #define MTIOCGET (('m'<<8)|2) /* get mag tape status */ #define MTIOCIEOT (('m'<<8)|3) /* ignore EOT error */ #define MTIOCEEOT (('m'<<8)|4) /* enable EOT error */ /* structure for MTIOCTOP - mag tape op command */ struct mtop { short mt_op; /* operations defined below */ daddr_t mt_count; /* how many of them */ }; /* operations */ #define MTWEOF 0 /* write an end-of-file record */ #define MTFSF 1 /* forward space file */ #define MTBSF 2 /* backward space file */ #define MTFSR 3 /* forward space record */ #define MTBSR 4 /* backward space record */ #define MTREW 5 /* rewind */ #define MTOFFL 6 /* rewind and put the drive offline */ #define MTNOP 7 /* no operation, sets status only */ #define MTRST 8 /* reset broken dec tape controller */ /* structure for MTIOCGET - mag tape get status command */ struct mtget { short mt_type; /* type of magtape device */ /* the following two registers are grossly device dependent */ short mt_dsreg; /* ``drive status'' register */ short mt_erreg; /* ``error'' register */ /* end device-dependent registers */ short mt_resid; /* residual count */ /* the following two are not yet implemented */ daddr_t mt_fileno; /* file number of current position */ daddr_t mt_blkno; /* block number of current position */ /* end not yet implemented */ }; /* * Constants for mt_type byte */ #define MT_ISTS 01 #define MT_ISHT 02 #define MT_ISTM 03 #define MT_ISMT 04 #define MT_ISUT 05 #define MT_ISTMSCP 06 sreg; /* ``drive status'' register */ short mt_erreg; /* ``error'' register */ /* end device-dependent registers */ short mt_resid; /* residual count */ /* the following two are not yet implemented */ daddr_t mt_fileno; /* file number of current position */ daddr_t mt_blkno; /* block number of current position */ /* end not yet implemented */ }; /* * Constants for mt_type byte */ #define MT_ISTS 01 #define MT_ISHT 02./sys/mtpr.h 664 0 0 3024 4564204570 6122 /* * VAX processor register numbers * only the generic ones */ #define KSP 0x0 /* kernel stack pointer */ #define ESP 0x1 /* exec stack pointer */ #define SSP 0x2 /* supervisor stack pointer */ #define USP 0x3 /* user stack pointer */ #define ISP 0x4 /* interrupt stack pointer */ #define P0BR 0x8 /* p0 base register */ #define P0LR 0x9 /* p0 length register */ #define P1BR 0xa /* p1 base register */ #define P1LR 0xb /* p1 length register */ #define SBR 0xc /* system segment base register */ #define SLR 0xd /* system segment length register */ #define PCBB 0x10 /* process control block base */ #define SCBB 0x11 /* system control block base */ #define IPL 0x12 /* interrupt priority level */ #define ASTLVL 0x13 /* async. system trap level */ #define SIRR 0x14 /* software interrupt request */ #define SISR 0x15 /* software interrupt summary */ #define ICCS 0x18 /* interval clock control */ #define NICR 0x19 /* next interval count */ #define ICR 0x1a /* interval count */ #define TODR 0x1b /* time of year (day) */ #define RXCS 0x20 /* console receiver control and status */ #define RXDB 0x21 /* console receiver data buffer */ #define TXCS 0x22 /* console transmitter control and status */ #define TXDB 0x23 /* console transmitter data buffer */ #define MAPEN 0x38 /* memory management enable */ #define TBIA 0x39 /* translation buffer invalidate all */ #define TBIS 0x3a /* translation buffer invalidate single */ #define PMR 0x3d /* performance monitor enable */ #define CPUSID 0x3e /* system identification */ */ #define RXCS 0x20 /* console receiver control and status */ #define RXDB 0x21 /* console receiver data buffer */ #define TXCS 0x22 /* console transmitter control and status */ #define TXDB 0x23 /* console transmitter data buffer */ #define MAPEN 0x38 /* memory management enable */ #define TBIA 0x39 /* translation buffer invalidate all */ #define TBIS 0x3a /* translation buffer invalidate single */ #define PMR 0x3d /* performance monitor enable */ #define CPUSID 0x3e /* syste./sys/nexus.h 664 0 0 750 4574612775 6300 /* * data structures associated with nexus devices; * sbi and vaxbi */ #define NXSIZE 0x2000 /* size of nexus register space */ #define NXWSIZE 01000000 /* size of nexus window space */ struct nexus { char nx[NXSIZE]; char wind[NXWSIZE]; }; struct nextab { /* table of configured nexus */ char bus; /* which group of nexus, if more than one */ char adp; /* which nexus within group */ }; #ifdef KERNEL extern struct nextab nextab[]; /* list of nexus configured */ #endif ne CPUSID 0x3e /* syste./sys/param.h 664 0 0 7507 4604206704 6246 /* * Tunable parameters which do not usually vary per system */ #define MAXUPRC 75 /* max processes per user */ #define SSIZE 4 /* initial stack size (*512 bytes) */ #define SINCR 4 /* increment of stack (*512 bytes) */ #define NOFILE 128 /* max open files per process */ #define NSYSFILE 4 /* stdin, stdout, stderr, /dev/tty */ #define NCARGS (16*1024) /* # characters in exec arglist */ #define CMASK 0 /* default mask for file creation */ #define NGROUPS 32 /* number of simultaneous groups */ /* * priorities * probably should not be * altered too much */ #define PSWP 0 #define PINOD 10 #define PRIBIO 20 #define PZERO 25 #define PPIPE 26 #define PWAIT 30 #define PSLEP 40 #define PUSER 50 #define PRIMAX 127 #define NZERO 20 /* * signals * dont change */ #ifndef NSIG #include #endif /* * Return values from tsleep(). */ #define TS_OK 0 /* normal wakeup */ #define TS_TIME 1 /* timed-out wakeup */ #define TS_SIG 2 /* asynchronous signal wakeup */ #define UPAGES 10 /* pages of u-area */ #define NULL 0 #define NODEV (dev_t)(-1) #define ROOTINO ((ino_t)2) /* i number of all roots */ #define SUPERB ((daddr_t)1) /* block number of the super block */ #define DIRSIZ 14 /* max characters per directory */ #define MAXPID 30000 /* largest process id */ /* * clustering of small hardware pages to larger software pages * this should be in a separate file, one might guess * * bugs: SSIZE, SINCR and UPAGES must be multiples of CLSIZE * BSIZE must bear some relation to CLSIZE*NBPG (but what?) */ #define CLSIZE 2 #define CLOFSET (CLSIZE*NBPG-1) /* for clusters, like PGOFSET */ /* give the base virtual address (first of CLSIZE) */ #define clbase(i) ((i) &~ (CLSIZE-1)) /* round a number of clicks up to a whole cluster */ #define clrnd(i) (((i) + (CLSIZE-1)) &~ (CLSIZE-1)) /* * the following tend to assume that CLSIZE == 2 */ #define BITFS(dev) ((dev) & 64) #define BUFSIZE 4096 /* real buffer size */ #define BSIZE(dev) (BITFS(dev)? 4096: 1024) #define INOPB(dev) (BITFS(dev)? 64: 16) /* inodes per block */ #define BMASK(dev) (BITFS(dev)? 07777: 01777) /* BSIZE-1 */ #define BSHIFT(dev) (BITFS(dev)? 12: 10) /* LOG2(BSIZE) */ #define NINDIR(dev) (BSIZE(dev)/sizeof(daddr_t)) #define NMASK(dev) (BITFS(dev)? 01777: 0377) /* NINDIR-1 */ #define NSHIFT(dev) (BITFS(dev)? 10: 8) /* LOG2(NINDIR) */ #define NICINOD 100 /* free inodes stored in super block */ #define NICFREE 178 /* free blocks in (old) super block */ #define itod(dev, x) ((daddr_t)((((unsigned)(x)+2*INOPB(dev)-1)/INOPB(dev)))) #define itoo(dev, x) ((int)(((x)+2*INOPB(dev)-1)%INOPB(dev))) #define fsbtodb(dev, b) (BITFS(dev)? (b)*8: (b)*CLSIZE) #define dbtofsb(dev, b) (BITFS(dev)? (b)/8: (b)/CLSIZE) #ifndef INTRLVE /* macros replacing interleaving functions */ #define dkblock(bp) ((bp)->b_blkno) #define dkunit(bp) (minor((bp)->b_dev & 077) >> 3) /* that means 8 units with at most 8 pieces each */ #endif /* * Macros for fast min/max */ #define MIN(a,b) (((a)<(b))?(a):(b)) #define MAX(a,b) (((a)>(b))?(a):(b)) /* * Machine-dependent bits and macros */ #define UMODE PSL_CURMOD /* usermode bits */ #define USERMODE(ps) (((ps) & UMODE) == UMODE) #define BASEPRI(ps) (((ps) & PSL_IPL) != 0) /* * Provide about n microseconds of delay */ #define DELAY(n) {extern int delayfact;register int N = (n)*delayfact;while (--N > 0);} /* * hardware definitions * some are (stupidly) in types.h */ #define USRSTACK (0x80000000-UPAGES*NBPG) /* Start of user stack */ #define P1TOP 0x200000 /* boundary between P0 and P1 regions */ #define KSTART 0x80000000 /* beginning of system space */ #define HZ 60 /* software clock ticks per second */ /* * user-accessible types and macros */ #include "sys/types.h" /* * very long stuff */ #define Ltol(x) (x).lo llong_t ltoL(); llong_t Lladd(); llong_t Luadd(); llong_t LLadd(); #define Lsign(x) (x).hi unsigned Lshift(); e are (stupidly) in types.h */ #define USRSTACK (0x80000000-UPAGES*NBPG) /* Start of user stack */ #define P1TOP 0x200000 /* boundary between P0 and P1 regions */ #define KSTART ./sys/pcb.h 664 0 0 2467 4564204571 5717 /* * VAX process control block */ struct pcb { int pcb_ksp; /* kernel stack pointer */ int pcb_esp; /* exec stack pointer */ int pcb_ssp; /* supervisor stack pointer */ int pcb_usp; /* user stack pointer */ int pcb_r0; int pcb_r1; int pcb_r2; int pcb_r3; int pcb_r4; int pcb_r5; int pcb_r6; int pcb_r7; int pcb_r8; int pcb_r9; int pcb_r10; int pcb_r11; int pcb_r12; #define pcb_ap pcb_r12 int pcb_r13; #define pcb_fp pcb_r13 int pcb_pc; /* program counter */ int pcb_psl; /* program status longword */ struct pte *pcb_p0br; /* seg 0 base register */ int pcb_p0lr; /* seg 0 length register and astlevel */ struct pte *pcb_p1br; /* seg 1 base register */ int pcb_p1lr; /* seg 1 length register and pme */ /* * Software pcb (extension) */ long *pcb_sswap; /* dont move until removed */ int pcb_szpt; /* number of pages of user page table */ int pcb_sigc[3]; }; #define AST_NONE 0x04000000 /* ast level */ #define AST_USER 0x03000000 /* ast for user mode */ #define ASTLVL_NONE 4 #define ASTLVL_USER 3 #define AST_CLR 0x07000000 #define aston() \ { \ u.u_pcb.pcb_p0lr = (u.u_pcb.pcb_p0lr &~ AST_CLR) | AST_USER; \ mtpr(ASTLVL, ASTLVL_USER); \ } #define astoff() \ { \ u.u_pcb.pcb_p0lr = (u.u_pcb.pcb_p0lr &~ AST_CLR) | AST_NONE; \ mtpr(ASTLVL, ASTLVL_NONE); \ } ntil removed */ int pcb_szpt; /* number of pages of user page table */ int pcb_sigc[3]; }; #define AST_NONE 0x04000000 /* ast level */ #define AST_USER 0x03000000 /* ast for user mode */ #define A./sys/debna.h 664 0 0 3121 4564204571 6210 /* * definitions for the DEBNA driver * * each hardware device has eight channels; * each channel dedicated to a particular Ethernet protocol * one bnachan per channel */ #define BNACHAN 8 struct bnachan { short proto; /* our protocol */ char needst; /* channel needs stptdb */ unsigned char dcnt; /* number of queued packets */ char unit; /* which controller is ours */ struct queue *rq; }; /* * one bnactl per controller */ struct bnactl { struct bvp bvp; /* general port stuff */ struct dgi *xfree; /* free xmit buffers */ char lastx; /* last channel transmitted -- fairness */ char needst; /* at least one channel needs STPTDB */ char myaddr[6]; /* 6 slightly magic */ struct bnachan chan[BNACHAN]; }; /* * our buffers * BNASLOP is there to allow two kinds of alignment in memory: * 1. interlocked queue instructions require quadword-aligned headers. * 2. a bug in the DEBNA causes it to choke if a BVP message or datagram * header crosses a page boundary; the longest such header is 28 bytes * it is assumed that a header misalignment can happen only once per * set of buffers, because the numbers happen to make it true * it would be easier, but more wasteful of memory, to make BNABSIZE * an even multiple of the page size * we have to allow slop and fix it up at runtime because the * VAX loader guarantees no more than longword alignment */ #define BNABSIZE 1600 /* must be multiple of eight -- quad-align */ #define BNASLOP (8+28) #define BNAXBUF 8 #define BNARBUF 8 struct bnabuf { char rbuf[BNARBUF*BNABSIZE + BNASLOP]; char xbuf[BNAXBUF*BNABSIZE + BNASLOP]; }; of buffers, because the numbers happen to make it true * it would be easier, but more wasteful of memory, to make BNABSIZE * an even multiple of the page size * we have to allow slop and fix it up at runtime because the * VAX loader guarantees no more than longword alignment */ #define BNABSIZE 1600 /* must be multiple of eight -- quad-align */ #define BNASLOP (8+28) #define BNAXBUF 8 #define BNARBUF 8 struct bnabuf { c./sys/proc.h 664 0 0 14061 4574612776 6142 /* * One structure allocated per active * process. It contains all data needed * about the process while the * process may be swapped out. * Other per process data (user.h) * is swapped with the process. */ struct proc { struct proc *p_link; /* linked list of running processes */ struct proc *p_rlink; /* (used by hardware q instructions) */ struct pte *p_addr; /* u-area kernel map address */ unsigned char p_usrpri; /* user-priority based on p_cpu and p_nice */ char p_pri; /* priority, negative is high */ unsigned char p_cpu; /* cpu usage for scheduling */ char p_stat; char p_time; /* resident time for scheduling */ char p_nice; /* nice for cpu usage */ char p_slptime; /* time since last block */ char p_cursig; long p_sig; /* signals pending to this process */ long p_siga0; /* low bit of 2 bit signal action */ long p_siga1; /* high bit of 2 bit signal action */ #define p_ignsig p_siga0 /* ignored signal mask */ int p_flag; short p_uid; /* user id, used to direct tty signals */ short p_pgrp; /* name of process group leader */ short p_pid; /* unique process id */ short p_ppid; /* process id of parent */ void *Jp_lnode; /* per-user scheduling */ float Jp_sharepri; /* priority based on p_nice and p_lnode->kl.l_usage */ short p_poip; /* count of page outs in progress */ short p_szpt; /* copy of page table size */ clicks_t p_tsize; /* size of text (clicks) */ clicks_t p_dsize; /* size of data space (clicks) */ clicks_t p_ssize; /* copy of stack size (clicks) */ clicks_t p_rssize; /* current resident set size in clicks */ clicks_t p_maxrss; /* copy of u.u_limit[MAXRSS] */ clicks_t p_swrss; /* resident set size before last swap */ swblk_t p_swaddr; /* disk address of u area when swapped */ caddr_t p_wchan; /* event process is awaiting */ struct text *p_textp; /* pointer to text structure */ unsigned short p_clktim; /* time to alarm clock signal */ unsigned short p_tsleep; /* time to tsleep */ struct pte *p_p0br; /* page table base P0BR */ struct proc *p_xlink; /* linked list of procs sharing same text */ short p_cpticks; /* ticks of cpu time (only for p_pctcpu) */ float p_pctcpu; /* %cpu for ps (only) */ short Jp_ndx; /* proc index for memall (because of vfork) */ short Jp_idhash; /* hashed based on p_pid for kill+exit+... */ struct proc *p_pptr; /* pointer to process structure of parent */ struct inode *p_trace; /* inode for tracing, see proca.c */ }; #ifdef KERNEL /* * temporary expedient to clean up p_siga0/p_siga1 mess */ #define P_SETDFL(p, mask) (p->p_siga0&=~(mask),p->p_siga1&=~(mask)) #define P_SETIGN(p, mask) (p->p_siga0|=(mask),p->p_siga1&=~(mask)) #define P_SETCATCH(p, mask) (p->p_siga0&=~(mask),p->p_siga1|=(mask)) #define P_SETHOLD(p, mask) (p->p_siga0|=(mask),p->p_siga1|=(mask)) #define P_SIGVAL(p, mask) ((int(*)())\ (((p->p_siga0&(mask))!=0)|(((p->p_siga1&(mask))!=0)<<1))) #define SIGMASK(sig) (1<<((sig)-1)) extern struct proc proc[]; extern int proccnt; extern struct proc *procNPROC; /* high water mark */ struct proc *pfind(); #define NQS 32 /* 32 run queues */ struct prochd { struct proc *ph_link; /* linked list of running processes */ struct proc *ph_rlink; } qs[NQS]; int whichqs; /* bit mask summarizing non-empty qs's */ #endif /* stat codes */ #define SSLEEP 1 /* awaiting an event */ #define SWAIT 2 /* (abandoned state) */ #define SRUN 3 /* running */ #define SIDL 4 /* intermediate state in process creation */ #define SZOMB 5 /* intermediate state in process termination */ #define SSTOP 6 /* process being traced */ /* flag codes */ #define SLOAD 0x00000001 /* in core */ #define SSYS 0x00000002 /* swapper or pager process */ #define SLOCK 0x00000004 /* process being swapped out */ #define SSWAP 0x00000008 /* save area flag */ #define STRC 0x00000010 /* process is being traced */ #define SWTED 0x00000020 /* another tracing flag */ #define SULOCK 0x00000040 /* user settable lock in core */ #define SPAGE 0x00000080 /* process in page wait state */ #define SKEEP 0x00000100 /* another flag to prevent swap out */ #define SDLYU 0x00000200 /* delayed unlock of pages */ #define SWEXIT 0x00000400 /* working on exiting */ #define SPHYSIO 0x00000800 /* doing physical i/o (bio.c) */ #define SPAGI 0x00008000 /* init data space on demand, from inode */ #define SSEQL 0x00010000 /* user warned of sequential vm behavior */ #define SUANOM 0x00020000 /* user warned of random vm behavior */ #define STIMO 0x00040000 /* timing out during sleep */ #define SOWEUPC 0x00200000 /* owe process an addupc() call at next ast */ #define SSEL 0x00400000 /* selecting: wakeup/waiting danger */ #define SPROCTR 0x00800000 /* tracing via /proc */ #define SPROCIO 0x01000000 /* doing I/O via /proc, so don't swap */ #define SSEXEC 0x02000000 /* stop on exec */ #define SPROCWT 0x04000000 /* wanted by /proc after SPAGE */ #define PTRACED(p) ((p)->p_trace || ((p)->p_flag&(STRC|SPROCTR|SSEXEC))) /* * special system process IDs * it is assumed that proc[syspid].p_pid == syspid */ #define SWAPPID 0 /* swapper */ #define INITPID 1 /* init; user process, but still special */ #define PAGEPID 2 /* pageout daemon */ #define SYSPIDS 3 /* number of system pids */ /* * parallel proc structure * to replace part with times * to be passed to parent process * in ZOMBIE state. * * THIS SHOULD BE DONE WITH A union() CONSTRUCTION */ struct xproc { struct proc *xp_link; struct proc *xp_rlink; struct pte *xp_addr; char xp_usrpri; char xp_pri; /* priority, negative is high */ char xp_cpu; /* cpu usage for scheduling */ char xp_stat; char xp_time; /* resident time for scheduling */ char xp_nice; /* nice for cpu usage */ char xp_slptime; char xp_cursig; long xp_sig; /* signals pending to this process */ long xp_siga0; long xp_siga1; int xp_flag; short xp_uid; /* user id, used to direct tty signals */ short xp_pgrp; /* name of process group leader */ short xp_pid; /* unique process id */ short xp_ppid; /* process id of parent */ void *Jxp_lnode; /* per-user scheduling */ float Jxp_sharepri; /* priority based on p_nice and p_lnode->kl.l_usage */ short xp_xstat; /* Exit status for wait */ struct vtimes xp_vm; }; xp_slptime; char xp_cursig; long xp_sig; /* signals pending to this process */ long xp_siga0; long xp_siga1; int xp_flag; short xp_uid; /* user id, used to direct tty signals */ short xp_pgrp; /* name of process group leader */ short xp_pid; /* unique process id */ short xp_ppid; /* process id of parent */ void *Jxp_lnode; /* per-user scheduling */ float Jxp_sharepri; /* priority based on p_nice and p_lnode->kl.l_usage */ short xp_xstat; /* ./sys/psl.h 664 0 0 2017 4564204571 5740 /* * VAX program status longword */ #define PSL_C 0x00000001 /* carry bit */ #define PSL_V 0x00000002 /* overflow bit */ #define PSL_Z 0x00000004 /* zero bit */ #define PSL_N 0x00000008 /* negative bit */ #define PSL_ALLCC 0x0000000f /* all cc bits - unlikely */ #define PSL_T 0x00000010 /* trace enable bit */ #define PSL_IV 0x00000020 /* integer overflow enable bit */ #define PSL_FU 0x00000040 /* floating point underflow enable */ #define PSL_DV 0x00000080 /* decimal overflow enable bit */ #define PSL_IPL 0x001f0000 /* interrupt priority level */ #define PSL_PRVMOD 0x00c00000 /* previous mode (all on is user) */ #define PSL_CURMOD 0x03000000 /* current mode (all on is user) */ #define PSL_IS 0x04000000 /* interrupt stack */ #define PSL_FPD 0x08000000 /* first part done */ #define PSL_TP 0x40000000 /* trace pending */ #define PSL_CM 0x80000000 /* compatibility mode */ #define PSL_MBZ 0x3020ff00 /* must be zero bits */ #define PSL_USERSET (PSL_PRVMOD|PSL_CURMOD) #define PSL_USERCLR (PSL_IS|PSL_IPL|PSL_MBZ) 1f0000 /* interrupt priority level */ #define PSL_PRVMOD 0x00c00000 /* previous mode (all on is user) */ #define PSL_CURMOD 0x03000000 /* current mode (all on is user) */ #define PSL_IS 0x04000000 /* interrupt stack */ #define PSL_FPD 0x08000000 /* first part done */ #define PSL_TP 0x40000000 /* trace pending */ #define PSL_CM 0x80000000 /* compatibility mode */ #define PSL_MBZ 0x3020ff00 /* must be zero bits */ #define PSL_USERSET (PSL_PRVMOD|PSL_CURMOD) #define PSL_USERCLR (PSL_IS|PS./sys/pte.h 664 0 0 3711 4657164720 5740 /* * VAX page table entry * * There are two major kinds of pte's: those which have ever existed (and are * thus either now in core or on the swap device), and those which have * never existed, but which will be filled on demand at first reference. * There is a structure describing each. There is also an ancillary * structure used in page clustering. */ struct pte { unsigned int pg_pfnum:21, /* core page frame number or 0 */ :2, /*pg_vreadm*/:1, /* modified since vread (or with _m) */ pg_swapm:1, /* have to write back to swap */ pg_fod:1, /* is fill on demand (=0) */ pg_m:1, /* hardware maintained modified bit */ pg_prot:4, /* access control */ pg_v:1; /* valid bit */ }; struct hpte { unsigned int pg_pfnum:21, :2, pg_high:9; /* special for clustering */ }; struct fpte { unsigned int pg_blkno:20, /* file system block number */ :4, pg_source:1, /* TEXT or ZERO */ pg_fod:1, /* is fill on demand (=1) */ :1, pg_prot:4, pg_v:1; }; #define PG_V 0x80000000 #define PG_PROT 0x78000000 #define PG_M 0x04000000 #define PG_FOD 0x02000000 #define PG_PFNUM 0x001fffff #define PG_FZERO 0 #define PG_FTEXT 1 #define PG_NOACC 0 #define PG_KW 0x10000000 #define PG_KR 0x18000000 #define PG_UW 0x20000000 #define PG_URKW 0x70000000 #define PG_URKR 0x78000000 #ifdef KERNEL /* * Pte related macros */ #define dirty(pte) ((pte)->pg_fod == 0 && (pte)->pg_pfnum && \ ((pte)->pg_m || (pte)->pg_swapm)) #define physadr(a) ((long)(a)&PGOFSET|(Sysmap[((long)(a)&~KSTART)/NBPG].pg_pfnum*NBPG)) struct pte *vtopte(); struct pte *btopte(); /* various pointers into the system page table */ extern struct pte *Sysmap; extern struct pte *Usrptmap; extern struct pte *usrpt; extern struct pte *Swapmap; extern struct pte *Forkmap; extern struct pte *Xswapmap; extern struct pte *Xswap2map; extern struct pte *Pushmap; extern struct pte *mmap; extern struct pte *msgbufmap; extern struct pte *camap; extern struct pte *Prusrmap; #endif r(a) ((long)(a)&PGOFSET|(Sysmap[((long)(a)&~KSTART)/NBP./sys/reboot.h 664 0 0 735 4564204571 6421 /* * Arguments to reboot system call. * These are passed to boot program in r11, * and on to init. */ #define RB_AUTOBOOT 0 /* flags for system auto-booting itself */ #define RB_ASKNAME 1 /* ask for file name to reboot from */ #define RB_SINGLE 2 /* reboot to single user only */ #define RB_NOSYNC 4 /* dont sync before reboot */ #define RB_HALT 8 /* don't reboot, just halt */ #define RB_PANIC 16 /* reboot due to panic */ #define RB_BOOT 0 /* reboot due to boot() */ SET|(Sysmap[((long)(a)&~KSTART)/NBP./sys/reg.h 664 0 0 640 4564204571 5677 /* * Location of the users' stored * registers relative to R0. * Usage is u.u_ar0[XX]. */ #define R0 (-18) #define R1 (-17) #define R2 (-16) #define R3 (-15) #define R4 (-14) #define R5 (-13) #define R6 (-12) #define R7 (-11) #define R8 (-10) #define R9 (-9) #define R10 (-8) #define R11 (-7) #define R12 (-21) #define R13 (-20) #define AP (-21) #define FP (-20) #define SP (-5) #define PS (-1) #define PC (-2) ue to panic */ #define RB_BOOT 0 /* reboot due to boot() */ SET|(Sysmap[((long)(a)&~KSTART)/NBP./sys/biic.h 664 0 0 3125 4564204571 6051 /* * registers in the VAXBI interface chip * used by all VAXBI nodes */ struct biic { long bitype; /* device type */ long bicsr; long biber; long bieir; /* error interrupt -- used by biic */ long biintr; /* mask of interrupt destination bits */ long biipmsk; long bifipdes; long biipsrc; long bisadr; /* some starting address */ long bieadr; /* some ending address */ long bibci; /* bci csr */ long biwstat; long bifipscmd; long bi__pad1[3]; long biuir; /* user device interrupt -- sometimes used */ long bi__pad2[43]; long bigpr0; long bigpr1; long bigpr2; long bigpr3; }; /* 0x100 bytes long */ /* * some bits * only put them here if needed, please */ /* * bicsr */ #define BIHES 0x8000 /* hard error summary */ #define BISES 0x4000 /* soft error summary */ #define BIBROKE 0x1000 /* device is broken */ #define BISTS 0x800 /* BIIC passed self-test */ #define BINRST 0x400 /* node, reset thyself */ #define BIHEIE 0x80 /* hard error interrupt enable */ #define BISEIE 0x40 /* soft error interrupt enable */ #define BIHIARB 0x10 /* fixed-high priority for this node */ #define BINODEID 0xf /* number of this node in this BI */ /* * biber */ #define BIBERCLR 0x3fff0007 /* clear all the error bits */ /* * bieir */ #define EIFORCE 0x100000 /* force interrupt if set */ #define EIBR7 0x80000 /* error interrupts at BR7 */ #define EIBR6 0x40000 #define EIBR5 0x20000 #define EIBR4 0x10000 /* * bibci */ #define BCINTREN 0x40 /* enable received interrupts */ #define BCRTOEN 0x2 /* enable retry event */ /* * biuir */ #define UIEXVEC 0x8000 /* external vector */ #define BINODEID 0xf /* number of this node in this BI */ /* * biber */ #define BIBERCLR 0x3fff0007 /* clear all the error bits */ /* * bieir */ #define EIFORCE 0x100000 /* force interrupt if set */ #define EIBR7 0x80000 /* error interrupts at BR7 */ #define EIBR6 0x40000 #define EIBR5 0x20000 #define EIBR4 0x10000 /* * bibci */ #define BCINTREN 0x40 /* enable received interrupts */ #define BCRTOEN 0x2 /* e./sys/bda.h 664 0 0 2154 4564204572 5673 /* * defs for the kdb50 driver */ /* * per-controller structure */ #define BDACMD 32 /* no more than this many command packets */ #define BDANMAP 20 /* number of chunks of map */ struct bd { struct biic *bd_addr; /* device register address */ short bd_flags; /* misc flag bits */ short bd_credits; /* number of flow control credits */ struct bdcomm *bd_comm; /* virt addr of comm area */ struct bdcmd *bd_cpkt; /* virt addr of command packets */ struct bdrsp *bd_rpkt; /* virt addr of response packets */ long *bd_pmap; /* page table for mapped transfers */ struct buf *bd_cbuf; /* buffer for comm/cmds */ struct buf *bd_rbuf; /* buffer for responses */ struct buf *bd_mbuf; /* buffer for page table */ short bd_cnext; /* index of next cmd descriptor */ short bd_rnext; /* ditto response */ char bd_cbusy[BDACMD]; /* busy flags for commands */ char bd_back[BDACMD]; /* back-index from cmd ring to packets */ unsigned short bd_mbase[BDACMD]; /* base addr of allocated map */ unsigned short bd_msize[BDACMD]; /* size of allocated map */ struct map bd_map[BDANMAP]; /* and how it is allocated */ }; /cmds */ struct buf *bd_rbuf; /* buffer for responses */ struct buf *bd_mbuf; /* buffer for page table */ short bd_cnext; /* index of next cmd descriptor */ short bd_rnext; /* ditto response */ char bd_cbusy[BDACMD]; /* busy flags for commands */ char bd_back[BDACMD]; /* back-index from cmd ring to packets */ unsigned short bd_mbase[BDACMD]; /* base addr of allocated map */ unsigned short ./sys/mesg.h 664 0 0 117 4564204572 6055 struct imesg { char type; char msflag; short size; struct block *saveb; }; nd how it is allocated */ }; /cmds */ struct buf *bd_rbuf; /* buffer for responses */ struct buf *bd_mbuf; /* buffer for page table */ short bd_cnext; /* index of next cmd descriptor */ short bd_rnext; /* ditto response */ char bd_cbusy[BDACMD]; /* busy flags for commands */ char bd_back[BDACMD]; /* back-index from cmd ring to packets */ unsigned short bd_mbase[BDACMD]; /* base addr of allocated map */ unsigned short ./sys/ta.h 664 0 0 376 4564204572 5535 /* * TMSCP driver */ struct tatape { short flags; short dens; /* current density */ struct msportsw *port; struct buf *actf; /* next buffer sent */ struct buf *actl; /* last buffer sent */ struct mscmd *cmdp; /* pending command this unit */ }; md descriptor */ short bd_rnext; /* ditto response */ char bd_cbusy[BDACMD]; /* busy flags for commands */ char bd_back[BDACMD]; /* back-index from cmd ring to packets */ unsigned short bd_mbase[BDACMD]; /* base addr of allocated map */ unsigned short ./sys/stat.h 664 0 0 1677 4564204572 6131 struct stat { dev_t st_dev; ino_t st_ino; unsigned short st_mode; short st_nlink; short st_uid; short st_gid; dev_t st_rdev; off_t st_size; time_t st_atime; time_t st_mtime; time_t st_ctime; }; #define S_IFMT 0170000 /* type of file */ #define S_IFDIR 0040000 /* directory */ #define S_IFCHR 0020000 /* character special */ #define S_IFBLK 0060000 /* block special */ #define S_IFREG 0100000 /* regular */ #define S_IFLNK 0120000 /* symbolic link */ #define S_ISUID 0004000 /* set user id on execution */ #define S_ISGID 0002000 /* set group id on execution */ #define S_IREAD 0000400 /* read permission, owner */ #define S_IWRITE 0000200 /* write permission, owner */ #define S_IEXEC 0000100 /* execute/search permission, owner */ #define S_ICCTYP 0007000 /* type of concurrent access */ #define S_ISYNC 0001000 /* 1 writer and n readers (synchronized access) */ #define S_IEXCL 0003000 /* 1 writer or n readers (exclusive access) */ /* symbolic link */ #define S_ISUID 0004000 /* set user id on e./sys/systm.h 664 0 0 1561 4564224077 6327 /* * Random set of variables * used by more than one * routine. */ int lbolt; /* time of day in 60th not in time */ time_t time; /* time in sec from 1970 */ char runin; /* scheduling flag */ char runout; /* scheduling flag */ int runrun; /* scheduling flag */ int noproc; /* no one is running just now */ char curpri; /* more scheduling */ int maxmem; /* actual max memory per process */ int physmem; /* physical memory on this CPU */ int wantin; daddr_t rablock; /* block to be read ahead */ dev_t rootdev; /* device of the root */ extern dev_t swapdev; /* swapping device */ dev_t argdev; /* device for argument lists */ daddr_t bmap(); unsigned max(); unsigned min(); /* * Structure of the system-entry table */ extern struct sysent { int sy_narg; /* total number of arguments */ int (*sy_call)(); /* handler */ } sysent[]; #define MAXSYS 128 /* actual max memory per process */ int physmem; /* physical memory on this CPU */ int wantin; daddr_t rablock; /* block to be read ahead./sys/text.h 664 0 0 2127 4574612776 6143 /* * Text structure. * One allocated per pure * procedure on swap device. * Manipulated by text.c */ #define NXDAD 12 /* param.h:MAXTSIZ / dmap.h:DMTEXT */ struct text { swblk_t x_daddr[NXDAD]; /* disk addresses of dmtext-page segments */ swblk_t x_ptdaddr; /* disk address of page table */ clicks_t x_size; /* size (clicks) */ struct proc *x_caddr; /* ptr to linked proc, if loaded */ struct inode *x_iptr; /* inode of prototype */ short x_rssize; short x_swrss; short x_count; /* reference count */ short x_ccount; /* number of loaded references */ char x_flag; /* traced, written flags */ char x_slptime; short x_poip; /* page out in progress count */ }; #ifdef KERNEL extern struct text text[]; struct text *textNTEXT; extern int textcnt; extern int dmtext; #endif #define XTRC 01 /* Text may be written, exclusive use */ #define XWRIT 02 /* Text written into, must swap out */ #define XLOAD 04 /* Currently being read from file */ #define XLOCK 010 /* Being swapped in or out */ #define XWANT 020 /* Wanted for swapping */ #define XPAGI 040 /* Page in on demand from inode */ en flags */ char x_slptime; short x_poip; /* page out in progress count */ }; #ifdef KERNEL extern struct text text[]; struct text *textNTEXT; extern int textcnt; extern int dmtext; #endif #define XTRC 01 /* Text may be written, exclusive use */ #define XWRIT 02 /* Text written into, must swap out */ #define XLOAD 04 /* Currently being read from file */ #define XLOCK 010 /* Being swapped in or out */ #define XWAN./sys/timeb.h 664 0 0 214 4564204572 6220 /* * Structure returned by ftime system call */ struct timeb { time_t time; unsigned short millitm; short timezone; short dstflag; }; Œ Ñ%´Ï.X3Œ Ñ%+MŸ te16.hdmrbinŒ Ñ%´Ï.X3Œ Ñ%xMŸ bufld.hdmrbinŒ Ñ%´Ï.X3Œ Ñ%uMŸ qbio.hdmrbinù Ñ%´Ï.X3 Ñ% ./sys/times.h 664 0 0 342 4564204572 6243 /* * Structure returned by times() */ struct tms { time_t tms_utime; /* user time */ time_t tms_stime; /* system time */ time_t tms_cutime; /* user time, children */ time_t tms_cstime; /* system time, children */ }; binŒ Ñ%´Ï.X3Œ Ñ%xMŸ bufld.hdmrbinŒ Ñ%´Ï.X3Œ Ñ%uMŸ qbio.hdmrbinù Ñ%´Ï.X3 Ñ% ./sys/kc.h 664 0 0 1512 4564204572 5537 /* * for datakit simple cure driver */ /* * per channel */ struct kc { struct queue *dkrq; char flag; u_char chan; struct kc *link; }; #define NCTL 4 struct cmd { long ubaddr; unsigned short count; unsigned char chan; unsigned char flag; unsigned short ctl[NCTL]; }; /* * per interface */ #define NCBUF 4 struct kccure { char flags; char kno; /* which cure is ours */ char ubno; /* which unibus has the cure */ struct device *addr; /* cure registers */ struct cmd xcbuf[NCBUF]; /* xcommand buffers */ struct cmd rcbuf[NCBUF]; /* rcommand buffers */ struct block *obp[NCBUF]; /* current output blocks */ struct block *ibp[NCBUF]; /* current input blocks */ ubm_t imap[NCBUF]; /* unibus map cookies */ ubm_t omap[NCBUF]; struct kc *xfirst, *xlast; /* pending transmit channels */ struct dkmodule *modp; }; t kccure { char flags; char kno; /* which cure is ours */ char ubno; /* which unibus has the cure */ struct device *addr; /* cure registers */ struct cmd xcbuf[NCBUF]; /* x./sys/trap.h 664 0 0 1445 4564204572 6115 /* * Trap type values */ /* The first three constant values are known to the real world */ #define RESADFLT 0 /* reserved addressing fault */ #define PRIVINFLT 1 /* privileged instruction fault */ #define RESOPFLT 2 /* reserved operand fault */ /* End of known constants */ #define BPTFLT 3 /* bpt instruction fault */ #define XFCFLT 4 /* xfc instruction fault */ #define SYSCALL 5 /* chmk instruction (syscall trap) */ #define ARITHTRAP 6 /* arithmetic trap */ #define ASTFLT 7 /* software level 2 trap (ast deliv) */ #define SEGFLT 8 /* segmentation fault */ #define PROTFLT 9 /* protection fault */ #define TRCTRAP 10 /* trace trap */ #define COMPATFLT 11 /* compatibility mode fault */ #define PAGEFLT 12 /* page fault */ #define TABLEFLT 13 /* page table fault */ efine BPTFLT 3 /* bpt instruction fault */ #define XFCFLT 4 /* xfc instruction fault */ #define SYSCALL 5 /* chmk instruction (syscall trap) */ #define ARITHTRAP 6 /* arithmetic trap */ #define ASTFLT 7 /* soft./sys/types.h 664 0 0 3431 4604205755 6307 /* * Basic system types and related macros */ /* * hardware parameters */ #define NBBY 8 /* number of bits in a byte */ #define NBPW sizeof(int) /* number of bytes in an integer */ #define NBPG 512 /* bytes per hardware page */ #define PGOFSET (NBPG-1) /* byte offset into page */ #define PGSHIFT 9 /* LOG2(NBPG) */ /* Core clicks (512 bytes) to segments and vice versa */ #define ctos(x) (x) #define stoc(x) (x) /* Core clicks (512 bytes) to disk blocks */ #define ctod(x) (x) /* clicks to bytes */ #define ctob(x) ((x)<<9) /* bytes to clicks */ #define btoc(x) ((((unsigned)(x)+511)>>9)) /* * these should go away; * just say `unsigned' */ typedef unsigned char u_char; typedef unsigned short u_short; typedef unsigned int u_int; typedef unsigned long u_long; typedef long daddr_t; /* disk blocks */ typedef char * caddr_t; typedef unsigned short ino_t; typedef long swblk_t; typedef long clicks_t; /* memory clicks */ typedef long time_t; typedef long label_t[14]; typedef unsigned short dev_t; typedef long off_t; typedef struct { unsigned long lo; long hi; } llong_t; /* major part of a device */ #define major(x) ((int)(((unsigned)(x)>>8)&0377)) /* minor part of a device */ #define minor(x) ((int)((x)&0377)) /* make a device number */ #define makedev(x,y) ((dev_t)(((x)<<8) | (y))) /* * Set of fds used with the select system call. * assumed that NOFILE <= 128 */ #define FDWORDS (128+NBPW*NBBY-1)/(NBPW*NBBY) typedef struct fd_set { unsigned int fds_bits[FDWORDS]; } fd_set; #define FD_SET(n,s) (s).fds_bits[(n)/(NBPW*NBBY)] |= 1<<((n)%(NBPW*NBBY)) #define FD_CLR(n,s) (s).fds_bits[(n)/(NBPW*NBBY)] &= ~(1<<((n)%(NBPW*NBBY))) #define FD_ISSET(n,s) ((s).fds_bits[(n)/(NBPW*NBBY)] & (1<<((n)%(NBPW*NBBY)))) #define FD_ZERO(s) {int i; for(i=0;i #include #include /* * The user structure. * One allocated per process. * Contains all per process data * that doesn't need to be referenced * while the process is swapped. * The user block is UPAGES*NBPG bytes * long; resides at virtual user * loc 0x80000000-UPAGES*NBPG; contains the system * stack per user; is cross referenced * with the proc structure for the * same process. */ #define SHSIZE 32 #define NOGROUP (short)-1 /* endmarker */ /* should NGROUPS be here? */ struct user { struct pcb u_pcb; int junk1; /* temp; pcb shrank */ int u_arg[5]; /* arguments to current system call */ label_t u_qsav; /* for non-local gotos on interrupts */ char u_segflg; /* 0:user D; 1:system; 2:user I */ #define SEGUDATA 0 #define SEGSYS 1 #define SEGUINST 2 char u_error; /* return error code */ short u_uid; /* effective user id */ short u_gid; /* effective group id */ short u_ruid; /* real user id */ short u_rgid; /* real group id */ short u_groups[NGROUPS]; /* array of groups really looked at */ struct proc *u_procp; /* pointer to proc structure */ int *u_ap; /* pointer to arglist */ union { /* syscall return values */ struct { int R_val1; int R_val2; } u_rv; #define r_val1 u_rv.R_val1 #define r_val2 u_rv.R_val2 off_t r_off; time_t r_time; } u_r; caddr_t u_base; /* base address for IO */ unsigned int u_count; /* bytes remaining for IO */ llong_t u_offset; /* offset in file for IO */ struct inode *u_cdir; /* pointer to inode of current directory */ struct inode *u_rdir; /* root directory of current process */ char junk2[14]; /* used to be current pathname component */ char junk4[14+2]; /* used to be current directory entry */ struct file *u_ofile[NOFILE]; /* pointers to file structures of open files */ char u_pofile[NOFILE]; /* per-process flags of open files */ #define EXCLOSE 01 /* auto-close on exec */ label_t u_ssav; /* label variable for swapping */ int (*u_signal[NSIG])(); /* disposition of signals */ int u_code; /* ``code'' to trap */ /* on SIGILL code passes compatibility mode fault address */ /* on SIGFPE code passes more specific kind of floating point fault */ int *u_ar0; /* address of users saved R0 */ struct uprof { /* profile arguments */ short *pr_base; /* buffer base */ unsigned pr_size; /* buffer size */ unsigned pr_off; /* pc offset */ unsigned pr_scale; /* pc scaling */ } u_prof; short junk5; /* was u_eosys/u_sep */ dev_t u_ttydev; /* dev,ino of controlling tty */ ino_t u_ttyino; union { struct { /* header of executable file */ int Ux_mag; /* magic number */ unsigned Ux_tsize; /* text size */ unsigned Ux_dsize; /* data size */ unsigned Ux_bsize; /* bss size */ unsigned Ux_ssize; /* symbol table size */ unsigned Ux_entloc; /* entry location */ unsigned Ux_unused; unsigned Ux_relflg; } Ux_A; char ux_shell[SHSIZE]; /* #! and name of interpreter */ } u_exdata; #define ux_mag Ux_A.Ux_mag #define ux_tsize Ux_A.Ux_tsize #define ux_dsize Ux_A.Ux_dsize #define ux_bsize Ux_A.Ux_bsize #define ux_ssize Ux_A.Ux_ssize #define ux_entloc Ux_A.Ux_entloc #define ux_unused Ux_A.Ux_unused #define ux_relflg Ux_A.Ux_relflg char u_comm[14]; /* needs to be >= acct.ac_comm */ time_t u_start; char u_acflag; short junk6; /* was u_fpflag */ short u_cmask; /* mask for file creation */ clicks_t u_tsize; /* text size (clicks) */ clicks_t u_dsize; /* data size (clicks) */ clicks_t u_ssize; /* stack size (clicks) */ struct vtimes u_vm; /* stats for this proc */ struct vtimes u_cvm; /* sum of stats for reaped children */ struct dmap u_dmap; /* disk map for data segment */ struct dmap u_smap; /* disk map for stack segment */ struct dmap u_cdmap, u_csmap; /* shadows of u_dmap, u_smap, for use of parent during fork */ time_t u_outime; /* user time at last sample */ clicks_t u_odsize, u_ossize; /* for (clumsy) expansion swaps */ int u_limit[8]; /* see */ int u_nbadio; /* # IO operations on hungup streams */ char u_logname[8]; /* login name */ int u_stack[1]; /* * kernel stack per user * extends from u + UPAGES*512 * backward not to reach here */ }; /* u_eosys values */ #define JUSTRETURN 0 #define RESTARTSYS 1 #define SIMULATERTI 2 /* u_error codes */ #include #ifdef KERNEL extern struct user u; extern struct user *swaputl; extern struct user *forkutl; extern struct user *xswaputl; extern struct user *xswap2utl; extern struct user *pushutl; extern struct user *prusrutl; #endif me[8]; /* login name */ int u_stack[1]; /* * kernel stack per user * extends from u + UPAGES*512 * backward not to reach here */ }; /* u_eosys values */ #define JUSTRETURN 0 #define RESTARTSYS 1 #define SIMULATERTI 2 /* u_error codes */ #include #ifdef KERNEL extern struct user u; extern struct user *swaputl; extern struct user *forkutl; extern struct user *xswaputl; extern struct user *xswap2utl; extern struct user *pushutl; extern struct user *pru./sys/vadvise.h 644 0 0 466 4564204573 6571 /* * Parameters to vadvise() to tell system of particular paging * behaviour: * VA_NORM Normal strategy * VA_ANOM Sampling page behaviour is not a win, don't bother * Suitable during GCs in LISP, or sequential or random * page referencing. */ #define VA_NORM 0 #define VA_ANOM 1 #define VA_SEQL 2 f KERNEL extern struct user u; extern struct user *swaputl; extern struct user *forkutl; extern struct user *xswaputl; extern struct user *xswap2utl; extern struct user *pushutl; extern struct user *pru./sys/vcmd.h 664 0 0 200 4564204573 6045 #define VPRINT 0100 #define VPLOT 0200 #define VPRINTPLOT 0400 #define VGETSTATE (('v'<<8)|0) #define VSETSTATE (('v'<<8)|1) page behaviour is not a win, don't bother * Suitable during GCs in LISP, or sequential or random * page referencing. */ #define VA_NORM 0 #define VA_ANOM 1 #define VA_SEQL 2 f KERNEL extern struct user u; extern struct user *swaputl; extern struct user *forkutl; extern struct user *xswaputl; extern struct user *xswap2utl; extern struct user *pushutl; extern struct user *pru./sys/vlimit.h 664 0 0 1004 4564204573 6443 /* * Limits for u.u_limit[i], per process, inherited. */ #define LIM_NORAISE 0 /* if <> 0, can't raise limits */ #define LIM_CPU 1 /* max secs cpu time */ #define LIM_FSIZE 2 /* max size of file created */ #define LIM_DATA 3 /* max growth of data space */ #define LIM_STACK 4 /* max growth of stack */ #define LIM_CORE 5 /* max size of ``core'' file */ #define LIM_MAXRSS 6 /* max desired data+stack core usage */ #define LIM_TEXT 7 /* max size of text segment */ #define NLIMITS 7 #define INFINITY 0x7fffffff * Limits for u.u_limit[i], per process, inherited. */ #define LIM_NORAISE 0 /* if <> 0, can't raise limits */ #define LIM_CPU 1 /* max secs cpu time */ #define LIM_FSIZE 2 /* max size of file created */ #define LIM_DATA 3 /* max growth of data space */ #define LIM_STACK 4 /* max growth of stack */ #define LIM_CORE 5 /* max size of ``core'' file */ #define LIM_MAXRSS 6 /* max desired data+stack core usage */ #define LIM_TEXT 7 /* max size of text segment */ #define NLIMITS 7 #define INFINITY 0x7ffff./sys/vm.h 664 0 0 266 4564204573 5552 /* * #include * is a quick way to include all the vm header files. */ #include #include #include #include ax size of file created */ #define LIM_DATA 3 /* max growth of data space */ #define LIM_STACK 4 /* max growth of stack */ #define LIM_CORE 5 /* max size of ``core'' file */ #define LIM_MAXRSS 6 /* max desired data+stack core usage */ #define LIM_TEXT 7 /* max size of text segment */ #define NLIMITS 7 #define INFINITY 0x7ffff./sys/vmmac.h 664 0 0 6111 4564204573 6246 /* * Virtual memory related conversion macros */ /* Core clicks to number of pages of page tables needed to map that much */ #define ctopt(x) (((x)+NPTEPG-1)/NPTEPG) /* Virtual page numbers to text|data|stack segment page numbers and back */ #define vtotp(p, v) ((int)(v)) #define vtodp(p, v) ((int)((v) - (p)->p_tsize)) #define vtosp(p, v) ((int)(btop(USRSTACK) - 1 - (v))) #define tptov(p, i) ((unsigned)(i)) #define dptov(p, i) ((unsigned)((p)->p_tsize + (i))) #define sptov(p, i) ((unsigned)(btop(USRSTACK) - 1 - (i))) /* Tell whether virtual page numbers are in text|data|stack segment */ #define isassv(p, v) ((v) & P1TOP) #define isatsv(p, v) ((v) < (p)->p_tsize) #define isadsv(p, v) ((v) >= (p)->p_tsize && !isassv(p, v)) /* Tell whether pte's are text|data|stack */ #define isaspte(p, pte) ((pte) > sptopte(p, (p)->p_ssize)) #define isatpte(p, pte) ((pte) < dptopte(p, 0)) #define isadpte(p, pte) (!isaspte(p, pte) && !isatpte(p, pte)) /* Text|data|stack pte's to segment page numbers and back */ #define ptetotp(p, pte) ((pte) - (p)->p_p0br) #define ptetodp(p, pte) ((pte) - ((p)->p_p0br + (p)->p_tsize)) #define ptetosp(p, pte) \ (((p)->p_p0br + (p)->p_szpt*NPTEPG - UPAGES - 1) - (pte)) #define tptopte(p, i) ((p)->p_p0br + (i)) #define dptopte(p, i) ((p)->p_p0br + (p)->p_tsize + (i)) #define sptopte(p, i) \ (((p)->p_p0br + (p)->p_szpt*NPTEPG - UPAGES - 1) - (i)) /* Bytes to pages without rounding, and back */ #define btop(x) (((unsigned)(x)) >> PGSHIFT) #define ptob(x) ((caddr_t)((x) << PGSHIFT)) /* Turn virtual addresses into kernel map indices */ #define kmxtob(a) (usrpt + (a) * NPTEPG) #define btokmx(b) (((b) - usrpt) / NPTEPG) /* User area address and pcb bases */ #define uaddr(p) (&((p)->p_p0br[(p)->p_szpt * NPTEPG - UPAGES])) #define pcbb(p) ((p)->p_addr[0].pg_pfnum) /* Average new into old with aging factor time */ #define ave(smooth, cnt, time) \ smooth = ((time - 1) * (smooth) + (cnt)) / (time) /* * Page clustering macros. * * dirtycl(pte) is the page cluster dirty? * anycl(pte,fld) does any pte in the cluster has fld set? * zapcl(pte,fld) = val set all fields fld in the cluster to val * distcl(pte) distribute high bits to cluster; note that * distcl copies everything but pg_pfnum, * INCLUDING pg_m!!! * * In all cases, pte must be the low pte in the cluster, even if * the segment grows backwards (e.g. the stack). */ #define H(pte) ((struct hpte *)(pte)) #if CLSIZE==1 #define dirtycl(pte) dirty(pte) #define anycl(pte,fld) ((pte)->fld) #define zapcl(pte,fld) (pte)->fld #define distcl(pte) #endif #if CLSIZE==2 #define dirtycl(pte) (dirty(pte) || dirty((pte)+1)) #define anycl(pte,fld) ((pte)->fld || (((pte)+1)->fld)) #define zapcl(pte,fld) (pte)[1].fld = (pte)[0].fld #endif #if CLSIZE==4 #define dirtycl(pte) \ (dirty(pte) || dirty((pte)+1) || dirty((pte)+2) || dirty((pte)+3)) #define anycl(pte,fld) \ ((pte)->fld || (((pte)+1)->fld) || (((pte)+2)->fld) || (((pte)+3)->fld)) #define zapcl(pte,fld) \ (pte)[3].fld = (pte)[2].fld = (pte)[1].fld = (pte)[0].fld #endif #ifndef distcl #define distcl(pte) zapcl(H(pte),pg_high) #endif rty(pte) || dirty((pte)+1)) #define anycl(pte,fld) ((pte)->fld || (((pte)+1)->fld)) #define zapcl(pte,fld) (pte)[1].fld = (pte)[0].fld #endif #if CLSIZE==4 #define dirtycl(pte) \ (dirty(pte) || dirty((pte)+1) || dirty((pte)+2) || dirty((pte)+3)) #define anycl(pte,fld) \ ((pte)->fld || (((pte)+1)->fld) || (((pte)+2)->fld) || (((pte)+3)->fld)) #define zapcl(pte,fld) \ (pte)[3].fld = (pte)[2].fld = (pte)[1].fld = (pte)[0].fld./sys/vmmeter.h 664 0 0 5662 4564204573 6634 /* * Virtual memory related instrumentation */ struct vmmeter { #define v_first v_swtch unsigned v_swtch; /* context switches */ unsigned v_trap; /* calls to trap */ unsigned v_syscall; /* calls to syscall() */ unsigned v_intr; /* device interrupts */ unsigned v_pdma; /* pseudo-dma interrupts */ unsigned v_pswpin; /* pages swapped in */ unsigned v_pswpout; /* pages swapped out */ unsigned v_pgin; /* pageins */ unsigned v_pgout; /* pageouts */ unsigned v_pgpgin; /* pages paged in */ unsigned v_pgpgout; /* pages paged out */ unsigned v_intrans; /* intransit blocking page faults */ unsigned v_pgrec; /* total page reclaims */ unsigned v_xsfrec; /* found in free list rather than on swapdev */ unsigned v_xifrec; /* found in free list rather than in filsys */ unsigned v_exfod; /* pages filled on demand from executables */ unsigned v_zfod; /* pages zero filled on demand */ unsigned v_vrfod; /* fills of pages mapped by vread() */ unsigned v_nexfod; /* number of exfod's created */ unsigned v_nzfod; /* number of zfod's created */ unsigned v_nvrfod; /* number of vrfod's created */ unsigned v_pgfrec; /* page reclaims from free list */ unsigned v_faults; /* total faults taken */ unsigned v_scan; /* scans in page out daemon */ unsigned v_rev; /* revolutions of the hand */ unsigned v_seqfree; /* pages taken from sequential programs */ unsigned v_dfree; /* pages freed by daemon */ #define v_last v_dfree unsigned v_swpin; /* swapins */ unsigned v_swpout; /* swapouts */ }; #ifdef KERNEL struct vmmeter cnt, rate, sum; #endif /* systemwide totals computed every five seconds */ struct vmtotal { unsigned t_rq; /* length of the run queue */ unsigned t_dw; /* jobs in ``disk wait'' (neg priority) */ unsigned t_pw; /* jobs in page wait */ unsigned t_sl; /* jobs sleeping in core */ unsigned t_sw; /* swapped out runnable/short block jobs */ unsigned t_vm; /* total virtual memory */ unsigned t_avm; /* active virtual memory */ unsigned t_rm; /* total real memory in use */ unsigned t_arm; /* active real memory */ unsigned t_vmtxt; /* virtual memory used by text */ unsigned t_avmtxt; /* active virtual memory used by text */ unsigned t_rmtxt; /* real memory used by text */ unsigned t_armtxt; /* active real memory used by text */ unsigned t_free; /* free memory pages */ }; #ifdef KERNEL struct vmtotal total; #endif /* * Optional instrumentation. */ #define NDMON 128 #define NSMON 128 #define DRES 20 #define SRES 5 #define PMONMIN 20 #define PRES 50 #define NPMON 64 #define RMONMIN 130 #define RRES 5 #define NRMON 64 /* data and stack size distribution counters */ unsigned int dmon[NDMON+1]; unsigned int smon[NSMON+1]; /* page in time distribution counters */ unsigned int pmon[NPMON+2]; /* reclaim time distribution counters */ unsigned int rmon[NRMON+2]; int pmonmin; int pres; int rmonmin; int rres; unsigned rectime; /* accumulator for reclaim times */ unsigned pgintime; /* accumulator for page in times */ 5 #define PMONMIN 20 #define PRES 50 #define NPMON 64 #define RMONMIN 130 #d./sys/vmparam.h 664 0 0 5674 4564204573 6623 /* * Machine dependent constants */ #define NPTEPG (NBPG/(sizeof (struct pte))) /* number of ptes per page */ #define USRSTACK (0x80000000-UPAGES*NBPG) /* Start of user stack */ #define P1TOP 0x200000 /* boundary between P0 and P1 regions */ #define KSTART 0x80000000 /* beginning of system space */ /* * Virtual memory related (configured) constants */ #ifdef KERNEL extern int maxtsize, maxdsize, maxssize; /* max seg sizes, in clicks */ #endif /* * space allocated to user page table */ #define USRPTSIZE (32*NPTEPG) /* * The size of the clock loop. */ #define LOOPPAGES (maxfree - firstfree) /* * The time for a process to be blocked before being very swappable. * This is a number of seconds which the system takes as being a non-trivial * amount of real time. You probably shouldn't change this; * it is used in subtle ways (fractions and multiples of it are, that is, like * half of a ``long time'', almost a long time, etc.) * It is related to human patience and other factors which don't really * change over time. */ #define MAXSLP 20 /* * A swapped in process is given a small amount of core without being bothered * by the page replacement algorithm. Basically this says that if you are * swapped in you deserve some resources. We protect the last SAFERSS * pages against paging and will just swap you out rather than paging you. * Note that each process has at least UPAGES+CLSIZE pages which are not * paged anyways (this is currently 8+2=10 pages or 5k bytes), so this * number just means a swapped in process is given around 25k bytes. * Just for fun: current memory prices are 4600$ a megabyte on VAX (4/22/81), * so we loan each swapped in process memory worth 100$, or just admit * that we don't consider it worthwhile and swap it out to disk which costs * $30/mb or about $0.75. */ #define SAFERSS 32 /* nominal ``small'' resident set size protected against replacement */ /* * DISKRPM is used to estimate the number of paging i/o operations * which one can expect from a single disk controller. */ #define DISKRPM 60 /* * minimum swap allocation piece * perhaps configurable later; for now, fixed */ #define DMMIN 32 /* * Klustering constants. Klustering is the gathering * of pages together for pagein/pageout, while clustering * is the treatment of hardware page size as though it were * larger than it really is. * * KLMAX gives maximum cluster size in CLSIZE page (cluster-page) * units. KLMAX*CLSIZE must be <= DMMIN. */ #define KLMAX (32/CLSIZE) #define KLSEQL (16/CLSIZE) /* in klust if vadvise(VA_SEQL) */ #define KLIN (8/CLSIZE) /* default data/stack in klust */ #define KLTXT (4/CLSIZE) /* default text in klust */ #define KLOUT (32/CLSIZE) /* * KLSDIST is the advance or retard of the fifo reclaim for sequential * processes data space. */ #define KLSDIST 3 /* klusters advance/retard for seq. fifo */ #ifdef KERNEL int klseql; int klsdist; int klin; int kltxt; int klout; #endif KLMAX*CLSIZE must be <= DMMIN. */ #define KLMAX (32/CLSIZE) #def./sys/xkb.h 664 0 0 2244 4564204573 5732 /* * for datakit simple kmc driver */ /* * per channel */ struct kb { struct queue *dkrq; char flag; unsigned char chan; struct kb *link; }; /* * buffer descriptor */ struct kbdesc { short loaddr; /* low buffer address */ short len; /* negative buffer length */ unsigned char chan; /* channel */ char flag; /* flags and high address */ }; /* * per interface */ #define XRING 40 #define RRING 20 struct kbkmc { char flags; char kno; /* which kmc is ours */ char ubno; /* which unibus has the kmc */ struct device *addr; /* kmc registers */ struct dkmodule *modp; struct { /* bundle for convenient unibus mapping */ struct kbdesc _xring[XRING+1]; struct kbdesc _rring[RRING+1]; } rings; #define xring rings._xring #define rring rings._rring ubm_t ringmap; uaddr_t xrua, rrua; /* unibus address of descriptor rings */ struct block *xblock[XRING]; /* blocks in transmit descriptors */ ubm_t xmap[XRING]; /* and their map cookies */ struct block *rblock[RRING]; /* likewise receive */ ubm_t rmap[RRING]; char xrp, xwp; /* read, write positions in xring */ char rrp, rwp; /* and in rring */ int rbytes; /* bytes of receive buffer outstanding */ }; struct kbdesc _rring[RRING+1]; } rings; #define xring rings._xring #define rring rings._rring ubm_t ringmap; uaddr_t xrua, rrua; /* unibus address of descriptor rings */ struct block *xblock[XRING]; /* blocks in transmit descriptors */ ubm_t xmap[XRING]; /* and their map cookies */ struct block *rblock[RRING]; /* likewise receive */ ubm_./sys/vmsystm.h 664 0 0 2267 4564204573 6675 /* * Miscellaneous virtual memory subsystem variables and structures. */ #ifdef KERNEL int freemem; /* remaining blocks of free memory */ int avefree; /* moving average of remaining free blocks */ int avefree30; /* 30 sec (avefree is 5 sec) moving average */ int deficit; /* estimate of needs of new swapped in procs */ int nscan; /* number of scans in last second */ int desscan; /* desired pages scanned per second */ int kmapwnt; /* kernel map wanted flag */ /* writable copies of tunables */ int maxpgio; /* max paging i/o per sec before start swaps */ int maxslp; /* max sleep time before very swappable */ int lotsfree; /* max free before clock freezes */ int minfree; /* minimum free pages before swapping begins */ int desfree; /* no of pages to try to keep free via daemon */ int saferss; /* no pages not to steal; decays with slptime */ #endif /* * Swap kind accounting. */ struct swptstat { int pteasy; /* easy pt swaps */ int ptexpand; /* pt expansion swaps */ int ptshrink; /* pt shrinking swaps */ int ptpack; /* pt swaps involving spte copying */ }; #ifdef KERNEL struct swptstat swptstat; #endif #ifdef KERNEL swblk_t vtod(); int vmemall(); int memall(); #endif minimum free pages before swapping begins */ int desfree; /* no of pages to try to keep free via daemon */ int saferss; /* no pages not to steal; decays with slptime */ #endif /* * Swap kind accounting. */ struct swptstat { int pteasy; /* easy pt swaps */ int ptexpand; /* pt expansion swaps */ int ptshrink; /* pt shrin./sys/vtimes.h 664 0 0 1472 4564204573 6457 /* * Structure returned by vtimes() and in vwait(). * In vtimes() two of these are returned, one for the process itself * and one for all its children. In vwait() these are combined * by adding componentwise (except for maxrss, which is max'ed). */ struct vtimes { int vm_utime; /* user time (60'ths) */ int vm_stime; /* system time (60'ths) */ /* divide next two by utime+stime to get averages */ unsigned vm_idsrss; /* integral of d+s rss */ unsigned vm_ixrss; /* integral of text rss */ int vm_maxrss; /* maximum rss */ int vm_majflt; /* major page faults */ int vm_minflt; /* minor page faults */ int vm_nswap; /* number of swaps */ int vm_inblk; /* block reads */ int vm_oublk; /* block writes */ }; #ifdef KERNEL struct vtimes zvms; /* an empty (componentwise 0) structure */ #endif KERNEL nt vm_stime; /* system time (60'ths) */ /* divide next two by utime+stime to get averages */ unsigned vm_idsrss; /* integral of d+s rss */ unsigned vm_ixrss; /* integral of text rss */ int vm./sys/cmc.h 664 0 0 1412 4564204574 5705 /* * datakit common-control interface definitions */ /* * protocol codes generated by driver */ #define T_CHG 3 /* status change to/from cmc */ #define D_CLOSE 1 /* close a channel */ #define D_ISCLOSED 2 /* channel is closed */ #define D_CLOSEALL 3 /* close all channels */ #define T_LSTNR 4 /* keep-alive message */ #define T_REPLY 2 /* reply to channel setup */ #define D_OK 1 /* setup OK */ #define D_OPEN 2 /* channel now open */ #define D_FAIL 3 /* setup failed */ #define T_RESTART 8 /* cmc crashed, we should init circuit */ struct lmsg { char type ; /* message type T_??? */ char srv ; /* message code D_??? */ short param0 ; /* various aditional info */ short param1 ; short param2 ; short param3 ; short param4 ; } ; 3 /* close all channels */ #define T_LSTNR 4 /* keep-alive message */ #define T_REPLY 2 /* reply to channel setup */ #define D_OK 1 /* setup OK */ #define D_OPEN 2 /* channel now open */ #define D_FAIL 3 /* setup failed */ #d./sys/stream.h 664 0 0 11462 4651431602 6453 #define QPCTL 0100 /* priority control message */ #define QBSIZE 64 /* "standard" size of queue block*/ /* * data queue */ struct queue { struct qinit *qinfo; /* procs and limits for queue */ struct block *first; /* first data block */ struct block *last; /* last data block */ struct queue *next; /* Q of next stream */ struct queue *link; /* to next Q for scheduling */ caddr_t ptr; /* to private data structure */ short count; /* number of blocks on Q */ u_short flag; }; /* Queue flags */ #define QENAB 01 /* Queue is already enabled to run */ #define QWANTR 02 /* Someone wants to read Q */ #define QWANTW 04 /* Someone wants to write Q */ #define QFULL 010 /* Q is considered full */ #define QREADR 020 /* This is the reader (first) Q */ #define QUSE 040 /* This queue in use (allocation) */ #define QNOENB 0100 /* Don't enable Q via putq */ #define QDELIM 0200 /* This queue generates delimiters */ #define QBIGB 0400 /* This queue would like big blocks */ /* * queue information structure */ struct qinit { int (*putp)(); /* put procedure */ int (*srvp)(); /* service procedure */ long (*qopen)(); /* called on startup */ int (*qclose)(); /* called on finish */ short limit; /* high water mark */ short lolimit; /* low water mark */ }; #define OTHERQ(q) ((q)->flag&QREADR? (q)+1: (q)-1) #define WR(q) (q+1) #define RD(q) (q-1) /* * Queue data block */ struct block { struct block *next; /* next in chain */ u_char *rptr; /* first unconsumed data */ u_char *wptr; /* next unwritten data */ u_char *lim; /* max for wptr */ u_char *base; /* min for rptr/wptr */ u_char type; /* type of block contents */ u_char class; /* size class (plus S_DELIM flag) */ u_char bufix; /* buffer index (for io maps) */ u_char rbufix; /* real index for anon block */ u_char data[4]; /* data contents for tiny blocks */ }; #define NOBUFIX 255 #define S_DELIM 0200 /* This block is followed by a delimiter */ #define CL_MASK 0177 /* * Header for a stream: interface to rest of system */ struct stdata { struct queue *wrq; /* write queue */ struct block *iocblk; /* return block for ioctl */ struct inode *inode; /* backptr, for hangups */ struct proc *wsel; /* process write-selecting */ struct proc *rsel; /* process read-selecting */ short pgrp; /* process group, for signals */ short flag; char count; /* # processes in stream routines */ }; #define IOCWAIT 01 /* Someone wants to do ioctl */ #define RSLEEP 02 /* Someone wants to read */ #define WSLEEP 04 /* Someone wants to write */ #define HUNGUP 010 /* Device has vanished */ #define RSEL 020 /* read-select collision*/ #define WSEL 040 /* write-select collision */ #define EXCL 0100 /* exclusive-use (no opens) */ #define STWOPEN 0200 /* waiting for 1st open */ #ifdef KERNEL struct block *getq(); int putq(); int noput(); struct block *allocb(); struct block *cramb(); struct block *dupb(); struct queue *backq(); struct queue *allocq(); struct inode *stopen(); #endif /* * Control messages (regular priority) */ #define M_DATA 0 /* regular data (not ctl) */ #define M_BREAK 01 /* line break */ #define M_HANGUP 02 /* line disconnect */ #define M_DELIM 03 /* data delimiter */ #define M_IOCTL 06 /* ioctl; set/get params */ #define M_DELAY 07 /* real-time xmit delay (1 param) */ #define M_CTL 010 /* device-specific control message */ #define M_PASS 011 /* pass file */ #define M_YDEL 012 /* stream has started generating delims */ #define M_NDEL 013 /* stream has stopped generating delims */ /* * Control messages (high priority; go to head of queue) */ #define M_SIGNAL 0101 /* generate process signal */ #define M_FLUSH 0102 /* flush your queues */ #define M_STOP 0103 /* stop transmission immediately */ #define M_START 0104 /* restart transmission after stop */ #define M_IOCACK 0105 /* acknowledge ioctl */ #define M_IOCNAK 0106 /* negative ioctl acknowledge */ #define M_PRICTL 0107 /* high priority device-specific ctl */ #define M_IOCWAIT 0110 /* stop ioctl timeout, ack/nak follows later */ #define setqsched() mtpr(SIRR, 0x3) /* * ioctl message packet */ #define STIOCSIZE 16 #define STIOCHDR 4 struct stioctl { unsigned char com[STIOCHDR]; /* four-byte command, low order byte first */ char data[STIOCSIZE]; /* depends on command */ }; #define stiocom(bp) (((struct stioctl *)bp->rptr)->com[0]|(((struct stioctl *)bp->rptr)->com[1]<<8)) /* two high bytes ignored for now */ #define stiodata(bp) (((struct stioctl *)bp->rptr)->data) /* * for passing files across streams */ struct kpassfd { union { struct file *fp; int fd; } f; short uid; short gid; short nice; char logname[8]; }; /* * header for messages, see mesg.c */ struct mesg { char type; u_char magic; u_char losize, hisize; }; #define MSGMAGIC 0345 #define MSGHLEN 4 /* true length of struct mesg in bytes */ >rptr)->com[0]|(((struct stioctl *)bp->rptr)->com[1]<<8)) /* two high bytes ignored for now */ #define stiodata(bp) (((struct stioctl *)bp->rptr)->data) /* * for passing files across streams */ struct kp./sys/ttyld.h 664 0 0 2004 4564204574 6301 /* * TTY line discipline processing */ struct ttyld { short t_flags; /* mode, settable by ioctl call */ short t_state; /* internal state, not visible externally */ char t_delct; /* number of delimiters in input q */ char t_col; /* printing column of device */ char t_erase; /* erase character */ char t_kill; /* kill character */ struct tchars t_chr; }; #define CTRL(c) ((c)&037) /* default special characters */ #define CERASE '\010' #define CEOT CTRL('d') #define CKILL '@' #define CQUIT 034 /* FS, cntl shift L */ #define CINTR 0177 /* DEL */ #define CSTOP CTRL('s') #define CSTART CTRL('q') #define CBRK 0377 /* define partab character types */ #define ORDINARY 0 #define CONTROL 1 #define BACKSPACE 2 #define NEWLINE 3 #define TAB 4 #define VTAB 5 #define RETURN 6 /* states */ #define TTSTOP 01 /* stopped by CTL S */ #define TTESC 02 /* have just seen \ */ #define TTCR 04 /* turning LF into CRLF */ #define TTUSE 010 /* this structure in use */ #define TTBLOCK 020 /* have sent tandem STOP */ ntl shift L */ #define CINTR 0177 /* DEL */ #define CSTOP CTRL('s') #define CSTART CTRL('q') #define CBRK 0377 /* define partab character types */ #define ORDINARY 0 #define CONTROL 1 #define BACKSPACE 2 #define NEWLINE 3 #define TAB 4 #define VTAB 5 #define RETURN 6 /* states */ #define TTSTOP 01 /* stopped by CTL S */ #define TTESC 02 /* have just seen \ */ #define TTCR 04 /* turning LF into CRLF */ #define TTUSE 010 /* this structure in use */ #define TTBLOCK 020 /* have sent tandem STOP./sys/dkstat.h 664 0 0 1276 4564204574 6445 /* * datakit status */ struct dkstat { long input; long output; int markflt; /* mark byte expected */ int markparity; /* parity error on mark byte */ int closepack; /* packet on closed channel */ int pack0; /* packet on channel 0 */ int packstrange; /* packet on strange channel */ int shortpack; /* short packet */ int parity; /* parity error */ int chgstrange; /* T_CHG on strange channel */ int notclosed; /* packets on hung-up chans */ int isclosed; /* "isclosed" packet on open chan */ int dkprxmit; /* retransmit rejected dkp msg */ int dkprjtrs; /* reject, trailer size */ int dkprjpks; /* reject, packet size */ int dkprjseq; /* reject, sequence number */ }; losed channel */ int pack0; /* packet on channel 0 */ int packstrange; /* packet on strange channel */ int shortpack; /* short packet */ int parity; /* parity error */ int chgstrange; /* T_CHG on strange channel */ int notclosed; /* packets on hung-up chans */ int isclosed; /* "isclosed" packet on open ch./sys/neta.h 664 0 0 2022 4564204574 6070 #define NETVERSION 1 /* protocol variant */ #define NSEARCH 0 #define NSTAT 1 #define NWRT 2 #define NREAD 3 #define NFREE 4 #define NTRUNC 5 #define NUPDAT 6 #define NGET 7 #define NNAMI 8 #define NPUT 9 #define NROOT 10 #define NDEL 11 #define NLINK 12 #define NCREAT 13 #define NOMATCH 14 #define NSTART 15 #define NIOCTL 16 #define NMKDIR 17 #define NRMDIR 18 struct senda { /* not space efficient */ char version; char cmd; char flags; /* now only for nami */ char rsvd; long trannum; short uid; short gid; short dev; /* server may be using several */ long tag; long mode; short newuid; /* for updat */ short newgid; long ino; long count; long offset; char *buf; time_t ta; time_t tm; }; struct rcva { /* not space efficient either */ long trannum; char errno; char flags; /* NROOT for nami */ short dev; long size; short mode; short uid; short gid; long tag; short nlink; short rsvd; long ino; /* back from nami */ long count; /* count or loc for nami to use */ time_t tm[3]; }; extern long trannum; v; /* server may be using several */ long tag; long mode; short newuid; /* for updat */ short newgid; long ino; long count; long offset; char *buf; time_t ta; time_t tm; }; struct rcva { /* not space efficient either */ long trannum; char errno; char flags; /* NROOT for nami */ short dev; long size; short mode; short uid; short gid; long tag; short nlink; short rsvd; long ino; /* back from nami */ long count; /* count or loc for nami to use */ time_t tm[3]; }; ext./sys/nttyld.h 664 0 0 4023 4564204574 6462 /* * new tty line discipline processing */ struct nttyld { struct queue *nt_outq; /* for echoed characters */ struct queue *nt_readq; /* for processed input characters */ #define NT_NIN 256 char nt_in[NT_NIN]; /* cooked mode input buffer */ short nt_nin; /* current number of characters in nt_in */ short nt_flags; /* ioctl [gs]ettable modes */ short nt_state; /* internal state, not visible externally */ char nt_col; /* printing column of device */ char nt_delct; /* number of delimiters in read queue */ char nt_erase; /* erase character */ char nt_kill; /* kill character */ struct tchars nt_tchr; #define nt_intrc nt_tchr.t_intrc #define nt_quitc nt_tchr.t_quitc #define nt_startc nt_tchr.t_startc #define nt_stopc nt_tchr.t_stopc #define nt_eofc nt_tchr.t_eofc #define nt_brkc nt_tchr.t_brkc /* * local: */ short nt_trash; /* nt_nin after last write() data processed */ short nt_rocol; /* nt_col when nt_nin==0 */ short nt_local; /* local mode bits */ short nt_lstate; /* local state bits */ struct ltchars nt_ltchr; #define nt_suspc nt_ltchr.t_suspc #define nt_dsuspc nt_ltchr.t_dsuspc #define nt_rprntc nt_ltchr.t_rprntc #define nt_flushc nt_ltchr.t_flushc #define nt_werasc nt_ltchr.t_werasc #define nt_lnextc nt_ltchr.t_lnextc #define nt_urotc nt_luchr.t_urotc }; /* * values for nt_state: */ #define NT_STOP 001 /* stopped by stop character */ #define NT_ESC 002 /* have just seen \ or lnext character */ #define NT_CR 004 /* turning LF into CRLF */ #define NT_USE 010 /* nttyld structure in use */ #define NT_CASE 020 /* adding \ for upper-case-only terminals */ #define NT_ECHO 040 /* echoed something for ntin */ /* * default local special characters (struct ltchars) */ #define CSUSP CTRL('z') #define CDSUSP CTRL('y') #define CRPRNT CTRL('r') #define CFLUSH CTRL('o') #define CWERAS CTRL('w') #define CLNEXT CTRL('v') /* * Ioctl message format. */ struct ntioc { int command; union { struct sgttyb sg; struct tchars tchr; struct ltchars ltchr; short local; char chr[16]; } arg; }; efine NT_CASE 020 /* adding \ for upper-case-only terminals */ #define NT_ECHO 040 /* echoed something for ntin */ /* * default local special characters (struct ltchars) */ #define CSUSP CTRL('z') #define CDSUSP CTRL('y') #define CRPRNT CTRL('r') #define CFLUSH CTRL('o') #define CWERAS CTRL('w') #define CLNEXT CTRL('v') /* * Ioctl message format. */ struct ntioc { int command; union { struct sgttyb sg; struct tchars tchr; struct ltchars ltchr; short local; char c./sys/udaioc.h 664 0 0 1623 4564204574 6413 /* * ioctl info for ra driver */ #define UIORRCT (('u'<<8) | 0) /* read a block of the rct */ #define UIOWRCT (('u'<<8) | 1) /* write a block of rct */ #define UIOCHAR (('u'<<8) | 2) /* get drive characteristics (sizes) */ #define UIOREPL (('u'<<8) | 3) /* replace a block */ #define UIOSPDW (('u'<<8) | 4) /* spin down on close */ #define UIORST (('u'<<8) | 5) /* hopeless controller reset */ /* * struct for RRCT and WRCT */ struct ud_rctbuf { caddr_t buf; int lbn; }; /* * struct for REPL */ struct ud_repl { daddr_t replbn; /* good block */ daddr_t lbn; /* bad block */ short prim; /* nonzero if primary replacement */ }; /* * struct for CHAR */ struct ud_unit { daddr_t radsize; /* size, from ONLINE end packet */ daddr_t rctsize; /* rct size, from get unit status */ long medium; /* generic type name */ short tracksz; short groupsz; short cylsz; char rbns; char copies; }; struct for RRCT and WRCT */ struct ud_rctbuf { caddr_t buf; int lbn; }; /* * struct for REPL */ stru./sys/ttyio.h 664 0 0 4373 4564204574 6324 /* * teletype-related ioctls */ struct sgttyb { char sg_ispeed; /* no longer set/returned by kernel */ char sg_ospeed; /* no longer set/returned by kernel */ char sg_erase; /* erase character */ char sg_kill; /* kill character */ short sg_flags; /* mode flags */ }; /* * Structure for setting and getting tty device parammeters. */ struct ttydevb { char ispeed; /* input speed */ char ospeed; /* output speed */ short flags; /* mode flags */ }; /* * List of special characters */ struct tchars { char t_intrc; /* interrupt */ char t_quitc; /* quit */ char t_startc; /* start output */ char t_stopc; /* stop output */ char t_eofc; /* end-of-file */ char t_brkc; /* input delimiter (like nl) */ }; /* * modes in sg_flags */ #define TANDEM 01 #define CBREAK 02 #define LCASE 04 #define ECHO 010 #define CRMOD 020 #define RAW 040 /* 0300: former parity bits */ #define NLDELAY 001400 #define TBDELAY 006000 #define XTABS 06000 #define CRDELAY 030000 #define VTDELAY 040000 #define BSDELAY 0100000 #define ALLDELAY 0177400 /* * Delay algorithms */ #define CR0 0 #define CR1 010000 #define CR2 020000 #define CR3 030000 #define NL0 0 #define NL1 000400 #define NL2 001000 #define NL3 001400 #define TAB0 0 #define TAB1 002000 #define TAB2 004000 #define FF0 0 #define FF1 040000 #define BS0 0 #define BS1 0100000 /* * Speeds */ #define B0 0 #define B50 1 #define B75 2 #define B110 3 #define B134 4 #define B150 5 #define B200 6 #define B300 7 #define B600 8 #define B1200 9 #define B1800 10 #define B2400 11 #define B4800 12 #define B9600 13 #define EXTA 14 #define EXTB 15 /* * device flags */ #define F8BIT 040 /* eight-bit path */ #define ODDP 0100 #define EVENP 0200 #define ANYP 0300 /* * tty ioctl commands */ #define TIOCHPCL (('t'<<8)|2) #define TIOCGETP (('t'<<8)|8) #define TIOCSETP (('t'<<8)|9) #define TIOCSETN (('t'<<8)|10) #define TIOCEXCL (('t'<<8)|13) #define TIOCNXCL (('t'<<8)|14) #define TIOCFLUSH (('t'<<8)|16) #define TIOCSETC (('t'<<8)|17) #define TIOCGETC (('t'<<8)|18) #define TIOCSBRK (('t'<<8)|19) #define TIOCGDEV (('t'<<8)|23) /* get device parameters */ #define TIOCSDEV (('t'<<8)|24) /* set device parameters */ #define TIOCSPGRP (('t'<<8)|118) /* set pgrp of tty */ #define TIOCGPGRP (('t'<<8)|119) /* get pgrp of tty */ 8)|2) #define TIOCGETP (('t'<<8)|8) #define TIOCSETP (('t'<<8)|9) #define TIOCSETN (('t'<<8)|10) #define TIOCEXCL (('t'<<8)|13) #define TIOCNXCL (('t'<<8)|14) #define TIOCFLUSH (('t'<<8)|16) #define TIOCSETC (('t'<<8)|17) #define TIOCGETC (('t'<<8)|18) #define ./sys/dkio.h 664 0 0 1561 4564204574 6076 /* * Datakit ioctls */ #define DIOCLHN (('d'<<8)|32) /* announce mgr channel */ #define DIOCHUP (('d'<<8)|33) /* tell ctlr to reinitialize */ #define DIOCSTREAM (('d'<<8)|34) /* no input delimiters */ #define DIOCRECORD (('d'<<8)|35) /* input delimiters */ #define DIOCCHAN (('d'<<8)|38) /* suggest channel # */ #define DIOCSTOP (('d'<<8)|39) /* delay input for cmcld */ #define DIOCSTART (('d'<<8)|40) /* restart input for cmcld */ #define DIOCNXCL (('d'<<8)|41) /* turn off exclusive use */ #define DIOCXWIN (('d'<<8)|42) /* set xmtr window sizes */ #define DIOCSCTL (('d'<<8)|43) /* send control character */ #define DIOCRCTL (('d'<<8)|44) /* receive stored control character */ #define KIOCISURP (('k'<<8)|1) /* is URP already turned on? */ #define KIOCINIT (('k'<<8)|2) /* force transmitter reinit */ #define KIOCSHUT (('k'<<8)|3) /* shut down all chans, force reinit */ ld */ #define DIOCSTART (('d'<<8)|40) /* restart input for cmcld */ #define DIOCNXCL (('d'<<8)|41) /* turn off exclusive use */ #define DIOCXWI./sys/netb.h 664 0 0 13767 4564204607 6130 /* * network filesystem protocol * * messages are character arrays, * encoding structures of characters, * two-byte shorts, and four-byte longs. * shorts and longs have a specific byte order, * and should be accessed through the macros below. */ /* * general numbers */ #define NETB 2 /* protocol version */ #define NBMAXMSG (5*1024) /* max message size */ #define NBROOTTAG 0 /* i_tag assumed for the root */ /* * turn network numbers into host numbers * unsigned char *p */ #define frnetlong(p, off) (p[off+0]+(p[off+1]<<8)+((long)p[off+2]<<16)+((long)p[off+3]<<24)) #define frnetshort(p, off) (p[off+0]+(p[off+1]<<8)) #define frnetchar(p, off) p[off] /* * turn host numbers to network numbers */ #define tonetlong(p, off, l) (p[off+0]=(l), p[off+1]=(l)>>8, p[off+2]=(l)>>16, p[off+3]=(l)>>24) #define tonetshort(p, off, s) (p[off+0]=(s), p[off+1]=(s)>>8) #define tonetchar(p, off, c) (p[off]=c) /* * messages from client to server */ /* * general header */ #define SNB_VERSION 0 /* (char) version */ #define SNB_CMD 1 /* (char) command; see below */ #define SNB_FLAGS 2 /* (char) mostly for nami */ /* one byte of padding */ #define SNB_TRANNUM 4 /* (long) unique transaction ID */ #define SNB_LEN 8 /* (long) including header and any data */ #define SNB_TAG 12 /* (long) which file this is about */ #define SNB_UID 16 /* (short) who wants to do IO */ #define SNB_GID 18 /* (short) ditto */ /* four more bytes of junk */ #define SNBSIZE 24 /* * commands */ #define NBPUT 1 /* put file */ /* 2 was NAGET */ #define NBUPD 3 /* update attributes */ #define NBREAD 4 /* read data */ #define NBWRT 5 /* write data */ #define NBNAMI 6 /* translate name (with many side effects) */ #define NBSTAT 7 /* read file status */ #define NBIOCTL 8 /* ioctl */ #define NBTRNC 9 /* truncate */ #define NBDIR 10 /* directory read */ /* * flags, for namei sub-function code, * are defined in inode.h * should they be here too? */ /* * additional data for each command */ /* * update */ #define SUP_MODE (SNBSIZE+0) /* (short) new mode */ /* two bytes for raw device (mknod) */ /* four bytes of junk */ #define SUP_ATIME (SNBSIZE+8) /* (long) access time */ #define SUP_MTIME (SNBSIZE+12) /* (long) mod time */ #define SUPSIZE (SNBSIZE+16) /* * read, dirread */ #define SRD_LEN (SNBSIZE+0) /* (long) how much to read */ #define SRD_OFFSET (SNBSIZE+4) /* (long) file offset */ #define SRDSIZE (SNBSIZE+8) /* * write */ #define SWR_LEN (SNBSIZE+0) /* (long) how much to write */ #define SWR_OFFSET (SNBSIZE+4) /* (long) where to write it */ #define SWRSIZE (SNBSIZE+8) /* data to be written follows immediately */ /* * namei */ #define SNM_MODE (SNBSIZE+0) /* (short) mode for creat */ #define SNM_DEV (SNBSIZE+2) /* (short) device (mknod); used? */ #define SNM_INO (SNBSIZE+4) /* (long) i-number, for link */ #define SNMSIZE (SNBSIZE+8) /* name to be translated follows immediately */ /* * SNB_FLAGS: namei function codes * these must match the numbers in inode.h; * they are repeated here so the protocol * is all defined in one place */ #define NI_SEARCH 0 /* search only (0 value known to nilargnamei, beware) */ #define NI_DEL 1 /* unlink this file */ #define NI_CREAT 2 /* create it if it doesn't exits */ #define NI_NXCREAT 3 /* create it, error if it already exists */ #define NI_LINK 4 /* make a link */ #define NI_MKDIR 5 /* make a directory */ #define NI_RMDIR 6 /* remove a directory */ /* * stat */ #define SST_TIME (SNBSIZE+0) /* (long) time, for synchronization */ /* four bytes of padding */ #define SSTSIZE (SNBSIZE+8) /* * ioctl */ #define SIO_CMD (SNBSIZE+0) /* (long) function code */ #define SIO_FLAG (SNBSIZE+4) /* (short) file flags; silly? */ /* two bytes padding */ #define SIOSIZE (SNBSIZE+8) #define SIODATA 64 /* bytes of data follow */ /* does some ioctl data follow? */ /* * responses from server to client */ /* * general header */ #define RNB_TRANNUM 0 /* (long) transaction ID */ #define RNB_ERRNO 4 /* (short) error number; zero if OK */ #define RNB_FLAGS 6 /* (char) see below */ /* one byte of pad */ #define RNB_LEN 8 /* (long) including header and any data */ #define RNB_FSIZE 12 /* (long) file size after write (why here?) */ #define RNBSIZE 16 /* * flags */ #define NBROOT 1 /* namei popped out of root */ #define NBEND 2 /* last read was short, probably end of file */ /* * extra data for each type of response */ /* * read: no extra header info; * data follows at offset RNBSIZE */ /* * namei * contains an entire stat response * so sys stat sends one namei message and no stat message * not exactly a stat message, though: RNM_USED is in the middle */ #define RNM_TAG (RNBSIZE+0) /* (long) new file */ #define RNM_INO (RNBSIZE+4) /* (long) its i-number */ #define RNM_DEV (RNBSIZE+8) /* (short) st_dev */ #define RNM_MODE (RNBSIZE+10) /* (short) mode */ #define RNM_USED (RNBSIZE+12) /* (long) filename chars consumed (NBROOT only) */ #define RNM_NLINK (RNBSIZE+16) /* (short) */ #define RNM_UID (RNBSIZE+18) /* (short) */ #define RNM_GID (RNBSIZE+20) /* (short) */ #define RNM_RDEV (RNBSIZE+22) /* (short) st_rdev; useful? */ #define RNM_SIZE (RNBSIZE+24) /* (long) */ #define RNM_ATIME (RNBSIZE+28) /* (long) */ #define RNM_MTIME (RNBSIZE+32) /* (long) */ #define RNM_CTIME (RNBSIZE+36) /* (long) */ #define RNMSIZE (RNBSIZE+40) /* * stat */ #define RST_INO (RNBSIZE+0) /* (long) i-number */ #define RST_DEV (RNBSIZE+4) /* (short) st_dev */ #define RST_MODE (RNBSIZE+6) /* (short) */ #define RST_NLINK (RNBSIZE+8) /* (short) */ #define RST_UID (RNBSIZE+10) /* (short) */ #define RST_GID (RNBSIZE+12) /* (short) */ #define RST_RDEV (RNBSIZE+14) /* (short) st_rdev; used? */ #define RST_SIZE (RNBSIZE+16) /* (long) */ #define RST_ATIME (RNBSIZE+20) /* (long) */ #define RST_MTIME (RNBSIZE+24) /* (long) */ #define RST_CTIME (RNBSIZE+28) /* (long) */ #define RSTSIZE (RNBSIZE+32) /* * ioctl: * no header, just SIOSIZE bytes of ioctl data */ /* * dirread */ #define RDI_USED (RNBSIZE+0) /* (long) advance file pointer this much */ /* four bytes of junk */ #define RDISIZE (RNBSIZE+8) RST_GID ./sys/dkmod.h 664 0 0 1742 4564204611 6237 /* * one dkmodule per hardware interface to datakit * a given hardware device == (major device, range of minor devices) * channel 0 == (dev, lo) * there are hi-lo channels */ struct dkmodule { char *dkstate; /* open/closed status of channels */ struct queue *listnrq; /* channel to controller */ short dev; /* major device of datakit interface */ short lo, hi; /* range of devs on this controller */ short type; /* type of listener */ }; #ifdef KERNEL struct dkmodule *dkmodall(), *getdkmod(); #endif /* * channel states */ #define DKCLOSED 0 #define DKRCLOSE 1 /* remote hung up, local still around */ #define DKLCLOSE 2 /* closed locally, CMC hasn't acked yet */ #define DKOPEN 3 /* in use */ /* * listener types */ #define CMCLD 'c' #define UNIXPLD 'u' /* * M_PRICTL messages contain * one byte of subtype * perhaps another byte of channel number */ #define DKMCLOSE 0 /* this channel is closing */ #define DKMXINIT 01 /* re-init URP because of splice */ odule *dkmodall(), *getdkmod()./sys/inet/ 777 0 0 0 5242462473 5646 ./sys/inet/in.h 664 0 0 2154 4564204611 6504 #ifndef INADDR_ANY /* * Bits in internet addresses. */ #define IN_CLASSA(i) ((((long)(i))&0x80000000)==0) #define IN_CLASSA_NET 0xff000000 #define IN_CLASSA_NSHIFT 24 #define IN_CLASSA_HOST 0x00ffffff #define IN_CLASSB(i) ((((long)(i))&0xc0000000)==0x80000000) #define IN_CLASSB_NET 0xffff0000 #define IN_CLASSB_NSHIFT 16 #define IN_CLASSB_HOST 0x0000ffff #define IN_CLASSC(i) ((((long)(i))&0xc0000000)==0xc0000000) #define IN_CLASSC_NET 0xffffff00 #define IN_CLASSC_NSHIFT 8 #define IN_CLASSC_HOST 0x000000ff #define INADDR_ANY 0x0 #ifdef KERNEL extern u_long in_class_nmask[]; extern u_long in_class_hmask[]; #define IN_CLASS_NMASK(i) in_class_nmask[((u_long)i)>>30] #define IN_CLASS_HMASK(i) in_class_hmask[((u_long)i)>>30] extern struct block *bp_pullup(); extern unsigned short u_cksum(), ntohs(), htons(); extern unsigned long htonl(), ntohl(); #endif KERNEL #ifndef KERNEL struct in_service { char *name; /* service name */ char *proto; /* protocol name */ unsigned long port; /* port number */ }; extern struct in_service *in_service(); #endif KERNEL typedef unsigned long in_addr; #endif INADDR_ANY ask[]; #define IN_CLASS_NMASK(i) in_class_nmask[((u_long)i)>>30] #define IN_CLASS_HMASK(i) in_class_hmask[((u_long)i)>>30] extern struct block *bp_pullup(); extern unsigned short u_cksum(), ntohs(), htons(); extern unsigned long htonl(), ntohl(); #endif KERNEL #ifndef KERNEL struct in_service { char *name; /* service name */ char *proto; /* protocol name */ unsigned long port; /* port number */ ./sys/inet/ip.h 664 0 0 5066 4574616552 6527 /* ip.h 6.1 83/07/29 */ /* * Definitions for internet protocol version 4. * Per RFC 791, September 1981. */ #define IPVERSION 4 /* * Structure of an internet header, naked of options. * * We declare ip_len and ip_off to be short, rather than u_short * pragmatically since otherwise unsigned comparisons can result * against negative integers quite easily, and fail in subtle ways. */ struct ip { #ifdef vax u_int ip_hl:4, /* header length */ ip_v:4; /* version */ #endif u_char ip_tos; /* type of service */ short ip_len; /* total length */ u_short ip_id; /* identification */ short ip_off; /* fragment offset field */ #define IP_DF 0x4000 /* dont fragment flag */ #define IP_MF 0x2000 /* more fragments flag */ u_char ip_ttl; /* time to live */ u_char ip_p; /* protocol */ u_short ip_sum; /* checksum */ u_long ip_src,ip_dst; /* source and dest address */ }; /* * Definitions for options. */ #define IPOPT_COPIED(o) ((o)&0x80) #define IPOPT_CLASS(o) ((o)&0x40) #define IPOPT_NUMBER(o) ((o)&0x3f) #define IPOPT_CONTROL 0x00 #define IPOPT_RESERVED1 0x10 #define IPOPT_DEBMEAS 0x20 #define IPOPT_RESERVED2 0x30 #define IPOPT_EOL 0 /* end of option list */ #define IPOPT_NOP 1 /* no operation */ #define IPOPT_RR 7 /* record packet route */ #define IPOPT_TS 68 /* timestamp */ #define IPOPT_SECURITY 130 /* provide s,c,h,tcc */ #define IPOPT_LSRR 131 /* loose source route */ #define IPOPT_SATID 136 /* satnet id */ #define IPOPT_SSRR 137 /* strict source route */ /* * Time stamp option structure. */ struct ip_timestamp { u_char ipt_code; /* IPOPT_TS */ u_char ipt_len; /* size of structure (variable) */ u_char ipt_ptr; /* index of current entry */ u_int ipt_flg:4, /* flags, see below */ ipt_oflw:4; /* overflow counter */ union { u_long ipt_time[1]; struct ipt_ta { u_long ipt_addr; u_long ipt_time; } ipt_ta[1]; }; }; /* flag bits for ipt_flg */ #define IPOPT_TS_TSONLY 0 /* timestamps only */ #define IPOPT_TS_TSANDADDR 1 /* timestamps and addresses */ #define IPOPT_TS_PRESPEC 2 /* specified modules only */ /* bits for security (not byte swapped) */ #define IPOPT_SECUR_UNCLASS 0x0000 #define IPOPT_SECUR_CONFID 0xf135 #define IPOPT_SECUR_EFTO 0x789a #define IPOPT_SECUR_MMMM 0xbc4d #define IPOPT_SECUR_RESTR 0xaf13 #define IPOPT_SECUR_SECRET 0xd788 #define IPOPT_SECUR_TOPSECRET 0x6bc5 /* * Internet implementation parameters. */ #define MAXTTL 255 /* maximum time to live (seconds) */ #define IPFRAGTTL 15 /* time to live for frag chains */ #define IPTTLDEC 5 /* subtracted when forwarding */ modules only */ /* bits for security (not byte swapped) */ #define IPOPT_SECUR_UNCLASS 0x0000 #define IPOPT_SECUR_CONFID 0xf135 #define IPOPT_SECUR_EFTO 0x789a #define IPOPT_SECUR_MMMM 0xbc4d #define IPOPT_SECUR_RESTR 0xaf13 #define IPOPT_SECUR_SECRET 0xd788 #define IPOPT_SECUR_TOPSECRET 0x6bc5 /* * Internet implementation parameters. */ #define MAXTTL 255 /* maximum time to live (seconds) */ #define IPFRAGTTL 15 /* time to live for frag chains */./sys/inet/ip_var.h 664 0 0 7714 5156761162 7374 /* ip_var.h 6.1 83/07/29 */ /* * Overlay for ip header used by other protocols (tcp, udp). */ struct ipovly { struct tcpiphdr *ih_next; /* for protocol sequence q's */ struct block *ih_bp; /* bookkeeping for above queue seq */ u_char ih_x1; /* (unused) */ u_char ih_pr; /* protocol */ short ih_len; /* protocol length */ in_addr ih_src; /* source internet address */ in_addr ih_dst; /* destination internet address */ }; /* * Ipq points to the ip reassembly queue. * * Ip reassembly queue structure. Each fragment being reassembled * has one of these structures as the data in the header block structure. * * They are timed out after ipq_ttl drops to 0, and may also * be reclaimed if memory becomes tight. */ struct ipq { struct block *next,*prev; /* to other reass headers */ u_char ipq_ttl; /* time for reass q to live */ u_char ipq_p; /* protocol of this fragment */ u_short ipq_id; /* sequence id for reassembly */ in_addr ipq_src,ipq_dst; }; /* * Ip header, when holding a fragment. * * Note: ipf_next must be at same offset as ipq_next above */ struct ipasfrag { #ifdef vax u_int ip_hl:4, ip_v:4; #endif u_char ip_tos; short ip_len; u_short ip_id; short ip_off; u_char ip_ttl; u_char ip_p; u_short ip_sum; struct block *ipf_next; /* next fragment */ struct block *ipf_prev; /* previous fragment */ }; struct ipstat { int ips_badsum; /* checksum bad */ int ips_tooshort; /* packet too short */ int ips_toosmall; /* not enough data */ int ips_badhlen; /* ip header length < data size */ int ips_badlen; /* ip length < ip header length */ int ips_qfull; int ips_route; /* routing output errors */ int ips_fragout; /* fragmented packets */ }; /* flags passed to ip_output as last parameter */ #define IP_FORWARDING 0x1 /* most of ip header exists */ #define IP_ROUTETOIF 0x10 /* same as SO_DONTROUTE */ #ifdef KERNEL struct ipstat ipstat; u_short ip_id; /* ip packet ctr, for ids */ #endif /* * interface stuff */ struct ipif{ struct queue *queue; int flags; int mtu; in_addr thishost; in_addr that; in_addr mask; in_addr bcast[6]; /* possible broadcast addresses */ int ipackets, ierrors; int opackets, oerrors; int arp; int dev; }; #define IFF_UP 0x1 #define IFF_HOST 0x2 #define IFF_ARP 0x4 #ifdef KERNEL extern struct ipif ipif[]; extern struct ipif *ip_ifwithaddr(), *ip_ifonnetof(); #endif #define IPIOHOST (('i'<<8)|1) #define IPIONET (('i'<<8)|2) #define IPIOLOCAL (('i'<<8)|3) #define IPIOARP (('i'<<8)|4) #define IPIORESOLVE (('i'<<8)|5) #define IPIOMTU (('i'<<8)|6) #define IPIOROUTE (('i'<<8)|7) #define IPIOGETIFS (('i'<<8)|8) #define IPIOMASK (('i'<<8)|9) #define IP_BODY_LIMIT 8192 #define IP_MSG_LIMIT (sizeof(struct ipovly) + IP_BODY_LIMIT) /* an ip routing record */ struct ip_route{ long time; /* time of last access */ in_addr dst; /* destination */ in_addr gate; /* gate to use for this destination */ }; #ifdef KERNEL /* structure returned by "ip_route" */ struct ip_route_info { in_addr addr; struct ipif *ifp; }; struct ip_route_info ip_route(); #endif KERNEL /* an ip to ethernet address mapping */ struct ip_arp{ long time; /* time of last access */ in_addr inaddr; /* inet address */ unsigned char enaddr[6]; /* ethernet address */ }; #define BLEN(bp) ((bp)->wptr - (bp)->rptr) #define BSZ(bp) ((bp)->lim - (bp)->base) #define MAXBLEN 64 /* #define MGET(m, x, y) ((m) = bp_get(x, y)) */ #ifdef KERNEL extern struct block *bp_copy(); extern struct block *bp_get(); #endif #ifdef IN_PARANOID extern struct block cblock[]; extern int blkcnt; #define BLOCKCHK(bp)\ if(bp < cblock || cblock >= &cblock[blkcnt])\ panic("bp_check bad bp");\ if(bp->base == 0 || bp->lim == 0)\ panic("bp_check 0");\ if(bp->rptr > bp->lim || bp->rptr < bp->base)\ panic("bp_check rptr");\ if(bp->wptr > bp->lim || bp->wptr < bp->base)\ panic("bp_check wptr");\ if(bp->rptr > bp->wptr)\ panic("bp_check rptr > wptr") #define MCHECK(bp) bp_check(bp) #else #define BLOCKCHK(bp) #define MCHECK(bp) #endif IN_PARANOID extern struct block cblock[]; extern int./sys/inet/tcp.h 664 0 0 1555 4574616553 6705 /* tcp.h 6.1 83/07/29 */ typedef unsigned short tcp_port; #define TCPPORT_ANY 0x8000 /* wild card for port number */ typedef unsigned long tcp_seq; #define TCP_DEFMAXSEG 512 /* default max segment size */ #ifdef KERNEL /* * TCP header. * Per RFC 793, September, 1981. */ struct tcphdr { tcp_port th_sport; /* source port */ tcp_port th_dport; /* destination port */ tcp_seq th_seq; /* sequence number */ tcp_seq th_ack; /* acknowledgement number */ #ifdef vax u_int th_x2:4, /* (unused) */ th_off:4; /* data offset */ #endif vax u_char th_flags; #define TH_FIN 0x01 #define TH_SYN 0x02 #define TH_RST 0x04 #define TH_PUSH 0x08 #define TH_ACK 0x10 #define TH_URG 0x20 u_short th_win; /* window */ u_short th_sum; /* checksum */ u_short th_urp; /* urgent pointer */ }; #define TCPOPT_EOL 0 #define TCPOPT_NOP 1 #define TCPOPT_MAXSEG 2 #endif KERNEL port */ tcp_seq th_seq; /* sequence number */ tcp_seq th_ack; /* acknowledgement number */ #ifdef vax u_int th_x2:4, /* (unused) */ th_o./sys/inet/tcp_fsm.h 664 0 0 3320 4564204611 7525 /* tcp_fsm.h 6.1 83/07/29 */ /* * TCP FSM state definitions. * Per RFC793, September, 1981. */ #define TCP_NSTATES 11 #define TCPS_CLOSED 0 /* closed */ #define TCPS_LISTEN 1 /* listening for connection */ #define TCPS_SYN_SENT 2 /* active, have sent syn */ #define TCPS_SYN_RECEIVED 3 /* have send and received syn */ /* states < TCPS_ESTABLISHED are those where connections not established */ #define TCPS_ESTABLISHED 4 /* established */ #define TCPS_CLOSE_WAIT 5 /* rcvd fin, waiting for close */ /* states > TCPS_CLOSE_WAIT are those where user has closed */ #define TCPS_FIN_WAIT_1 6 /* have closed, sent fin */ #define TCPS_CLOSING 7 /* closed xchd FIN; await FIN ACK */ #define TCPS_LAST_ACK 8 /* had fin and close; await FIN ACK */ /* states > TCPS_CLOSE_WAIT && < TCPS_FIN_WAIT_2 await ACK of FIN */ #define TCPS_FIN_WAIT_2 9 /* have closed, fin is acked */ #define TCPS_TIME_WAIT 10 /* in 2*msl quiet wait after close */ #define TCPS_HAVERCVDSYN(s) ((s) >= TCPS_SYN_RECEIVED) #define TCPS_HAVERCVDFIN(s) ((s) >= TCPS_TIME_WAIT) #ifdef TCPOUTFLAGS /* * Flags used when sending segments in tcp_output. * Basic flags (TH_RST,TH_ACK,TH_SYN,TH_FIN) are totally * determined by state, with the proviso that TH_FIN is sent only * if all data queued for output is included in the segment. */ u_char tcp_outflags[TCP_NSTATES] = { TH_RST|TH_ACK, 0, TH_SYN, TH_SYN|TH_ACK, TH_ACK, TH_ACK, TH_FIN|TH_ACK, TH_FIN|TH_ACK, TH_FIN|TH_ACK, TH_ACK, TH_ACK, }; #endif #ifdef KPROF int tcp_acounts[TCP_NSTATES][PRU_NREQ]; #endif #ifdef TCPSTATES char *tcpstates[] = { "CLOSED", "LISTEN", "SYN_SENT", "SYN_RCVD", "ESTABLISHED", "CLOSE_WAIT", "FIN_WAIT_1", "CLOSING", "LAST_ACK", "FIN_WAIT_2", "TIME_WAIT", }; #endif H_FIN is sent only * if all data queued for output is included in the segment. */ u_char tcp_outflags[TCP_NSTATES] = { TH_RST|TH_ACK, 0, TH_SYN, TH_SYN|TH_ACK, TH_ACK, TH_ACK, TH_FIN|TH_ACK, TH_FIN|TH_ACK, TH_FIN|TH_ACK, TH_ACK, TH_ACK, }; #endif #ifdef KPROF int tcp_acounts[TCP_NSTATES][./sys/inet/tcp_seq.h 664 0 0 1413 4564204611 7531 /* tcp_seq.h 6.1 83/07/29 */ /* * TCP sequence numbers are 32 bit integers operated * on with modular arithmetic. These macros can be * used to compare such integers. */ #define SEQ_LT(a,b) ((int)((a)-(b)) < 0) #define SEQ_LEQ(a,b) ((int)((a)-(b)) <= 0) #define SEQ_GT(a,b) ((int)((a)-(b)) > 0) #define SEQ_GEQ(a,b) ((int)((a)-(b)) >= 0) /* * Macros to initialize tcp sequence numbers for * send and receive from initial send and receive * sequence numbers. */ #define tcp_rcvseqinit(tp) \ (tp)->rcv_nxt = (tp)->irs + 1 #define tcp_sendseqinit(tp) \ (tp)->snd_una = (tp)->snd_nxt = (tp)->snd_max = (tp)->snd_up = \ (tp)->iss #define TCP_ISSINCR 128 /* increment for tcp_iss each second */ #ifdef KERNEL tcp_seq tcp_iss; /* tcp initial send seq # */ #endif SEQ_GT(a,b) ((int)((a)-(b)) > 0) #define SEQ_GEQ(a,b) ((int)((a)-(b)) >= 0) /* * Macros to initialize tcp sequence numbers for * send and receive from initial send and receive * sequence numbers. */ #define tcp_rcvseqinit(tp) \ (tp)->rcv_./sys/inet/tcp_timer.h 664 0 0 7522 4564204612 10071 /* tcp_timer.h 6.1 83/07/29 */ /* * Definitions of the TCP timers. These timers are counted * down PR_SLOWHZ times a second. */ #define TCPT_NTIMERS 4 #define TCPT_REXMT 0 /* retransmit */ #define TCPT_PERSIST 1 /* retransmit persistance */ #define TCPT_KEEP 2 /* keep alive */ #define TCPT_2MSL 3 /* 2*msl quiet time timer */ /* * The TCPT_REXMT timer is used to force retransmissions. * The TCP has the TCPT_REXMT timer set whenever segments * have been sent for which ACKs are expected but not yet * received. If an ACK is received which advances tp->snd_una, * then the retransmit timer is cleared (if there are no more * outstanding segments) or reset to the base value (if there * are more ACKs expected). Whenever the retransmit timer goes off, * we retransmit all unacknowledged segments, and do an exponential * backoff on the retransmit timer. * * The TCPT_PERSIST timer is used to keep window size information * flowing even if the window goes shut. If all previous transmissions * have been acknowledged (so that there are no retransmissions in progress), * and the window is shut, then we start the TCPT_PERSIST timer, and at * intervals send a single byte into the peers window to force him to update * our window information. We do this at most as often as TCPT_PERSMIN * time intervals, but no more frequently than the current estimate of * round-trip packet time. The TCPT_PERSIST timer is cleared whenever * we receive a window update from the peer. * * The TCPT_KEEP timer is used to keep connections alive. If an * connection is idle (no segments received) for TCPTV_KEEP amount of time, * but not yet established, then we drop the connection. If the connection * is established, then we force the peer to send us a segment by sending: * * This segment is (deliberately) outside the window, and should elicit * an ack segment in response from the peer. If, despite the TCPT_KEEP * initiated segments we cannot elicit a response from a peer in TCPT_MAXIDLE * amount of time, then we drop the connection. */ #define TCP_TTL 15 /* time to live for TCP segs */ /* * Time constants. */ #define PR_SLOWHZ 1 /* ticks/second */ #define TCPTV_MSL ( 30*PR_SLOWHZ) /* max seg lifetime */ #define TCPTV_SRTTBASE ( 1*PR_SLOWHZ) /* base roundtrip time */ #define TCPTV_KEEP ( 45*PR_SLOWHZ) /* keep alive - 45 secs */ #define TCPTV_PERSMIN ( 5*PR_SLOWHZ) /* retransmit persistance */ #define TCPTV_MAXIDLE ( 8*TCPTV_KEEP) /* maximum allowable idle time before drop conn */ /* * add 1 to min val, to avoid spurious timeouts * due to quantization errors (timer set to 1 just before it ticks) */ #define TCPTV_MIN ( 1*PR_SLOWHZ + 1) /* minimum allowable value */ #define TCPTV_MAX ( 120*PR_SLOWHZ) /* maximum allowable value */ #define TCP_LINGERTIME 120 /* linger at most 2 minutes */ #define TCP_MAXRXTSHIFT 12 /* maximum retransmits */ #ifdef TCPTIMERS char *tcptimers[] = { "REXMT", "PERSIST", "KEEP", "2MSL" }; #endif /* * Retransmission smoothing constants. * Smoothed round trip time is updated by * tp->t_srtt = (tcp_alpha * tp->t_srtt) + ((1 - tcp_alpha) * tp->t_rtt) * each time a new value of tp->t_rtt is available. The initial * retransmit timeout is then based on * tp->t_timer[TCPT_REXMT] = tcp_beta * tp->t_srtt; * limited, however to be at least TCPTV_REXMTLO and at most TCPTV_REXMTHI. */ float tcp_alpha, tcp_beta; /* * Initial values of tcp_alpha and tcp_beta. * These are conservative: averaging over a long * period of time, and allowing for large individual deviations from * tp->t_srtt. */ #define TCP_ALPHA 0.9 #define TCP_BETA 2.0 /* * Force a time value to be in a certain range. */ #define TCPT_RANGESET(tv, value, tvmin, tvmax) { \ (tv) = (value); \ if ((tv) < (tvmin)) \ (tv) = (tvmin); \ if ((tv) > (tvmax)) \ (tv) = (tvmax); \ } TV_REXMTLO and at most TCPTV_REXMTHI. */ float tcp_alpha, tcp_beta; /* * Initial values of tcp_alpha and tcp_beta. * These are conservative: averaging over a long * peri./sys/inet/tcp_user.h 664 0 0 1323 4564204612 7720 /* * things users need to know to talk to /dev/tcp* * open a free tcp device, write a tcpuser struct on it, * then wait for a tcpreply. */ /* the following is defined in kernel .h's */ #ifndef KERNEL #include #include #endif struct tcpuser{ int code; /* request or reply code */ tcp_port lport, fport; in_addr laddr, faddr; int param; /* options or device number */ }; #define TCPC_LISTEN 1 #define TCPC_CONNECT 2 #define TCPC_OK 3 #define TCPC_SORRY 4 /* unknown error */ #define TCPC_BADDEV 5 /* tcp device is bad */ #define TCPC_NOROUTE 6 /* no routing to dest */ #define TCPC_BADLOCAL 7 /* user specified bad local addr */ #define TCPC_BOUND 8 /* address already bound */ de #include #endif struct tcpuser{ int code; /* request or reply code */ tcp_port lport, fport; in_addr laddr, faddr; int param; /* options or device number */ }; #define TCPC_LISTEN 1 #define TCPC_CONNECT 2 #define TCPC_OK 3 #define TCPC_SORRY 4 /* unknown e./sys/inet/tcp_var.h 664 0 0 7453 4564204612 7544 /* tcp_var.h 6.1 83/07/29 */ /* * Kernel variables for tcp. */ /* * Tcp control block, one per tcp; fields: */ struct tcpcb { struct tcpiphdr *seg_next; /* sequencing queue for tcpiphdr */ struct queue *so_rq; struct queue *so_wq; int so_rcount; int so_wcount; /* because q->count is inaccurate */ struct tcpcb *so_head; /* parent who listened */ int so_dev; int so_state; int so_options; in_addr so_laddr; in_addr so_faddr; tcp_port so_lport; tcp_port so_fport; int so_oobmark; int so_delimcnt; /* to detect logical eof */ short t_state; /* state of this connection */ short t_timer[TCPT_NTIMERS]; /* tcp timers */ short t_rxtshift; /* log(2) of rexmt exp. backoff */ struct block *t_tcpopt; /* tcp options */ struct block *t_ipopt; /* ip options */ short t_maxseg; /* maximum segment size */ char t_force; /* 1 if forcing out a byte */ u_char t_flags; #define TF_ACKNOW 0x01 /* ack peer immediately */ #define TF_DELACK 0x02 /* ack, but try to delay it */ #define TF_DONTKEEP 0x04 /* don't use keep-alives */ #define TF_NOOPT 0x08 /* don't use tcp options */ struct block *t_template; /* skeletal tcpiphdr - packet for transmit */ struct inpcb *t_inpcb; /* back pointer to internet pcb */ /* * The following fields are used as in the protocol specification. * See RFC783, Dec. 1981, page 21. */ /* send sequence variables */ tcp_seq snd_una; /* send unacknowledged */ tcp_seq snd_nxt; /* send next */ tcp_seq snd_up; /* send urgent pointer */ tcp_seq snd_wl1; /* window update seg seq number */ tcp_seq snd_wl2; /* window update seg ack number */ tcp_seq iss; /* initial send sequence number */ u_short snd_wnd; /* send window */ /* receive sequence variables */ short rcv_wnd; /* receive window */ tcp_seq rcv_nxt; /* receive next */ tcp_seq rcv_up; /* receive urgent pointer */ tcp_seq irs; /* initial receive sequence number */ /* * Additional variables for this implementation. */ /* receive variables */ tcp_seq rcv_adv; /* advertised window */ /* retransmit variables */ tcp_seq snd_max; /* highest sequence number sent used to recognize retransmits */ /* transmit timing stuff */ short t_idle; /* inactivity time */ short t_rtt; /* round trip time */ tcp_seq t_rtseq; /* sequence number being timed */ float t_srtt; /* smoothed round-trip time */ /* out-of-band data */ char t_oobflags; /* have some */ char t_iobc; /* input character */ #define TCPOOB_HAVEDATA 0x01 }; struct tcpstat { int tcps_badsum; int tcps_badoff; int tcps_hdrops; int tcps_badsegs; int tcps_unack; int tcps_timeouts[4]; /* timeouts while ESTABLISHED */ int tcps_duplicates; /* other side retransmitting */ int tcps_delayed; /* packets out of sequence? */ }; #define SO_DONTROUTE 0x1 #define SO_KEEPALIVE 0x2 #define SO_ACCEPTCONN 0x4 /* this is real */ #define SO_TRUSTED 0x8 /* use a trusted < 1024 port */ #define SS_OPEN 0x1 /* by user */ #define SS_PLEASEOPEN 0x2 /* waiting for user open */ #define SS_RCVATMARK 0x4 /* some kind of OOB */ #define SS_WAITING 0x8 /* wait for user control */ #define SS_HANGUP 0x20 /* HANGUP on TH_FIN */ #define SS_HUNGUP 0x40 /* socket has been hung up (avoid multiple) */ #define SS_WCLOSED 0x80 /* write side is closed */ #define socantsendmore(tp) (tp->so_delimcnt>1 || tp->so_state&SS_WCLOSED) #define sbrcvspace(tp) (tp->so_rq ?\ (sorcvhiwat(tp) - tp->so_rcount)\ : 0) #define sosndcc(tp) (tp->so_wq ? (tp->so_wcount) : 0) #define sototcpcb(tp) (tp->so_tcpcb) #define sorcvhiwat(tp) (tp->so_rq ? (tp->so_rq->qinfo->limit)\ : 0) #define sohasoutofband(tp) #ifdef KERNEL extern struct tcpcb *tcpcb_lookup(); extern struct tcpcb *tcp_newconn(); #endif #ifdef KERNEL struct tcpstat tcpstat; /* tcp statistics */ struct tcpcb *tcp_close(), *tcp_drop(); struct tcpcb *tcp_timers(), *tcp_disconnect(), *tcp_usrclosed(); #endif >so_rq ?\ (sorcvhiwat(tp) - tp->so_rcount)\ : 0) #define sosndcc(tp) (tp->so_wq ? (tp->so_wcount) : 0) #define sototcpcb(tp) (tp->so_tcpcb) #define sorcvhiwat(tp) (tp->so_rq ? (tp->so_rq->qinfo->limit)\ ./sys/inet/tcpip.h 664 0 0 1235 4564204612 7215 /* tcpip.h 6.1 83/07/29 */ /* * Tcp+ip header, after ip options removed. */ struct tcpiphdr { struct ipovly ti_i; /* overlaid ip structure */ struct tcphdr ti_t; /* tcp header */ }; #define ti_next ti_i.ih_next #define ti_bp ti_i.ih_bp #define ti_x1 ti_i.ih_x1 #define ti_pr ti_i.ih_pr #define ti_len ti_i.ih_len #define ti_src ti_i.ih_src #define ti_dst ti_i.ih_dst #define ti_sport ti_t.th_sport #define ti_dport ti_t.th_dport #define ti_seq ti_t.th_seq #define ti_ack ti_t.th_ack #define ti_x2 ti_t.th_x2 #define ti_off ti_t.th_off #define ti_flags ti_t.th_flags #define ti_win ti_t.th_win #define ti_sum ti_t.th_sum #define ti_urp ti_t.th_urp cphdr ti_t; /* tcp header */ }; #define ti_next ti_i.ih_next #define ti_bp ti_i.ih_bp #define ti_x1 ti_i.ih_x1 #define ti_pr ti_i.ih_pr #define ti_len ti_i.ih_len #define ti_src ti_i.ih_src #define ti_dst ti_i.ih_dst #define ti_sport ti_t.th_sport #define ti_dport ti_t.th_dport #define ti_seq ti_t.th_seq #define ti_ack ti_t.th_ack #define ti_x./sys/inet/udp.h 664 0 0 1264 4564204612 6670 /* udp.h 6.1 83/07/29 */ typedef unsigned short udp_port; #define UDPPORT_ANY 0x8000 /* wild card for port number */ #ifdef KERNEL /* * Udp protocol header. * Per RFC 768, September, 1981. */ struct udphdr { u_short uh_sport; /* source port */ u_short uh_dport; /* destination port */ short uh_ulen; /* udp length */ u_short uh_sum; /* udp checksum */ }; struct udp { int flags; u_short dport; u_long dst; u_short sport; u_long src; struct queue *rq; struct block *head; struct block *tail; }; /* values for udp flags */ #define UDP_INIT 1 #define UDP_LISTEN 2 #define UDP_CONNECTED 4 #endif KERNEL #define UDP_BODY_LIMIT 512 /* maximum size of a UDP message body */ ember, 1981. */ struct udphdr { u_short uh_sport; /* source port */ u_short uh_dport; /* destination port */ short uh_ulen; /* udp length */ u_short uh_sum; /* udp checksum */ }; struct udp { int flags; u_short dport; u_long dst; u_short sport; u_long src; struct queue *rq; struct block *head; struct block *tail./sys/inet/udp_user.h 664 0 0 1121 4564204612 7716 /* * things users need to know to talk to /dev/udp* * open a free udp device, write a udpuser struct on it, * then wait for a udpreply. */ /* the following is defined in kernel .h's */ #ifndef KERNEL #include #include #endif struct udpuser{ int cmd; int sport, dport; in_addr dst; }; #define UDPC_LISTEN 1 #define UDPC_CONNECT 2 #define UDPC_DATAGRAM 3 struct udpreply{ int reply; /* for listen: */ int dport; in_addr dst; int udpdev; /* minor device # */ }; #define UDPR_OK 1 #define UDPR_SORRY 2 struct udpaddr{ in_addr host; int port; }; rite a udpuser struct on it, * then wait for a udpreply. */ /* the following is defined in kernel .h's */ #ifndef KERNEL #include #include #endif struct udpuser{ int cmd; int sport, dport; in_addr dst; }; #define UDPC_LISTEN 1 #define UDPC_CONNECT 2 #define UDPC_DATAGRAM 3 struct udpreply{ int reply; /* for listen: */ int dport; in_addr dst; int udpdev; /* minor device # */ }; #defi./sys/inet/udp_var.h 664 0 0 1456 4564204612 7543 /* udp_var.h 6.1 83/07/29 */ /* * UDP kernel structures and variables. */ struct udpiphdr { struct ipovly ui_i; /* overlaid ip structure */ struct udphdr ui_u; /* udp header */ }; #define ui_next ui_i.ih_next #define ui_bp ui_i.ih_bp #define ui_x1 ui_i.ih_x1 #define ui_pr ui_i.ih_pr #define ui_len ui_i.ih_len #define ui_src ui_i.ih_src #define ui_dst ui_i.ih_dst #define ui_sport ui_u.uh_sport #define ui_dport ui_u.uh_dport #define ui_ulen ui_u.uh_ulen #define ui_sum ui_u.uh_sum struct udpstat { int udps_hdrops; int udps_badsum; int udps_badlen; int udps_badport; int udps_inqfull; int udps_ipackets; }; #ifdef KERNEL /* struct inpcb udb; */ struct udpstat udpstat; #endif /* sizeof largest udp message (at ip level) */ #define UDP_MSG_LIMIT (UDP_BODY_LIMIT+sizeof(struct udpiphdr)) e ui_len ui_i.ih_len #define ui_src ui_i.ih_src #define ui_dst ui_i.ih_dst #define ui_sport ui_u.uh_sport #define ui_dport ui_u.uh_dport #define ui_ulen ui_u.uh_ulen #define ui_sum ui_u.uh_sum struct udps./sys/inet/tcpdebug.h 664 0 0 606 4564204612 7654 /* Data structures to help debug tcp. */ struct tcpdebug { unsigned long seq; /* sequence number */ time_t stamp; /* time stamp */ short inout; /* flag to note if input (1) or output (0) mess */ short length; /* length in bytes of packet data */ struct tcpiphdr hdr; /* header of the sent/received message */ }; #define SIZDEBUG 64 /* number of headers to save in debug queue */ _sport ui_u.uh_sport #define ui_dport ui_u.uh_dport #define ui_ulen ui_u.uh_ulen #define ui_sum ui_u.uh_sum struct udps./sys/inet/ethernet.h 664 0 0 502 4564204612 7670 #ifndef _ETHERNET_ #define _ETHERNET_ struct etherpup { u_char dhost[6]; u_char shost[6]; u_short type; }; #define ETHERPUP_PUPTYPE 0x400 #define ETHERPUP_IPTYPE 0x800 #define ETHERPUP_CHAOSTYPE 0x804 #define ETHERPUP_ARPTYPE 0x806 #endif #ifndef CHANS_PER_UNIT #define CHANS_PER_UNIT 8 #endif #define SIZDEBUG 64 /* number of headers to save in debug queue */ _sport ui_u.uh_sport #define ui_dport ui_u.uh_dport #define ui_ulen ui_u.uh_ulen #define ui_sum ui_u.uh_sum struct udps./sys/nttyio.h 664 0 0 4445 4564204613 6474 /* * 'ntty' ioctls */ /* * local special characters */ struct ltchars { char t_suspc; /* stop process signal */ char t_dsuspc; /* delayed stop process signal */ char t_rprntc; /* reprint line */ char t_flushc; /* flush output (toggles) */ char t_werasc; /* word erase */ char t_lnextc; /* literal next character */ }; /* * local undo special characters */ struct luchars { char t_undoc; /* erase/kill/werase undo character */ char t_urotc; /* rotate undo stack character */ }; /* * local mode settings */ #define LCRTBS 0000001 /* correct backspacing for crt */ #define LPRTERA 0000002 /* printing terminal \ ... / erase */ #define LCRTERA 0000004 /* do "\b \b" to wipe out character */ #define LTILDE 0000010 /* IIASA - hazeltine tilde kludge */ #define LMDMBUF 0000020 /* IIASA - start/stop output on carrier intr */ #define LLITOUT 0000040 /* IIASA - suppress any output translations */ #define LTOSTOP 0000100 /* send stop for any background tty output */ #define LFLUSHO 0000200 /* flush output sent to terminal */ #define LNOHANG 0000400 /* IIASA - don't send hangup on carrier drop */ #define LETXACK 0001000 /* IIASA - diablo style buffer hacking */ #define LCRTKIL 0002000 /* erase whole line ala LCRTERA */ #define LINTRUP 0004000 /* interrupt on every input char - SIGTINT */ #define LCTLECH 0010000 /* echo control characters as ^X */ #define LPENDIN 0020000 /* tp->t_rawq is waiting to be reread */ #define LDECCTQ 0040000 /* only ^Q starts after ^S */ /* local state */ #define LSBKSL 01 /* state bit for lowercase backslash work */ #define LSQUOT 02 /* last character input was \ */ #define LSERASE 04 /* within a \.../ for LPRTRUB */ #define LSLNCH 010 /* next character is literal */ #define LSTYPEN 020 /* retyping suspended input (LPENDIN) */ #define LSCNTTB 040 /* counting width of tab; leave LFLUSHO alone */ /* * tty ioctl commands */ #define TIOCLBIS (('t'<<8)|127) /* bis local mode bits */ #define TIOCLBIC (('t'<<8)|126) /* bic local mode bits */ #define TIOCLSET (('t'<<8)|125) /* set entire local mode word */ #define TIOCLGET (('t'<<8)|124) /* get local modes */ #define TIOCSLTC (('t'<<8)|117) /* set local special characters */ #define TIOCGLTC (('t'<<8)|116) /* get local special characters */ #define TIOCOUTQ (('t'<<8)|115) /* number of chars in output queue */ nting width of tab; leave LFLUSHO alone */ /* * tty ioctl commands */ #define TIOCLBIS (('t'<<8)|127) /* bis local mode bits */ #define TIOCLBIC (('t'<<8)|126) /* bic local mode bits */ #define TIOCLSET (('t'<<8)|125./sys/trcio.h 664 0 0 1226 4564204613 6260 /* * stream tracer ioctls */ #define TRCGNAME (('T'<<8)|6) /* get trace module name */ #define TRCSNAME (('T'<<8)|7) /* set trace module name */ #define TRCGMASK (('T'<<8)|8) /* get trace module mask */ #define TRCSMASK (('T'<<8)|9) /* set trace module mask */ /* * stream tracer mask values */ #define TR_DATA 0x1 #define TR_BREAK 0x2 #define TR_HANGUP 0x4 #define TR_DELIM 0x8 #define TR_ECHO 0x10 #define TR_ACK 0x20 #define TR_IOCTL 0x40 #define TR_DELAY 0x80 #define TR_CTL 0x100 #define TR_SIGNAL 0x200 #define TR_FLUSH 0x400 #define TR_STOP 0x800 #define TR_START 0x1000 #define TR_IOCACK 0x2000 #define TR_IOCNAK 0x4000 #define TR_CLOSE 0x8000 fine TRCGMASK (('T'<<8)|8) /* get trace module mask */ #define TRCSMASK (('T'<<8)|9) /* set trace module mask */ /* * stream tracer mask values */ #define TR_DATA 0x1 #define TR_BREAK 0x2 #define TR_HANGUP 0x4 #define TR_DELIM 0x8 #define TR_ECHO 0x10 #define TR_ACK 0x20 #define TR_IOCTL 0x40 #define TR_DELAY 0x80 #define TR_CTL 0x100 #define TR_SIGNAL ./sys/inio.h 664 0 0 720 4564204613 6054 /* * internet ioctls */ /* internet goo */ #define IPIOHOST (('i'<<8)|1) #define IPIONET (('i'<<8)|2) #define IPIOLOCAL (('i'<<8)|3) #define IPIOARP (('i'<<8)|4) #define IPIORESOLVE (('i'<<8)|5) #define IPIOMTU (('i'<<8)|6) #define IPIOROUTE (('i'<<8)|7) #define IPIOGETIFS (('i'<<8)|8) #define IPIOMASK (('i'<<8)|9) /* ugly tcp ioctls */ #define TCPIOHUP (('T'<<8)|1) /* HANGUP on TH_FIN */ #define TCPIOMAXSEG (('T'<<8)|2) #define TCPGETADDR (('T'<<8)|3) AY 0x80 #define TR_CTL 0x100 #define TR_SIGNAL ./sys/filio.h 664 0 0 1123 4564204613 6236 /* * general file and stream ioctls */ /* * for FIOINSLD */ struct insld { short ld; short level; }; /* * for passing files across streams */ struct passfd { int fd; short uid; short gid; short nice; char logname[8]; }; /* * file ioctls */ #define FIOCLEX (('f'<<8)|1) #define FIONCLEX (('f'<<8)|2) #define FIOPUSHLD (('f'<<8)|3) #define FIOPOPLD (('f'<<8)|4) #define FIOLOOKLD (('f'<<8)|5) #define FIOINSLD (('f'<<8)|6) #define FIOSNDFD (('f'<<8)|7) #define FIORCVFD (('f'<<8)|8) #define FIOACCEPT (('f'<<8)|9) #define FIOREJECT (('f'<<8)|10) #define FIONREAD (('f'<<8)|127) ort ld; short level; }; /* * for passing files across streams */ struct passfd { int fd; short uid; short gid; short nice; char logname[8]; }; /* * file ioctls */ #define FIOCLEX (('f'<<8)|1) #define FIONCLEX (('f'<<8)|2) #define FIOPUSHLD (('f'<<8)|3) #define FIOPOPLD (('f'<<8)|4) #define FIOLOOKLD (('f'<<8)|5) #define FIOINSLD (('f'<<8)|6) #define FIOSNDFD (('f'<<8)|7) #define FIORCVFD (('f'<<8)|8) #define FIOA./sys/enio.h 664 0 0 412 4564204613 6046 /* * generic ethernet ioctls */ #define ENIOTYPE (('e'<<8)|1) /* set receive packet type */ #define ENIOADDR (('e'<<8)|2) /* fetch physical addr */ #define ENIOCMD (('e'<<8)|3) /* perform interface board cmd */ #define ENIOPROM (('e'<<8)|4) /* go promiscuous */ FIOCLEX (('f'<<8)|1) #define FIONCLEX (('f'<<8)|2) #define FIOPUSHLD (('f'<<8)|3) #define FIOPOPLD (('f'<<8)|4) #define FIOLOOKLD (('f'<<8)|5) #define FIOINSLD (('f'<<8)|6) #define FIOSNDFD (('f'<<8)|7) #define FIORCVFD (('f'<<8)|8) #define FIOA./sys/nxaddr.h 664 0 0 457 4564204613 6405 /* * addressing and adapters for old-style nexus devices * sbi, cmi, et al * not vaxbi */ struct nxaddr { char nexus; /* nexus number; index in nexus table */ char adno; /* adapter number; e.g. 8600 */ short voff; /* vector offset, e.g. unibus adapter */ }; #if KERNEL caddr_t nxaddr(); #endif X (('f'<<8)|2) #define FIOPUSHLD (('f'<<8)|3) #define FIOPOPLD (('f'<<8)|4) #define FIOLOOKLD (('f'<<8)|5) #define FIOINSLD (('f'<<8)|6) #define FIOSNDFD (('f'<<8)|7) #define FIORCVFD (('f'<<8)|8) #define FIOA./sys/mbaddr.h 664 0 0 345 4564204613 6352 /* * addressing data structures for massbus devices */ struct mbaddr { char unit; /* unit number within this massbus */ char mbno; /* massbus number within system */ }; #if KERNEL caddr_t mbaddr(); long mbcuraddr(); #endif or offset, e.g. unibus adapter */ }; #if KERNEL caddr_t nxaddr(); #endif X (('f'<<8)|2) #define FIOPUSHLD (('f'<<8)|3) #define FIOPOPLD (('f'<<8)|4) #define FIOLOOKLD (('f'<<8)|5) #define FIOINSLD (('f'<<8)|6) #define FIOSNDFD (('f'<<8)|7) #define FIORCVFD (('f'<<8)|8) #define FIOA./sys/ubaddr.h 664 0 0 2557 4564204613 6411 /* * addressing stuff for unibus devices */ struct ubaddr { long uboff; /* address within unibus space */ short vec; /* vector (within unibus) */ short ubno; /* unibus number */ }; /* * unibus map things */ typedef long ubm_t; /* cookie for a piece of unibus map */ typedef long uaddr_t; /* 18-bit unibus or 22-bit q-bus address */ /* * pieces of ubm_t; * ubmpath is probably the only one * useful outside the unibus code * * bits 0-12 first reg index; enough for 22 bits of addr space (q-bus) * bits 13-19 number of map registers; enough for 64kb transfer * number offset by UMSZERO -- alignment page + end sentinel * bits 20-23 data path */ #define UMFIRST 0 #define UMSIZE 13 #define UMSZERO 2 #define UMDP 20 #define ubmfirst(m) (int)((m)&017777) #define ubmsize(m) (int)((((m)>>UMSIZE)&0177)+UMSZERO) #define ubmpath(m) (int)(((m)>>UMDP)&017) /* * change map m to use path p */ #define ubinspath(p, m) (((m)&~(017<>8) & 017) #define W_DEST(x) ((x>>4) & 017) #define W_TRAF(x) (x & 017) #define W_DESTMAX(x,y) (WINDOW(W_ORIG(x),MIN(W_DEST(x),y),W_TRAF(x))) #define W_LIMIT(x,y) (WINDOW(MIN(W_ORIG(x),y),MIN(W_DEST(x),y),W_TRAF(x))) #define W_VALUE(x) (1<<(x+4)) #define WS_16 0 #define WS_32 1 #define WS_64 2 #define WS_128 3 #define WS_256 4 #define WS_512 5 #define WS_1K 6 #define WS_2K 7 #define WS_4K 8 #define WS_8K 9 #define WS_16K 10 #define WS_32K 11 #define WS_64K 12 #define WS_128K 13 #define WS_256K 14 #define WS_512K 15 W_DEST(x) ((x>>4) & 017) #define W_TRAF(x) (x & 017) #define W_DESTMAX(x,y) (WINDOW(W_ORIG(x),MIN(W_DEST(x),y),W_TRAF(x))) #define W_LIMIT(x,y) (WINDOW(MIN(W_ORIG(x),y),MIN(W_DEST(x),y),W_TRAF(x))) #define W_VALUE(x) (1<<(x+4)) #define WS_16 0 #define WS_32 1 #define WS_64 2 #define WS_128 3 #define WS_256 4 #define WS_512 5 #define WS_1K 6 #define WS_2K 7 #define WS_4K 8 #define WS_8K 9 #define WS_16K 10 #define WS_32K 11 #defi./sys/dhv11.h 664 0 0 340 4564204615 6041 /* * structures for DHV11 serial interface driver */ struct dhv { short state; short flags; struct dhvreg *regs; struct queue *rdq; char adno; char line; char ispeed, ospeed; short lctl; struct block *oblock; }; NDOW(MIN(W_ORIG(x),y),MIN(W_DEST(x),y),W_TRAF(x))) #define W_VALUE(x) (1<<(x+4)) #define WS_16 0 #define WS_32 1 #define WS_64 2 #define WS_128 3 #define WS_256 4 #define WS_512 5 #define WS_1K 6 #define WS_2K 7 #define WS_4K 8 #define WS_8K 9 #define WS_16K 10 #define WS_32K 11 #defi./sys/ni1010a.h 664 0 0 1773 4564204615 6222 /* * Interlan NI1010A Ethernet controller */ /* * one struct ilchan per minor device; * eight of these per controller, * embedded in struct il */ #define NILCHAN 8 struct ilchan { char unit; char ndelims; /* number of packets waiting */ short type; /* ethernet protocol # */ struct queue *rq; struct block *xcur; /* block now being sent */ struct block *xlast; /* last data block put */ }; /* * one struct il per controller */ struct il { char flags; char ubno; short rbytes; /* buffer space now outstanding */ short rbufs; /* number of buffers outstanding */ short lastcsr; /* il_csr at last interrupt */ int ipackets, opackets; int ierrors, oerrors; int collisions; int ilost; struct ildevice *addr; struct block *rfirst, *rlast; /* receive buffer */ struct block *rnext; /* where next block goes */ short rcur; /* bytes left in current packet */ char lastch; /* current transmit channel */ unsigned char enaddr[6]; /* my ethernet address */ struct ilchan chan[NILCHAN]; }; r spa./sys/errlog.h 664 0 0 745 4564204615 6421 /* * error log record */ #define MAXEDATA 112 struct errhdr { char e_1magic, e_2magic; char e_len; /* how many bytes of data are valid */ char e_unit; /* subdevice number */ time_t e_time; /* when error happened */ char e_dev[8]; /* device (or other) name */ }; struct errlog { struct errhdr e_hdr; char e_data[MAXEDATA]; }; #define E_HARD 0200 /* e_len -- unrecovered error */ #define E_LEN 0177 /* e_len -- the real length */ #define E_1MAGIC 0247 #define E_2MAGIC 0145 han chan[NILCHAN]; }; r spa./sys/im.h 664 0 0 212 4564204615 5521 struct im { char open; /* single open */ enum states state; /* driver state */ struct imdevice *addr; ubm_t ubm; struct buf buf; }; id */ char e_unit; /* subdevice number */ time_t e_time; /* when error happened */ char e_dev[8]; /* device (or other) name */ }; struct errlog { struct errhdr e_hdr; char e_data[MAXEDATA]; }; #define E_HARD 0200 /* e_len -- unrecovered error */ #define E_LEN 0177 /* e_len -- the real length */ #define E_1MAGIC 0247 #define E_2MAGIC 0145 han chan[NILCHAN]; }; r spa./sys/rco.h 664 0 0 310 4564204615 5676 struct rco { u_short flags; struct device *addr; struct buf buf; ubm_t ubm; ubm_t chunkubm; struct pte *pte; int mreg; u_short resol; /* resolution */ u_short dither; /* 1=dither on */ }; when error happened */ char e_dev[8]; /* device (or other) name */ }; struct errlog { struct errhdr e_hdr; char e_data[MAXEDATA]; }; #define E_HARD 0200 /* e_len -- unrecovered error */ #define E_LEN 0177 /* e_len -- the real length */ #define E_1MAGIC 0247 #define E_2MAGIC 0145 han chan[NILCHAN]; }; r spa./sys/rcocmd.h 664 0 0 240 4564204616 6365 #define RCORES (('R'<<8)|1) #define RCODITHER (('R'<<8)|2) #define RCOHACK (('R'<<8)|3) /* obsolete ? */ #define IOSIZE (1069200) #define IOALIGN (4*512) u_short dither; /* 1=dither on */ }; when error happened */ char e_dev[8]; /* device (or other) name */ }; struct errlog { struct errhdr e_hdr; char e_data[MAXEDATA]; }; #define E_HARD 0200 /* e_len -- unrecovered error */ #define E_LEN 0177 /* e_len -- the real length */ #define E_1MAGIC 0247 #define E_2MAGIC 0145 han chan[NILCHAN]; }; r spa./sys/vplot.h 664 0 0 104 4564204616 6261 struct vplot { int open; struct device *addr; struct buf buf; }; RCOHACK (('R'<<8)|3) /* obsolete ? */ #define IOSIZE (1069200) #define IOALIGN (4*512) u_short dither; /* 1=dither on */ }; when error happened */ char e_dev[8]; /* device (or other) name */ }; struct errlog { struct errhdr e_hdr; char e_data[MAXEDATA]; }; #define E_HARD 0200 /* e_len -- unrecovered error */ #define E_LEN 0177 /* e_len -- the real length */ #define E_1MAGIC 0247 #define E_2MAGIC 0145 han chan[NILCHAN]; }; r spa./sys/vplotcmd.h 664 0 0 1531 4564204616 6772 #define VGETSTATE (('v'<<8)|0) #define VSETSTATE (('v'<<8)|1) #define VC_ERROR 0100000 #define VC_UNUSED1 0040000 #define VC_SPP 0020000 #define VC_BTCNT 0010000 #define VC_ADDR 0004000 #define VC_PP 0002000 #define VC_SWPBT 0001000 #define VC_UNUSED2 0000400 #define VC_READY 0000200 #define VC_IENABLE 0000100 #define VC_AD17 0000040 #define VC_AD16 0000020 #define VC_REMOTE 0000016 #define VC_REMOTE2 0000010 #define VC_REMOTE1 0000004 #define VC_REMOTE0 0000002 #define VC_DMAGO 0000001 #define VC_MASK (VC_SPP | VC_PP | VC_SWPBT | VC_REMOTE) /* sc_state bits (other than bits defined above) */ #define VCSC_CMNDS VC_REMOTE #define VCSC_OPEN VC_UNUSED1 /* remote functions */ #define VC_RLTER (01 << 1) #define VC_CLEAR (02 << 1) #define VC_RESET (03 << 1) #define VC_RFFED (04 << 1) #define VC_REOTR (05 << 1) #define VC_RESET_ALL (06 << 1) fine VC_AD16 0000020 #define VC_REMOTE 0000016 #define VC_REMOTE2 0000010 #define VC_REMOTE1 0000004 #define VC_REMOTE0 0000002 #define VC_DMAGO 0000001 #define VC_MA./sys/hp.h 664 0 0 1334 4577464571 5566 /* * MASSBUS SMD disk data structures * one hpdisk per drive */ #define NHPPART 8 struct hpdisk { struct hpdevice *addr; char flags; char type; /* index into hpst */ char errcnt; char recal; short badsec; char pinit; struct buf *actf, *actl; /* queue of buffers waiting for xfer */ long blkoff[NHPPART]; long nblocks[NHPPART]; }; /* * device size info * here so hpdump can get it */ struct hptype { short type; /* hpdt drive type */ char nsect; /* sectors per track */ char ntrak; /* tracks per cylinder */ char sdist; /* sectors twixt search and io */ char rdist; /* sectors close enough not to search */ short nspc; /* sectors per cylinder */ short ncyl; /* cylinders per pack */ struct size *sizes; }; r pinit; struct buf *actf, *actl; /* queue of buffers waiting for xfer */ long blkoff[NHPPART]; long nblocks[NHPPART]; }; /* * device size info * here so hpdump can get it */ struct hptype { short type; /* hpdt drive type */ char nsect; /* sectors per track */ char ntrak; /* tracks./sys/bad144.h 664 0 0 2545 4564204616 6127 /* * Definitions needed to perform bad sector * revectoring ala DEC STD 144. * * The bad sector information is located in the * first 5 even numbered sectors of the last * track of the disk pack. There are five * identical copies of the information, described * by the bad144 structure. * * Replacement sectors are allocated starting with * the first sector before the bad sector information * and working backwards towards the beginning of * the disk. A maximum of 126 bad sectors are supported. * The position of the bad sector in the bad sector table * determines which replacement sector it corresponds to. * * The bad sector information and replacement sectors * are conventionally only accessible through the * 'c' file system partition of the disk. If that * partition is used for a file system, the user is * responsible for making sure that it does not overlap * the bad sector information or any replacement sector.s */ #define NBADDESC 126 /* * known to be 512 bytes long */ struct bad144 { long bt_csn; /* cartridge serial number */ unsigned short bt_mbz; /* unused; should be 0 */ unsigned short bt_flag; /* -1 => alignment cartridge */ struct bt_bad { unsigned short bt_cyl; /* cylinder number of bad sector */ unsigned short bt_trksec; /* track and sector number */ } bt_bad[126]; }; #if KERNEL int bad144rep(); #endif that it does not overlap * the bad sector information or any replacement sector.s */ #define NBADDESC 126 /* * known to be 512 bytes long */ struct b./sys/diskio.h 664 0 0 366 4577464570 6424 /* * generic disk-driver ioctls * not necessarily supported by every device */ #define DIOSSIZ (('D'<<8)|0) /* set size for this device */ #define DIOGSIZ (('D'<<8)|1) /* fetch size */ #define DIOHDR (('D'<<8)|2) /* write sector header */ unsigned short bt_trksec; /* track and sector number */ } bt_bad[126]; }; #if KERNEL int bad144rep(); #endif that it does not overlap * the bad sector information or any replacement sector.s */ #define NBADDESC 126 /* * known to be 512 bytes long */ struct b./sys/xttyld.h 644 0 0 352 5050323714 6440 struct xttyld { struct sgttyb sg; struct tchars tc; struct queue *qp; int status; struct block *icanb; int col; }; /* status bits */ #define XTTY_ESCAPED 01 #define XTTY_NEWLINE 02 #define XTTY_STOPPED 04 #define XTTY_FULL 010 r header */ unsigned short bt_trksec; /* track and sector number */ } bt_bad[126]; }; #if KERNEL int bad144rep(); #endif that it does not overlap * the bad sector information or any replacement sector.s */ #define NBADDESC 126 /* * known to be 512 bytes long */ struct b./sys.s 666 0 0 1710 2455551134 5153 .set exit,1 .set fork,2 .set read,3 .set write,4 .set open,5 .set close,6 .set wait,7 .set creat,8 .set link,9 .set unlink,10 .set exec,11 .set chdir,12 .set time,13 .set mknod,14 .set chmod,15 .set chown,16 .set break,17 .set stat,18 .set lseek,19 .set getpid,20 .set mount,21 .set umount,22 .set setuid,23 .set getuid,24 .set stime,25 .set ptrace,26 .set alarm,27 .set fstat,28 .set pause,29 .set utime,30 .set smdate,30 .set stty,31 .set gtty,32 .set access,33 .set nice,34 .set ftime,35 .set sync,36 .set kill,37 # .set switch,38 # inoperative .set setpgrp,39 # .set tell,40 # obsolete .set dup,41 .set pipe,42 .set times,43 .set prof,44 .set setgid,46 .set getgid,47 .set signal,48 # USG 49 # USG 50 .set acct,51 .set setphys,52 .set syslock,53 .set ioctl,54 # .set reboot,55 .set mpx,56 # USG 57 # USG 58 .set exece,59 .set umask,60 .set chroot,61 # LOCAL 62 .set vfork,66 .set vread,67 .set vwrite,68 set stty,31 .set gtty,32 .set access,33 .set nice,34 ./sysexits.h 664 0 0 7110 4376144376 6225 /* ** SYSEXITS.H -- Exit status codes for system programs. ** ** This include file attempts to categorize possible error ** exit statuses for system programs, notably delivermail ** and the Berkeley network. ** ** Error numbers begin at EX__BASE to reduce the possibility of ** clashing with other exit statuses that random programs may ** already return. The meaning of the codes is approximately ** as follows: ** ** EX_USAGE -- The command was used incorrectly, e.g., with ** the wrong number of arguments, a bad flag, a bad ** syntax in a parameter, or whatever. ** EX_DATAERR -- The input data was incorrect in some way. ** This should only be used for user's data & not ** system files. ** EX_NOINPUT -- An input file (not a system file) did not ** exist or was not readable. This could also include ** errors like "No message" to a mailer (if it cared ** to catch it). ** EX_NOUSER -- The user specified did not exist. This might ** be used for mail addresses or remote logins. ** EX_NOHOST -- The host specified did not exist. This is used ** in mail addresses or network requests. ** EX_UNAVAILABLE -- A service is unavailable. This can occur ** if a support program or file does not exist. This ** can also be used as a catchall message when something ** you wanted to do doesn't work, but you don't know ** why. ** EX_SOFTWARE -- An internal software error has been detected. ** This should be limited to non-operating system related ** errors as possible. ** EX_OSERR -- An operating system error has been detected. ** This is intended to be used for such things as "cannot ** fork", "cannot create pipe", or the like. It includes ** things like getuid returning a user that does not ** exist in the passwd file. ** EX_OSFILE -- Some system file (e.g., /etc/passwd, /etc/utmp, ** etc.) does not exist, cannot be opened, or has some ** sort of error (e.g., syntax error). ** EX_CANTCREAT -- A (user specified) output file cannot be ** created. ** EX_IOERR -- An error occurred while doing I/O on some file. ** EX_TEMPFAIL -- temporary failure, indicating something that ** is not really an error. In sendmail, this means ** that a mailer (e.g.) could not create a connection, ** and the request should be reattempted later. ** EX_PROTOCOL -- the remote system returned something that ** was "not possible" during a protocol exchange. ** EX_NOPERM -- You did not have sufficient permission to ** perform the operation. This is not intended for ** file system problems, which should use NOINPUT or ** CANTCREAT, but rather for higher level permissions. ** For example, kre uses this to restrict who students ** can send mail to. ** ** Maintained by Eric Allman (eric@berkeley, ucbvax!eric) -- ** please mail changes to me. ** ** @(#)sysexits.h 4.2 7/31/83 */ # define EX_OK 0 /* successful termination */ # define EX__BASE 64 /* base value for error messages */ # define EX_USAGE 64 /* command line usage error */ # define EX_DATAERR 65 /* data format error */ # define EX_NOINPUT 66 /* cannot open input */ # define EX_NOUSER 67 /* addressee unknown */ # define EX_NOHOST 68 /* host name unknown */ # define EX_UNAVAILABLE 69 /* service unavailable */ # define EX_SOFTWARE 70 /* internal software error */ # define EX_OSERR 71 /* system error (e.g., can't fork) */ # define EX_OSFILE 72 /* critical OS file missing */ # define EX_CANTCREAT 73 /* can't create (user) output file */ # define EX_IOERR 74 /* input/output error */ # define EX_TEMPFAIL 75 /* temp failure; user is invited to retry */ # define EX_PROTOCOL 76 /* remote error in protocol */ # define EX_NOPERM 77 /* permission denied */ me unknown */ # define EX_UNAVAILABLE 69 /* service unavailable */ # define EX_SOFTWARE 70 /* internal software error */ # define EX_OSERR 71 /* system error (e.g., can't fork) */ # define EX_OSFILE 72 /* critical OS file missing */ # define EX_CANTCREAT 73 /* can't create (user) output file */ # define EX_IOERR 74 /* input/output error */ # define EX_TEMPFAIL 75 /* temp failure; user is invited to retry */ # define EX_PROTOCOL 76 /* re./time.h 664 0 0 544 4211040155 5226 struct tm { /* see ctime(3) */ int tm_sec; int tm_min; int tm_hour; int tm_mday; int tm_mon; int tm_year; int tm_wday; int tm_yday; int tm_isdst; }; extern struct tm *localtime(); extern struct tm *gmtime(); extern char *asctime(); extern char *ctime(); extern long timec(); extern long timegm(); extern long timelocal(); extern char *timezone(); put file */ # define EX_IOERR 74 /* input/output error */ # define EX_TEMPFAIL 75 /* temp failure; user is invited to retry */ # define EX_PROTOCOL 76 /* re./tr.h 666 0 0 11102 2475572612 4771 #ifdef KERNEL #include "../h/param.h" #include "../h/dir.h" #include "../h/user.h" #include "../h/tty.h" #include "../h/buf.h" #include "../h/proc.h" #include "../h/systm.h" #ifdef VMUNIX #include "../h/clist.h" #include "../h/file.h" #define ttiocb sgttyb #endif #ifdef VMUNIX #define ttioccomm ttioctl #define ioc_ispeed sg_ispeed #define ioc_ospeed sg_ospeed #define ioc_erase sg_erase #define ioc_kill sg_kill #define ioc_flags sg_flags #endif #define NTR 20 #define xseq tr->tr_xseq #define lseq tr->tr_lseq #define rseq tr->tr_rseq #define avbytes tr->tr_avbytes #define trschars tr->tr_schars #define rbytes tr->tr_rbytes #define cbytes tr->tr_cbytes #define trstate tr->tr_state #define trcntl tr->tr_cntl #define tramsg tr->tr_amsg #define trbsize tr->tr_bsize #define trsent tr->tr_sent #define inpq tr->tr_inpq #define troutq tr->tr_outq #define trctlq tr->tr_ctlq #define trecho tr->tr_echo #define trenq tr->tr_enq #define trepoch tr->tr_epoch #define trtime tr->tr_time #define q4 tr->tr_q4 #define DCLS register struct tr *tr; register s; #define DHIWAT 150 #define DLOWAT 50 #define q1 tp->t_rawq #define q2 tp->t_canq #define q3 tp->t_outq #define WAKEUP(a) wakeup(a) #define LOCK s = spl6() #define UNLOCK splx(s) #endif struct triocmb { char type; char seq; short cmd; /* param0 */ struct ttiocb triocb; }; #define trioc (tr->tr_iocb) struct tr { struct tty *tr_tty; /* device tty struct */ struct tty *tr_utty; /* user's tty struct */ struct clist *tr_q4; short tr_state; /* state bits */ short tr_cntl; /* meta packet control bits */ short tr_amsg; /* async receive register */ short tr_avbytes; /* max transmission allowed */ short tr_rbytes; /* size of */ short tr_cbytes; /* current input record residual */ short tr_bsize; /* size of buffer request */ short tr_schars; /* singleton bytes in q1 */ short tr_echo; short tr_enq; short tr_epoch; struct clist tr_inpq; struct clist tr_outq; struct clist tr_ctlq; struct triocmb tr_iocb; char tr_sig; char tr_flag; char tr_xseq; /* output sequence number */ char tr_lseq; /* last xseq acknowledged */ char tr_rseq; /* last seq received */ char tr_time; /* timeout delay */ }; #ifdef KERNEL struct tr trvec[NTR]; #endif /* * control codes */ #define CHK 040 /* enable checking of seq number */ #define INIT 0100 /* allowable response to RESEQ msg */ #define P_DATA (01|INIT|CHK) #define P_CHAR (02|INIT|CHK) #define P_MORE (03|INIT|CHK) #define P_CMD (04|INIT|CHK) #define P_ERROR (05|INIT|CHK) #define P_ACK 06 #define P_REJ 07 #define P_ALLOC 010 #define P_ENQ 011 #define P_RESP 012 #define P_SYN 013 #define P_RESYN (014|INIT) #define P_IOCTL (015|INIT) #define P_IOANS 016 #define P_SIGNAL 023 #define P_SIGANS 024 #define NMSG (024-010) struct msg { char type; char seq; short param0; short param1; short param2; short param3; short param4; short param5; short param6; }; /* * state bits */ #define RXMIT 01 /* flag to start retransmission */ #define R_ACK 02 /* have received an ack */ #define LIVE 04 /* connection is live */ #define T_ASYNC 010 #define R_IOCTL 020 /* have received an ioctl */ #define R_SYN 040 /* have received P_SYN */ #define BREAD 0100 #define S_REJ 0200 /* have sent one REJ */ #define S_ENQ 0400 /* sending ENQs */ #define R_ZERO 01000 /* zero length read pending */ #define BWRITE 02000 #define D_IOCTL 04000 /* * cntrl msg flags */ #define X_CLOSE 01 #define X_CLOSED 02 #define X_SYN 04 #define X_RESYN 010 #define X_REJ 020 #define X_ACK 040 #define X_ALL 0100 #define X_ENQ 0200 #define X_RESP 0400 #define X_BREQ 01000 #define X_BANS 02000 #define X_IOCTL 040000 #define X_IOANS 010000 #define X_SIG 020000 #define X_SIGANS 040000 /* * Circular trace buffer (debugging) */ struct trec { char dev; char state; char code; short seq; short p0; short p1; }; #define R 0100 #define S 0 #define Tblock 0200 #define Tmove 0201 #define Trelease 0202 #define Tmark 0203 #define Tflush 0204 #define Trxint 0205 #define Topen 0206 #define Tclose 0207 #define Tsleep 0210 #define Twrite 0211 #define Tbwrite 0212 #define Tbwait 0213 #define Tread 0220 #define Trend 0221 #define Tsmeta 0222 #define Tablock 0223 #define Tbusy 0224 #define Trxmeta 0225 #define Tlive 0226 #define Tbread 0227 #define Trxmit 0230 #define Trzero 0231 #define Trproc 0232 #define Tdowrite 0233 #define Tgetblk 0234 #define Tbrelse 0235 #define Tovf 0236 #define Tseq 0237 #define Tmeta 0240 #define Tucount 0241 #define Txint 0242 #define Tadjust 0243 #define TSioctl 0244 #define Tdoctl 0245 #define Tcounts 0246 #define Ttimes 0247 #define Tdel 0250 #define TSIZE 250 ne Tread 0220 #define Trend 0221 #define Tsmeta 0222 #define Tablock 0223 #define Tbusy 0224 #define Trxmeta 0225 #define Tlive 0226 #define Tbread 0227 #define Trxmit 0230 #define Trzero 0231 #define Trproc 0232 #define Tdowrite 0233 #define Tgetblk 0234 #define Tbrelse 0235 #define Tovf 0236 #define Tseq 0237 #define Tmeta 0240 #define Tucount 0241 #define Txint 0242 #define Tadjust 0243 #define TSioctl 0244 #define Tdoctl 0245 #define Tcou./trmsg.h 666 0 0 1273 2455551135 5463 #define Tblock 0200 #define Tmove 0201 #define Trelease 0202 #define Tmark 0203 #define Tflush 0204 #define Trxint 0205 #define Topen 0206 #define Tclose 0207 #define Tsleep 0210 #define Twrite 0211 #define Tbwrite 0212 #define Tbwait 0213 #define Tread 0220 #define Trend 0221 #define Tsmeta 0222 #define Tablock 0223 #define Tbusy 0224 #define Trxmeta 0225 #define Tlive 0226 #define Tbread 0227 #define Trxmit 0230 #define Trzero 0231 #define Trproc 0232 #define Tdowrite 0233 #define Tgetblk 0234 #define Tbrelse 0235 #define TSIZE 250 #define Tdkxin 240 #define Tdkxou 241 #define Tdkrin 242 #define Tdkrou 243 #define Tdkrb 244 #define Tdkstart 245 #define Tdkmark 246 #define Tdkrmark 247 Twrite 0211 #define Tbwrite 0212 #define Tbwait 0213 #define Tread 0220 #define Trend 0221 #define Tsmeta 0222 #define Tablock 0223 #define Tbusy 0224 #define Trxmeta 0225 #define Tlive 0226 #define Tbread 0227 #define Trxmit 0230 #define Trzero 0231 #define Trproc 0232 #define Tdowrite 0233 #define Tgetblk 0234 #define Tbr./unctrl.h 666 0 0 73 2455551135 5573 extern char *_unctrl[]; # define unctrl(ch) (_unctrl[ch]) xou 241 #define Tdkrin 242 #define Tdkrou 243 #define Tdkrb 244 #define Tdkstart 245 #define Tdkmark 246 #define Tdkrmark 247 Twrite 0211 #define Tbwrite 0212 #define Tbwait 0213 #define Tread 0220 #define Trend 0221 #define Tsmeta 0222 #define Tablock 0223 #define Tbusy 0224 #define Trxmeta 0225 #define Tlive 0226 #define Tbread 0227 #define Trxmit 0230 #define Trzero 0231 #define Trproc 0232 #define Tdowrite 0233 #define Tgetblk 0234 #define Tbr./utmp.h 666 0 0 305 2455551155 5271 /* * Structure of utmp and wtmp files. * * Assuming the number 8 is unwise. */ struct utmp { char ut_line[8]; /* tty name */ char ut_name[8]; /* user id */ long ut_time; /* time on */ }; 1 #define Tbwrite 0212 #define Tbwait 0213 #define Tread 0220 #define Trend 0221 #define Tsmeta 0222 #define Tablock 0223 #define Tbusy 0224 #define Trxmeta 0225 #define Tlive 0226 #define Tbread 0227 #define Trxmit 0230 #define Trzero 0231 #define Trproc 0232 #define Tdowrite 0233 #define Tgetblk 0234 #define Tbr./vadvise.h 666 0 0 444 2455551156 5752 /* * Parameters to vadvise() to tell system of particular paging * behaviour: * VA_NORM Normal strategy * VA_ANOM Sampling page behaviour is not a win, don't bother * Suitable during GCs in LISP, or sequential or random * page referencing. */ #define VA_NORM 0 #define VA_ANOM 1 0222 #define Tablock 0223 #define Tbusy 0224 #define Trxmeta 0225 #define Tlive 0226 #define Tbread 0227 #define Trxmit 0230 #define Trzero 0231 #define Trproc 0232 #define Tdowrite 0233 #define Tgetblk 0234 #define Tbr./valign.h 666 0 0 24 2455551156 5543 #define VALSIZ 1024 vadvise() to tell system of particular paging * behaviour: * VA_NORM Normal strategy * VA_ANOM Sampling page behaviour is not a win, don't bother * Suitable during GCs in LISP, or sequential or random * page referencing. */ #define VA_NORM 0 #define VA_ANOM 1 0222 #define Tablock 0223 #define Tbusy 0224 #define Trxmeta 0225 #define Tlive 0226 #define Tbread 0227 #define Trxmit 0230 #define Trzero 0231 #define Trproc 0232 #define Tdowrite 0233 #define Tgetblk 0234 #define Tbr./varargs.h 666 0 0 275 2455551156 5760 typedef char *va_list; # define va_dcl int va_alist; # define va_start(list) list = (char *) &va_alist # define va_end(list) # define va_arg(list,mode) ((mode *)(list += sizeof(mode)))[-1] ng GCs in LISP, or sequential or random * page referencing. */ #define VA_NORM 0 #define VA_ANOM 1 0222 #define Tablock 0223 #define Tbusy 0224 #define Trxmeta 0225 #define Tlive 0226 #define Tbread 0227 #define Trxmit 0230 #define Trzero 0231 #define Trproc 0232 #define Tdowrite 0233 #define Tgetblk 0234 #define Tbr./vfont.h 666 0 0 467 2455551156 5452 /* * The structures header and dispatch define the format of a font file. * * See vfont(5) for more details. */ struct header { short magic; unsigned short size; short maxx; short maxy; short xtend; }; struct dispatch { unsigned short addr; short nbytes; char up,down,left,right; short width; }; ck 0223 #define Tbusy 0224 #define Trxmeta 0225 #define Tlive 0226 #define Tbread 0227 #define Trxmit 0230 #define Trzero 0231 #define Trproc 0232 #define Tdowrite 0233 #define Tgetblk 0234 #define Tbr./wait.h 664 0 0 4220 3405402067 5257 /* * This file holds definitions relevent to the wait system call. * Some of the options here are available only through the ``wait3'' * entry point; the old entry point with one argument has more fixed * semantics, never returning status of unstopped children, hanging until * a process terminates if any are outstanding, and never returns * detailed information about process resource utilization (). */ /* * Structure of the information in the first word returned by both * wait and wait3. If w_stopval==WSTOPPED, then the second structure * describes the information returned, else the first. See WUNTRACED below. */ union wait { int w_status; /* used in syscall */ /* * Terminated process status. */ struct { unsigned int w_Termsig:7; /* termination signal */ unsigned int w_Coredump:1; /* core dump indicator */ unsigned int w_Retcode:8; /* exit code if w_termsig==0 */ } w_T; /* * Stopped process status. Returned * only for traced children unless requested * with the WUNTRACED option bit. */ struct { unsigned int w_Stopval:8; /* == W_STOPPED if stopped */ unsigned int w_Stopsig:8; /* signal that stopped us */ } w_S; }; #define w_termsig w_T.w_Termsig #define w_coredump w_T.w_Coredump #define w_retcode w_T.w_Retcode #define w_stopval w_S.w_Stopval #define w_stopsig w_S.w_Stopsig #define WSTOPPED 0177 /* value of s.stopval if process is stopped */ /* * Option bits for the second argument of wait3. WNOHANG causes the * wait to not hang if there are no stopped or terminated processes, rather * returning an error indication in this case (pid==0). WUNTRACED * indicates that the caller should receive status about untraced children * which stop due to signals. If children are stopped and a wait without * this option is done, it is as though they were still running... nothing * about them is returned. */ #define WNOHANG 1 /* dont hang in wait */ #define WUNTRACED 2 /* tell about stopped, untraced children */ #define WIFSTOPPED(x) ((x).w_stopval == WSTOPPED) #define WIFSIGNALED(x) ((x).w_stopval != WSTOPPED && (x).w_termsig != 0) #define WIFEXITED(x) ((x).w_stopval != WSTOPPED && (x).w_termsig == 0) tatus about untraced children * which stop due to signals. If children are stopped and a wait without * this option is done, it is as though they were still running... nothing * about them is returned. */ #define WNOHANG 1 /* dont hang in wait */ #define WUNTRACED 2 /* tell about stopped, untraced children */ #define WIFSTOPPED(x) ((x).w_stopval == WSTOPPED) ./ftw.h 664 0 0 1415 4072273254 5123 /* * Codes for the third argument to the user-supplied function * which is passed as the second argument to ftw... */ #define FTW_F 0 /* file */ #define FTW_D 1 /* directory */ #define FTW_DNR 2 /* directory without read permission */ #define FTW_NS 3 /* unknown type, stat failed */ #define FTW_DP 4 /* directory, postorder visit */ #define FTW_SL 5 /* symbolic link */ #define FTW_NSL 6 /* stat failed (errno = ENOENT) on symbolic link */ /* Values the user-supplied function may wish to assign to component quit of struct FTW... */ #define FTW_SKD 1 /* skip this directory (2nd par = FTW_D) */ #define FTW_SKR 2 /* skip rest of current directory */ #define FTW_FOLLOW 3 /* follow symbolic link */ struct FTW { int quit, base, level; #ifndef FTW_more_to_come }; #endif pe, stat failed */ #define FTW_DP 4 /* directory, postorder visit */ #define FTW_SL 5 /* symbolic link */ #define FTW_NSL 6 /* stat failed (errno = ENOENT) on symbolic link */ /* Values the user-supplied function may wish to assign to compon./class_task.h 666 0 0 12777 2742632524 6512 #class #define SIZE 512 #define MODE DEDICATED #define UNTOUCHED 052525 extern char * calloc(); extern char * malloc(); extern free(); extern class sched * run_chain; /* list of ready to run scheds */ extern class task * task_chain; /* list of all tasks */ extern int task_error(int,class object *); extern void print_error(int); #define E_OLINK 1 #define E_ONEXT 2 #define E_GETEMPTY 3 #define E_PUTOBJ 4 #define E_PUTFULL 5 #define E_BACKOBJ 6 #define E_BACKFULL 7 #define E_SETCLOCK 8 #define E_CLOCKIDLE 9 #define E_RESTERM 10 #define E_RESRUN 11 #define E_NEGTIME 12 #define E_RESOBJ 13 #define E_HISTO 14 #define E_STACK 15 #define E_STORE 16 #define E_TASKMODE 17 #define E_TASKDEL 18 #define E_TASKPRE 19 #define E_TIMERDEL 20 #define E_SCHTIME 21 #define E_SCHOBJ 22 #define E_QDEL 23 #define E_RESULT 24 #define E_WAIT 25 #define MAXERR E_WAIT extern char _hwm; #define hwm() (_hwm=1) class olink /* the building block for chains of task pointers */ { friend object; class olink * l_next; class task * l_task; void new(class task * t, class olink * l) { l_task=t; l_next=l; }; }; class oqueue { friend qhead; friend qtail; int q_max; int q_count; class object * q_ptr; class qhead * q_head; class qtail * q_tail; void new(int m) { q_max=m; q_count=0; q_head=0; q_tail=0; }; void delete() { (q_count)?task_error(E_QDEL,0):0; }; }; /* header file for the task system */ #define TIMER 1 #define TASK 2 #define QHEAD 4 #define QTAIL 5 #define IDLE 1 #define RUNNING 2 #define TERMINATED 4 #define DEDICATED 1 #define SHARED 2 #define CHAIN 1 #define VERBOSE 2 #define STACK 4 extern class task * clock_task; extern class task * thistask; extern long clock; /* typedef int (*PFI)(); extern PFI error_fct; extern PFI exit_fct; */ extern int (*error_fct)(); extern int (*exit_fct)(); #define EMODE 1 #define WMODE 2 #define ZMODE 3 class object { void delete(void); class olink * o_link; public: class object * o_next; int o_type; void new(int t = 0) { o_type=t; o_link=0; o_next=0; }; void remember(class task * t) { o_link = new class olink(t,o_link); }; void forget(class task *); void alert(void); void print(int); }; class sched : public object { friend timer; friend task; friend object; void schedule(void); void insert(int,class object *); void remove(void); long s_time; int s_state; public: void print(int); long rdtime() { return s_time; }; int rdstate() { return s_state; }; void cancel(int); int result(void); }; class timer : public sched { void new(int); void delete(void); public: void reset(int); void print(int); }; class task : public sched { friend sched; void new(char* = 0, int = 0, int = 0); void delete(void); void save(void); void restore(void); int* t_framep; /* WARNING: t_framep is manipulated as an offset by restore() */ int* t_basep; int t_size; int* t_savearea; int t_trap; class team * t_team; int t_mode; int t_stacksize; class object * t_alert; public: class task * t_next; char* t_name; int waitvec(class object **); int waitlist(); void wait(class object * ob) { (void) waitlist(ob,0); }; void delay(int); int preempt(void); void sleep(void); void resultis(int); void print(int); }; class qhead : public object { friend qtail; void new(int=WMODE, int=10000); void delete(void); int qh_mode; class oqueue * qh_queue; public: class object * get(void); int putback(class object *); int rdcount() { return qh_queue->q_count; }; int rdmax() { return qh_queue->q_max; }; int rdmode() { return qh_mode; }; class qtail * tail(void); class qhead * cut(void); void splice(class qtail *); void setmode(int m){ qh_mode = m; }; void setmax(int m) { qh_queue->q_max = m; }; void print(int); }; class qtail : public object { friend qhead; void new(int=WMODE, int=10000); void delete(void); int qt_mode; class oqueue * qt_queue; public: int put(class object *); int rdspace() { return qt_queue->q_max - qt_queue->q_count; }; int rdmax() { return qt_queue->q_max; }; int rdmode() { return qt_mode; }; class qtail * cut(void); void splice(class qhead *); class qhead * head(void); void setmode(int m){ qt_mode = m; }; void setmax(int m) { qt_queue->q_max = m; }; void print(int); }; class histogram /* "nbin" bins covering the range [l:r[ uniformly nbin*binsize == r-l */ { public: int l, r; int binsize; int nbin; int * h; long sum; long sqsum; void new(int=16, int=0, int=16); void add(int); void print(void); }; /* the result of randint() is always >= 0 */ #define DRAW (randx = randx*1103515245 + 12345) #define ABS(x) (x&0x7fffffff) #ifdef pdp11 #define MASK(x) ((x>>16)&077777) #define MAX 32768.0 #endif #ifdef vax #define MASK(x) ABS(x) #define MAX 2147483648.0 #endif class randint /* uniform distribution in the interval [0,MAX] */ { long randx; public: void new(long s=0) { randx=s; }; void seed(long s) { randx=s; }; int draw() { return MASK(DRAW); }; float fdraw() { return ABS(DRAW)/MAX; }; }; class urand : public randint /* uniform distribution in the interval [low,high] */ { public: int low, high; void new(int l, int h) { low=l; high=h; }; int draw() { return (int) (low + (high - low) * (randint.draw()/MAX) ); }; }; extern double log(); class erand : public randint /* exponential distribution random number generator */ { public: int mean; void new(int m) { mean=m; }; int draw() { return (int) (-mean * log( (double) (MAX-randint.draw())/MAX) ); }; }; a./class_object.h 666 0 0 1 2742633032 6662 () { return ABS(DRAW)/MAX; }; }; class urand : public randint /* uniform distribution in the interval [low,high] */ { public: int low, high; void new(int l, int h) { low=l; high=h; }; int draw() { return (int) (low + (high - low) * (randint.draw()/MAX) ); }; }; extern double log(); class erand : public randint /* exponential distribution random number generator */ { public: int mean; void new(int m) { mean=m; }; int draw() { return (int) (-mean * log( (double) (MAX-randint.draw())/MAX) ); }; }; a./local.h 666 0 0 65 2476306436 5364 #define VAX #define VMUNIX #define SYSTEM "/vmunix" lic randint /* uniform distribution in the interval [low,high] */ { public: int low, high; void new(int l, int h) { low=l; high=h; }; int draw() { return (int) (low + (high - low) * (randint.draw()/MAX) ); }; }; extern double log(); class erand : public randint /* exponential distribution random number generator */ { public: int mean; void new(int m) { mean=m; }; int draw() { return (int) (-mean * log( (double) (MAX-randint.draw())/MAX) ); }; }; a./dkmgr.h 664 0 0 1171 3676061664 5437 /* * structure returned by dkmgr() * for an incoming call from datakit */ struct mgrmsg { short m_chan ; /* chanel number of call */ short m_tstamp ; /* time stamp of msg from controller */ short m_traffic ; /* traffic type requested */ char * m_dial ; /* pointer to dialstring */ char * m_service ; /* pointer to service name requested */ char * m_source ; /* pointer to source-id of call */ char * m_origin ; /* pointer to node.mod.chan */ char * m_uid ; /* pointer to userid string from source */ char * m_param1 ; /* pointer to first param from source */ char * m_param2 ; /* pointer to second */ } ; l number of call */ short m_tstamp ; /* time stamp of msg from controller */ short m_traffic ; /* traffic type requested */ char * m_dial ; /* pointer to dialstring */ char * m_service ; /* pointer to service name requested */ char * m_source ; /* pointer to source-id of call */ char * m_origin ; /* pointer to node.mod.chan */ char * m_uid ; /* pointer to userid string from./iplot.h 664 0 0 4050 3325267232 5447 #define arc(_x,_y,_X,_Y,_u,_v,_r) printf("a %d %d %d %d %d %d %d\n",_x,_y,_X,_Y,_u,_v,_r) #define box(_x,_y,_X,_Y) printf("bo %d %d %d %d\n", _x,_y,_X,_Y) #define bspline(_num,_ff) {printf("bs {\n"); putnum(_num,_ff); printf("}\n");} #define call(_sname,_x) printf("ca %s %d\n", _sname,_x) #define cfill(_s) printf("cf %s\n", _s) #define circle(_x,_y,_r) printf("ci %d %d %d\n", _x,_y,_r) #define closepl() printf("cl\n") #define color(_s) printf("co %s\n", _s) #define cspline(_num,_ff) {printf("cs {\n"); putnum(_num,_ff); printf("}\n");} #define pdefine(_sname, _str) printf("de %s {\n%s\n",_sname, _str) #define dspline(_num,_ff) {printf("ds {\n");putnum(_num,_ff);printf("}\n");} #define erase() printf("e\n") #define ffill(_s) printf("ff %s\n", _s) #define fill(_num,_ff) {printf("fi {\n"); putnum(_num,_ff); printf("}\n");} #define fpoly(_s) printf("fp %s\n", _s) #define frame(_x,_y,_X,_Y) printf("fr %g %g %g %g\n", _x,_y,_X,_Y) #define fspline(_s) printf("fs %s\n", _s) #define grade(_x) printf("g %d\n", _x) #define idle() #define line(_x1,_y1,_x2,_y2) printf("li %d %d %d %d\n", _x1,_y1,_x2,_y2) #define lspline(_num,_ff) {printf("ls {\n"); putnum(_num,_ff); printf("}\n");} #define move(_x, _y) printf("m %d %d\n", _x, _y) #define openpl() printf("o\n") #define parabola(_x,_y,_X,_Y,_u,_v) printf("\npa %d %d %d %d %d %d\n", _x,_y,_X,_Y,_u,_v) #define pen(_s) printf("pe %s\n", _s) #define point(_x,_y) printf("poi %d %d\n", _x,_y) #define poly(_num,_ff) {printf("pol {\n"); putnum(_num,_ff); printf("}\n");} #define ppause() printf("pp\n") #define range(_x,_y,_X,_Y) printf("ra %d %d %d %d\n", _x,_y,_X,_Y) #define restore() printf("re\n") #define rmove(_x,_y) printf("rm %d %d\n", _x,_y) #define rvec(_x,_y) printf("rv %d %d\n", _x,_y) #define save() printf( "sa\n") #define sbox(_x,_y,_X,_Y) printf("sb %d %d %d %d\n", _x,_y,_X,_Y) #define spline(_num,_ff) {printf("sp {\n"); putnum(_num,_ff); printf("}\n");} #define text(_s) {if(*(_s) == ' ')printf("t \"%s\"\n",_s); else printf("t %s\n", _s); } #define vec(_x,_y) printf("v %d %d\n", _x,_y) define range(_x,_y,_X,_Y) printf("ra %d %d %d %d\n", _x,_y,_X,_Y) #define restore() printf("re\n") #define rmove(_x,_y) printf("rm %d %d\n", _x,_y) #define rvec(_x,_y) printf("rv %d %d\n", _x,_y) #define save() printf( "sa\n") #define sbox(_x,_y,_X,_Y) printf("sb %d %d %d %d\n", _x,_y,_X,_Y) #define spline(_num,_ff) {printf("sp {\n"); putnum(_num,_ff); printf("}\n");} #define text(_s) {if(*(_s) == ' ')printf("t \"%s\"\n",_s); else printf("t %s\n", _s); } #define./cbt.h 664 0 0 5415 4115040226 5064 #ifdef TEST #define NDSZ 64 #else #define NDSZ 1024/* for real systems (larger may be slower) */ #endif #define MAXKLEN (NDSZ/4)-8 #if MAXKLEN > 255 #undef MAXKLEN #define MAXKLEN 255 #endif #define MXHT 5 typedef long ndaddr; /* for communication with users */ typedef struct { char *mdata; unsigned short mlen; } mbuf; typedef struct bfile { struct bfile *next; struct hdr *path[MXHT + 1]; char height, advnc, rdwrt, flag[MXHT + 1]; ndaddr loc[MXHT + 1]; int tfd, dfd; char *fname, *altname; struct rdptr { struct dkey *rptr; /* current dkey */ short rnum; /* its ordinal */ char rpref[MAXKLEN]; /* first dcom bytes of its key */ } rdptr; char fatal; /* this bfile can't be used */ } bfile; extern bfile *bopen(); extern mbuf bkey(); #define BERROR 100 /* first btree value of errno */ #define BUTRAN BERROR + 0 /* user caused tran abort */ #define BNOWRITE BERROR + 1 /* not opened for writing */ #define BIOWRT BERROR + 2 /* wrote short record */ #define BNOMEM BERROR + 3 /* no mem from malloc */ #define BFATAL BERROR + 4 /* last chance for user */ #define BTALL BERROR + 5 /* tree becoming taller than MXHT */ #define BRDERR BERROR + 6 /* read short record or read error */ #define BLASTE BERROR + 7 /* one past last btree value of errno */ extern int errno; /* users can ignore the rest of this stuff */ /* keys in nodes */ typedef struct dkey { unsigned char dlen; /* total size of structure */ char dcom; /* bytes in common with preceding */ char dkey[MAXKLEN]; /* rest of key */ } dkey; #define DKEYSZ 2 /* overhead in dkey */ /* node header */ typedef struct hdr { long hstamp; /* for owning process */ short kcnt; /* keys in node */ char htype; char hlev; } hdr; typedef struct { short tfree; /* free bytes in node, at end for triv checking */ } trailer; #define nfree(p) ((trailer *)((char *)(p) + NDSZ - sizeof(trailer)))->tfree #define SHARED 1 #define INDEX 2 #define READONLY 4 #define bf_type(b, t) ((b)->path[0]->htype & (t)) #define treeonly(b) bf_type(b, INDEX) #define shared(b) bf_type(b, SHARED) #define readonly(b) bf_type(b, READONLY) /* disk addresses */ typedef struct { long lloc; unsigned short llen; } lfaddr; #define ndadr(b, j) ((ndaddr *)((char *)(b) + NDSZ - sizeof(trailer)) - (j) - 1) #define lfadr(b, j) ((lfaddr *)((char *)(b) + NDSZ - sizeof(trailer)) - (j) - 1) #define mustwrite(bf, n) bf->flag[n] /* for getincore */ /* node format: * hdr, dkey, dkey, dkey, ..., space, adr, adrn, ..., adr0, trailer */ extern int bdump; /* dump on first fatal error */ extern long tranid, getlpid(); /* unique transaction id */ #ifndef EOF #ifndef NULL #define NULL 0 #endif #define EOF -1 #endif #define NOTFOUND 0 #define FOUND 1 #define alloc(x) (x *)malloc(sizeof(x)) #define stamped(b) b->hstamp == tranid #define FNAMELEN 256 /*1000001111101111*/ sizeof(trailer)) - (j) - 1) #define mustwrite(bf, n) bf->flag[n] /* for getincore */ /* node format: * hdr, dkey, dkey, dkey, ..., space, adr, adrn, ..., adr0, trailer */ extern int bdump; /* dump on first fatal error */ extern long tranid./ndir.h 664 0 0 2161 4403245060 5246 /* Copyright (c) 1982 Regents of the University of California */ /* and modified by pjw in 1986 */ /* * this must be a power of 2 and a multiple of all the ones in the system */ #define DIRBLKSIZ 512 /* * This limits the directory name length. Its main constraint * is that it appears twice in the user structure. (u. area) in bsd systems */ #define MAXNAMLEN 255 struct direct { unsigned long d_ino; short d_reclen; short d_namlen; char d_name[MAXNAMLEN + 1]; /* typically shorter */ }; struct _dirdesc { int dd_fd; long dd_loc; /* where we left off in dd_buf */ long dd_size; /* bytes back from system */ long dd_offset; /* lseek at beginning of dd_buf */ char dd_buf[DIRBLKSIZ]; }; /* * useful macros. */ #define NDIRSIZ(dp) \ ((sizeof(struct direct) - MAXNAMLEN + (dp)->d_namlen + sizeof(ino_t) - 1) &\ ~(sizeof(ino_t) - 1)) typedef struct _dirdesc DIR; #ifndef NULL #define NULL 0 #endif /* * functions defined on directories */ extern DIR *opendir(); extern struct direct *readdir(); extern long telldir(); extern void seekdir(); #define rewinddir(dirp) seekdir((dirp), 0) extern void closedir(); long dd_offset; /* lseek at beginning of dd_buf */ char dd_buf[DIRBLKSIZ]; }; /* * useful macros. */ #define NDIRSIZ(dp) \ ((sizeof(struct direct) - MAXNAMLEN + (dp)->d_namlen + sizeof(ino_t) - 1) &\ ~(sizeof(ino_t) - 1)) typedef struct _dirdesc DIR; #ifndef NULL #define NULL 0 #endif /* * functions defined on directories */ extern DIR *opendir(); extern struct direct *readdir(); ./odk.h 666 0 0 10552 2460020172 5110 /* * This file defines message structures and codes * shared by the common control (cmc), listener, * and programs that call the common control. */ /* * library routine declarations (libdk.c) * for a program that actually touches the switch. */ extern long cmread(); extern long ocmread(); /* * switch commands */ #define RAM_ON 0226 #define ROM_ON 0322 #define R_CNTL 0264 #define W_CNTL 0170 /* * Principal message structure. */ struct dialout { char type; /* message type */ char srv; /* service requested */ short param0; /* parameters */ short param1; short param2; short param3; short param4; short param5; }; /* * dialout struct for MPX mode output. */ struct xmsg { char x_ochan; char x_esc; char x_type; char x_srv; short x_param0; short x_param1; short x_param2; short x_param3; short x_param4; short x_param5; }; /* * dialout structure as received by cmc. */ struct dialin { short i_vhn; /* virtual host number */ short i_rchan; /* channel calling */ struct dialout dial; }; /* * dialout structure as received with * ICHAN mode on (used by listener, terminal manager). */ struct listenin { short l_lchan; char l_type; char l_srv; short l_param0; short l_param1; short l_param2; short l_param3; short l_param4; short l_param5; }; /* * message types */ #define T_SRV 1 /* request for server process */ #define T_LOC 2 /* generated by driver */ #define T_CHG 3 /* status change on a channel */ #define T_LSTNR 4 /* keep alive msg from listener */ #define T_SYNC 5 /* synchronizer */ #define T_STATUS 6 /* status requests */ #define T_INDIR 7 /* indirect (third party) */ #define T_PROXY 8 /* terminal manager */ #define T_MODE 9 /* cmc modes */ #define T_REPLY 10 /* handshake */ #define T_TH 11 /* terminal handler */ #define T_MAINT 12 /* maintenance msg */ #define T_CMC 13 /* cmc/cmc msg */ #define T_MGR 14 /* manager process */ #define T_MAP 15 /* map a channel somewhere */ #define T_NAME 16 /* access name manager */ /* * server process codes */ #define D_SH 1 /* interactive shell (no login) */ #define D_LOG 2 /* normal login */ #define D_FS 3 /* fdaemon */ #define D_XFS 4 /* xdaemon */ #define D_XSH 5 #define D_YSH 6 #define D_TR 7 #define D_RES2 8 #define D_EXEC 9 /* sh -c */ #define D_AUX 10 /* talk to cmc */ #define D_BOOT 11 /* boot ploglam */ #define D_NULL 12 /* don't do anything */ /* * mgr process codes */ #define MGRBASE 64 #define D_PROC 1 /* cpu manager */ #define D_TIME 2 /* date and time */ #define D_NAME 3 /* name translation */ #define D_TTY 4 /* tty server */ #define D_FMGR 5 /* file name manager */ #define D_FSRV 6 /* file server */ /* * Channel mapping codes */ #define R_MAPTO 1 /* map me to (sw, mod, ch) */ #define R_LSPLICE 2 /* local splice */ #define R_RSPLICE 3 /* remote splice */ /* * T_CHG codes */ #define D_CLOSE 1 /* close a channel */ #define D_ISCLOSED 2 /* channel is closed */ #define D_OPEN 3 /* channel is open */ #define D_OK 3 /* general acknowledgement */ #define D_ACK 3 /* general acknowledgement */ #define D_ACCEPT 4 /* login name accepted */ #define D_FAIL 5 #define D_PLOG 6 /* login name rejected, running login */ #define D_PRY 7 /* pry up channels: inverse of D_NAIL */ #define D_PRYALL 8 /* pry all nailed channels */ #define D_MSG 9 /* msg follows */ #define D_ON 10 /* carrier on */ #define D_OFF 11 /* carrier off */ #define D_WAIT 12 /* delay */ /* * maintenance codes */ #define M_NAIL 1 /* nail down channels */ #define M_PRY 2 /* pry up channels */ #define M_STAT 3 /* read out things */ #define M_TRACE 4 /* control cmc trace verbosity */ #define M_SBOOT 5 /* boot a switch */ #define M_MBOOT 6 /* reset a module */ /* * M_STAT codes */ #define S_MOD 1 /* channel maps for a module */ /* * T_LOC codes */ #define DL_CLOSE 1 /* same as T_CHG */ #define DL_ISCLOSED 2 /* same as T_CHG */ #define DL_OPEN 3 /* channel open */ #define D_TIMER 4 /* 15 sec tick */ /* * TM/TH messages */ #define DM_CLOSE 1 /* same as T_CHG */ #define DM_ISCLOSED 2 /* same as T_CHG */ #define DM_IO 3 /* ioctl */ #define DM_HUP 4 /* hangup */ #define DM_ON 5 /* carrier on */ /* * Boot Protocol */ #define B_HEAD 1 /* load address */ #define B_TAIL 2 /* end of message */ #define B_GO 3 /* jump to start address */ #define NAMEFILE "/usr/dk/netnames" struct dkaddr { short area; short exch; short host; }; struct dkaddr netname(); */ #define D_TIMER 4 /* 15 sec tick */ /* * TM/TH messages */ #define DM_CLOSE 1 /* same as T_CHG */ #define DM_ISCLOSED 2 /* same as T_CHG */./f2c.h 664 0 0 7472 5005607322 5000 /* f2c.h -- Standard Fortran to C header file */ /** barf [ba:rf] 2. "He suggested using FORTRAN, and everybody barfed." - From The Shogakukan DICTIONARY OF NEW ENGLISH (Second edition) */ #ifndef F2C_INCLUDE #define F2C_INCLUDE typedef long int integer; typedef char *address; typedef short int shortint; typedef float real; typedef double doublereal; typedef struct { real r, i; } complex; typedef struct { doublereal r, i; } doublecomplex; typedef long int logical; typedef short int shortlogical; #define TRUE_ (1) #define FALSE_ (0) /* Extern is for use with -E */ #ifndef Extern #define Extern extern #endif /* I/O stuff */ #ifdef f2c_i2 /* for -i2 */ typedef short flag; typedef short ftnlen; typedef short ftnint; #else typedef long flag; typedef long ftnlen; typedef long ftnint; #endif /*external read, write*/ typedef struct { flag cierr; ftnint ciunit; flag ciend; char *cifmt; ftnint cirec; } cilist; /*internal read, write*/ typedef struct { flag icierr; char *iciunit; flag iciend; char *icifmt; ftnint icirlen; ftnint icirnum; } icilist; /*open*/ typedef struct { flag oerr; ftnint ounit; char *ofnm; ftnlen ofnmlen; char *osta; char *oacc; char *ofm; ftnint orl; char *oblnk; } olist; /*close*/ typedef struct { flag cerr; ftnint cunit; char *csta; } cllist; /*rewind, backspace, endfile*/ typedef struct { flag aerr; ftnint aunit; } alist; /* inquire */ typedef struct { flag inerr; ftnint inunit; char *infile; ftnlen infilen; ftnint *inex; /*parameters in standard's order*/ ftnint *inopen; ftnint *innum; ftnint *innamed; char *inname; ftnlen innamlen; char *inacc; ftnlen inacclen; char *inseq; ftnlen inseqlen; char *indir; ftnlen indirlen; char *infmt; ftnlen infmtlen; char *inform; ftnint informlen; char *inunf; ftnlen inunflen; ftnint *inrecl; ftnint *innrec; char *inblank; ftnlen inblanklen; } inlist; #define VOID void union Multitype { /* for multiple entry points */ shortint h; integer i; real r; doublereal d; complex c; doublecomplex z; }; typedef union Multitype Multitype; typedef long Long; struct Vardesc { /* for Namelist */ char *name; char *addr; ftnlen *dims; int type; }; typedef struct Vardesc Vardesc; struct Namelist { char *name; Vardesc **vars; int nvars; }; typedef struct Namelist Namelist; #define abs(x) ((x) >= 0 ? (x) : -(x)) #define dabs(x) (doublereal)abs(x) #define min(a,b) ((a) <= (b) ? (a) : (b)) #define max(a,b) ((a) >= (b) ? (a) : (b)) #define dmin(a,b) (doublereal)min(a,b) #define dmax(a,b) (doublereal)max(a,b) /* procedure parameter types for -A and -C++ */ #define F2C_proc_par_types 1 #ifdef __cplusplus typedef int /* Unknown procedure type */ (*U_fp)(...); typedef shortint (*J_fp)(...); typedef integer (*I_fp)(...); typedef real (*R_fp)(...); typedef doublereal (*D_fp)(...), (*E_fp)(...); typedef /* Complex */ VOID (*C_fp)(...); typedef /* Double Complex */ VOID (*Z_fp)(...); typedef logical (*L_fp)(...); typedef shortlogical (*K_fp)(...); typedef /* Character */ VOID (*H_fp)(...); typedef /* Subroutine */ int (*S_fp)(...); #else typedef int /* Unknown procedure type */ (*U_fp)(); typedef shortint (*J_fp)(); typedef integer (*I_fp)(); typedef real (*R_fp)(); typedef doublereal (*D_fp)(), (*E_fp)(); typedef /* Complex */ VOID (*C_fp)(); typedef /* Double Complex */ VOID (*Z_fp)(); typedef logical (*L_fp)(); typedef shortlogical (*K_fp)(); typedef /* Character */ VOID (*H_fp)(); typedef /* Subroutine */ int (*S_fp)(); #endif /* E_fp is for real functions when -R is not specified */ typedef VOID C_f; /* complex function */ typedef VOID H_f; /* character function */ typedef VOID Z_f; /* double complex function */ typedef doublereal E_f; /* real function with -R not specified */ /* undef any lower-case symbols that your C compiler predefines, e.g.: */ #ifndef Skip_f2c_Undefs #undef unix #undef vax #endif #endif typedef shortlogical (*K_fp)(); typedef /* Character */ VOID (*H_fp)(); typedef /* Subroutine */ int (*S_fp)(); #endif /* E_fp is for real functions when -R is not specified */ typedef VOID C_f; /* ./regexp.h 664 0 0 377 3704313564 5603 /* the structure describing a sub-expression match */ typedef struct { char *sp; char *ep; } regsubexp; /* a compiled regular expression */ typedef char *regexp; /* the routines */ extern regexp *regcomp(); extern int regexec(); extern void regsub(); fndef Skip_f2c_Undefs #undef unix #undef vax #endif #endif typedef shortlogical (*K_fp)(); typedef /* Character */ VOID (*H_fp)(); typedef /* Subroutine */ int (*S_fp)(); #endif /* E_fp is for real functions when -R is not specified */ typedef VOID C_f; /* ./fcntl.h 666 0 0 135 3641572742 5416 /* just the system 5 place holder */ #define O_RDONLY 0 #define O_WRONLY 1 #define O_RDWR 2 } regsubexp; /* a compiled regular expression */ typedef char *regexp; /* the routines */ extern regexp *regcomp(); extern int regexec(); extern void regsub(); fndef Skip_f2c_Undefs #undef unix #undef vax #endif #endif typedef shortlogical (*K_fp)(); typedef /* Character */ VOID (*H_fp)(); typedef /* Subroutine */ int (*S_fp)(); #endif /* E_fp is for real functions when -R is not specified */ typedef VOID C_f; /* ./screen.h 666 0 0 4562 3155315733 5612 typedef int (*pftn)(); #define NULL 0 class backgr { friend figure; friend screen; void new(void); void delete(void); void draw(class line *); char **lines; public: void setc(int, int, char); void sets(int, int, char *); }; struct desc { char x; char y; char c; }; class figure { friend screen; friend field; void new(class screen *, int, struct desc *); void delete(void); void display(void); void update(void); class figure **last; class figure *next; class screen *scr; int active; int f_x; int f_y; int size; struct desc *map; public: void cursor(int); void add(int, int); void remove(void); void move(int, int); void change(void); }; class line { friend screen; void new(void); void delete(void); void clean(void); void fix_lines(void); void redisplay(int, int, int); void fix_chars(class line *, int); char *text; int dirty; int leading; int trailing; long hash; public: void update_vdu(void); void paint(char *); void clr(void); void addch(int x, char c) { text[x] = c; dirty++; }; char *vect(void) { return text; }; }; class screen { friend figure; friend obj; void new(class backgr *); void delete(void); class backgr *bg; class figure *list; class line *image; public: char what(int x, int y) { return image[y].vect()[x]; }; void freeze(void); void thaw(void); void update(void); void clear(void); void display(void); }; class field { void new(class screen *, int); void delete(void); void make_buff(int); void yank(int, int); int cursor_motion(char, int, int, int); char *contents; class figure *fig; int width; struct desc *fdesc; public: char *text(void) { return contents; }; void add(int x, int y) { fig->add(x, y); }; void move(int x, int y) { fig->move(x, y); }; void remove(void) { fig->remove(); }; void display(char *); int read(pftn); int edit(int *); void patch(int, int); }; extern void get_cursor(int *, int *); extern void move_cursor(int, int); extern void screen_init(int, int); extern void beep(void); extern void redraw(void); extern void quit(int); extern int reset_tty(void); extern int set_tty(int); extern char *my_name; /* * Field defines. */ #define ERROR (-2) #define DONE (-1) #define NIL 0 #define CHANGED 1 #define UP 2 #define DOWN 3 #define COMMAND 4 #define EXIT 5 #define cntrl(c) ('c' & 0x1F) ); int read(pftn); int edit(int *); void patch(int, int); }; extern void get_cursor(int *, int *); extern void move_cursor(int, int); e./fio.h 666 0 0 3014 4301220537 5066 #define FIOBSIZE 4096 typedef struct Fbuffer { unsigned char *next; /* next char to be used */ unsigned char *end; /* first invalid char */ unsigned char *lnext; /* previous value of next */ unsigned short flags; /* see FIO_.* below */ short oflush; /* if >= 0 fd to flush on read */ long offset; /* seek of end */ unsigned char buf[FIOBSIZE]; } Fbuffer; extern Fbuffer *Ffb[]; #define FIORESET(f) ((f)->next=(f)->lnext=(f)->end=(f)->buf, (f)->flags&= ~FIO_MALLOCED, (f)->oflush= -1) #define FIOSET(f, fd) if((f=Ffb[fd&=0x7f]) == 0){Finit(fd,(char *)0);f=Ffb[fd];} /* FIOLINELEN is length of last input */ #define FIOLINELEN(fd) (((int)(Ffb[fd]->next - Ffb[fd]->lnext))-1) /* FIOSEEK is lseek of next char to be processed */ #define FIOSEEK(fd) (Ffb[fd]->offset - (Ffb[fd]->end - Ffb[fd]->next)) #define FIOFLUSH(fd) if((fd >= 0) && Ffb[fd]) Fflush(fd) #define FIO_RDLAST 0x0001 /* true if last input was rdline */ #define FIO_WRITING 0x0002 /* true if last action was write */ #define FIO_MALLOCED 0x0004 /* set if Finit did the malloc */ extern void Finit(); extern char *Frdline(); extern void Fundo(); extern int Fgetc(); extern long Fread(); extern long Fwrite(); extern long Fseek(); extern int Fflush(); #ifdef FIO_IMP /* COUNT is the type of counts to things like read, write, memcpy etc */ #ifdef GNOT #define COUNT long #define FIOMALLOC(n) malloc(n) #define SEEK(a,b,c) seek(a,b,c) #else #define COUNT int #define FIOMALLOC(n) malloc(n) #define SEEK(a,b,c) lseek(a,b,c) #endif extern COUNT read(), write(); #endif Finit did the malloc */ extern void Finit(); extern char *Frdline(); extern void Fundo(); extern int Fgetc(); extern long Fread(); extern long Fwrite(); extern long Fseek(); extern int Fflush(); #ifdef FIO_IMP /* COUNT is the type of counts to things like read, write, memcpy etc */ #ifdef GNOT #define COUNT long #define FIOMALLOC(n) malloc(n) #define SEEK(a,b,c) seek(a,b,c) #else #define COUNT int #define FIOMALLOC(n) malloc(n) #define SEEK(a,b,c) lseek(a,b,c) #endif extern COUNT read(), writ./sets.h 666 0 0 446 3157770202 5264 /* * Set manipulation macros for use with programs preprocessed * by sets(1). */ #define in(s, c) (((s)[((int)c)>>3]) & (1<<(((int)c)&07))) #define insert(s, c) (((s)[((int)c)>>3]) |= (1<<(((int)c)&07))) #define delete(s,c) (((s)[((int)c)>>3]) &= ~(1<<(((int)c)&07))) typedef char *setptr; */ #ifdef GNOT #define COUNT long #define FIOMALLOC(n) malloc(n) #define SEEK(a,b,c) seek(a,b,c) #else #define COUNT int #define FIOMALLOC(n) malloc(n) #define SEEK(a,b,c) lseek(a,b,c) #endif extern COUNT read(), writ./db.h 666 0 0 6332 3161755265 4722 /* * ========= * // * // "db" database management system * ========== * // // Copyright (C) 1983 * // // Electroacoustic Creations * // ========= Forestville NSW * // * // * ========= */ /* * Database types. */ typedef struct Db_t db_t; typedef struct Rec_t rec_t; typedef long iaddr_t; /* * Field: fundamental data type. * * f_data - points to the data (plus a NUL) * f_size - is the size in bytes */ typedef struct Field_t { char *f_data; int f_size; } field_t; /* * Multiple. * * Count plus array of fields. */ typedef struct Mult_t { field_t *m_vec; int m_count; } mult_t; /* * A component, single or multiple. */ typedef union comp_t { field_t c_f; mult_t c_m; } comp_t; /* * A record (instance). Member of a linked list. */ struct Rec_t { comp_t *r_vec; rec_t *r_next; }; /* * A vector of addresses plus a count. */ typedef struct Addr_t { iaddr_t *a_vec; int a_count; } addr_t; /* * An entry descriptor. */ typedef struct Ent_t { int e_count; char **e_nvec; int *e_fvec; } ent_t; #if vax #define SAVE_LEN 10 #endif #if pdp11 #define SAVE_LEN 3 #endif #ifndef SAVE_LEN @ "SAVE_LEN not defined" #endif typedef struct { int save_vec[SAVE_LEN]; } save_t; /* * Database error types. */ typedef enum Errtype { et_bad_address, et_change_unique, et_communicate, et_delete_nonempty, et_incomplete, et_internal, et_length, et_locked, et_memory, et_mismatch, et_no_key, et_not_found, et_not_locked, et_not_unique, et_not_your_lock, et_readonly, et_redefinition, et_syntax, et_system, et_timeout, et_too_many_locked, et_unknown, } errtype; extern void d_a_data(); extern iaddr_t d_a_end(); extern void d_a_mend(); extern void d_a_mstart(); extern void d_a_pstart(); extern void d_a_pdata(); extern void d_a_pend(); extern void d_a_start(); extern void d_all_unlock(); extern void d_c_data(); extern void d_c_end(); extern void d_c_mend(); extern void d_c_mstart(); extern void d_c_start(); extern void d_close(); extern addr_t *d_cp_addr(); extern ent_t *d_cp_ent(); extern void d_d_all(); extern void d_d_at(); extern void d_d_key(); extern void d_d_re(); extern void d_dele(); extern addr_t *d_diff_addr(); extern rec_t *d_f_all(); extern rec_t *d_f_at(); extern rec_t *d_f_ents(); extern rec_t *d_f_key(); extern rec_t *d_f_re(); extern addr_t *d_fa_all(); extern addr_t *d_fa_key(); extern addr_t *d_fa_re(); extern void d_fr_addr(); extern void d_fr_ent(); extern field_t *d_getd(); extern ent_t *d_gete(); extern field_t *d_geti(); extern field_t *d_getn(); extern addr_t *d_inter_addr(); extern void d_lock(); extern db_t *d_open(); extern void d_putd(); extern void d_pute(); extern void d_puti(); extern void d_putn(); extern void d_save(); extern void d_stats(); extern void d_sync(); extern void d_restore(); extern addr_t *d_uniq_addr(); extern addr_t *d_union_addr(); extern void d_unlock(); extern void d_wait_lock(); extern char *d_error; extern db_t *d_errdb; extern errtype d_errtype; extern int d_buffs; #define d_catch(d) setjmp((int *)d) #define D_RDONLY 17 #define D_RDWR 18 #define NC_ADDR 8 /* * Name flags. */ #define N_MULT 0x01 #define N_UNIQ 0x02 #define N_KEY 0xF0 #define K_WORD 0x20 #define K_ALL 0x40 void d_save(); extern void d_stats(); extern void d_sync(); extern void d_restore(); extern addr_t *d_uniq_addr(); extern addr_t *d_union_addr(); extern void d_unlock(); extern void d_wait_lock(); extern char *d_error; extern db_t *d_errdb; extern errtype d_errtype; extern int d_buffs; #def./getflags.h 664 0 0 327 4461401356 6076 #define NFLAG 128 #define NCMDLINE 512 #define NGETFLAGSARGV 256 extern char **flag[NFLAG]; extern char cmdline[NCMDLINE+1]; extern char *cmdname; extern char *flagset[]; extern char *getflagsargv[NGETFLAGSARGV+2]; 40 void d_save(); extern void d_stats(); extern void d_sync(); extern void d_restore(); extern addr_t *d_uniq_addr(); extern addr_t *d_union_addr(); extern void d_unlock(); extern void d_wait_lock(); extern char *d_error; extern db_t *d_errdb; extern errtype d_errtype; extern int d_buffs; #def./picfile.h 666 0 0 2315 4523603512 5733 /* * Not working: TYPE=ccitt-g31, TYPE=ccitt-g32, TYPE=ccitt-g4, TYPE=ccir601. * picconf.c has unimplemented TYPEs commented out. */ typedef struct PICFILE{ int fd; int nchan; int x, y; int width, height; char *type; char *chan; char *cmap; int argc; char **argv; int flags; int line; char *buf; char *ebuf; char *bufp; int (*rd)(), (*wr)(), (*cl)(); }PICFILE; #define PIC_NCHAN(p) ((p)->nchan) #define PIC_WIDTH(p) ((p)->width) #define PIC_HEIGHT(p) ((p)->height) #define PIC_XOFFS(p) ((p)->x) #define PIC_YOFFS(p) ((p)->y) #define PIC_RECT(p) Rect((p)->x, (p)->y, (p)->x+(p)->width, (p)->y+(p)->height) /* needs */ #define PIC_SAMEARGS(p) (p)->type, (p)->x, (p)->y, (p)->width, (p)->height, (p)->chan, argv, (p)->cmap #define picread(f, buf) (*(f)->rd)(f, buf) #define picwrite(f, buf) (*(f)->wr)(f, buf) PICFILE *picopen_r(); PICFILE *picopen_w(); PICFILE *picputprop(); char *picgetprop(); void picclose(), picpack(), picunpack(); /* * Private data */ char *PIC_command; char *PIC_error; #define PIC_NOCLOSE 1 /* don't close p->fd on picclose */ #define PIC_INPUT 2 /* open for input */ struct PIC_conf{ char *type; int (*rd)(); int (*wr)(); int (*cl)(); int nchan; }PIC_conf[]; (p)->height, (p)->chan, argv, (p)->cmap #define picread(f, buf) (*(f)->rd)(f, buf) #define picwrite(f, buf) (*(f)->wr)(f, buf) PICFILE *picopen_r(); PICFILE *picopen_w(); PICFILE *picputprop(); char *picgetprop(); void picclose(), picpack(), picunpack(); /* * Private data */ char *PIC_command; char *PI./jstructs.h 664 0 0 2157 3540616504 6206 #ifndef JSTRUCTS_H #define JSTRUCTS_H /* * 32 bit host */ #define WORDSHIFT 5 #define WORDSIZE 32 #define WORDMASK (WORDSIZE-1) #define ONES 0xFFFFFFFF #define FIRSTBIT ((unsigned)0x80000000) #define LASTBIT ((unsigned)0x1) /* * Graphics definitions */ typedef int Word; /* 32 bits */ typedef unsigned int UWord; /* 32 bits */ typedef struct Point { short x; short y; } Point; typedef struct Rectangle { Point origin; Point corner; } Rectangle; typedef struct Bitmap { Word *base; /* pointer to start of data */ unsigned width; /* width in 32 bit words of total data area */ Rectangle rect; /* rectangle in data area, local coords */ char *_null; /* unused, always zero */ } Bitmap; typedef struct Texture32 { Word bits[32]; } Texture32; typedef struct Texture { short bits[16]; } Texture; #define muldiv(a,b,c) ((long)((a)*((long)b)/(c))) /* * Function Codes */ typedef int Code; #define F_STORE ((Code) 0) /* target = source */ #define F_OR ((Code) 1) /* target |= source */ #define F_CLR ((Code) 2) /* target &= ~source */ #define F_XOR ((Code) 3) /* target ^= source */ Bitmap *balloc(); #endif angle in data area, local coords */ char *_null; /* unused, always zero */ } Bitmap; typedef struct Texture32 { Word bits[32]; } Texture32; typedef struct Texture { short bits[16]; } Texture; #define muldiv(a,b,c) ((long)((a)*((long)b)/(c))) /* * Function Codes */ typedef int Code; #define F_STORE ((Code) 0) /* target = source */ #define F_OR ((Code) 1) /* target |= source */ #define F_CL./plot.h 664 0 0 4067 3331212130 5266 #include #define arc(_x,_y,_X,_Y,_u,_v,_r) printf("a %g %g %g %g %g %g %g\n",_x,_y,_X,_Y,_u,_v,_r) #define box(_x,_y,_X,_Y) printf("bo %g %g %g %g\n", _x,_y,_X,_Y) #define bspline(_num,_ff) {printf("bs {\n"); putnum(_num,_ff); printf("}\n");} #define call(_sname,_x) printf("ca %s %g\n", _sname,_x) #define cfill(_s) printf("cf %s\n", _s) #define circle(_x,_y,_r) printf("ci %g %g %g\n", _x,_y,_r) #define closepl() printf("cl\n") #define color(_s) printf("co %s\n", _s) #define cspline(_num,_ff) {printf("cs {\n"); putnum(_num,_ff); printf("}\n");} #define pdefine(_sname,_str) printf("de %s {\n%s\n",_sname,_str) #define dspline(_num,_ff) {printf("ds {\n");putnum(_num,_ff);printf("}\n");} #define erase() printf("e\n") #define ffill(_s) printf("ff %s\n", _s) #define fill(_num,_ff) {printf("fi {\n"); putnum(_num,_ff); printf("}\n");} #define fpoly(_s) printf("fp %s\n", _s) #define frame(_x,_y,_X,_Y) printf("fr %g %g %g %g\n", _x,_y,_X,_Y) #define fspline(_s) printf("fs %s\n", _s) #define grade(_x) printf("g %g\n", _x) #define idle() #define line(_x1,_y1,_x2,_y2) printf("li %g %g %g %g\n", _x1,_y1,_x2,_y2) #define lspline(_num,_ff) {printf("ls {\n"); putnum(_num,_ff); printf("}\n");} #define move(_x, _y) printf("m %g %g\n", _x, _y) #define openpl() printf("o\n") #define parabola(_x,_y,_X,_Y,_u,_v) printf("\npa %g %g %g %g %g %g\n", _x,_y,_X,_Y,_u,_v) #define pen(_s) printf("pe %s\n", _s) #define point(_x,_y) printf("poi %g %g\n", _x,_y) #define poly(_num,_ff) {printf("pol {\n"); putnum(_num,_ff); printf("}\n");} #define ppause() printf("pp\n") #define range(_x,_y,_X,_Y) printf("ra %g %g %g %g\n", _x,_y,_X,_Y) #define restore() printf("re\n") #define rmove(_x,_y) printf("rm %g %g\n", _x,_y) #define rvec(_x,_y) printf("rv %g %g\n", _x,_y) #define save() printf( "sa\n") #define sbox(_x,_y,_X,_Y) printf("sb %g %g %g %g\n", _x,_y,_X,_Y) #define spline(_num,_ff) {printf("sp {\n"); putnum(_num,_ff); printf("}\n");} #define text(_s) {if(*(_s)== ' ')printf("t \"%s\"\n",_s); else printf("t %s\n", _s); } #define vec(_x,_y) printf("v %g %g\n", _x,_y) #define range(_x,_y,_X,_Y) printf("ra %g %g %g %g\n", _x,_y,_X,_Y) #define restore() printf("re\n") #define rmove(_x,_y) printf("rm %g %g\n", _x,_y) #define rvec(_x,_y) printf("rv %g %g\n", _x,_y) #define save() printf( "sa\n") #define sbox(_x,_y,_X,_Y) printf("sb %g %g %g %g\n", _x,_y,_X,_Y) #define spline(_num,_ff) {printf("sp {\n"); putnum(_num,_ff); printf("}\n");} #define text(_s) {if(*(_s)== ' ')printf("t \"%s\"\n",_s); else printf("t %s\n",./DB.h 664 0 0 5567 3377747054 4637 /* PBLKSIZ is the maximum length of a key/record pair */ /* DBLKSIZ * BYTESIZE yeilds # Pblocks filled per Dblock */ /* tunable size of Pblock in bytes (max is 64K) */ #define PBLKSIZ (64L*1024L) /* tunable size of Dblock in bytes (min is 512) */ #define DBLKSIZ 4096L /* size of char in bits */ #define BYTESIZ 8 #ifndef NULL #define NULL ((char *) 0) #endif NULL /* data structures private to DB: */ /* structure of a Pblock: */ typedef struct { union { unsigned short P_off[PBLKSIZ / sizeof (unsigned short)]; char P_dat[PBLKSIZ]; } p_u; } Pblock; #define p_off p_u.P_off #define p_dat p_u.P_dat /* structure of a Dblock: */ typedef struct { char d_bits[DBLKSIZ]; } Dblock; /* public data types: */ /* key and record data structure */ typedef struct { char * dptr; int dsize; } datum; /* the state of a DB file */ typedef struct { /* public data: */ int d_flags; /* flags; see below */ char * d_name; /* name of the database file */ /* private data: */ /* page file info: */ int d_pfd; /* page file descriptor */ long d_pblk; /* block number of page file */ Pblock * d_pbuf; /* buffer for page file */ /* direct file info: */ int d_dfd; /* direct file descriptor */ long d_dblk; /* block number of direct file */ Dblock * d_dbuf; /* buffer for direct file */ /* hashing info: */ long d_hbit; /* bit number */ long d_hmask; /* hash mask */ long d_hnbit; /* maximum bit # */ } DBFILE; /* flag bits in d_flags: */ #define DB_RONLY 0x0001 /* this database is read only */ #define DB_SYNC 0x0002 /* sync() on every write (ouch!) */ #define DB_PMOD 0x0004 /* disk is out of date with respect to d_pbuf */ #define DB_DMOD 0x0008 /* disk is out of date with respect to d_dbuf */ #define DB_CREATE 0x0010 /* create database files if they don't exist */ #define DB_LOCK 0x0020 /* database is locked */ /* user settable flags: */ #define DB_USER (DB_RONLY|DB_SYNC|DB_CREATE) /* public functions defined in DB: */ extern DBFILE * DBopen(); /*(char *name, int flags) open a DB file*/ extern void DBclose(); /*(DBFILE *dp) close a DB file*/ extern void DBsync(); /*(DBFILE *dp) flush any modified buffers*/ extern datum DBget(); /*(DBFILE *dp, datum key) get rec at key*/ extern int DBdel(); /*(DBFILE *dp, datum key) del rec at key*/ extern int DBput(); /*(DBFILE *dp, datum key, datum rec) put rec at key*/ extern datum DBkey0(); /*(DBFILE *dp) get lowest key*/ extern datum DBkeyn(); /*(DBFILE *dp, datum key) get next key*/ extern int DBlock(); /*(DBFILE *dp) lock a DB file */ extern int DBunlock();/*(DBFILE *dp) unlock a DB file */ /* public data defined in DB */ extern int DBdebug; /* DB debugging level */ #define DBDBCORE 0 /* errors that produce core files */ #define DBDBERR 1 /* errors less catastrophic */ #define DBDBWARN 2 /* various warnings */ #define DBDBINFO 3 /* entry/exit info for DB*() above */ #define DBdbprt(level) if ((level) <= DBdebug) fprintf ern datum DBkeyn(); /*(DBFILE *dp, datum key) get next key*/ extern int DBlock(); /*(DBFILE *dp) lock a DB file */ extern int DBunlock(./fb.h 666 0 0 6411 3541721453 4714 #include #define ITIADDR (('F'<<8)|0) /* get Unibus device address */ /* * hardware registers */ typedef struct fbreg{ struct chanreg{ short x, y, pan, scroll; unsigned char vid, csr, j0, j1, mask, j2, z, j3; }grn, alf, red, blu; struct mapreg{ unsigned char data, addr, sele, csr; }map; }fbreg; fbreg *snare(); typedef struct point{ int x, y; }Point; typedef struct rectangle{ Point origin, corner; }Rectangle; typedef struct color{ unsigned char r, g, b, a; }Color; #ifdef lint Color Rgb(), Rgba(); #else #define Rgb(r, g, b) Rgba(r, g, b, 255) #define Rgba(r, g, b, a) (((r)&255)|(((g)&255)<<8)|(((b)&255)<<16)|((a)<<24)) #endif typedef struct hsva{ short h; /* won't fit in a char. nuts. */ unsigned char s, v, a; }Hsva; Color hsv2rgb(); Hsva rgb2hsv(); /* * new picture file definitions * used by openpic[rw], readpic, writepic, etc. */ typedef struct picfile{ int fd; char *file; Rectangle r; int nchan; int type; unsigned char *cmap; char **argv; unsigned char *buf, *bufp, *hwm, *ebuf; int cnt, write; struct picfile *next; }PICFILE; /* * PICFILE types */ #define F_RUNCODE 1 #define F_DUMP 2 #define F_PICO 3 PICFILE *openpicr(), *openpicw(); #define F_UNCOVERED 1.701411733192644270e38 /* large value to indicate no z */ #define fbr fb.rect #define or origin #define co corner struct fb{ Rectangle rect; int colors; char gotflags; char cheat; fbreg *addr; int fd; char *cmd; PICFILE *picfiles; }fb; char *progname; #define F_RED 1 #define F_GRN 2 #define F_BLU 4 #define F_ALF 8 #define F_Z 16 /* * [red,grn,blu,alf].csr defines */ #define F_IX 0x5 #define F_DX 0x4 #define F_IY 0xa #define F_DY 0x8 #define F_IR 0x10 #define F_IW 0x20 #define F_IXW (F_IX|F_IW) #define F_IYW (F_IY|F_IW) #define F_IXR (F_IX|F_IR) #define F_IYR (F_IY|F_IR) #define F_DXW (F_DX|F_IW) #define F_DYW (F_DY|F_IW) #define F_DXR (F_DX|F_IR) #define F_DYR (F_DY|F_IR) #define F_CLR 0x40 /* * [red,grn,blu,alf].vid defines */ #define F_MAG1 0 /* magnify x1 */ #define F_MAG2 6 /* magnify x2 */ /* * constructors for points and rectangles -- good only in argument lists */ #ifdef lint Point Pt(); Rectangle Rect(), Rpt(); #else #define Pt(x, y) (x), (y) #define Rect(a, b, c, d) (a), (b), (c), (d) #define Rpt(a, b) a, b #endif Point add(), sub(), mul(), div(); Rectangle inset(), raddp(), rsubp(), rcanon(), rdiv(), rmul(), rdivp(), rmulp(); #define F_SY 32 /* Y scale for hotdog lines, etc. */ #define F_SX (F_SY*5/4) /* X scale for hotdog lines, etc. */ /* * A font file contains a struct fonthead, followed by fonthead.nchr copies * of struct chr, followed by run-coded descriptions of each character. * The runs are stored as an 8 bit count (actually 1 less than the count) and * an 8 bit value. No run spans the end of a scanline. */ #define FONTMAGIC 1138 /* magic number */ struct fonthead{ short magic; /* FONTMAGIC */ short nfontchar; /* normally 137 */ short size; /* nominal size in pixels */ char name[16]; /* name[15]=='\0' */ }; struct fontchar{ short xlo, ylo, xhi, yhi;/* bounding box of character */ long addr; /* address in file of runs, 0 if no char */ }; /* * incore structure used by fbfontopen, fbfontdraw */ struct fbfont{ short nfontchar; struct fbfontchar{ Rectangle r; unsigned char *bits; }*fontchar; }; struct fbfont *fbfontopen(); gic number */ struct fonthead{ short magic; /* FONTMAGIC */ short nfontchar; /* normally 137 */ short size; /* nominal size in pixels */ char name[16]; /* name[15]=='\0' */ }; struct fontchar{ short xlo, ylo, xhi, yhi;/* bounding box of ch./string.h 664 0 0 300 3574135257 5607 extern char *strcpy(), *strncpy(), *strcat(), *strncat(), *strchr(), *strrchr(), *strpbrk(), *strtok(), *strdup(); extern int strcmp(), strncmp(), strlen(), strspn(), strcspn(); e r; unsigned char *bits; }*fontchar; }; struct fbfont *fbfontopen(); gic number */ struct fonthead{ short magic; /* FONTMAGIC */ short nfontchar; /* normally 137 */ short size; /* nominal size in pixels */ char name[16]; /* name[15]=='\0' */ }; struct fontchar{ short xlo, ylo, xhi, yhi;/* bounding box of ch./tmpnam.h 666 0 0 102 3700610340 5555 #define P_tmpdir "/tmp/" #define L_tmpnam (sizeof(P_tmpdir) + 15) rchr(), *strrchr(), *strpbrk(), *strtok(), *strdup(); extern int strcmp(), strncmp(), strlen(), strspn(), strcspn(); e r; unsigned char *bits; }*fontchar; }; struct fbfont *fbfontopen(); gic number */ struct fonthead{ short magic; /* FONTMAGIC */ short nfontchar; /* normally 137 */ short size; /* nominal size in pixels */ char name[16]; /* name[15]=='\0' */ }; struct fontchar{ short xlo, ylo, xhi, yhi;/* bounding box of ch./cin.h 664 0 0 21322 4660620615 5113 /* Copyright 1984,1985,1986,1987,1988,1989,1990 AT&T Bell Laboratories */ #if defined(__STDC__) || defined(__cplusplus) extern int cin_break(char *name, int line, char *string); #else /* defined(__STDC__) || defined(__cplusplus)*/ extern int cin_break(); #endif /* defined(__STDC__) || defined(__cplusplus)*/ #if defined(__STDC__) || defined(__cplusplus) extern struct enode *cin_compile(struct enode *code); #else /* defined(__STDC__) || defined(__cplusplus)*/ extern struct enode *cin_compile(); #endif /* defined(__STDC__) || defined(__cplusplus)*/ #if defined(__STDC__) || defined(__cplusplus) extern int cin_dump(char *name); #else /* defined(__STDC__) || defined(__cplusplus)*/ extern int cin_dump(); #endif /* defined(__STDC__) || defined(__cplusplus)*/ #if defined(__STDC__) || defined(__cplusplus) extern int cin_epp(char *func); #else /* defined(__STDC__) || defined(__cplusplus)*/ extern int cin_epp(); #endif /* defined(__STDC__) || defined(__cplusplus)*/ #if defined(__STDC__) || defined(__cplusplus) extern struct enode *cin_eprint(struct enode *code); #else /* defined(__STDC__) || defined(__cplusplus)*/ extern struct enode *cin_eprint(); #endif /* defined(__STDC__) || defined(__cplusplus)*/ #if defined(__STDC__) || defined(__cplusplus) extern char *cin_error_code_set(char *message, char *string); #else /* defined(__STDC__) || defined(__cplusplus)*/ extern char *cin_error_code_set(); #endif /* defined(__STDC__) || defined(__cplusplus)*/ #if defined(__STDC__) || defined(__cplusplus) extern struct enode *cin_eval(struct enode *code); #else /* defined(__STDC__) || defined(__cplusplus)*/ extern struct enode *cin_eval(); #endif /* defined(__STDC__) || defined(__cplusplus)*/ #if defined(__STDC__) || defined(__cplusplus) extern struct ident *cin_find_ident(char *name); #else /* defined(__STDC__) || defined(__cplusplus)*/ extern struct ident *cin_find_ident(); #endif /* defined(__STDC__) || defined(__cplusplus)*/ #if defined(__STDC__) || defined(__cplusplus) extern struct nlist *cin_find_nlist(unsigned long addr); #else /* defined(__STDC__) || defined(__cplusplus)*/ extern struct nlist *cin_find_nlist(); #endif /* defined(__STDC__) || defined(__cplusplus)*/ #if defined(__STDC__) || defined(__cplusplus) extern void cin_info(char *string); #else /* defined(__STDC__) || defined(__cplusplus)*/ extern void cin_info(); #endif /* defined(__STDC__) || defined(__cplusplus)*/ #if defined(__STDC__) || defined(__cplusplus) extern void(*cin_info_set(char *string, void(*routine)()))(); #else /* defined(__STDC__) || defined(__cplusplus)*/ extern void(*cin_info_set())(); #endif /* defined(__STDC__) || defined(__cplusplus)*/ #if defined(__STDC__) || defined(__cplusplus) extern int cin_load(char *string); #else /* defined(__STDC__) || defined(__cplusplus)*/ extern int cin_load(); #endif /* defined(__STDC__) || defined(__cplusplus)*/ #if defined(__STDC__) || defined(__cplusplus) extern int cin_log(char *name); #else /* defined(__STDC__) || defined(__cplusplus)*/ extern int cin_log(); #endif /* defined(__STDC__) || defined(__cplusplus)*/ #if defined(__STDC__) || defined(__cplusplus) extern char *cin_ltof(int line); #else /* defined(__STDC__) || defined(__cplusplus)*/ extern char *cin_ltof(); #endif /* defined(__STDC__) || defined(__cplusplus)*/ #if defined(__STDC__) || defined(__cplusplus) extern void cin_make(char *string); #else /* defined(__STDC__) || defined(__cplusplus)*/ extern void cin_make(); #endif /* defined(__STDC__) || defined(__cplusplus)*/ #if defined(__STDC__) || defined(__cplusplus) extern void cin_pop(int level); #else /* defined(__STDC__) || defined(__cplusplus)*/ extern void cin_pop(); #endif /* defined(__STDC__) || defined(__cplusplus)*/ #if defined(__STDC__) || defined(__cplusplus) extern int cin_pp(char *func, int level); #else /* defined(__STDC__) || defined(__cplusplus)*/ extern int cin_pp(); #endif /* defined(__STDC__) || defined(__cplusplus)*/ #if defined(__STDC__) || defined(__cplusplus) extern struct enode *cin_print(struct enode *code, int level); #else /* defined(__STDC__) || defined(__cplusplus)*/ extern struct enode *cin_print(); #endif /* defined(__STDC__) || defined(__cplusplus)*/ #if defined(__STDC__) || defined(__cplusplus) extern void cin_quit(); #else /* defined(__STDC__) || defined(__cplusplus)*/ extern void cin_quit(); #endif /* defined(__STDC__) || defined(__cplusplus)*/ #if defined(__STDC__) || defined(__cplusplus) extern struct enode *cin_read(char *string); #else /* defined(__STDC__) || defined(__cplusplus)*/ extern struct enode *cin_read(); #endif /* defined(__STDC__) || defined(__cplusplus)*/ #if defined(__STDC__) || defined(__cplusplus) extern int cin_reset(); #else /* defined(__STDC__) || defined(__cplusplus)*/ extern int cin_reset(); #endif /* defined(__STDC__) || defined(__cplusplus)*/ #if defined(__STDC__) || defined(__cplusplus) extern void cin_return(); #else /* defined(__STDC__) || defined(__cplusplus)*/ extern void cin_return(); #endif /* defined(__STDC__) || defined(__cplusplus)*/ #if defined(__STDC__) || defined(__cplusplus) extern void cin_run(char *string); #else /* defined(__STDC__) || defined(__cplusplus)*/ extern void cin_run(); #endif /* defined(__STDC__) || defined(__cplusplus)*/ #if defined(__STDC__) || defined(__cplusplus) extern char *cin_slashify(char *string); #else /* defined(__STDC__) || defined(__cplusplus)*/ extern char *cin_slashify(); #endif /* defined(__STDC__) || defined(__cplusplus)*/ #if defined(__STDC__) || defined(__cplusplus) extern int cin_spy(char *func, char *name, char *mod, char *ref); #else /* defined(__STDC__) || defined(__cplusplus)*/ extern int cin_spy(); #endif /* defined(__STDC__) || defined(__cplusplus)*/ #if defined(__STDC__) || defined(__cplusplus) extern void cin_step(); #else /* defined(__STDC__) || defined(__cplusplus)*/ extern void cin_step(); #endif /* defined(__STDC__) || defined(__cplusplus)*/ #if defined(__STDC__) || defined(__cplusplus) extern void cin_stepin(); #else /* defined(__STDC__) || defined(__cplusplus)*/ extern void cin_stepin(); #endif /* defined(__STDC__) || defined(__cplusplus)*/ #if defined(__STDC__) || defined(__cplusplus) extern void cin_stepout(); #else /* defined(__STDC__) || defined(__cplusplus)*/ extern void cin_stepout(); #endif /* defined(__STDC__) || defined(__cplusplus)*/ #if defined(__STDC__) || defined(__cplusplus) extern int cin_stopin(char *func, char *string); #else /* defined(__STDC__) || defined(__cplusplus)*/ extern int cin_stopin(); #endif /* defined(__STDC__) || defined(__cplusplus)*/ #if defined(__STDC__) || defined(__cplusplus) extern char *cin_sync(char *string); #else /* defined(__STDC__) || defined(__cplusplus)*/ extern char *cin_sync(); #endif /* defined(__STDC__) || defined(__cplusplus)*/ #if defined(__STDC__) || defined(__cplusplus) extern void cin_system(); #else /* defined(__STDC__) || defined(__cplusplus)*/ extern void cin_system(); #endif /* defined(__STDC__) || defined(__cplusplus)*/ #if defined(__STDC__) || defined(__cplusplus) extern int cin_unbreak(char *name, int line, char *string); #else /* defined(__STDC__) || defined(__cplusplus)*/ extern int cin_unbreak(); #endif /* defined(__STDC__) || defined(__cplusplus)*/ #if defined(__STDC__) || defined(__cplusplus) extern int cin_unload(char *name); #else /* defined(__STDC__) || defined(__cplusplus)*/ extern int cin_unload(); #endif /* defined(__STDC__) || defined(__cplusplus)*/ #if defined(__STDC__) || defined(__cplusplus) extern int cin_unspy(char *func, char *name, char *mod, char *ref); #else /* defined(__STDC__) || defined(__cplusplus)*/ extern int cin_unspy(); #endif /* defined(__STDC__) || defined(__cplusplus)*/ #if defined(__STDC__) || defined(__cplusplus) extern int cin_unstopin(char *func, char *string); #else /* defined(__STDC__) || defined(__cplusplus)*/ extern int cin_unstopin(); #endif /* defined(__STDC__) || defined(__cplusplus)*/ #if defined(__STDC__) || defined(__cplusplus) extern int cin_unwrapper(char *func, void(*before)(), void(*after)()); #else /* defined(__STDC__) || defined(__cplusplus)*/ extern int cin_unwrapper(); #endif /* defined(__STDC__) || defined(__cplusplus)*/ #if defined(__STDC__) || defined(__cplusplus) extern int cin_view(char *name); #else /* defined(__STDC__) || defined(__cplusplus)*/ extern int cin_view(); #endif /* defined(__STDC__) || defined(__cplusplus)*/ #if defined(__STDC__) || defined(__cplusplus) extern int cin_wrapper(char *func, void(*before)(), void(*after)()); #else /* defined(__STDC__) || defined(__cplusplus)*/ extern int cin_wrapper(); #endif /* defined(__STDC__) || defined(__cplusplus)*/ extern int cin_argc; extern char **cin_argv; extern int cin_err_fd; extern char *cin_filename; extern int cin_in_fd; extern int cin_level; extern char *cin_libpath; extern int cin_lineno; extern int cin_out_fd; extern char *cin_prompt; extern struct stackelem *cin_stack; extern struct view *cin_views; plus) extern int cin_wrapper(char *func, void(*before)(), void(*after)()); #else /* defined(__STDC__) || defined(__cplusplus)*/ extern int cin_wrapper(); #endif /* defined(__STDC__) || defined(__cplusplus)*/ extern int cin_argc; extern char **cin_argv; extern int cin_err_fd; extern char *cin_filename./ipc.h 664 0 0 2650 4353257621 5102 /* information returned by listen */ typedef struct { int rfd; /* fd for reply */ int cfd; /* fd for communications */ char *myname; /* translated part of name */ char *name; /* untranslated part of name */ char *param; /* parameters used to set up call */ char *machine; /* machine id of caller */ char *user; /* user name of caller */ int uid, gid; /* uid, gid of caller */ char flags; /* type of communication */ } ipcinfo; /* communication flags */ #define IPC_OPEN 0x0 /* open an original connection */ #define IPC_CREAT 0x1 /* create a server channel */ #define IPC_HANDOFF 0x2 /* pass a request onto someone else */ #define IPC_CAREFUL 0x4 /* check protections before opening file */ #define IPC_REDIAL 0x8 /* this means ask the network to redial * the call as the new machine and user */ /* library definitions */ extern int ipcopen(); extern int ipccreat(); extern ipcinfo *ipclisten(); extern ipcinfo *ipctrylisten(); extern int ipcaccept(); extern int ipcdaccept(); extern int ipcreject(); extern int ipclogin(); extern int ipcrogin(); extern char *ipcpath(); extern int ipcexec(); /* import */ extern int errno; extern char *errstr; extern char *ipcname; /* qnet stuff */ typedef struct qtuple{ struct qtuple *next; char *value; char *type; } Qtuple; typedef struct qset{ struct qset *next; Qtuple *this; } Qset; extern Qset *qset(); extern char *qvalue(); extern int freeQtuple(); extern int freeQset(); ctrylisten(); extern int ipcaccept(); extern int ipcdaccept(); extern int ipcreject(); e./dkwindow.h 664 0 0 4106 3716030523 6143 /* URP window-size negotiation. * * The 16 bits of the window-size argument are defined as: * * ----------------------------------------------------------------- * |valid| spare | originator | destination | traffic | * | | | window size | window size | | * ----------------------------------------------------------------- * 1 3 4 4 4 * * The "valid" bit equals 1 to indicate that the window size values * are specified. Zero means they should be ignored and that default * values must be used instead. Old controllers that do not have * window size negotiation happen to set this bit to zero, fortunately. * * The actual window size is computed from the 4-bit window size * parameter (n) as 2**(n+4). Thus, window sizes range from 16 to * 512K bytes. * * The originator of a call sets his "originator window size" to be * less than or equal to the size of his receive buffer, and he * requests through the "destination window size" the size of the * buffer that he would like to use for transmission. As the call * is being set up, trunk processes and the destination line process * may lower either or both window sizes. The resulting window sizes * are returned to the originator in the call ANSWER message. */ #ifndef MIN #define MIN(x,y) (x < y ? x : y) #endif /* Format originator, destination, and traffic values */ #define WINDOW(o,d,t) ((o<<8) | (d<<4) | t | 0100000) #define W_VALID(x) (x & 0100000) #define W_ORIG(x) ((x>>8) & 017) #define W_DEST(x) ((x>>4) & 017) #define W_TRAF(x) (x & 017) #define W_DESTMAX(x,y) (WINDOW(W_ORIG(x),MIN(W_DEST(x),y),W_TRAF(x))) #define W_LIMIT(x,y) (WINDOW(MIN(W_ORIG(x),y),MIN(W_DEST(x),y),W_TRAF(x))) #define W_VALUE(x) (1<<(x+4)) #define WS_16 0 #define WS_32 1 #define WS_64 2 #define WS_128 3 #define WS_256 4 #define WS_512 5 #define WS_1K 6 #define WS_2K 7 #define WS_4K 8 #define WS_8K 9 #define WS_16K 10 #define WS_32K 11 #define WS_64K 12 #define WS_128K 13 #define WS_256K 14 #define WS_512K 15 W_DEST(x) ((x>>4) & 017) #define W_TRAF(x) (x & 017) #define W_DESTMAX(x,y) (WINDOW(W_ORIG(x),MIN(W_DEST(x),y),W_TRAF(x))) #define W_LIMIT(x,y) (WINDOW(MIN(W_ORIG(x),y),MIN(W_DEST(x),y),W_TRAF(x))) #define W_VALUE(x) (1<<(x+4)) #define WS_16 0 #define WS_32 1 #define WS_64 2 #define WS_128 3 #define WS_256 4 #define WS_512 5 #define WS_1K 6 #define WS_2K 7 #define WS_4K 8 #define WS_8K 9 #define WS_16K 10 #define WS_32K 11 #defi./Y.h 664 0 0 3137 4031564602 4531 typedef unsigned char byte; typedef struct Point { short x, y; } Point; #define Pt(x,y) ((((unsigned short)(y))<<16)|((unsigned short)(x))) extern Point add(), sub(), midpt(); typedef struct Rectangle { Point min, max; } Rectangle; #define Rect(a,b,c,d) Pt(a,b), Pt(c,d) #define Rpt(a,b) a, b extern Rectangle inset(), raddp(), rsubp(), rcanon(); typedef struct Color { byte r, g, b, a; } Color; #define Col(r,g,b,a) ((((byte)(a))<<24)|(((byte)(b))<<16)|(((byte)(g))<<8)|((byte)(r))) typedef struct Font { char name[32]; short index; byte sizex, sizey; } Font; typedef struct Gcontext { Color c; Font *f; short mode; short curson; Point p; Rectangle cdest; /* rectangle containing the cursor on screen */ Rectangle csrc; /* rectangle source for cursor */ Point coffset; /* offset (rel to csrc.min) of focus */ Color cmap[256]; } Gcontext; extern Gcontext gc[]; #define GC_STORE 0 #define GC_CLR 1 #define GC_SET 2 #define GC_OR 3 #define GC_XOR 4 #define GC_AND 5 /* separate flags */ #define GC_CURSORON 1 #define GC_CRECT 2 #define NMBUF 65536 typedef struct Window { char name[32]; short fd; short id; short bits; Rectangle r; char *bp; char buf[NMBUF]; } Window; extern Window *newwindow(); extern void *ymalloc(); extern void arc(), sarc(), bitblt(), dbox(), fbox(), circle(), getcmap(); extern void setcolor(), offcursor(), setcursor(), defcursor(), flush(), line(); extern void lineto(), pan(), wrpix(), dpolygon(), fpolygon(), reset(), sync(); extern void zoom(), setmode(), overlay(), setpoint(), setcmap(); extern int getmode(); extern Point getpoint(); #define NWINDOWS 16 32]; short fd; short id; short bits; Rectangle r; char *bp; char buf[NMBUF]; } Window; extern Window *newwindow(); extern void *ymalloc(); extern void arc(), sarc(), bitblt(), dbox(), fbox(), circle(), getcmap(); extern void setcolor(), offcursor(), setcursor(), defcursor(), flush(), line(); extern void lineto(), pan(), wrpix(), dpolygon(), fpolygon(), reset(), sync(); extern void zoom(), setmode(), overlay./label.h 664 0 0 2610 4326450036 5375 /* * The size and shape of a security label. * Logically this stuff belongs in param.h and types.h, * but it seems wise to keep it in one easily-checked * place, rather than diffused. */ #ifndef L_BITS #define LABSIZ 60 /* just fits with di_mode in a disk inode */ #define L_UNDEF 0 /* no valid value yet */ #define L_YES 1 /* the universally permissive label */ #define L_NO 2 /* the universally restrictive label */ #define L_BITS 3 /* this one is in the lattice */ #define F_LOOSE 0 /* label may rise automatically */ #define F_FROZEN 1 /* label may not rise automatically */ #define F_RIGID 2 /* permafrost; changeable with T_EXTERN */ #define F_CONST 3 /* changeable by nobody */ #define T_SETPRIV 1 /* may set file privs */ #define T_SETLIC 2 /* may change licences */ #define T_NOCHK 4 /* exempt from label checking */ #define T_EXTERN 8 /* may change shape of label arena */ #define T_UAREA 16 /* may write in u area */ #define T_LOG 32 /* may execute syslog() call */ struct labpriv { unsigned int lp_junk : 16, lp_flag : 2, lp_fix : 2, /* frozen */ lp_t : 6, /* capabilities */ lp_u : 6; /* licences */ }; struct label { struct labpriv lb_priv; unsigned char lb_bits[LABSIZ]; # define lb_flag lb_priv.lp_flag # define lb_fix lb_priv.lp_fix # define lb_t lb_priv.lp_t # define lb_u lb_priv.lp_u }; #ifdef KERNEL #include "sys/jlabel.h" #endif #endif L_BITS T_UAREA 16 /* may write in u area */ #define T_LOG 32 /* may execute syslog() call */ struct labpriv { unsigned int lp./values.h 664 0 0 10331 4232503246 5632 /* @(#)values.h 1.17 */ #ifndef BITSPERBYTE /* These values work with any binary representation of integers * where the high-order bit contains the sign. */ /* a number used normally for size of a shift */ #if gcos #define BITSPERBYTE 9 #else #define BITSPERBYTE 8 #endif #define BITS(type) (BITSPERBYTE * (int)sizeof(type)) /* short, regular and long ints with only the high-order bit turned on */ #define HIBITS ((short)(1 << BITS(short) - 1)) #define HIBITI (1 << BITS(int) - 1) #define HIBITL (1L << BITS(long) - 1) /* largest short, regular and long int */ #define MAXSHORT ((short)~HIBITS) #define MAXINT (~HIBITI) #define MAXLONG (~HIBITL) /* various values that describe the binary floating-point representation * _EXPBASE - the exponent base * DMAXEXP - the maximum exponent of a double (as returned by frexp()) * FMAXEXP - the maximum exponent of a float (as returned by frexp()) * DMINEXP - the minimum exponent of a double (as returned by frexp()) * FMINEXP - the minimum exponent of a float (as returned by frexp()) * MAXDOUBLE - the largest double ((_EXPBASE ** DMAXEXP) * (1 - (_EXPBASE ** -DSIGNIF))) * MAXFLOAT - the largest float ((_EXPBASE ** FMAXEXP) * (1 - (_EXPBASE ** -FSIGNIF))) * MINDOUBLE - the smallest double (_EXPBASE ** (DMINEXP - 1)) * MINFLOAT - the smallest float (_EXPBASE ** (FMINEXP - 1)) * DSIGNIF - the number of significant bits in a double * FSIGNIF - the number of significant bits in a float * DMAXPOWTWO - the largest power of two exactly representable as a double * FMAXPOWTWO - the largest power of two exactly representable as a float * _IEEE - 1 if IEEE standard representation is used * _DEXPLEN - the number of bits for the exponent of a double * _FEXPLEN - the number of bits for the exponent of a float * _HIDDENBIT - 1 if high-significance bit of mantissa is implicit * LN_MAXDOUBLE - the natural log of the largest double -- log(MAXDOUBLE) * LN_MINDOUBLE - the natural log of the smallest double -- log(MINDOUBLE) */ #if u3b || u3b5 || u3b2 #define MAXDOUBLE 1.79769313486231470e+308 #define MAXFLOAT ((float)3.40282346638528860e+38) #define MINDOUBLE 4.94065645841246544e-324 #define MINFLOAT ((float)1.40129846432481707e-45) #define _IEEE 1 #define _DEXPLEN 11 #define _HIDDENBIT 1 #define DMINEXP (-(DMAXEXP + DSIGNIF - _HIDDENBIT - 3)) #define FMINEXP (-(FMAXEXP + FSIGNIF - _HIDDENBIT - 3)) #endif #if pdp11 || vax #define MAXDOUBLE 170141183460469229370504062281061498880.0 #define MAXFLOAT 170141173319264429905852091742258462720.0 /* The following is kludged because the PDP-11 compilers botch the simple form. The kludge causes the constant to be computed at run-time on the PDP-11, even though it is still "folded" at compile-time on the VAX. */ #define MINDOUBLE (0.01 * 2.938735877055718770e-37) #define MINFLOAT ((float)MINDOUBLE) #define _IEEE 0 #define _DEXPLEN 8 #define _HIDDENBIT 1 #define DMINEXP (-DMAXEXP) #define FMINEXP (-FMAXEXP) #endif #if gcos #define MAXDOUBLE 1.7014118346046923171e+38 #define MAXFLOAT ((float)1.7014118219281863150e+38) #define MINDOUBLE 2.9387358770557187699e-39 #define MINFLOAT ((float)MINDOUBLE) #define _IEEE 0 #define _DEXPLEN 8 #define _HIDDENBIT 0 #define DMINEXP (-(DMAXEXP + 1)) #define FMINEXP (-(FMAXEXP + 1)) #endif #if u370 #define _LENBASE 4 #else #define _LENBASE 1 #endif #define _EXPBASE (1 << _LENBASE) #define _FEXPLEN 8 #define DSIGNIF (BITS(double) - _DEXPLEN + _HIDDENBIT - 1) #define FSIGNIF (BITS(float) - _FEXPLEN + _HIDDENBIT - 1) #define DMAXPOWTWO ((double)(1L << BITS(long) - 2) * \ (1L << DSIGNIF - BITS(long) + 1)) #define FMAXPOWTWO ((float)(1L << FSIGNIF - 1)) #define DMAXEXP ((1 << _DEXPLEN - 1) - 1 + _IEEE) #define FMAXEXP ((1 << _FEXPLEN - 1) - 1 + _IEEE) #define LN_MAXDOUBLE (M_LN2 * DMAXEXP) #define LN_MINDOUBLE (M_LN2 * (DMINEXP - 1)) #define H_PREC (DSIGNIF % 2 ? (1L << DSIGNIF/2) * M_SQRT2 : 1L << DSIGNIF/2) #define X_EPS (1.0/H_PREC) #define X_PLOSS ((double)(long)(M_PI * H_PREC)) #define X_TLOSS (M_PI * DMAXPOWTWO) #define M_LN2 0.69314718055994530942 #define M_PI 3.14159265358979323846 #define M_SQRT2 1.41421356237309504880 #define MAXBEXP DMAXEXP /* for backward compatibility */ #define MINBEXP DMINEXP /* for backward compatibility */ #define MAXPOWTWO DMAXPOWTWO /* for backward compatibility */ #endif UBLE (M_LN2 * (DMINEXP - 1)) #define H_PREC (DSIGNIF % 2 ? (1L << DSIGNIF/2) * M_SQRT2 : 1L << DSIGNIF/2) #define X_EPS (1.0/H_PREC) #define X_PLOSS ((double)(long)(M_PI * H_PREC)) #define X_TLOSS (M_PI * DMAXPOWTWO) #define M_LN2 0.69314718055994530942 #define M_PI 3.14159265358979323846 #defi./utsname.h 664 0 0 141 4325125100 5735 struct utsname { char sysname[32]; char nodename[32]; char release[32]; char version[32]; }; e MINBEXP DMINEXP /* for backward compatibility */ #define MAXPOWTWO DMAXPOWTWO /* for backward compatibility */ #endif UBLE (M_LN2 * (DMINEXP - 1)) #define H_PREC (DSIGNIF % 2 ? (1L << DSIGNIF/2) * M_SQRT2 : 1L << DSIGNIF/2) #define X_EPS (1.0/H_PREC) #define X_PLOSS ((double)(long)(M_PI * H_PREC)) #define X_TLOSS (M_PI * DMAXPOWTWO) #define M_LN2 0.69314718055994530942 #define M_PI 3.14159265358979323846 #defi./lcc/ 775 0 0 0 5404716332 4624 ./lcc/assert.h 664 0 0 407 5404716115 6343 #ifndef __ASSERT #define __ASSERT void assert(int); #endif /* __ASSERT */ #undef assert #ifdef NDEBUG #define assert(ignore) ((void)0) #else extern int _assert(char *, unsigned); #define assert(e) ((void)((e)||_assert(__FILE__, __LINE__))) #endif /* NDEBUG */ ÷´ÿT>à´ÿø´ÿ and sector T>ü´ÿµÿbad[126]; }; #iRNEL144r`#$5404716332"<,µÿø´ÿlcc 4624"<Hµÿµÿ Ƽ+üÿÿoTµÿ£5ÀÀ+£†pµÿ^%´í,./lcc/ctype.h 664 0 0 1773 5404716115 6215 #ifndef __CTYPE #define __CTYPE extern int isalnum(int); extern int isalpha(int); extern int iscntrl(int); extern int isdigit(int); extern int isgraph(int); extern int islower(int); extern int isprint(int); extern int ispunct(int); extern int isspace(int); extern int isupper(int); extern int isxdigit(int); extern int tolower(int); extern int toupper(int); #define __U 01 #define __L 02 #define __N 04 #define __S 010 #define __P 020 #define __C 040 #define __B 0100 #define __X 0200 extern unsigned char _ctype[]; #define isalnum(c) ((_ctype+1)[c]&(__U|__L|__N)) #define isalpha(c) ((_ctype+1)[c]&(__U|__L)) #define iscntrl(c) ((_ctype+1)[c]&__C) #define isdigit(c) ((_ctype+1)[c]&__N) #define isgraph(c) ((_ctype+1)[c]&(__P|__U|__L|__N)) #define islower(c) ((_ctype+1)[c]&__L) #define isprint(c) ((_ctype+1)[c]&(__P|__U|__L|__N|__B)) #define ispunct(c) ((_ctype+1)[c]&__P) #define isspace(c) ((_ctype+1)[c]&__S) #define isupper(c) ((_ctype+1)[c]&__U) #define isxdigit(c) ((_ctype+1)[c]&__X) #endif /* __CTYPE */ r _ct./lcc/float.h 664 0 0 1633 5404716116 6172 #ifndef __FLOAT #define __FLOAT #define FLT_ROUNDS 1 #define FLT_RADIX 2 #define FLT_DIG 6 #define FLT_EPSILON 1.1920928955078125e-07 #define FLT_MANT_DIG 24 #define FLT_MAX 1.7014117331926443e+38 #define FLT_MAX_10_EXP 38 #define FLT_MAX_EXP 127 #define FLT_MIN 2.9387358770557188e-39 #define FLT_MIN_10_EXP -38 #define FLT_MIN_EXP -127 #define DBL_DIG 16 #define DBL_EPSILON 2.7755575615628914e-17 #define DBL_MANT_DIG 56 #define DBL_MAX 1.7014118346046923e+38 #define DBL_MAX_10_EXP 38 #define DBL_MAX_EXP 127 #define DBL_MIN 2.9387358770557188e-39 #define DBL_MIN_10_EXP -38 #define DBL_MIN_EXP -127 #define LDBL_MANT_DIG DBL_MANT_DIG #define LDBL_EPSILON DBL_EPSILON #define LDBL_DIG DBL_DIG #define LDBL_MIN_EXP DBL_MIN_EXP #define LDBL_MIN DBL_MIN #define LDBL_MIN_10_EXP DBL_MIN_10_EXP #define LDBL_MAX_EXP DBL_MAX_EXP #define LDBL_MAX DBL_MAX #define LDBL_MAX_10_EXP DBL_MAX_10_EXP #endif /* __FLOAT */ ine DBL_MANT_DIG 56 #define DBL_MAX 1.7014118346046923e+38 #define DBL_MAX_10_EXP 38 #define DBL_MAX./lcc/limits.h 664 0 0 752 5404716116 6347 #ifndef __LIMITS #define __LIMITS #define CHAR_BIT 8 #define MB_LEN_MAX 1 #define UCHAR_MAX 0xff #define USHRT_MAX 0xffff #define UINT_MAX 0xffffffff #define ULONG_MAX 0xffffffffL #define CHAR_MAX SCHAR_MAX #define SCHAR_MAX 0x7f #define SHRT_MAX 0x7fff #define INT_MAX 0x7fffffff #define LONG_MAX 0x7fffffffL #define CHAR_MIN SCHAR_MIN #define SCHAR_MIN (-SCHAR_MAX-1) #define SHRT_MIN (-SHRT_MAX-1) #define INT_MIN (-INT_MAX-1) #define LONG_MIN (-LONG_MAX-1) #endif /* __LIMITS */ EXP 38 #define DBL_MAX./lcc/locale.h 664 0 0 1241 5404716116 6317 #ifndef __LOCALE #define __LOCALE #define LC_ALL 0 #define LC_COLLATE 1 #define LC_CTYPE 2 #define LC_MONETARY 3 #define LC_NUMERIC 4 #define LC_TIME 5 #define NULL 0 struct lconv { char *decimal_point; char *thousands_sep; char *grouping; char *int_curr_symbol; char *currency_symbol; char *mon_decimal_point; char *mon_thousands_sep; char *mon_grouping; char *positive_sign; char *negative_sign; char int_frac_digits; char frac_digits; char p_cs_precedes; char p_sep_by_space; char n_cs_precedes; char n_sep_by_space; char p_sign_posn; char n_sign_posn; }; char *setlocale(int, const char *); struct lconv *localeconv(void); #endif /* __LOCALE */ e NULL 0 struct lconv { char *decimal_point; char *thousands_sep; char *grouping; char *int_curr_symbol; char *currency_symbol; char *mon_decimal_point; char *mon_thousands_sep; char *mon_grouping; char *positive_sign; char *negative_sign; char int_frac_digits; char frac_digits; char p_cs_precedes; char p_sep_by_space; char n_cs_prec./lcc/math.h 664 0 0 1362 5404716116 6015 #ifndef __MATH #define __MATH #define HUGE_VAL 1.7014118346046923e+38 extern double acos(double); extern double asin(double); extern double atan(double); extern double atan2(double, double); extern double cos(double); extern double sin(double); extern double tan(double); extern double cosh(double); extern double sinh(double); extern double tanh(double); extern double exp(double); extern double frexp(double, int *); extern double ldexp(double, int); extern double log(double); extern double log10(double); extern double modf(double, double *); extern double pow(double, double); extern double sqrt(double); extern double ceil(double); extern double fabs(double); extern double floor(double); extern double fmod(double, double); #endif /* __MATH */ le); extern double tan(double); extern double cosh(double); extern double sinh(double); extern double tanh(double); extern double exp(double); extern double frexp(double, int *); extern double ldexp(double, int); extern double log(double); extern double log10(double); e./lcc/setjmp.h 664 0 0 204 5404716116 6340 #ifndef __SETJMP #define __SETJMP typedef int jmp_buf[10]; int setjmp(jmp_buf); void longjmp(jmp_buf, int); #endif /* __SETJMP */ rn double fabs(double); extern double floor(double); extern double fmod(double, double); #endif /* __MATH */ le); extern double tan(double); extern double cosh(double); extern double sinh(double); extern double tanh(double); extern double exp(double); extern double frexp(double, int *); extern double ldexp(double, int); extern double log(double); extern double log10(double); e./lcc/signal.h 664 0 0 545 5404716116 6323 #ifndef __SIGNAL #define __SIGNAL typedef int sig_atomic_t; #define SIG_DFL ((void (*)(int))0) #define SIG_ERR ((void (*)(int))-1) #define SIG_IGN ((void (*)(int))1) #define SIGABRT 6 #define SIGFPE 8 #define SIGILL 4 #define SIGINT 2 #define SIGSEGV 11 #define SIGTERM 15 void (*signal(int, void (*)(int)))(int); int raise(int); #endif /* __SIGNAL */ extern double exp(double); extern double frexp(double, int *); extern double ldexp(double, int); extern double log(double); extern double log10(double); e./lcc/stdarg.h 664 0 0 1176 5404716116 6353 #ifndef __STDARG #define __STDARG typedef char *va_list; #define va_start(list, start) ((void)(list = (sizeof(start)<4 ? (char *)((int *)&(start)+1) : \ (char *)(&(start)+1)))) #define va_end(list) ((void)0) #define __va_arg(list, mode, n) *(mode *)(&(list += ((sizeof(mode)+n)&~n))[-(int)((sizeof(mode)+n)&~n)]) #define _bigendian_va_arg(list, mode, n) (\ sizeof(mode)==1 ? *(mode *)(&(list += 4)[-1]) : \ sizeof(mode)==2 ? *(mode *)(&(list += 4)[-2]) : __va_arg(list, mode, n) ) #define _littleendian_va_arg(list, mode, n) __va_arg(list, mode, n) #define va_arg(list, mode) _littleendian_va_arg(list, mode, 3U) #endif /* __STDARG */ ar *)((int *)&(start)+1) : \ (char *)(&(start)+1)))) #define va_end(list) ((void)0) #define __va_arg(list, mode, n) *(mode *)(&(list += ((sizeof(mode)+n)&~n))[-(int)((sizeof(mode)+n)&~n)]) #define _bigendian_va_arg(list, mode, n) (\ sizeof(mode)==1 ? *(mode *)(&(list += 4)[-1]) : \ sizeof(mode)==2 ? *(mode *)(&(list += 4)[-2]) : __va_arg(list, mode, n) ) #define _littleendian_va_arg(./lcc/stddef.h 664 0 0 616 5404716116 6316 #ifndef __STDDEF #define __STDDEF #define NULL 0 #define offsetof(ty,mem) ((size_t)((char*)&((ty*)0)->mem - (char*)0)) typedef long ptrdiff_t; #if !defined(_SIZE_T) && !defined(_SIZE_T_) #define _SIZE_T #define _SIZE_T_ typedef unsigned size_t; #endif #if !defined(_WCHAR_T) && !defined(_WCHAR_T_) #define _WCHAR_T #define _WCHAR_T_ typedef unsigned char wchar_t; #endif #endif /* __STDDEF */ )[-1]) : \ sizeof(mode)==2 ? *(mode *)(&(list += 4)[-2]) : __va_arg(list, mode, n) ) #define _littleendian_va_arg(./lcc/stdio.h 664 0 0 5105 5404716116 6205 #ifndef __STDIO #define __STDIO #define _IOFBF 0 #define _IOLBF 0200 #define _IONBF 04 #define BUFSIZ 4096 #define EOF (-1) extern struct _iobuf { int _cnt; unsigned char *_ptr; unsigned char *_base; short _flag; char _file; } _iob[]; #define FILE struct _iobuf #define FILENAME_MAX 256 #define FOPEN_MAX 100 typedef long fpos_t; #define L_tmpnam 25 #define NULL 0 #define SEEK_CUR 1 #define SEEK_END 2 #define SEEK_SET 0 #if !defined(_SIZE_T) && !defined(_SIZE_T_) #define _SIZE_T #define _SIZE_T_ typedef unsigned size_t; #endif #define stderr (&_iob[2]) #define stdin (&_iob[0]) #define stdout (&_iob[1]) #define TMP_MAX 17576 extern int remove(const char *); extern int rename(const char *, const char *); extern FILE *tmpfile(void); extern char *tmpnam(char *); extern int fclose(FILE *); extern int fflush(FILE *); extern FILE *fopen(const char *, const char *); extern FILE *freopen(const char *, const char *, FILE *); extern void setbuf(FILE *, char *); extern int setvbuf(FILE *, char *, int, size_t); extern int fprintf(FILE *, const char *, ...); extern int fscanf(FILE *, const char *, ...); extern int printf(const char *, ...); extern int scanf(const char *, ...); extern int sprintf(char *, const char *, ...); extern int sscanf(const char *, const char *, ...); extern int vfprintf(FILE *, const char *, char *); extern int vprintf(const char *, char *); extern int vsprintf(char *, const char *, char *); extern int fgetc(FILE *); extern char *fgets(char *, int, FILE *); extern int fputc(int, FILE *); extern int fputs(const char *, FILE *); extern int getc(FILE *); extern int getchar(void); extern char *gets(char *); extern int putc(int, FILE *); extern int putchar(int); extern int puts(const char *); extern int ungetc(int, FILE *); extern size_t fread(void *, size_t, size_t, FILE *); extern size_t fwrite(const void *, size_t, size_t, FILE *); extern int fgetpos(FILE *, fpos_t *); extern int fseek(FILE *, long int, int); extern int fsetpos(FILE *, const fpos_t *); extern long int ftell(FILE *); extern void rewind(FILE *); extern void clearerr(FILE *); extern int feof(FILE *); extern int ferror(FILE *); extern void perror(const char *); #define _IOEOF 020 #define _IOERR 040 #define getc(p) (--(p)->_cnt>=0? (int)*(p)->_ptr++:_filbuf(p)) #define putc(x,p) (--(p)->_cnt>=0? ((int)(*(p)->_ptr++=(x))):_flsbuf((x),p)) extern int _filbuf(FILE *), _flsbuf(unsigned, FILE *); #define feof(p) ((p)->_flag&_IOEOF) #define ferror(p) ((p)->_flag&_IOERR) #define clearerr(p) ((p)->_flag &= ~(_IOERR|_IOEOF)) #define getchar() getc(stdin) #define putchar(x) putc(x,stdout) #endif /* __STDIO */ ); extern int ferror(FILE *); extern void perror(const char *); #define _IOEOF 020 #define _IOERR 040 #define getc(p) (--(p)->_cnt>=0? (int)*(p)->_ptr++:_filbuf(p)) #define putc(x,p) (--(p)->_cnt>=0? ((int)(*(p)->_ptr++=(x))):_flsbuf((x),p)) extern int _filbuf(FILE *), _flsbuf(unsigned, FILE *); #define feof(p) ((p)->_flag&_IOEOF) #define ferror(p) ((p)->_flag&_IOERR) #define clearerr(p) ((p)->_flag &= ~(_IOERR|_IOEOF)) #define getchar()./lcc/stdlib.h 664 0 0 3115 5404716116 6343 #ifndef __STDLIB #define __STDLIB #define EXIT_FAILURE 1 #define EXIT_SUCCESS 0 #define MB_CUR_MAX 1 #define NULL 0 #define RAND_MAX 32767 typedef struct { int quot, rem; } div_t; typedef struct { long quot, rem; } ldiv_t; #if !defined(_SIZE_T) && !defined(_SIZE_T_) #define _SIZE_T #define _SIZE_T_ typedef unsigned size_t; #endif #if !defined(_WCHAR_T) && !defined(_WCHAR_T_) #define _WCHAR_T #define _WCHAR_T_ typedef char wchar_t; #endif extern double atof(const char *); extern int atoi(const char *); extern long int atol(const char *); extern double strtod(const char *, char **); extern long int strtol(const char *, char **, int); extern unsigned long int strtoul(const char *, char **, int); extern int rand(void); extern void srand(unsigned int); extern void *calloc(size_t, size_t); extern void free(void *); extern void *malloc(size_t); extern void *realloc(void *, size_t); extern void abort(void); extern int atexit(void (*)(void)); extern void exit(int); extern char *getenv(const char *); extern int system(const char *); extern void *bsearch(const void *, const void *, size_t, size_t, int (*)(const void *, const void *)); extern void qsort(void *, size_t, size_t, int (*)(const void *, const void *)); extern int abs(int); extern div_t div(int, int); extern long int labs(long int); extern ldiv_t ldiv(long int, long int); extern int mblen(const char *, size_t); extern int mbtowc(wchar_t *, const char *, size_t); extern int wctomb(char *, wchar_t); extern size_t mbstowcs(wchar_t *, const char *, size_t); extern size_t wcstombs(char *, const wchar_t *, size_t); #endif /* __STDLIB */ size_t, int (*)(const void *, const void *)); extern void qsort(void *, size_t, size_t, int (*)(const void *, const void *)); extern int abs(int); extern div_t div(int, int); extern long int labs(long int); extern ldiv_t ldiv(long int, long int); extern int mblen(const char *, size_t); extern int mbtowc(wchar_t *, const char *, size_t); extern int wctomb(char *, wchar_t); extern size_t mbstowcs(wchar_t *, const char *, size_t); ext./lcc/string.h 664 0 0 2044 5404716116 6370 #ifndef __STRING #define __STRING #define NULL 0 #if !defined(_SIZE_T) && !defined(_SIZE_T_) #define _SIZE_T #define _SIZE_T_ typedef unsigned size_t; #endif void *memcpy(void *, const void *, size_t); void *memmove(void *, const void *, size_t); char *strcpy(char *, const char *); char *strncpy(char *, const char *, size_t); char *strcat(char *, const char *); char *strncat(char *, const char *, size_t); int memcmp(const void *, const void *, size_t); int strcmp(const char *, const char *); int strcoll(const char *, const char *); int strncmp(const char *, const char *, size_t); size_t strxfrm(char *, const char *, size_t); void *memchr(const void *, int, size_t); char *strchr(const char *, int); size_t strcspn(const char *, const char *); char *strpbrk(const char *, const char *); char *strrchr(const char *, int); size_t strspn(const char *, const char *); char *strstr(const char *, const char *); char *strtok(char *, const char *); void *memset(void *, int, size_t); char *strerror(int); size_t strlen(const char *); #endif /* __STRING */ ncmp(const char *, const char *, size_t); size_t strxfrm(char *, const char *, size_t); void *memchr(const void *, int, size_t); char *strchr(const char *, int); size_t strcspn(const char *, const char *); char *strpbrk(const char *, const char *); char *strrchr(const char *, int); size_t strspn(const char *, const char *); char *strstr(const char *, const char *); char *strtok(char *, const char *); void *memset(void *, int, size_t); char *strerror(int); size_t strlen(co./lcc/time.h 664 0 0 1647 5404716116 6030 #ifndef __TIME #define __TIME #define CLOCKS_PER_SEC 1000000 #define NULL 0 #if !defined(_CLOCK_T) && !defined(_CLOCK_T_) #define _CLOCK_T #define _CLOCK_T_ typedef long clock_t; #endif #if !defined(_TIME_T) && !defined(_TIME_T_) #define _TIME_T #define _TIME_T_ typedef long time_t; #endif #if !defined(_SIZE_T) && !defined(_SIZE_T_) #define _SIZE_T #define _SIZE_T_ typedef unsigned size_t; #endif struct tm { int tm_sec; int tm_min; int tm_hour; int tm_mday; int tm_mon; int tm_year; int tm_wday; int tm_yday; int tm_isdst; }; extern clock_t clock(void); extern double difftime(time_t, time_t); extern time_t mktime(struct tm *); extern time_t time(time_t *); extern char *asctime(const struct tm *); extern char *ctime(const time_t *); extern struct tm *gmtime(const time_t *); extern struct tm *localtime(const time_t *); extern size_t strftime(char *, size_t, const char *, const struct tm *); #endif /* __TIME */ m_sec; int tm_min; int tm_hour; int tm_mday; int tm_mon; int tm_year; int tm_wday; ./lcc/errno.h 664 0 0 153 5404716115 6165 #ifndef __ERRNO #define __ERRNO #define EDOM 33 #define ERANGE 34 extern int errno; #endif /* __ERRNO */ time_t mktime(struct tm *); extern time_t time(time_t *); extern char *asctime(const struct tm *); extern char *ctime(const time_t *); extern struct tm *gmtime(const time_t *); extern struct tm *localtime(const time_t *); extern size_t strftime(char *, size_t, const char *, const struct tm *); #endif /* __TIME */ m_sec; int tm_min; int tm_hour; int tm_mday; int tm_mon; int tm_year; int tm_wday; ./oCC/ 775 0 0 0 4420772371 4531 ./oCC/stdio.h 664 0 0 4211 3656311502 6102 /* @(#)stdio.h 84/11/10 */ #ifndef STDIO_H #define STDIO_H 1 #define BUFSIZ 4096 #define _NFILE 120 # ifndef FILE extern struct _iobuf { int _cnt; unsigned char *_ptr; unsigned char *_base; short _flag; char _file; } _iob[_NFILE]; # endif #define _IOREAD 01 #define _IOWRT 02 #define _IONBF 04 #define _IOMYBUF 010 #define _IOEOF 020 #define _IOERR 040 #define _IOSTRG 0100 #define _IOLBF 0200 #define _IORW 0400 #define NULL 0 #define FILE struct _iobuf #define EOF (-1) extern int _flsbuf(unsigned,FILE*); extern int _filbuf(FILE*); #define stdin (&_iob[0]) #define stdout (&_iob[1]) #define stderr (&_iob[2]) #define getc(p) (--(p)->_cnt>=0? *(p)->_ptr++&0377:_filbuf(p)) #define getchar() getc(stdin) #define putc(x,p) (--(p)->_cnt>=0? ((int)(*(p)->_ptr++=(unsigned)(x))):_flsbuf((unsigned)(x),p)) #define putchar(x) putc(x,stdout) #define feof(p) (((p)->_flag&_IOEOF)!=0) #define ferror(p) (((p)->_flag&_IOERR)!=0) #define fileno(p) ((p)->_file) extern FILE* fopen(const char*, const char*); extern FILE* fdopen(int, const char*); extern FILE* freopen(const char*, const char*, FILE*); extern long ftell(const FILE*); extern char* fgets(char*, int, FILE*); #define P_tmpdir "/tmp/" #define L_tmpnam (sizeof(P_tmpdir) + 15) extern char* gets(char*); extern puts(const char*); extern fputs(const char*, FILE*); extern int printf(const char* ...); extern int fprintf(FILE*, const char* ...); extern int sprintf(char*, const char* ...); extern int scanf(const char* ...); extern int fscanf(FILE*, const char* ...); extern int sscanf(char*, const char* ...); extern int fread(char*, int, int, FILE*); extern int fwrite(const char*, int, int, FILE*); extern int fclose(FILE*); extern fflush(FILE*); extern clearerr(FILE*); extern int fseek(FILE*, long, int); extern int rewind(FILE*); extern int getw(FILE*); extern int fgetc(FILE*); extern FILE* popen(const char*, const char*); extern int pclose(FILE*); extern int putw(int, FILE*); extern int fputc(int, FILE*); extern setbuf(FILE*, char*); extern int ungetc(int, FILE*); extern void exit(int); extern int abort(...); extern int atoi(const char*); extern double atof(const char*); extern long atol(const char*); #endif fclose(FILE*); extern fflush(FILE*); extern clearerr(FILE*); extern int fseek(FILE*, long, int); extern int rewind(FILE*); extern int getw(FILE*); extern int fgetc(FILE*); extern FILE* popen(const char*, const char*); extern int pclose(FILE*); extern int putw(int, FILE*); extern int fputc(int, FILE*); extern setbuf(FILE*, char*); extern int ungetc(int, FILE*); extern void./oCC/math.h 664 0 0 1157 4241671751 5725 extern double fabs(double), floor(double), ceil(double), modf(double, double*), frexp(double, int*), ldexp(double, int), sqrt(double), hypot(double, double), atof(const char*), sin(double), cos(double), tan(double), asin(double), acos(double), atan(double), atan2(double, double), exp(double), log(double), log10(double), pow(double, double), sinh(double), cosh(double), tanh(double), gamma(double), j0(double), j1(double), jn(int, double), y0(double), y1(double), yn(int, double), frand(); #define HUGE 1.701411733192644270e38 #define PI 3.1415926535897932384 #define PI2 6.2831853071795864769 (double, int), sqrt(double), hypot(double, double), atof(const char*), sin(double), cos(double), tan(double), asin(double), acos(double), atan(double), atan2(double, double), exp(double), log(double), log10(double), pow(double, double), sinh(double), cosh(double), tanh(double), gamma(double), j0(double), j1(double), jn(int, double), y0(double), y1(double), yn(int, double), fra./oCC/signal.h 664 0 0 4234 3443127615 6246 #ifndef NSIG #define NSIG 32 #define SIGHUP 1 /* hangup */ #define SIGINT 2 /* interrupt */ #define SIGQUIT 3 /* quit */ #define SIGILL 4 /* illegal instruction (not reset when caught) */ #define SIGTRAP 5 /* trace trap (not reset when caught) */ #define SIGIOT 6 /* IOT instruction */ #define SIGEMT 7 /* EMT instruction */ #define SIGFPE 8 /* floating point exception */ #define K_INTOVF 1 /* integer overflow */ #define K_INTDIV 2 /* integer divide by zero */ #define K_FLTOVF 3 /* floating overflow */ #define K_FLTDIV 4 /* floating/decimal divide by zero */ #define K_FLTUND 5 /* floating underflow */ #define K_DECOVF 6 /* decimal overflow */ #define K_SUBRNG 7 /* subscript out of range */ #define SIGKILL 9 /* kill (cannot be caught or ignored) */ #define SIGKIL 9 #define SIGBUS 10 /* bus error */ #define SIGSEGV 11 /* segmentation violation */ #define SIGSYS 12 /* bad argument to system call */ #define SIGPIPE 13 /* write on a pipe with no one to read it */ #define SIGALRM 14 /* alarm clock */ #define SIGTERM 15 /* software termination signal from kill */ #define SIGSTOP 17 /* sendable stop signal not from tty */ #define SIGTSTP 18 /* stop signal from tty */ #define SIGCONT 19 /* continue a stopped process */ #define SIGCHLD 20 /* to parent on child stop or exit */ #define SIGTTIN 21 /* to readers pgrp upon background tty read */ #define SIGTTOU 22 /* like TTIN for output if (tp->t_local<OSTOP) */ #define SIGTINT 23 /* to pgrp on every input character if LINTRUP */ #define SIGXCPU 24 /* exceeded CPU time limit */ #define SIGXFSZ 25 /* exceeded file size limit */ #ifndef KERNEL typedef int (*SIG_TYP)(); typedef void (*SIG_ARG_TYP)(); SIG_TYP signal(int, SIG_ARG_TYP); #endif #define BADSIG (SIG_TYP)-1 #define SIG_DFL (SIG_TYP)0 #define SIG_IGN (SIG_TYP)1 #ifdef KERNEL #define SIG_CATCH (SIG_TYP)2 #endif #define SIG_HOLD (SIG_TYP)3 #define SIGISDEFER(x) (((int)(x) & 1) != 0) #define SIGUNDEFER(x) (SIG_TYP)((int)(x) &~ 1) #define DEFERSIG(x) (SIG_TYP)((int)(x) | 1) #define SIGNUMMASK 0377 /* to extract pure signal number */ #define SIGDOPAUSE 0400 /* do pause after setting action */ #define SIGDORTI 01000 /* do ret+rti after setting action */ #endif SIG_ARG_TYP); #endif #define BADSIG (SIG_TYP)-1 #define SIG_DFL (SIG_TYP)0 #define SIG_IGN (SIG_TYP)1 #ifdef KERNEL #define SIG_CATCH (SIG_TYP)2 #endif #define SIG_HOLD (SIG_TYP)3 #define SIGISDEFER(x) (((int)(x) & 1) != 0) #define SIGUNDEFER(x) (SIG_TYP)((int)(x) &~ 1) #define DEFERSIG(x) (SIG_TYP)((int)(x) | 1) #define SIGNUMMASK 0377 /* to extr./oCC/task.h 644 0 0 14551 3661764607 5766 /* HEADER FILE FOR THE TASK SYSTEM */ printf(const char* ...); void exit(int); #define SIZE 750 #define MODE DEDICATED class object; class sched; /* : public object */ class task; /* : public sched */ class qhead; /* : public object */ class qtail; /* : public object */ class team; extern sched* run_chain; /* list of ready-to-run scheds (ordered by s_time) */ extern task* task_chain; /* list of tasks */ extern int task_error(int, object*); extern void print_error(int); /* object.o_type */ #define TIMER 1 #define TASK 2 #define QHEAD 4 #define QTAIL 5 /* sched.s_state */ #define IDLE 1 #define RUNNING 2 #define TERMINATED 4 /* type of stack */ #define DEDICATED 1 #define SHARED 2 /* loc on stack */ #define UNTOUCHED 052525 extern task* clock_task; extern task* thistask; extern long clock; void setclock(long); /* error codes */ #define E_OLINK 1 #define E_ONEXT 2 #define E_GETEMPTY 3 #define E_PUTOBJ 4 #define E_PUTFULL 5 #define E_BACKOBJ 6 #define E_BACKFULL 7 #define E_SETCLOCK 8 #define E_CLOCKIDLE 9 #define E_RESTERM 10 #define E_RESRUN 11 #define E_NEGTIME 12 #define E_RESOBJ 13 #define E_HISTO 14 #define E_STACK 15 #define E_STORE 16 #define E_TASKMODE 17 #define E_TASKDEL 18 #define E_TASKPRE 19 #define E_TIMERDEL 20 #define E_SCHTIME 21 #define E_SCHOBJ 22 #define E_QDEL 23 #define E_RESULT 24 #define E_WAIT 25 #define MAXERR E_WAIT typedef int (*PFIO)(int,object*); typedef void (*PFV)(); extern PFIO error_fct; extern PFV exit_fct; /* print flags */ #define CHAIN 1 #define VERBOSE 2 #define STACK 4 /* DATA STRUCTURES */ /* object --> olink --> olink ... | | | ... V V | task task V object --> ... */ class olink /* the building block for chains of task pointers */ { friend object; olink* l_next; task* l_task; olink(task* t, olink* l) { l_task=t; l_next=l; }; }; class object { olink* o_link; public: object* o_next; int o_type; /* TASK,TIMER,QHEAD/QTAIL */ object(int t = 0) { o_type=t; o_link=0; o_next=0; } ~object(); void remember(task* t) { o_link = new olink(t,o_link); } void forget(task*); /* remove all occurrences of task from chain */ void alert(); /* prepare IDLE tasks for scheduling */ void print(int); }; class sched : public object { friend timer; friend task; friend object; void schedule(); /* sched clock_task or front of run_chain */ void insert(int,object*); /* sched for d time units, ?t_alert=obj */ void remove(); /* remove from run_chain & make IDLE */ long s_time; /* time to sched; result after cancel() */ int s_state; /* IDLE, RUNNING, TERMINATED */ public: void print(int); long rdtime() { return s_time; }; int rdstate() { return s_state; }; void cancel(int); int result(); }; struct timer : sched { timer(int); ~timer(); void reset(int); void print(int); }; extern _hwm; class task : public sched { friend sched; void save(); void restore(); /* swap in new task */ int curr_hwm(); /* "high water mark" */ /* (how high stack has risen) */ int* t_framep; /* WARNING: t_framep is manipulated as an offset by restore() */ void* th; /* fudge return from swap */ int* t_basep; int t_size; /* holds hwm after cancel() */ int* t_savearea; /* for saving stack */ int t_trap; team* t_team; /* stack and info for sharing */ int t_mode; /* DEDICATED/SHARED stack */ int t_stacksize; object* t_alert; /* object that inserted you */ public: task(char* =0, int =0, int =0); ~task(); task* t_next; /* insertion in "task_chain" */ char* t_name; int waitvec(object**); int waitlist(object* ...); void wait(object* ob) { (void) waitlist(ob,0); }; void delay(int); int preempt(); void sleep(); void resultis(int); void cancel(int); void swap_stack(int*,int*,int*,int*,int*); /* set fram and restore */ void print(int); }; /* QUEUE MANIPULATION (see queue.c) */ /* qhead <--> oqueue <--> qtail (qhead, qtail independent) oqueue ->> circular queue of objects */ /* qh_modes */ #define EMODE 1 #define WMODE 2 #define ZMODE 3 class oqueue { friend qhead; friend qtail; int q_max; int q_count; object* q_ptr; qhead* q_head; qtail* q_tail; oqueue(int m) { q_max=m; q_count=0; q_head=0; q_tail=0; }; ~oqueue() { (q_count)?task_error(E_QDEL,0):0; }; void print(int); }; class qhead : public object { friend qtail; int qh_mode; /* EMODE,WMODE,ZMODE */ oqueue* qh_queue; public: qhead(int = WMODE, int = 10000); ~qhead(); object* get(); int putback(object*); int rdcount() { return qh_queue->q_count; } int rdmax() { return qh_queue->q_max; } int rdmode() { return qh_mode; } qtail* tail(); qhead* cut(); void splice(qtail*); void setmode(int m) { qh_mode = m; }; void setmax(int m) { qh_queue->q_max = m; }; void print(int); }; class qtail : public object { friend qhead; int qt_mode; oqueue* qt_queue; public: qtail(int = WMODE, int = 10000); ~qtail(); int put(object*); int rdspace() { return qt_queue->q_max - qt_queue->q_count; }; int rdmax() { return qt_queue->q_max; }; int rdmode() { return qt_mode; }; qtail* cut(); void splice(qhead*); qhead* head(); void setmode(int m) { qt_mode = m; }; void setmax(int m) { qt_queue->q_max = m; }; void print(int); }; struct histogram /* "nbin" bins covering the range [l:r[ uniformly nbin*binsize == r-l */ { int l, r; int binsize; int nbin; int* h; long sum; long sqsum; histogram(int=16, int=0, int=16); void add(int); void print(); }; /* the result of randint() is always >= 0 */ #define DRAW (randx = randx*1103515245 + 12345) #define ABS(x) (x&0x7fffffff) #ifdef pdp11 #define MASK(x) ((x>>16)&077777) #define MAX 32768.0 #endif #ifdef vax #define MASK(x) ABS(x) #define MAX 2147483648.0 #endif class randint /* uniform distribution in the interval [0,MAX] */ { long randx; public: randint(long s = 0) { randx=s; } void seed(long s) { randx=s; } int draw() { return MASK(DRAW); } float fdraw() { return ABS(DRAW)/MAX; }; }; class urand : public randint /* uniform distribution in the interval [low,high] */ { public: int low, high; urand(int l, int h) { low=l; high=h; } int draw() { return int(low + (high-low) * (0+randint::draw()/MAX)); } }; extern double log(double); class erand : public randint /* exponential distribution random number generator */ { public: int mean; erand(int m) { mean=m; }; int draw() { return (int)(-mean * log( (double)(MAX-randint::draw()) / MAX) + .5); }; }; return ABS(DRAW)/MAX; }; }; class urand : public randint /* uniform distribution in the interval [low,high] */ { public: int low, high; urand(int l./oCC/complex.h 666 0 0 3725 3654551644 6455 #include #include overload cos; overload cosh; overload exp; overload log; overload pow; overload sin; overload sinh; overload sqrt; overload abs; #include inline double abs(double d) { return fabs(d); } class complex { double re, im; public: complex(double r, double i) { re=r; im=i; } complex(double r) { re=r; im=0; } complex() { re=0; im=0; } friend double real(const complex& a ) { return a.re; } friend double imag(const complex& a ) { return a.im; } friend double abs(complex); friend double norm(complex); friend double arg(complex); friend complex conj(complex a) { return complex(a.re, -a.im); } friend complex cos(complex); friend complex cosh(complex); friend complex exp(complex); friend complex log(complex); friend complex pow(double, complex); friend complex pow(complex, int); friend complex pow(complex, double); friend complex pow(complex, complex); friend complex polar(double, double = 0); friend complex sin(complex); friend complex sinh(complex); friend complex sqrt(complex); friend complex operator+(complex a1, complex a2) { return complex(a1.re+a2.re, a1.im+a2.im); } friend complex operator-(complex a1, complex a2) { return complex(a1.re-a2.re, a1.im-a2.im); } friend complex operator-(complex a) { return complex(-a.re, -a.im); } friend complex operator*(complex, complex); friend complex operator/(complex, complex); friend int operator==(complex a, complex b) { return a.re==b.re && a.im==b.im; } friend int operator!=(complex a, complex b) { return a.re!=b.re || a.im!=b.im; } friend int operator==(complex, complex); friend int operator!=(complex, complex); void operator+=(complex a) { re += a.re; im += a.im; } void operator-=(complex a) { re -= a.re; im -= a.im; } void operator*=(complex); void operator/=(complex); }; ostream& operator<<(ostream&, complex); istream& operator>>(istream&, complex&); void complex_error(int,double); extern int errno; return a.re==b.re && a.im==b.im; } frien./oCC/errno.h 664 0 0 1572 4224460444 6116 /* * Error codes */ #define EPERM 1 #define ENOENT 2 #define ESRCH 3 #define EINTR 4 #define EIO 5 #define ENXIO 6 #define E2BIG 7 #define ENOEXEC 8 #define EBADF 9 #define ECHILD 10 #define EAGAIN 11 #define ENOMEM 12 #define EACCES 13 #define EFAULT 14 #define ENOTBLK 15 #define EBUSY 16 #define EEXIST 17 #define EXDEV 18 #define ENODEV 19 #define ENOTDIR 20 #define EISDIR 21 #define EINVAL 22 #define ENFILE 23 #define EMFILE 24 #define ENOTTY 25 #define ETXTBSY 26 #define EFBIG 27 #define ENOSPC 28 #define ESPIPE 29 #define EROFS 30 #define EMLINK 31 #define EPIPE 32 /* math software */ #define EDOM 33 #define ERANGE 34 /* complex */ #define C_COSH_RE 40 #define C_COSH_IM 41 #define C_EXP_RE_POS 42 #define C_EXP_RE_NEG 43 #define C_EXP_IM 44 #define C_LOG_0 45 #define C_SINH_RE 46 #define C_SINH_IM 47 extern int errno; extern int sys_nerr; extern char *sys_errlist[]; IR 21 #define EINVAL 22 #define ENFILE 23 #define EMFILE 24 #define ENOTTY 25 #define ETXTBSY 26 #define EFBIG 27 #define ENOSPC 28 #d./oCC/sys/ 775 0 0 0 4420772354 5350 ./oCC/sys/stat.h 664 0 0 1701 3657721461 6564 struct stat { dev_t st_dev; ino_t st_ino; unsigned short st_mode; short st_nlink; short st_uid; short st_gid; dev_t st_rdev; off_t st_size; time_t st_atime; time_t st_mtime; time_t st_ctime; }; #define S_IFMT 0170000 /* type of file */ #define S_IFDIR 0040000 /* directory */ #define S_IFCHR 0020000 /* character special */ #define S_IFBLK 0060000 /* block special */ #define S_IFREG 0100000 /* regular */ #define S_IFLNK 0120000 /* symbolic link */ #define S_ISUID 0004000 /* set user id on execution */ #define S_ISGID 0002000 /* set group id on execution */ #define S_ISVTX 0001000 /* save swapped text even after use */ #define S_IREAD 0000400 /* read permission, owner */ #define S_IWRITE 0000200 /* write permission, owner */ #define S_IEXEC 0000100 /* execute/search permission, owner */ #ifdef _OVERLOAD_STAT overload stat; /* sleazy string package hack */ #endif int stat(char*, struct stat*); int fstat(int, struct stat*); /* symbolic link */ #define S_ISUID 0004000 /* set user id on ./oCC/sys/types.h 664 0 0 2645 4326620446 6760 /* * Basic system types and major/minor device constructing/busting macros. */ #ifndef _TYPES_ #define _TYPES_ /* major part of a device */ #define major(x) ((int)(((unsigned)(x)>>8)&0377)) /* minor part of a device */ #define minor(x) ((int)((x)&0377)) /* make a device number */ #define makedev(x,y) ((dev_t)(((x)<<8) | (y))) typedef unsigned char u_char; typedef unsigned short u_short; typedef unsigned int u_int; typedef unsigned long u_long; typedef struct _physadr { int r[1]; } *physadr; typedef long daddr_t; typedef char * caddr_t; typedef u_short ino_t; typedef long swblk_t; typedef long size_t; typedef long time_t; typedef long label_t[14]; typedef u_short dev_t; typedef long off_t; typedef long portid_t; #ifndef NBBY #include #ifndef NBBY #define NBBY 8 /* number of bits in a byte */ #define NBPW sizeof(int) /* number of bytes in an integer */ #endif #endif NBBY /* * Set of fds used with the select system call. * The macros depend on NBPW and NBBY; assume NOFILE <= 128. */ #define FDWORDS (128+NBPW*NBBY-1)/(NBPW*NBBY) typedef struct { unsigned long fds_bits[FDWORDS]; } fd_set; #define FD_SET(n,s) (s).fds_bits[(n)/(NBPW*NBBY)] |= 1<<((n)%(NBPW*NBBY)) #define FD_CLR(n,s) (s).fds_bits[(n)/(NBPW*NBBY)] &= ~(1<<((n)%(NBPW*NBBY))) #define FD_ISSET(n,s) ((s).fds_bits[(n)/(NBPW*NBBY)] & (1<<((n)%(NBPW*NBBY)))) #define FD_ZERO(s) {int i; for(i=0;i #endif #define vector(type) name2(type,vector) #define vectordeclare(type) \ extern GPT errorhandler(vector,type); \ extern GPT set_handler(vector,type,GPT); \ class vector(type) { \ type* v; \ int sz; \ public: \ vector(type)(int s) \ { if (s<=0) callerror(vector,type,1,"bad vector size"); \ v = new type[sz=s]; \ } \ ~vector(type)() { delete[sz] v; } \ vector(type)(vector(type)&); \ vector(type)& operator=(vector(type)&); \ int size() { return sz; } \ void set_size(int); \ type& elem(int i) { return v[i]; } \ type& operator[](int i) \ { if (i<0 || sz<=i) \ callerror(vector,type,2,"vector index out of range"); \ return v[i]; \ } \ }; #define vectorimplement(type) \ GPT errorhandler(vector,type) = genericerror; \ vector(type)::vector(type)(vector(type)& a) \ { \ register i = a.sz; \ sz = i; \ v = new type[i]; \ register type* vv = &v[i]; \ register type* av = &a.v[i]; \ while (i--) *--vv = *--av; \ } \ \ vector(type)& vector(type)::operator=(vector(type)& a) \ { \ register i = a.sz; \ if (i != sz) \ callerror(vector,type,3,"different vector sizes in assignment");\ register type* vv = &v[i]; \ register type* av = &a.v[i]; \ while (i--) *--vv = *--av; \ delete[i] v; \ return *this; \ } \ \ void vector(type)::set_size(int s) \ { \ if (s<=0) callerror(vector,type,4,"bad new vector size"); \ type* nv = new type[s]; \ register i = (s<=sz)?s:sz; \ register type* vv = &v[i]; \ register type* av = &nv[i]; \ while (i--) *--vv = *--av; \ delete[sz] v; \ v = nv; \ sz = s; \ } \ \ GPT set_handler(vector,type, GPT a) \ { \ GPT oo = errorhandler(vector,type); \ errorhandler(vector,type) = a; \ return oo; \ } #define stack(type) name2(type,stack) #define stackdeclare(type) \ extern GPT errorhandler(stack,type); \ extern GPT set_handler(stack,type,GPT); \ class stack(type) : vector(type) { \ int t; \ public: \ stack(type)(int s) : (s) { t = 0; } \ stack(type)(stack(type)& a) : ((vector(type)&)a) { t = a.t; } \ void push(type& a) \ { if (t==size()-1) callerror(stack,type,1,"stack overflow"); \ elem(++t) = a; \ } \ type pop() \ { if (t==0) callerror(stack,type,2,"stack underflow"); \ return elem(t--); \ } \ type& top() \ { if (t==0) callerror(stack,type,3,"stack empty"); \ return elem(t); \ } \ }; #define stackimplement(type) \ GPT errorhandler(stack,type); \ GPT set_handler(stack,type, GPT a) \ { \ GPT oo = errorhandler(stack,type); \ errorhandler(stack,type) = a; \ return oo; \ } elem(++t) = a; ./oCC/common.h 664 0 0 1143 3304526206 6250 class istream; class ostream; struct common { virtual int cmp(common& oo) { return this==&oo; } /* cmp performs a three way comparison if an ordering exists: this==arg: return 0, thisarg: return positive otherwise this==arg: return 0, this!=arg: return non-zero */ virtual int operator==(common& oo) { return this==&oo; } virtual char* swho() { return 0; } virtual int iwho() { return 0; } virtual int size() { return sizeof(common); } virtual ostream& write(ostream& s) { return s;} virtual istream& read(istream& s) { return s; } common() {} }; /* cmp performs a three way comparison if an ordering exists: this==arg: return 0, thisarg: return positive otherwise this==arg: return 0, this!=arg: return non-zero */ virtual int operator==(common& oo) { return this==&oo; } virtual char* swho() { return 0; } virtual int iwho() { return 0; } virtual int size() { return sizeof(common); } virtual ostream./oCC/stream.h 664 0 0 17244 4045456556 6321 /* stream.h, the header file for the C++ stream i/o system 4/06/85 */ #ifndef STREAMH #define STREAMH #include #ifndef NULL #define NULL 0 #endif #ifndef EOF #define EOF (-1) #endif #ifndef BUFSIZE #define BUFSIZE 1024 #endif enum state_value { _good=0, _eof=1, _fail=2, _bad=4 }; enum open_mode { input=0, output=1, append=2 }; struct streambuf { // a buffer for streams char* base; // pointer to beginning of buffer char* pptr; // pointer to next free byte char* gptr; // pointer to next filled byte char* eptr; // pointer to first byte following buffer char alloc; // true if buffer is allocated using "new" FILE* fp; // for stdio compatibility virtual overflow(int c=EOF); // Empty a buffer. // Return EOF on error // 0 on success virtual int underflow(); // Fill a buffer // Return EOF on error or end of input // next character on success inline int sgetc() // get the current character { return (gptr>=pptr) ? underflow() : *gptr&0377; } inline int snextc() // get the next character { return (gptr>=(pptr-1)) ? underflow() : *++gptr&0377; } inline void stossc() // advance to the next character { if (gptr++ >= pptr) underflow(); } inline void sputbackc(char c) /* Return a character to the buffer (ala lookahead 1). Since the user may be "playing games" the character might be different than the last one returned by sgetc or snextc. If the user attempts to put back more characters than have been extracted, nothing will be put back. Putting back an EOF is DANGEROUS. */ { if (gptr > base) *--gptr = c; } inline int sputc(int c =EOF) // put a character into the buffer { if (fp == 0) return (eptr<=pptr) ? overflow(c&0377) : (*pptr++=c&0377); else return putc(c, fp); } inline streambuf * setbuf(char *p, int len, int count =0) /* supply an area for a buffer. The "count" parameter allows the buffer to start in non-empty. */ { base = gptr = p; pptr = p + count; eptr = base + len; return this; } int doallocate(); // allocate some space for the buffer inline int allocate(){ return base==0 ? doallocate() : 0; } streambuf() { base = gptr = pptr = eptr = 0; alloc = 0; fp = 0; } streambuf(char* p, int l) { setbuf(p,l); alloc = 0; } ~streambuf() { if (base && alloc) delete base; } }; extern int close(int); struct filebuf : public streambuf { // a stream buffer for files int fd; // file descriptor char opened; // non-zero if file has been opened int overflow(int c=EOF); // Empty a buffer. // Return EOF on error // 0 on success int underflow(); // Fill a buffer. // Return EOF on error or end of input // next character on success filebuf* open(char *name, open_mode om); // Open a file // return 0 if failure // return "this" if success int close() { int i = opened?::close(fd):0; opened=0; return i; } filebuf() { opened = 0; fp = 0; } filebuf(FILE* p) { fp = p; opened = 1; } filebuf(int nfd) { fd = nfd; opened = 1; } filebuf(int nfd, char* p, int l) : (p,l) { fd = nfd; opened = 1; } ~filebuf() { close(); } }; struct circbuf : public streambuf { // a circular stream buffer int overflow(int c=EOF); // Empty a buffer. // Return EOF on error // 0 on success int underflow(); // Fill a buffer. // Return EOF on error or end of input // next character on success circbuf() { } ~circbuf() { } }; /* * This type defines white space. Any number of whitespace * characters can be used to separate two fields in an input * stream. The effect of sending an input stream to a whitespace * object is to cause all whitespace in the input stream, up to the * next non-whitespace character, to be discarded. The whitespace * characters are space, tab, form feed, and new line. */ struct whitespace { }; /***************************** output: *********************************/ extern char* oct(long, int =0); extern char* dec(long, int =0); extern char* hex(long, int =0); extern char* chr(int, int =0); // chr(0) is the empty string "" extern char* str(const char*, int =0); extern char* form(const char* ...); // printf format class istream; class common; class ostream { friend istream; streambuf* bp; short state; public: ostream& operator<<(const char*); // write ostream& operator<<(int a) { return *this<overflow(); return *this; } operator void*(){ return _eofbase; } ostream(streambuf* s) { bp = s; state = 0; } ostream(int fd) { bp = new filebuf(fd); state = 0; } ostream(int size, char* p) { state = 0; bp = new streambuf(); if (p == 0) p = new char[size]; bp->setbuf(p, size); } ~ostream() { flush(); } }; /***************************** input: ***********************************/ /* The >> operator reads after skipping initial whitespace get() reads but does not skip whitespace if >> fails (1) the state of the stream turns non-zero (2) the value of the argument does not change (3) non-whitespace characters are put back onto the stream >> get() fails if the state of the stream is non-zero */ class istream { friend ostream; streambuf* bp; ostream* tied_to; char skipws; // if non-null, automaticly skip whitespace short state; friend void eatwhite (istream&); public: int skip(int i) { int ii=skipws; skipws=i; return ii; } /* formatted input: >> skip whitespace */ istream& operator>>(char*); // string istream& operator>>(char&); // single character istream& operator>>(short&); istream& operator>>(int&); istream& operator>>(long&); istream& operator>>(float&); istream& operator>>(double&); istream& operator>>(streambuf&); istream& operator>>(whitespace&); // skip whitespace istream& operator>>(common&); /* raw input: get's do not skip whitespace */ istream& get(char*, int, char ='\n'); // string istream& get(streambuf& sb, char ='\n'); istream& get(char& c) // single character { int os = skipws; skipws = 0; *this >> c; skipws = os; return *this; } istream& putback(char c); ostream* tie(ostream* s) { ostream* t = tied_to; tied_to = s; return t; } operator void*(){ return _eofbase; } istream(streambuf* s, int sk =1, ostream* t =0) // bind to buffer { state = 0; skipws = sk; tied_to = t; bp = s; } istream(int size, char* p, int sk =1) // bind to string { state = 0; skipws = sk; tied_to = 0; bp = new streambuf(); if (p == 0) p = new char[size]; bp->setbuf(p, size, size); } istream(int fd, int sk =1, ostream* t =0) // bind to file { state = 0; skipws = sk; tied_to = t; bp = new filebuf(fd); } }; extern istream cin; // standard input predefined extern ostream cout; // standard output extern ostream cerr; // error output extern whitespace WS; // predefined white space #endif char* p, int sk =1) // bind to string { state = 0; skipws = sk; tied_to = 0; bp = new streambuf(); if (p == 0) p = new char[size]; bp->setbuf(p, size, size); } istream(int fd, int sk =1, ostream* t =0) // bind to file { state = 0; skipws = sk; tied_to = t; bp = new filebuf(fd); } }; extern istream cin;./oCC/common/ 775 0 0 0 4420772356 6024 ./oCC/common/list.h 666 0 0 2557 3304526330 7235 struct link { link* next; common* p; link(common* pp, link* nn) { p=pp; next=nn; } }; class list : public common { /* an element can occur more than once */ link* head; link* tail; public: list() { head = tail = 0; } list(common& oo) { head = tail = new link(&oo, 0); } ~list(); void add(common& oo) { head = new link(&oo,head); if (tail == 0) tail=head; } void addlast(common& oo) { if (tail==0) head = tail = new link(&oo,0); else tail = tail->next = new link(&oo,0); } common* remove() { if (head) { common* p = head->p; if (head == tail) head = tail = 0; else head=head->next; return p; } else return 0; } common* remove(common& oo); common* first() { return head?head->p:0; } common* last() { return tail?tail->p:0; } int empty() { return head!=0; } }; class set : public list { /* unique elements */ common remove(); public: set(); set(common&); ~set(); int empty(); int insert(common&); common* remove(common&); common* find(char*); common* find(common&); int no_of_mem(); }; struct dlink { dlink* pre, *suc; common* p; dlink(dlink* pr, dlink* su, common* pp) { pre=pr; suc=su; p=pp; } }; class dlist : public common { dlink* head; public: dlist(); dlist(common&); ~dlist(); void insert(); common* remove(); common* remove(common&); common* curr(); common* next(); common* prev(); }; ommon remove(); public: set(); set(common&); ~set(); int empty(); int insert(common&); common* remove(common&); common* find(char*); com./oCC/common/table.h 666 0 0 1264 3304526364 7352 class vector : public common { common** vec; int size; public: vector(int sz) { size = (sz<=0) ? 1 : sz; vec = new common*[size]; } ~vector() {}; virtual common* range_error() { return 0; } common& operator[](int i) { return (0<=i && i #include #undef _OVERLOAD_STAT #ifdef BSD extern char* bcopy(const char* from, char* to, int); /* vomit */ extern int bcmp(const char* from, const char* to, int); /* only for == */ #define memcpy(t,f,n) bcopy(f,t,n) #else extern char* memcpy(char* to, const char* from, int); extern int memcmp(const char* to, const char* from, int); #endif overload system, access, acct, chdir, chmod, chown, creat, link, mknod, mount, open, umount, unlink, read, write; #include overload strchr, strrchr, strpbrk, strspn, strcspn; overload fopen, fdopen, freopen, popen, gets, fgets, puts, fputs; #include #include #ifndef GENERICH #include #endif #ifndef TRUE #define FALSE 0 #define TRUE (!FALSE) #endif #ifndef BIT_DEFINED #define BIT_DEFINED typedef int bit; #endif overload min; inline int min(int i, int j) { return idummy == empty_dummy; } Charfield *myField(); Rep *canCat(int); // returns a new Rep if this can be catenated Rep *newSub(int offset, int length); /* the following are from String(3) */ int strchr(char); // position of first occurrence of char int strrchr(char); // ... last ... (-1 if char not there) int strpbrk(const Rep&); int strspn(const Rep&); int strcspn(const Rep&); }; // Strings are at the bottom working up, and Reps are at the top working down struct Charfield { Charfield *next; MtRep *emptyHead; /* of list of free Reps with no space */ Rep *lastRep; char *field; /* beginning of characters */ char *end; /* ... of data area */ char *firstFree; int usedSpace; Charfield(); Charfield(unsigned int); int compactify(unsigned int); /* return TRUE if no use */ Rep *newRep(unsigned int); char *getSpace(int); /* new String space for old Rep */ void putMt(MtRep *); Rep *getMt(); }; extern Rep *nullRep; /* the null String */ extern Rep *oneChar; /* all one-character Strings */ extern Charfield *currfield; extern char *Memcpy(char *to, const char *from, int); inline ostream& operator<<(ostream& oo, Rep& r) { return oo.put(r.start, r.len); } class String { static GPT handler; static bit startedUp; void error(int = 0, char * = 0); Rep *d; friend SubString; friend Subchar; public: String(); String(char); String(char, char); String(char, char, char); String(char, char, char, char); String(const char *); String(const char *, unsigned); String(const String& s) { d = s.d; d->refIncr(); } String(const SubString&); String(Rep& r) { d = &r; r.refIncr(); } ~String() { d->refDecr(); } friend int stat(const String&, struct stat*); friend int system(const String&); friend int access(const String&, int); friend int acct(const String&); friend int chdir(const String&); friend int chmod(const String&, int); friend int chown(const String&, int, int); friend int creat(const String&, int); friend int link(const String&, const String&); friend int mknod(const String&, int, int); friend int mount(const String&, const String&, int); friend int open(const String&, int); friend int umount(const String&); friend int unlink(const String&); friend int read(int, String&, int); friend int write(int, const String&); friend FILE* fopen(const String&, const String&); friend FILE* fdopen(int, const String&); friend FILE* freopen(const String&, const String&, FILE*); friend FILE* popen(const String&, const String&); friend puts(const String&); friend fputs(const String&, FILE*); friend inline ostream& operator<<(ostream&, const String&); friend istream& operator>>(istream&, String&); friend String operator+(const char, const String&); friend String operator+(const char*, const String&); friend Rep; friend Regexp; friend void startUp(); unsigned length (){ return d->length(); } operator void*() { return length() ? this : 0; } int hashval() { return d->hashval(); } int compare(const String& oo) { return d == oo.d ? 0 : d->compare(*oo.d); } int compare(const char *p) { return d->compare(p); } bit operator==(const String& oo) { return d == oo.d ? 1 : (*d == *oo.d); } bit operator>(const String& oo) { return compare(oo) > 0; } bit operator>=(const String& oo) { return compare(oo) >= 0; } bit operator<=(const String& oo) { return compare(oo) <= 0; } bit operator<(const String& oo) { return compare(oo) < 0; } bit operator!=(const String& oo) { return d == oo.d ? 0 : !(*d == *oo.d); } bit operator==(const char* p) { return compare(p) == 0; } bit operator>(const char* p) { return compare(p) > 0; } bit operator>=(const char* p) { return compare(p) >= 0; } bit operator<=(const char* p) { return compare(p) <= 0; } bit operator<(const char* p) { return compare(p) < 0; } bit operator!=(const char* p) { return compare(p) != 0; } // match returns the first differing position int match(const String& s) { return d == s.d ? length() : d->match(*s.d); } int match (const char* p) { return d->match(p); } String operator+(const String&); /* catenate */ String operator+(const char*); /* catenate */ String operator+(const char); /* catenate */ String& operator=(const char); String& operator=(const char *); String& operator=(const String& oo); String& put(const char); /* append or put */ String& put(const char*); /* append or put */ String& put(const String&); /* append or put */ String& operator+=(const char c) { return put(c); } String& operator+=(const String& oo) { return put(oo); } String& operator+=(const char *s) { return put(s); } bit getX(char&); /* get or lop */ bit get() { char c; return getX(c); } String& unget(const char); /* prepend */ String& unget(const String&); /* prepend */ bit unputX(char&); /* remove from back */ bit unput() { char c; return unputX(c); } bit firstX(char&); bit lastX(char&); SubString& operator() (const unsigned start, const unsigned length); Subchar& operator[] (const unsigned); /* character selection */ void dump(char *); GPT sethandler(GPT); /* the following are from String(3) */ /* position of first occurrence of char */ int strchr(const char c) { return d->strchr(c); } /* ... last ... (-1 if char not there) */ int strrchr(const char c) { return d->strrchr(c); } int strpbrk(const String& oo) { return d->strpbrk(*oo.d); } int strspn(const String& oo) { return d->strspn(*oo.d); } int strcspn(const String& oo) { return d->strcspn(*oo.d); } }; inline bit operator==(const char* p, const String& s) { return s.compare(p) == 0; } inline bit operator>(const char* p, const String& s) { return s < p; } inline bit operator>=(const char* p, const String& s) { return s >= p; } inline bit operator<=(const char* p, const String& s) { return s >= p; } inline bit operator<(const char* p, const String& s) { return s > p; } inline bit operator!=(const char* p, const String& s) { return s != p; } inline ostream& operator<<(ostream& oo, const String& ss) { return oo << *ss.d; } class SubString { friend String; static String *ss; static int oo; static int ll; static GPT handler; void error(int = 0, char * = 0); SubString(const SubString&); SubString(String &ii, int off, int len) { this = 0; ss = ⅈ oo = off; ll = len; } ~SubString() { this = 0; } public: void operator=(const String&); GPT sethandler(GPT); String *it() { return ss; } int offset() { return oo; } int length() { return ll; } }; class Subchar { friend String; static String *ss; static int oo; /* position in the String */ static GPT handler; void error(int = 0, char * = 0); Subchar(const Subchar&); Subchar(String &ii, int off) { this = 0; ss = ⅈ oo = off; } ~Subchar() { this = 0; } public: char operator=(const char); operator char() { return *(ss->d->start + oo); } GPT sethandler(GPT); String *it() { return ss; } int offset() { return oo; } }; overload length; inline int length(const String &s) { return s.length(); } overload hashval; inline int hashval(const String &s) { return s.hashval(); } overload compare; inline int compare(const String &s,const String &t) { return s.compare(t); } inline int strchr(const String& s, const char c) { return s.strchr(c); } inline int strrchr(const String& s, const char c) { return s.strrchr(c); } inline int strpbrk(const String& s, const String& t) { return s.strpbrk(t); } inline int strspn(const String& s, const String& t) { return s.strspn(t); } inline int strcspn(const String& s, const String& t) { return s.strcspn(t); } String sgets(istream&); int fgets(String&, int, FILE*); int gets(String&); #endif ing &s,const String &t) { return s.compare(t); } inline int strchr(const String& s, const char c) { return s.strchr(c); } inline int strrchr(const String& s, const char c) { return s.strrchr(c); } inline int strpbrk(const String& s, const String& t) { return s.strpbrk(t); } inline int strspn(const String& s, const String& t) { return s.strspn(t); } inline int strcspn(const St./oCC/libc.h 664 0 0 2654 4325115464 5705 /* some functions from the UNIX manual section 3 INCOMPLETE: contains only declarations of functions that (1) is not declared with their data structures (2) are identically declared in UNIX5.2 and bsd4.2 */ extern int abort(...); /* extern int abs(int); */ /* extern long clock(); */ extern char* crypt(char*, char*); extern void setkey(char*); extern void encrypt(char*, int); extern char* ecvt(double, int, int*, int*); extern char* fcvt(double, int ,int*, int*); extern char* gcvt(double, int, char*); /* extern end, etext, edata; */ extern double frexp(double, int*); extern double ldexp(double, int); extern double modf(double, double*); extern char* getenv(char*); extern char* getlogin(); extern char* getpass(char*); extern int getpw(int, char*); extern void l3tol(long*, char*, int); extern void ltol3(char*, long*, int); extern char *malloc(unsigned); extern void free(char *); extern char *realloc(char *, unsigned); extern char *calloc(unsigned, unsigned); extern char* mktemp(char*); extern void perror(char*); /* extern sleep(unsigned); */ extern void swab(char*, char*, int); extern int system(char*); extern char* ttyname(int); extern int isatty(int); extern int ttyslot(); extern int sprint(char *, char * ...); extern int print(char * ...); extern int fprint(int, char * ...); extern int system(char *); extern long atol(const char *); extern void exit(int); extern int creat(char *, int); extern int atoi(const char *); extern char *calloc(unsigned, unsigned); extern char* mktemp(char*); extern void pe./oCC/sysent.h 664 0 0 2522 3517521573 6317 /* some functions from the UNIX manual section 2 INCOMPLETE: contains only declarations of functions that (1) is not declared with their data structures (2) are identically declared in UNIX5.2 and bsd4.2 */ /* extern char* ctermid(char*); */ extern int system(char*); extern int access(char*, int); extern int acct(char*); /* extern alarm(unsigned); */ /* extern char* brk(int); */ extern char* sbrk(int); extern int chdir(char*); extern int chmod(char*, int); extern int chown(char*, int, int); extern int close(int); extern int creat(char*, int); extern int dup(int); extern int execl(char* ...); extern int execv(char*, char**); extern int execle(char* ...); extern int execve(char*, char**, char**); extern void exit(int), _exit(int); extern int fork(); extern int getpid(); extern int kill(int, int); extern int link(char*, char*); extern long lseek(int, long, int); extern int mknod(char*, int, int); extern int mount(char*, char*, int); extern int nice(int); extern int open(char*, int); extern pause(); extern int pipe(int*); /* extern void profil(char *, int, int, int); */ extern int setuid(int); extern int setgid(int); extern int stime(long*); extern void sync(); extern int umask(int); extern int umount(char*); extern int unlink(char*); extern int wait(int*); extern int read(int, char *, int); extern int write(int, char *, int); *); extern long lseek(int, long, int); extern int mknod(char*, int, int); extern int mount(char*, char*, int); extern int nice(int); extern int open(char*, int); extern pause./oCC/varargs.h 664 0 0 1536 3373564660 6447 #ifndef va_start /* Proper usage of this version of varargs is slightly different from that found in C. Functions are declared foo(int arg ...) { va_list ap; ... va_start(ap,arg1) ; ... rather than foo(va_alist) va_dcl { va_list ap; ... va_start(ap); use of va_arg, and va_end remain the same. Arg does not have to be int, but it must be declared. Hence all calls of foo must have the same first type for their first argument. (In the most common printf-like cases the first argument is a char* format.) */ typedef char *va_list; #define va_start(list,last) list = (char *) &last #define va_end(list) #ifdef u370 #define va_arg(list, mode) ((mode *)(list = \ (char *) ((int)list + 2*sizeof(mode) - 1 & -sizeof(mode))))[-1] #else #define va_arg(list, mode) ((mode *)(list += sizeof(mode)))[-1] #endif #endif o be int, but it must be declared. Hence all calls of foo must have the same first type for their first argument. (In the most common printf-like cases the./oCC/string.h 664 0 0 1732 4172561652 6302 // : the C string functions, UNIX Programmer's Manual vol 1 section 3 extern char* strcat(char*, const char*); extern char* strncat(char*, const char*, int); extern int strcmp(const char*, const char*); extern int strncmp(const char*, const char*, int); extern char* strcpy(char*, const char*); extern char* strncpy(char*, const char*, int); extern int strlen(const char*); // bsd: //extern char* index(char*, int); //extern char* rindex(char*, int); extern char* strchr(const char*, int); extern char* strrchr(const char*, int); extern char* strpbrk(const char*, const char*); extern int strspn(const char*, const char*); extern int strcspn(const char*, const char*); extern char* strtok(char*, const char*); extern char* strdup(const char*); extern char* memccpy(char*, const char*, int, int); extern char* memchr(const char*, int, int); extern int memcmp(const char*, const char*, int); extern char* memcpy(char*, const char*, int); extern char* memset(char*, int, int); strchr(const char*, int); extern char./oCC/stdargs.h 664 0 0 1141 3514111035 6416 /* stdarg.h */ /* USAGE: f( arg-declarations ... ) { va_list ap; va_start(ap, parmN); // parmN == last named arg // ... type arg = va_arg(ap, type); // ... va_end(ap); } */ #ifndef va_start typedef char *va_list; #define va_end(ap) #ifdef u370 #define va_start(ap, parmN) ap =\ (char *) ((int)&parmN + 2*sizeof(parmN) - 1 & -sizeof(parmN)) #define va_arg(ap, mode) ((mode *)(ap = \ (char *) ((int)ap + 2*sizeof(mode) - 1 & -sizeof(mode))))[-1] #else #define va_start(ap, parmN) ap = (char *)( &parmN+1 ) #define va_arg(ap, mode) ((mode *)(ap += sizeof(mode)))[-1] #endif #endif / parmN == last named arg // ... type arg = va_arg(ap, type); // ... va_end(ap); } */ #ifndef va_start typedef char *va_list; #define va_end(ap) #ifdef u370 #define va_start(ap, parmN) ap =\ (char *) ((int)&parmN + 2*sizeof(parmN) - 1 & -sizeof(parmN)) #define va_arg(ap, mode) ((mode *)(ap = \ (char *) ((int)ap + 2*sizeof(mode) - 1 & -sizeof(mode))))[-1] #else #define va_start(ap, parmN) ap = (./oCC/list.h 664 0 0 47311 4045456555 5776 #ifndef listdeclare #ifndef GENERICH #include #endif #include #ifndef TRUE #define FALSE 0 #define TRUE (!FALSE) #endif #ifndef NULL #define NULL 0 #endif #ifndef BIT_DEFINED #define BIT_DEFINED typedef int bit; #endif struct lnk { lnk* nxt; lnk* prv; void init(lnk* p, lnk* s) { prv = p; nxt = s; } lnk() {} ~lnk() {} }; struct LstHead { lnk *t; // tail lnk *h() { return t ? t->nxt : 0; } int sz; lnk *cache; // a recently retrieved link int cacheNo; // its index or garbage if cache == NULL int refCount; LstHead() { sz = 0; cache = t = NULL; } virtual ~LstHead(); void insert(lnk*); // used by put() and unget() void unget(lnk* nl) { insert(nl); cacheNo++; } void put(lnk* nl) { insert(nl); t = nl; } lnk* get(); lnk* unput(); lnk* getAt(int); }; struct lstiter; struct List { friend lstiter; lstiter *fI; LstHead *it; virtual void sepWork(); void separate() { if (it->refCount > 1) sepWork(); } int length() { return it->sz; } List() { fI = NULL; } List(List& x) { fI = NULL; it = x.it; it->refCount++; } ~List(); lnk* tail() { return it->t; } lnk* head() { return it->h(); } lstiter* firstIt() { return fI; } void newIt(lstiter*, int=0); void removeIt(lstiter*); operator void*() { return length() ? this : 0; } List& operator=(List&); List& unget(lnk*); List& put(lnk*); lnk* get(); lnk* unput(); }; struct lstiter { friend List; lnk *pred; List *aList; lstiter *nextIt; int index; lstiter(List&, int =0); lstiter(lstiter&); ~lstiter(); List *theList() { return aList; } lstiter& operator=(lstiter&); bit operator==(lstiter& oo) { return aList == oo.aList && index == oo.index; } bit atEnd() { return index == aList->length(); } bit r_atEnd() { return index == 0 ; } lnk* next(); lnk* r_next(); lnk* peek(); lnk* r_peek(); void insert(lnk*); void r_insert(lnk*); lnk* remove(); lnk* r_remove(); void reset(int =0); void r_reset(int i=0) { reset(aList->length() - i); } }; extern int abort(...); #define lnnk(type) name2(type,lnnk) #define list(type) name2(type,_list) #define ListHead(type) name2(type,ListHead) #define listiterator(type) name2(type,_list_iterator) #define listsubitem(type) name2(type,listsubitem) #define plist(type) name2(type,P_list) #define plistiterator(type) name2(type,P_list_iterator) #define plistsubitem(type) name2(type,Plistsubitem) #define CMPF(type) name2(type,CMPFN) #define CMPFP(type) name2(type,CMPFNP) #define listdeclare(type) \ extern GPT errorhandler(list,type); \ extern GPT set_handler(list,type,GPT); \ extern GPT errorhandler(listiterator,type); \ extern GPT set_handler(listiterator,type,GPT); \ class list(type); \ class lnnk(type); \ class ListHead(type); \ class listiterator(type); \ class listsubitem(type); \ typedef int (*CMPF(type))(type&, type&); \ ostream& operator<<(ostream&, list(type)&); \ class lnnk(type) : public lnk { \ friend ListHead(type); \ friend list(type); \ friend listsubitem(type); \ friend listiterator(type); \ friend ostream& operator<<(ostream&, list(type)&); \ friend void voidP_list_sort_internal(voidP_list&, CMPF(voidP)); \ type val; \ lnnk(type)(type& pp) : val(pp) {} \ ~lnnk(type)() {} \ }; \ class ListHead(type) : public LstHead { \ friend list(type); \ ListHead(type)() {} \ ~ListHead(type)(); \ lnnk(type) *tail() { return (lnnk(type)*)t; } \ lnnk(type) *head() { return (lnnk(type)*)h(); } \ bit firstX(type&); \ bit lastX(type&); \ }; \ class list(type) : public List { \ lnnk(type) *tail() { return (lnnk(type)*)List::tail(); } \ lnnk(type) *head() { return (lnnk(type)*)List::head(); } \ void init() { it = new ListHead(type); it->refCount = 1; } \ void sepWork(); \ public: \ friend ostream& operator<<(ostream&, list(type)&); \ friend void voidP_list_sort_internal(voidP_list&, CMPF(voidP)); \ list(type)() { init(); } \ list(type)(list(type)& x) : (x) {} \ ~list(type)() {} \ operator void*() { return length() ? this : 0; } \ bit operator==(list(type)&); \ bit operator!=(list(type)& x) { return !(*this == x); } \ list(type)& operator=(list(type)& ll) { return (list(type)&) \ (*(List*)this = (List&)ll); } \ list(type)& put(type &x) { return (list(type)&) \ List::put(new lnnk(type)(x)); } \ list(type)& put(list(type)&); /* append */ \ list(type)& operator+=(list(type)& oo) { return put(oo); } \ list(type)& operator+=(type& t) { return put(t); } \ list(type) operator+(list(type)& ll) { list(type) ans = *this; \ ans += ll; return ans; } \ list(type) operator+(type& t) { list(type) ans = *this; \ ans += t; return ans; } \ bit unputX(type &t); \ bit unput(); \ bit getX(type&); /* get */ \ bit get(); /* get */ \ list(type)& unget(type &x) { return (list(type)&) \ List::unget(new lnnk(type)(x)); } \ list(type)& unget(list(type)&); /* prepend */ \ bit firstX(type& t) { return \ ((ListHead(type)*)it)->firstX(t); } \ bit lastX(type& t) { return \ ((ListHead(type)*)it)->lastX(t); } \ /* getAt(0) returns the head of the list */ \ type getAt(int ii) { return ((lnnk(type)*)it->getAt(ii))->val; } \ inline listsubitem(type) operator[](unsigned ii); \ list(type)(type& x) { init(); put(x); } \ list(type)(type& x, type& y) { init(); put(x); put(y); } \ list(type)(type& x, type& y, type& z) { init(); put(x); put(y); \ put(z); } \ list(type)(type& x, type& y, type& z, type& w) { init(); \ put(x); put(y); put(z); put(w); } \ void sort(CMPF(type)); \ }; \ class listiterator(type) : public lstiter { \ friend listsubitem(type); \ friend list(type); \ public: \ listiterator(type)(list(type)& a, int i=0) : (*(List*)&a, i) {} \ listiterator(type)(listiterator(type)& a) : (*(lstiter*)&a) {} \ ~listiterator(type)() {} \ listiterator(type)& operator=(listiterator(type)& a) { return \ (listiterator(type)&)(*(lstiter*)this = (lstiter&)a); } \ bit nextX(type&); \ bit nextX(type*&); \ bit next() { return lstiter::next() != 0; } \ bit r_nextX(type&); \ bit r_nextX(type*&); \ bit r_next() { return lstiter::r_next() != 0; } \ bit peekX(type&); \ bit peekX(type*&); \ bit peek() { return !atEnd(); } \ bit r_peekX(type&); \ bit r_peekX(type*&); \ bit r_peek() { return !r_atEnd(); } \ /* remove -- deletes current from list */ \ bit remove(); \ bit r_remove(); \ bit removeX(type&); \ bit r_removeX(type&); \ /* insert -- put it at the left of the pointer */ \ void insert(type& x) { lstiter::insert(new lnnk(type)(x)); } \ void r_insert(type& x) { lstiter::r_insert(new lnnk(type)(x)); } \ bit replace(type&); \ bit r_replace(type&); \ }; \ class listsubitem(type) : public listiterator(type) { \ public: \ listsubitem(type)(list(type)& t, unsigned i) : (t, i) {} \ listsubitem(type)(listsubitem(type)& a) : ((listiterator(type)&)a) {} \ ~listsubitem(type)() {} \ type& operator=(type& x) { r_replace(x); return x; } \ operator type(); \ }; \ inline listsubitem(type) \ list(type)::operator[](unsigned ii) \ { \ return listsubitem(type)(*this, ii); \ } typedef void* voidP; listdeclare(voidP) #define plistdeclare(type) \ extern GPT errorhandler(Plist,type); \ extern GPT set_handler(Plist,type,GPT); \ extern GPT errorhandler(Plistiterator,type); \ extern GPT set_handler(Plistiterator,type,GPT); \ class plist(type); \ typedef int (*CMPFP(type))(type*&, type*&); \ ostream& operator<<(ostream&, plist(type)&); \ class plistiterator(type); \ class plistsubitem(type); \ class plist(type) : public voidP_list { \ public: \ friend ostream& operator<<(ostream&, plist(type)&); \ plist(type)() {} \ plist(type)(type* x) : ((voidP) x) {} \ plist(type)(type* x, type* y) : ((voidP) x, (voidP) y) {} \ plist(type)(type* x, type* y, type* z) : \ ((voidP) x, (voidP) y, (voidP) z) {} \ plist(type)(type* x, type* y, type* z, type* w) : \ ((voidP) x, (voidP) y, (voidP) z, (voidP) w) {} \ plist(type)(plist(type)& ll) : ((voidP_list&) ll) {} \ ~plist(type)() {} \ operator void*() { return voidP_list::operator void*(); } \ bit operator==(plist(type)& ll) { return ((voidP_list&)*this == \ (voidP_list&)ll); } \ plist(type)& operator=(plist(type)& ll) { return (plist(type)&) \ ((voidP_list&)*this = (voidP_list&)ll); } \ plist(type) operator+(plist(type)& ll) { \ return (plist(type)&)((voidP_list&)*this + (voidP_list&)ll); } \ plist(type) operator+(type* t) { \ return (plist(type)&) ((voidP_list&)*this + (voidP)t); } \ plist(type)& put(type *t) { return (plist(type)&) \ voidP_list::put((voidP)t); } \ plist(type)& put(plist(type)& ll) { return (plist(type)&) \ voidP_list::put((voidP_list&)ll); } \ plist(type)& operator+=(plist(type)& oo) { return put(oo); } \ plist(type)& operator+=(type* t) { return put(t); } \ bit unputX(type *&t) { return voidP_list::unputX((voidP&)t); } \ bit unput() { return voidP_list::unput(); } \ bit getX(type *&t) { return voidP_list::getX((voidP&)t); } \ bit get() { return voidP_list::get(); } \ plist(type)& unget(type *x) { return (plist(type)&) \ voidP_list::unget((voidP)x); } \ plist(type)& unget(plist(type)& ll) { return (plist(type)&) \ voidP_list::unget((voidP_list&)ll); } \ bit firstX(type *&t) { return voidP_list::firstX((voidP&)t); } \ bit lastX(type *&t) { return voidP_list::lastX((voidP&)t); } \ /* getAt(0) returns the head of the list */ \ type* getAt(int ii) { return (type *) voidP_list::getAt(ii); } \ inline plistsubitem(type) operator[](unsigned ii); \ void sort(CMPFP(type) pf) { voidP_list::sort((CMPF(voidP))pf); } \ }; \ class plistiterator(type) : public voidP_list_iterator { \ public: \ plistiterator(type)(plist(type)& a, int i=0) : \ ((voidP_list&)a, i) {} \ plistiterator(type)(plistiterator(type)& a) : \ ((voidP_list_iterator&)a) {} \ ~plistiterator(type)() {} \ plistiterator(type)& operator=(plistiterator(type)& a) { return \ (plistiterator(type)&)((voidP_list_iterator&)*this = \ (voidP_list_iterator&)a); } \ bit nextX(type *&t) { return \ voidP_list_iterator::nextX((voidP&)t); } \ bit nextX(type **&t) { return \ voidP_list_iterator::nextX((voidP*&)t); } \ bit next() { return voidP_list_iterator::next(); } \ bit r_nextX(type *&t) { return \ voidP_list_iterator::r_nextX((voidP&)t); } \ bit r_nextX(type **&t) { return \ voidP_list_iterator::r_nextX((voidP*&)t); } \ bit r_next() { return voidP_list_iterator::r_next(); } \ bit peekX(type *&t) { return \ voidP_list_iterator::peekX((voidP&)t); } \ bit peekX(type **&t) { return \ voidP_list_iterator::peekX((voidP*&)t); } \ bit peek() { return voidP_list_iterator::peek(); } \ bit r_peekX(type *&t) { return \ voidP_list_iterator::r_peekX((voidP&)t); } \ bit r_peekX(type **&t) { return \ voidP_list_iterator::r_peekX((voidP*&)t); } \ bit r_peek() { return voidP_list_iterator::r_peek(); } \ bit remove() { return voidP_list_iterator::remove(); } \ bit r_remove() { return voidP_list_iterator::r_remove(); } \ bit removeX(type *&x) { return \ voidP_list_iterator::removeX((voidP&)x); } \ bit r_removeX(type *&x) { return \ voidP_list_iterator::r_removeX((voidP&)x); } \ void insert(type *&x) { voidP_list_iterator::insert((voidP&)x); } \ void r_insert(type *&x) { \ voidP_list_iterator::r_insert((voidP&)x); } \ void replace(type *x) { voidP_list_iterator::replace((voidP)x); } \ void r_replace(type *x) { \ voidP_list_iterator::r_replace((voidP)x); } \ }; \ class plistsubitem(type) : public voidPlistsubitem { \ public: \ plistsubitem(type)(plist(type)& t, int i) : ((voidP_list&)t, i) {} \ plistsubitem(type)(plistsubitem(type)&ll) : ((voidPlistsubitem&)ll){} \ ~plistsubitem(type)() {} \ type*& operator=(type *&t) { return \ (type*&) ((voidPlistsubitem&)*this =(voidP&)t); } \ operator type*() { return (type*) voidPlistsubitem::operator voidP(); } \ }; \ inline \ plistsubitem(type) \ plist(type)::operator[](unsigned ii) \ { \ return plistsubitem(type)(*this, ii); \ } #define listimplement(type) \ GPT errorhandler(list,type) = genericerror; \ GPT errorhandler(listiterator,type) = genericerror; \ bit \ ListHead(type)::firstX(type& v) \ { \ lnnk(type) *aLink = (lnnk(type) *)LstHead::h(); \ return aLink ? (v = aLink->val, TRUE) : FALSE; \ } \ bit \ ListHead(type)::lastX(type& v) \ { \ lnnk(type) *aLink = (lnnk(type) *)LstHead::t; \ return aLink ? (v = aLink->val, TRUE) : FALSE; \ } \ ListHead(type)::~ListHead(type)() \ { \ lnnk(type) *temp; \ while (temp = (lnnk(type) *)LstHead::get()) \ delete temp; \ } \ bit \ listiterator(type)::remove() \ { \ lnnk(type) *aLink = (lnnk(type) *)lstiter::remove(); \ return aLink ? (delete aLink, TRUE) : FALSE; \ } \ bit \ listiterator(type)::removeX(type &x) \ { \ lnnk(type) *aLink = (lnnk(type) *)lstiter::remove(); \ return aLink ? (x = aLink->val, delete aLink, TRUE) : FALSE; \ } \ bit \ listiterator(type)::r_remove() \ { \ lnnk(type) *aLink = (lnnk(type) *)lstiter::r_remove(); \ return aLink ? (delete aLink, TRUE) : FALSE; \ } \ bit \ listiterator(type)::r_removeX(type &x) \ { \ lnnk(type) *aLink = (lnnk(type) *)lstiter::r_remove(); \ return aLink ? (x = aLink->val, delete aLink, TRUE) : FALSE; \ } \ bit \ listiterator(type)::nextX(type& t) \ { \ return atEnd() ? FALSE : \ (t = ((lnnk(type)*)lstiter::next())->val, TRUE); \ } \ bit \ listiterator(type)::nextX(type*& t) \ { \ return atEnd() ? FALSE : \ (theList()->separate(), t = &((lnnk(type)*)lstiter::next())->val, \ TRUE); \ } \ bit \ listiterator(type)::r_nextX(type& t) \ { \ return r_atEnd() ? FALSE : \ (t = ((lnnk(type)*)lstiter::r_next())->val, TRUE); \ } \ bit \ listiterator(type)::r_nextX(type*& t) \ { \ return r_atEnd() ? FALSE : \ (theList()->separate(), t = &((lnnk(type)*)lstiter::r_next())->val, \ TRUE); \ } \ bit \ listiterator(type)::r_peekX(type& t) \ { \ return r_atEnd() ? FALSE : \ (t = ((lnnk(type)*)lstiter::r_peek())->val, TRUE); \ } \ bit \ listiterator(type)::r_peekX(type*& t) \ { \ return r_atEnd() ? FALSE : \ (theList()->separate(), t = &((lnnk(type)*)lstiter::r_peek())->val, \ TRUE); \ } \ bit \ listiterator(type)::peekX(type& t) \ { \ return atEnd() ? FALSE : \ (t = ((lnnk(type)*)lstiter::peek())->val, TRUE); \ } \ bit \ listiterator(type)::peekX(type*& t) \ { \ return atEnd() ? FALSE : \ (theList()->separate(), t = &((lnnk(type)*)lstiter::peek())->val, \ TRUE); \ } \ bit \ listiterator(type)::replace(type& x) \ { \ return r_atEnd() ? FALSE : \ (theList()->separate(), ((lnnk(type)*)lstiter::r_peek())->val = x, \ TRUE); \ } \ bit \ listiterator(type)::r_replace(type& x) \ { \ return atEnd() ? FALSE : \ (theList()->separate(), ((lnnk(type)*)lstiter::peek())->val = x, \ TRUE); \ } \ bit \ list(type)::operator==(list(type)& x) \ { \ if ( length() != x.length() ) \ return FALSE; \ if ( length() == 0 ) \ return TRUE; \ lnnk(type) *mine = (lnnk(type) *)head(); \ lnnk(type) *yours = (lnnk(type) *)x.head(); \ for ( int i = length(); i--; ) \ if ( mine->val == yours->val ) { \ mine = (lnnk(type) *)mine->nxt; \ yours = (lnnk(type) *)yours->nxt; \ } else \ return FALSE; \ return TRUE; \ } \ bit \ list(type)::getX(type& t) \ { \ lnnk(type) *aLink = (lnnk(type) *)List::get(); \ return aLink ? (t = aLink->val, delete aLink, TRUE) : FALSE; \ } \ bit \ list(type)::get() \ { \ lnnk(type) *aLink = (lnnk(type) *)List::get(); \ return aLink ? (delete aLink, TRUE) : FALSE; \ } \ bit \ list(type)::unputX(type& t) \ { \ lnnk(type) *aLink = (lnnk(type) *)List::unput(); \ return aLink ? (t = aLink->val, delete aLink, TRUE) : FALSE; \ } \ bit \ list(type)::unput() \ { \ lnnk(type) *aLink = (lnnk(type) *)List::unput(); \ return aLink ? (delete aLink, TRUE) : FALSE; \ } \ list(type)& \ list(type)::put(list(type)& a) \ { \ if (a.length()) { \ type t; \ listiterator(type) ita(a); \ while (ita.nextX(t)) \ put(t); \ } \ return *this; \ } \ list(type)& \ list(type)::unget(list(type)& a) \ { \ if (a.length()) { \ type t; \ listiterator(type) ita(a); \ ita.r_reset(); \ while (ita.r_nextX(t)) \ unget(t); \ } \ return *this; \ } \ type \ listsubitem(type)::operator type() \ { \ type t; \ peekX(t); \ return t; \ } \ void \ list(type)::sepWork() \ { \ it->refCount--; \ ListHead(type) *newLst = new ListHead(type); \ if (tail()) { \ for (lnnk(type) *oldLnk = (lnnk(type) *)head();; \ oldLnk = (lnnk(type) *)oldLnk->nxt) { \ lnnk(type) *newLnk; \ newLst->put(newLnk = new lnnk(type)(oldLnk->val)); \ /* only be one or two listiterators (I hope) */ \ for (listiterator(type) *anIt = \ (listiterator(type) *)firstIt(); anIt; \ anIt = (listiterator(type) *)anIt->nextIt) { \ if (anIt->pred == oldLnk) { \ anIt->pred = newLnk; \ } \ } \ if ( oldLnk == tail() ) \ break; \ } \ } \ it = newLst; \ it->refCount = 1; \ } \ void \ list(type)::sort(CMPF(type) cmp) \ { \ if (length() < 2) return; \ separate(); \ voidP_list_sort_internal(*(voidP_list*)this, (CMPF(voidP))cmp); \ for (listiterator(type) *anIt = \ (listiterator(type) *)firstIt(); anIt; \ anIt = (listiterator(type) *)anIt->nextIt) \ anIt->reset(); \ } #define listoutimplement(type) \ ostream& \ operator<<(ostream& oo, list(type)& ll) \ { \ oo<<"("; \ if ( ll.length() ) { \ listiterator(type) it(ll); \ type t; \ it.nextX(t); \ oo< #include "String.h" class Regexp { String subject; int offset[NSUBEXP]; int len[NSUBEXP]; regexp* prog; public: Regexp(const char*); Regexp(const String&); ~Regexp(); int exec(const String&); int result(unsigned& start, unsigned& length, unsigned = 0); String subst(const String&); }; #endif ator<<(ostream& oo, plist(type)& ll) \ { \ oo<<"("; \ if ( ll.length() ) { \ plistiterator(type) it(ll); \ ./oCC/pwd.h 664 0 0 574 3670426704 5551 struct passwd { /* see getpwent(3) */ char *pw_name; char *pw_passwd; int pw_uid; int pw_gid; int pw_quota; char *pw_comment; char *pw_gecos; char *pw_dir; char *pw_shell; }; extern struct passwd *getpwent(); extern struct passwd *getpwuid(int); extern struct passwd *getpwnam(char*); extern struct passwd *pwdecode(char*); extern int setpwent(); extern int endpwent(); stream& oo, plist(type)& ll) \ { \ oo<<"("; \ if ( ll.length() ) { \ plistiterator(type) it(ll); \ ./oCC/dir.h 644 0 0 2065 3670471574 5555 /* * This sets the "page size" for directories. * Requirements are DEV_BSIZE <= DIRBLKSIZ <= MINBSIZE with * DIRBLKSIZ a power of two. * Dennis Ritchie feels that directory pages should be atomic * operations to the disk, so we use DEV_BSIZE. */ #define DIRBLKSIZ 512 /* * This limits the directory name length. Its main constraint * is that it appears twice in the user structure. (u. area) */ #define MAXNAMLEN 255 struct direct { u_long d_ino; short d_reclen; short d_namlen; char d_name[MAXNAMLEN + 1]; /* typically shorter */ }; struct _dirdesc { int dd_fd; long dd_loc; long dd_size; char dd_buf[DIRBLKSIZ]; }; #undef DIRSIZ inline int DIRSIZ(direct* dp) { return ~(sizeof(ino_t) - 1) & (sizeof(struct direct) - MAXNAMLEN + dp->d_namlen + sizeof(ino_t) - 1); } typedef struct _dirdesc DIR; /* * functions defined on directories */ extern DIR *opendir(char*); extern direct *readdir(DIR*); extern long telldir(DIR*); extern void seekdir(DIR*,long); inline void rewinddir(DIR* dirp) { seekdir(dirp, 0); } extern void closedir(DIR*); c { int dd_fd; long dd_loc; long dd_size; char dd_buf[DIRBLKSIZ]; }; #undef DIRSIZ inline int DIRSIZ(direct* dp) { return ~(sizeof(ino_t) - 1) & (sizeof(struct direct) - MAXNAMLEN + dp->d_namlen + sizeof(ino_t) - 1); } typedef struct _dirdesc DIR; /* * functions defined on directories */ extern DIR *opendir(char*); extern direct *readdir(DIR*); extern long telldir(DIR*); extern void seekdir(DIR*,long); inline void rewinddir(DIR* dir./oCC/ipc.h 664 0 0 2055 4237630056 5543 /* information returned by listen */ typedef struct { int rfd; /* fd for reply */ int cfd; /* fd for communications */ char *myname; /* translated part of name */ char *name; /* untranslated part of name */ char *param; /* parameters used to set up call */ char *machine; /* machine id of caller */ char *user; /* user name of caller */ int uid, gid; /* uid, gid of caller */ char flags; /* type of communication */ } ipcinfo; /* communication flags */ #define IPC_OPEN 0x0 #define IPC_CREAT 0x1 #define IPC_HANDOFF 0x2 #define IPC_CAREFUL 0x4 /* library definitions */ extern int ipcopen(char *, char *); extern int ipccreat(char *, char *); extern ipcinfo *ipclisten(int); extern ipcinfo *ipctrylisten(int); extern int ipcaccept(ipcinfo *); extern int ipcdaccept(ipcinfo *, int, char *); extern int ipcreject(ipcinfo *, int, char *); extern int ipclogin(int); extern int ipcrogin(int, int); extern char *ipcpath(char *, char *, char *); extern int ipcexec(char *, char *, char *); /* import */ extern int errno; extern char *errstr; extern char *ipcname; library definitions */ extern int ipcopen(char *, char *); extern int ipccreat(char *, char *); extern ipcinfo *ipclisten(int); extern ipcinfo *ipctrylisten(int); extern int ipcaccept(ipcinfo *); extern int ipcdaccept(ipcinfo *, int, char *); extern int ipcreject(ipcinfo *, int, char *); extern int ipclogin(int); extern int ipcrogin(int, int); extern char *ipcpath(char *, char *, char *); extern int ipcexec(char *, char *, char *); /* import */ extern int errno./oCC/Map.h 664 0 0 16653 4353253766 5546 #ifndef MAP_H #define MAP_H 1 #ifndef GENERICH #include #endif #define Map(S,T)name4(Map_,S,_,T) #define Node(S,T)name4(_Node_,S,_,T) #define Mapiter(S,T)name4(Mapiter_,S,_,T) #define Mapdeclare(S,T) \ class Node(S,T) { \ S key; \ T value; \ Node(S,T)* L; \ Node(S,T)* R; \ Node(S,T)* U; \ char bal; \ Node(S,T)(S& xs, T& xt): key (xs), value(xt) { L = R = 0; bal = '='; } \ ~Node(S,T)(); \ void attach (Node(S,T)*& p, Node(S,T)* dest) \ { p = dest; if (dest) dest->U = this; } \ friend class Map(S,T); \ friend class Mapiter(S,T); \ }; \ \ static S name2(Map(S,T),_Sdef); \ static T name2(Map(S,T),_Tdef); \ \ class Mapiter(S,T) { \ friend class Map(S,T); \ Map(S,T)* m; \ Node(S,T)* p; \ Mapiter(S,T) (Map(S,T)* map, Node(S,T)* n) { m = map; p = n; } \ public: \ Mapiter(S,T) (Map(S,T)& map) { m = ↦ p = 0; } \ operator int() { return p != 0; } \ S key() { return p? p->key: name2(Map(S,T),_Sdef); } \ T value() { return p? p->value: name2(Map(S,T),_Tdef); } \ Mapiter(S,T)& operator++(); \ Mapiter(S,T)& operator--(); \ }; \ \ class Map(S,T) { \ friend class Mapiter(S,T); \ Node(S,T)* head; \ int n; \ T def; \ void clear(); \ T& newnode (Node(S,T)*&, S&, Node(S,T)*); \ void rotL (Node(S,T)*); \ void rotR (Node(S,T)*); \ public: \ Map(S,T)(); \ Map(S,T)(T&); \ Map(S,T)(Map(S,T)&); \ ~Map(S,T)(); \ Map(S,T)& operator= (Map(S,T)&); \ T& operator[] (S&); \ int size() { return n; } \ Mapiter(S,T) element (S&); \ Mapiter(S,T) first() { return ++Mapiter(S,T) (*this); } \ Mapiter(S,T) last() { return --Mapiter(S,T) (*this); } \ }; \ \ \ #define Mapimplement(S,T) \ \ /* \ * Node destructor -- should be inline but cfront \ * lays it down even if not needed \ */ \ \ Node(S,T)::~Node(S,T)() \ { \ delete L; \ delete R; \ } \ \ void \ Map(S,T)::clear() \ { \ delete head; \ head = 0; \ n = 0; \ } \ \ Map(S,T)::Map(S,T)(): def (name2(Map(S,T),_Tdef)) \ { \ head = 0; \ n = 0; \ } \ \ Map(S,T)::Map(S,T)(T& d): def (d) \ { \ head = 0; \ n = 0; \ } \ \ Map(S,T)::~Map(S,T)() \ { \ clear(); \ } \ \ Map(S,T)& \ Map(S,T)::operator= (Map(S,T)& m) \ { \ if (this != &m) { \ clear(); \ for (Mapiter(S,T) p (m); ++p; ) { \ S s = p.key(); /* sidestep a cfront bug */ \ (*this) [s] = p.value(); \ } \ } \ return *this; \ } \ \ Map(S,T)::Map(S,T) (Map(S,T)& m): def (m.def) \ { \ head = 0; \ n = 0; \ operator= (m); \ } \ \ T& \ Map(S,T)::newnode (Node(S,T)*& ptr, S& s, Node(S,T)* parent) \ { \ ptr = new Node(S,T) (s, def); \ T& retval = ptr->value; \ \ ptr->U = parent; \ n++; \ \ /* rebalance */ \ \ /* \ * phase 1 - run up the tree, looking for an unbalanced \ * node and unbalancing all the balanced nodes we traverse \ */ \ Node(S,T)* p = ptr->U; \ Node(S,T)* q = ptr; \ \ while (p && p->bal == '=') { \ p->bal = p->L == q? 'L': 'R'; \ q = p; \ p = p->U; \ } \ \ /* \ * p is now 0 or points at an unbalanced node. If 0, we're done. \ * Otherwise calculate the new balance factor for p. \ */ \ if (p) { \ if (p->bal == (p->L == q? 'R': 'L')) \ p->bal = '='; \ else { \ /* we have become truly unbalanced */ \ if (p->bal == 'R') { \ if (q->bal == 'R') { \ rotL (p); \ p->bal = '='; \ q->bal = '='; \ } else { \ Node(S,T)* r = q->L; \ rotR (q); \ rotL (p); \ switch (r->bal) { \ case 'L': \ p->bal = '='; \ q->bal = 'R'; \ break; \ case 'R': \ p->bal = 'L'; \ q->bal = '='; \ break; \ case '=': \ p->bal = '='; \ q->bal = '='; \ break; \ } \ r->bal = '='; \ } \ } else { \ if (q->bal == 'L') { \ rotR (p); \ p->bal = '='; \ q->bal = '='; \ } else { \ Node(S,T)* r = q->R; \ rotL (q); \ rotR (p); \ switch (r->bal) { \ case 'R': \ p->bal = '='; \ q->bal = 'L'; \ break; \ case 'L': \ p->bal = 'R'; \ q->bal = '='; \ break; \ case '=': \ p->bal = '='; \ q->bal = '='; \ break; \ } \ r->bal = '='; \ } \ } \ } \ } \ \ return retval; \ } \ \ void \ Map(S,T)::rotL (Node(S,T)* p) \ { \ Node(S,T)* q = p->R; \ Node(S,T)* u = p->U; \ p->attach (p->R, q->L); \ q->attach (q->L, p); \ if (!u) \ head = q; \ else if (u->L == p) \ u->L = q; \ else \ u->R = q; \ q->U = u; \ } \ \ void \ Map(S,T)::rotR (Node(S,T)* p) \ { \ Node(S,T)* q = p->L; \ Node(S,T)* u = p->U; \ p->attach (p->L, q->R); \ q->attach (q->R, p); \ if (!u) \ head = q; \ else if (u->R == p) \ u->R = q; \ else \ u->L = q; \ q->U = u; \ } \ \ T& \ Map(S,T)::operator[] (S& s) \ { \ if (head) { \ Node(S,T)* t = head; \ for(;;) { \ if (s < t->key) { \ if (t->L) \ t = t->L; \ else \ return newnode (t->L, s, t); \ } else if (t->key < s) { \ if (t->R) \ t = t->R; \ else \ return newnode (t->R, s, t); \ } else \ break; \ } \ return t->value; \ } else \ return newnode (head, s, 0); \ } \ \ Mapiter(S,T) \ Map(S,T)::element (S& s) \ { \ Node(S,T)* t = head; \ while (t) { \ if (s < t->key) \ t = t->L; \ else if (t->key < s) \ t = t->R; \ else \ break; \ } \ return Mapiter(S,T) (this, t); \ } \ \ Mapiter(S,T)& \ Mapiter(S,T)::operator++() \ { \ if (p) { \ if (p->R) \ p = p->R; \ else { \ while (p) { \ Node(S,T)* q = p; \ p = p->U; \ if (p && p->L == q) \ return *this; \ } \ } \ } else \ p = m->head; \ \ /* p = low(p) */ \ if (p) \ while (p->L) \ p = p->L; \ \ return *this; \ } \ \ Mapiter(S,T)& \ Mapiter(S,T)::operator--() \ { \ if (p) { \ if (p->L) \ p = p->L; \ else { \ while (p) { \ Node(S,T)* q = p; \ p = p->U; \ if (p && p->R == q) \ return *this; \ } \ } \ } else \ p = m->head; \ \ /* p = low(p) */ \ if (p) \ while (p->R) \ p = p->R; \ \ return *this; \ } \ \ \ #endif \ \ Mapiter(S,T)& \ Mapiter(S,T)::operator--() \ { ./oCC/oMap.h 664 0 0 15221 4125220262 5671 #ifndef MAP_H #define MAP_H 1 #ifndef GENERICH #include #endif #define Map(S,T)name4(Map_,S,_,T) #define Pair(S,T)name4(Pair_,S,_,T) #define Node(S,T)name4(_Node_,S,_,T) #define Mapdeclare(S,T) \ struct Pair(S,T) { \ S key; \ T data; \ Pair(S,T) (S& xs, T& xt): key (xs), data (xt) {} \ }; \ \ class Node(S,T): public Pair(S,T) { \ Node(S,T)* L; \ Node(S,T)* R; \ Node(S,T)* U; \ char bal; \ Node(S,T)(S& xs, T& xt): (xs, xt) { L = R = 0; bal = '='; } \ ~Node(S,T)() { delete L; delete R; } \ void attach (Node(S,T)*& p, Node(S,T)* dest) \ { p = dest; if (dest) dest->U = this; } \ friend class Map(S,T); \ }; \ \ class Map(S,T) { \ Node(S,T)* head; \ int n; \ T def; \ void clear(); \ T& newnode (Node(S,T)*&, S&, Node(S,T)*); \ void rotL (Node(S,T)*); \ void rotR (Node(S,T)*); \ public: \ Map(S,T)(); \ Map(S,T)(T&); \ Map(S,T)(Map(S,T)&); \ ~Map(S,T)(); \ Map(S,T)& operator= (Map(S,T)&); \ T& operator[] (S&); \ int size() { return n; } \ Pair(S,T)* element (S&); \ Pair(S,T)* succ (Pair(S,T)*); \ Pair(S,T)* pred (Pair(S,T)*); \ }; \ \ \ #define Mapimplement(S,T) \ \ void \ Map(S,T)::clear() \ { \ delete head; \ n = 0; \ } \ \ static T name2(Map(S,T),_def); \ \ Map(S,T)::Map(S,T)(): def (name2(Map(S,T),_def)) \ { \ head = 0; \ n = 0; \ } \ \ Map(S,T)::Map(S,T)(T& d): def (d) \ { \ head = 0; \ n = 0; \ } \ \ Map(S,T)::~Map(S,T)() \ { \ clear(); \ } \ \ Map(S,T)& \ Map(S,T)::operator= (Map(S,T)& m) \ { \ clear(); \ for (Pair(S,T)* p = m.succ(0); p; p = m.succ (p)) \ operator[] (p->key) = p->data; \ return *this; \ } \ \ Map(S,T)::Map(S,T) (Map(S,T)& m): def (m.def) \ { \ head = 0; \ n = 0; \ operator= (m); \ } \ \ T& \ Map(S,T)::newnode (Node(S,T)*& ptr, S& s, Node(S,T)* parent) \ { \ ptr = new Node(S,T) (s, def); \ T& retval = ptr->data; \ \ ptr->U = parent; \ n++; \ \ /* rebalance */ \ \ /* \ * phase 1 - run up the tree, looking for an unbalanced \ * node and unbalancing all the balanced nodes we traverse \ */ \ Node(S,T)* p = ptr->U; \ Node(S,T)* q = ptr; \ \ while (p && p->bal == '=') { \ p->bal = p->L == q? 'L': 'R'; \ q = p; \ p = p->U; \ } \ \ /* \ * p is now 0 or points at an unbalanced node. If 0, we're done. \ * Otherwise calculate the new balance factor for p. \ */ \ if (p) { \ if (p->bal == (p->L == q? 'R': 'L')) \ p->bal = '='; \ else { \ /* we have become truly unbalanced */ \ if (p->bal == 'R') { \ q = p->R; \ if (q->bal == 'R') { \ rotL (p); \ p->bal = '='; \ q->bal = '='; \ } else { \ Node(S,T)* r = q->L; \ rotR (q); \ rotL (p); \ switch (r->bal) { \ case 'L': \ p->bal = '='; \ q->bal = 'R'; \ break; \ case 'R': \ p->bal = 'L'; \ q->bal = '='; \ break; \ case '=': \ p->bal = '='; \ q->bal = '='; \ break; \ } \ r->bal = '='; \ } \ } else { \ q = p->L; \ if (q->bal == 'L') { \ rotR (p); \ p->bal = '='; \ q->bal = '='; \ } else { \ Node(S,T)* r = q->R; \ rotL (q); \ rotR (p); \ switch (r->bal) { \ case 'R': \ p->bal = '='; \ q->bal = 'L'; \ break; \ case 'L': \ p->bal = 'R'; \ q->bal = '='; \ break; \ case '=': \ p->bal = '='; \ q->bal = '='; \ break; \ } \ r->bal = '='; \ } \ } \ } \ } \ \ return retval; \ } \ \ void \ Map(S,T)::rotL (Node(S,T)* p) \ { \ Node(S,T)* q = p->R; \ Node(S,T)* u = p->U; \ p->attach (p->R, q->L); \ q->attach (q->L, p); \ if (!u) \ head = q; \ else if (u->L == p) \ u->L = q; \ else \ u->R = q; \ q->U = u; \ } \ \ void \ Map(S,T)::rotR (Node(S,T)* p) \ { \ Node(S,T)* q = p->L; \ Node(S,T)* u = p->U; \ p->attach (p->L, q->R); \ q->attach (q->R, p); \ if (!u) \ head = q; \ else if (u->R == p) \ u->R = q; \ else \ u->L = q; \ q->U = u; \ } \ \ T& \ Map(S,T)::operator[] (S& s) \ { \ if (head) { \ Node(S,T)* t = head; \ while (s != t->key) { \ if (s < t->key) { \ if (t->L) \ t = t->L; \ else \ return newnode (t->L, s, t); \ } else { \ if (t->R) \ t = t->R; \ else \ return newnode (t->R, s, t); \ } \ } \ return t->data; \ } else \ return newnode (head, s, 0); \ } \ \ Pair(S,T)* \ Map(S,T)::element (S& s) \ { \ Node(S,T)* t = head; \ while (t && s != t->key) { \ if (s < t->key) \ t = t->L; \ else \ t = t->R; \ } \ return t; \ } \ \ Pair(S,T)* \ Map(S,T)::succ (Pair(S,T)* p) \ { \ Node(S,T)* np = (Node(S,T)*) p; \ \ if (np) { \ if (np->R) \ np = np->R; \ else { \ while (np) { \ Node(S,T)* u = np->U; \ if (u && u->L == np) \ return u; \ np = u; \ } \ } \ } else \ np = head; \ \ /* np = low(np) */ \ if (np) \ while (np->L) \ np = np->L; \ \ return np; \ } \ \ Pair(S,T)* \ Map(S,T)::pred (Pair(S,T)* p) \ { \ Node(S,T)* np = (Node(S,T)*) p; \ \ if (np) { \ if (np->L) \ np = np->L; \ else { \ while (np) { \ Node(S,T)* u = np->U; \ if (u && u->R == np) \ return u; \ np = u; \ } \ } \ } else \ np = head; \ \ /* np = low(np) */ \ if (np) \ while (np->R) \ np = np->R; \ \ return np; \ } \ \ \ #endif air(S,T)* p) \ { \ Node(S,T)* np = (Node(S,T)*) p; \ \ if (np) { \ if (np->L) \ np = np->L; \ else { \ while (np) { \ Node(S,T)* u = np->U; \ if (u && u->R == np) \ return u; \ np = u; \ } \ } \ } else \ np = head; \ \ /* np = low(np) *./oCC/oString.h 664 0 0 23271 4133572351 6436 #ifndef STRING_DOT_H #define STRING_DOT_H #define _OVERLOAD_STAT 1 #include #include #undef _OVERLOAD_STAT overload system, access, acct, chdir, chmod, chown, creat, link, mknod, mount, open, umount, unlink, read, write; #include overload strchr, strrchr, strpbrk, strspn, strcspn; overload fopen, fdopen, freopen, gets, fgets, puts, fputs; #include #include #ifndef GENERICH #include #endif #ifndef TRUE #define FALSE 0 #define TRUE (!FALSE) #endif #ifndef BIT_DEFINED #define BIT_DEFINED typedef int bit; #endif overload min; int min(int, int); int min(int, int, int); inline int min(int i, int j) { return idummy == empty_dummy; } Charfield *myField(); Rep *canCat(int); // returns a new Rep if this can be catenated Rep *newSub(int offset, int length); /* the following are from String(3) */ int strchr(char); // position of first occurrence of char int strrchr(char); // ... last ... (-1 if char not there) int strpbrk(const Rep&); int strspn(const Rep&); int strcspn(const Rep&); }; // Strings are at the bottom working up, and Reps are at the top working down struct Charfield { Charfield *next; MtRep *emptyHead; /* of list of free Reps with no space */ Rep *lastRep; char *field; /* beginning of characters */ char *end; /* ... of data area */ char *firstFree; int usedSpace; Charfield(); Charfield(unsigned int); int compactify(unsigned int); /* return TRUE if no use */ Rep *newRep(unsigned int); char *getSpace(int); /* new String space for old Rep */ void putMt(MtRep *); Rep *getMt(); }; extern Rep *nullRep; /* the null String */ extern Rep *oneChar; /* all one-character Strings */ extern Charfield *currfield; extern char *Memcpy(char *to, const char *from, int); inline ostream& operator<<(ostream& oo, Rep& r) { return oo.put(r.start, r.len); } class String { static GPT handler; static bit startedUp; void error(int = 0, char * = 0); Rep *d; friend SubString; friend Subchar; public: String(); String(char); String(char, char); String(char, char, char); String(char, char, char, char); String(const char *); String(const char *, int); String(const String& s) { d = s.d; d->refIncr(); } String(const SubString&); String(Rep& r) { d = &r; r.refIncr(); } ~String() { d->refDecr(); } friend int stat(const String&, struct stat*); friend int system(const String&); friend int access(const String&, int); friend int acct(const String&); friend int chdir(const String&); friend int chmod(const String&, int); friend int chown(const String&, int, int); friend int creat(const String&, int); friend int link(const String&, const String&); friend int mknod(const String&, int, int); friend int mount(const String&, const String&, int); friend int open(const String&, int); friend int umount(const String&); friend int unlink(const String&); friend int read(int, String&, int); friend int write(int, const String&); friend FILE* fopen(const String&, const String&); friend FILE* fdopen(int, const String&); friend FILE* freopen(const String&, const String&, FILE*); friend puts(const String&); friend fputs(const String&, FILE*); friend inline ostream& operator<<(ostream&, const String&); friend istream& operator>>(istream&, String&); friend String operator+(const char, const String&); friend String operator+(const char*, const String&); friend Rep; friend Regexp; friend void startUp(); unsigned length (){ return d->length(); } operator void*() { return length() ? this : 0; } int hashval() { return d->hashval(); } int compare(const String& s) { return d == s.d ? 0 : d->compare(*s.d); } int compare(const char *p) { return d->compare(p); } bit operator==(const String& oo) { return compare(oo) == 0; } bit operator>(const String& oo) { return compare(oo) > 0; } bit operator>=(const String& oo) { return compare(oo) >= 0; } bit operator<=(const String& oo) { return compare(oo) <= 0; } bit operator<(const String& oo) { return compare(oo) < 0; } bit operator!=(const String& oo) { return compare(oo) != 0; } bit operator==(const char* p) { return compare(p) == 0; } bit operator>(const char* p) { return compare(p) > 0; } bit operator>=(const char* p) { return compare(p) >= 0; } bit operator<=(const char* p) { return compare(p) <= 0; } bit operator<(const char* p) { return compare(p) < 0; } bit operator!=(const char* p) { return compare(p) != 0; } // match returns the first differing position int match(const String& s) { return d == s.d ? length() : d->match(*s.d); } int match (const char* p) { return d->match(p); } String operator+(const String&); /* catenate */ String operator+(const char*); /* catenate */ String operator+(const char); /* catenate */ String& operator=(const char); String& operator=(const char *); String& operator=(const String& oo); String& put(const char); /* append or put */ String& put(const char*); /* append or put */ String& put(const String&); /* append or put */ String& operator+=(const char c) { return put(c); } String& operator+=(const String& oo) { return put(oo); } String& operator+=(const char *s) { return put(s); } bit getX(char&); /* get or lop */ bit get() { char c; return getX(c); } String& unget(const char); /* prepend */ String& unget(const String&); /* prepend */ bit unputX(char&); /* remove from back */ bit unput() { char c; return unputX(c); } bit firstX(char&); bit lastX(char&); SubString& operator() (const unsigned start, const unsigned length); Subchar& operator[] (const unsigned); /* character selection */ void dump(char *); GPT sethandler(GPT); /* the following are from String(3) */ /* position of first occurrence of char */ int strchr(const char c) { return d->strchr(c); } /* ... last ... (-1 if char not there) */ int strrchr(const char c) { return d->strrchr(c); } int strpbrk(const String& oo) { return d->strpbrk(*oo.d); } int strspn(const String& oo) { return d->strspn(*oo.d); } int strcspn(const String& oo) { return d->strcspn(*oo.d); } }; inline bit operator==(const char* p, const String s) { return s.compare(p) == 0; } inline bit operator>(const char* p, const String s) { return s < p; } inline bit operator>=(const char* p, const String s) { return s >= p; } inline bit operator<=(const char* p, const String s) { return s >= p; } inline bit operator<(const char* p, const String s) { return s > p; } inline bit operator!=(const char* p, const String s) { return s != p; } inline ostream& operator<<(ostream& oo, const String& ss) { return oo << *ss.d; } class SubString { static String *ss; static int oo; static int ll; static GPT handler; void error(int = 0, char * = 0); SubString(const SubString&); SubString(const String &ii, int off, int len) { this = 0; ss = ⅈ oo = off; ll = len; } ~SubString() { this = 0; } public: void operator=(const String&); GPT sethandler(GPT); String *it() { return ss; } int offset() { return oo; } int length() { return ll; } }; class Subchar { static String *ss; static int oo; /* position in the String */ static GPT handler; void error(int = 0, char * = 0); Subchar(const Subchar&); Subchar(const String &ii, int off) { this = 0; ss = ⅈ oo = off; } ~Subchar() { this = 0; } char operator=(const char); public: operator char() { return *(ss->d->start + oo); } GPT sethandler(GPT); String *it() { return ss; } int offset() { return oo; } }; overload length; int length(const String&); inline int length(const String &s) { return s.length(); } overload hashval; int hashval(const String&); inline int hashval(const String &s) { return s.hashval(); } overload compare; int compare(const String&,const String&); inline int compare(const String &s,const String &t) { return s.compare(t); } int strchr(const String&, const char); inline int strchr(const String& s, const char c) { return s.strchr(c); } int strrchr(const String&, const char); inline int strrchr(const String& s, const char c) { return s.strrchr(c); } int strpbrk(const String&, const String&); inline int strpbrk(const String& s, const String& t) { return s.strpbrk(t); } int strspn(const String&, const String&); inline int strspn(const String& s, const String& t) { return s.strspn(t); } int strcspn(const String&, const String&); inline int strcspn(const String& s, const String& t) { return s.strcspn(t); } String sgets(istream&); int fgets(String&, int, FILE*); int gets(String&); #endif int strrchr(const String& s, const char c) { return s.strrchr(c); } int strpbrk(const String&, const String&); inline int strpbrk(const String& s, const String& t) { return s.strpbrk(t); } int strspn(const String&, const String&); inline int strspn(const String& s, const String& t) { return s.strspn(t); } int strcspn(const S./oCC/regexp.h 644 0 0 435 4134232353 6232 #define NSUBEXP 10 struct regexp { /* see regexp(3) */ char *startp[NSUBEXP]; char *endp[NSUBEXP]; char program[1]; }; extern regexp* regcomp(const char *); extern int regexec(regexp*, const char*); extern void regsub(const regexp*, const char*, char*); extern void regerr(char*); t String&); inline int strpbrk(const String& s, const String& t) { return s.strpbrk(t); } int strspn(const String&, const String&); inline int strspn(const String& s, const String& t) { return s.strspn(t); } int strcspn(const S./oCC/iostream.h 664 0 0 35221 4157263076 6641 #ifndef STREAMH #define STREAMH extern char* memcpy(char*,const char*,int) ; /* Of course this should come in from a header. * But there is variation in where * that header is found. * */ #include /* I'd like to not include . But for * compatibility with older versions there is * an iostream constructor that expects a * FILE* argument, stdiobuf, * and iostream::sync_with_stdio. */ #ifndef NULL #define NULL 0 #endif #ifndef EOF #define EOF (-1) #endif #ifndef BUFSIZE #define BUFSIZE 1024 #endif #define cin (*iocin) #define cout (*iocout) #define cerr (*iocerr) #define cdebug (*iocdebug) #define zapeof(c) (unsigned char)(c) /* extracts char from c. The * critical requirement is * zapeof(EOF)!=EOF * (c)&0377 is an alternative * in case the cast has a bug * in your compiler. */ enum state_value { _good=0, _eof=1, _fail=2, _bad=4 }; static const int iostatebits = _eof|_fail|_bad ; enum open_mode { input=1, output=2, atend=4, append=010, binaryio=020 } ; enum seek_dir { seek_beg=0, seek_cur=1, seek_end=2 } ; typedef long int streampos ; class streambuf { short alloc; short x_unbuf; char* x_base; char* x_pbase; char* x_pptr; char* x_epptr; char* x_gptr; char* x_egptr; char* x_eback; int x_blen; int xsputn(const char* s,int n); int xsgetn(char* s,int n); public: void dbp(); protected: char* base() { return x_base ; } char* pbase() { return x_pbase ; } char* pptr() { return x_pptr ; } char* epptr() { return x_epptr ; } char* gptr() { return x_gptr ; } char* egptr() { return x_egptr ; } char* eback() { return x_eback ; } char* ebuf() { return x_base+x_blen ; } int blen() { return x_blen; } void setp(char* p, char* ep) { x_pbase=x_pptr=p ; x_epptr=ep ; } void setg(char* eb,char* g, char* eg) { x_eback=eb; x_gptr=g ; x_egptr=eg ; } void pbump(int n) { x_pptr+=n ; } void gbump(int n) { x_gptr+=n ; } void setb(char* b, char* eb, int a = 0 ) { if ( alloc && x_base ) delete x_base ; x_base = b ; if (eb < b ) { x_unbuf = 1 ; x_blen = 0 ; } else { x_unbuf = 0 ; x_blen = eb-b ; } alloc = a ; } int unbuffered() { return x_unbuf; } int allocate() { if ( x_base== 0 && !unbuffered() ) return doallocate() ; else return 0 ; } virtual int doallocate(); virtual void destructor() ; public : int in_avail() { return x_gptrx_pbase ; } virtual int overflow(int c=EOF); virtual int underflow(); virtual int pbackfail(int c); virtual int sync(); virtual streampos seek(streampos,seek_dir); /*** should be protected ***/ int sgetc() { /***WARNING: sgetc does not bump the pointer ***/ return (x_gptr>=x_egptr) ? underflow() : zapeof(*x_gptr); } int snextc() { return (x_gptr>=(x_egptr-1)) ? underflow() : zapeof(*++x_gptr); } int sbumpc() { return ( x_gptr>=x_egptr && underflow()==EOF ) ? EOF : zapeof(*x_gptr++) ; } void stossc() { if ( x_gptr++ > x_egptr ) underflow() ; } int sputbackc(char c) { if (x_gptr > x_eback ) return zapeof(*--x_gptr = c); else return pbackfail(c) ; } int sputc(int c) { return (x_pptr>=x_epptr) ? overflow(zapeof(c)) : zapeof(*x_pptr++=c); } int sputn(const char* s,int n) { if ( n <= (x_epptr-x_pptr) ) { memcpy(x_pptr,s,n) ; pbump(n); return n ; } else { return xsputn(s,n) ; } } int sgetn(char* s,int n) { if ( n <= (x_egptr-x_gptr) ) { memcpy(s,x_gptr,n) ; gbump(n); return n ; } else { return xsgetn(s,n) ; } } virtual streambuf* setbuf(char* p, int len, int count =0) ; streambuf* setbuf(unsigned char* p, int len, int count =0) ; /*** Constructors -- should be protected ***/ streambuf() ; streambuf(char* p, int l,int c=0) ; ~streambuf() ; }; class filebuf : public streambuf { /* a stream buffer for files */ protected: int xfd; open_mode mode ; char opened; streampos last_seek ; char* in_start; int last_op(); char lahead[2] ; public: filebuf() ; filebuf(int fd); filebuf(int fd, char* p, int l) ; virtual int overflow(int=EOF); virtual int underflow(); virtual int sync() ; virtual streampos seek(streampos,seek_dir) ; virtual streambuf* setbuf(char* p, int len, int count =0) ; int is_open() { return opened ; } int fd() { return xfd ; } filebuf* open(char *name, open_mode om, int prot=0664); filebuf* attach(int fd) ; int close() ; void destructor() ; }; class stdiobuf : public streambuf { /*** stdiobuf is obsolete, should be avoided ***/ FILE* fp ; int last_op ; char buf[2]; virtual int overflow(int=EOF); virtual int underflow(); virtual int sync() ; virtual streampos seek(streampos,seek_dir) ; virtual int pbackfail(int c); void destructor() ; public: stdiobuf(FILE* f) ; FILE* stdiofile() { return fp ; } }; class pipebuf : public streambuf { virtual int overflow(int); virtual int underflow(); virtual int pbackfail(int); void normalize() ; public: pipebuf() ; pipebuf(char* p, int l, int c=0) ; int full() ; int empty() ; virtual streambuf* setbuf(char* p, int l, int c) ; }; class iostream; typedef iostream& (*iostreamf)(iostream&) ; #define IOMANIP(mtype,ftype,atype) \ class mtype { \ iostream& (*fct)(iostream&,atype) ; \ atype arg ; \ friend iostream& operator<<(iostream&, mtype&) ; \ friend iostream& operator>>(iostream&, mtype&) ; \ public: \ mtype(iostream& (*f)(iostream&,atype), atype a) : \ fct(f), arg(a) { } \ } ; \ inline iostream& operator<<(iostream& ios, mtype& m) \ { \ return (*m.fct)(ios,m.arg) ; \ } \ inline iostream& operator>>(iostream& ios, mtype& m) \ { \ return (*m.fct)(ios,m.arg) ; \ } \ class ftype { \ iostream& (*fct)(iostream&,atype) ; \ public : \ ftype(iostream& (*f)(iostream&,atype)) : \ fct(f) { } \ mtype operator() (atype a) { return mtype(fct,a) ; } \ } ; \ #define IOMANIP2(mtype,ftype,ptype,atype) \ class mtype { \ iostream& (*fct)(iostream&,ptype,atype) ; \ ptype param ; \ atype arg ; \ friend iostream& operator<<(iostream&, mtype&) ; \ friend iostream& operator<<(iostream&, mtype&) ; \ public: \ mtype(iostream& (*f)(iostream&,ptype,atype), ptype p, atype a): \ fct(f), param(p), arg(a) { } \ } ; \ inline iostream& operator<<(iostream& ios, mtype& m) \ { \ return (*m.fct)(ios,m.param,m.arg) ; \ } \ inline iostream& operator>>(iostream& ios, mtype& m) \ { \ return (*m.fct)(ios,m.param,m.arg) ; \ } \ class ftype { \ iostream& (*fct)(iostream&,ptype,atype) ; \ ptype param ; \ public : \ ftype(iostream& (*f)(iostream&,ptype,atype),ptype p) : \ fct(f), param(p) { } \ mtype operator() (atype a) { return mtype(fct,param,a) ; } \ } ; \ class iostream { protected: streambuf* bp; iostream* tied_to; int state; enum { io_tied=010, io_skipws=020 } ; int ispecial; int ospecial; int freewhat ; int x_gcount ; void eatwhite() ; int sync() { return bp->sync() ; } void xget(char* c,int sk) ; int do_ipfx(int noskipws) ; int do_opfx() ; void setstate(int b) { state|=b ; ispecial|=b; ospecial|=b; } private: short x_convbase ; short x_width ; short x_precision; char x_fill; char x_ladjust; char x_showbase; public: iostream(streambuf* b,int sk=1, iostream *t=0) ; iostream(FILE*) ; /*** obsolete ***/ iostream(int fd) ; /*** obsolete, use fstream */ iostream(int size, char* p,int sk=1) ; /*** obsolete, use strstream ***/ ~iostream() ; int convbase() { return x_convbase ; } void convbase(int b) { if ( b==0 || b==10 || b==8 || b==16 ) x_convbase=b ; else x_convbase=10 ; } int width() { return x_width ; } void width(int w) { x_width = w ; } char fill() { return x_fill ; } void fill(char f) { x_fill = f ; } int ladjust() { return x_ladjust ; } void ladjust(int a) { x_ladjust = a ; } int precision() { return x_precision ; } void precision(int a) { x_precision = a ; } int showbase() { return x_showbase ; } void showbase(int s) { x_showbase = s ; } void sync_with_stdio() ; iostream& operator<< (iostreamf f) { return (*f)(*this) ; } iostream& operator>> (iostreamf f) { return (*f)(*this) ; } int rdstate() { return state; } operator int() { return !(state&(_fail|_bad)) ; } int operator!() { return state&(_fail|_bad) ; } int eof() { return state&_eof; } int fail() { return state&(_fail|_bad) ; } int bad() { return state&_bad ; } int good() { return state == _good; } void clear(state_value i =0) { state = i & iostatebits ; ispecial = (ispecial&~iostatebits) | state ; ospecial = (ospecial&~iostatebits) | state ; } streambuf* rdbuf() { return bp ;} int ipfx(int noskipws=0) { return ( !(noskipws?(ispecial&~io_skipws):ispecial) || do_ipfx(noskipws) ) ; } int opfx() /* Output prefix */ { return !ospecial || do_opfx() ; } iostream& flush() ; streampos tell() { return bp->seek(0,seek_cur) ; } iostream& seek(streampos p, seek_dir d) { if ( bp->seek(p,d) == EOF ) setstate(_bad) ; return *this ; } iostream& operator<<(const char*); iostream& operator<<(int a); /* beware: << 'a' writes 97 */ iostream& operator<<(long); iostream& operator<<(double); iostream& operator<<(unsigned int a); iostream& operator<<(unsigned long); iostream& operator<<(void*); iostream& operator<<(streambuf*); iostream& put(char c) { if ( !ospecial ) { if ( bp->sputc(c) == EOF ) { setstate(_eof|_fail) ; } } return *this ; } iostream& write(const char* s,int n) { if ( !state ) { if ( bp->sputn(s,n) != n ) setstate(_eof|_fail); } return *this ; } iostream& write(const unsigned char* s, int n) { return write((const char*)s,n); } iostream& operator>>(char*); iostream& operator>>(unsigned char*); iostream& operator>>(unsigned char& c) { if ( !ispecial && bp->in_avail() ) { c = bp->sbumpc() ; } else { xget((char*)&c,ispecial&io_skipws) ; } return *this ; } iostream& operator>>(char& c) { if ( !ispecial && bp->in_avail() ) { c = bp->sbumpc() ; } else { xget(&c,ispecial&io_skipws) ; } return *this ; } iostream& operator>>(short&); iostream& operator>>(int&); iostream& operator>>(long&); iostream& operator>>(unsigned short&); iostream& operator>>(unsigned int&); iostream& operator>>(unsigned long&); iostream& operator>>(float&); iostream& operator>>(double&); iostream& operator>>(streambuf*); iostream& get(char* , int lim, char delim='\n'); iostream& get(unsigned char* b,int lim, char delim='\n'); iostream& getline(char* b, int lim, char delim='\n'); iostream& getline(unsigned char* b, int lim, char delim='\n'); iostream& get(streambuf& sb, char delim ='\n'); iostream& get(unsigned char& c) { if ( !(ispecial&~io_skipws) && bp->in_avail()) { x_gcount = 1 ; c = bp->sbumpc() ; } else { xget((char*)&c,0) ; } return *this ; } iostream& get(char& c) { if ( !(ispecial&~io_skipws) && bp->in_avail()) { x_gcount = 1 ; c = bp->sbumpc() ; } else { xget(&c,0) ; } return *this ; } int get() { unsigned char c ; return get(c) ? zapeof(c) : EOF ; } iostream& read(char* s,int n); iostream& ignore(int n=1,int delim=EOF) ; iostream& read(unsigned char* s,int n) { return read((char*)s,n) ; } int gcount() ; iostream& putback(char c); iostream* tie(); iostream* tie(iostream* s); int skip() ; int skip(int i) ; }; typedef iostream ostream ; typedef iostream istream ; class fstream: public iostream { filebuf buf ; public: fstream() ; fstream(char* name, open_mode mode,int prot=0664) ; fstream(int fd) ; fstream(int fd, char* p, int l) ; ~fstream() ; int open(char* name, open_mode mode, int prot=0664) ; int attach(int fd); int close() ; streambuf* setbuf(char* p, int l,int count) ; filebuf* rdbuf() { return &buf ; } } ; class strstream ; class strstreambuf : public streambuf { void* (*afct)(long) ; void (*ffct)(void*) ; int ignore_oflow ; int froozen ; int auto_extend ; int doallocate() ; int overflow(int) ; int underflow() ; void destructor() ; streambuf* setbuf(char* p, int l, int c) ; public: strstreambuf(void* (*a)(long) = 0 , void (*f)(void*) = 0) ; void init( char* b, int size, char* pstart) ; void init( unsigned char* b, int size, unsigned char* pstart) ; void freeze(int n=1) ; char* str() ; } ; class strstream : public iostream { strstreambuf buf ; public: strstream(char* str, open_mode mode, int size = 0); strstream(unsigned char* str, open_mode mode, int size = 0); strstream(void* (*allocator)(long), void (*freer)(void*) ) ; strstream() ; ~strstream() ; char* str() ; int pcount() ; strstreambuf* rdbuf() ; } ; extern istream* iocin; /* buffered standard input (file descriptor 0) */ extern ostream* iocout; /* buffered standard output (file descriptor 1) */ extern ostream* iocerr; /* unbuffered error output (file descriptor 2) */ extern ostream* iocdebug; /* buffered error output (file descriptor 2) */ IOMANIP(iomanip,ioap,int) ; iostream& WS(iostream& i) ; iostream& ENDS(iostream& i) ; iomanip setbase(int b) ; iomanip setw(int w) ; iostream& HEX(iostream&) ; iostream& DEC(iostream&) ; iostream& OCT(iostream&) ; iostream& FLUSH(iostream&) ; static class Iostream_init { static int stdstatus ; /* see cstreams.c */ static int initcount ; /* initialized to 0 automatically */ friend iostream ; public: Iostream_init() ; ~Iostream_init() ; } iostream_init ; /* The constructor is called once for * every time this header file is #included. * It initializes the package, including * cin, cout, cerr and cdebug. */ /***************************** output conversions ********************* * These are obsolete and included for compatibility * with earlier stream package. *********************/ extern char* oct(long, int =0); extern char* dec(long, int =0); extern char* hex(long, int =0); extern char* chr(int, int =0); /* chr(0) is the empty string "" */ extern char* str(const char*, int =0); extern char* form(const char* ...); /* printf format * Things may go terribly wrong (maybe even core * dumps, if form tries to create a string with * more than "max_field_width" characters. */ #endif *********************/ extern char* oct(long, int =0); extern char* dec(long, int =0); extern char* hex(long, int =0); extern char* chr(int, int =0); /* chr(0) is the empty string "" */ extern char* str(const char*, int =0); extern char* form(const char* ...); /* printf format * Things may go terribly wrong (maybe even core ./oCC/fio.h 666 0 0 3003 4215537642 5544 #define FIOBSIZE 4096 typedef struct Fbuffer { unsigned char *next; /* next char to be used */ unsigned char *end; /* first invalid char */ unsigned char *lnext; /* previous value of next */ unsigned short flags; /* see FIO_.* below */ short oflush; /* if >= 0 fd to flush on read */ long offset; /* seek of end */ unsigned char buf[FIOBSIZE]; } Fbuffer; extern Fbuffer *Ffb[]; #define FIORESET(f) ((f)->next=(f)->lnext=(f)->end=(f)->buf, (f)->flags=0, (f)->oflush= -1) #define FIOSET(f, fd) if((f=Ffb[fd&=0x7f]) == 0){Finit(fd,(char *)0);f=Ffb[fd];} /* FIOLINELEN is length of last input */ #define FIOLINELEN(fd) (((int)(Ffb[fd]->next - Ffb[fd]->lnext))-1) /* FIOSEEK is lseek of next char to be processed */ #define FIOSEEK(fd) (Ffb[fd]->offset - (Ffb[fd]->end - Ffb[fd]->next)) #define FIOFLUSH(fd) if((fd >= 0) && Ffb[fd]) Fflush(fd) #define FIO_RDLAST 0x0001 /* true if last input was rdline */ #define FIO_WRITING 0x0002 /* true if last action was write */ extern void Finit(int, char *); extern char *Frdline(int); extern void Fundo(int); extern int Fgetc(int); extern long Fread(int, char *, long); extern long Fseek(int, long, int); extern int Fflush(int); extern int Fprint(int, char * ...); #ifdef FIO_IMP /* COUNT is the type of counts to things like read, write, memcpy etc */ #ifdef GNOT #define COUNT long #define FIOMALLOC(n) malloc(n) #define SEEK(a,b,c) seek(a,b,c) #else #define COUNT int #define FIOMALLOC(n) malloc(n) #define SEEK(a,b,c) lseek(a,b,c) #endif extern COUNT read(), write(); #endif r *Frdline(int); extern void Fundo(int); extern int Fgetc(int); extern long Fread(int, char *, long); extern long Fseek(int, long, int); extern int Fflush(int); extern int Fprint(int, char * ...); #ifdef FIO_IMP /* COUNT is the type of counts to things like read, write, memcpy etc */ #ifdef GNOT #define COUNT long #define FIOMALLOC(n) malloc(n) #define SEEK(a,b,c) seek(a,b,c) #else #define COUNT int #define FIOMALLOC(n) malloc(n) #define SEEK(a,b,c) lseek(a,b,c) #endif extern COUNT read(), write(); #end./oCC/Block.h 664 0 0 6615 4353253724 6032 #ifndef BLOCK_H #define BLOCK_H 1 #ifndef GENERICH #include #endif #define Block(T)name2(Block_,T) #define Blockdeclare(T) \ \ class Block(T) { \ public: \ Block(T)() { n = 0; p = 0; } \ Block(T)(unsigned k) { n = 0; p = 0; size(k); } \ Block(T)(const Block(T)& b) { copy(b); } \ ~Block(T)() { delete[n] p; } \ Block(T)& operator=(const Block(T)& b) { \ delete[n] p; \ copy(b); \ return *this; \ } \ operator T*() { return p; } \ T* end() { return p + n; } \ T& operator[](int i) { return p[i]; } \ unsigned size() { return n; } \ unsigned size(unsigned); \ int reserve(unsigned k) { return k> 1) + 1; \ T* np = new T[nn]; \ if (!np) { \ nn = k+1; \ np = new T[nn]; \ } \ move(np, nn); \ return n; \ } \ \ /* Transfer len (or fewer) elements into this Block. */ \ void \ Block(T)::transfer(T* source, unsigned len) \ { \ register T* plim; \ register T* pp = p; \ register T* q = source; \ \ if (n > len) { \ plim = p + len; \ clear(plim, n - len); \ } else \ plim = p + n; \ \ while (pp < plim) \ *pp++ = *q++; \ } \ \ /* \ * The contents of this Block now live in memory starting at np \ * If np is 0, null out this Block. \ */ \ void \ Block(T)::move(T* np, unsigned nn) \ { \ T* oldp = p; \ unsigned oldn = n; \ p = np; \ if (np) { \ n = nn; \ transfer(oldp, oldn); \ } else \ n = 0; \ delete[oldn] oldp; \ } \ \ /* Exchange the contents of this Block with another Block */ \ void \ Block(T)::swap(Block(T)& b) \ { \ T* bp = b.p; \ unsigned bn = b.n; \ b.p = p; \ b.n = n; \ p = bp; \ n = bn; \ } \ \ #endif \ { \ T* oldp = p; \ unsigned oldn = n; \ p = np; \ if (np) { \ n = nn; ./oCC/stdarg.h 664 0 0 1141 3514111035 6233 /* stdarg.h */ /* USAGE: f( arg-declarations ... ) { va_list ap; va_start(ap, parmN); // parmN == last named arg // ... type arg = va_arg(ap, type); // ... va_end(ap); } */ #ifndef va_start typedef char *va_list; #define va_end(ap) #ifdef u370 #define va_start(ap, parmN) ap =\ (char *) ((int)&parmN + 2*sizeof(parmN) - 1 & -sizeof(parmN)) #define va_arg(ap, mode) ((mode *)(ap = \ (char *) ((int)ap + 2*sizeof(mode) - 1 & -sizeof(mode))))[-1] #else #define va_start(ap, parmN) ap = (char *)( &parmN+1 ) #define va_arg(ap, mode) ((mode *)(ap += sizeof(mode)))[-1] #endif #endif / parmN == last named arg // ... type arg = va_arg(ap, type); // ... va_end(ap); } */ #ifndef va_start typedef char *va_list; #define va_end(ap) #ifdef u370 #define va_start(ap, parmN) ap =\ (char *) ((int)&parmN + 2*sizeof(parmN) - 1 & -sizeof(parmN)) #define va_arg(ap, mode) ((mode *)(ap = \ (char *) ((int)ap + 2*sizeof(mode) - 1 & -sizeof(mode))))[-1] #else #define va_start(ap, parmN) ap = (./oCC/CCversion.h 664 0 0 271 4402576447 6650 // This file defines things that are convenient for people // who want to cope simultaneously with several different cfronts. #ifndef __const #define __const #define externC #endif ap); } */ #ifndef va_start typedef char *va_list; #define va_end(ap) #ifdef u370 #define va_start(ap, parmN) ap =\ (char *) ((int)&parmN + 2*sizeof(parmN) - 1 & -sizeof(parmN)) #define va_arg(ap, mode) ((mode *)(ap = \ (char *) ((int)ap + 2*sizeof(mode) - 1 & -sizeof(mode))))[-1] #else #define va_start(ap, parmN) ap = (./olcc/ 775 0 0 0 4407760003 4777 ./olcc/assert.h 664 0 0 313 4363166154 6523 #ifndef __ASSERT #define __ASSERT #ifdef NDEBUG #define assert(b) #else #define assert(b) (b || (fprintf(stderr, "assertion failed: file %s, line %d\n", \ __FILE__, __LINE__), abort())) #endif #endif ef va_start typedef *va¥CÕ´ÿdefine va_en) #i¥C÷´ÿT>à´ÿø´ÿ_start(ap, p T>ü´ÿµÿar *) ((int)&par 2*srmN)`#$4407760003"<,µÿø´ÿolcc 4777"<Hµÿµÿ Ƽ+üÿÿoTµÿ£5ÀÀ+£†pµÿ^%´Ý,./olcc/errno.h 664 0 0 216 4363166155 6352 #ifndef __ERRNO #define __ERRNO #include "/usr/include/errno.h" extern int errno; extern char* sys_errlist[]; extern int sys_nerr; #endif line %d\n", \ __FILE__, __LINE__), abort())) #endif #endif ef va_start typedef *va¥CÕ´ÿdefine va_en) #i¥C÷´ÿT>à´ÿø´ÿ_start(ap, p T>ü´ÿµÿar *) ((int)&par 2*srmN)`#$4407760003"<,µÿø´ÿolcc 4777"<Hµÿµÿ Ƽ+üÿÿoTµÿ£5ÀÀ+£†pµÿ^%´Ý,./olcc/libc.h 664 0 0 12534 4407757277 6216 /* * mem routines */ void* memccpy(void*, void*, int, long); void* memset(void*, int, long); int memcmp(void*, void*, long); void* memcpy(void*, void*, long); void* memchr(void*, int, long); /* * string routines */ char* strcat(char*, char*); char* strchr(char*, char); int strcmp(char*, char*); char* strcpy(char*, char*); char* strdup(char*); char* strncat(char*, char*, long); char* strncpy(char*, char*, long); int strncmp(char*, char*, long); char* strpbrk(char*, char*); char* strrchr(char*, char); char* strtok(char*, char*); long strlen(char*); long strspn(char*, char*); long strcspn(char*, char*); /* * malloc */ void* malloc(long); void free(void*); void* calloc(long, long); void* realloc(void*, long); void cfree(void*); void* galloc(unsigned int); void gfree(void*); void garbage(void); /* * print routines */ void strconv(char*, int, int); int fmtinstall(char, int (*)(void*, int, int, int)); char* doprint(char*, char*, void*); char* donprint(char*, char*, char*, void*); void flt_init(void); int print(char*, ...); int sprint(char*, char*, ...); int fprint(int, char*, ...); /* * random number */ void srand(long); int rand(void); int nrand(int); long lrand(void); long lnrand(long); double frand(void); /* * math */ double pow(double, double); double atan2(double, double); double fabs(double); double atan(double); double log(double); double log10(double); double exp(double); double erf(double); double erfc(double); double floor(double); double ceil(double); double gamma(double); double hypot(double, double); double sin(double); double cos(double); double tan(double); double asin(double); double acos(double); double sinh(double); double cosh(double); double tanh(double); double sqrt(double); #define HUGE 3.4028234e38 #define PIO2 1.570796326794896619231e0 #define PI (PIO2+PIO2) /* * one-of-a-kind */ int abs(int); long labs(long); int gcd(int, int); int lcm(int, int); int min(int, int); int max(int, int); double atof(char*); long atol(char*); int atoi(char*); double pow10(int); double frexp(double, int*); double ldexp(double, int); double modf(double, double*); char* getenv(char*); char* mktemp(char*); int exit(int); void qsort(void*, long, long, int (*)(void*, void*)); void monitor(int(*)(), int(*)(), void*, long, ...); void perror(char*); char* crypt(char*, char*); void setkey(char*); void encrypt(char*, int); int getfields(char*, char**, int); int getmfields(char*, char**, int); void setfields(char*); char* getlogin(void); int getopt(int, char**, char*); char* getpass(char*); char* getwd(char*); char* getcwd(char*, int); int isatty(int); int onexit(int (*)(void)); int ptopen(char*); void sleep(unsigned int); void swab(void*, void*, int); char* tmpnam(char*); char* ttyname(int); int ttyslot(int); void abort(void); /* * Time-of-day */ typedef struct tm { int tm_sec; int tm_min; int tm_hour; int tm_mday; int tm_mon; int tm_year; int tm_wday; int tm_yday; int tm_isdst; } Tm; Tm* gmtime(long*); Tm* localtime(long*); char* asctime(Tm*); char* ctime(long*); char* timezone(int, int); #define MAXNAMLEN 255 #define DIRBLKSIZ 512 typedef struct direct { unsigned long d_ino; short d_reclen; short d_namlen; char d_name[MAXNAMLEN+1]; } Direct; typedef struct _dirdesc { int dd_fd; long dd_loc; /* where we left off in dd_buf */ long dd_size; /* bytes back from system */ long dd_offset; /* lseek at beginning of dd_buf */ char dd_buf[DIRBLKSIZ]; } DIR; DIR* opendir(); Direct* readdir(); long telldir(); void seekdir(); void closedir(); /* * manual section 2 * */ typedef struct stat { unsigned short st_dev; unsigned short st_ino; unsigned short st_mode; short st_uid; short st_gid; unsigned short st_rdev; long st_size; long st_atime; long st_mtime; long st_ctime; } Stat; typedef struct fd_set { unsigned int fds_bits[5]; } Fd_set; struct tms { long tms_utime; long tms_stime; long tms_cutime; long tms_cstime; }; int access(char*, int); int acct(char*); unsigned alarm(int); int brk(void*); int chdir(char*); int chmod(char*, int); int chroot(char*); int chown(char*, int, int); int close(int); int creat(char*, int); int dup(int); int dup2(int, int); int execl(char*, ...); int execle(char*, ...); int execlp(char*, ...); int exect(char*, char**, char**); int execv(char*, char**); int execve(char*, char**, char**); int execvp(char*, char**); void _exit(int); int fmount(int, int, char*, int); int fchmod(int, int); int fchown(char*, int, int); int funmount(char*); int fork(void); int fstat(int, Stat*); int getegid(void); int geteuid(void); int getgid(void); int getlogname(char*); int getpid(void); int getppid(void); int getuid(void); int ioctl(int, int, void*); int kill(int, int); int link(char*, char*); long lseek(int, long, int); int lstat(char*, Stat*); int mkdir(char*, int); int mknod(char*, int, int); int mount(char*, char*); int nap(int); int nice(int); int newpgrp(void); int open(char*, int); int pipe(int[2]); int profil(void*, int, int, int); long read(int, void*, int); int readlink(char*, char*, int); int reboot(int); int rmdir(char*); void* sbrk(int); int select(int, Fd_set*, Fd_set*, int); long settod(long); void (*signal(int, void (*)(int)))(int); int stat(char*, Stat*); int stime(long*); void sync(void); int symlink(char*, char*); int syscall(int, ...); int times(struct tms*); int unmount(char*, char*); int umask(int); int unlink(char*); int utime(char*, long[2]); int wait(int*); long write(int, void*, int); t profil(void*, int, int, int); long read(int, void*, int); int readlink(char*, char*, int); int reboot(int); int rmdir(char*); void* sbrk(int); int select(int, Fd_./olcc/math.h 664 0 0 1323 4363166156 6177 #ifndef __MATH #define __MATH #define HUGE_VAL 1.0e38 extern double acos(double); extern double asin(double); extern double atan(double); extern double atan2(double, double); extern double ceil(double); extern double cos(double); extern double cosh(double); extern double exp(double); extern double fabs(double); extern double floor(double); extern double fmod(double, double); extern double frexp(double, int*); extern double ldexp(double, int); extern double log(double); extern double log10(double); extern double modf(double, double*); extern double pow(double, double); extern double sin(double); extern double sinh(double); extern double sqrt(double); extern double tan(double); extern double tanh(double); #endif double cos(double); extern double cosh(double); extern double exp(double); extern double fabs(double); extern double floor(double); extern double fmod(double, double); extern double frexp(double, int*); extern double ldexp(double, int); extern double log(double); extern double log10(double); extern ./olcc/u.h 664 0 0 227 4407757277 5505 typedef unsigned short ushort; typedef unsigned char uchar; typedef unsigned long ulong; typedef long vlong; #define Length long hlenght; long length ern double tan(double); extern double tanh(double); #endif double cos(double); extern double cosh(double); extern double exp(double); extern double fabs(double); extern double floor(double); extern double fmod(double, double); extern double frexp(double, int*); extern double ldexp(double, int); extern double log(double); extern double log10(double); extern ./olcc/setjmp.h 664 0 0 204 4363166161 6521 #ifndef __SETJMP #define __SETJMP typedef int jmp_buf[10]; extern void longjmp(jmp_buf, int); extern int setjmp(jmp_buf); #endif enght; long length ern double tan(double); extern double tanh(double); #endif double cos(double); extern double cosh(double); extern double exp(double); extern double fabs(double); extern double floor(double); extern double fmod(double, double); extern double frexp(double, int*); extern double ldexp(double, int); extern double log(double); extern double log10(double); extern ./olcc/stdarg.h 664 0 0 323 4363166161 6505 #ifndef __STDARG #define __STDARG typedef char* va_list; #define va_start(list, start) list = (char *) (&(start)+1) #define va_end(list) #define va_arg(list, mode) ((mode *)(list += sizeof(mode)))[-1] #endif double cos(double); extern double cosh(double); extern double exp(double); extern double fabs(double); extern double floor(double); extern double fmod(double, double); extern double frexp(double, int*); extern double ldexp(double, int); extern double log(double); extern double log10(double); extern ./olcc/stddef.h 664 0 0 261 4363166161 6473 #ifndef __STDDEF #define __STDDEF typedef long ptrdiff_t; typedef unsigned int size_t; typedef char wchar_t; #define NULL 0 #define offsetof(t,x) ((int)&(((t*)0)->x)) #endif ist += sizeof(mode)))[-1] #endif double cos(double); extern double cosh(double); extern double exp(double); extern double fabs(double); extern double floor(double); extern double fmod(double, double); extern double frexp(double, int*); extern double ldexp(double, int); extern double log(double); extern double log10(double); extern ./olcc/stdio.h 664 0 0 4661 4363166161 6374 #include #define BUFSIZ 4096 #define _NFILE 120 extern struct _iobuf { int _cnt; unsigned char *_ptr; unsigned char *_base; short _flag; char _file; } _iob[_NFILE]; #define _IOREAD 01 #define _IOWRT 02 #define _IONBF 04 #define _IOMYBUF 010 #define _IOEOF 020 #define _IOERR 040 #define _IOSTRG 0100 #define _IOLBF 0200 #define _IORW 0400 #define NULL 0 #define FILE struct _iobuf #define EOF (-1) #define stdin (&_iob[0]) #define stdout (&_iob[1]) #define stderr (&_iob[2]) #define getc(p) (--(p)->_cnt>=0? (int)*(p)->_ptr++:_filbuf(p)) #define getchar() getc(stdin) #define putc(x,p) (--(p)->_cnt>=0? ((int)(*(p)->_ptr++=(x))):_flsbuf((x),p)) #define putchar(x) putc(x,stdout) #define feof(p) (((p)->_flag&_IOEOF)!=0) #define ferror(p) (((p)->_flag&_IOERR)!=0) #define fileno(p) ((p)->_file) #define TMP_MAX 25 #define FOPEN_MAX 40 #define FILENAME_MAX 120 #define SEEK_CUR 1 /* 3rd arg of fseek */ #define SEEK_END 2 #define SEEK_SET 0 typedef long fpos_t; extern void clearerr(FILE*); extern int fclose(FILE*); extern FILE* fdopen(int, char*); extern int fflush(FILE*); extern int fgetc(FILE*); extern int fgetpos(FILE *, fpos_t *); /* like ftell */ extern char* fgets(char*, int, FILE*); extern FILE* fopen(const char*, const char*); extern int fprintf(FILE*, char* ,...); extern int fputc(int, FILE*); extern int fputs(const char*, FILE*); extern size_t fread(void*, size_t, size_t, FILE*); extern FILE* freopen(const char*, const char*, FILE*); extern int fscanf(FILE*, const char* ,...); extern int fseek(FILE*, long, int); extern int fsetpos(FILE*, const fpos_t *); extern long ftell(FILE*); extern size_t fwrite(const void*, size_t, size_t, FILE*); extern char* gets(char*); extern int getw(FILE*); extern int pclose(FILE*); /* extern void perror(const char*); */ extern FILE* popen(char*, char*); extern int printf(const char* ,...); extern int puts(char*); extern int putw(int, FILE*); extern int remove(const char *filename); extern int rename(const char *, const char *); extern void rewind(FILE*); extern int scanf(const char* ,...); extern void setbuf(FILE*, char*); extern int setvbuf(FILE *, char *, int mode, size_t size); /* extern int sprintf(char*, const char* ,...); */ extern int sscanf(const char*, const char* ,...); extern FILE* tmpfile(void); extern char* tmpnam(char *s); extern int ungetc(int, FILE*); extern int vfprintf(FILE*, char* ,...); extern int vprintf(const char* ,...); extern int vsprintf(char*, const char* ,...); n int rename(const char *, const char *); extern void rewind(FILE*); extern int./olcc/stdlib.h 664 0 0 2041 4363166162 6522 #ifndef __STDLIB #define __STDLIB #include #define ERANGE 38 #define RAND_MAX ((unsigned)1<<31)-1) #define EXIT_FAILURE 1 #define EXIT_SUCCESS 0 typedef int div_t; typedef long ldiv_t; extern int abort(void); extern int abs(int); extern int atexit(void (*)(void)); extern double atof(const char*); extern int atoi(const char*); extern long atol(const char*); extern void* bsearch(const void*, const void*, size_t, size_t, int (*)(const void*, const void*)); extern void* calloc(size_t, size_t); extern div_t div(int); extern void exit(int); extern void free(void*); extern char* getenv(const char*); extern long labs(long); extern ldiv_t ldiv(long, long); extern void* malloc(size_t); extern void qsort(void*, size_t, size_t, int (*)(const void*, const void*)); extern int rand(void); extern void* realloc(void*, size_t); extern void srand(unsigned int); extern double strtod(const char*, char**); extern long strtol(const char*, char**, int); extern unsigned long strtoul(const char*, char**, int); extern int system(const char *); #endif exit(int); extern void free(void*); extern char* getenv(const char*); extern long labs(long); extern ldiv_t ldiv(long, long); extern void* malloc(size_t); extern void qsort(void*, size_t, size_t, int (*)(const void*, const void*)); extern int rand(void); extern void* realloc(void*, size_t); extern void srand(unsigned int); extern double strtod(const char*, char**); extern long strtol(const char*, char**, int); extern unsigned long strtoul(const char*, char**, int); extern i./olcc/string.h 664 0 0 1676 4363166162 6564 #include #ifndef __STRING #define __STRING extern void* memchr(const void*, int, size_t); extern int memcmp(const void*, const void*, size_t); extern void* memcpy(void*, const void*, size_t); extern void* memmove(void*, const void*, size_t); extern void* memset(void*, int, size_t); extern char* strcat(char*, const char*); extern char* strchr(const char*, int); extern int strcmp(const char*, const char*); extern char* strcpy(char*, const char*); extern int strcspn(const char*, const char*); extern char* strerror(int); extern size_t strlen(const char*); extern char* strncat(char*, const char*, size_t); extern int strncmp(const char*, const char*, size_t); extern char* strncpy(char*, const char*, size_t); extern char* strpbrk(const char*, const char*); extern char* strrchr(const char*, int); extern int strspn(const char*, const char*); extern char* strstr(const char*, const char*); extern char* strtok(char*, const char*); #endif , const char*); extern int strcspn(const char*, const char*); ex./olcc/time.h 664 0 0 1444 4363166162 6205 /* * Structure returned by gettimeofday(2) system call, * and used in other calls. */ struct timezone { long tz_minuteswest; /* minutes west of Greenwich */ long tz_dsttime; /* type of dst correction */ }; #define DST_NONE 0 /* not on dst */ #define DST_USA 1 /* USA style dst */ #define DST_AUST 2 /* Australian style dst */ #define DST_WET 3 /* Western European dst */ #define DST_MET 4 /* Middle European dst */ #define DST_EET 5 /* Eastern European dst */ /* * Structure returned by gmtime and localtime calls (see ctime(3)). */ typedef struct tm { int tm_sec; int tm_min; int tm_hour; int tm_mday; int tm_mon; int tm_year; int tm_wday; int tm_yday; int tm_isdst; } Tm; extern Tm* gmtime(long); extern Tm* localtime(long); extern char* asctime(Tm*); extern char* ctime(long); ine DST_AUST 2 /* Australian style dst */ #define DST_WET 3 /* Western European dst */ #define DST_MET 4 /* Middle European dst */ #define DST_EET 5 /* Eastern European dst */ /* * Structure returned by gmtime and l./olcc/fio.h 664 0 0 2703 4407757277 6037 #define FIOBSIZE 4096 #define NOFILE 20 typedef struct { char *next; /* next char to be used */ char *end; /* first invalid char */ char *lnext; /* previous value of next */ short flags; /* see FIO_.* below */ short oflush; /* if >= 0 fd to flush on read */ long offset; /* seek of end */ char buf[FIOBSIZE]; } Fbuffer; Fbuffer* Ffb[NOFILE]; #define FIORESET(f) ((f)->next=(f)->lnext=(f)->end=(f)->buf, (f)->flags&= ~FIO_MALLOCED, (f)->oflush= -1) #define FIOSET(f, fd) if((f=Ffb[fd&=0x7f]) == 0){Finit(fd,(char *)0);f=Ffb[fd];} /* FIOLINELEN is length of last input */ #define FIOLINELEN(fd) (((int)(Ffb[fd]->next - Ffb[fd]->lnext))-1) /* FIOSEEK is lseek of next char to be processed */ #define FIOSEEK(fd) (Ffb[fd]->offset - (Ffb[fd]->end - Ffb[fd]->next)) #define FIOFLUSH(fd) if((fd >= 0) && Ffb[fd]) Fflush(fd) #define FIO_RDLAST 0x0001 /* true if last input was rdline */ #define FIO_WRITING 0x0002 /* true if last action was write */ #define FIO_MALLOCED 0x0004 /* set if Finit did the malloc */ extern void Finit(int, void*); extern void Fclose(int); extern char* Frdline(int); extern void Fundo(int); extern int Fgetc(int); extern int Fputc(int, int); extern long Fread(int, void*, long); extern long Fwrite(int, void*, long); extern long Fseek(int, long, int); extern int Fflush(int); extern int Ffillbuf(int); extern void Fexit(int); extern int F_flush(Fbuffer*, int); extern void Ftie(int, int); extern int Fprint(int, char *, ...); */ #define FIO_MALLOCED 0x0004 /* set if Finit did the mall./libc/ 775 0 0 0 5343551703 4775 ./libc/fio.h 664 0 0 2713 4742255631 6016 #define FIOBSIZE 4096 #define NOFILE 20 typedef struct { char *next; /* next char to be used */ char *end; /* first invalid char */ char *lnext; /* previous value of next */ short flags; /* see FIO_.* below */ short oflush; /* if >= 0 fd to flush on read */ long offset; /* seek of end */ char buf[FIOBSIZE]; } Fbuffer; extern Fbuffer* Ffb[NOFILE]; #define FIORESET(f) ((f)->next=(f)->lnext=(f)->end=(f)->buf, (f)->flags&= ~FIO_MALLOCED, (f)->oflush= -1) #define FIOSET(f, fd) if((f=Ffb[fd&=0x7f]) == 0){Finit(fd,(char *)0);f=Ffb[fd];} /* FIOLINELEN is length of last input */ #define FIOLINELEN(fd) (((int)(Ffb[fd]->next - Ffb[fd]->lnext))-1) /* FIOSEEK is lseek of next char to be processed */ #define FIOSEEK(fd) (Ffb[fd]->offset - (Ffb[fd]->end - Ffb[fd]->next)) #define FIOFLUSH(fd) if((fd >= 0) && Ffb[fd]) Fflush(fd) #define FIO_RDLAST 0x0001 /* true if last input was rdline */ #define FIO_WRITING 0x0002 /* true if last action was write */ #define FIO_MALLOCED 0x0004 /* set if Finit did the malloc */ extern void Finit(int, void*); extern void Fclose(int); extern char* Frdline(int); extern void Fundo(int); extern int Fgetc(int); extern int Fputc(int, int); extern long Fread(int, void*, long); extern long Fwrite(int, void*, long); extern long Fseek(int, long, int); extern int Fflush(int); extern int Ffillbuf(int); extern void Fexit(int); extern int F_flush(Fbuffer*, int); extern void Ftie(int, int); extern int Fprint(int, char *, ...); */ #define FIO_MALLOCED 0x0004 /* set if Finit did t./libc/libc.h 664 0 0 16125 5072162654 6173 /* * mem routines */ void* memset(void*, int, long); int memcmp(void*, void*, long); void* memcpy(void*, void*, long); void* memmove(void*, void*, long); void* memchr(void*, int, long); void* memccpy(void*, void*, int, long); /* * string routines */ char* strcat(char*, char*); char* strchr(char*, char); int strcmp(char*, char*); char* strcpy(char*, char*); char* strncat(char*, char*, long); char* strncpy(char*, char*, long); int strncmp(char*, char*, long); char* strrchr(char*, char); char* strtok(char*, char*); long strlen(char*); long strspn(char*, char*); long strcspn(char*, char*); char* strpbrk(char*, char*); char* strdup(char*); /* * malloc */ void* malloc(long); void free(void*); void* calloc(long, long); void* realloc(void*, long); void cfree(void*); void* galloc(unsigned int); void gfree(void*); void garbage(void); /* * print routines */ void strconv(char*, int, int); int fmtinstall(char, int (*)(void*, int, int, int)); char* doprint(char*, char*, void*); char* donprint(char*, char*, char*, void*); void flt_init(void); int print(char*, ...); int sprint(char*, char*, ...); int fprint(int, char*, ...); /* * random number */ void srand(long); int rand(void); int nrand(int); long lrand(void); long lnrand(long); double frand(void); /* * math */ double pow(double, double); double atan2(double, double); double fabs(double); double atan(double); double log(double); double log10(double); double exp(double); double erf(double); double erfc(double); double floor(double); double ceil(double); double gamma(double); double hypot(double, double); double sin(double); double cos(double); double tan(double); double asin(double); double acos(double); double sinh(double); double cosh(double); double tanh(double); double sqrt(double); #define HUGE 3.4028234e38 #define PIO2 1.570796326794896619231e0 #define PI (PIO2+PIO2) /* * one-of-a-kind */ int abs(int); long labs(long); int gcd(int, int); int lcm(int, int); int min(int, int); int max(int, int); double pow10(int); double frexp(double, int*); double ldexp(double, int); double modf(double, double*); char* mktemp(char*); void monitor(int(*)(void), int(*)(void), void*, long, ...); char* crypt(char*, char*); void setkey(char*); void encrypt(char*, int); int getfields(char*, char**, int); int getmfields(char*, char**, int); char *setfields(char*); char* getlogin(void); int getopt(int, char**, char*); char* getpass(char*); char* getwd(char*); char* getcwd(char*, int); int isatty(int); int atexit(int (*)(void)); int onexit(int (*)(void)); int ptopen(char*); void sleep(unsigned int); void swab(void*, void*, int); char* tmpnam(char*); char* ttyname(int); int ttyslot(int); void abort(void); void perror(char*); double atof(char*); long atol(char*); int atoi(char*); int exit(int); char* getenv(char*); void qsort(void*, long, long, int (*)(void*, void*)); /* * Time-of-day */ struct tm { int tm_sec; int tm_min; int tm_hour; int tm_mday; int tm_mon; int tm_year; int tm_wday; int tm_yday; int tm_isdst; } ; struct tm* gmtime(long*); struct tm* localtime(long*); char* asctime(struct tm*); char* ctime(long*); char* timezone(int, int); #define MAXNAMLEN 255 #define DIRBLKSIZ 512 typedef struct direct { unsigned long d_ino; short d_reclen; short d_namlen; char d_name[MAXNAMLEN+1]; } Direct; typedef struct _dirdesc { int dd_fd; long dd_loc; /* where we left off in dd_buf */ long dd_size; /* bytes back from system */ long dd_offset; /* lseek at beginning of dd_buf */ char dd_buf[DIRBLKSIZ]; } DIR; DIR* opendir(char*); Direct* readdir(DIR*); long telldir(DIR*); void seekdir(DIR*, long); void closedir(DIR*); /* * manual section 2 * */ typedef struct stat { unsigned short st_dev; unsigned short st_ino; unsigned short st_mode; short st_nlink; short st_uid; short st_gid; unsigned short st_rdev; long st_size; long st_atime; long st_mtime; long st_ctime; } Stat; #define S_IFMT 0170000 /* type of file */ #define S_IFDIR 0040000 /* directory */ #define S_IFCHR 0020000 /* character special */ #define S_IFBLK 0060000 /* block special */ #define S_IFREG 0100000 /* regular */ #define S_IFLNK 0120000 /* symbolic link */ #define S_ISUID 0004000 /* set user id on execution */ #define S_ISGID 0002000 /* set group id on execution */ #define S_IREAD 0000400 /* read permission, owner */ #define S_IWRITE 0000200 /* write permission, owner */ #define S_IEXEC 0000100 /* execute/search permission, owner */ #define S_ICCTYP 0007000 /* type of concurrent access */ #define S_ISYNC 0001000 /* 1 writer and n readers (synchronized access) */ #define S_IEXCL 0003000 /* 1 writer or n readers (exclusive access) */ #define NSIG 32 #define SIGHUP 1 /* hangup */ #define SIGINT 2 /* interrupt */ #define SIGQUIT 3 /* quit */ #define SIGILL 4 /* illegal instruction (not reset when caught) */ #define SIGTRAP 5 /* trace trap (not reset when caught) */ #define SIGIOT 6 /* IOT instruction */ #define SIGEMT 7 /* EMT instruction */ #define SIGFPE 8 /* floating point exception */ #define SIGKILL 9 /* kill (cannot be caugt or ignored) */ #define SIGBUS 10 /* bus error */ #define SIGSEGV 11 /* segmentation violation */ #define SIGSYS 12 /* bad argument to system call */ #define SIGPIPE 13 /* write on a pipe with no one to read it */ #define SIGALRM 14 /* alarm clock */ #define SIGTERM 15 /* software termination signal from kill */ #define SIGSTOP 17 /* sendable stop signal not from tty */ #define SIGCONT 19 /* continue a stopped process */ #define SIGCHLD 20 /* to parent on child stop or exit */ #define SIGLAB 26 /* file label changed; secure unix only (not reset) */ typedef struct fd_set { unsigned int fds_bits[5]; } Fd_set; struct tms { long tms_utime; long tms_stime; long tms_cutime; long tms_cstime; }; int access(char*, int); int acct(char*); unsigned alarm(int); int brk(void*); int chdir(char*); int chmod(char*, int); int chroot(char*); int chown(char*, int, int); int close(int); int creat(char*, int); int dup(int); int dup2(int, int); int execl(char*, ...); int execle(char*, ...); int execlp(char*, ...); int exect(char*, char**, char**); int execv(char*, char**); int execve(char*, char**, char**); int execvp(char*, char**); void _exit(int); int fmount(int, int, char*, int); int fchmod(int, int); int fchown(int, int, int); int funmount(char*); int fork(void); int fstat(int, Stat*); int getegid(void); int geteuid(void); int getgid(void); int getlogname(char*); int getpid(void); int getppid(void); int getuid(void); int ioctl(int, int, void*); int kill(int, int); int link(char*, char*); long lseek(int, long, int); int lstat(char*, Stat*); int mkdir(char*, int); int mknod(char*, int, int); int nap(int); int nice(int); int newpgrp(void); int open(char*, int); int pipe(int[2]); int profil(void*, int, int, int); long read(int, void*, int); int readlink(char*, char*, int); int reboot(int); int rmdir(char*); void* sbrk(int); int select(int, Fd_set*, Fd_set*, int); void (*signal(int, void (*)(int)))(int); int stat(char*, Stat*); int stime(long*); void sync(void); int symlink(char*, char*); int syscall(int, ...); long time(long*); int times(struct tms*); int umask(int); int unlink(char*); int utime(char*, long[2]); int wait(int*); long write(int, void*, int); int); int pipe(int[2]); int profil(void*, int, int, int); long read(int, void*, int); int readlink(char*, char*, int); int reboot(int); int rmdir(char*); void* sbrk(int); int select(int, Fd_set*, Fd_set*, int); void (*signal(int, void (*)(int)))(int); int stat(char*, Stat*); int stime(long*); void sync(void); int symlink(char*, char*); int syscall(int, ...); long time(long*); int times(struct tms*); int umask(int); int unl./libc/stdio.h 664 0 0 4743 5343551615 6367 #define _IOFBF 0 #define _IOLBF 0200 #define _IONBF 04 #define BUFSIZ 4096 #define EOF (-1) extern struct _iobuf { int _cnt; unsigned char *_ptr; unsigned char *_base; short _flag; char _file; } _iob[]; #define FILE struct _iobuf #define FILENAME_MAX 256 #define FOPEN_MAX 100 typedef long fpos_t; #define L_tmpnam 25 #define SEEK_CUR 1 #define SEEK_END 2 #define SEEK_SET 0 #define stdin (&_iob[0]) #define stdout (&_iob[1]) #define stderr (&_iob[2]) #define TMP_MAX 17576 extern int remove(char *filename); extern int rename(char *old, char *new); extern FILE *tmpfile(void); extern char *tmpnam(char *s); extern int fclose(FILE *stream); extern int fflush(FILE *stream); extern FILE *fopen(char *filename, char *mode); extern FILE *freopen(char *filename, char *mode, FILE *stream); extern void setbuf(FILE *stream, char *buf); extern int setvbuf(FILE *stream, char *buf, int mode, int size); extern int fprintf(FILE *stream, char *format, ...); extern int fscanf(FILE *stream, char *format, ...); extern int printf(char *format, ...); extern int scanf(char *format, ...); extern int sprintf(char *s, char *format, ...); extern int sscanf(char *s, char *format, ...); extern int fgetc(FILE *stream); extern char *fgets(char *s, int n, FILE *stream); extern int fputc(int c, FILE *stream); extern int fputs(char *s, FILE *stream); extern int getc(FILE *stream); extern int getchar(void); extern char *gets(char *s); extern int putc(int c, FILE *stream); extern int putchar(int c); extern int puts(char *s); extern int ungetc(int c, FILE *stream); extern unsigned fread(void *ptr, unsigned size, unsigned nmemb, FILE *stream); extern unsigned fwrite(void *ptr, unsigned size, unsigned nmemb, FILE *stream); extern int fgetpos(FILE *stream, fpos_t *pos); extern int fseek(FILE *stream, long int offset, int whence); extern int fsetpos(FILE *stream, fpos_t *pos); extern long int ftell(FILE *stream); extern void rewind(FILE *stream); extern void clearerr(FILE *stream); extern int feof(FILE *stream); extern int ferror(FILE *stream); extern void perror(char *s); #define _IOEOF 020 #define _IOERR 040 #define getc(p) (--(p)->_cnt>=0? (int)*(p)->_ptr++:_filbuf(p)) #define putc(x,p) (--(p)->_cnt>=0? ((int)(*(p)->_ptr++=(x))):_flsbuf((x),p)) extern int _filbuf(FILE *), _flsbuf(unsigned, FILE *); #define feof(p) ((p)->_flag&_IOEOF) #define ferror(p) ((p)->_flag&_IOERR) #define clearerr(p) ((p)->_flag &= ~(_IOERR|_IOEOF)) #define getchar() getc(stdin) #define putchar(x) putc(x,stdout) #define fileno(p) ((p)->_file) int ferror(FILE *stream); ext./libc/u.h 664 0 0 331 4422176712 5454 typedef unsigned short ushort; typedef unsigned char uchar; typedef unsigned long ulong; typedef long vlong; typedef union { char clength[8]; vlong vlength; struct { long length; long hlength; }; } Length; _filbuf(FILE *), _flsbuf(unsigned, FILE *); #define feof(p) ((p)->_flag&_IOEOF) #define ferror(p) ((p)->_flag&_IOERR) #define clearerr(p) ((p)->_flag &= ~(_IOERR|_IOEOF)) #define getchar() getc(stdin) #define putchar(x) putc(x,stdout) #define fileno(p) ((p)->_file) int ferror(FILE *stream); ext sleep(unsigned int); void swab(void*, void*, int); char* tmpnam(char*); char* ttyname(int); int ttyslot(int); void abort(void); void perror(char*); double atof(char*); long atol(char*); int atoi(char*); int exit(int); char* getenv(char*); void qsort(void*, long, long, int (*)(void*, void*)); /* * Time-of-day */ struct tm { int tm_sec; int tm_min; int tm_hour; int tm_mday; int tm_mon; int tm_year; int tm_wday; int tm_yday; int tm_isdst; } ; struct tm* gmtime(long*); struct tm* localtime(long*); char* asctime(struct tm*); char* ctime(long*); char* timezone(int, int); #define MAXNAMLEN 255 #define DIRBLKSIZ 512 typedef struct direct { unsigned long d_ino; short d_reclen; short d_namlen; char d_name[MAXNAMLEN+1]; } Direct; typedef struct _dirdesc { int dd_fd; long dd_loc; /* where we left off in dd_buf */ long dd_size; /* bytes back from system */ long dd_offset; /* lseek at beginning of dd_buf */ char dd_buf[DIRBLKSIZ]; } DIR; DIR* opendir(char*); Direct* readdir(DIR*); long telldir(DIR*); void seekdir(DIR*, long); void closedir(DIR*); /* * manual section 2 * */ typedef struct stat { unsigned short st_dev; unsigned short st_ino; unsigned short st_mode; short st_nlink; short st_uid; short st_gid; unsigned short st_rdev; long st_size; long st_atime; long st_mtime; long st_ctime; } Stat; #define S_IFMT 0170000 /* type of file */ #define S_IFDIR 0040000 /* directory */ #define S_IFCHR 0020000 /* character special */ #define S_IFBLK 0060000 /* block special */ #define S_IFREG 0100000 /* regular */ #define S_IFLNK 0120000 /* symbolic link */ #define S_ISUID 0004000 /* set user id on execution */ #define S_ISGID 0002000 /* set group id on execution */ #define S_IREAD 0000400 /* read permission, owner */ #define S_IWRITE 0000200 /* write permission, owner */ #define S_IEXEC 0000100 /* execute/search permission, owner */ #define S_ICCTYP 0007000 /* type of concurrent access */ #define S_ISYNC 0001000 /* 1 writer and n readers (synchronized access) */ #define S_IEXCL 0003000 /* 1 writer or n readers (exclusive access) */ #define NSIG 32 #define SIGHUP 1 /* hangup */ #define SIGINT 2 /* interrupt */ #define SIGQUIT 3 /* quit */ #define SIGILL 4 /* illegal instruction (not reset when caught) */ #define SIGTRAP 5 /* trace trap (not reset when caught) */ #define SIGIOT 6 /* IOT instruction */ #define SIGEMT 7 /* EMT instruction */ #define SIGFPE 8 /* floating point exception */ #define SIGKILL 9 /* kill (cannot be caugt or ignored) */ #define SIGBUS 10 /* bus error */ #define SIGSEGV 11 /* segmentation violation */ #define SIGSYS 12 /* bad argument to system call */ #define SIGPIPE 13 /* write on a pipe with no one to read it */ #define SIGALRM 14 /* alarm clock */ #define SIGTERM 15 /* software termination signal from kill */ #define SIGSTOP 17 /* sendable stop signal not from tty */ #define SIGCONT 19 /* continue a stopped process */ #define SIGCHLD 20 /* to parent on child stop or exit */ #define SIGLAB 26 /* file label changed; secure unix only (not reset) */ typedef struct fd_set { unsigned int fds_bits[5]; } Fd_set; struct tms { long tms_utime; long tms_stime; long tms_cutime; long tms_cstime; }; int access(char*, int); int acct(char*); unsigned alarm(int); int brk(void*); int chdir(char*); int chmod(char*, int); int chroot(char*); int chown(char*, int, int); int close(int); int creat(char*, int); int dup(int); int dup2(int, int); int execl(char*, ...); int execle(char*, ...); int execlp(char*, ...); int exect(char*, char**, char**); int execv(char*, char**); int execve(char*, char**, char**); int execvp(char*, char**); void _exit(int); int fmount(int, int, char*, int); int fchmod(int, int); int fchown(int, int, int); int funmount(char*); int fork(void); int fstat(int, Stat*); int getegid(void); int geteuid(void); int getgid(void); int getlogname(char*); int getpid(void); int getppid(void); int getuid(void); int ioctl(int, int, void*); int kill(int, int); int link(char*, char*); long lseek(int, long, int); int lstat(char*, Stat*); int mkdir(char*, int); int mknod(char*, int, int); int nap(int); int nice(int); int newpgrp(void); int open(char*, int); int pipe(int[2]); int profil(void*, int, int, int); long read(int, void*, int); int readlink(char*, char*, int); int reboot(int); int rmdir(char*); void* sbrk(int); int select(int, Fd_set*, Fd_set*, int); void (*signal(int, void (*)(int)))(int); int stat(char*, Stat*); int stime(long*); void sync(void); int symlink(char*, char*); int syscall(int, ...); long time(long*); int times(struct tms*); int umask(int); int unlink(char*); int utime(char*, long[2]); int wait(int*); long write(int, void*, int); int); int pipe(int[2]); int profil(void*, int, int, int); long read(int, void*, int); int readlink(char*, char*, int); int reboot(int); int rmdir(char*); void* sbrk(int); int select(int, Fd_set*, Fd_set*, int); void (*signal(int, void (*)(int)))(int); int stat(char*, Stat*); int stime(long*); void sync(void); int symlink(char*, char*); int syscall(int, ...); long time(long*); int times(struct tms*); int umask(int); int unl./libc/stdio.h 664 0 0 4743 5343551615 6367