|
root / base / usr / src / cmd / sgs / m4 / common / m4ext.c
m4ext.c C 111 lines 3.1 KB
  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
106
107
108
109
110
/*
 * CDDL HEADER START
 *
 * The contents of this file are subject to the terms of the
 * Common Development and Distribution License (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
 * or http://www.opensolaris.org/os/licensing.
 * 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) 1988 AT&T	*/
/*	  All Rights Reserved  	*/


/*
 * Copyright (c) 1989, 2010, Oracle and/or its affiliates. All rights reserved.
 */

#include	"m4.h"


/* storage params */
int	hshsize 	= DEF_HSHSIZE;	/* hash table size (prime) */
int	bufsize 	= DEF_BUFSIZE;	/* pushback & arg text buffers */
int	stksize 	= DEF_STKSIZE;	/* call stack */
int	toksize 	= DEF_TOKSIZE;	/* biggest word ([a-z_][a-z0-9_]*) */


/* pushback buffer */
wchar_t	*ibuf;				/* buffer */
wchar_t	*ibuflm;			/* highest buffer addr */
wchar_t	*ip;				/* current position */
wchar_t	*ipflr;				/* buffer floor */
wchar_t 	*ipstk[10];			/* stack for "ipflr"s */


/* arg collection buffer */
wchar_t	*obuf;				/* buffer */
wchar_t	*obuflm;			/* high address */
wchar_t	*op;				/* current position */


/* call stack */
struct call	*callst;		/* stack */
struct call	*Cp 	= NULL;		/* position */


/* token storage */
wchar_t	*token;				/* buffer */
wchar_t	*toklm;				/* high addr */


/* file name and current line storage for line sync and diagnostics */
char	*fname[11];			/* file name ptr stack */
int	fline[10];			/* current line nbr stack */


/* input file stuff for "include"s */
FILE	*ifile[10] 	= {stdin};	/* stack */
int	ifx;				/* stack index */
ibuf_t	ibuffer[11];			/* input buffer */

/* stuff for output diversions */
FILE	*cf 	= stdout;		/* current output file */
FILE	*ofile[11] 	= {stdout};	/* output file stack */
int	ofx;				/* stack index */


/* comment markers */
wchar_t	lcom[MAXSYM+1] 	= L"#";
wchar_t	rcom[MAXSYM+1] 	= L"\n";


/* quote markers */
wchar_t	lquote[MAXSYM+1]  = L"`";
wchar_t	rquote[MAXSYM+1]  = L"\'";


/* argument ptr stack */
wchar_t	**argstk;
wchar_t	*astklm;			/* high address */
wchar_t	**Ap;				/* current position */


/* symbol table */
struct nlist	**hshtab;		/* hash table */
unsigned int	hshval;			/* last hash val */


/* misc */
char	*procnam;			/* argv[0] */
char	*tempfile;			/* used for diversion files */
struct	Wrap *wrapstart = NULL;	/* first entry in of list of "m4wrap" strings */
wchar_t	nullstr[] 	= {0};
int	nflag 	= 1;			/* name flag, used for line sync code */
int	sflag;				/* line sync flag */
int	sysrval;			/* return val from syscmd */
int	trace;				/* global trace flag */
int	exitstat = OK;			/* global exit status */
int	wide;				/* multi-byte locale */