|
|
1.1 ! root 1: #define TBLOCKSIZE 512 /* largest piece of text sent to terminal */ ! 2: #define DATASIZE (TBLOCKSIZE+30) /* ... including protocol header stuff */ ! 3: /* ! 4: * Messages originating at the terminal ! 5: */ ! 6: typedef enum Tmesg{ ! 7: Tcut, ! 8: Tpaste, ! 9: Tsnarf, ! 10: Ttype, /* add some characters, but terminal already knows */ ! 11: Trequest, /* request data to fill a hole */ ! 12: Tstartfile, /* terminal just opened a file's frame */ ! 13: Tstartnewfile, /* terminal just opened a new frame */ ! 14: Tstartcmdfile, /* terminal just opened command frame */ ! 15: Tworkfile, /* set file to which commands apply */ ! 16: Twrite, /* write file */ ! 17: Tcheck, /* ask host to poke with Hcheck */ ! 18: Torigin, /* gimme an Horigin near here */ ! 19: Tclose, /* terminal requests file close; check mod. status */ ! 20: Tsearch, /* search for last regular expression */ ! 21: Tlook, /* search for literal current text */ ! 22: Tsend, /* pretend he typed stuff */ ! 23: Tunlockfile, /* Hunlockfile me */ ! 24: Tstartsnarf, /* initiate snarf buffer exchange */ ! 25: Tsetsnarf, /* remember string in snarf buffer */ ! 26: Tdclick, /* double click */ ! 27: Texit, /* exit */ ! 28: }Tmesg; ! 29: /* ! 30: * Messages originating at the host ! 31: */ ! 32: typedef enum Hmesg{ ! 33: Hnewname, /* create "" name in menu */ ! 34: Hdelname, /* delete file name from menu */ ! 35: Hmovname, /* move file name in menu */ ! 36: Hbindname, /* attach name[0] to text in terminal */ ! 37: Hcurrent, /* make named file the typing file */ ! 38: Hgrow, /* insert space in rasp */ ! 39: Hdata, /* store this data in previously allocated space */ ! 40: Hgrowdata, /* Hgrow + Hdata folded together */ ! 41: Hcut, /* remove space from rasp */ ! 42: Hclean, /* named file is now 'clean' */ ! 43: Hdirty, /* named file is now 'dirty' */ ! 44: Hcheck0, /* see below */ ! 45: Hcheck, /* ask terminal to check whether it needs more data */ ! 46: Hmoveto, /* scrolling, context search, etc. */ ! 47: Hsetdot, /* set dot in terminal */ ! 48: Horigin, /* set origin of file/frame in terminal */ ! 49: Hclose, /* close file and remove from menu */ ! 50: Hunlock, /* command is finished; user can do things */ ! 51: Hsetpat, /* set remembered regular expression */ ! 52: Hunlockfile, /* unlock file in terminal */ ! 53: Hsetsnarf, /* remember string in snarf buffer */ ! 54: Hsnarflen, /* report length of implicit snarf */ ! 55: Hexit, ! 56: }Hmesg; ! 57: typedef struct Header{ ! 58: uchar type; /* one of the above */ ! 59: uchar count0; /* low bits of data size */ ! 60: uchar count1; /* high bits of data size */ ! 61: uchar data[1]; /* variable size */ ! 62: }Header; ! 63: /* ! 64: * File transfer protocol schematic, a la Holzmann ! 65: * ! 66: * proc h ! 67: * { pvar n = 0; ! 68: * queue h[4]; ! 69: * ! 70: * do ! 71: * :: (n < N) -> n++; t!Hgrow ! 72: * :: (n == N) -> n++; t!Hcheck0 ! 73: * :: h?Trequest -> t!Hdata ! 74: * :: h?Tcheck -> t!Hcheck ! 75: * od ! 76: * } ! 77: * proc t ! 78: * { queue t[4]; ! 79: * do ! 80: * :: t?Hgrow -> h!Trequest ! 81: * :: t?Hdata -> skip ! 82: * :: t?Hcheck0 -> h!Tcheck ! 83: * :: t?Hcheck -> ! 84: * if ! 85: * :: break ! 86: * :: h!Trequest; h!Tcheck ! 87: * fi ! 88: * od ! 89: * } ! 90: */
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.