return (*fp) (mm, complain);
}
-int
+__clib_export int
clib_macro_unset (clib_macro_main_t * mm, char *name)
{
hash_pair_t *p;
return 0;
}
-int
+__clib_export int
clib_macro_set_value (clib_macro_main_t * mm, char *name, char *value)
{
u8 *key_copy, *value_copy;
* eval: takes a string, returns a vector.
* looks up $foobar in the variable table.
*/
-i8 *
+__clib_export i8 *
clib_macro_eval (clib_macro_main_t * mm, i8 * s, i32 complain, u16 level,
u16 max_level)
{
/* add results to answer */
vec_append (rv, ts);
/* Remove NULL termination or the results are sad */
- _vec_len (rv) = vec_len (rv) - 1;
+ vec_set_len (rv, vec_len (rv) - 1);
vec_free (ts);
}
else
if (complain)
clib_warning ("Undefined Variable Reference: %s\n", varname);
vec_append (rv, format (0, "UNSET "));
- _vec_len (rv) = vec_len (rv) - 1;
-
+ vec_set_len (rv, vec_len (rv) - 1);
}
vec_free (varname);
}
* eval: takes a string, returns a vector.
* looks up $foobar in the variable table.
*/
-i8 *
-clib_macro_eval_dollar (clib_macro_main_t * mm, i8 * s, i32 complain)
+__clib_export i8 *
+clib_macro_eval_dollar (clib_macro_main_t *mm, i8 *s, i32 complain)
{
i8 *s2;
i8 *rv;
return (rv);
}
-void
+__clib_export void
clib_macro_add_builtin (clib_macro_main_t * mm, char *name, void *eval_fn)
{
hash_set_mem (mm->the_builtin_eval_hash, name, (uword) eval_fn);
}
#endif
-void
+__clib_export void
clib_macro_init (clib_macro_main_t * mm)
{
if (mm->the_builtin_eval_hash != 0)
#endif
}
-void
+__clib_export void
clib_macro_free (clib_macro_main_t * mm)
{
hash_pair_t *p;
hash_free (mm->the_builtin_eval_hash);
- /* *INDENT-OFF* */
hash_foreach_pair (p, mm->the_value_table_hash,
({
vec_add1 (strings_to_free, (u8 *) (p->key));
vec_add1 (strings_to_free, (u8 *) (p->value[0]));
}));
- /* *INDENT-ON* */
for (i = 0; i < vec_len (strings_to_free); i++)
vec_free (strings_to_free[i]);
}
-u8 *
+__clib_export u8 *
format_clib_macro_main (u8 * s, va_list * args)
{
clib_macro_main_t *mm = va_arg (*args, clib_macro_main_t *);
name_sort_t *nses = 0, *ns;
int i;
- /* *INDENT-OFF* */
hash_foreach_pair (p, mm->the_value_table_hash,
({
vec_add2 (nses, ns, 1);
ns->name = (u8 *)(p->key);
ns->value = (u8 *)(p->value[0]);
}));
- /* *INDENT-ON* */
if (vec_len (nses) == 0)
return s;