awk.def

来自「<B>Digital的Unix操作系统VAX 4.2源码</B>」· DEF 代码 · 共 176 行

DEF
176
字号
/* *			Copyright (c) 1987,1988,1989 by *		Digital Equipment Corporation, Maynard, MA *			All rights reserved. *								 *	This software is furnished under a license and may be used and *	copied  only  in accordance with the terms of such license and *	with the  inclusion  of  the  above  copyright  notice.   This *	software  or  any  other copies thereof may not be provided or *	otherwise made available to any other person.  No title to and *	ownership of the software is hereby transferred.		 *								 *	This software is  derived  from  software  received  from  the *	University    of   California,   Berkeley,   and   from   Bell *	Laboratories.  Use, duplication, or disclosure is  subject  to *	restrictions  under  license  agreements  with  University  of *	California and with AT&T.					 *								 *	The information in this software is subject to change  without *	notice  and should not be construed as a commitment by Digital *	Equipment Corporation.					 *								 *	Digital assumes no responsibility for the use  or  reliability *	of its software on equipment which is not supplied by Digital.*//********************************** *  Modification History * * 31-May-89	Tim N *	Added field field_num to cell definition.  This way when assigning *	values to a cell you can check to see if the fields need to be *	reevaluated, especially updating a field not defined by the input *	record.  Added this header. * ***********************************//* @(#)awk.def	4.1	(ULTRIX)	7/17/90 */#define hack	int#define	AWKFLOAT	double	/*  changed to duble from float since				    it caused truncation problems of data				    11/25/87 Teoman Topcubasi	*/#define	xfree(a)	{ if(a!=NULL) { yfree(a); a=NULL;} }#define	strfree(a)	{ if(a!=NULL && a!=EMPTY) { yfree(a);} a=EMPTY; }#define yfree free#define	isnull(x)	((x) == EMPTY || (x) == NULL)#ifdef	DEBUG#	define	dprintf	if(dbg)printf#else#	define	dprintf(x1, x2, x3, x4)#endiftypedef	AWKFLOAT	awkfloat;extern char	**FS;extern char	**RS;extern char	**ORS;extern char	**OFS;extern char	**OFMT;extern awkfloat *NR;extern awkfloat *NF;extern char	**FILENAME;extern char	record[];extern char	EMPTY[];extern int	dbg;extern int	lineno;extern int	errorflag;extern int	donefld;	/* 1 if record broken into fields */extern int	donerec;	/* 1 if record is valid (no fld has changed */typedef struct val {	/* general value during processing */	char	*nval;	/* name, for variables only */	char	*sval;	/* string value */	awkfloat	fval;	/* value as number */	unsigned	tval;	/* type info */	char		field_num;	/* if cell is a field this is the # */	struct val	*nextval;	/* ptr to next if chained */} cell;extern cell *symtab[];cell	*setsymtab(), *lookup(), **makesymtab();extern cell	*recloc;	/* location of input record */extern cell	*nrloc;		/* NR */extern cell	*nfloc;		/* NF */#define	STR	01	/* string value is valid */#define	NUM	02	/* number value is valid */#define FLD	04	/* FLD means don't free string space */#define	CON	010	/* this is a constant */#define	ARR	020	/* this is an array */awkfloat setfval(), getfval();char	*setsval(), *getsval();char	*tostring(), *tokname(), *malloc();double	log(), sqrt(), exp(), atof();/* function types */#define	FLENGTH	1#define	FSQRT	2#define	FEXP	3#define	FLOG	4#define	FINT	5typedef struct {	char otype;	char osub;	cell *optr;} obj;#define BOTCH	1struct nd {	char ntype;	char subtype;	struct nd *nnext;	int nobj;	struct nd *narg[BOTCH];	/* C won't take a zero length array */};typedef struct nd node;extern node	*winner;extern node	*nullstat;/* otypes */#define OCELL	0#define OEXPR	1#define OBOOL	2#define OJUMP	3/* cell subtypes */#define CTEMP	4#define CNAME	3 #define CVAR	2#define CFLD	1#define CCON	0/* bool subtypes */#define BTRUE	1#define BFALSE	2/* jump subtypes */#define JEXIT	1#define JNEXT	2#define	JBREAK	3#define	JCONT	4/* node types */#define NVALUE	1#define NSTAT	2#define NEXPR	3#define NPA2	4extern obj	(*proctab[])();extern obj	true, false;extern int	pairstack[], paircnt;#define cantexec(n)	(n->ntype == NVALUE)#define notlegal(n)	(n <= FIRSTTOKEN || n >= LASTTOKEN || proctab[n-FIRSTTOKEN]== nullproc)#define isexpr(n)	(n->ntype == NEXPR)#define isjump(n)	(n.otype == OJUMP)#define isexit(n)	(n.otype == OJUMP && n.osub == JEXIT)#define	isbreak(n)	(n.otype == OJUMP && n.osub == JBREAK)#define	iscont(n)	(n.otype == OJUMP && n.osub == JCONT)#define	isnext(n)	(n.otype == OJUMP && n.osub == JNEXT)#define isstr(n)	(n.optr->tval & STR)#define istrue(n)	(n.otype == OBOOL && n.osub == BTRUE)#define istemp(n)	(n.otype == OCELL && n.osub == CTEMP)#define isfld(n)	(!donefld && n.osub==CFLD && n.otype==OCELL && n.optr->nval==EMPTY)#define isrec(n)	(donefld && n.osub==CFLD && n.otype==OCELL && n.optr->nval!=EMPTY)obj	nullproc();obj	relop();#define MAXSYM	50#define	HAT	0177	/* matches ^ in regular expr */			/* watch out for mach dep */

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?