2 * Copyright 1993, 2000 Christopher Seiwald.
3 * This file is part of Jam - see jam.c for Copyright information.
5 * This program is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation, version 3 of the License ONLY.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with this program. If not, see <http://www.gnu.org/licenses/>.
18 * variable.h - handle jam multi-element variables
20 #ifndef JAMH_VARIABLE_H
21 #define JAMH_VARIABLE_H
27 * var_defines() - load a bunch of variable=value settings
29 * if variable name ends in PATH, split value at :'s, otherwise, split at blanks
31 extern void var_defines (const char **e
, int dontignore
);
34 * var_string() - expand a string with variables in it
36 * copies in to 'out'; doesn't modify targets & sources
37 * 'out' should be initialized
38 * returns length of added data or -1
40 extern int var_string (const char *in
, dstring_t
*out
, LOL
*lol
, char separator
);
43 * var_get() - get value of a user defined symbol
45 * returns NULL if symbol unset
47 extern LIST
*var_get (const char *symbol
);
50 * defines for var_set()
53 VAR_SET
, /* override previous value */
54 VAR_APPEND
, /* append to previous value */
55 VAR_REMOVE
, /* find and remove all occurences of value */
56 VAR_DEFAULT
/* set only if no previous value */
60 * var_set() - set a variable in jam's user defined symbol table
62 * 'flag' controls the relationship between new and old values of
63 * the variable: SET replaces the old with the new; APPEND appends
64 * the new to the old; DEFAULT only uses the new if the variable
65 * was previously unset and REMOVE removes all occurences of all
66 * items in 'value' list
68 * copies symbol, takes ownership of value
70 extern void var_set (const char *symbol
, LIST
*value
, int flag
);
73 * var_swap() - swap a variable's value with the given one
75 extern LIST
*var_swap (const char *symbol
, LIST
*value
);
78 * var_done() - free variable tables
80 extern void var_done (void);