Blame nss/coreconf/mkdepend/def.h

Packit 40b132
/* $Xorg: def.h,v 1.4 2001/02/09 02:03:16 xorgcvs Exp $ */
Packit 40b132
/*
Packit 40b132
Packit 40b132
Copyright (c) 1993, 1994, 1998 The Open Group.
Packit 40b132
Packit 40b132
Permission to use, copy, modify, distribute, and sell this software and its
Packit 40b132
documentation for any purpose is hereby granted without fee, provided that
Packit 40b132
the above copyright notice appear in all copies and that both that
Packit 40b132
copyright notice and this permission notice appear in supporting
Packit 40b132
documentation.
Packit 40b132
Packit 40b132
The above copyright notice and this permission notice shall be included in
Packit 40b132
all copies or substantial portions of the Software.
Packit 40b132
Packit 40b132
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
Packit 40b132
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
Packit 40b132
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
Packit 40b132
OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
Packit 40b132
AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
Packit 40b132
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Packit 40b132
Packit 40b132
Except as contained in this notice, the name of The Open Group shall not be
Packit 40b132
used in advertising or otherwise to promote the sale, use or other dealings
Packit 40b132
in this Software without prior written authorization from The Open Group.
Packit 40b132
Packit 40b132
*/
Packit 40b132
/* $XFree86: xc/config/makedepend/def.h,v 3.14 2003/01/17 17:09:49 tsi Exp $ */
Packit 40b132
Packit 40b132
#ifndef NO_X11
Packit 40b132
#include <X11/Xos.h>
Packit 40b132
#include <X11/Xfuncproto.h>
Packit 40b132
#endif
Packit 40b132
#include <stdlib.h>
Packit 40b132
#include <stdio.h>
Packit 40b132
#include <string.h>
Packit 40b132
#include <ctype.h>
Packit 40b132
#if 0
Packit 40b132
#ifndef X_NOT_POSIX
Packit 40b132
#ifndef _POSIX_SOURCE
Packit 40b132
#define _POSIX_SOURCE
Packit 40b132
#endif
Packit 40b132
#endif
Packit 40b132
#endif
Packit 40b132
#include <sys/types.h>
Packit 40b132
#include <fcntl.h>
Packit 40b132
#include <sys/stat.h>
Packit 40b132
Packit 40b132
#define MAXDEFINES	512
Packit 40b132
#define MAXFILES	1024
Packit 40b132
#define MAXINCFILES	256	/* "-include" files */
Packit 40b132
#define MAXDIRS		1024
Packit 40b132
#define SYMTABINC	10	/* must be > 1 for define() to work right */
Packit 40b132
#define	TRUE		1
Packit 40b132
#define	FALSE		0
Packit 40b132
Packit 40b132
/* the following must match the directives table in main.c */
Packit 40b132
#define	IF		0
Packit 40b132
#define	IFDEF		1
Packit 40b132
#define	IFNDEF		2
Packit 40b132
#define	ELSE		3
Packit 40b132
#define	ENDIF		4
Packit 40b132
#define	DEFINE		5
Packit 40b132
#define	UNDEF		6
Packit 40b132
#define	INCLUDE		7
Packit 40b132
#define	LINE		8
Packit 40b132
#define	PRAGMA		9
Packit 40b132
#define ERROR           10
Packit 40b132
#define IDENT           11
Packit 40b132
#define SCCS            12
Packit 40b132
#define ELIF            13
Packit 40b132
#define EJECT           14
Packit 40b132
#define WARNING         15
Packit 40b132
#define INCLUDENEXT     16
Packit 40b132
#define IFFALSE         17     /* pseudo value --- never matched */
Packit 40b132
#define ELIFFALSE       18     /* pseudo value --- never matched */
Packit 40b132
#define INCLUDEDOT      19     /* pseudo value --- never matched */
Packit 40b132
#define IFGUESSFALSE    20     /* pseudo value --- never matched */
Packit 40b132
#define ELIFGUESSFALSE  21     /* pseudo value --- never matched */
Packit 40b132
#define INCLUDENEXTDOT  22     /* pseudo value --- never matched */
Packit 40b132
Packit 40b132
#ifdef DEBUG
Packit 40b132
extern int	_debugmask;
Packit 40b132
/*
Packit 40b132
 * debug levels are:
Packit 40b132
 * 
Packit 40b132
 *     0	show ifn*(def)*,endif
Packit 40b132
 *     1	trace defined/!defined
Packit 40b132
 *     2	show #include
Packit 40b132
 *     3	show #include SYMBOL
Packit 40b132
 *     4-6	unused
Packit 40b132
 */
Packit 40b132
#define debug(level,arg) { if (_debugmask & (1 << level)) warning arg; }
Packit 40b132
#else
Packit 40b132
#define	debug(level,arg) /**/
Packit 40b132
#endif /* DEBUG */
Packit 40b132
Packit 40b132
typedef	unsigned char boolean;
Packit 40b132
Packit 40b132
struct symtab {
Packit 40b132
	char	*s_name;
Packit 40b132
	char	*s_value;
Packit 40b132
};
Packit 40b132
Packit 40b132
/* possible i_flag */
Packit 40b132
#define DEFCHECKED	(1<<0)	/* whether defines have been checked */
Packit 40b132
#define NOTIFIED	(1<<1)	/* whether we have revealed includes */
Packit 40b132
#define MARKED		(1<<2)	/* whether it's in the makefile */
Packit 40b132
#define SEARCHED	(1<<3)	/* whether we have read this */
Packit 40b132
#define FINISHED	(1<<4)	/* whether we are done reading this */
Packit 40b132
#define INCLUDED_SYM	(1<<5)	/* whether #include SYMBOL was found
Packit 40b132
				   Can't use i_list if TRUE */
Packit 40b132
struct	inclist {
Packit 40b132
	char		*i_incstring;	/* string from #include line */
Packit 40b132
	char		*i_file;	/* path name of the include file */
Packit 40b132
	struct inclist	**i_list;	/* list of files it itself includes */
Packit 40b132
	int		i_listlen;	/* length of i_list */
Packit 40b132
	struct symtab	**i_defs;	/* symbol table for this file and its
Packit 40b132
					   children when merged */
Packit 40b132
	int		i_ndefs;	/* current # defines */
Packit 40b132
	boolean		*i_merged;      /* whether we have merged child
Packit 40b132
					   defines */
Packit 40b132
	unsigned char   i_flags;
Packit 40b132
};
Packit 40b132
Packit 40b132
struct filepointer {
Packit 40b132
	char	*f_name;
Packit 40b132
	char	*f_p;
Packit 40b132
	char	*f_base;
Packit 40b132
	char	*f_end;
Packit 40b132
	long	f_len;
Packit 40b132
	long	f_line;
Packit 40b132
	long	cmdinc_count;
Packit 40b132
	char	**cmdinc_list;
Packit 40b132
	long	cmdinc_line;
Packit 40b132
};
Packit 40b132
Packit 40b132
#include <stdlib.h>
Packit 40b132
#if defined(macII) && !defined(__STDC__)  /* stdlib.h fails to define these */
Packit 40b132
char *malloc(), *realloc();
Packit 40b132
#endif /* macII */
Packit 40b132
Packit 40b132
char			*copy(char *str);
Packit 40b132
int                     match(char *str, char **list);
Packit 40b132
char			*base_name(char *file);
Packit 40b132
char			*getnextline(struct filepointer *fp);
Packit 40b132
struct symtab		**slookup(char *symbol, struct inclist *file);
Packit 40b132
struct symtab		**isdefined(char *symbol, struct inclist *file,
Packit 40b132
				    struct inclist **srcfile);
Packit 40b132
struct symtab		**fdefined(char *symbol, struct inclist *file,
Packit 40b132
				   struct inclist **srcfile);
Packit 40b132
struct filepointer	*getfile(char *file);
Packit 40b132
void                    included_by(struct inclist *ip, 
Packit 40b132
				    struct inclist *newfile);
Packit 40b132
struct inclist		*newinclude(char *newfile, char *incstring);
Packit 40b132
void                    inc_clean (void);
Packit 40b132
struct inclist		*inc_path(char *file, char *include, int type);
Packit 40b132
Packit 40b132
void                    freefile(struct filepointer *fp);
Packit 40b132
Packit 40b132
void                    define2(char *name, char *val, struct inclist *file);
Packit 40b132
void                    define(char *def, struct inclist *file);
Packit 40b132
void                    undefine(char *symbol, struct inclist *file);
Packit 40b132
int                     find_includes(struct filepointer *filep, 
Packit 40b132
				      struct inclist *file, 
Packit 40b132
				      struct inclist *file_red, 
Packit 40b132
				      int recursion, boolean failOK);
Packit 40b132
Packit 40b132
void                    recursive_pr_include(struct inclist *head, 
Packit 40b132
					     char *file, char *base);
Packit 40b132
void                    add_include(struct filepointer *filep, 
Packit 40b132
				    struct inclist *file, 
Packit 40b132
				    struct inclist *file_red, 
Packit 40b132
				    char *include, int type,
Packit 40b132
				    boolean failOK);
Packit 40b132
Packit 40b132
int                     cppsetup(char *filename,
Packit 40b132
				 char *line,
Packit 40b132
				 struct filepointer *filep,
Packit 40b132
				 struct inclist *inc);
Packit 40b132
Packit 40b132
Packit 40b132
extern void fatalerr(char *, ...);
Packit 40b132
extern void warning(char *, ...);
Packit 40b132
extern void warning1(char *, ...);