38 regex_t *re = g_malloc0 (
sizeof (regex_t));
46 e = regcomp (re, re_str, REG_EXTENDED | REG_NOSUB | REG_ICASE);
52 regerror (e, re, errbuf,
sizeof (errbuf));
53 nasl_perror (NULL,
"Line %d: Cannot compile regex: %s (error %d: %s)\n",
54 lnb, re_str, e, errbuf);
102 for (i = 0; i < 4; i++)
115 for (i = 0; i < 4; i++)
116 if (c->
link[i] != NULL)
124#ifdef SCRATCH_FREED_MEMORY
160#ifdef SCRATCH_FREED_MEMORY
161 memset (c, 0xFF,
sizeof (*c));
174 nasl_perror (NULL,
"ref_cell: ref count is negative!\n");
192 "NODE_EMPTY",
"NODE_IF_ELSE",
"NODE_INSTR_L",
"NODE_FOR",
193 "NODE_WHILE",
"NODE_FOREACH",
"NODE_REPEAT_UNTIL",
"NODE_REPEATED",
194 "NODE_FUN_DEF",
"NODE_FUN_CALL",
"NODE_DECL",
"NODE_ARG",
195 "NODE_RETURN",
"NODE_BREAK",
"NODE_CONTINUE",
197 "NODE_ARRAY_EL",
"NODE_AFF",
"NODE_VAR",
"NODE_LOCAL",
198 "NODE_GLOBAL",
"NODE_PLUS_EQ",
"NODE_MINUS_EQ",
"NODE_MULT_EQ",
199 "NODE_DIV_EQ",
"NODE_MODULO_EQ",
201 "NODE_L_SHIFT_EQ",
"NODE_R_SHIFT_EQ",
"NODE_R_USHIFT_EQ",
"EXPR_AND",
202 "EXPR_OR",
"EXPR_NOT",
204 "EXPR_PLUS",
"EXPR_MINUS",
"EXPR_U_MINUS",
"EXPR_MULT",
205 "EXPR_DIV",
"EXPR_MODULO",
"EXPR_EXPO",
207 "EXPR_BIT_AND",
"EXPR_BIT_OR",
"EXPR_BIT_XOR",
"EXPR_BIT_NOT",
208 "EXPR_INCR",
"EXPR_DECR",
"EXPR_L_SHIFT",
"EXPR_R_SHIFT",
211 "COMP_MATCH",
"COMP_NOMATCH",
"COMP_RE_MATCH",
"COMP_RE_NOMATCH",
213 "COMP_LT",
"COMP_LE",
"COMP_EQ",
"COMP_NE",
214 "COMP_GT",
"COMP_GE",
"CONST_INT",
"CONST_STR",
215 "CONST_DATA",
"CONST_REGEX",
219 "REF_VAR",
"REF_ARRAY",
"DYN_ARRAY"};
225 for (j = 0; j < n; j++)
246 snprintf (txt,
sizeof (txt),
"%ld", c->
x.
i_val);
250 if ((
unsigned int) c->
size >= sizeof (txt) + 2)
252 snprintf (txt,
sizeof (txt),
"\"%s", c->
x.
str_val);
253 strcpy (txt + (
sizeof (txt) - 5),
"...\"");
256 snprintf (txt,
sizeof (txt),
"\"%s\"", c->
x.
str_val);
286 printf (
"* UNKNOWN %d (0x%x)*\n", c->
type, c->
type);
295 printf (
"\tSize=%d (0x%x)", c->
size, c->
size);
303 printf (
"Val=%ld\n", c->
x.
i_val);
317 printf (
"Val=(null)\n");
319 printf (
"Val=\"%s\"\n", c->
x.
str_val);
324 printf (
"Ref=(null)\n");
328 printf (
"Ref=(type=%d, name=%s, value=%s)\n", v->
u.
var_type,
339 for (i = 0; i < 4; i++)
348 static char txt4[4][32];
358 snprintf (txt, 32,
"%s (%d)",
node_names[t], t);
360 snprintf (txt, 32,
"*UNKNOWN* (%d)", t);
368 printf (
"^^^^ %p ^^^^^\n", (
void *) c);
375 printf (
"vvvvvvvvvvvvvvvvvv\n");
384 snprintf (txt,
sizeof (txt),
" at or near line %d ", c->
line_nb);
void nasl_perror(lex_ctxt *lexic, char *msg,...)
tree_cell * dup_cell(const tree_cell *tc)
void ref_cell(tree_cell *c)
char * dump_cell_val(const tree_cell *c)
void nasl_dump_tree(const tree_cell *c)
int cell_type(const tree_cell *c)
static tree_cell * alloc_tree_cell()
tree_cell * alloc_RE_cell(int lnb, int t, tree_cell *l, char *re_str, int *err_c)
const char * nasl_type_name(int t)
static char * node_names[]
int nasl_is_leaf(const tree_cell *pc)
static void free_tree(tree_cell *c)
static void dump_tree(const tree_cell *c, int n, int idx)
tree_cell * alloc_expr_cell(int lnb, int t, tree_cell *l, tree_cell *r)
tree_cell * alloc_typed_cell(int typ)
static void prefix(int n, int i)
char * get_line_nb(const tree_cell *c)
void deref_cell(tree_cell *c)
const char * var2str(anon_nasl_var *v)
void free_array(nasl_array *a)