home *** CD-ROM | disk | FTP | other *** search
/ World of A1200 / World_Of_A1200.iso / programs / system / csh / src / shell.h < prev    next >
C/C++ Source or Header  |  1995-02-27  |  7KB  |  293 lines

  1. /*
  2.  * SHELL.H
  3.  *
  4.  * (c)1986 Matthew Dillon     9 October 1986
  5.  *
  6.  *
  7.  * SHELL include file.. contains shell parameters and extern's
  8.  *
  9.  * Version 2.07M by Steve Drew 10-Sep-87
  10.  * Version 4.01A by Carlo Borreo & Cesare Dieni 17-Feb-90
  11.  * Version 5.00L by Urban Mueller 16-Mar-91
  12.  *
  13.  */
  14.  
  15. #define RAW_CONSOLE 1   /* Set to 0 to compile out command line editing */
  16.  
  17. /* uncommented by AMK for SAS/C 6.1 */
  18. /* #define strlen strlen */
  19.  
  20. #ifdef _DCC
  21. # define C_Args
  22. # define FUNCARG(x,y,z) ()
  23. #else
  24. # define FUNCARG(x,y,z) (x,y,z)
  25. # define KICK20
  26. #endif
  27.  
  28.  
  29. /* AMK: more includes for OS 2.0 */
  30.  
  31. #include <exec/types.h>
  32. #include <exec/exec.h>
  33. #include <exec/memory.h>
  34. #include <graphics/gfxbase.h>
  35. #include <graphics/text.h>
  36. #include <intuition/intuitionbase.h>
  37. #include <libraries/dos.h>
  38. #include <libraries/dosextens.h>
  39. #include <libraries/gadtools.h>
  40. #include <libraries/asl.h>
  41. #include <time.h>
  42. #include <ctype.h>
  43. #include <fcntl.h>
  44. #include <stdio.h>
  45. #include <stdlib.h>
  46. #include <string.h>
  47. #include <math.h>
  48. #include <dos/datetime.h>
  49. #include <dos/dosextens.h>
  50. #include <dos/dostags.h>
  51. #include <dos/var.h>
  52. #include <utility/tagitem.h>
  53. #include <resources/battclock.h>
  54.  
  55.  
  56. /*
  57.  *  Magnus Lilja, lilja@lysator.liu.se, IRC: lilja - for multiuser-support
  58.  *  out-comment the following line if you don't have MultiUser installed
  59.  */
  60.  
  61. #define MULTIUSER_SUPPORT 1
  62.  
  63. #ifdef MULTIUSER_SUPPORT
  64. # include <libraries/multiuser.h>
  65. # include <proto/multiuser.h>
  66. # include <pragmas/multiuser.h>
  67.   extern struct muBase *muBase;
  68. #endif
  69.  
  70.  
  71. LONG AllocPattern    (STRPTR, ULONG);
  72. LONG MatchThePattern (LONG, STRPTR);
  73. void FreePattern     (LONG);
  74.  
  75.  
  76. typedef struct FileInfoBlock FIB;
  77.  
  78. #ifdef AZTEC_C
  79. # include <functions.h>
  80. # define DEVTAB(x)    (BPTR)(_devtab[x->_unit].fd)
  81. # define CHARSWAIT(x) (x->_bp < x->_bend)
  82. # define RESETIO(x)   (x->_bp = x->_bend)
  83. # define COMPILER "Aztec C 5.0d"
  84. # pragma amicall(PatternBase, 0x48, AllocPattern(a0,d0))
  85. # pragma amicall(PatternBase, 0x60, MatchThePattern(d0,a0))
  86. # pragma amicall(PatternBase, 0x66, FreePattern(d0))
  87. #endif
  88.  
  89. #ifdef LATTICE
  90. # include <proto/all.h>
  91. # include <ios1.h>
  92. /* # define DEVTAB(x)    _ufbs[(x)->_file].ufbfh*/
  93. # define DEVTAB(x)    __ufbs[(x)->_file].ufbfh
  94. # define CHARSWAIT(x) (x->_rcnt != x->_wcnt)
  95. # define RESETIO(x)   (x->_rcnt =  x->_wcnt)
  96.  
  97.   /* AMK: already defined in <ios1.h>, extern struct UFB _ufbs[];*/
  98. # ifndef memmove
  99. # define memmove(t,f,l) movmem((f),(t),(l))
  100. # endif
  101. # define COMPILER "SAS/C 6"
  102. # define swapmem(x,y,z) swmem(x,y,z)
  103. # pragma libcall PatternBase AllocPattern 48 0802
  104. # pragma libcall PatternBase MatchThePattern 60 8002
  105. # pragma libcall PatternBase FreePattern 66 001
  106. #endif
  107.  
  108. #ifdef _DCC
  109. # define COMPILER "DICE 2.06"
  110. # define DEVTAB(x)    (_IoFD[x->sd_Fd].fd_Fh)
  111. # define CHARSWAIT(x) (x->sd_RPtr != x->sd_RBuf)
  112. # define RESETIO(x)   (x->sd_RPtr =  x->sd_RBuf)
  113. # define index strchr
  114. # define rindex strrchr
  115.   void * AllocMem(long byteSize, long requirements);
  116.   struct MsgPort *FindPort( UBYTE *name );
  117. #endif
  118.  
  119. #undef  toupper
  120. #define toupper(c)    ((c)>='a'&&(c)<='z'?((c)-('a'-'A')):(c))
  121.  
  122. #ifndef MAX
  123. #define MAX(x,y) ((x)>(y) ? (x) : (y))
  124. #endif
  125.  
  126. #define OPT(x) (options & (x))
  127.  
  128. #define MAXSRC        5        /* Max. # of source file levels    */
  129. #define MAXIF        20        /* Max. # of if levels            */
  130. #define MAXALIAS    20        /* Max. # of alias levels        */
  131. #define MAXMYFILES    9        /* Max. # of internal files        */
  132. #define MAXHASH        32        /* Max. # of hash chains        */
  133. #define MAXFILENAME    30
  134.  
  135. #define LEVEL_SET        0        /* which variable list to use   */
  136. #define LEVEL_ALIAS        1
  137. #define LEVEL_LABEL        2
  138. #define LEVEL_LOCAL        256
  139.  
  140. #define SBYTE signed char
  141. #define MAXMENUS    31    /* GadTools maximum */
  142. #define MAXMENUITEMS    63    /* GadTools maximum */
  143.  
  144. #define VERBOSE_SOURCE 1
  145. #define VERBOSE_ALIAS  2
  146. #define VERBOSE_HILITE 4
  147.  
  148. #define SCAN_FILE     1
  149. #define SCAN_DIR      2
  150. #define SCAN_RECURSE  4
  151. #define SCAN_DIRENTRY 8
  152. #define SCAN_DIREND   16
  153.  
  154. #ifndef NULL
  155. #define NULL 0L
  156. #endif
  157.  
  158. #define CHECKBREAK() dobreak()
  159. #define ISSPACE(c) ((c)==' ' || (c)==9 || (UBYTE)(c)==0xA0)
  160.  
  161. #ifndef AZTEC_C
  162. struct _dev {
  163.     long  fd;
  164.     short mode;
  165.     };
  166. #endif
  167.  
  168. typedef struct hnode {
  169.     struct hnode *next, *prev;        /* doubly linked list */
  170.     char *line;                /* line in history    */
  171. } HIST;
  172.  
  173. typedef struct PErr {
  174.     int errnum;                /* Format of global error lookup */
  175.     char *errstr;
  176. } PERROR;
  177.  
  178. #ifdef MA_AMK
  179. #undef MA_AMK
  180. #endif
  181. /* #define MA_AMK 1 /* */
  182. typedef struct dirptr {                /* Format of directory fetch pointer */
  183.     BPTR lock;                /* lock on directory   */
  184.     FIB *fib;                /* mod'd fib for entry */
  185. #ifdef MA_AMK
  186.     struct DevProc *dvp;            /* for multi-assigns */
  187.     char *dname;                /* for multi-assigns */
  188. #endif
  189. } DPTR;
  190.  
  191. extern HIST *H_head, *H_tail;
  192. extern PERROR Perror[];
  193. extern char **av;
  194. extern char *Current;
  195. extern int  H_len, H_tail_base, H_stack, H_num;
  196. extern int  E_stack;
  197. extern int  Src_stack, If_stack, forward_goto;
  198. extern int  ac;
  199. extern int  max_ac;
  200. extern int  debug, Rval, Verbose, disable, Quit;
  201. extern int  Lastresult, atoierr;
  202. extern int  Exec_abortline;
  203. extern int  S_histlen;
  204. extern unsigned int options;
  205.  
  206. extern FILE *Src_base[MAXSRC];
  207. extern long  Src_pos[MAXSRC];
  208. extern short Src_if[MAXSRC], Src_abort[MAXSRC];
  209. extern char  If_base[MAXIF];
  210. extern struct Process *Myprocess;        /* The shell's process  */
  211. extern struct CommandLineInterface *Mycli;    /* Cli() */
  212. extern struct DosPacket *Mypacket;        /* initialization packet from AmigaDOS */
  213.  
  214. extern char v_titlebar[], v_prompt[], v_hist[], v_histnum[], v_debug[],
  215.     v_verbose[], v_stat[], v_lasterr[], v_cwd[], v_except[], v_passed[],
  216.     v_path[], v_gotofwd[], v_linenum[], v_every[], v_lcd[], v_rxpath[],
  217.     v_hilite[], v_scroll[], v_minrows[], v_result[], v_qcd[], v_noreq[],
  218.     v_value[], v_nobreak[], v_bground[], v_pipe[], v_datefmt[], v_ioerr[],
  219.     v_abbrev[], v_rback[], v_insert[], v_failat[], v_clipri[],
  220.     v_dirformat[], v_nomatch[], v_prghash[], v_cquote[], v_mappath[],
  221.     v_timeout[];
  222.  
  223. extern char o_hilite[], o_lolite[], o_rback[], *o_csh_qcd, o_internal;
  224. extern char o_aux, o_minrows, o_scroll, o_nowindow, o_noraw, o_vt100;
  225. extern char o_nofastscr, o_nobreak, o_bground, o_resident, o_nomatch;
  226. extern char o_cquote, o_mappath;
  227. extern char o_pipe[], o_datefmt, o_abbrev, o_insert, *o_every;
  228. extern long o_noreq, o_failat, o_timeout;
  229. extern char Buf[], isalph[], confirmed, asked, *classfile;
  230.  
  231. extern char *MyMem;
  232.  
  233. #define isalphanum(x) isalph[x]
  234.  
  235. typedef struct file_info {
  236.     LONG flags;
  237.     LONG type;
  238.     LONG size;
  239.     LONG blocks;
  240.     char class[12];
  241.     struct DateStamp date;
  242.     UWORD uid;
  243.     UWORD gid;
  244. } FILEINFO;
  245.  
  246. typedef struct pattern {
  247.     int  casedep;
  248.     int  queryflag;
  249.     LONG patptr;
  250.     char pattern[1];
  251. } PATTERN;
  252.  
  253. #define INFO_COMMENT (1<<30)
  254. #define INFO_INFO    (1<<29)
  255.  
  256. typedef struct Class {
  257.     struct Class *next;
  258.     char name[1];
  259. } CLASS;
  260.  
  261. extern CLASS *CRoot, *LastCRoot;
  262. extern struct Window *Mywindow;
  263.  
  264. extern long IoError;
  265.  
  266. typedef struct VNode {
  267.     struct VNode *next;
  268.     long len;
  269.     char *text;
  270.     char name[1];
  271. } NODE;
  272.  
  273. typedef struct VRoot {
  274.     NODE         *first[MAXHASH];
  275.     struct VRoot *parent;
  276. } ROOT;
  277.  
  278. struct PathList {
  279.     BPTR pl_NextPath;
  280.     BPTR pl_PathLock;
  281. };
  282.  
  283. /* internal programm path hash-list */
  284. extern char **prghash_list;
  285. extern long prghash_num;
  286.  
  287. #include "proto.h"
  288. #include "WindowBounds.h"
  289.  
  290. /* DEBUG */
  291. #include <mindebug.h>
  292.  
  293.