added "jammod" command and "genman" module
[k8jam.git] / src / variable.h
blob6c053abfb864ce6f814455e15c443f872844d978
1 /*
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, either version 3 of the License, or
8 * (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this program. If not, see <http://www.gnu.org/licenses/>.
19 * variable.h - handle jam multi-element variables
21 #ifndef JAMH_VARIABLE_H
22 #define JAMH_VARIABLE_H
24 #include "dstrings.h"
28 * var_defines() - load a bunch of variable=value settings
30 * if variable name ends in PATH, split value at :'s, otherwise, split at blanks
32 extern void var_defines (const char **e, int dontignore);
35 * var_string() - expand a string with variables in it
37 * copies in to 'out'; doesn't modify targets & sources
38 * 'out' should be initialized
39 * returns length of added data or -1
41 extern int var_string (const char *in, dstring_t *out, LOL *lol, char separator);
44 * var_get() - get value of a user defined symbol
46 * returns NULL if symbol unset
48 extern LIST *var_get (const char *symbol);
51 * defines for var_set()
53 enum {
54 VAR_SET, /* override previous value */
55 VAR_APPEND, /* append to previous value */
56 VAR_REMOVE, /* find and remove all occurences of value */
57 VAR_DEFAULT /* set only if no previous value */
61 * var_set() - set a variable in jam's user defined symbol table
63 * 'flag' controls the relationship between new and old values of
64 * the variable: SET replaces the old with the new; APPEND appends
65 * the new to the old; DEFAULT only uses the new if the variable
66 * was previously unset and REMOVE removes all occurences of all
67 * items in 'value' list
69 * copies symbol, takes ownership of value
71 extern void var_set (const char *symbol, LIST *value, int flag);
74 * var_swap() - swap a variable's value with the given one
76 extern LIST *var_swap (const char *symbol, LIST *value);
79 * var_done() - free variable tables
81 extern void var_done (void);
84 #endif