source: trunk/third/kermit/ckucmd.h @ 20081

Revision 20081, 8.5 KB checked in by zacheiss, 21 years ago (diff)
This commit was generated by cvs2svn to compensate for changes in r20080, which included commits to RCS files with non-trunk default branches.
Line 
1/*  C K U C M D . H  --  Header file for Unix cmd package  */
2
3/*
4  Author: Frank da Cruz <fdc@columbia.edu>
5  Columbia University Kermit Project, New York City.
6
7  Copyright (C) 1985, 2002,
8    Trustees of Columbia University in the City of New York.
9    All rights reserved.  See the C-Kermit COPYING.TXT file or the
10    copyright text in the ckcmai.c module for disclaimer and permissions.
11*/
12
13#ifndef CKUCMD_H
14#define CKUCMD_H
15
16/* Command recall */
17
18#ifdef pdp11                            /* Not enough room for this */
19#ifndef NORECALL
20#define NORECALL
21#endif /* NORECALL */
22#endif /* pdp11 */
23
24#ifdef DYNAMIC                          /* Dynamic command buffers */
25/*
26  Use malloc() to allocate the many command-related buffers in ckucmd.c.
27*/
28#ifndef DCMDBUF
29#ifndef NORECALL
30#define NORECALL
31#endif /* NORECALL */
32#endif /* DCMDBUF */
33
34#ifndef NORECALL
35#define CK_RECALL
36#else
37#ifdef CK_RECALL
38#undef CK_RECALL
39#endif /* CK_RECALL */
40#endif /* NORECALL */
41#else
42#ifndef NORECALL
43#define NORECALL
44#endif /*  NORECALL */
45#endif /* DYNAMIC */
46
47#ifdef NORECALL
48#ifdef CK_RECALL
49#undef CK_RECALL
50#endif /* CK_RECALL */
51#endif /* NORECALL */
52
53#ifdef NORECALL
54#ifndef NOARROWKEYS
55#define NOARROWKEYS
56#endif /* NOARROWKEYS */
57#endif /* NORECALL */
58
59/* Special getchars */
60
61#ifdef VMS
62#ifdef getchar                          /* This is for VMS GCC */
63#undef getchar
64#endif /* getchar */
65#define getchar()   vms_getchar()
66int vms_getchar(void);
67#endif /* VMS */
68
69#ifdef aegis
70#undef getchar
71#define getchar()   coninc(0)
72#endif /* aegis */
73
74#ifdef AMIGA
75#undef getchar
76#define getchar() coninc(0)
77#endif /* AMIGA */
78
79#ifdef Plan9
80#undef getchar
81#define getchar() coninc(0)
82#undef putchar
83#define putchar(c) conoc(c)
84#undef printf
85#define printf conprint
86#endif /* Plan9 */
87
88/* Sizes of things */
89
90#ifndef CMDDEP
91#ifdef BIGBUFOK
92#define CMDDEP  64                      /* Maximum command recursion depth */
93#else
94#define CMDDEP  20
95#endif /* BIGBUFOK */
96#endif /* CMDDEP */
97#define HLPLW   78                      /* Width of ?-help line */
98#define HLPCW   19                      /* Width of ?-help column */
99#define HLPBL  100                      /* Help string buffer length */
100#ifdef BIGBUFOK
101#define ATMBL 10238                     /* Command atom buffer length*/
102#else
103#ifdef NOSPL
104#define ATMBL  256
105#else
106#define ATMBL  1024
107#endif /* NOSPL */
108#endif /* BIGBUFOK */
109
110#ifndef CMDBL
111#ifdef NOSPL
112/* No script programming language, save some space */
113#define CMDBL 608                       /* Command buffer length */
114#else
115#ifdef BIGBUFOK
116#define CMDBL 32763
117#else
118#define CMDBL 4092
119#endif /* OS2 */
120#endif /* NOSPL */
121#endif /* CMDBL */
122
123/* Special characters */
124
125#define RDIS 0022                       /* Redisplay   (^R) */
126#define LDEL 0025                       /* Delete line (^U) */
127#define WDEL 0027                       /* Delete word (^W) */
128#ifdef CK_RECALL
129#define C_UP 0020                       /* Go Up in recall buffer (^P) */
130#define C_UP2 0002                      /* Alternate Go Up (^B) for VMS */
131#define C_DN 0016                       /* Go Down in recall buffer (^N) */
132#endif /* CK_RECALL */
133
134/* Keyword flags (bits, powers of 2) */
135
136#define CM_INV 1                        /* Invisible keyword */
137#define CM_ABR 2                        /* Abbreviation for another keyword */
138#define CM_HLP 4                        /* Help-only keyword */
139#define CM_ARG 8                        /* An argument is required */
140#define CM_NOR 16                       /* No recall for this command */
141#define CM_PRE 32                       /* Long-form cmdline arg for prescan */
142#define CM_PSH 64                       /* Command disabled if nopush */
143#define CM_LOC 128                      /* Command disabled if nolocal */
144
145/*
146  A long-form command line option is a keyword using the regular struct keytab
147  and lookup mechanisms.  Flags that make sense in this context are CM_ARG,
148  indicating this option requires an argument (operand), and CM_PRE, which
149  means this option must be processed before the initialization file.  The
150  absence of CM_PRE means the option is to be processed after the
151  initialization file in the normal manner.
152*/
153
154/* Token flags (numbers) */
155
156#define CMT_COM 0                       /* Comment (; or #) */
157#define CMT_SHE 1                       /* Shell escape (!) */
158#define CMT_LBL 2                       /* Label (:) */
159#define CMT_FIL 3                       /* Indirect filespec (@) (not used) */
160
161/* Path separator for path searches */
162
163#ifdef OS2
164#define PATHSEP ';'
165#else
166#ifdef UNIX
167#define PATHSEP ':'
168#else
169#define PATHSEP ','
170#endif /* UNIX */
171#endif /* OS2 */
172
173#ifndef CK_KEYTAB
174#define CK_KEYTAB
175
176/* Keyword Table Template perhaps already defined in ckcdeb.h */
177
178struct keytab {                         /* Keyword table */
179    char *kwd;                          /* Pointer to keyword string */
180    int kwval;                          /* Associated value */
181    int flgs;                           /* Flags (as defined above) */
182};
183#endif /* CK_KEYTAB */
184
185/* String preprocessing function */
186
187#ifdef CK_ANSIC                         /* ANSI C */
188#ifdef M_SYSV                           /* SCO Microsoft C wants no args */
189typedef int (*xx_strp)();
190#else
191typedef int (*xx_strp)(char *, char **, int *);
192#endif /* M_SYSV */
193#else                                   /* Not ANSI C */
194typedef int (*xx_strp)();
195#endif /* CK_ANSIC */
196
197/* FLDDB struct */
198
199typedef struct FDB {
200    int fcode;                          /* Function code */
201    char * hlpmsg;                      /* Help message */
202    char * dflt;                        /* Default */
203    char * sdata;                       /* Additional string data */
204    int ndata1;                         /* Additional numeric data 1 */
205    int ndata2;                         /* Additional numeric data 2 */
206    xx_strp spf;                        /* String processing function */
207    struct keytab * kwdtbl;             /* Keyword table */
208    struct FDB * nxtfdb;                /* Pointer to next alternative */
209} fdb;
210
211typedef struct OFDB {
212    struct FDB * fdbaddr;               /* Address of succeeding FDB struct */
213    int fcode;                          /* Function code */
214    char * sresult;                     /* String result */
215    int nresult;                        /* Numeric result */
216    int kflags;                         /* Keyword flags if any */
217} ofdb;
218
219#ifndef CKUCMD_C
220extern struct OFDB cmresult;
221#endif /* CKUCMD_C */
222
223/* Codes for primary parsing function  */
224
225#define _CMNUM 0                        /* Number */
226#define _CMOFI 1                        /* Output file */
227#define _CMIFI 2                        /* Input file */
228#define _CMFLD 3                        /* Arbitrary field */
229#define _CMTXT 4                        /* Text string */
230#define _CMKEY 5                        /* Keyword */
231#define _CMCFM 6                        /* Confirmation */
232#define _CMDAT 7                        /* Date/time */
233
234/* Function prototypes */
235
236_PROTOTYP( int xxesc, (char **) );
237_PROTOTYP( int cmrini, (int) );
238_PROTOTYP( VOID cmsetp, (char *) );
239_PROTOTYP( VOID cmsavp, (char [], int) );
240_PROTOTYP( char * cmgetp, () );
241_PROTOTYP( VOID prompt, (xx_strp) );
242_PROTOTYP( VOID pushcmd, (char *) );
243_PROTOTYP( VOID cmres, (void) );
244_PROTOTYP( VOID cmini, (int) );
245_PROTOTYP( int cmgbrk, (void) );
246_PROTOTYP( int cmgkwflgs, (void) );
247_PROTOTYP( int cmpush, (void) );
248_PROTOTYP( int cmpop, (void) );
249_PROTOTYP( VOID untab, (char *) );
250_PROTOTYP( int cmnum, (char *, char *, int, int *, xx_strp ) );
251_PROTOTYP( int cmofi, (char *, char *, char **, xx_strp ) );
252_PROTOTYP( int cmifi, (char *, char *, char **, int *, xx_strp ) );
253_PROTOTYP( int cmiofi, (char *, char *, char **, int *, xx_strp ) );
254_PROTOTYP( int cmifip,(char *, char *, char **, int *, int, char *, xx_strp ));
255_PROTOTYP( int cmifi2,(char *,char *,char **,int *,int,char *,xx_strp,int ));
256_PROTOTYP( int cmdir, (char *, char *, char **, xx_strp ) );
257_PROTOTYP( int cmdirp, (char *, char *, char **, char *, xx_strp ) );
258_PROTOTYP( int cmfld, (char *, char *, char **, xx_strp ) );
259_PROTOTYP( int cmtxt, (char *, char *, char **, xx_strp ) );
260_PROTOTYP( int cmkey,  (struct keytab [], int, char *, char *, xx_strp) );
261_PROTOTYP( int cmkeyx, (struct keytab [], int, char *, char *, xx_strp) );
262_PROTOTYP( int cmkey2,(struct keytab [],int,char *,char *,char *,xx_strp,int));
263_PROTOTYP( int cmswi,  (struct keytab [], int, char *, char *, xx_strp) );
264_PROTOTYP( int cmdate,(char *, char *, char **, int, xx_strp) );
265_PROTOTYP( char * cmpeek, (void) );
266_PROTOTYP( int cmfdb, (struct FDB *) );
267_PROTOTYP( VOID cmfdbi, (struct FDB *,
268                        int, char *, char *, char *, int, int, xx_strp,
269                        struct keytab *, struct FDB *) );
270_PROTOTYP( int chktok, (char *) );
271_PROTOTYP( int cmcfm, (void) );
272_PROTOTYP( int lookup, (struct keytab [], char *, int, int *) );
273_PROTOTYP( VOID kwdhelp, (struct keytab[],int,char *,char *,char *,int,int) );
274_PROTOTYP( int ungword, (void) );
275_PROTOTYP( VOID unungw, (void) );
276_PROTOTYP( int cmdsquo, (int) );
277_PROTOTYP( int cmdgquo, (void) );
278_PROTOTYP( char * ckcvtdate, (char *, int) );
279_PROTOTYP( int cmdgetc, (int));
280#ifndef NOARROWKEYS
281_PROTOTYP( int cmdconchk, (void) );
282#endif /* NOARROWKEYS */
283
284#ifdef CK_RECALL
285_PROTOTYP( char * cmgetcmd, (char *) );
286_PROTOTYP( VOID addcmd, (char *) );
287_PROTOTYP( VOID cmaddnext, () );
288#endif /* CK_RECALL */
289_PROTOTYP( char * cmcvtdate, (char *, int) );
290_PROTOTYP( char * cmdiffdate, (char *, char *) );
291_PROTOTYP( char * cmdelta, (int,
292                            int,int,int,int,int,int,int,int,int,int,int,int ));
293_PROTOTYP( char * shuffledate, (char *, int) );
294_PROTOTYP( int filhelp, (int, char *, char *, int, int) );
295
296#ifdef DCMDBUF
297_PROTOTYP( int cmsetup, (void) );
298#endif /* DCMDBUF */
299
300#endif /* CKUCMD_H */
301
302/* End of ckucmd.h */
Note: See TracBrowser for help on using the repository browser.