[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[8136] parsetexi update
From: |
gavinsmith0123 |
Subject: |
[8136] parsetexi update |
Date: |
Sat, 1 Sep 2018 05:52:24 -0400 (EDT) |
Revision: 8136
http://svn.sv.gnu.org/viewvc/?view=rev&root=texinfo&revision=8136
Author: gavin
Date: 2018-09-01 05:52:23 -0400 (Sat, 01 Sep 2018)
Log Message:
-----------
parsetexi update
Modified Paths:
--------------
trunk/tp/Texinfo/XS/parsetexi/api.c
trunk/tp/Texinfo/XS/parsetexi/def.c
trunk/tp/Texinfo/XS/parsetexi/def.h
trunk/tp/Texinfo/XS/parsetexi/dump_perl.c
trunk/tp/Texinfo/XS/parsetexi/element_types.c
trunk/tp/Texinfo/XS/parsetexi/element_types.h
trunk/tp/Texinfo/XS/parsetexi/element_types.txt
trunk/tp/Texinfo/XS/parsetexi/end_line.c
trunk/tp/Texinfo/XS/parsetexi/extra.c
trunk/tp/Texinfo/XS/parsetexi/parser.h
trunk/tp/Texinfo/XS/parsetexi/tree.c
trunk/tp/Texinfo/XS/parsetexi/tree_types.h
Modified: trunk/tp/Texinfo/XS/parsetexi/api.c
===================================================================
--- trunk/tp/Texinfo/XS/parsetexi/api.c 2018-08-26 18:48:31 UTC (rev 8135)
+++ trunk/tp/Texinfo/XS/parsetexi/api.c 2018-09-01 09:52:23 UTC (rev 8136)
@@ -455,54 +455,28 @@
be much nicer if we could get rid of the need for this key.
We set this afterwards in build_index_data. */
break;
- case extra_def_args:
+ case extra_def_info:
{
- /* Value is an array of two-element arrays. */
- AV *av, *av2;
+ DEF_INFO *d = (DEF_INFO *) f;
HV *def_parsed_hash;
- int j;
- DEF_ARGS_EXTRA *d = (DEF_ARGS_EXTRA *) f;
- av = newAV ();
- STORE(newRV_inc ((SV *)av));
-
- /* Also create a "def_parsed_hash" extra value. The key name
- for this is hard-coded here. */
+ /* Create a "def_parsed_hash" extra value. */
def_parsed_hash = newHV ();
- hv_store (extra, "def_parsed_hash",
- strlen ("def_parsed_hash"),
- newRV_inc ((SV *)def_parsed_hash), 0);
+ STORE(newRV_inc ((SV *)def_parsed_hash));
- for (j = 0; j < d->nelements; j++)
- {
- ELEMENT *elt = d->elements[j];
- char *label = d->labels[j];
- av2 = newAV ();
- av_push (av, newRV_inc ((SV *)av2));
- av_push (av2, newSVpv (label, 0));
- if (!elt->hv)
- {
- /* TODO: Same problem as "extra_element" cross-tree
- references. */
- if (elt->parent_type != route_not_in_tree)
- abort ();
- element_to_perl_hash (elt);
- }
- if (!elt->hv)
- abort ();
- av_push (av2, newRV_inc ((SV *)elt->hv));
+#define SAVE_DEF(X) { if (!d->X->hv) \
+ element_to_perl_hash (d->X); \
+ hv_store (def_parsed_hash, #X, strlen (#X), \
+ newRV_inc ((SV *)d->X->hv), 0) ; }
- /* Set keys of "def_parsed_hash". */
- // 2793
- if (strcmp (label, "spaces")
- && strcmp (label, "arg") && strcmp (label, "typearg")
- && strcmp (label, "delimiter"))
- {
- hv_store (def_parsed_hash, label, strlen (label),
- newRV_inc ((SV *)elt->hv), 0);
- }
- }
-
+ if (d->category)
+ SAVE_DEF(category)
+ if (d->class)
+ SAVE_DEF(class)
+ if (d->type)
+ SAVE_DEF(type)
+ if (d->name)
+ SAVE_DEF(name)
break;
}
case extra_float_type:
Modified: trunk/tp/Texinfo/XS/parsetexi/def.c
===================================================================
--- trunk/tp/Texinfo/XS/parsetexi/def.c 2018-08-26 18:48:31 UTC (rev 8135)
+++ trunk/tp/Texinfo/XS/parsetexi/def.c 2018-09-01 09:52:23 UTC (rev 8136)
@@ -64,139 +64,23 @@
}
-static ELEMENT *
-shallow_copy_element (ELEMENT *e)
+/* Starting at I in the contents, return the next non-whitespace element,
+ incrementing I. Return null if no more elements. */
+ELEMENT *
+next_bracketed_or_word (ELEMENT *current, int *i)
{
- ELEMENT *e2 = 0;
- if (e)
+ while (1)
{
- e2 = malloc (sizeof (ELEMENT));
- memcpy (e2, e, sizeof (ELEMENT));
- e2->parent_type = route_not_in_tree;
+ if (*i == current->contents.number)
+ return 0;
+ if (current->contents.list[*i]->type != ET_spaces
+ && current->contents.list[*i]->type != ET_spaces_inserted)
+ break;
+ (*i)++;
}
- return (e2);
+ return current->contents.list[(*i)];
}
-static void
-shallow_destroy_element (ELEMENT *e)
-{
- free (e->text.text);
- free (e);
-}
-
-// 2335
-/* Used for definition line parsing. Return next unit on the line after
- a definition command like @deffn. The contents of E is what is remaining
- in the argument line. *SPACES_OUT is set to an element with spaces before
- the line. */
-static ELEMENT *
-next_bracketed_or_word (ELEMENT *e, ELEMENT **spaces_out, int join)
-{
- char *text;
- ELEMENT *spaces = 0;
- int space_len = 0;
- ELEMENT *ret;
- ELEMENT *f;
-
- *spaces_out = 0;
- if (e->contents.number == 0)
- return 0; /* No more arguments */
-
- f = e->contents.list[0];
- text = f->text.text;
- if (text)
- space_len = strspn (text, whitespace_chars);
- if (space_len)
- {
- if (space_len)
- {
- spaces = new_element (ET_spaces);
- if (text[space_len - 1] == '\n')
- spaces->type = ET_spaces_at_end;
- spaces->parent_type = route_not_in_tree;
- text_append_n (&spaces->text, text, space_len);
- memmove (f->text.text,
- f->text.text + space_len,
- f->text.end - space_len + 1);
- f->text.end -= space_len;
- }
-
- if (f->text.end == 0)
- {
- (void ) remove_from_contents (e, 0);
- shallow_destroy_element (f);
- }
- *spaces_out = spaces;
- }
-
- if (e->contents.number == 0)
- return 0; /* No more arguments */
-
- ret = new_element (ET_NONE);
- ret->parent_type = route_not_in_tree;
- while (e->contents.number > 0)
- {
- f = e->contents.list[0];
- if (f->type == ET_bracketed)
- {
- (void) remove_from_contents (e, 0);
- f->type = ET_bracketed_def_content;
- isolate_last_space (f, 0);
- add_to_contents_as_array (ret, f);
- if (!join)
- break;
- }
- else if (f->cmd) // 2363
- {
- (void ) remove_from_contents (e, 0);
- add_to_contents_as_array (ret, f);
- if (!join)
- break;
- }
- else
- {
- /* Extract span of non-whitespace characters. */
- ELEMENT *returned;
- int arg_len;
-
- text = f->text.text;
- if (!*text)
- {
- /* Finished with this element */
- remove_from_contents (e, 0);
- shallow_destroy_element (f);
- continue;
- }
-
- space_len = strspn (text, whitespace_chars);
- if (space_len > 0)
- break; /* Finished */
-
- returned = new_element (ET_NONE);
- returned->parent_type = route_not_in_tree;
- arg_len = strcspn (text, whitespace_chars);
- text_append_n (&returned->text, text, arg_len);
- memmove (f->text.text, f->text.text + space_len + arg_len,
- f->text.end - (space_len + arg_len) + 1);
- f->text.end -= space_len + arg_len;
-
- add_to_contents_as_array (ret, returned);
- if (!join)
- break;
- }
- }
- if (ret->contents.number == 1)
- {
- ELEMENT *tmp = ret;
- ret = ret->contents.list[0];
- shallow_destroy_element (tmp);
- }
- else if (ret->contents.number == 0)
- abort ();
-
- return ret;
-}
-
typedef struct {
enum command_id alias;
enum command_id command;
@@ -218,83 +102,66 @@
0, 0, 0
};
+/* Divide any text elements into separate elements, separating whitespace
+ and non-whitespace. */
static void
-add_to_def_args_extra (DEF_ARGS_EXTRA *d, char *label, ELEMENT *arg)
+split_def_args (ELEMENT *current)
{
- if (d->nelements >= d->space - 1)
+ int i;
+ for (i = 0; i < current->contents.number; i++)
{
- d->space += 5;
- d->labels = realloc (d->labels, d->space * sizeof (char *));
- d->elements = realloc (d->elements, d->space * sizeof (ELEMENT *));
- }
+ ELEMENT *e = current->contents.list[i];
+ int j;
+ char *p;
+ ELEMENT *new;
+ int len;
+ if (e->text.end == 0)
+ continue;
+ p = e->text.text;
- if (arg && arg->hv)
- abort ();
- if (!arg)
- return; /* Probably a bug */
+ len = strspn (p, whitespace_chars);
+ if (len)
+ {
+ new = new_element (ET_spaces);
+ text_append_n (&new->text, p, len);
+ insert_into_contents (current, new, i++);
+ p += len;
+ }
- d->labels[d->nelements] = label;
- d->elements[d->nelements++] = arg;
- d->labels[d->nelements] = 0;
- d->elements[d->nelements] = 0;
+ while (1)
+ {
+ len = strspn (p, whitespace_chars);
+ new = new_element (ET_spaces);
+ text_append_n (&new->text, p, len);
+ insert_into_contents (current, new, i++);
+ if (!*(p += len))
+ break;
+
+ len = strcspn (p, whitespace_chars);
+ new = new_element (ET_NONE);
+ text_append_n (&new->text, p, len);
+ insert_into_contents (current, new, i++);
+ if (!*(p += len))
+ break;
+ }
+ destroy_element (remove_from_contents (current, i--));
+ }
}
-/* Parse the arguments on a def* command line.
- The return value is suitable for "def_args" extra value. */
-// 2378
-DEF_ARGS_EXTRA *
-parse_def (enum command_id command, ELEMENT_LIST contents)
+DEF_INFO *
+parse_def (enum command_id command, ELEMENT *current)
{
- DEF_ARGS_EXTRA *def_args; /* Return value */
- int i, args_start = 0;
-
- ELEMENT *arg_line; /* Copy of argument line. */
- ELEMENT *arg, *spaces; /* Arguments and spaces extracted from line. */
+ DEF_INFO *ret;
+ int contents_idx;
+ ELEMENT *arg;
ELEMENT *e, *e1;
-
enum command_id original_command = CM_NONE;
- def_args = malloc (sizeof (DEF_ARGS_EXTRA));
- memset (def_args, 0, sizeof (DEF_ARGS_EXTRA));
+ ret = malloc (sizeof (DEF_INFO));
+ memset (ret, 0, sizeof (DEF_INFO));
- /* Copy contents of argument line. */
- arg_line = new_element (ET_NONE);
- for (i = contents.list[0]->type != ET_empty_spaces_after_command ? 0 : 1;
- i < contents.number; i++)
- {
- if (0)
- {
- add_to_contents_as_array (arg_line,
- shallow_copy_element (contents.list[i]));
- }
- else if (contents.list[i]->text.space > 0)
- {
- /* Copy text to avoid changing the original. */
- ELEMENT *copy = new_element (ET_NONE);
- copy->parent_type = route_not_in_tree;
- copy->parent = 0;
- text_init (©->text);
- text_append_n (©->text,
- contents.list[i]->text.text,
- contents.list[i]->text.end);
- add_to_contents_as_array (arg_line, copy);
+ split_def_args (current);
- /* Note that these copied elements should be destroyed with
- shallow_destroy_element, not destroy_element, because their
- contents and args are shared with in-tree elements. */
- }
- else
- {
- add_to_contents_as_array (arg_line, contents.list[i]);
- }
- }
-
- if (arg_line->contents.number > 0 // 2385
- && arg_line->contents.list[0]->type == ET_empty_spaces_after_command)
- {
- remove_from_contents (arg_line, 0);
- }
-
/* Check for "def alias" - for example @defun for @deffn. */
if (command_data(command).flags & CF_def_alias) // 2387
{
@@ -316,10 +183,8 @@
command = def_aliases[i].command;
/* Used when category text has a space in it. */
- e = new_element (ET_bracketed);
- insert_into_contents (arg_line, e, 0);
- e->parent = 0;
- e->parent_type = route_not_in_tree;
+ e = new_element (ET_bracketed_inserted);
+ insert_into_contents (current, e, 0);
e1 = new_element (ET_NONE);
text_append_n (&e1->text, category, strlen (category));
add_to_element_contents (e, e1);
@@ -329,14 +194,13 @@
add_extra_string_dup (e1, "documentlanguage",
global_documentlanguage);
}
- e1->parent_type = route_not_in_tree;
- e = new_element (ET_NONE);
+ e = new_element (ET_spaces_inserted);
text_append_n (&e->text, " ", 1);
- insert_into_contents (arg_line, e, 1);
- e->parent_type = route_not_in_tree;
+ insert_into_contents (current, e, 1);
}
+
/* Read arguments as CATEGORY [CLASS] [TYPE] NAME [ARGUMENTS].
Meaning of these:
@@ -346,13 +210,9 @@
NAME - name of entity being documented
ARGUMENTS - arguments to a function or macro */
+ contents_idx = 0;
/* CATEGORY */
- arg = next_bracketed_or_word (arg_line, &spaces, 1);
- if (!arg)
- goto finished;
- if (spaces)
- add_to_def_args_extra (def_args, "spaces", spaces);
- add_to_def_args_extra (def_args, "category", arg);
+ ret->category = next_bracketed_or_word (current, &contents_idx);
/* CLASS */
if (command == CM_deftypeop
@@ -360,12 +220,7 @@
|| command == CM_deftypecv
|| command == CM_defop)
{
- arg = next_bracketed_or_word (arg_line, &spaces, 1);
- if (spaces)
- add_to_def_args_extra (def_args, "spaces", spaces);
- if (!arg)
- goto finished;
- add_to_def_args_extra (def_args, "class", arg);
+ ret->class = next_bracketed_or_word (current, &contents_idx);
}
/* TYPE */
@@ -374,23 +229,35 @@
|| command == CM_deftypevr
|| command == CM_deftypecv)
{
- arg = next_bracketed_or_word (arg_line, &spaces, 1);
- if (spaces)
- add_to_def_args_extra (def_args, "spaces", spaces);
- if (!arg)
- goto finished;
- add_to_def_args_extra (def_args, "type", arg);
+ ret->type = next_bracketed_or_word (current, &contents_idx);
}
/* NAME */
- /* All command types get a name. */
- arg = next_bracketed_or_word (arg_line, &spaces, 1);
- if (spaces)
- add_to_def_args_extra (def_args, "spaces", spaces);
- if (!arg)
- goto finished;
- add_to_def_args_extra (def_args, "name", arg);
+ ret->name = next_bracketed_or_word (current, &contents_idx);
+ if (ret->category)
+ {
+ add_extra_string_dup (ret->category, "def_role", "category");
+ }
+ if (ret->class)
+ {
+ add_extra_string_dup (ret->class, "def_role", "class");
+ }
+ if (ret->type)
+ {
+ add_extra_string_dup (ret->type, "def_role", "type");
+ }
+ if (ret->name)
+ {
+ add_extra_string_dup (ret->name, "def_role", "name");
+ }
+ /* TODO: process args */
+
+ return ret;
+
+}
+
+#if 0
/* ARGUMENTS */
args_start = def_args->nelements;
@@ -479,3 +346,5 @@
destroy_element (arg_line);
return def_args;
}
+
+#endif
Modified: trunk/tp/Texinfo/XS/parsetexi/def.h
===================================================================
--- trunk/tp/Texinfo/XS/parsetexi/def.h 2018-08-26 18:48:31 UTC (rev 8135)
+++ trunk/tp/Texinfo/XS/parsetexi/def.h 2018-09-01 09:52:23 UTC (rev 8136)
@@ -1,2 +1,2 @@
void gather_def_item (ELEMENT *current, enum command_id next_command);
-DEF_ARGS_EXTRA *parse_def (enum command_id command, ELEMENT_LIST contents);
+DEF_INFO *parse_def (enum command_id command, ELEMENT *current);
Modified: trunk/tp/Texinfo/XS/parsetexi/dump_perl.c
===================================================================
--- trunk/tp/Texinfo/XS/parsetexi/dump_perl.c 2018-08-26 18:48:31 UTC (rev
8135)
+++ trunk/tp/Texinfo/XS/parsetexi/dump_perl.c 2018-09-01 09:52:23 UTC (rev
8136)
@@ -304,31 +304,6 @@
dump_string (value, text);
text_append_n (text, "',\n", 3);
}
- else if (e->extra[i].type == extra_def_args)
- {
- DEF_ARGS_EXTRA *value = (DEF_ARGS_EXTRA *) e->extra[i].value;
- int j;
- char *label;
-
- text_append_n (text, "'", 1);
- text_append (text, e->extra[i].key);
- text_append (text, "' => [\n");
-
- for (j = 0; j < value->nelements; j++)
- {
- label = value->labels[j];
- dump_indent (text);
- text_append_n (text, "['", 2);
- text_append (text, label);
- text_append_n (text, "', ", 3);
-
- dump_element (value->elements[j], text);
- text_append_n (text, "],\n", 3);
- }
- dump_indent (text);
- text_append_n (text, "],\n", 3);
- /* TODO: Also output a "def_parsed_hash". */
- }
else if (e->extra[i].value->parent_type == route_not_in_tree)
{
switch (e->extra[i].type)
Modified: trunk/tp/Texinfo/XS/parsetexi/element_types.c
===================================================================
--- trunk/tp/Texinfo/XS/parsetexi/element_types.c 2018-08-26 18:48:31 UTC
(rev 8135)
+++ trunk/tp/Texinfo/XS/parsetexi/element_types.c 2018-09-01 09:52:23 UTC
(rev 8136)
@@ -20,6 +20,7 @@
"space_at_end_menu_node",
"after_description_line",
"spaces",
+"spaces_inserted",
"text_root",
"document_root",
"root_line",
@@ -56,6 +57,7 @@
"row",
"bracketed",
"bracketed_def_content",
+"bracketed_inserted",
"bracketed_multitable_prototype",
"row_prototype",
"elided",
Modified: trunk/tp/Texinfo/XS/parsetexi/element_types.h
===================================================================
--- trunk/tp/Texinfo/XS/parsetexi/element_types.h 2018-08-26 18:48:31 UTC
(rev 8135)
+++ trunk/tp/Texinfo/XS/parsetexi/element_types.h 2018-09-01 09:52:23 UTC
(rev 8136)
@@ -21,6 +21,7 @@
ET_space_at_end_menu_node,
ET_after_description_line,
ET_spaces,
+ET_spaces_inserted,
ET_text_root,
ET_document_root,
ET_root_line,
@@ -57,6 +58,7 @@
ET_row,
ET_bracketed,
ET_bracketed_def_content,
+ET_bracketed_inserted,
ET_bracketed_multitable_prototype,
ET_row_prototype,
ET_elided,
Modified: trunk/tp/Texinfo/XS/parsetexi/element_types.txt
===================================================================
--- trunk/tp/Texinfo/XS/parsetexi/element_types.txt 2018-08-26 18:48:31 UTC
(rev 8135)
+++ trunk/tp/Texinfo/XS/parsetexi/element_types.txt 2018-09-01 09:52:23 UTC
(rev 8136)
@@ -1,4 +1,4 @@
-# Copyright 2010, 2011, 2012, 2013, 2014, 2015, 2016
+# Copyright 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018
# Free Software Foundation, Inc.
#
# This file is part of GNU Texinfo.
@@ -40,6 +40,7 @@
space_at_end_menu_node
after_description_line
spaces
+spaces_inserted
# Other special types
text_root
@@ -81,6 +82,7 @@
row
bracketed
bracketed_def_content
+bracketed_inserted
bracketed_multitable_prototype
row_prototype
Modified: trunk/tp/Texinfo/XS/parsetexi/end_line.c
===================================================================
--- trunk/tp/Texinfo/XS/parsetexi/end_line.c 2018-08-26 18:48:31 UTC (rev
8135)
+++ trunk/tp/Texinfo/XS/parsetexi/end_line.c 2018-09-01 09:52:23 UTC (rev
8136)
@@ -2224,7 +2224,8 @@
else if (current->parent && current->parent->type == ET_def_line)
{
enum command_id def_command, original_def_command;
- DEF_ARGS_EXTRA *arguments = 0;
+ DEF_INFO *def_info = 0;
+ static DEF_INFO zero_def_info; /* always stays zeroed */
KEY_PAIR *k;
if (pop_context () != ct_def)
@@ -2247,41 +2248,36 @@
free (stripped);
}
- arguments = parse_def (def_command, current->contents);
+ def_info = parse_def (def_command, current);
- /* Now record the index entry. */
- if (arguments && arguments->nelements > 0)
+ /* Record the index entry if def_info is not empty. */
+ if (!memcmp(def_info, &zero_def_info, sizeof (DEF_INFO)))
{
- ELEMENT *name = 0, *class = 0; /* From arguments. */
+ free (def_info);
+ command_warn (current->parent, "missing category for @%s",
+ command_name (original_def_command));
+ }
+ else
+ {
ELEMENT *index_entry = 0; /* Index entry text. */
char *label;
int i;
- add_extra_def_args (current->parent, "def_args", arguments);
+ add_extra_def_info (current->parent, "def_parsed_hash", def_info);
- /* We use the keys "name" and "class" from the arguments. */
- for (i = 0; i < arguments->nelements; i++)
+ if (def_info->name) // 2811
{
- label = arguments->labels[i];
- if (!strcmp (label, "name"))
- name = arguments->elements[i];
- else if (!strcmp (label, "class"))
- class = arguments->elements[i];
- }
-
- if (name) // 2811
- {
char *t;
/* Set index_entry unless an empty ET_bracketed_def_content. */
- if (name->type == ET_bracketed_def_content
- && (name->contents.number == 0
- || (name->contents.number == 1
- && (t = name->contents.list[0]->text.text)
+ if (def_info->name->type == ET_bracketed_def_content
+ && (def_info->name->contents.number == 0
+ || (def_info->name->contents.number == 1
+ && (t = def_info->name->contents.list[0]->text.text)
&& t[strspn (t, whitespace_chars)] == '\0')))
{
}
else
- index_entry = name;
+ index_entry = def_info->name;
}
if (index_entry) // 2822
@@ -2289,7 +2285,7 @@
ELEMENT *index_contents = 0;
// 2824
- if (class &&
+ if (def_info->class &&
(def_command == CM_defop
|| def_command == CM_deftypeop
|| def_command == CM_defmethod
@@ -2320,11 +2316,6 @@
command_name (original_def_command));
}
}
- else
- {
- command_warn (current->parent, "missing category for @%s",
- command_name (original_def_command));
- }
current = current->parent->parent; // 2868
current = begin_preformatted (current);
Modified: trunk/tp/Texinfo/XS/parsetexi/extra.c
===================================================================
--- trunk/tp/Texinfo/XS/parsetexi/extra.c 2018-08-26 18:48:31 UTC (rev
8135)
+++ trunk/tp/Texinfo/XS/parsetexi/extra.c 2018-09-01 09:52:23 UTC (rev
8136)
@@ -112,9 +112,9 @@
}
void
-add_extra_def_args (ELEMENT *e, char *key, DEF_ARGS_EXTRA *value)
+add_extra_def_info (ELEMENT *e, char *key, DEF_INFO *value)
{
- add_extra_key (e, key, (ELEMENT *) value, extra_def_args);
+ add_extra_key (e, key, (ELEMENT *) value, extra_def_info);
}
void
Modified: trunk/tp/Texinfo/XS/parsetexi/parser.h
===================================================================
--- trunk/tp/Texinfo/XS/parsetexi/parser.h 2018-08-26 18:48:31 UTC (rev
8135)
+++ trunk/tp/Texinfo/XS/parsetexi/parser.h 2018-09-01 09:52:23 UTC (rev
8136)
@@ -110,7 +110,7 @@
void add_extra_misc_args (ELEMENT *e, char *key, ELEMENT *value);
void add_extra_node_spec (ELEMENT *e, char *key, NODE_SPEC_EXTRA *value);
void add_extra_node_spec_array (ELEMENT *, char *, NODE_SPEC_EXTRA **value);
-void add_extra_def_args (ELEMENT *e, char *key, DEF_ARGS_EXTRA *value);
+void add_extra_def_info (ELEMENT *e, char *key, DEF_INFO *value);
void add_extra_float_type (ELEMENT *e, char *key, EXTRA_FLOAT_TYPE *value);
void add_extra_string (ELEMENT *e, char *key, char *value);
void add_extra_string_dup (ELEMENT *e, char *key, char *value);
Modified: trunk/tp/Texinfo/XS/parsetexi/tree.c
===================================================================
--- trunk/tp/Texinfo/XS/parsetexi/tree.c 2018-08-26 18:48:31 UTC (rev
8135)
+++ trunk/tp/Texinfo/XS/parsetexi/tree.c 2018-09-01 09:52:23 UTC (rev
8136)
@@ -131,27 +131,10 @@
/* Same problem as above. */
//destroy_element_and_children (e->extra[i].value);
break;
- case extra_def_args:
- {
- int j;
- DEF_ARGS_EXTRA *dae = (DEF_ARGS_EXTRA *) e->extra[i].value;
+ case extra_def_info:
+ free (e->extra[i].value);
+ break;
- /* Same problem as above. */
- for (j = 0; 0 && j < dae->nelements; j++)
- {
- ELEMENT *e = dae->elements[j];
- if (e->text.end > 0)
- {
- //destroy_element_and_children (dae->elements[j]);
- destroy_element (dae->elements[j]);
- }
- free (dae->labels[j]);
- }
- free (dae->labels);
- free (dae->elements);
- free (dae);
- }
-
default:
break;
}
Modified: trunk/tp/Texinfo/XS/parsetexi/tree_types.h
===================================================================
--- trunk/tp/Texinfo/XS/parsetexi/tree_types.h 2018-08-26 18:48:31 UTC (rev
8135)
+++ trunk/tp/Texinfo/XS/parsetexi/tree_types.h 2018-09-01 09:52:23 UTC (rev
8136)
@@ -37,7 +37,7 @@
extra_node_spec_array,
extra_string,
extra_integer,
- extra_def_args,
+ extra_def_info,
extra_float_type,
extra_deleted
};
@@ -227,7 +227,16 @@
ELEMENT *node_content;
} NODE_SPEC_EXTRA;
+
+/* For 'def_parsed_hash'. */
typedef struct {
+ ELEMENT *category;
+ ELEMENT *class;
+ ELEMENT *type;
+ ELEMENT *name;
+} DEF_INFO;
+
+typedef struct {
char **labels;
ELEMENT **elements;
int nelements;
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [8136] parsetexi update,
gavinsmith0123 <=