xref: /openbsd-src/usr.bin/make/varmodifiers.h (revision bb4544df9ace63bacb4f113c781faab96bfc1dec)
1f7923656Sespie #ifndef VARMODIFIERS_H
2f7923656Sespie #define VARMODIFIERS_H
3f7923656Sespie 
4*bb4544dfSespie /* $OpenBSD: varmodifiers.h,v 1.12 2010/07/19 19:46:44 espie Exp $ */
56b5ae482Sespie 
66b5ae482Sespie /*
76b5ae482Sespie  * Copyright (c) 1999 Marc Espie.
86b5ae482Sespie  *
96b5ae482Sespie  * Extensive code changes for the OpenBSD project.
106b5ae482Sespie  *
116b5ae482Sespie  * Redistribution and use in source and binary forms, with or without
126b5ae482Sespie  * modification, are permitted provided that the following conditions
136b5ae482Sespie  * are met:
146b5ae482Sespie  * 1. Redistributions of source code must retain the above copyright
156b5ae482Sespie  *    notice, this list of conditions and the following disclaimer.
166b5ae482Sespie  * 2. Redistributions in binary form must reproduce the above copyright
176b5ae482Sespie  *    notice, this list of conditions and the following disclaimer in the
186b5ae482Sespie  *    documentation and/or other materials provided with the distribution.
196b5ae482Sespie  *
206b5ae482Sespie  * THIS SOFTWARE IS PROVIDED BY THE OPENBSD PROJECT AND CONTRIBUTORS
216b5ae482Sespie  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
226b5ae482Sespie  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
236b5ae482Sespie  * A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE OPENBSD
246b5ae482Sespie  * PROJECT OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
256b5ae482Sespie  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
266b5ae482Sespie  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
276b5ae482Sespie  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
286b5ae482Sespie  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
296b5ae482Sespie  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
306b5ae482Sespie  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
316b5ae482Sespie  */
32f7923656Sespie 
33f7923656Sespie /* VarModifiers_Init();
34f7923656Sespie  *	Set up varmodifiers internal table according to selected features.
35f7923656Sespie  *	This can be called several times without harm. */
3604ed836eSespie extern void VarModifiers_Init(void);
37f7923656Sespie 
38f7923656Sespie 
39f7923656Sespie /* result = VarModifiers_Apply(val, name, ctxt, undef_is_bad,
400f4e4af8Sespie  *   &should_free, &modstart, paren);
41f7923656Sespie  *	Applies variable modifiers starting at modstart (including :),
4268636f61Sespie  *	using parenthesis paren, to value val.
43f7923656Sespie  *	Variables in spec are taken from context ctxt.
44f7923656Sespie  *	If undef_is_bad, error occurs if undefined variables are mentioned.
450f4e4af8Sespie  *	modstart is advanced past the end of the spec.
46f7923656Sespie  *	name holds the name of the corresponding variable, as some ODE
47f7923656Sespie  *	modifiers need it.
48f7923656Sespie  *
49f7923656Sespie  *	If both val and name are NULL, VarModifiers_Apply just parses the
50f7923656Sespie  *	modifiers specification, as it can't apply it to anything. */
51f7923656Sespie extern char *VarModifiers_Apply(char *, const struct Name *, SymTable *,
520f4e4af8Sespie 	bool, bool *, const char **, int);
53f7923656Sespie 
54f7923656Sespie /* Direct interface to specific modifiers used under special circumstances. */
55f7923656Sespie /* tails = Var_GetTail(string);
56f7923656Sespie  *	Returns the tail of list of words in string (needed for SysV locals). */
57f7923656Sespie extern char *Var_GetTail(char *);
58f7923656Sespie /* heads = Var_GetHead(string);
59f7923656Sespie  *	Returns the head of list of words in string. */
60f7923656Sespie /* XXX this does not replace foo with ., as (sun) System V make does.
61f7923656Sespie  * Should it ? */
62f7923656Sespie extern char *Var_GetHead(char *);
636b5ae482Sespie #endif
64