47 for (i = 0; i < 4; i++)
63 regex_t *re = g_malloc0 (
sizeof (regex_t));
70 e = regcomp (re, re_str, REG_EXTENDED | REG_NOSUB | REG_ICASE);
76 regerror (e, re, errbuf,
sizeof (errbuf));
77 nasl_perror (NULL,
"Line %d: Cannot compile regex: %s (error %d: %s)\n",
78 lnb, re_str, e, errbuf);
121 for (i = 0; i < 4; i++)
137 for (i = 0; i < 4; i++)
138 if (c->
link[i] != NULL)
145 #ifdef SCRATCH_FREED_MEMORY 181 #ifdef SCRATCH_FREED_MEMORY 182 memset (c, 0xFF,
sizeof (*c));
195 nasl_perror (NULL,
"ref_cell: ref count is negative!\n");
212 static char *node_names[] = {
289 prefix (
int n,
int i)
292 for (j = 0; j < n; j++)
313 snprintf (txt,
sizeof (txt),
"%ld", c->
x.
i_val);
317 if (c->
size >= sizeof (txt) + 2)
319 snprintf (txt,
sizeof (txt),
"\"%s", c->
x.
str_val);
320 strcpy (txt + (
sizeof (txt) - 5),
"...\"");
323 snprintf (txt,
sizeof (txt),
"\"%s\"", c->
x.
str_val);
333 dump_tree (
const tree_cell * c,
int n,
int idx)
352 if ((
int) c < 0x1000)
354 printf (
"* INVALID PTR 0x%x *\n", (
int) c);
358 if (c->
type < 0 || c->
type >= sizeof (node_names) /
sizeof (node_names[0]))
359 printf (
"* UNKNOWN %d (0x%x)*\n", c->
type, c->
type);
361 printf (
"%s (%d)\n", node_names[c->
type], c->
type);
369 printf (
"\tSize=%d (0x%x)", c->
size, c->
size);
377 printf (
"Val=%ld\n", c->
x.
i_val);
391 printf (
"Val=(null)\n");
393 printf (
"Val=\"%s\"\n", c->
x.
str_val);
398 printf (
"Ref=(null)\n");
402 printf (
"Ref=(type=%d, name=%s, value=%s)\n", v->
u.
var_type,
413 for (i = 0; i < 4; i++)
415 dump_tree (c->
link[i], n + 3, i + 1);
422 static char txt4[4][32];
430 if (t >= 0 && t <
sizeof (node_names) /
sizeof (node_names[0]))
431 snprintf (txt, 32,
"%s (%d)", node_names[t], t);
433 snprintf (txt, 32,
"*UNKNOWN* (%d)", t);
441 printf (
"^^^^ %p ^^^^^\n", c);
448 printf (
"vvvvvvvvvvvvvvvvvv\n");
457 snprintf (txt,
sizeof (txt),
" at or near line %d ", c->
line_nb);
void ref_cell(tree_cell *c)
void nasl_dump_tree(const tree_cell *c)
void deref_cell(tree_cell *c)
tree_cell * alloc_typed_cell(int typ)
tree_cell * alloc_RE_cell(int lnb, int t, tree_cell *l, char *re_str)
int nasl_is_leaf(const tree_cell *pc)
char * dump_cell_val(const tree_cell *c)
void nasl_perror(lex_ctxt *lexic, char *msg,...)
tree_cell * dup_cell(const tree_cell *tc)
tree_cell * alloc_tree_cell(int lnb, char *s)
const char * var2str(const anon_nasl_var *v)
const char * nasl_type_name(int t)
int cell_type(const tree_cell *c)
void free_array(nasl_array *a)
char * get_line_nb(const tree_cell *c)
tree_cell * alloc_expr_cell(int lnb, int t, tree_cell *l, tree_cell *r)