awk.h revision 7c478bd95313f5f23a4c958a745db2134aa03244
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License, Version 1.0 only
* (the "License"). You may not use this file except in compliance
* with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
/* All Rights Reserved */
/*
* Copyright (c) 1996, 2001 by Sun Microsystems, Inc.
* All rights reserved.
*/
#ident "%Z%%M% %I% %E% SMI" /* SVr4.0 2.13 */
#include <limits.h>
typedef double Awkfloat;
typedef unsigned char uchar;
#define DEBUG
#ifdef DEBUG
/* uses have to be doubly parenthesized */
#else
# define dprintf(x)
#endif
extern char errbuf[200];
extern int compile_time; /* 1 if compiling, 0 if running */
/* The standards (SUSV2) requires that Record size be atleast LINE_MAX.
* LINE_MAX is standard variable defined in limits.h.
* Though nawk is not standards compliant, we let RECSIZE
* grow with LINE_MAX instead of magic number 1024.
*/
#define MAXFLD 500
extern int dbg;
extern int errorflag;
extern int donefld; /* 1 if record broken into fields */
extern int donerec; /* 1 if record is valid (no fld has changed */
/* Cell: all information about a variable or constant */
typedef struct Cell {
unsigned tval; /* type info: STR|NUM|ARR|FCN|FLD|CON|DONTFREE */
} Cell;
typedef struct { /* symbol table array */
int nelem; /* elements in table right now */
int size; /* size of tab */
} Array;
/* Cell.tval values: */
/* function types */
#define FLENGTH 1
#define FSQRT 2
#define FEXP 3
#define FLOG 4
#define FINT 5
#define FSYSTEM 6
#define FRAND 7
#define FSRAND 8
#define FSIN 9
#define FCOS 10
#define FATAN 11
#define FTOUPPER 12
#define FTOLOWER 13
/* Node: parse tree is made of nodes, with Cell's at bottom */
typedef struct Node {
int ntype;
int nobj;
} Node;
/* ctypes */
#define OCELL 1
#define OBOOL 2
#define OJUMP 3
/* Cell subtypes: csub */
#define CFREE 7
#define CCOPY 6
#define CCON 5
#define CTEMP 4
#define CNAME 3
#define CVAR 2
#define CFLD 1
/* bool subtypes */
#define BTRUE 11
#define BFALSE 12
/* jump subtypes */
#define JEXIT 21
#define JNEXT 22
#define JBREAK 23
#define JCONT 24
#define JRET 25
/* node types */
#define NVALUE 1
#define NSTAT 2
#define NEXPR 3
#define NFIELD 4
#define NSTATES 32
typedef struct rrow {
int ltype;
int lval;
int *lfollow;
} rrow;
typedef struct fa {
int anchor;
int use;
int initstat;
int curstat;
int accept;
int reset;
} fa;