mirror of
https://github.com/zeek/zeek.git
synced 2025-10-14 20:48:21 +00:00
bifcl: Move BIF function arguments from val_list to vector of IntrusivePtr
This commit is contained in:
parent
7009f1dda6
commit
163a86fc4e
2 changed files with 6 additions and 6 deletions
|
@ -61,7 +61,7 @@ void BuiltinFuncArg::PrintCDef(FILE* fp, int n)
|
||||||
builtin_func_arg_type[type].c_type);
|
builtin_func_arg_type[type].c_type);
|
||||||
|
|
||||||
char buf[1024];
|
char buf[1024];
|
||||||
snprintf(buf, sizeof(buf), "(*%s)[%d]", arg_list_name, n);
|
snprintf(buf, sizeof(buf), "(*%s)[%d].get()", arg_list_name, n);
|
||||||
// Print the accessor expression.
|
// Print the accessor expression.
|
||||||
fprintf(fp, builtin_func_arg_type[type].accessor, buf);
|
fprintf(fp, builtin_func_arg_type[type].accessor, buf);
|
||||||
|
|
||||||
|
|
|
@ -545,11 +545,11 @@ head_1: TOK_ID opt_ws arg_begin
|
||||||
decl.c_fullname.c_str(), decl.bro_fullname.c_str());
|
decl.c_fullname.c_str(), decl.bro_fullname.c_str());
|
||||||
|
|
||||||
fprintf(fp_func_h,
|
fprintf(fp_func_h,
|
||||||
"%sextern Val* %s(Frame* frame, val_list*);%s\n",
|
"%sextern Val* %s(Frame* frame, const zeek::Args*);%s\n",
|
||||||
decl.c_namespace_start.c_str(), decl.bare_name.c_str(), decl.c_namespace_end.c_str());
|
decl.c_namespace_start.c_str(), decl.bare_name.c_str(), decl.c_namespace_end.c_str());
|
||||||
|
|
||||||
fprintf(fp_func_def,
|
fprintf(fp_func_def,
|
||||||
"Val* %s(Frame* frame, val_list* %s)",
|
"Val* %s(Frame* frame, const zeek::Args* %s)",
|
||||||
decl.c_fullname.c_str(), arg_list_name);
|
decl.c_fullname.c_str(), arg_list_name);
|
||||||
|
|
||||||
record_bif_item(decl.bro_fullname.c_str(), "FUNCTION");
|
record_bif_item(decl.bro_fullname.c_str(), "FUNCTION");
|
||||||
|
@ -654,7 +654,7 @@ body_start: TOK_LPB c_code_begin
|
||||||
|
|
||||||
if ( ! var_arg )
|
if ( ! var_arg )
|
||||||
{
|
{
|
||||||
fprintf(fp_func_def, "\tif ( %s->length() != %d )\n", arg_list_name, argc);
|
fprintf(fp_func_def, "\tif ( %s->size() != %d )\n", arg_list_name, argc);
|
||||||
fprintf(fp_func_def, "\t\t{\n");
|
fprintf(fp_func_def, "\t\t{\n");
|
||||||
fprintf(fp_func_def,
|
fprintf(fp_func_def,
|
||||||
"\t\treporter->Error(\"%s() takes exactly %d argument(s)\");\n",
|
"\t\treporter->Error(\"%s() takes exactly %d argument(s)\");\n",
|
||||||
|
@ -664,7 +664,7 @@ body_start: TOK_LPB c_code_begin
|
||||||
}
|
}
|
||||||
else if ( argc > 0 )
|
else if ( argc > 0 )
|
||||||
{
|
{
|
||||||
fprintf(fp_func_def, "\tif ( %s->length() < %d )\n", arg_list_name, argc);
|
fprintf(fp_func_def, "\tif ( %s->size() < %d )\n", arg_list_name, argc);
|
||||||
fprintf(fp_func_def, "\t\t{\n");
|
fprintf(fp_func_def, "\t\t{\n");
|
||||||
fprintf(fp_func_def,
|
fprintf(fp_func_def,
|
||||||
"\t\treporter->Error(\"%s() takes at least %d argument(s)\");\n",
|
"\t\treporter->Error(\"%s() takes at least %d argument(s)\");\n",
|
||||||
|
@ -703,7 +703,7 @@ c_atom: TOK_ID
|
||||||
| TOK_ARGS
|
| TOK_ARGS
|
||||||
{ fprintf(fp_func_def, "%s", arg_list_name); }
|
{ fprintf(fp_func_def, "%s", arg_list_name); }
|
||||||
| TOK_ARGC
|
| TOK_ARGC
|
||||||
{ fprintf(fp_func_def, "%s->length()", arg_list_name); }
|
{ fprintf(fp_func_def, "%s->size()", arg_list_name); }
|
||||||
| TOK_CSTR
|
| TOK_CSTR
|
||||||
{ fprintf(fp_func_def, "%s", $1); }
|
{ fprintf(fp_func_def, "%s", $1); }
|
||||||
| TOK_ATOM
|
| TOK_ATOM
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue