blob: 54ceda7016b19436d613c8e7d38fbfeeef24091c [file] [log] [blame]
Ed Warnickecb9cada2015-12-08 15:45:58 -07001/*
Dave Barach961e3c82020-06-18 17:04:18 -04002 * macros.h - definitions for a simple macro expander
3 *
4 * Copyright (c) 2010-2020 Cisco and/or its affiliates.
5 *
6 * Licensed under the Apache License, Version 2.0 (the "License");
Ed Warnickecb9cada2015-12-08 15:45:58 -07007 * you may not use this file except in compliance with the License.
8 * You may obtain a copy of the License at:
9 *
10 * http://www.apache.org/licenses/LICENSE-2.0
11 *
12 * Unless required by applicable law or agreed to in writing, software
13 * distributed under the License is distributed on an "AS IS" BASIS,
14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 * See the License for the specific language governing permissions and
16 * limitations under the License.
17*/
18
19#ifndef included_macros_h
20#define included_macros_h
21
22#include <vppinfra/vec.h>
23#include <vppinfra/hash.h>
24#include <vppinfra/format.h>
25
26#ifdef CLIB_UNIX
27#include <stdlib.h>
28#include <unistd.h>
29#endif
30
Dave Barachc3799992016-08-15 11:12:27 -040031typedef struct
32{
33 uword *the_builtin_eval_hash;
34 uword *the_value_table_hash;
Dave Barach961e3c82020-06-18 17:04:18 -040035} clib_macro_main_t;
Ed Warnickecb9cada2015-12-08 15:45:58 -070036
Dave Barach961e3c82020-06-18 17:04:18 -040037int clib_macro_unset (clib_macro_main_t * mm, char *name);
38int clib_macro_set_value (clib_macro_main_t * mm, char *name, char *value);
39void clib_macro_add_builtin (clib_macro_main_t * mm, char *name,
40 void *eval_fn);
41i8 *clib_macro_get_value (clib_macro_main_t * mm, char *name);
42i8 *clib_macro_eval (clib_macro_main_t * mm, i8 * s, i32 complain);
43i8 *clib_macro_eval_dollar (clib_macro_main_t * mm, i8 * s, i32 complain);
44void clib_macro_init (clib_macro_main_t * mm);
45void clib_macro_free (clib_macro_main_t * mm);
46
47format_function_t format_clib_macro_main;
Ed Warnickecb9cada2015-12-08 15:45:58 -070048
49#endif /* included_macros_h */
Dave Barachc3799992016-08-15 11:12:27 -040050
51/*
52 * fd.io coding-style-patch-verification: ON
53 *
54 * Local Variables:
55 * eval: (c-set-style "gnu")
56 * End:
57 */