From 6806be37ce1869ffeb8c5841dcfc724fb6563925 Mon Sep 17 00:00:00 2001 From: Kolan Sh Date: Mon, 4 Jul 2011 11:15:59 +0400 Subject: [PATCH] =?UTF-8?q?=D0=B4=D0=BE=D0=B1=D0=B0=D0=B2=D0=BB=D0=B5?= =?UTF-8?q?=D0=BD=D1=8B=20=D0=BC=D0=BE=D0=B4=D1=83=D0=BB=D0=B8=20graphics?= =?UTF-8?q?=20=D0=B8=20table?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- c/tex_parser/Makefile | 2 +- c/tex_parser/tex_parser.c | 16 +++++++++------- c/tex_parser/tex_parser.geany | 22 ++++++++++------------ c/tex_parser/tex_parser_const.h | 6 ++++++ c/tex_parser/tex_parser_graphics.c | 6 ++++++ c/tex_parser/tex_parser_graphics.h | 4 ++++ c/tex_parser/tex_parser_table.c | 6 ++++++ c/tex_parser/tex_parser_table.h | 6 ++++++ 8 files changed, 48 insertions(+), 20 deletions(-) create mode 100644 c/tex_parser/tex_parser_const.h create mode 100644 c/tex_parser/tex_parser_graphics.c create mode 100644 c/tex_parser/tex_parser_graphics.h create mode 100644 c/tex_parser/tex_parser_table.c create mode 100644 c/tex_parser/tex_parser_table.h diff --git a/c/tex_parser/Makefile b/c/tex_parser/Makefile index 26415da..3a61f11 100644 --- a/c/tex_parser/Makefile +++ b/c/tex_parser/Makefile @@ -8,7 +8,7 @@ LIBRARIES= #-lexpat $(shell pkg-config --cflags liblist) TARGET=tex_parser_test -#_______________________________________ +#________________________________________ # BUILD SCRIPT (don't change) | #_______________________________________| # Compiler flags diff --git a/c/tex_parser/tex_parser.c b/c/tex_parser/tex_parser.c index e6bc8b2..57c82e2 100644 --- a/c/tex_parser/tex_parser.c +++ b/c/tex_parser/tex_parser.c @@ -7,6 +7,8 @@ #include "zalloc_ext.h" #include "zalloc.h" #include "c_const.h" +#include "xerror.h" +#include "zerror.h" /* only for debug */ #define __TEX_PARSER_DEBUG 0 @@ -42,7 +44,7 @@ void tex_parse(const char *source, size_t len, struct zerror_s **error) } where_stack[MAX_TEX_STACK_LEVEL] = {IN_UNDEF}; - char *tag = NULL; + char *tag = NULL, *param = NULL; size_t i = 0; size_t tex_level = 0; @@ -66,7 +68,7 @@ void tex_parse(const char *source, size_t len, struct zerror_s **error) switch (where_stack[tex_level]) { case IN_UNDEF: if (c == '\\') { - tag = zfree_null(tag); + zclear(&tag); where_stack[++tex_level] = IN_TAG; @@ -143,7 +145,7 @@ void tex_parse(const char *source, size_t len, struct zerror_s **error) #ifdef __TEX_PARSER_DEBUG printf("\\%s\n", tag); #endif - tag = zfree_null(tag); + zclear(&tag); i--; } @@ -164,7 +166,7 @@ void tex_parse(const char *source, size_t len, struct zerror_s **error) where_stack[tex_level--] = IN_UNDEF; } else if (c == '\\') { // new tag - tag = zfree_null(tag); + zclear(&tag); where_stack[++tex_level] = IN_TAG; } else if (isspace(c)) { @@ -194,7 +196,7 @@ void tex_parse(const char *source, size_t len, struct zerror_s **error) case IN_TAG_MULTICOLUMN: case IN_TAG_MULTIROW: case IN_TAG_TABULARNEWLINE: - switch(where_stack[tex_level]) { + /*switch (where_stack[tex_level]) { case IN_TAG_UNKNOWN: @@ -247,7 +249,7 @@ void tex_parse(const char *source, size_t len, struct zerror_s **error) where_stack[tex_level], source[i], (u_int8_t)source[i], i); return; break; - } + }//*/ if (c == '{' || c == '[') where_stack[++tex_level] = IN_TAGPARM; @@ -257,7 +259,7 @@ void tex_parse(const char *source, size_t len, struct zerror_s **error) i--; } else if (c == '\\') { - tag = zfree_null(tag); + zclear(&tag); where_stack[tex_level] = IN_TAG; } else if (isspace(c)) diff --git a/c/tex_parser/tex_parser.geany b/c/tex_parser/tex_parser.geany index 114e582..69aa946 100644 --- a/c/tex_parser/tex_parser.geany +++ b/c/tex_parser/tex_parser.geany @@ -16,18 +16,16 @@ long_line_behaviour=1 long_line_column=72 [files] -current_page=7 -FILE_NAME_0=846;C;0;16;1;1;1;/home/kolan/dev/c/tex_parser/tex_parser_test.c;0 -FILE_NAME_1=284;C;0;16;1;1;1;/home/kolan/dev/c/tex_parser/tex_parser.c;0 -FILE_NAME_2=655;C;0;16;1;1;1;/home/kolan/dev/c/tex_parser/tex_parser_tags.h;0 -FILE_NAME_3=1952;Make;0;16;1;1;1;/home/kolan/dev/c/tex_parser/Makefile;0 -FILE_NAME_4=410;C;0;16;1;1;1;/home/kolan/dev/c/tex_parser/tex_parser.h;0 -FILE_NAME_5=1858;C;0;16;1;1;1;/home/kolan/projects/include/xerror.c;0 -FILE_NAME_6=877;C;0;16;1;1;1;/home/kolan/projects/include/xerror.h;0 -FILE_NAME_7=1049;C;0;16;1;1;1;/home/kolan/projects/include/zerror.c;0 -FILE_NAME_8=1912;C;0;16;1;1;1;/home/kolan/projects/include/zerror.h;0 -FILE_NAME_9=1649;C;0;16;1;1;1;/home/kolan/projects/include/xalloc.c;0 -FILE_NAME_10=4903;C;0;16;1;1;1;/home/kolan/projects/include/xalloc.h;0 +current_page=0 +FILE_NAME_0=79;C;0;16;1;1;1;/home/kolan/dev/c/tex_parser/tex_parser_test.c;0 +FILE_NAME_1=5881;C;0;16;1;1;1;/home/kolan/dev/c/tex_parser/tex_parser.c;0 +FILE_NAME_2=298;C;0;16;1;1;1;/home/kolan/dev/c/tex_parser/tex_parser.h;0 +FILE_NAME_3=525;C;0;16;1;1;1;/home/kolan/dev/c/tex_parser/tex_parser_tags.h;0 +FILE_NAME_4=50;C;0;16;1;1;1;/home/kolan/dev/c/tex_parser/tex_parser_table.c;0 +FILE_NAME_5=57;C;0;16;1;1;1;/home/kolan/dev/c/tex_parser/tex_parser_table.h;0 +FILE_NAME_6=97;C;0;16;1;1;1;/home/kolan/dev/c/tex_parser/tex_parser_const.h;0 +FILE_NAME_7=3556;Make;0;16;1;1;1;/home/kolan/dev/c/tex_parser/Makefile;0 +FILE_NAME_8=0;C;0;16;1;1;1;/home/kolan/projects/include/zerror.h;0 [build-menu] NF_00_LB=_Сделать diff --git a/c/tex_parser/tex_parser_const.h b/c/tex_parser/tex_parser_const.h new file mode 100644 index 0000000..f4f233a --- /dev/null +++ b/c/tex_parser/tex_parser_const.h @@ -0,0 +1,6 @@ +#ifndef _TEX_PARSER_CONST_H +#define _TEX_PARSER_CONST_H + +#define MAX_TEX_STACK_LEVEL 128 + +#endif diff --git a/c/tex_parser/tex_parser_graphics.c b/c/tex_parser/tex_parser_graphics.c new file mode 100644 index 0000000..a7f8804 --- /dev/null +++ b/c/tex_parser/tex_parser_graphics.c @@ -0,0 +1,6 @@ +#include "tex_parser_graphics.h" + +void sssttuubbsdf() +{ + +} diff --git a/c/tex_parser/tex_parser_graphics.h b/c/tex_parser/tex_parser_graphics.h new file mode 100644 index 0000000..e3fb05c --- /dev/null +++ b/c/tex_parser/tex_parser_graphics.h @@ -0,0 +1,4 @@ +#ifndef _TEX_PARSER_GRAPHICS_H +#define _TEX_PARSER_GRAPHICS_H + +#endif diff --git a/c/tex_parser/tex_parser_table.c b/c/tex_parser/tex_parser_table.c new file mode 100644 index 0000000..2180993 --- /dev/null +++ b/c/tex_parser/tex_parser_table.c @@ -0,0 +1,6 @@ +#include "tex_parser_table.h" + +void sssttuubbasfsd() +{ + +} diff --git a/c/tex_parser/tex_parser_table.h b/c/tex_parser/tex_parser_table.h new file mode 100644 index 0000000..88c638d --- /dev/null +++ b/c/tex_parser/tex_parser_table.h @@ -0,0 +1,6 @@ +#ifndef _TEX_PARSER_TABLE_H +#define _TEX_PARSER_TABLE_H + + + +#endif