|
|
1.1 root 1: #ifndef PADS_H
2: #define PADS_H
3:
4: typedef unsigned short Attrib;
5: #ifndef PADS_TERM
6: int strlen(char*),
7: strcmp(char*,char*),
8: read(int,char*,int),
9: write(int,char*,int),
10: ioctl(int,int ...);
11: char *strcpy(char*,char*),
12: *sbrk(int);
13:
14: #define PRINTF_TYPES char * ...
15: #define PRINTF_ARGS char *fmt ...
16: #define FMT(i) ( ((int*)&fmt)[i] )
17: #define PRINTF_COPY\
18: (fmt?fmt:""), FMT(1),FMT(2),FMT(3),FMT(4),FMT(5),FMT(6),FMT(7),FMT(8)
19:
20: #ifdef TRACE
21: #define OK(x) if( !ok() ) PadsError(__SRC__);
22: #define VOK if( !ok() ) PadsError(__SRC__);
23: #define IF_LIVE(x) { if( x ) PadsError(__SRC__); } if(0)
24: #define SRCFILE(f) static __SRC__ = f;
25: typedef int (*PFI)();
26: PFI trace_fcn(char*,int), trace_ptr;
27: #define trace (!(trace_ptr=trace_fcn(__SRC__,__LINE__))) ? 0 : (*trace_ptr)
28: #else
29: #define OK(x) { if( !ok() ) return x; }
30: #define VOK { if( !ok() ) return ; }
31: #define IF_LIVE(x) if( x )
32: #define SRCFILE(f)
33: #define trace if( 0 )
34: #endif
35:
36: class Index {
37: char pub_filler[2];
38: public:
39: int null();
40: };
41: extern Index ZIndex;
42: #else
43: typedef unsigned short Index;
44: #define MJR(i) ((i)>>8)
45: #define MNR(i) ((i)&0xFF)
46: typedef struct Carte Carte;
47: typedef enum Protocol Protocol;
48: struct Carte {
49: unsigned char size; /* host.size != term.size */
50: unsigned char attrib;
51: short width;
52: Index bin[1];
53: };
54: #endif
55:
56: #define SELECTLINE ((Attrib)0x0001)
57: #define SORTED ((Attrib)0x0002)
58: #define ACCEPT_KBD ((Attrib)0x0004)
59: #define FOLD ((Attrib)0x0008)
60: #define TRUNCATE ((Attrib)0x0010)
61: #define USERCLOSE ((Attrib)0x0020)
62: #define DONT_CUT ((Attrib)0x0040)
63: #define FLUSHLINE ((Attrib)0x0080) /* should not be required */
64: #define FAKELINE ((Attrib)0x0100)
65: #define USERCUT ((Attrib)0x0200)
66: #define DONT_CLOSE ((Attrib)0x0400)
67: #define NO_TILDE ((Attrib)0x0800)
68: #define DONT_DIRTY ((Attrib)0x1000)
69:
70: #ifndef PADS_TERM
71: char *sf(PRINTF_TYPES);
72: char *PadsInit(char* = 0);
73: void PadsServe(long = 0);
74: void NewHelp();
75: void NewPadStats();
76: class PadRcv;
77: typedef void (PadRcv::*Action)(...);
78: void Pick(char*,Action,long);
79: long UniqueKey();
80: Index NumericRange(short,short);
81: void PadsWarn(PRINTF_TYPES);
82: //extern char *TapTo;
83:
84: class PadRcv { friend Remote; friend Pad;
85: short oid;
86: short magic;
87: int isvalid();
88: public:
89: PadRcv();
90: ~PadRcv();
91: void invalidate();
92: virtual int disc();
93: virtual char *kbd(char*);
94: virtual char *help();
95: virtual void numeric(long);
96: virtual void userclose();
97: virtual void cycle();
98: virtual void linereq(long,Attrib=0);
99: virtual int accept(Action);
100: virtual void usercut();
101: };
102:
103: class Pad {
104: char pub_filler[24];
105: public:
106: int ok();
107: Pad(PadRcv *);
108: ~Pad();
109: void alarm(short=0);
110: void banner(PRINTF_TYPES);
111: void clear();
112: void dump();
113: void error(PRINTF_TYPES);
114: void insert(class Line&);
115: void insert(long, Attrib, PadRcv*, Index, PRINTF_TYPES);
116: void insert(long, Attrib, PadRcv*, class Menu&, PRINTF_TYPES);
117: void insert(long, Attrib, PRINTF_TYPES);
118: void insert(long, PRINTF_TYPES);
119: void lines(long);
120: void makecurrent();
121: void makegap(long,long);
122: void menu(Index);
123: void menu(class Menu&);
124: void name(PRINTF_TYPES);
125: void options(Attrib, Attrib=0);
126: void tabs(short);
127: void removeline(long);
128: void createline(long,long);
129: void createline(long);
130: };
131:
132: class Line {
133: public:
134: int ok();
135: Line();
136: PadRcv *object;
137: char *text;
138: long key;
139: Attrib attributes;
140: Index carte;
141: };
142: class Menu {
143: char pub_filler[8];
144: public:
145: Menu();
146: ~Menu();
147: Menu( char*, Action=0, long=0 );
148: Index index( char* =0, Action=0, long=0 );
149: void first( char*, Action=0, long=0 );
150: void first( Index );
151: void last( char*, Action=0, long=0 );
152: void last( Index );
153: void sort( char*, Action=0, long=0 );
154: void sort( Index );
155: };
156:
157: #endif
158:
159: #endif
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.