1 2 /******************************************** 3 field.h 4 copyright 1991, Michael D. Brennan 5 6 This is a source file for mawk, an implementation of 7 the AWK programming language. 8 9 Mawk is distributed without warranty under the terms of 10 the GNU General Public License, version 2, 1991. 11 ********************************************/ 12 13 /* $Log: field.h,v $ 14 * Revision 5.2 1992/01/06 08:10:24 brennan 15 * set_binmode() proto for MSDOS 16 * 17 * Revision 5.1 91/12/05 07:59:16 brennan 18 * 1.1 pre-release 19 * 20 */ 21 22 /* field.h */ 23 24 25 #ifndef FIELD_H 26 #define FIELD_H 1 27 28 void PROTO( set_field0, (char *, unsigned) ) ; 29 void PROTO( split_field0, (void) ) ; 30 int PROTO( space_split, (char *, unsigned) ) ; 31 void PROTO( field_assign, (CELL*, CELL *) ) ; 32 char *PROTO( is_string_split, (PTR , unsigned *) ) ; 33 void PROTO( slow_cell_assign, (CELL*, CELL*)) ; 34 CELL *PROTO( slow_field_ptr, (int)) ; 35 int PROTO( field_addr_to_index, (CELL*)) ; 36 void PROTO( set_binmode, (int)) ; 37 38 39 #define NUM_PFIELDS 5 40 extern CELL field[FBANK_SZ+NUM_PFIELDS] ; 41 /* $0, $1 ... $(MAX_SPLIT), NF, RS, RS, CONVFMT, OFMT */ 42 43 /* more fields if needed go here */ 44 extern CELL *fbank[NUM_FBANK] ; /* fbank[0] == field */ 45 46 /* index to CELL * for a field */ 47 #define field_ptr(i) ((i)<=MAX_SPLIT?field+(i):slow_field_ptr(i)) 48 49 /* the pseudo fields, assignment has side effects */ 50 #define NF (field+MAX_SPLIT+1) /* must be first */ 51 #define RS (field+MAX_SPLIT+2) 52 #define FS (field+MAX_SPLIT+3) 53 #define CONVFMT (field+MAX_SPLIT+4) 54 #define OFMT (field+MAX_SPLIT+5) /* must be last */ 55 56 #define LAST_PFIELD OFMT 57 58 /* some compilers choke on (NF-field) in a case statement 59 even though it's constant so ... 60 */ 61 #define NF_field (MAX_SPLIT+1) 62 #define RS_field (MAX_SPLIT+2) 63 #define FS_field (MAX_SPLIT+3) 64 #define CONVFMT_field (MAX_SPLIT+4) 65 #define OFMT_field (MAX_SPLIT+5) 66 67 68 extern int nf ; /* shadows NF */ 69 70 /* a shadow type for RS and FS */ 71 #define SEP_SPACE 0 72 #define SEP_CHAR 1 73 #define SEP_STR 2 74 #define SEP_RE 3 75 #define SEP_MLR 4 76 77 typedef struct { 78 char type ; 79 char c ; 80 PTR ptr ; /* STRING* or RE machine* */ 81 } SEPARATOR ; 82 83 extern SEPARATOR rs_shadow ; 84 extern CELL fs_shadow ; 85 86 87 /* types for splitting overflow */ 88 89 typedef struct spov { 90 struct spov *link ; 91 STRING *sval ; 92 } SPLIT_OV ; 93 94 extern SPLIT_OV *split_ov_list ; 95 96 97 #endif /* FIELD_H */ 98