1
0
mirror of https://gitlab.labs.nic.cz/labs/bird.git synced 2024-05-11 16:54:54 +00:00

Create syntax sugar for add/delete/prepend, so xyzzy.prepend(123) is

possible. That means that milestone 3 was reached.
This commit is contained in:
Pavel Machek
2000-04-20 10:25:51 +00:00
parent 77f37ae099
commit 7d6eebae3b
2 changed files with 30 additions and 0 deletions

View File

@@ -10,6 +10,8 @@
#include "conf/conf.h"
#include "filter/filter.h"
#define P(a,b) ((a<<8) | b)
struct f_inst *
f_new_inst(void)
{
@@ -29,6 +31,27 @@ f_new_dynamic_attr(int type, int f_type, int code)
return f;
}
/*
* Generate set_dynamic( operation( get_dynamic(), argument ) )
*/
struct f_inst *
f_generate_complex(int operation, int operation_aux, struct f_inst *dyn, struct f_inst *argument)
{
struct f_inst *set_dyn = f_new_inst(),
*oper = f_new_inst(),
*get_dyn = dyn;
*set_dyn = *get_dyn;
get_dyn->code = P('e','a');
oper->code = operation;
oper->aux = operation_aux;
oper->a1.p = get_dyn;
oper->a2.p = argument;
set_dyn->code = P('e','S');
set_dyn->a1.p = oper;
return set_dyn;
}
char *
filter_name(struct filter *filter)
{