Object's stack added.

This commit is contained in:
Kolan Sh 2011-07-15 18:15:48 +04:00
parent 4c45d76996
commit d2fe2e99b7
1 changed files with 15 additions and 28 deletions

View File

@ -31,30 +31,24 @@ void tex_parse(const char *source, size_t len, struct tex_struct_s **tex_struct,
IN_TAG_BEGIN,
IN_TAG_END,
IN_TAG_TABULARNEWLINE,
IN_TABLE,
IN_TABLE_PARAMS, // column properties devided by '>'
IN_TABLE_TAG_HLINE,
IN_TABLE_TAG_MULTICOLUMN,
IN_TABLE_COMMENT,
IN_TABLE_TAG,
IN_TABLE_TAG_UNKNOWN,
IN_TABLE_SPACE,
IN_TABLE_TAGPARM,
IN_TABLE_TAG_CLINE,
IN_TABLE_TAG_ENDFOOT,
IN_TABLE_TAG_ENDHEAD,
IN_TABLE_TAG_HSPACE,
IN_TABLE_TAG_MULTIROW,
IN_FORMULA, // in $...$
} where_stack[MAX_TEX_STACK_LEVEL] = {IN_UNDEF};
enum object_e {
OBJ_UNDEF = 0,
OBJ_TABLE,
OBJ_TABLE_PARAMS,
OBJ_TABLE_HEADER,
OBJ_TABLE_FOOTER,
OBJ_GRAPHICS
} object_stack[MAX_TEX_STACK_LEVEL] = {OBJ_UNDEF};
char *tag = NULL, *param = NULL;
size_t i = 0;
size_t tex_level = 0;
size_t obj_level = 0;
for (i = 0; i < len; i++) {
@ -157,11 +151,10 @@ void tex_parse(const char *source, size_t len, struct tex_struct_s **tex_struct,
if (tex_level && where_stack[tex_level - 1] == IN_TAG_BEGIN
&& !strcmp(param, TEX_PARAM_TABLE))
where_stack[tex_level++] = IN_TABLE;
if (tex_level && where_stack[tex_level - 1] == IN_TAG_END
object_stack[++obj_level] = OBJ_TABLE;
else if (tex_level && where_stack[tex_level - 1] == IN_TAG_END
&& !strcmp(param, TEX_PARAM_TABLE))
where_stack[tex_level--] = IN_UNDEF;
object_stack[obj_level--] = OBJ_UNDEF;
where_stack[tex_level--] = IN_UNDEF;
@ -221,13 +214,6 @@ void tex_parse(const char *source, size_t len, struct tex_struct_s **tex_struct,
case IN_FORMULA:
break;
case IN_TABLE:
*tex_struct = zalloc_append64(*tex_struct,
break;
default:
@ -239,3 +225,4 @@ void tex_parse(const char *source, size_t len, struct tex_struct_s **tex_struct,
}
}
}