From 198da9e822b56dded1632d4cfc4ffd7cb9d0337c Mon Sep 17 00:00:00 2001 From: keie Date: Thu, 23 Aug 1984 13:18:14 +0000 Subject: [PATCH] Initial revision --- first/em_path.h.src | 10 +++ first/local.h.src | 7 ++ h/as_spec.h | 1 + h/cg_pattern.h | 156 ++++++++++++++++++++++++++++++++++++++++++++ h/em_abs.h | 30 +++++++++ h/em_flag.h | 25 +++++++ h/em_mes.h | 20 ++++++ h/em_ptyp.h | 8 +++ h/em_reg.h | 10 +++ h/pc_err.h | 22 +++++++ h/pc_file.h | 19 ++++++ h/pc_size.h | 21 ++++++ 12 files changed, 329 insertions(+) create mode 100644 first/em_path.h.src create mode 100644 first/local.h.src create mode 100644 h/as_spec.h create mode 100644 h/cg_pattern.h create mode 100644 h/em_abs.h create mode 100644 h/em_flag.h create mode 100644 h/em_mes.h create mode 100644 h/em_ptyp.h create mode 100644 h/em_reg.h create mode 100644 h/pc_err.h create mode 100644 h/pc_file.h create mode 100644 h/pc_size.h diff --git a/first/em_path.h.src b/first/em_path.h.src new file mode 100644 index 000000000..02394fb2d --- /dev/null +++ b/first/em_path.h.src @@ -0,0 +1,10 @@ +#define TMP_DIR "/usr/tmp" /* Intended as a common dir. for */ + /* ALL temporary files */ + +/* The trailing " is intentionally missing ! */ +#define EM_HOME "/usr/em +#define EM_DIR EM_HOME" /* The root directory for EM stuff */ +#define PEM_PATH EM_HOME/lib/pc_pem" +#define ERR_PATH EM_HOME/etc/pc_errors" +#define RTERR_PATH EM_HOME/etc/pc_rt_errors" +#define ACK_DIR EM_HOME/lib/ack" diff --git a/first/local.h.src b/first/local.h.src new file mode 100644 index 000000000..9839d9c83 --- /dev/null +++ b/first/local.h.src @@ -0,0 +1,7 @@ +/* collection of options, selected by including or excluding 'defines' */ + +/* Version number of the EM object code */ +# define VERSION 3 /* 16 bits number */ + +/* The default machine used by ack, acc, apc */ +# define ACKM "pdp" diff --git a/h/as_spec.h b/h/as_spec.h new file mode 100644 index 000000000..b309ffa0c --- /dev/null +++ b/h/as_spec.h @@ -0,0 +1 @@ +#define as_magic (sp_magic|(14<<8)) diff --git a/h/cg_pattern.h b/h/cg_pattern.h new file mode 100644 index 000000000..fc42c2f8c --- /dev/null +++ b/h/cg_pattern.h @@ -0,0 +1,156 @@ +/* offsets of interesting fields in EM-pattern */ + +#define PO_HASH 0 +#define PO_NEXT 1 +#define PO_MATCH 3 + +#define ILLHASH 0177777 + +/* Escapes in printstrings */ + +#define PR_TOK '\001' +#define PR_TOKFLD '\002' +#define PR_EMINT '\003' +#define PR_EMSTR '\004' +#define PR_ALLREG '\005' +#define PR_SUBREG '\006' +/* + * In case this list gets longer remember to keep out printable nonprintables + * like \t \n \r and the like. + */ + +/* Commands for codegenerator, in low order 5 bits of byte */ + +#define DO_NEXTEM 0 +#define DO_MATCH 1 +#define DO_XMATCH 2 +#define DO_XXMATCH 3 +#define DO_REMOVE 4 +#define DO_DEALLOCATE 5 +#define DO_REALLOCATE 6 +#define DO_ALLOCATE 7 +#define DO_LOUTPUT 8 +#define DO_ROUTPUT 9 +#define DO_MOVE 10 +#define DO_ERASE 11 +#define DO_TOKREPLACE 12 +#define DO_EMREPLACE 13 +#define DO_COST 14 +#define DO_RETURN 15 +#define DO_COERC 16 +#define DO_PRETURN 17 +#define DO_RREMOVE 18 + +typedef struct instance { + int in_which; +# define IN_COPY 1 +# define IN_RIDENT 2 +# define IN_ALLOC 3 +# define IN_DESCR 4 +# define IN_REGVAR 5 + int in_info[TOKENSIZE+1]; +} inst_t,*inst_p; + +typedef struct { + int c_size; /* index in enode-table */ + int c_time; /* dito */ +} cost_t,*cost_p; + +typedef struct { + int m_set1; /* number of tokenexpr in move: from */ + int m_expr1; /* optional expression */ + int m_set2; /* number of tokenexpr in move: to */ + int m_expr2; /* optional expression */ + int m_cindex; /* code index to really do it */ + cost_t m_cost; /* associated cost */ +} move_t, *move_p; + +typedef struct { + int set_size; + short set_val[SETSIZE]; +} set_t,*set_p; + +struct exprnode { + short ex_operator; + short ex_lnode; + short ex_rnode; +}; +typedef struct exprnode node_t; +typedef struct exprnode *node_p; + +typedef struct { /* to stack coercions */ + int c1_texpno; /* token expression number */ + int c1_expr; /* boolean expression */ + int c1_prop; /* property of register needed */ + int c1_codep; /* code index */ + cost_t c1_cost; /* cost involved */ +} c1_t,*c1_p; + +#ifdef MAXSPLIT +typedef struct { /* splitting coercions */ + int c2_texpno; /* token expression number */ + int c2_nsplit; /* split factor */ + int c2_repl[MAXSPLIT]; /* replacement instances */ + int c2_codep; /* code index */ +} c2_t,*c2_p; +#endif MAXSPLIT + +typedef struct { /* one to one coercions */ + int c3_texpno; /* token expression number */ + int c3_prop; /* property of register needed */ + int c3_repl; /* replacement instance */ + int c3_codep; /* code index */ +} c3_t,*c3_p; + +/* + * contents of .ex_operator + */ + +#define EX_TOKFIELD 0 +#define EX_ARG 1 +#define EX_CON 2 +#define EX_ALLREG 3 +#define EX_SAMESIGN 4 +#define EX_SFIT 5 +#define EX_UFIT 6 +#define EX_ROM 7 +#define EX_NCPEQ 8 +#define EX_SCPEQ 9 +#define EX_RCPEQ 10 +#define EX_NCPNE 11 +#define EX_SCPNE 12 +#define EX_RCPNE 13 +#define EX_NCPGT 14 +#define EX_NCPGE 15 +#define EX_NCPLT 16 +#define EX_NCPLE 17 +#define EX_OR2 18 +#define EX_AND2 19 +#define EX_PLUS 20 +#define EX_CAT 21 +#define EX_MINUS 22 +#define EX_TIMES 23 +#define EX_DIVIDE 24 +#define EX_MOD 25 +#define EX_LSHIFT 26 +#define EX_RSHIFT 27 +#define EX_NOT 28 +#define EX_COMP 29 +#define EX_COST 30 +#define EX_STRING 31 +#define EX_DEFINED 32 +#define EX_SUBREG 33 +#define EX_TOSTRING 34 +#define EX_UMINUS 35 +#define EX_REG 36 +#define EX_LOWW 37 +#define EX_HIGHW 38 +#define EX_INREG 39 +#define EX_REGVAR 40 + + + +#define getint(a,b) \ + if ((a=((*(b)++)&BMASK)) >= 128) {\ + a = ((a-128)<=0) */ +#define PAR_F 0004 /* address offset */ +#define PAR_L 0005 /* addressing locals/parameters */ +#define PAR_G 0006 /* addressing globals */ +#define PAR_W 0007 /* size: word multiple, fits word, possibly indirect */ +#define PAR_S 0010 /* size: word multiple */ +#define PAR_Z 0011 /* size: zero or word multiple */ +#define PAR_O 0012 /* size: word multiple or word fraction */ +#define PAR_P 0013 /* procedure name */ +#define PAR_B 0014 /* branch: instruction label */ +#define PAR_R 0015 /* register number (0,1,2) */ + +/* flow */ +#define FLO_NO 0000 /* straight on */ +#define FLO_C 0020 /* conditional branch */ +#define FLO_P 0040 /* procedure: call and return */ +#define FLO_T 0060 /* terminate: no return */ diff --git a/h/em_mes.h b/h/em_mes.h new file mode 100644 index 000000000..687f91742 --- /dev/null +++ b/h/em_mes.h @@ -0,0 +1,20 @@ +/* + * mnemonics for the message numbers in EM + */ + +#define ms_err 0 /* Compilation error occurred, ignore rest of module */ +#define ms_opt 1 /* Disable optimization please */ +#define ms_emx 2 /* Wordsize and pointersize assumed */ +#define ms_reg 3 /* Hint for possible register usage from frontend */ +#define ms_src 4 /* Number of source lines in this module */ +#define ms_flt 5 /* Floating point used */ +#define ms_com 6 /* Comment to be retained in compact code */ +#define ms_ret 7 /* Reserved */ +#define ms_ext 8 /* List of exported symbols from this library module */ +#define ms_par 9 /* Number of bytes of parameters accessed */ +#define ms_ego 10 /* Hint from EM Global Optimizer */ + +/* + * for details about ms_reg, see em_reg.h + * for details about ms_ego, see em_ego.h + */ diff --git a/h/em_ptyp.h b/h/em_ptyp.h new file mode 100644 index 000000000..6cb3da2c6 --- /dev/null +++ b/h/em_ptyp.h @@ -0,0 +1,8 @@ +#define ptyp(x) (1<<(x-sp_fspec)) + +#define cst_ptyp 0000140 +#define sym_ptyp 0000034 +#define arg_ptyp 0000574 +#define con_ptyp 0036000 +#define val_ptyp 0037777 +#define any_ptyp 0137777 diff --git a/h/em_reg.h b/h/em_reg.h new file mode 100644 index 000000000..760d7cfdd --- /dev/null +++ b/h/em_reg.h @@ -0,0 +1,10 @@ +/* + * mes ms_reg,offset,size,type,priority + * + * Here are the defines for type + */ + +#define reg_any 0 /* Unspecified type */ +#define reg_loop 1 /* loop control variable */ +#define reg_pointer 2 /* pointer variable */ +#define reg_float 3 /* floating point variable */ diff --git a/h/pc_err.h b/h/pc_err.h new file mode 100644 index 000000000..9e5e89920 --- /dev/null +++ b/h/pc_err.h @@ -0,0 +1,22 @@ +#define EARGC 64 +#define EEXP 65 +#define ELOG 66 +#define ESQT 67 +#define EASS 68 +#define EPACK 69 +#define EUNPACK 70 +#define EMOD 71 +#define EBADF 72 +#define EFREE 73 + +#define EWRITEF 96 +#define EREADF 97 +#define EEOF 98 +#define EFTRUNC 99 +#define ERESET 100 +#define EREWR 101 +#define ECLOSE 102 +#define EREAD 103 +#define EWRITE 104 +#define EDIGIT 105 +#define EASCII 106 diff --git a/h/pc_file.h b/h/pc_file.h new file mode 100644 index 000000000..f49a18537 --- /dev/null +++ b/h/pc_file.h @@ -0,0 +1,19 @@ +#define WRBIT 0100000 +#define TXTBIT 040000 +#define EOFBIT 020000 +#define ELNBIT 010000 +#define WINDOW 04000 +#define MAGIC 0252 + +struct file { + char *ptr; + unsigned flags; + char *fname; + int ufd; + int size; + int count; + int buflen; + char bufadr[512]; +}; + +#define EXTFL(z) ((struct file *)(_hbase + _extfl[z])) diff --git a/h/pc_size.h b/h/pc_size.h new file mode 100644 index 000000000..8545063fb --- /dev/null +++ b/h/pc_size.h @@ -0,0 +1,21 @@ +/* fundamental */ +#define sz_byte 1 +#define sz_bool 1 +#define sz_char 1 + +/* fixed for the time being */ +#define sz_word 2 +#define sz_int 2 +#define sz_long 4 + +/* variable (see pc.c) */ +#define sz_addr sizes[0] +#define sz_real sizes[1] +#define sz_head sizes[2] +#define sz_buff sizes[3] +#define sz_mset sizes[4] +#define sz_iset sizes[5] + +#define sz_last 5 + +#define sz_proc 2*sz_addr -- 2.34.1