home *** CD-ROM | disk | FTP | other *** search
/ Columbia Kermit / kermit.zip / archives / ckv200.zip / ckucmd.h < prev    next >
C/C++ Source or Header  |  2001-10-14  |  9KB  |  293 lines

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