summaryrefslogtreecommitdiff
path: root/conf/cf-lex.l
diff options
context:
space:
mode:
authorMartin Mares <mj@ucw.cz>1999-05-17 20:06:19 +0000
committerMartin Mares <mj@ucw.cz>1999-05-17 20:06:19 +0000
commit4107df1d1b7454a16e6f45ea55aae13b01c9f566 (patch)
tree633f4f7a266cb62d0aea1a08d6f2d7538573e8cc /conf/cf-lex.l
parentb23c5e0ff4e9071b2568bf2f7d437bc13273d17d (diff)
Implemented two new symbol handling functions:
o cf_define_symbol() -- it assigns a meaning to a symbol, bailing out if it already has one. o cf_find_symbol() -- finds symbol by name and creates it if not found. Also modified filter/config.Y to make use of the first function.
Diffstat (limited to 'conf/cf-lex.l')
-rw-r--r--conf/cf-lex.l15
1 files changed, 15 insertions, 0 deletions
diff --git a/conf/cf-lex.l b/conf/cf-lex.l
index ca7bfae1..94c2b2ab 100644
--- a/conf/cf-lex.l
+++ b/conf/cf-lex.l
@@ -183,6 +183,12 @@ cf_find_sym(byte *c, unsigned int h0)
}
struct symbol *
+cf_find_symbol(byte *c)
+{
+ return cf_find_sym(c, cf_hash(c));
+}
+
+struct symbol *
cf_default_name(char *prefix, int *counter)
{
char buf[32];
@@ -199,6 +205,15 @@ cf_default_name(char *prefix, int *counter)
}
void
+cf_define_symbol(struct symbol *sym, int type, void *def)
+{
+ if (sym->class)
+ cf_error("Symbol already defined");
+ sym->class = type;
+ sym->def = def;
+}
+
+void
cf_lex_init(int flag)
{
if (allow_new_symbols = flag)