home *** CD-ROM | disk | FTP | other *** search
- /*
- * cstructs.h - structures and accompanying manifest constants for functions
- * in the common subdirectory.
- */
-
- /*
- * cal_time holds a calendar time.
- */
- struct cal_time {
- int year; /* yyyy */
- int month_no; /* month number: 1-12 */
- char *month_nm; /* month name: "January", "February", ... */
- int mday; /* day of the month */
- char *wday; /* "Sunday", "Monday", ... */
- int hour; /* hour by 24 hr clock */
- int minute;
- int second;
- };
-
- /*
- * fileparts holds a file name broken down into parts.
- */
-
-
- struct fileparts { /* struct of file name parts */
- char *dir; /* directory */
- char *name; /* name */
- char *ext; /* extension */
-
- #if MVS
- char *member;
- #endif /* MVS */
-
- };
-
- union xval {
- long ival;
- double rval;
- char *sval;
- };
-
-
- /*
- * str_buf references a string buffer. Strings are built a character
- * at a time.
- */
- struct str_buf {
- unsigned int size; /* total size of current buffer */
- char *strtimage; /* start of string currently being built */
- char *endimage; /* next free character in buffer */
- char *end; /* end of current buffer */
- struct str_buf *next; /* buffers can be put on free list */
- };
-
- /*
- * implement contains information about the implementation of an operation.
- */
- #define NoRsltSeq -1L /* no result sequence: {} */
- #define UnbndSeq -2L /* unbounded result sequence: {*} */
-
- #define DoesRet 01 /* operation (or "body" function) returns */
- #define DoesFail 02 /* operation (or "body" function) fails */
- #define DoesSusp 04 /* operation (or "body" function) suspends */
- #define DoesEFail 010 /* fails through error conversion */
- #define DoesFThru 020 /* only "body" functions can "fall through" */
-
- struct implement {
- struct implement *blink; /* link for bucket chain in hash tables */
- char oper_typ; /* 'K'=keyword, 'F'=function, 'O'=operator */
- char prefix[2]; /* prefix to make start of name unique */
- char *name; /* function/operator/keyword name */
- char *op; /* operator symbol (operators only) */
- int nargs; /* number of arguments operation requres */
- int *arg_flgs; /* array of arg flags: deref/underef, var len*/
- long min_result; /* minimum result sequence length */
- long max_result; /* maiximum result sequence length */
- int resume; /* flag - resumption after last result */
- int ret_flag; /* DoesRet, DoesFail, DoesSusp */
- int use_rslt; /* flag - explicitly uses result location */
- char *comment; /* description of operation */
- int ntnds; /* size of tnds array */
- struct tend_var *tnds; /* pointer to array of info about tended vars */
- int nvars; /* size of vars array */
- struct ord_var *vars; /* pointer to arrry of info about ordinary vars */
- struct il_code *in_line; /* inline version of the operation */
- int iconc_flgs; /* flags for internal use by the compiler */
- };
-
- /*
- * These codes are shared between the data base and rtt. They are defined
- * here, though not all are used by the data base.
- */
- #define TndDesc 1 /* a tended descriptor */
- #define TndStr 2 /* a tended character pointer */
- #define TndBlk 3 /* a tended block pointer */
- #define OtherDcl 4 /* a declaration that is not special */
- #define IsTypedef 5 /* a typedef */
- #define VArgLen 6 /* identifier for length of variable parm list */
- #define RsltLoc 7 /* the special result location of an operation */
- #define Label 8 /* label */
- #define RtParm 16 /* undereferenced paramter of run-time routine */
- #define DrfPrm 32 /* dereferenced parameter of run-time routine */
- #define VarPrm 64 /* variable part of parm list (with RtParm or DrfPrm) */
- #define PrmMark 128 /* flag - used while recognizing params of body fnc */
- #define ByRef 256 /* flag - parameter to body function passed by reference */
-
- /*
- * Flags to indicate what types are returned from the function implementing
- * a body. These are unsed in determining the calling conventions
- * of the function.
- */
- #define RetInt 1 /* body/function returns a C_integer */
- #define RetDbl 2 /* body/function returns a C_double */
- #define RetOther 4 /* body (not function itself) returns something else */
- #define RetNoVal 8 /* function returns no value */
- #define RetSig 16 /* function returns a signal */
-
- /*
- * tend_var contains information about a tended variable in the "declare {...}"
- * action of an operation.
- */
- struct tend_var {
- int var_type; /* TndDesc, TndStr, or TndBlk */
- struct il_c *init; /* initial value from declaration */
- char *blk_name; /* TndBlk: struct name of block */
- };
-
- /*
- * ord_var contains information about an ordinary variable in the
- * "declare {...}" action of an operation.
- */
- struct ord_var {
- char *name; /* name of variable */
- struct il_c *dcl; /* declaration of variable (includes name) */
- };
-
- /*
- * il_code has information about an action in an operation.
- */
- #define IL_If1 1
- #define IL_If2 2
- #define IL_Tcase1 3
- #define IL_Tcase2 4
- #define IL_Lcase 5
- #define IL_Err1 6
- #define IL_Err2 7
- #define IL_Lst 8
- #define IL_Const 9
- #define IL_Bang 10
- #define IL_And 11
- #define IL_Cnv1 12
- #define IL_Cnv2 13
- #define IL_Def1 14
- #define IL_Def2 15
- #define IL_Is 16
- #define IL_Var 17
- #define IL_Subscr 18
- #define IL_Block 19
- #define IL_Call 20
- #define IL_Abstr 21
- #define IL_VarTyp 22
- #define IL_Store 23
- #define IL_LstElm 24
- #define IL_SetElm 25
- #define IL_TblKey 26
- #define IL_TblElm 27
- #define IL_TblDft 28
- #define IL_Fields 29
- #define IL_StrVar 30
- #define IL_TrpTbl 31
- #define IL_TpAsgn 32
- #define IL_Union 33
- #define IL_Inter 34
- #define IL_New 35
- #define IL_IcnTyp 36
-
- union il_fld {
- struct il_code *fld;
- struct il_c *c_cd;
- int *vect;
- char *s;
- word n;
- };
-
- struct il_code {
- int il_type;
- union il_fld u[1]; /* actual number of fields varies with type */
- };
-
- /*
- * The following manifest constants are used to describe types, conversions,
- * and returned values.
- */
- #define TypEmpty 1
- #define TypCset 2
- #define TypReal 3
- #define TypInt 4
- #define TypFile 5
- #define TypStr 6
- #define TypNull 7
- #define TypProc 8
- #define TypCoExp 9
- #define TypList 10
- #define TypRec 12
- #define TypSet 13
- #define TypTbl 14
- #define TypVar 15
- #define TypTvStr 16
- #define TypTvTbl 17
- #define TypKyInt 18
- #define TypKySub 19
- #define TypKyPos 20
- #define TypCInt 21
- #define TypCDbl 22
- #define TypCStr 23
- #define TypEInt 24
- #define TypECInt 25
- #define TypTStr 26
- #define TypTCset 27
- #define RetDesc 28
- #define RetNVar 29
- #define RetSVar 30
- #define RetNone 31
-
- /*
- * il_c describes a piece of C code.
- */
- #define ILC_Ref 1 /* nonmodifying reference to var. in sym. tab. */
- #define ILC_Mod 2 /* modifying reference to var. in sym. tab */
- #define ILC_Tend 3 /* tended var. local to inline block */
- #define ILC_SBuf 4 /* string buffer */
- #define ILC_CBuf 5 /* cset buffer */
- #define ILC_Ret 6 /* return statement */
- #define ILC_Susp 7 /* suspend statement */
- #define ILC_Fail 8 /* fail statement */
- #define ILC_Goto 9 /* goto */
- #define ILC_CGto 10 /* conditional goto */
- #define ILC_Lbl 11 /* label */
- #define ILC_LBrc 12 /* '{' */
- #define ILC_RBrc 13 /* '}' */
- #define ILC_Str 14 /* arbitrary string of code */
- #define ILC_EFail 15 /* errorfail statement */
-
- #define RsltIndx -1 /* symbol table index for "result" */
-
- struct il_c {
- int il_c_type;
- struct il_c *code[3];
- word n;
- char *s;
- struct il_c *next;
- };
-
- /*
- * The parameter value of a run-time operation may be in one of several
- * different locations depending on what conversions have been done to it.
- * These codes are shared by rtt and iconc.
- */
- #define PrmTend 1 /* in tended location */
- #define PrmCStr 3 /* converted to C string: tended location */
- #define PrmInt 4 /* converted to C int: non-tended location */
- #define PrmDbl 8 /* converted to C double: non-tended location */
-
- /*
- * minimum number of unsigned ints needed to hold the bits of a cset - only
- * used in translators, not in the run-time system.
- */
- #define BVectSize 16
-