File: field.h

package info (click to toggle)
mawk 1.3.3-8
  • links: PTS
  • area: main
  • in suites: woody
  • size: 1,176 kB
  • ctags: 1,511
  • sloc: ansic: 13,038; yacc: 994; awk: 629; sh: 162; makefile: 152
file content (105 lines) | stat: -rw-r--r-- 2,652 bytes parent folder | download | duplicates (7)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105

/********************************************
field.h
copyright 1991, Michael D. Brennan

This is a source file for mawk, an implementation of
the AWK programming language.

Mawk is distributed without warranty under the terms of
the GNU General Public License, version 2, 1991.
********************************************/

/* $Log: field.h,v $
 * Revision 1.2  1995/06/18  19:42:16  mike
 * Remove some redundant declarations and add some prototypes
 *
 * Revision 1.1.1.1  1993/07/03  18:58:12  mike
 * move source to cvs
 *
 * Revision 5.2  1992/01/06  08:10:24  brennan
 * set_binmode() proto for MSDOS
 *
 * Revision 5.1  91/12/05  07:59:16  brennan
 * 1.1 pre-release
 * 
*/

/* field.h */


#ifndef  FIELD_H
#define  FIELD_H   1

void  PROTO( set_field0, (char *, unsigned) ) ;
void  PROTO( split_field0, (void) ) ;
int   PROTO( space_split, (char *, unsigned) ) ;
int   PROTO( re_split, (char *, PTR) ) ;
int   PROTO( null_split, (char *)) ;
void  PROTO( field_assign, (CELL*, CELL *) ) ;
char *PROTO( is_string_split, (PTR , unsigned *) ) ;
void  PROTO( slow_cell_assign, (CELL*, CELL*)) ;
CELL *PROTO( slow_field_ptr, (int)) ;
int   PROTO( field_addr_to_index, (CELL*)) ;
void  PROTO( set_binmode, (int)) ;


#define  NUM_PFIELDS		5
extern  CELL  field[FBANK_SZ+NUM_PFIELDS] ;
	/* $0, $1 ... $(MAX_SPLIT), NF, RS, RS, CONVFMT, OFMT */

/* more fields if needed go here */
extern CELL *fbank[NUM_FBANK] ; /* fbank[0] == field */

/* index to CELL *  for a field */
#define field_ptr(i) ((i)<=MAX_SPLIT?field+(i):slow_field_ptr(i))

/* the pseudo fields, assignment has side effects */
#define  NF     (field+MAX_SPLIT+1)   /* must be first */
#define  RS     (field+MAX_SPLIT+2)
#define  FS     (field+MAX_SPLIT+3)
#define  CONVFMT  (field+MAX_SPLIT+4)
#define  OFMT   (field+MAX_SPLIT+5)   /* must be last */

#define  LAST_PFIELD	OFMT

/* some compilers choke on (NF-field) in a case statement
   even though it's constant so ...
*/
#define  NF_field    (MAX_SPLIT+1)
#define  RS_field    (MAX_SPLIT+2) 
#define  FS_field    (MAX_SPLIT+3) 
#define  CONVFMT_field (MAX_SPLIT+4)
#define  OFMT_field  (MAX_SPLIT+5) 


extern  int  nf ; /* shadows NF */

/* a shadow type for RS and FS */
#define  SEP_SPACE      0
#define  SEP_CHAR       1
#define  SEP_STR        2
#define  SEP_RE         3
#define  SEP_MLR	4

typedef  struct {
char  type ;
char  c ;
PTR ptr ; /* STRING* or RE machine* */
} SEPARATOR ;

extern   SEPARATOR  rs_shadow  ;
extern   CELL  fs_shadow ;


/*  types for splitting overflow */

typedef  struct spov {
struct spov  *link ;
STRING  *sval ;
} SPLIT_OV ;

extern  SPLIT_OV  *split_ov_list ;


#endif   /* FIELD_H  */