~ubuntu-branches/ubuntu/utopic/gridengine/utopic

« back to all changes in this revision

Viewing changes to source/3rdparty/sge_depend/def.h

  • Committer: Bazaar Package Importer
  • Author(s): Mark Hymers
  • Date: 2008-06-25 22:36:13 UTC
  • Revision ID: james.westby@ubuntu.com-20080625223613-tvd9xlhuoct9kyhm
Tags: upstream-6.2~beta2
ImportĀ upstreamĀ versionĀ 6.2~beta2

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* $XConsortium: def.h /main/30 1996/12/04 10:11:12 swick $ */
 
2
/*
 
3
 
 
4
Copyright (c) 1993, 1994  X Consortium
 
5
 
 
6
Permission is hereby granted, free of charge, to any person obtaining a copy
 
7
of this software and associated documentation files (the "Software"), to deal
 
8
in the Software without restriction, including without limitation the rights
 
9
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 
10
copies of the Software, and to permit persons to whom the Software is
 
11
furnished to do so, subject to the following conditions:
 
12
 
 
13
The above copyright notice and this permission notice shall be included in
 
14
all copies or substantial portions of the Software.
 
15
 
 
16
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 
17
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 
18
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
 
19
X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
 
20
AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
 
21
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 
22
 
 
23
Except as contained in this notice, the name of the X Consortium shall not be
 
24
used in advertising or otherwise to promote the sale, use or other dealings
 
25
in this Software without prior written authorization from the X Consortium.
 
26
 
 
27
*/
 
28
 
 
29
#include <stdio.h>
 
30
#include <ctype.h>
 
31
#include <string.h>
 
32
#include <sys/types.h>
 
33
#include <sys/stat.h>
 
34
#include <unistd.h>
 
35
 
 
36
#ifndef X_NOT_POSIX
 
37
#ifndef _POSIX_SOURCE
 
38
#define _POSIX_SOURCE
 
39
#endif
 
40
#endif
 
41
#include <sys/types.h>
 
42
#include <fcntl.h>
 
43
#include <sys/stat.h>
 
44
 
 
45
#define MAXDEFINES      512
 
46
#define MAXFILES        1024
 
47
#define MAXDIRS         64
 
48
#define SYMTABINC       10   /* must be > 1 for define() to work right */
 
49
#define TRUE            1
 
50
#define FALSE           0
 
51
 
 
52
/* the following must match the directives table in main.c */
 
53
#define IF              0
 
54
#define IFDEF           1
 
55
#define IFNDEF          2
 
56
#define ELSE            3
 
57
#define ENDIF           4
 
58
#define DEFINE          5
 
59
#define UNDEF           6
 
60
#define INCLUDE         7
 
61
#define LINE            8
 
62
#define PRAGMA          9
 
63
#define ERROR           10
 
64
#define IDENT           11
 
65
#define SCCS            12
 
66
#define ELIF            13
 
67
#define EJECT           14
 
68
#define IFFALSE         15     /* pseudo value --- never matched */
 
69
#define ELIFFALSE       16     /* pseudo value --- never matched */
 
70
#define INCLUDEDOT      17     /* pseudo value --- never matched */
 
71
#define IFGUESSFALSE    18     /* pseudo value --- never matched */
 
72
#define ELIFGUESSFALSE  19     /* pseudo value --- never matched */
 
73
 
 
74
#ifdef DEBUG
 
75
extern int   _debugmask;
 
76
/*
 
77
 * debug levels are:
 
78
 * 
 
79
 *     0   show ifn*(def)*,endif
 
80
 *     1   trace defined/!defined
 
81
 *     2   show #include
 
82
 *     3   show #include SYMBOL
 
83
 *     4-6   unused
 
84
 */
 
85
#define debug(level,arg) { if (_debugmask & (1 << level)) warning arg; }
 
86
#else
 
87
#define   debug(level,arg) /**/
 
88
#endif /* DEBUG */
 
89
 
 
90
/* typedef   unsigned char boolean; */
 
91
typedef   int boolean;
 
92
struct symtab {
 
93
   char   *s_name;
 
94
   char   *s_value;
 
95
};
 
96
 
 
97
/* possible i_flag */
 
98
#define DEFCHECKED      (1<<0)   /* whether defines have been checked */
 
99
#define NOTIFIED        (1<<1)   /* whether we have revealed includes */
 
100
#define MARKED          (1<<2)   /* whether it's in the makefile */
 
101
#define SEARCHED        (1<<3)   /* whether we have read this */
 
102
#define FINISHED        (1<<4)   /* whether we are done reading this */
 
103
#define INCLUDED_SYM    (1<<5)   /* whether #include SYMBOL was found
 
104
                                    Can't use i_list if TRUE */
 
105
struct   inclist {
 
106
   char              *i_incstring;     /* string from #include line */
 
107
   char              *i_file;          /* path name of the include file */
 
108
   struct inclist    **i_list;         /* list of files it itself includes */
 
109
   int               i_listlen;        /* length of i_list */
 
110
   struct symtab     **i_defs;         /* symbol table for this file and its
 
111
                                          children when merged */
 
112
   int               i_ndefs;          /* current # defines */
 
113
   boolean           *i_merged;        /* whether we have merged child
 
114
                                          defines */
 
115
   unsigned char     i_flags;
 
116
};
 
117
 
 
118
struct filepointer {
 
119
   char   *f_p;
 
120
   char   *f_base;
 
121
   char   *f_end;
 
122
   long   f_len;
 
123
   long   f_line;
 
124
};
 
125
 
 
126
#ifndef X_NOT_STDC_ENV
 
127
#include <stdlib.h>
 
128
#if defined(macII) && !defined(__STDC__)  /* stdlib.h fails to define these */
 
129
char *malloc(), *realloc();
 
130
#endif /* macII */
 
131
#else
 
132
char         *malloc();
 
133
char         *realloc();
 
134
#endif
 
135
 
 
136
#if NeedFunctionPrototypes
 
137
char *copy( char *str);
 
138
char *base_name(char *file, int strip);
 
139
char *getline(struct filepointer *filep);
 
140
struct filepointer *getfile(char *file);
 
141
struct inclist *newinclude(char *newfile, char *incstring);
 
142
struct inclist *inc_path(char   *file, char *include, boolean   dot);
 
143
void included_by(struct inclist *ip, struct inclist *newfile);
 
144
void inc_clean(void);
 
145
void define2(char *name, char *val, struct inclist *file);
 
146
void define(char *def, struct inclist *file);
 
147
int find_includes(struct filepointer *filep, struct inclist *file, 
 
148
                  struct inclist *file_red, int recursion, boolean failOK);
 
149
void recursive_pr_include(struct inclist *head, char *file, char *base);
 
150
void freefile(struct filepointer *fp);
 
151
int cppsetup(char       *line, struct filepointer *filep, struct inclist *inc);
 
152
struct symtab **isdefined( char *symbol,
 
153
                           struct inclist *file,
 
154
                           struct inclist **srcfile);
 
155
#else
 
156
char *copy();
 
157
char *base_name();
 
158
char *getline();
 
159
struct filepointer *getfile();
 
160
struct inclist *newinclude();
 
161
struct inclist *inc_path();
 
162
void inc_clean();
 
163
void included_by();
 
164
void define2();
 
165
void define();
 
166
int find_includes();
 
167
void recursive_pr_include();
 
168
void freefile();
 
169
int cppsetup();
 
170
struct symtab **isdefined();
 
171
#endif
 
172
 
 
173
#if NeedVarargsPrototypes
 
174
extern void fatalerr(char *, ...);
 
175
extern void warning(char *, ...);
 
176
extern void warning1(char *, ...);
 
177
#else
 
178
void fatalerr();
 
179
void warning();
 
180
void warning1();
 
181
#endif
 
182
 
 
183
 
 
184
extern boolean local_include;