Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 1 | /* |
| 2 | macros.h - definitions for a simple macro expander |
Dave Barach | c379999 | 2016-08-15 11:12:27 -0400 | [diff] [blame] | 3 | |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 4 | Copyright (c) 2010, 2014 Cisco and/or its affiliates. |
Dave Barach | c379999 | 2016-08-15 11:12:27 -0400 | [diff] [blame] | 5 | |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 6 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 7 | * 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 Barach | c379999 | 2016-08-15 11:12:27 -0400 | [diff] [blame] | 31 | typedef struct |
| 32 | { |
| 33 | uword *the_builtin_eval_hash; |
| 34 | uword *the_value_table_hash; |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 35 | } macro_main_t; |
| 36 | |
| 37 | int clib_macro_unset (macro_main_t * mm, char *name); |
| 38 | int clib_macro_set_value (macro_main_t * mm, char *name, char *value); |
Dave Barach | c379999 | 2016-08-15 11:12:27 -0400 | [diff] [blame] | 39 | void clib_macro_add_builtin (macro_main_t * mm, char *name, void *eval_fn); |
| 40 | i8 *clib_macro_get_value (macro_main_t * mm, char *name); |
| 41 | i8 *clib_macro_eval (macro_main_t * mm, i8 * s, i32 complain); |
| 42 | i8 *clib_macro_eval_dollar (macro_main_t * mm, i8 * s, i32 complain); |
| 43 | void clib_macro_init (macro_main_t * mm); |
| 44 | void clib_macro_free (macro_main_t * mm); |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 45 | |
| 46 | #endif /* included_macros_h */ |
Dave Barach | c379999 | 2016-08-15 11:12:27 -0400 | [diff] [blame] | 47 | |
| 48 | /* |
| 49 | * fd.io coding-style-patch-verification: ON |
| 50 | * |
| 51 | * Local Variables: |
| 52 | * eval: (c-set-style "gnu") |
| 53 | * End: |
| 54 | */ |