VirtualBox

source: kBuild/vendor/gnumake/current/loadapi.c@ 3208

最後變更 在這個檔案從3208是 3138,由 bird 提交於 7 年 前

Imported make 4.2.1 (2e55f5e4abdc0e38c1d64be703b446695e70b3b6) from https://git.savannah.gnu.org/git/make.git.

  • 屬性 svn:eol-style 設為 native
檔案大小: 2.0 KB
 
1/* API for GNU Make dynamic objects.
2Copyright (C) 2013-2016 Free Software Foundation, Inc.
3This file is part of GNU Make.
4
5GNU Make is free software; you can redistribute it and/or modify it under the
6terms of the GNU General Public License as published by the Free Software
7Foundation; either version 3 of the License, or (at your option) any later
8version.
9
10GNU Make is distributed in the hope that it will be useful, but WITHOUT ANY
11WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
12A PARTICULAR PURPOSE. See the GNU General Public License for more details.
13
14You should have received a copy of the GNU General Public License along with
15this program. If not, see <http://www.gnu.org/licenses/>. */
16
17#include "makeint.h"
18
19#include "filedef.h"
20#include "variable.h"
21#include "dep.h"
22
23/* Allocate a buffer in our context, so we can free it. */
24char *
25gmk_alloc (unsigned int len)
26{
27 return xmalloc (len);
28}
29
30/* Free a buffer returned by gmk_expand(). */
31void
32gmk_free (char *s)
33{
34 free (s);
35}
36
37/* Evaluate a buffer as make syntax.
38 Ideally eval_buffer() will take const char *, but not yet. */
39void
40gmk_eval (const char *buffer, const gmk_floc *gfloc)
41{
42 /* Preserve existing variable buffer context. */
43 char *pbuf;
44 unsigned int plen;
45 char *s;
46 floc fl;
47 floc *flp;
48
49 if (gfloc)
50 {
51 fl.filenm = gfloc->filenm;
52 fl.lineno = gfloc->lineno;
53 fl.offset = 0;
54 flp = &fl;
55 }
56 else
57 flp = NULL;
58
59 install_variable_buffer (&pbuf, &plen);
60
61 s = xstrdup (buffer);
62 eval_buffer (s, flp);
63 free (s);
64
65 restore_variable_buffer (pbuf, plen);
66}
67
68/* Expand a string and return an allocated buffer.
69 Caller must call gmk_free() with this buffer. */
70char *
71gmk_expand (const char *ref)
72{
73 return allocated_variable_expand (ref);
74}
75
76/* Register a function to be called from makefiles. */
77void
78gmk_add_function (const char *name, gmk_func_ptr func,
79 unsigned int min, unsigned int max, unsigned int flags)
80{
81 define_new_function (reading_file, name, min, max, flags, func);
82}
注意: 瀏覽 TracBrowser 來幫助您使用儲存庫瀏覽器

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette