CF_ADDTO(conf, function_def)
function_def:
FUNCTION SYM { DBG( "Begining of function %s\n", $2->name ); cf_push_scope($2); } function_params function_body {
- extern struct f_inst *startup_func;
+ extern struct f_inst *startup_func, *test1_func, *test2_func;
cf_define_symbol($2, SYM_FUNCTION, $5);
if (!strcasecmp($2->name, "__startup"))
startup_func = $5;
+ if (!strcasecmp($2->name, "__test1"))
+ test1_func = $5;
+ if (!strcasecmp($2->name, "__test2"))
+ test2_func = $5;
$2->aux = (int) $4;
$2->aux2 = $5;
DBG("Hmm, we've got one function here - %s\n", $2->name);
*
* Can be freely distributed and used under the terms of the GNU GPL.
*
- * Notice that pair is stored as integer: first << 16 | second
- *
*/
#define LOCAL_DEBUG
#define P(a,b) ((a<<8) | b)
-struct f_inst *startup_func = NULL;
+struct f_inst *startup_func = NULL, *test1_func, *test2_func;
#define CMP_ERROR 999
filters_postconfig(void)
{
struct f_val res;
+
+ if (!i_same(test1_func, test2_func))
+ bug("i_same does not work");
if (startup_func) {
debug( "Launching startup function...\n" );
f_pool = lp_new(&root_pool, 1024);
/* User visible types, which fit in int */
#define T_INT 0x10
#define T_BOOL 0x11
-#define T_PAIR 0x12
+#define T_PAIR 0x12 /* Notice that pair is stored as integer: first << 16 | second */
/* Put enumerational types in 0x30..0x3f range */
#define T_ENUM_LO 0x30
# print "*** FAIL: this is unreachable";
}
+function __test1()
+{
+ if source = RTS_STATIC then {
+ bgp_community = -empty-;
+ bgp_community.add((65000,5678));
+ if bgp_path ~ / 65000 / then
+ bgp_path.prepend(65000);
+ accept;
+ }
+ reject;
+}
+
+function __test2()
+{
+ if source = RTS_STATIC then {
+ bgp_community = -empty-;
+ bgp_community.add((65000,5678));
+ if bgp_path ~ / 65000 / then
+ bgp_path.prepend(65000);
+ accept;
+ }
+ reject;
+}
+
filter testf
int j;
{