From 513baf4076b6f82ef6b21c206a1cd17681db0cb0 Mon Sep 17 00:00:00 2001 From: Kolan Sh Date: Thu, 16 Jun 2011 16:45:28 +0400 Subject: [PATCH] =?UTF-8?q?=D0=BF=D0=BE=D0=B4=D0=BF=D1=80=D0=B0=D0=B2?= =?UTF-8?q?=D0=BB=D0=B5=D0=BD=D0=BE,=20=D1=88=D0=BE=D0=BF=20=D0=B7=D0=B0?= =?UTF-8?q?=D0=BF=D1=83=D1=81=D0=BA=D0=B0=D0=BB=D0=BE=D1=81=D1=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- c/tex_parser/Makefile | 8 ++++---- c/tex_parser/tex_table.c | 24 +++++++++++++++++------- c/tex_parser/tex_table_test.c | 7 ++++--- c/zalloc_ext/zalloc_ext.geany | 14 +++++++------- 4 files changed, 32 insertions(+), 21 deletions(-) diff --git a/c/tex_parser/Makefile b/c/tex_parser/Makefile index 85243d9..2ed4096 100644 --- a/c/tex_parser/Makefile +++ b/c/tex_parser/Makefile @@ -53,17 +53,17 @@ endif %.o : $(CC) -c $(CFLAGS) $(LDFLAGS) $(INCLUDE) -o $@ $< -tex_table_test_obj = tex_table_test.o tex_table.o zmalloc.o xmalloc.o xerror.o +tex_table_test_obj = tex_table_test.o tex_table.o zalloc.o xalloc.o xerror.o tex_table_test: $(tex_table_test_obj) $(CC) $(CFLAGS) $(LDFLAGS) $(INCLUDE) -o $@ $(tex_table_test_obj) tex_table_test.o: tex_table_test.c tex_table.o -tex_table.o: tex_table.c tex_table.h zmalloc.o xmalloc.o +tex_table.o: tex_table.c tex_table.h zalloc.o xalloc.o -zmalloc.o: $(KOLAN_INCLUDE)/zmalloc.c $(KOLAN_INCLUDE)/zmalloc.h xerror.o +zalloc.o: $(KOLAN_INCLUDE)/zalloc.c $(KOLAN_INCLUDE)/zalloc.h xerror.o -xmalloc.o: $(KOLAN_INCLUDE)/xmalloc.c $(KOLAN_INCLUDE)/xmalloc.h xerror.o +xalloc.o: $(KOLAN_INCLUDE)/xalloc.c $(KOLAN_INCLUDE)/xalloc.h xerror.o xerror.o: $(KOLAN_INCLUDE)/xerror.c $(KOLAN_INCLUDE)/xerror.h diff --git a/c/tex_parser/tex_table.c b/c/tex_parser/tex_table.c index 890c794..6d5a125 100644 --- a/c/tex_parser/tex_table.c +++ b/c/tex_parser/tex_table.c @@ -3,7 +3,8 @@ #include #include #include "tex_table_tags.h" -#include "zmalloc.h" +#include "zalloc_ext.h" +#include "zalloc.h" int parse_table(const char *table_source, size_t len, struct table_s *table, struct xerror_s *error) { @@ -39,9 +40,9 @@ int parse_table(const char *table_source, size_t len, struct table_s *table, str case IN_TAG: if (!isalpha(c)) { - size_t len = zmalloc_getlen(tag); - zrealloc(&tag, len + 1); - tag[len] = c; + //~ size_t len = zmalloc_getlen(tag); + //~ zrealloc(&tag, len + 1); + //~ tag[len] = c; } else { if (!strcmp(tag, TEX_TAG_BEGIN)) where = IN_TAG_BEGIN_END; @@ -52,12 +53,12 @@ int parse_table(const char *table_source, size_t len, struct table_s *table, str break; case IN_TAG_PARAM: - if () + //~ if () - if (!isspace(c) || c == '{') + if (!isspace(c) || c == '{') { - else if (isspace(c)) { + } else if (isspace(c)) { } else { } break; @@ -68,6 +69,15 @@ int parse_table(const char *table_source, size_t len, struct table_s *table, str } else { } break; + + case IN_TAG_END: + + break; + + case IN_TAG_BEGIN_END: + + break; + } } diff --git a/c/tex_parser/tex_table_test.c b/c/tex_parser/tex_table_test.c index c5746b9..051d273 100644 --- a/c/tex_parser/tex_table_test.c +++ b/c/tex_parser/tex_table_test.c @@ -4,8 +4,8 @@ #include #include "tex_table.h" -#include "zmalloc.h" -#include "xmalloc.h" +#include "zalloc.h" +#include "xalloc.h" #include "xerror.h" int main(int argc, char *argv[]) @@ -23,12 +23,13 @@ int main(int argc, char *argv[]) char *tex_buf = (char *)xmalloc((size_t)stat_buf.st_size + 1); if (fread(tex_buf, 1, (size_t)stat_buf.st_size, tex_file) != (size_t)stat_buf.st_size) - xerrx(errno, "Error reading %s", argv[1]); + xerrx(-1, "Error reading %s", argv[1]); fclose(tex_file); tex_buf[stat_buf.st_size] = 0; struct xerror_s error; struct table_s table; + /* Коммент по-русски */ parse_table(tex_buf, (size_t)stat_buf.st_size, &table, &error); xfree(&tex_buf); diff --git a/c/zalloc_ext/zalloc_ext.geany b/c/zalloc_ext/zalloc_ext.geany index 1c486f7..844b4f3 100644 --- a/c/zalloc_ext/zalloc_ext.geany +++ b/c/zalloc_ext/zalloc_ext.geany @@ -16,13 +16,13 @@ long_line_behaviour=1 long_line_column=72 [files] -current_page=0 -FILE_NAME_0=262;C;0;16;1;1;1;/home/kolan/dev/c/zalloc_ext/zalloc_ext_test.c;0 -FILE_NAME_1=8384;C;0;16;1;1;1;/home/kolan/projects/include/zalloc_ext.c;0 -FILE_NAME_2=2684;C;0;16;1;1;1;/home/kolan/projects/include/zalloc_ext.h;0 -FILE_NAME_3=0;C;0;16;1;1;1;/home/kolan/projects/include/zalloc.h;0 -FILE_NAME_4=0;C;0;16;1;1;1;/home/kolan/projects/include/xalloc.h;0 -FILE_NAME_5=1193;Make;0;16;1;1;1;/home/kolan/dev/c/zalloc_ext/Makefile;0 +current_page=1 +FILE_NAME_0=1852;C;0;16;1;1;1;/home/kolan/dev/c/zalloc_ext/zalloc_ext_test.c;0 +FILE_NAME_1=2168;C;0;16;1;1;1;/home/kolan/projects/include/zalloc_ext.c;0 +FILE_NAME_2=1868;C;0;16;1;1;1;/home/kolan/projects/include/zalloc_ext.h;0 +FILE_NAME_3=90;C;0;16;1;1;1;/home/kolan/projects/include/zalloc.h;0 +FILE_NAME_4=1193;Make;0;16;1;1;1;/home/kolan/dev/c/zalloc_ext/Makefile;0 +FILE_NAME_5=0;C;0;16;1;1;1;/home/kolan/projects/include/xalloc.h;0 [build-menu] NF_00_LB=_Сделать