]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - contrib/bmake/nonints.h
Update to bmake-20200902
[FreeBSD/FreeBSD.git] / contrib / bmake / nonints.h
1 /*      $NetBSD: nonints.h,v 1.102 2020/08/30 19:56:02 rillig Exp $     */
2
3 /*-
4  * Copyright (c) 1988, 1989, 1990, 1993
5  *      The Regents of the University of California.  All rights reserved.
6  *
7  * This code is derived from software contributed to Berkeley by
8  * Adam de Boor.
9  *
10  * Redistribution and use in source and binary forms, with or without
11  * modification, are permitted provided that the following conditions
12  * are met:
13  * 1. Redistributions of source code must retain the above copyright
14  *    notice, this list of conditions and the following disclaimer.
15  * 2. Redistributions in binary form must reproduce the above copyright
16  *    notice, this list of conditions and the following disclaimer in the
17  *    documentation and/or other materials provided with the distribution.
18  * 3. Neither the name of the University nor the names of its contributors
19  *    may be used to endorse or promote products derived from this software
20  *    without specific prior written permission.
21  *
22  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
23  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
24  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
25  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
26  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
27  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
28  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
29  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
30  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
31  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
32  * SUCH DAMAGE.
33  *
34  *      from: @(#)nonints.h     8.3 (Berkeley) 3/19/94
35  */
36
37 /*-
38  * Copyright (c) 1989 by Berkeley Softworks
39  * All rights reserved.
40  *
41  * This code is derived from software contributed to Berkeley by
42  * Adam de Boor.
43  *
44  * Redistribution and use in source and binary forms, with or without
45  * modification, are permitted provided that the following conditions
46  * are met:
47  * 1. Redistributions of source code must retain the above copyright
48  *    notice, this list of conditions and the following disclaimer.
49  * 2. Redistributions in binary form must reproduce the above copyright
50  *    notice, this list of conditions and the following disclaimer in the
51  *    documentation and/or other materials provided with the distribution.
52  * 3. All advertising materials mentioning features or use of this software
53  *    must display the following acknowledgement:
54  *      This product includes software developed by the University of
55  *      California, Berkeley and its contributors.
56  * 4. Neither the name of the University nor the names of its contributors
57  *    may be used to endorse or promote products derived from this software
58  *    without specific prior written permission.
59  *
60  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
61  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
62  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
63  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
64  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
65  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
66  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
67  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
68  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
69  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
70  * SUCH DAMAGE.
71  *
72  *      from: @(#)nonints.h     8.3 (Berkeley) 3/19/94
73  */
74
75 /* arch.c */
76 Boolean Arch_ParseArchive(char **, Lst, GNode *);
77 void Arch_Touch(GNode *);
78 void Arch_TouchLib(GNode *);
79 time_t Arch_MTime(GNode *);
80 time_t Arch_MemMTime(GNode *);
81 void Arch_FindLib(GNode *, Lst);
82 Boolean Arch_LibOODate(GNode *);
83 void Arch_Init(void);
84 void Arch_End(void);
85 Boolean Arch_IsLib(GNode *);
86
87 /* compat.c */
88 int CompatRunCommand(void *, void *);
89 void Compat_Run(Lst);
90 int Compat_Make(void *, void *);
91
92 /* cond.c */
93 struct If;
94 CondEvalResult Cond_EvalExpression(const struct If *, char *, Boolean *, int, Boolean);
95 CondEvalResult Cond_Eval(char *);
96 void Cond_restore_depth(unsigned int);
97 unsigned int Cond_save_depth(void);
98
99 /* for.c */
100 int For_Eval(char *);
101 int For_Accum(char *);
102 void For_Run(int);
103
104 /* job.c */
105 #ifdef WAIT_T
106 void JobReapChild(pid_t, WAIT_T, Boolean);
107 #endif
108
109 /* main.c */
110 void Main_ParseArgLine(const char *);
111 void MakeMode(const char *);
112 char *Cmd_Exec(const char *, const char **);
113 void Error(const char *, ...) MAKE_ATTR_PRINTFLIKE(1, 2);
114 void Fatal(const char *, ...) MAKE_ATTR_PRINTFLIKE(1, 2) MAKE_ATTR_DEAD;
115 void Punt(const char *, ...) MAKE_ATTR_PRINTFLIKE(1, 2) MAKE_ATTR_DEAD;
116 void DieHorribly(void) MAKE_ATTR_DEAD;
117 int PrintAddr(void *, void *);
118 void Finish(int) MAKE_ATTR_DEAD;
119 int eunlink(const char *);
120 void execError(const char *, const char *);
121 char *getTmpdir(void);
122 Boolean s2Boolean(const char *, Boolean);
123 Boolean getBoolean(const char *, Boolean);
124 char *cached_realpath(const char *, char *);
125
126 /* parse.c */
127 void Parse_Error(int, const char *, ...) MAKE_ATTR_PRINTFLIKE(2, 3);
128 Boolean Parse_IsVar(char *);
129 void Parse_DoVar(char *, GNode *);
130 void Parse_AddIncludeDir(char *);
131 void Parse_File(const char *, int);
132 void Parse_Init(void);
133 void Parse_End(void);
134 void Parse_SetInput(const char *, int, int, char *(*)(void *, size_t *), void *);
135 Lst Parse_MainName(void);
136
137 /* str.c */
138 typedef struct {
139     char **words;
140     size_t len;
141     void *freeIt;
142 } Words;
143
144 Words Str_Words(const char *, Boolean);
145 static inline void MAKE_ATTR_UNUSED
146 Words_Free(Words w) {
147     free(w.words);
148     free(w.freeIt);
149 }
150
151 char *str_concat2(const char *, const char *);
152 char *str_concat3(const char *, const char *, const char *);
153 char *str_concat4(const char *, const char *, const char *, const char *);
154 char *Str_FindSubstring(const char *, const char *);
155 Boolean Str_Match(const char *, const char *);
156
157 #ifndef HAVE_STRLCPY
158 /* strlcpy.c */
159 size_t strlcpy(char *, const char *, size_t);
160 #endif
161
162 /* suff.c */
163 void Suff_ClearSuffixes(void);
164 Boolean Suff_IsTransform(char *);
165 GNode *Suff_AddTransform(char *);
166 int Suff_EndTransform(void *, void *);
167 void Suff_AddSuffix(const char *, GNode **);
168 Lst Suff_GetPath(char *);
169 void Suff_DoPaths(void);
170 void Suff_AddInclude(char *);
171 void Suff_AddLib(const char *);
172 void Suff_FindDeps(GNode *);
173 Lst Suff_FindPath(GNode *);
174 void Suff_SetNull(char *);
175 void Suff_Init(void);
176 void Suff_End(void);
177 void Suff_PrintAll(void);
178
179 /* targ.c */
180 void Targ_Init(void);
181 void Targ_End(void);
182 void Targ_Stats(void);
183 Lst Targ_List(void);
184 GNode *Targ_NewGN(const char *);
185 GNode *Targ_FindNode(const char *, int);
186 Lst Targ_FindList(Lst, int);
187 Boolean Targ_Ignore(GNode *);
188 Boolean Targ_Silent(GNode *);
189 Boolean Targ_Precious(GNode *);
190 void Targ_SetMain(GNode *);
191 int Targ_PrintCmd(void *, void *);
192 int Targ_PrintNode(void *, void *);
193 char *Targ_FmtTime(time_t);
194 void Targ_PrintType(int);
195 void Targ_PrintGraph(int);
196 void Targ_Propagate(void);
197
198 /* var.c */
199
200 typedef enum {
201     /* Treat undefined variables as errors. */
202     VARE_UNDEFERR       = 0x01,
203     /* Expand and evaluate variables during parsing. */
204     VARE_WANTRES        = 0x02,
205     VARE_ASSIGN         = 0x04
206 } VarEvalFlags;
207
208 typedef enum {
209     VAR_NO_EXPORT       = 0x01, /* do not export */
210     /* Make the variable read-only. No further modification is possible,
211      * except for another call to Var_Set with the same flag. */
212     VAR_SET_READONLY    = 0x02
213 } VarSet_Flags;
214
215
216 void Var_Delete(const char *, GNode *);
217 void Var_Set(const char *, const char *, GNode *);
218 void Var_Set_with_flags(const char *, const char *, GNode *, VarSet_Flags);
219 void Var_Append(const char *, const char *, GNode *);
220 Boolean Var_Exists(const char *, GNode *);
221 const char *Var_Value(const char *, GNode *, char **);
222 const char *Var_Parse(const char *, GNode *, VarEvalFlags, int *, void **);
223 char *Var_Subst(const char *, GNode *, VarEvalFlags);
224 void Var_Init(void);
225 void Var_End(void);
226 void Var_Stats(void);
227 void Var_Dump(GNode *);
228 void Var_ExportVars(void);
229 void Var_Export(const char *, Boolean);
230 void Var_UnExport(const char *);
231
232 /* util.c */
233 void (*bmake_signal(int, void (*)(int)))(int);