object places added with puts() in DEBUG but works improper while
This commit is contained in:
parent
6f902a3bb7
commit
a81c73dc23
|
@ -39,8 +39,11 @@ void tex_parse(const char *source, size_t len, struct tex_struct_s **tex_struct,
|
|||
OBJ_UNDEF = 0,
|
||||
OBJ_TABLE,
|
||||
OBJ_TABLE_PARAMS,
|
||||
OBJ_TABLE_SUBTABLE,
|
||||
OBJ_TABLE_HEADER,
|
||||
OBJ_TABLE_FIRSTHEADER,
|
||||
OBJ_TABLE_FOOTER,
|
||||
OBJ_TABLE_FIRSTFOOTER,
|
||||
OBJ_GRAPHICS
|
||||
|
||||
} object_stack[MAX_TEX_STACK_LEVEL] = {OBJ_UNDEF};
|
||||
|
@ -116,10 +119,38 @@ void tex_parse(const char *source, size_t len, struct tex_struct_s **tex_struct,
|
|||
else if (!strcmp(tag, TEX_TAG_END))
|
||||
where_stack[tex_level] = IN_TAG_END;
|
||||
|
||||
else if (!strcmp(tag, TEX_TAG_TABULARNEWLINE))
|
||||
else if (!strcmp(tag, TEX_TAG_TABULARNEWLINE)) {
|
||||
where_stack[tex_level] = IN_TAG_TABULARNEWLINE;
|
||||
|
||||
else
|
||||
} else if (!strcmp(tag, TEX_TAG_ENDFIRSTHEAD)) {
|
||||
// subtable is first header - some actions here...
|
||||
object_stack[obj_level] = OBJ_TABLE_SUBTABLE;
|
||||
#ifdef __TEX_PARSER_DEBUG
|
||||
puts("=OBJ_TABLE_SUBTABLE");
|
||||
#endif
|
||||
|
||||
} else if (!strcmp(tag, TEX_TAG_ENDHEAD)) {
|
||||
// subtable is header - some actions here...
|
||||
object_stack[obj_level] = OBJ_TABLE_SUBTABLE;
|
||||
#ifdef __TEX_PARSER_DEBUG
|
||||
puts("=OBJ_TABLE_SUBTABLE");
|
||||
#endif
|
||||
|
||||
} else if (!strcmp(tag, TEX_TAG_ENDFIRSTFOOT)) {
|
||||
// subtable is first footer - some actions here...
|
||||
object_stack[obj_level] = OBJ_TABLE_SUBTABLE;
|
||||
#ifdef __TEX_PARSER_DEBUG
|
||||
puts("=OBJ_TABLE_SUBTABLE");
|
||||
#endif
|
||||
|
||||
} else if (!strcmp(tag, TEX_TAG_ENDFOOT)) {
|
||||
// subtable is footer - some actions here...
|
||||
object_stack[obj_level] = OBJ_TABLE_SUBTABLE;
|
||||
#ifdef __TEX_PARSER_DEBUG
|
||||
puts("=OBJ_TABLE_SUBTABLE");
|
||||
#endif
|
||||
|
||||
} else
|
||||
where_stack[tex_level] = IN_TAG_UNKNOWN;
|
||||
|
||||
#ifdef __TEX_PARSER_DEBUG
|
||||
|
@ -150,11 +181,19 @@ void tex_parse(const char *source, size_t len, struct tex_struct_s **tex_struct,
|
|||
#endif
|
||||
|
||||
if (tex_level && where_stack[tex_level - 1] == IN_TAG_BEGIN
|
||||
&& !strcmp(param, TEX_PARAM_TABLE))
|
||||
&& !strcmp(param, TEX_PARAM_TABLE)) {
|
||||
object_stack[++obj_level] = OBJ_TABLE;
|
||||
else if (tex_level && where_stack[tex_level - 1] == IN_TAG_END
|
||||
&& !strcmp(param, TEX_PARAM_TABLE))
|
||||
#ifdef __TEX_PARSER_DEBUG
|
||||
puts("->OBJ_TABLE");
|
||||
#endif
|
||||
|
||||
} else if (tex_level && where_stack[tex_level - 1] == IN_TAG_END
|
||||
&& !strcmp(param, TEX_PARAM_TABLE)) {
|
||||
object_stack[obj_level--] = OBJ_UNDEF;
|
||||
#ifdef __TEX_PARSER_DEBUG
|
||||
puts("<-OBJ_UNDEF");
|
||||
#endif
|
||||
}
|
||||
|
||||
where_stack[tex_level--] = IN_UNDEF;
|
||||
|
||||
|
@ -181,6 +220,18 @@ void tex_parse(const char *source, size_t len, struct tex_struct_s **tex_struct,
|
|||
case IN_TAG_END:
|
||||
case IN_TAG_TABULARNEWLINE:
|
||||
if (c == '{' || c == '[') {
|
||||
switch (object_stack[obj_level]) {
|
||||
case OBJ_TABLE:
|
||||
object_stack[++obj_level] = OBJ_TABLE_PARAMS;
|
||||
#ifdef __TEX_PARSER_DEBUG
|
||||
puts("->OBJ_TABLE_PARAMS");
|
||||
#endif
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
zclear(¶m);
|
||||
where_stack[++tex_level] = IN_TAGPARM;
|
||||
|
||||
|
@ -193,6 +244,18 @@ void tex_parse(const char *source, size_t len, struct tex_struct_s **tex_struct,
|
|||
i--;
|
||||
|
||||
} else if (c == '\\') {
|
||||
switch (object_stack[obj_level]) {
|
||||
case OBJ_TABLE:
|
||||
object_stack[++obj_level] = OBJ_TABLE_SUBTABLE;
|
||||
#ifdef __TEX_PARSER_DEBUG
|
||||
puts("->OBJ_TABLE_SUBTABLE");
|
||||
#endif
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
zclear(&tag);
|
||||
where_stack[tex_level] = IN_TAG;
|
||||
|
||||
|
|
|
@ -4,8 +4,10 @@
|
|||
#define TEX_TAG_BEGIN "begin"
|
||||
#define TEX_TAG_CLINE "cline"
|
||||
#define TEX_TAG_END "end"
|
||||
#define TEX_TAG_ENDFOOT "endfoot"
|
||||
#define TEX_TAG_ENDFIRSTHEAD "endfirsthead"
|
||||
#define TEX_TAG_ENDHEAD "endhead"
|
||||
#define TEX_TAG_ENDFIRSTFOOT "endfirstfoot"
|
||||
#define TEX_TAG_ENDFOOT "endfoot"
|
||||
#define TEX_TAG_HLINE "hline"
|
||||
#define TEX_TAG_HSPACE "hspace"
|
||||
#define TEX_TAG_MULTICOLUMN "multicolumn"
|
||||
|
|
Loading…
Reference in New Issue