xref: /openbsd/usr.bin/make/varmodifiers.h (revision bb4544df)
1 #ifndef VARMODIFIERS_H
2 #define VARMODIFIERS_H
3 
4 /* $OpenBSD: varmodifiers.h,v 1.12 2010/07/19 19:46:44 espie Exp $ */
5 
6 /*
7  * Copyright (c) 1999 Marc Espie.
8  *
9  * Extensive code changes for the OpenBSD project.
10  *
11  * Redistribution and use in source and binary forms, with or without
12  * modification, are permitted provided that the following conditions
13  * are met:
14  * 1. Redistributions of source code must retain the above copyright
15  *    notice, this list of conditions and the following disclaimer.
16  * 2. Redistributions in binary form must reproduce the above copyright
17  *    notice, this list of conditions and the following disclaimer in the
18  *    documentation and/or other materials provided with the distribution.
19  *
20  * THIS SOFTWARE IS PROVIDED BY THE OPENBSD PROJECT AND CONTRIBUTORS
21  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
23  * A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE OPENBSD
24  * PROJECT OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
25  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
26  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
27  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
28  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
30  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31  */
32 
33 /* VarModifiers_Init();
34  *	Set up varmodifiers internal table according to selected features.
35  *	This can be called several times without harm. */
36 extern void VarModifiers_Init(void);
37 
38 
39 /* result = VarModifiers_Apply(val, name, ctxt, undef_is_bad,
40  *   &should_free, &modstart, paren);
41  *	Applies variable modifiers starting at modstart (including :),
42  *	using parenthesis paren, to value val.
43  *	Variables in spec are taken from context ctxt.
44  *	If undef_is_bad, error occurs if undefined variables are mentioned.
45  *	modstart is advanced past the end of the spec.
46  *	name holds the name of the corresponding variable, as some ODE
47  *	modifiers need it.
48  *
49  *	If both val and name are NULL, VarModifiers_Apply just parses the
50  *	modifiers specification, as it can't apply it to anything. */
51 extern char *VarModifiers_Apply(char *, const struct Name *, SymTable *,
52 	bool, bool *, const char **, int);
53 
54 /* Direct interface to specific modifiers used under special circumstances. */
55 /* tails = Var_GetTail(string);
56  *	Returns the tail of list of words in string (needed for SysV locals). */
57 extern char *Var_GetTail(char *);
58 /* heads = Var_GetHead(string);
59  *	Returns the head of list of words in string. */
60 /* XXX this does not replace foo with ., as (sun) System V make does.
61  * Should it ? */
62 extern char *Var_GetHead(char *);
63 #endif
64