Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
labs
BIRD Internet Routing Daemon
Commits
8450be97
Commit
8450be97
authored
Nov 27, 1998
by
Martin Mareš
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added generator of default names.
parent
906b0170
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
20 additions
and
0 deletions
+20
-0
conf/cf-lex.l
conf/cf-lex.l
+18
-0
conf/conf.h
conf/conf.h
+2
-0
No files found.
conf/cf-lex.l
View file @
8450be97
...
...
@@ -32,6 +32,7 @@ static struct keyword *kw_hash[KW_HASH_SIZE];
static struct symbol **sym_hash;
static int allow_new_symbols;
static int cf_lino;
static int default_counter;
static int cf_hash(byte *c);
static struct symbol *cf_find_sym(byte *c, unsigned int h0);
...
...
@@ -180,12 +181,29 @@ cf_find_sym(byte *c, unsigned int h0)
return s;
}
struct symbol *
cf_default_name(char *prefix)
{
char buf[32];
struct symbol *s;
do
{
sprintf(buf, "%s%d", prefix, default_counter++);
s = cf_find_sym(buf, cf_hash(buf));
if (!s) cf_error("Unable to generate default name");
}
while (s->class != SYM_VOID);
return s;
}
void
cf_lex_init(int flag)
{
if (allow_new_symbols = flag)
sym_hash = mp_allocz(cfg_mem, SYM_HASH_SIZE * sizeof(struct keyword *));
cf_lino = 1;
default_counter = 1;
}
void
...
...
conf/conf.h
View file @
8450be97
...
...
@@ -26,12 +26,14 @@ struct symbol {
};
#define SYM_VOID 0
#define SYM_PROTO 1
void
cf_lex_init_tables
(
void
);
int
cf_lex
(
void
);
void
cf_lex_init
(
int
flag
);
void
cf_error
(
char
*
msg
)
NORET
;
void
cf_allocate
(
void
);
struct
symbol
*
cf_default_name
(
char
*
prefix
);
/* Parser */
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment