home *** CD-ROM | disk | FTP | other *** search
/ Power-Programmierung / CD1.mdf / icon / dos / src / h / cstructs.h < prev    next >
Encoding:
C/C++ Source or Header  |  1992-02-10  |  8.4 KB  |  269 lines

  1. /*
  2.  * cstructs.h - structures and accompanying manifest constants for functions
  3.  *  in the common subdirectory.
  4.  */
  5.  
  6. /*
  7.  * cal_time holds a calendar time.
  8.  */
  9. struct cal_time {
  10.    int year;        /* yyyy */
  11.    int month_no;    /* month number: 1-12 */
  12.    char *month_nm;    /* month name: "January", "February", ... */
  13.    int mday;        /* day of the month */
  14.    char *wday;        /* "Sunday", "Monday", ... */
  15.    int hour;        /* hour by 24 hr clock */
  16.    int minute;
  17.    int second;
  18.    };
  19.  
  20. /*
  21.  * fileparts holds a file name broken down into parts.
  22.  */
  23.  
  24.  
  25. struct fileparts {            /* struct of file name parts */
  26.    char *dir;                /* directory */
  27.    char *name;                /* name */
  28.    char *ext;                /* extension */
  29.  
  30. #if MVS
  31.    char *member;
  32. #endif                    /* MVS */
  33.  
  34.    };
  35.  
  36. union xval {
  37.    long ival;
  38.    double rval;
  39.    char *sval;
  40.    };
  41.  
  42.  
  43. /*
  44.  * str_buf references a string buffer. Strings are built a character
  45.  *  at a time.
  46.  */
  47. struct str_buf {
  48.    unsigned int size;      /* total size of current buffer */
  49.    char *strtimage;       /* start of string currently being built */
  50.    char *endimage;        /* next free character in buffer */
  51.    char *end;             /* end of current buffer */
  52.    struct str_buf *next;  /* buffers can be put on free list */
  53.    };
  54.  
  55. /*
  56.  * implement contains information about the implementation of an operation.
  57.  */
  58. #define NoRsltSeq  -1L         /* no result sequence: {} */
  59. #define UnbndSeq   -2L       /* unbounded result sequence: {*} */
  60.  
  61. #define DoesRet    01         /* operation (or "body" function) returns */
  62. #define DoesFail   02         /* operation (or "body" function) fails */
  63. #define DoesSusp   04         /* operation (or "body" function) suspends */
  64. #define DoesEFail 010        /* fails through error conversion */
  65. #define DoesFThru 020         /* only "body" functions can "fall through" */
  66.  
  67. struct implement {
  68.    struct implement *blink;   /* link for bucket chain in hash tables */
  69.    char oper_typ;             /* 'K'=keyword, 'F'=function, 'O'=operator */
  70.    char prefix[2];          /* prefix to make start of name unique */
  71.    char *name;              /* function/operator/keyword name */
  72.    char *op;              /* operator symbol (operators only) */
  73.    int nargs;              /* number of arguments operation requres */
  74.    int *arg_flgs;             /* array of arg flags: deref/underef, var len*/
  75.    long min_result;          /* minimum result sequence length */
  76.    long max_result;          /* maiximum result sequence length */
  77.    int resume;              /* flag - resumption after last result */
  78.    int ret_flag;          /* DoesRet, DoesFail, DoesSusp */
  79.    int use_rslt;              /* flag - explicitly uses result location */
  80.    char *comment;          /* description of operation */
  81.    int ntnds;              /* size of tnds array */
  82.    struct tend_var *tnds;     /* pointer to array of info about tended vars */
  83.    int nvars;                 /* size of vars array */
  84.    struct ord_var  *vars;     /* pointer to arrry of info about ordinary vars */
  85.    struct il_code *in_line;    /* inline version of the operation */
  86.    int iconc_flgs;          /* flags for internal use by the compiler */
  87.    };
  88.  
  89. /*
  90.  * These codes are shared between the data base and rtt. They are defined
  91.  *  here, though not all are used by the data base.
  92.  */
  93. #define TndDesc   1  /* a tended descriptor */
  94. #define TndStr    2  /* a tended character pointer */
  95. #define TndBlk    3  /* a tended block pointer */
  96. #define OtherDcl  4  /* a declaration that is not special */
  97. #define IsTypedef 5  /* a typedef */
  98. #define VArgLen   6  /* identifier for length of variable parm list */
  99. #define RsltLoc   7  /* the special result location of an operation */
  100. #define Label     8  /* label */
  101. #define RtParm   16  /* undereferenced paramter of run-time routine */
  102. #define DrfPrm   32  /* dereferenced parameter of run-time routine */
  103. #define VarPrm   64  /* variable part of parm list (with RtParm or DrfPrm) */
  104. #define PrmMark 128  /* flag - used while recognizing params of body fnc */
  105. #define ByRef   256  /* flag - parameter to body function passed by reference */
  106.  
  107. /*
  108.  * Flags to indicate what types are returned from the function implementing
  109.  *  a body. These are unsed in determining the calling conventions 
  110.  *  of the function.
  111.  */
  112. #define RetInt   1  /* body/function returns a C_integer */
  113. #define RetDbl   2  /* body/function returns a C_double */
  114. #define RetOther 4  /* body (not function itself) returns something else */
  115. #define RetNoVal 8  /* function returns no value */
  116. #define RetSig  16  /* function returns a signal */
  117.  
  118. /*
  119.  * tend_var contains information about a tended variable in the "declare {...}"
  120.  *  action of an operation.
  121.  */
  122. struct tend_var {
  123.    int var_type;           /* TndDesc, TndStr, or TndBlk */
  124.    struct il_c *init;      /* initial value from declaration */
  125.    char *blk_name;         /* TndBlk: struct name of block */
  126.    };
  127.  
  128. /*
  129.  * ord_var contains information about an ordinary variable in the
  130.  *  "declare {...}" action of an operation.
  131.  */
  132. struct ord_var {
  133.    char *name;        /* name of variable */
  134.    struct il_c *dcl;  /* declaration of variable (includes name) */
  135.    };
  136.  
  137. /*
  138.  * il_code has information about an action in an operation.
  139.  */
  140. #define IL_If1     1
  141. #define IL_If2     2
  142. #define IL_Tcase1  3
  143. #define IL_Tcase2  4
  144. #define IL_Lcase   5
  145. #define IL_Err1    6
  146. #define IL_Err2    7
  147. #define IL_Lst     8
  148. #define IL_Const   9
  149. #define IL_Bang   10
  150. #define IL_And    11
  151. #define IL_Cnv1   12
  152. #define IL_Cnv2   13
  153. #define IL_Def1   14
  154. #define IL_Def2   15
  155. #define IL_Is     16
  156. #define IL_Var    17
  157. #define IL_Subscr 18
  158. #define IL_Block  19
  159. #define IL_Call   20
  160. #define IL_Abstr  21
  161. #define IL_VarTyp 22
  162. #define IL_Store  23
  163. #define IL_LstElm 24
  164. #define IL_SetElm 25
  165. #define IL_TblKey 26
  166. #define IL_TblElm 27
  167. #define IL_TblDft 28
  168. #define IL_Fields 29
  169. #define IL_StrVar 30
  170. #define IL_TrpTbl 31
  171. #define IL_TpAsgn 32
  172. #define IL_Union  33
  173. #define IL_Inter  34
  174. #define IL_New    35
  175. #define IL_IcnTyp 36
  176.  
  177. union il_fld {
  178.    struct il_code *fld;
  179.    struct il_c *c_cd;
  180.    int *vect;
  181.    char *s;
  182.    word n;
  183.    };
  184.  
  185. struct il_code {
  186.    int il_type;
  187.    union il_fld u[1];   /* actual number of fields varies with type */
  188.    };
  189.  
  190. /*
  191.  * The following manifest constants are used to describe types, conversions,
  192.  *   and returned values.
  193.  */
  194. #define TypEmpty  1
  195. #define TypCset   2
  196. #define TypReal   3
  197. #define TypInt    4
  198. #define TypFile   5
  199. #define TypStr    6
  200. #define TypNull   7
  201. #define TypProc   8
  202. #define TypCoExp  9
  203. #define TypList  10
  204. #define TypRec   12
  205. #define TypSet   13
  206. #define TypTbl   14
  207. #define TypVar   15
  208. #define TypTvStr 16
  209. #define TypTvTbl 17
  210. #define TypKyInt 18
  211. #define TypKySub 19
  212. #define TypKyPos 20
  213. #define TypCInt  21
  214. #define TypCDbl  22
  215. #define TypCStr  23
  216. #define TypEInt  24
  217. #define TypECInt 25
  218. #define TypTStr  26
  219. #define TypTCset 27
  220. #define RetDesc  28
  221. #define RetNVar  29
  222. #define RetSVar  30
  223. #define RetNone  31
  224.  
  225. /*
  226.  * il_c describes a piece of C code.
  227.  */
  228. #define ILC_Ref    1   /* nonmodifying reference to var. in sym. tab. */
  229. #define ILC_Mod    2   /* modifying reference to var. in sym. tab */
  230. #define ILC_Tend   3   /* tended var. local to inline block */
  231. #define ILC_SBuf   4   /* string buffer */
  232. #define ILC_CBuf   5   /* cset buffer */
  233. #define ILC_Ret    6   /* return statement */
  234. #define ILC_Susp   7   /* suspend statement */
  235. #define ILC_Fail   8   /* fail statement */
  236. #define ILC_Goto   9   /* goto */
  237. #define ILC_CGto  10   /* conditional goto */
  238. #define ILC_Lbl   11   /* label */
  239. #define ILC_LBrc  12   /* '{' */
  240. #define ILC_RBrc  13   /* '}' */
  241. #define ILC_Str   14   /* arbitrary string of code */
  242. #define ILC_EFail 15   /* errorfail statement */
  243.  
  244. #define RsltIndx -1   /* symbol table index for "result" */
  245.  
  246. struct il_c {
  247.    int il_c_type;
  248.    struct il_c *code[3];
  249.    word n;
  250.    char *s;
  251.    struct il_c *next;
  252.    };
  253.    
  254. /*
  255.  * The parameter value of a run-time operation may be in one of several
  256.  *  different locations depending on what conversions have been done to it.
  257.  *  These codes are shared by rtt and iconc.
  258.  */
  259. #define PrmTend    1   /* in tended location */
  260. #define PrmCStr    3   /* converted to C string: tended location */
  261. #define PrmInt     4   /* converted to C int: non-tended location */
  262. #define PrmDbl     8   /* converted to C double: non-tended location */
  263.  
  264. /*
  265.  * minimum number of unsigned ints needed to hold the bits of a cset - only
  266.  *  used in translators, not in the run-time system.
  267.  */
  268. #define BVectSize 16
  269.