| 1 | /*-------------------------------------------------------------------------*/ |
|---|
| 2 | /* CIFMT.h */ |
|---|
| 3 | /*-------------------------------------------------------------------------*/ |
|---|
| 4 | |
|---|
| 5 | #ifndef CIFMT_H |
|---|
| 6 | #define CIFMT_H |
|---|
| 7 | |
|---|
| 8 | #define DATEFUNC 0 |
|---|
| 9 | #define DATETIME 999 |
|---|
| 10 | #define DATEONLY 998 |
|---|
| 11 | |
|---|
| 12 | #define DEB_ATTRIB 0 |
|---|
| 13 | #define TYPE_PATTERN 1 |
|---|
| 14 | #define TYPE_NUM 0 |
|---|
| 15 | #define TY_A 'A' /* tem que ficaR NO CISIS */ |
|---|
| 16 | #define TY_X 'X' |
|---|
| 17 | #define TY_N 'N' |
|---|
| 18 | #define NO_MIN_OCC -1 /* [-NO_MIN_OCC:-NO_MAX_OCC] */ |
|---|
| 19 | #define NO_MAX_OCC -9999 /* Numero maximo de ocorrencias ? */ |
|---|
| 20 | #define FMT_OPTIMIZE 0 |
|---|
| 21 | #define MAXSTACK 100 |
|---|
| 22 | #define PRINT_CODE 0 |
|---|
| 23 | #define l_code FMT_CODE /* AOT 14/05/93 */ |
|---|
| 24 | #define MAX_LITER 500 |
|---|
| 25 | #define INCR_LITER 500 |
|---|
| 26 | #define NMAXVAR 10 /* Numero maximo de variaveis E e S */ |
|---|
| 27 | /* fld_def is used to store the possible parameters related to a field */ |
|---|
| 28 | |
|---|
| 29 | typedef struct fld_def |
|---|
| 30 | { |
|---|
| 31 | int tag; |
|---|
| 32 | char sub_field; |
|---|
| 33 | int indent1; |
|---|
| 34 | int indent2; |
|---|
| 35 | int offset; |
|---|
| 36 | int length; |
|---|
| 37 | /* inicio implementacao [x:y] */ |
|---|
| 38 | int lower; /* intervalo [lowocc:uppocc] */ |
|---|
| 39 | int upper; |
|---|
| 40 | int execlower; /* intervalo [lowocc:uppocc] -execucao */ |
|---|
| 41 | int execupper; |
|---|
| 42 | /* fim implementacao [x:y] */ |
|---|
| 43 | int max_occ; |
|---|
| 44 | int actual_occ; |
|---|
| 45 | int first_occ; |
|---|
| 46 | int last_occ; |
|---|
| 47 | } field_definition_node; |
|---|
| 48 | |
|---|
| 49 | typedef int endereco; |
|---|
| 50 | |
|---|
| 51 | typedef enum classe_operandos { |
|---|
| 52 | integer,string,logical,float_n,ptr,l_w,xindex,next_cc,long_n,type_recstru |
|---|
| 53 | } class_operand; |
|---|
| 54 | |
|---|
| 55 | /* Extern */ |
|---|
| 56 | #if !CIAPI_SOURCE |
|---|
| 57 | extern LONGX fmt_error; /* gener'ated */ /* AOT 26/12/91 */ |
|---|
| 58 | extern char *inst_cnv[];/* gener'ated */ /* AOT 26/12/91 */ |
|---|
| 59 | #endif /* CIAPI_SOURCE */ |
|---|
| 60 | /* HB 20080901 - a funcao fmt_float_numb nao converte o numero corretamente se float_x for float |
|---|
| 61 | #if PC */ |
|---|
| 62 | #if 1 |
|---|
| 63 | #define float_x double |
|---|
| 64 | #else |
|---|
| 65 | #define float_x float |
|---|
| 66 | #define float_x_fmt "%f" |
|---|
| 67 | #endif |
|---|
| 68 | /* Esta dando erro quando define float (?) */ |
|---|
| 69 | #define max_str_num 16 /* Tamanho numero formatado quando omite param */ |
|---|
| 70 | |
|---|
| 71 | |
|---|
| 72 | /* Prototypes */ |
|---|
| 73 | #if ANSI |
|---|
| 74 | char *fmt_float_numb (float_x valor,int min,int dec,char fill); |
|---|
| 75 | LONGX store_float_const(char *s); |
|---|
| 76 | void fmt_chadd(l_code *pgmp); |
|---|
| 77 | int num_expr(void); |
|---|
| 78 | #if CICPP |
|---|
| 79 | void sc(char *p); |
|---|
| 80 | #else /* CICPP */ |
|---|
| 81 | void sc(char *p); |
|---|
| 82 | #endif /* CICPP */ |
|---|
| 83 | |
|---|
| 84 | #if CICPP |
|---|
| 85 | int fmt_CRLF (char *v,int pos); |
|---|
| 86 | #else |
|---|
| 87 | int fmt_CRLF (char *v,int pos); |
|---|
| 88 | #endif /*CICPP*/ |
|---|
| 89 | |
|---|
| 90 | #if CICPP |
|---|
| 91 | LONGX lookup(char *keyp,TRMSTRU *trmp,char *dbnp,LONGX nord); |
|---|
| 92 | #else /* CICPP */ |
|---|
| 93 | LONGX lookup(char *keyp,LONGX next_inverted_prat,char *dbnp,LONGX nord); |
|---|
| 94 | #endif /* CICPP */ |
|---|
| 95 | void out_put_str(char out[],LONGX maxsize,int *pout,LONGX lw, |
|---|
| 96 | int id1,int id2,LONGX *ncc,char s[]); |
|---|
| 97 | void print_inter_din(char *fmt,l_code *head); |
|---|
| 98 | void print_inter(char *fmt,l_code *head); |
|---|
| 99 | int spacing_string (void); |
|---|
| 100 | void suffix (void); |
|---|
| 101 | label gen_next_label (void); |
|---|
| 102 | int separator (void); |
|---|
| 103 | char *store_res_word(char *str); |
|---|
| 104 | void get_ch (void); |
|---|
| 105 | void erro (int nerr); |
|---|
| 106 | void str_read (char end_ch); |
|---|
| 107 | void getsymbol (void); |
|---|
| 108 | void initialize (void); |
|---|
| 109 | void escrevesym (void); |
|---|
| 110 | void semantic_initialize(void); |
|---|
| 111 | void semantic_error(char *msg); |
|---|
| 112 | void isis_fmt ( void ); |
|---|
| 113 | void change_pre_cond_by_u_cond(l_code *first, l_code *last); |
|---|
| 114 | int dummy_id (l_code *idx,label lab1); |
|---|
| 115 | int gen(label lab, |
|---|
| 116 | instruction_code instr,LONGX add,l_code *index); |
|---|
| 117 | void print_code(l_code *lista); |
|---|
| 118 | field_definition_node *alloc_field_definition_node (void); |
|---|
| 119 | LONGX store_field_def(int tag,char subfield, |
|---|
| 120 | int ind1,int ind2,int off,int len,int low,int upp); |
|---|
| 121 | l_code *alloc_pgm_node (void); |
|---|
| 122 | LONGX store_str_const(char *s); |
|---|
| 123 | |
|---|
| 124 | /*versao6 fim ----------------------------------------------------------*/ |
|---|
| 125 | char *sub_field_change(char *q); |
|---|
| 126 | char *translate_instruction( instruction_code i); |
|---|
| 127 | char *find_numeric_string(char v[],int *k); |
|---|
| 128 | |
|---|
| 129 | /*AOT ------------------------------------------------------------------*/ |
|---|
| 130 | void out_coreleft (void); |
|---|
| 131 | void boolean_expr (void); |
|---|
| 132 | void boolean_factor (void); |
|---|
| 133 | void boolean_term (void); |
|---|
| 134 | |
|---|
| 135 | void fmt_push_repeat (void); |
|---|
| 136 | void fmt_pop_repeat (void); |
|---|
| 137 | /* void fmt_inicio_grupos_vfields(instruction_code i, instruction_code f); */ |
|---|
| 138 | void fmt_fim_grupos_vfields(void); |
|---|
| 139 | |
|---|
| 140 | #else |
|---|
| 141 | char *fmt_float_numb (); |
|---|
| 142 | LONGX store_float_const(); |
|---|
| 143 | void fmt_chadd(); |
|---|
| 144 | int num_expr(); |
|---|
| 145 | LONGX lookup(); |
|---|
| 146 | void out_put_str(); |
|---|
| 147 | void print_inter_din(); |
|---|
| 148 | void print_inter(); |
|---|
| 149 | int spacing_string (); |
|---|
| 150 | void suffix (); |
|---|
| 151 | label gen_next_label (); |
|---|
| 152 | int separator (); |
|---|
| 153 | char *store_res_word(); |
|---|
| 154 | void get_ch (); |
|---|
| 155 | void erro (); |
|---|
| 156 | void str_read (); |
|---|
| 157 | void getsymbol (); |
|---|
| 158 | void initialize (); |
|---|
| 159 | void escrevesym (); |
|---|
| 160 | void semantic_initialize(); |
|---|
| 161 | void semantic_error(); |
|---|
| 162 | void isis_fmt (); |
|---|
| 163 | void change_pre_cond_by_u_cond(); |
|---|
| 164 | int dummy_id (); |
|---|
| 165 | int gen(); |
|---|
| 166 | void print_code(); |
|---|
| 167 | field_definition_node *alloc_field_definition_node (); |
|---|
| 168 | LONGX store_field_def(); |
|---|
| 169 | l_code *alloc_pgm_node (); |
|---|
| 170 | LONGX store_str_const(); |
|---|
| 171 | |
|---|
| 172 | /*versao6 fim ----------------------------------------------------------*/ |
|---|
| 173 | char *sub_field_change(); |
|---|
| 174 | char *translate_instruction(); |
|---|
| 175 | char *find_numeric_string(); |
|---|
| 176 | |
|---|
| 177 | /*AOT ------------------------------------------------------------------*/ |
|---|
| 178 | void out_coreleft (); |
|---|
| 179 | void boolean_expr (); |
|---|
| 180 | void boolean_factor (); |
|---|
| 181 | void boolean_term (); |
|---|
| 182 | |
|---|
| 183 | void fmt_push_repeat (); |
|---|
| 184 | void fmt_pop_repeat (); |
|---|
| 185 | /* void fmt_inicio_grupos_vfields(); */ |
|---|
| 186 | void fmt_fim_grupos_vfields(); |
|---|
| 187 | |
|---|
| 188 | #endif |
|---|
| 189 | |
|---|
| 190 | |
|---|
| 191 | |
|---|
| 192 | /*-------------------------- Defines ---------------------------------------*/ |
|---|
| 193 | #define null_char '\0' |
|---|
| 194 | #define multiply_char '*' |
|---|
| 195 | #define nulo NULL /* AOT 06/04/92 */ |
|---|
| 196 | #define subfield_null ' ' |
|---|
| 197 | #define cr '\r' |
|---|
| 198 | #define lf '\n' |
|---|
| 199 | #define true 1 |
|---|
| 200 | #define false 0 |
|---|
| 201 | #define greater_char '>' |
|---|
| 202 | #define less_char '<' |
|---|
| 203 | #define equal_char '=' |
|---|
| 204 | #define space_char ' ' |
|---|
| 205 | #define LASTVAL -2 |
|---|
| 206 | |
|---|
| 207 | /*----------------- Defines retirados de cifm[2,3].c-----------------------*/ |
|---|
| 208 | |
|---|
| 209 | |
|---|
| 210 | /*--------------------------------------------------------------------------*/ |
|---|
| 211 | /* crlf */ |
|---|
| 212 | /*--------------------------------------------------------------------------*/ |
|---|
| 213 | #if 0 |
|---|
| 214 | #if UNIX | WWWISIS |
|---|
| 215 | #define crlf(v,i) ((v[i-1]==lf)?true:false) |
|---|
| 216 | #define LEN_crlf 1 /* 04-02-95 Para delete_chars funcionar */ |
|---|
| 217 | #else |
|---|
| 218 | #define crlf(v,i) ((v[i-2]==cr && v[i-1]==lf)?true:false) |
|---|
| 219 | #define LEN_crlf 2 /* 04-02-95 Para delete_chars funcionar */ |
|---|
| 220 | #endif |
|---|
| 221 | #endif |
|---|
| 222 | /*--------------------------------------------------------------------------*/ |
|---|
| 223 | /* Macro is_upper_mode */ |
|---|
| 224 | /*--------------------------------------------------------------------------*/ |
|---|
| 225 | |
|---|
| 226 | #define is_upper_mode(i) (i==mpu_par || i==mdu_par || i==mhu_par) |
|---|
| 227 | |
|---|
| 228 | /*--------------------------------------------------------------------------*/ |
|---|
| 229 | /* new_line */ |
|---|
| 230 | /*--------------------------------------------------------------------------*/ |
|---|
| 231 | #if 0 |
|---|
| 232 | #if UNIX |
|---|
| 233 | #define new_line(v,i) {v[i++]=lf;v[i]=null_char;} |
|---|
| 234 | #else |
|---|
| 235 | #define new_line(v,i) {v[i++]=cr;v[i++]=lf;v[i]=null_char;} |
|---|
| 236 | #endif |
|---|
| 237 | #endif |
|---|
| 238 | |
|---|
| 239 | #if !CICPP |
|---|
| 240 | #define new_line(v,i,max) { if (i + nl_LEN < max ){ \ |
|---|
| 241 | strcat(v,nl_STR); \ |
|---|
| 242 | i=i+nl_LEN; \ |
|---|
| 243 | }else {if (fmttrace)printf(" No room for text - truncating");} \ |
|---|
| 244 | ;} |
|---|
| 245 | #endif /* CICPP */ |
|---|
| 246 | |
|---|
| 247 | #endif /* CIFMT_H */ |
|---|