11590Srgrimes/*
21590Srgrimes * Copyright (c) 1987, 1993, 1994
31590Srgrimes *	The Regents of the University of California.  All rights reserved.
41590Srgrimes *
51590Srgrimes * Redistribution and use in source and binary forms, with or without
61590Srgrimes * modification, are permitted provided that the following conditions
71590Srgrimes * are met:
81590Srgrimes * 1. Redistributions of source code must retain the above copyright
91590Srgrimes *    notice, this list of conditions and the following disclaimer.
101590Srgrimes * 2. Redistributions in binary form must reproduce the above copyright
111590Srgrimes *    notice, this list of conditions and the following disclaimer in the
121590Srgrimes *    documentation and/or other materials provided with the distribution.
131590Srgrimes * 4. Neither the name of the University nor the names of its contributors
141590Srgrimes *    may be used to endorse or promote products derived from this software
151590Srgrimes *    without specific prior written permission.
161590Srgrimes *
171590Srgrimes * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
181590Srgrimes * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
191590Srgrimes * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
201590Srgrimes * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
211590Srgrimes * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
221590Srgrimes * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
231590Srgrimes * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
241590Srgrimes * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
251590Srgrimes * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
261590Srgrimes * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
271590Srgrimes * SUCH DAMAGE.
281590Srgrimes *
291590Srgrimes *	@(#)ctags.h	8.3 (Berkeley) 4/2/94
3056677Smjacob *
3156677Smjacob * $FreeBSD$
3256677Smjacob *
331590Srgrimes */
341590Srgrimes
351590Srgrimes#define	bool	char
361590Srgrimes
371590Srgrimes#define	YES		1
381590Srgrimes#define	NO		0
391590Srgrimes#define	EOS		'\0'
401590Srgrimes
411590Srgrimes#define	ENDLINE		50		/* max length of pattern */
421590Srgrimes#define	MAXTOKEN	250		/* max size of single token */
431590Srgrimes
441590Srgrimes#define	SETLINE		{++lineno;lineftell = ftell(inf);}
451590Srgrimes#define	GETC(op,exp)	((c = getc(inf)) op (int)exp)
461590Srgrimes
4756666Smjacob/*
4856677Smjacob * These character classification macros assume that the (EOF & 0xff) element
4956677Smjacob * of the arrays is always 'NO', as the EOF return from getc() gets masked
5056677Smjacob * to that value.  Masking with 0xff has no effect for normal characters
5156677Smjacob * returned by getc() provided chars have 8 bits.
5256666Smjacob */
531590Srgrimes
5456666Smjacob#define	iswhite(arg)	_wht[arg & 0xff]	/* T if char is white */
5556666Smjacob#define	begtoken(arg)	_btk[arg & 0xff]	/* T if char can start token */
5656666Smjacob#define	intoken(arg)	_itk[arg & 0xff]	/* T if char can be in token */
5756666Smjacob#define	endtoken(arg)	_etk[arg & 0xff]	/* T if char ends tokens */
5856666Smjacob#define	isgood(arg)	_gd[arg & 0xff]	/* T if char can be after ')' */
5956663Smjacob
601590Srgrimestypedef struct nd_st {			/* sorting structure */
611590Srgrimes	struct nd_st	*left,
621590Srgrimes			*right;		/* left and right sons */
631590Srgrimes	char	*entry,			/* function or type name */
641590Srgrimes		*file,			/* file name */
651590Srgrimes		*pat;			/* search pattern */
661590Srgrimes	int	lno;			/* for -x option */
671590Srgrimes	bool	been_warned;		/* set if noticed dup */
681590Srgrimes} NODE;
691590Srgrimes
701590Srgrimesextern char	*curfile;		/* current input file name */
711590Srgrimesextern NODE	*head;			/* head of the sorted binary tree */
721590Srgrimesextern FILE    *inf;			/* ioptr for current input file */
731590Srgrimesextern FILE    *outf;			/* ioptr for current output file */
741590Srgrimesextern long	lineftell;		/* ftell after getc( inf ) == '\n' */
751590Srgrimesextern int	lineno;			/* line number of current line */
761590Srgrimesextern int	dflag;			/* -d: non-macro defines */
771590Srgrimesextern int	tflag;			/* -t: create tags for typedefs */
781590Srgrimesextern int	vflag;			/* -v: vgrind style index output */
791590Srgrimesextern int	wflag;			/* -w: suppress warnings */
801590Srgrimesextern int	xflag;			/* -x: cxref style output */
811590Srgrimesextern bool	_wht[], _etk[], _itk[], _btk[], _gd[];
821590Srgrimesextern char	lbuf[LINE_MAX];
831590Srgrimesextern char    *lbp;
841590Srgrimesextern char	searchar;		/* ex search character */
851590Srgrimes
8692920Simpextern int	cicmp(const char *);
8792920Simpextern void	getline(void);
8892920Simpextern void	pfnote(const char *, int);
8992920Simpextern int	skip_key(int);
9092920Simpextern void	put_entries(NODE *);
9192920Simpextern void	toss_yysec(void);
9292920Simpextern void	l_entries(void);
9392920Simpextern void	y_entries(void);
9492920Simpextern int	PF_funcs(void);
9592920Simpextern void	c_entries(void);
9692920Simpextern void	skip_comment(int);
97