до encodingdefault дошло
This commit is contained in:
parent
b175af9da4
commit
be3dbe915f
|
@ -7,9 +7,11 @@
|
|||
#include "zalloc.h"
|
||||
#include "c_const.h"
|
||||
|
||||
/* unnecessary includes */
|
||||
/* only for debug */
|
||||
#define __TEX_TABLE_DEBUG 0
|
||||
#include <stdio.h>
|
||||
|
||||
|
||||
int parse_table(const char *table_source, size_t len, struct table_s *table, struct xerror_s *error)
|
||||
{
|
||||
if (!len)
|
||||
|
@ -91,83 +93,118 @@ int parse_table(const char *table_source, size_t len, struct table_s *table, str
|
|||
error->message = "empty tag (IN_TAG)";
|
||||
return error->code;
|
||||
|
||||
} else if (!strcmp(tag, TEX_TAG_BEGIN)) {
|
||||
where_stack[tex_level] = IN_TAG_BEGIN;
|
||||
printf("\\%s\n", tag);
|
||||
tag = zfree_null(tag);
|
||||
} else {
|
||||
if (!strcmp(tag, TEX_TAG_BEGIN)) {
|
||||
where_stack[tex_level] = IN_TAG_BEGIN;
|
||||
#ifdef __TEX_TABLE_DEBUG
|
||||
printf("\\%s\n", tag);
|
||||
#endif
|
||||
tag = zfree_null(tag);
|
||||
|
||||
} else if (!strcmp(tag, TEX_TAG_CLINE)) {
|
||||
where_stack[tex_level] = IN_TAG_CLINE;
|
||||
printf("\\%s\n", tag);
|
||||
tag = zfree_null(tag);
|
||||
} else if (!strcmp(tag, TEX_TAG_CLINE)) {
|
||||
where_stack[tex_level] = IN_TAG_CLINE;
|
||||
#ifdef __TEX_TABLE_DEBUG
|
||||
printf("\\%s\n", tag);
|
||||
#endif
|
||||
tag = zfree_null(tag);
|
||||
|
||||
} else if (!strcmp(tag, TEX_TAG_END)) {
|
||||
where_stack[tex_level] = IN_TAG_END;
|
||||
printf("\\%s\n", tag);
|
||||
tag = zfree_null(tag);
|
||||
} else if (!strcmp(tag, TEX_TAG_END)) {
|
||||
where_stack[tex_level] = IN_TAG_END;
|
||||
#ifdef __TEX_TABLE_DEBUG
|
||||
printf("\\%s\n", tag);
|
||||
#endif
|
||||
tag = zfree_null(tag);
|
||||
|
||||
} else if (!strcmp(tag, TEX_TAG_ENDFOOT)) {
|
||||
where_stack[tex_level] = IN_TAG_ENDFOOT;
|
||||
printf("\\%s\n", tag);
|
||||
tag = zfree_null(tag);
|
||||
} else if (!strcmp(tag, TEX_TAG_ENDFOOT)) {
|
||||
where_stack[tex_level] = IN_TAG_ENDFOOT;
|
||||
#ifdef __TEX_TABLE_DEBUG
|
||||
printf("\\%s\n", tag);
|
||||
#endif
|
||||
tag = zfree_null(tag);
|
||||
|
||||
} else if (!strcmp(tag, TEX_TAG_ENDHEAD)) {
|
||||
where_stack[tex_level] = IN_TAG_ENDHEAD;
|
||||
printf("\\%s\n", tag);
|
||||
tag = zfree_null(tag);
|
||||
} else if (!strcmp(tag, TEX_TAG_ENDHEAD)) {
|
||||
where_stack[tex_level] = IN_TAG_ENDHEAD;
|
||||
#ifdef __TEX_TABLE_DEBUG
|
||||
printf("\\%s\n", tag);
|
||||
#endif
|
||||
tag = zfree_null(tag);
|
||||
|
||||
} else if (!strcmp(tag, TEX_TAG_HLINE)) {
|
||||
where_stack[tex_level] = IN_TAG_HLINE;
|
||||
printf("\\%s\n", tag);
|
||||
tag = zfree_null(tag);
|
||||
} else if (!strcmp(tag, TEX_TAG_HLINE)) {
|
||||
where_stack[tex_level] = IN_TAG_HLINE;
|
||||
#ifdef __TEX_TABLE_DEBUG
|
||||
printf("\\%s\n", tag);
|
||||
#endif
|
||||
tag = zfree_null(tag);
|
||||
|
||||
} else if (!strcmp(tag, TEX_TAG_HSPACE)) {
|
||||
where_stack[tex_level] = IN_TAG_HSPACE;
|
||||
printf("\\%s\n", tag);
|
||||
tag = zfree_null(tag);
|
||||
} else if (!strcmp(tag, TEX_TAG_HSPACE)) {
|
||||
where_stack[tex_level] = IN_TAG_HSPACE;
|
||||
#ifdef __TEX_TABLE_DEBUG
|
||||
printf("\\%s\n", tag);
|
||||
#endif
|
||||
tag = zfree_null(tag);
|
||||
|
||||
} else if (!strcmp(tag, TEX_TAG_MULTICOLUMN)) {
|
||||
where_stack[tex_level] = IN_TAG_MULTICOLUMN;
|
||||
printf("\\%s\n", tag);
|
||||
tag = zfree_null(tag);
|
||||
} else if (!strcmp(tag, TEX_TAG_MULTICOLUMN)) {
|
||||
where_stack[tex_level] = IN_TAG_MULTICOLUMN;
|
||||
#ifdef __TEX_TABLE_DEBUG
|
||||
printf("\\%s\n", tag);
|
||||
#endif
|
||||
tag = zfree_null(tag);
|
||||
|
||||
} else if (!strcmp(tag, TEX_TAG_MULTIROW)) {
|
||||
where_stack[tex_level] = IN_TAG_MULTIROW;
|
||||
printf("\\%s\n", tag);
|
||||
tag = zfree_null(tag);
|
||||
} else if (!strcmp(tag, TEX_TAG_MULTIROW)) {
|
||||
where_stack[tex_level] = IN_TAG_MULTIROW;
|
||||
#ifdef __TEX_TABLE_DEBUG
|
||||
printf("\\%s\n", tag);
|
||||
#endif
|
||||
tag = zfree_null(tag);
|
||||
|
||||
} else if (!strcmp(tag, TEX_TAG_TABULARNEWLINE)) {
|
||||
where_stack[tex_level] = IN_TAG_TABULARNEWLINE;
|
||||
printf("\\%s\n", tag);
|
||||
tag = zfree_null(tag);
|
||||
} else if (!strcmp(tag, TEX_TAG_TABULARNEWLINE)) {
|
||||
where_stack[tex_level] = IN_TAG_TABULARNEWLINE;
|
||||
#ifdef __TEX_TABLE_DEBUG
|
||||
printf("\\%s\n", tag);
|
||||
#endif
|
||||
tag = zfree_null(tag);
|
||||
|
||||
} else if (!strcmp(tag, TEX_TAG_SLASH)) {
|
||||
where_stack[tex_level] = IN_TAG_SLASH;
|
||||
printf("\\%s\n", tag);
|
||||
tag = zfree_null(tag);
|
||||
} else if (!strcmp(tag, TEX_TAG_SLASH)) {
|
||||
where_stack[tex_level] = IN_TAG_SLASH;
|
||||
#ifdef __TEX_TABLE_DEBUG
|
||||
printf("\\%s\n", tag);
|
||||
#endif
|
||||
tag = zfree_null(tag);
|
||||
|
||||
} else if (c == '%') {
|
||||
printf("\\%s\n", tag);
|
||||
tag = zfree_null(tag);
|
||||
where_stack[tex_level] = IN_TAG_UNKNOWN;
|
||||
where_stack[++tex_level] = IN_COMMENT;
|
||||
} else if (c == '%') {
|
||||
#ifdef __TEX_TABLE_DEBUG
|
||||
printf("\\%s\n", tag);
|
||||
#endif
|
||||
tag = zfree_null(tag);
|
||||
where_stack[tex_level] = IN_TAG_UNKNOWN;
|
||||
where_stack[++tex_level] = IN_COMMENT;
|
||||
|
||||
} else if (c == '{' || c == '[') {
|
||||
printf("\\%s\n", tag);
|
||||
tag = zfree_null(tag);
|
||||
where_stack[tex_level] = IN_TAG_UNKNOWN;
|
||||
where_stack[++tex_level] = IN_TAGPARM;
|
||||
} else if (c == '{' || c == '[') {
|
||||
#ifdef __TEX_TABLE_DEBUG
|
||||
printf("\\%s\n", tag);
|
||||
#endif
|
||||
tag = zfree_null(tag);
|
||||
where_stack[tex_level] = IN_TAG_UNKNOWN;
|
||||
where_stack[++tex_level] = IN_TAGPARM;
|
||||
|
||||
} else if (isspace(c)) { // \tag { for example
|
||||
printf("\\%s\n", tag);
|
||||
tag = zfree_null(tag);
|
||||
where_stack[tex_level] = IN_TAG_UNKNOWN;
|
||||
where_stack[++tex_level] = IN_SPACE;
|
||||
} else if (isspace(c)) { // \tag { for example
|
||||
#ifdef __TEX_TABLE_DEBUG
|
||||
printf("\\%s\n", tag);
|
||||
#endif
|
||||
tag = zfree_null(tag);
|
||||
where_stack[tex_level] = IN_TAG_UNKNOWN;
|
||||
where_stack[++tex_level] = IN_SPACE;
|
||||
|
||||
} else { // unknown tag
|
||||
printf("\\%s\n", tag);
|
||||
tag = zfree_null(tag);
|
||||
where_stack[tex_level] = IN_TAG_UNKNOWN;
|
||||
} else { // unknown tag
|
||||
#ifdef __TEX_TABLE_DEBUG
|
||||
printf("\\%s\n", tag);
|
||||
#endif
|
||||
tag = zfree_null(tag);
|
||||
where_stack[tex_level] = IN_TAG_UNKNOWN;
|
||||
}
|
||||
|
||||
if (c == '\\')
|
||||
i--;
|
||||
}
|
||||
break;
|
||||
|
||||
|
@ -215,8 +252,8 @@ int parse_table(const char *table_source, size_t len, struct table_s *table, str
|
|||
tag = zfree_null(tag);
|
||||
where_stack[tex_level] = IN_TAG;
|
||||
|
||||
if (FALSE) { // longtable
|
||||
}
|
||||
} else if (c == '%') {
|
||||
where_stack[++tex_level] = IN_COMMENT;
|
||||
|
||||
} else if (isspace(c)) {
|
||||
where_stack[++tex_level] = IN_SPACE;
|
||||
|
@ -241,6 +278,9 @@ int parse_table(const char *table_source, size_t len, struct table_s *table, str
|
|||
if (FALSE) { // longtable
|
||||
}
|
||||
|
||||
} else if (c == '%') {
|
||||
where_stack[++tex_level] = IN_COMMENT;
|
||||
|
||||
} else if (isspace(c)) {
|
||||
where_stack[++tex_level] = IN_SPACE;
|
||||
|
||||
|
|
Loading…
Reference in New Issue