1/* $NetBSD: nonints.h,v 1.72 2016/02/18 20:25:08 sjg 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 */
76ReturnStatus Arch_ParseArchive(char **, Lst, GNode *);
77void Arch_Touch(GNode *);
78void Arch_TouchLib(GNode *);
79time_t Arch_MTime(GNode *);
80time_t Arch_MemMTime(GNode *);
81void Arch_FindLib(GNode *, Lst);
82Boolean Arch_LibOODate(GNode *);
83void Arch_Init(void);
84void Arch_End(void);
85int Arch_IsLib(GNode *);
86
87/* compat.c */
88int CompatRunCommand(void *, void *);
89void Compat_Run(Lst);
90int Compat_Make(void *, void *);
91
92/* cond.c */
93struct If;
94int Cond_EvalExpression(const struct If *, char *, Boolean *, int, Boolean);
95int Cond_Eval(char *);
96void Cond_restore_depth(unsigned int);
97unsigned int Cond_save_depth(void);
98
99/* for.c */
100int For_Eval(char *);
101int For_Accum(char *);
102void For_Run(int);
103
104/* job.c */
105#ifdef WAIT_T
106void JobReapChild(pid_t, WAIT_T, Boolean);
107#endif
108
109/* main.c */
110void Main_ParseArgLine(const char *);
111void MakeMode(const char *);
112int main(int, char **);
113char *Cmd_Exec(const char *, const char **);
114void Error(const char *, ...) MAKE_ATTR_PRINTFLIKE(1, 2);
115void Fatal(const char *, ...) MAKE_ATTR_PRINTFLIKE(1, 2) MAKE_ATTR_DEAD;
116void Punt(const char *, ...) MAKE_ATTR_PRINTFLIKE(1, 2) MAKE_ATTR_DEAD;
117void DieHorribly(void) MAKE_ATTR_DEAD;
118int PrintAddr(void *, void *);
119void Finish(int) MAKE_ATTR_DEAD;
120int eunlink(const char *);
121void execError(const char *, const char *);
122char *getTmpdir(void);
123Boolean s2Boolean(const char *, Boolean);
124Boolean getBoolean(const char *, Boolean);
125
126/* parse.c */
127void Parse_Error(int, const char *, ...) MAKE_ATTR_PRINTFLIKE(2, 3);
128Boolean Parse_AnyExport(void);
129Boolean Parse_IsVar(char *);
130void Parse_DoVar(char *, GNode *);
131void Parse_AddIncludeDir(char *);
132void Parse_File(const char *, int);
133void Parse_Init(void);
134void Parse_End(void);
135void Parse_SetInput(const char *, int, int, char *(*)(void *, size_t *), void *);
136Lst Parse_MainName(void);
137
138/* str.c */
139char *str_concat(const char *, const char *, int);
140char **brk_string(const char *, int *, Boolean, char **);
141char *Str_FindSubstring(const char *, const char *);
142int Str_Match(const char *, const char *);
143char *Str_SYSVMatch(const char *, const char *, int *len);
144void Str_SYSVSubst(Buffer *, char *, char *, int);
145
146/* suff.c */
147void Suff_ClearSuffixes(void);
148Boolean Suff_IsTransform(char *);
149GNode *Suff_AddTransform(char *);
150int Suff_EndTransform(void *, void *);
151void Suff_AddSuffix(char *, GNode **);
152Lst Suff_GetPath(char *);
153void Suff_DoPaths(void);
154void Suff_AddInclude(char *);
155void Suff_AddLib(char *);
156void Suff_FindDeps(GNode *);
157Lst Suff_FindPath(GNode *);
158void Suff_SetNull(char *);
159void Suff_Init(void);
160void Suff_End(void);
161void Suff_PrintAll(void);
162
163/* targ.c */
164void Targ_Init(void);
165void Targ_End(void);
166Lst Targ_List(void);
167GNode *Targ_NewGN(const char *);
168GNode *Targ_FindNode(const char *, int);
169Lst Targ_FindList(Lst, int);
170Boolean Targ_Ignore(GNode *);
171Boolean Targ_Silent(GNode *);
172Boolean Targ_Precious(GNode *);
173void Targ_SetMain(GNode *);
174int Targ_PrintCmd(void *, void *);
175int Targ_PrintNode(void *, void *);
176char *Targ_FmtTime(time_t);
177void Targ_PrintType(int);
178void Targ_PrintGraph(int);
179void Targ_Propagate(void);
180void Targ_Propagate_Wait(void);
181
182/* var.c */
183void Var_Delete(const char *, GNode *);
184void Var_Set(const char *, const char *, GNode *, int);
185void Var_Append(const char *, const char *, GNode *);
186Boolean Var_Exists(const char *, GNode *);
187char *Var_Value(const char *, GNode *, char **);
188char *Var_Parse(const char *, GNode *, int, int *, void **);
189char *Var_Subst(const char *, const char *, GNode *, int);
190char *Var_GetTail(const char *);
191char *Var_GetHead(const char *);
192void Var_Init(void);
193void Var_End(void);
194void Var_Dump(GNode *);
195void Var_ExportVars(void);
196void Var_Export(char *, int);
197void Var_UnExport(char *);
198
199/* util.c */
200void (*bmake_signal(int, void (*)(int)))(int);
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 */
76ReturnStatus Arch_ParseArchive(char **, Lst, GNode *);
77void Arch_Touch(GNode *);
78void Arch_TouchLib(GNode *);
79time_t Arch_MTime(GNode *);
80time_t Arch_MemMTime(GNode *);
81void Arch_FindLib(GNode *, Lst);
82Boolean Arch_LibOODate(GNode *);
83void Arch_Init(void);
84void Arch_End(void);
85int Arch_IsLib(GNode *);
86
87/* compat.c */
88int CompatRunCommand(void *, void *);
89void Compat_Run(Lst);
90int Compat_Make(void *, void *);
91
92/* cond.c */
93struct If;
94int Cond_EvalExpression(const struct If *, char *, Boolean *, int, Boolean);
95int Cond_Eval(char *);
96void Cond_restore_depth(unsigned int);
97unsigned int Cond_save_depth(void);
98
99/* for.c */
100int For_Eval(char *);
101int For_Accum(char *);
102void For_Run(int);
103
104/* job.c */
105#ifdef WAIT_T
106void JobReapChild(pid_t, WAIT_T, Boolean);
107#endif
108
109/* main.c */
110void Main_ParseArgLine(const char *);
111void MakeMode(const char *);
112int main(int, char **);
113char *Cmd_Exec(const char *, const char **);
114void Error(const char *, ...) MAKE_ATTR_PRINTFLIKE(1, 2);
115void Fatal(const char *, ...) MAKE_ATTR_PRINTFLIKE(1, 2) MAKE_ATTR_DEAD;
116void Punt(const char *, ...) MAKE_ATTR_PRINTFLIKE(1, 2) MAKE_ATTR_DEAD;
117void DieHorribly(void) MAKE_ATTR_DEAD;
118int PrintAddr(void *, void *);
119void Finish(int) MAKE_ATTR_DEAD;
120int eunlink(const char *);
121void execError(const char *, const char *);
122char *getTmpdir(void);
123Boolean s2Boolean(const char *, Boolean);
124Boolean getBoolean(const char *, Boolean);
125
126/* parse.c */
127void Parse_Error(int, const char *, ...) MAKE_ATTR_PRINTFLIKE(2, 3);
128Boolean Parse_AnyExport(void);
129Boolean Parse_IsVar(char *);
130void Parse_DoVar(char *, GNode *);
131void Parse_AddIncludeDir(char *);
132void Parse_File(const char *, int);
133void Parse_Init(void);
134void Parse_End(void);
135void Parse_SetInput(const char *, int, int, char *(*)(void *, size_t *), void *);
136Lst Parse_MainName(void);
137
138/* str.c */
139char *str_concat(const char *, const char *, int);
140char **brk_string(const char *, int *, Boolean, char **);
141char *Str_FindSubstring(const char *, const char *);
142int Str_Match(const char *, const char *);
143char *Str_SYSVMatch(const char *, const char *, int *len);
144void Str_SYSVSubst(Buffer *, char *, char *, int);
145
146/* suff.c */
147void Suff_ClearSuffixes(void);
148Boolean Suff_IsTransform(char *);
149GNode *Suff_AddTransform(char *);
150int Suff_EndTransform(void *, void *);
151void Suff_AddSuffix(char *, GNode **);
152Lst Suff_GetPath(char *);
153void Suff_DoPaths(void);
154void Suff_AddInclude(char *);
155void Suff_AddLib(char *);
156void Suff_FindDeps(GNode *);
157Lst Suff_FindPath(GNode *);
158void Suff_SetNull(char *);
159void Suff_Init(void);
160void Suff_End(void);
161void Suff_PrintAll(void);
162
163/* targ.c */
164void Targ_Init(void);
165void Targ_End(void);
166Lst Targ_List(void);
167GNode *Targ_NewGN(const char *);
168GNode *Targ_FindNode(const char *, int);
169Lst Targ_FindList(Lst, int);
170Boolean Targ_Ignore(GNode *);
171Boolean Targ_Silent(GNode *);
172Boolean Targ_Precious(GNode *);
173void Targ_SetMain(GNode *);
174int Targ_PrintCmd(void *, void *);
175int Targ_PrintNode(void *, void *);
176char *Targ_FmtTime(time_t);
177void Targ_PrintType(int);
178void Targ_PrintGraph(int);
179void Targ_Propagate(void);
180void Targ_Propagate_Wait(void);
181
182/* var.c */
183void Var_Delete(const char *, GNode *);
184void Var_Set(const char *, const char *, GNode *, int);
185void Var_Append(const char *, const char *, GNode *);
186Boolean Var_Exists(const char *, GNode *);
187char *Var_Value(const char *, GNode *, char **);
188char *Var_Parse(const char *, GNode *, int, int *, void **);
189char *Var_Subst(const char *, const char *, GNode *, int);
190char *Var_GetTail(const char *);
191char *Var_GetHead(const char *);
192void Var_Init(void);
193void Var_End(void);
194void Var_Dump(GNode *);
195void Var_ExportVars(void);
196void Var_Export(char *, int);
197void Var_UnExport(char *);
198
199/* util.c */
200void (*bmake_signal(int, void (*)(int)))(int);