1106106Sjmallett/*-
2106106Sjmallett * Copyright (c) 2002 Juli Mallett.
3106106Sjmallett * Copyright (c) 1988, 1989, 1990, 1993
4106106Sjmallett *	The Regents of the University of California.  All rights reserved.
5106106Sjmallett * Copyright (c) 1989 by Berkeley Softworks
6106106Sjmallett * All rights reserved.
7106106Sjmallett *
8106106Sjmallett * This code is derived from software contributed to Berkeley by
9106106Sjmallett * Adam de Boor.
10106106Sjmallett *
11106106Sjmallett * Redistribution and use in source and binary forms, with or without
12106106Sjmallett * modification, are permitted provided that the following conditions
13106106Sjmallett * are met:
14106106Sjmallett * 1. Redistributions of source code must retain the above copyright
15106106Sjmallett *    notice, this list of conditions and the following disclaimer.
16106106Sjmallett * 2. Redistributions in binary form must reproduce the above copyright
17106106Sjmallett *    notice, this list of conditions and the following disclaimer in the
18106106Sjmallett *    documentation and/or other materials provided with the distribution.
19106106Sjmallett * 3. All advertising materials mentioning features or use of this software
20106106Sjmallett *    must display the following acknowledgement:
21106106Sjmallett *	This product includes software developed by the University of
22106106Sjmallett *	California, Berkeley and its contributors.
23106106Sjmallett * 4. Neither the name of the University nor the names of its contributors
24106106Sjmallett *    may be used to endorse or promote products derived from this software
25106106Sjmallett *    without specific prior written permission.
26106106Sjmallett *
27106106Sjmallett * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
28106106Sjmallett * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
29106106Sjmallett * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
30106106Sjmallett * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
31106106Sjmallett * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
32106106Sjmallett * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
33106106Sjmallett * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
34106106Sjmallett * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
35106106Sjmallett * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
36106106Sjmallett * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
37106106Sjmallett * SUCH DAMAGE.
38106106Sjmallett *
39106106Sjmallett * $FreeBSD$
40106106Sjmallett */
41106106Sjmallett
42141104Sharti#ifndef var_h_9cccafce
43141104Sharti#define	var_h_9cccafce
44141104Sharti
45146141Shartistruct Buffer;
46141104Shartistruct GNode;
47146141Shartistruct List;
48141104Sharti
49146047Sharti/* Variables defined in a global context, e.g in the Makefile itself */
50146047Shartiextern struct GNode	*VAR_GLOBAL;
51146047Sharti
52146047Sharti/* Variables defined on the command line */
53146047Shartiextern struct GNode	*VAR_CMD;
54146047Sharti
55146062Sharti/*
56146062Sharti * Value returned by Var_Parse when an error is encountered.  It actually
57146062Sharti * points to an empty string, so naive callers needn't worry about it.
58146062Sharti */
59146062Shartiextern char		var_Error[];
60146062Sharti
61146134Sharti/*
62146134Sharti * TRUE if environment should be searched for all variables before
63146134Sharti * the global context
64146134Sharti */
65146134Shartiextern Boolean		checkEnvFirst;
66146134Sharti
67146062Sharti/* Do old-style variable substitution */
68146062Shartiextern Boolean		oldVars;
69146062Sharti
70143963Shartivoid Var_Append(const char *, const char *, struct GNode *);
71143963Shartivoid Var_Delete(const char *, struct GNode *);
72146039Shartivoid Var_Dump(void);
73143963ShartiBoolean Var_Exists(const char *, struct GNode *);
74145971Shartivoid Var_Init(char **);
75146038Shartisize_t Var_Match(const char [], struct GNode *);
76143963Shartichar *Var_Parse(const char *, struct GNode *, Boolean, size_t *, Boolean *);
77146141Shartivoid Var_Print(struct Lst *, Boolean);
78143963Shartivoid Var_Set(const char *, const char *, struct GNode *);
79146145Shartivoid Var_SetGlobal(const char *, const char *);
80145971Shartivoid Var_SetEnv(const char *, struct GNode *);
81146027Shartistruct Buffer *Var_Subst(const char *, struct GNode *, Boolean);
82146048Shartistruct Buffer *Var_SubstOnly(const char *, const char *, Boolean);
83146581Sharticonst char *Var_Value(const char [], struct GNode *);
84106106Sjmallett
85141104Sharti#endif /* var_h_9cccafce */
86