home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Professional / OS2PRO194.ISO / os2 / fileutil / rh / rh.h < prev    next >
Encoding:
C/C++ Source or Header  |  1990-02-13  |  3.5 KB  |  138 lines

  1.  
  2. /* ----------------------------------------------------------------------
  3.  * FILE: rh.h
  4.  * VERSION: 2
  5.  * Written by: Ken Stauffer
  6.  * This header contains the #define's for the tokens.
  7.  * It also contains structure definitions.
  8.  *
  9.  * ---------------------------------------------------------------------- */
  10.  
  11. #include <stdio.h>
  12.  
  13. #define RHRC        "/.rhrc"    /* start up file */
  14. #define RHENV        "RH"        /* rh environment variable */
  15. #define HOMEENV        "HOME"        /* path to your home directory */
  16.  
  17. /* Definition of returned tokens from the lexical analyzer */
  18.  
  19. #define OR        256    /* || */
  20. #define AND        257    /* && */
  21. #define LE        258    /* <= */
  22. #define GE        259    /* >= */
  23. #define NE        260    /* != */
  24. #define EQ        261    /* == */
  25. #define SHIFTL        262    /* << */
  26. #define SHIFTR        263    /* >> */
  27. #define NOP        264    /* no-operation */
  28. #define NUMBER        265    /* literal numbers and symbolic constants */
  29. #define STR        266    /* regular expression strings */
  30. #define FIELD        267    /* file fields (size,mode,nlinks) */
  31. #define FUNCTION    268    /* user defined function */
  32. #define RETURN        269    /* return keyword */
  33. #define PARAM        270    /* parameter to functions */
  34. #define IDENTIFIER    271
  35.  
  36. #define LENGTH        2000    /* size of stack program */
  37. #define MEM        1000    /* size of stack */
  38. #define IDLENGTH    20    /* length of an identifier */
  39. #define STRLEN        200    /* total chars available for strings */
  40.  
  41. #if BSD
  42. #define DEPTH        getdtablesize()
  43. #define strrchr        rindex
  44. #ifdef SUNOS_4
  45. #define    POSIX_DIRECTORY_LIBRARY
  46. #endif /* SUNOS_4 */
  47. #endif /* BSD */
  48.  
  49. #ifdef SYSV
  50. #ifdef SYSVR3
  51. #define    DEPTH        ulimit(4, 0L)
  52. #define    POSIX_DIRECTORY_LIBRARY
  53. #else /* SYSVR3 */
  54. /* This value was arbitrarily chosen */
  55. #define DEPTH        20
  56. #endif /* SYSVR3 */
  57. #endif /* SYSV */
  58.  
  59. /*
  60.  * Structure of a "rh-assembly" instruction.
  61.  *
  62.  */
  63.  
  64. struct instr {
  65.     int        (*func)();
  66.     long        value;
  67. };
  68.  
  69. /*
  70.  * Structure of a symbol.
  71.  *
  72.  */
  73.  
  74. struct symbol {
  75.     char        *name;
  76.     int        type;
  77.     long        value;
  78.     int        (*func)();
  79.     struct symbol    *next;
  80. };
  81.  
  82. /*
  83.  * Structure defining the rh runtime environment.
  84.  *
  85.  */
  86.  
  87. struct runtime {
  88.     struct stat    *buf;        /* stat info of current file */
  89.     char        *fname;        /* file name of current file */
  90.     int        depth;        /* relative depth of current file */
  91.     int        (*func)();    /* examination function */
  92.     int        prune;        /* flag to indicate prunning */
  93.     int        verbose;    /* used by the (*func)() routine */
  94.     char        *command;    /* command to exec for current file */
  95. };
  96.  
  97. #ifndef DATA
  98.     extern struct symbol    *symbols;
  99.  
  100.     extern struct symbol    *tokensym;
  101.     extern long        tokenval;
  102.     extern long        token;
  103.  
  104.     extern struct instr    StackProgram[];
  105.     extern int        PC;
  106.     extern int        startPC;
  107.     extern long        Stack[];
  108.     extern int        SP;
  109.     extern int        FP;    /* frame pointer */
  110.  
  111.     extern struct runtime    attr;
  112.  
  113.     extern char        Strbuf[];
  114.     extern int        strfree;
  115.  
  116.     extern char        *expstr;
  117.     extern char        *expfname;
  118.     extern FILE        *expfile;
  119.  
  120. #endif
  121.  
  122. extern    c_or(),      c_and(),      c_le(),      c_lt(),      c_ge(),
  123.     c_gt(),      c_ne(),       c_eq(),      c_bor(),     c_band(),
  124.     c_bxor(),    c_not(),      c_plus(),    c_mul(),     c_minus(),
  125.     c_div(),     c_mod(),      c_number(),  c_atime(),   c_ctime(),
  126.     c_dev(),     c_gid(),      c_ino(),     c_mode(),    c_mtime(),
  127.     c_nlink(),   c_rdev(),     c_size(),    c_uid(),     c_str(),
  128.     c_bnot(),    c_uniminus(), c_lshift(),  c_rshift(),  c_qm(),
  129.     c_colon(),   c_return(),  c_func(),     c_param(),   c_depth(),
  130.     c_baselen(), c_pathlen(), c_prune();
  131.  
  132. #ifdef MSDOS
  133. #define S_IDOS      0000007
  134. #define S_ISYS      0000004
  135. #define S_IHID      0000002
  136. #define S_IMOD      0000001
  137. #endif
  138.