|
|
1.1 root 1: /*
2: * $Header: def.h,v 1.2 87/08/20 12:13:09 toddb Exp $
3: *
4: * $Log: def.h,v $
5: * Revision 1.2 87/08/20 12:13:09 toddb
6: * add define for u_char for the sake of USG.
7: *
8: * Revision 1.1 87/04/08 16:40:37 rich
9: * Initial revision
10: *
11: * Revision 1.1 87/04/08 16:40:37 rich
12: * Initial revision
13: *
14: * Revision 1.2 86/04/18 14:05:40 toddb
15: * Added a new field to struct inclist: "i_marked". This is used
16: * by recursive_pr() to tell if it is traversing a loop of include
17: * files.
18: *
19: * Revision 1.1 86/04/15 08:34:21 toddb
20: * Initial revision
21: *
22: */
23: #include <stdio.h>
24: #include <ctype.h>
25: #include <sys/types.h>
26: #include <fcntl.h>
27: #include <sys/stat.h>
28:
29: #ifdef USG
30: #define u_char unchar
31: #endif
32:
33: #define MAXDEFINES 512
34: #define MAXFILES 512
35: #define MAXDIRS 10
36: #define SYMTABINC 10 /* must be > 1 for define() to work right */
37: #define TRUE 1
38: #define FALSE 0
39: #define IF 0
40: #define IFDEF 1
41: #define IFNDEF 2
42: #define ELSE 3
43: #define ENDIF 4
44: #define DEFINE 5
45: #define UNDEF 6
46: #define INCLUDE 7
47: #define LINE 8
48: #define IFFALSE 9 /* pseudo value --- never matched */
49: #define INCLUDEDOT 10 /* pseudo value --- never matched */
50:
51: #ifdef DEBUG
52: extern int debug;
53: #define debug0 ((debug&0x0001)==0) ? debug : log /* show ifn*(def)*,endif */
54: #define debug1 ((debug&0x0002)==0) ? debug : log /* trace defined/!defined */
55: #define debug2 ((debug&0x0004)==0) ? debug : log /* show #include */
56: #define debug3 ((debug&0x0008)==0) ? debug : log /* unused */
57: #define debug4 ((debug&0x0010)==0) ? debug : log /* unused */
58: #define debug5 ((debug&0x0020)==0) ? debug : log /* unused */
59: #define debug6 ((debug&0x0040)==0) ? debug : log /* unused */
60: #else DEBUG
61: #define debug0
62: #define debug1
63: #define debug2
64: #define debug3
65: #define debug4
66: #define debug5
67: #define debug6
68: #endif DEBUG
69:
70: typedef u_char boolean;
71:
72: struct symtab {
73: char *s_name;
74: char *s_value;
75: };
76:
77: struct inclist {
78: char *i_incstring; /* string from #include line */
79: char *i_file; /* path name of the include file */
80: struct inclist **i_list; /* list of files it itself includes */
81: int i_listlen; /* length of i_list */
82: struct symtab *i_defs; /* symbol table for this file */
83: struct symtab *i_lastdef; /* last symbol defined */
84: int i_deflen; /* number of defines */
85: boolean i_defchecked; /* whether defines have been checked */
86: boolean i_notified; /* whether we have revealed includes */
87: boolean i_marked; /* whether it's in the makefile */
88: boolean i_searched; /* whether we have read this */
89: };
90:
91: struct filepointer {
92: char *f_p;
93: char *f_base;
94: char *f_end;
95: long f_len;
96: long f_line;
97: };
98:
99: char *copy();
100: char *malloc();
101: char *realloc();
102: char *basename();
103: char *getline();
104: struct symtab *slookup();
105: struct symtab *defined();
106: struct symtab *fdefined();
107: struct filepointer *getfile();
108: struct inclist *newinclude();
109: struct inclist *inc_path();
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.