Commit graph

68 commits

Author SHA1 Message Date
Martin Mares
c9aae7f47f Lexer supports fallback symbol tables and uses them to recognize
symbols from global config when parsing CLI commands.

cf_lex_init_tables() is now called automatically inside the lexer.
1999-11-30 14:03:36 +00:00
Martin Mares
cbc3183007 SYM_STAT is gone. 1999-11-15 11:34:51 +00:00
Martin Mares
df8b85e33f Silly bug. 1999-11-04 13:53:47 +00:00
Martin Mares
c8f61a01ea Symbols are not scoped. 1999-11-04 13:51:52 +00:00
Martin Mares
bc2fb68098 Parse CLI commands. We use the same parser as for configuration files (because
we want to allow filter and similar complex constructs to be used in commands
and we should avoid code duplication), only with CLI_MARKER token prepended
before the whole input.

Defined macro CF_CLI(cmd, args, help) for defining CLI commands in .Y files.
The first argument specifies the command itself, the remaining two arguments
are copied to the help file (er, will be copied after the help file starts
to exist). This macro automatically creates a skeleton rule for the command,
you only need to append arguments as in:

	CF_CLI(STEAL MONEY, <$>, [[Steal <$> US dollars or equivalent in any other currency]]): NUM {
		cli_msg(0, "%d$ stolen", $3);
	} ;

Also don't forget to reset lexer state between inputs.
1999-10-31 17:47:47 +00:00
Pavel Machek
6542ece91a Function calling in filters works - somehow. Calling syntax is
currently very ugly, beware. Variables are not really local - that
needs to be fixed.
1999-07-01 09:11:21 +00:00
Martin Mares
4107df1d1b 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.
1999-05-17 20:06:19 +00:00
Pavel Machek
ba92164871 Update of filters towards new interface. 1999-03-29 20:21:28 +00:00
Martin Mares
4ba84ebc82 Slightly better generator of default protocol instance names. 1999-03-26 21:37:29 +00:00
Martin Mares
4e9498cbb1 config->router_id works again. 1999-02-13 18:42:00 +00:00
Martin Mares
31b3e1bbf5 Implemented new configuration/reconfiguration interface and defined protocol
state machines. Full explanation will follow soon.
1999-02-05 21:37:34 +00:00
Pavel Machek
72380a3447 Filters added. They are unable to do anything interesting for now
(with exception of printing integers to screen), but they exist.
1999-01-15 14:41:51 +00:00
Martin Mares
cc12cf05c7 cf_error() now accepts any format strings instead of just an error
message. Also added extra kludge to get rid of collisions of REJECT
symbols.
1998-12-06 23:10:28 +00:00
Martin Mares
b35d72ac66 Name cleanups as suggested by Pavel:
- cfg_strcpy() -> cfg_strdup()
- mempool -> linpool, mp_* -> lp_*  [to avoid confusion with memblock, mb_*]

Anyway, it might be better to stop ranting about names and do some *real* work.
1998-12-06 11:59:18 +00:00
Martin Mares
49e4a4d1fd Created new functions for allocating configuration data:
o  cfg_alloc(size) -- generic memory allocation
   o  cfg_allocu(size) -- unaligned memory allocation
   o  cfg_allocz(size) -- zeroed memory allocation
   o  cfg_strcpy(str) -- allocate a copy of a string

Also fixed a bug in lexing of string literals.
1998-11-29 21:59:37 +00:00
Martin Mares
0b62c3a7c7 Trivial 15-line bison excercise: Implemented expressions including
user-defined numeric symbols. Whenever possible, use `expr' instead
of `NUM' to get full express ion power :-)
1998-11-27 21:32:45 +00:00
Martin Mares
8450be97d6 Added generator of default names. 1998-11-27 21:07:02 +00:00
Martin Mares
fe7cec12e8 Replaced nest/confile.h by conf/conf.h, added a lot of new definitions. 1998-11-27 19:35:10 +00:00