1 /* API for GNU Make dynamic objects.
2 Copyright (C) 2013 Free Software Foundation, Inc.
3 This file is part of GNU Make.
5 GNU Make is free software; you can redistribute it and/or modify it under the
6 terms of the GNU General Public License as published by the Free Software
7 Foundation; either version 3 of the License, or (at your option) any later
10 GNU Make is distributed in the hope that it will be useful, but WITHOUT ANY
11 WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
12 A PARTICULAR PURPOSE. See the GNU General Public License for more details.
14 You should have received a copy of the GNU General Public License along with
15 this program. If not, see <http://www.gnu.org/licenses/>. */
23 /* Allocate a buffer in our context, so we can free it. */
25 gmk_alloc (unsigned int len)
30 /* Free a buffer returned by gmk_expand(). */
37 /* Evaluate a buffer as make syntax.
38 Ideally eval_buffer() will take const char *, but not yet. */
40 gmk_eval (const char *buffer, const gmk_floc *floc)
42 char *s = xstrdup (buffer);
43 eval_buffer (s, floc);
47 /* Expand a string and return an allocated buffer.
48 Caller must call gmk_free() with this buffer. */
50 gmk_expand (const char *ref)
52 return allocated_variable_expand (ref);
55 /* Register a function to be called from makefiles. */
57 gmk_add_function (const char *name, gmk_func_ptr func,
58 unsigned int min, unsigned int max, unsigned int flags)
60 define_new_function (reading_file, name, min, max, flags, func);