подправлено, шоп запускалось

This commit is contained in:
Kolan Sh 2011-06-16 16:45:28 +04:00
parent 49cfd34cd6
commit 513baf4076
4 changed files with 32 additions and 21 deletions

View File

@ -53,17 +53,17 @@ endif
%.o : %.o :
$(CC) -c $(CFLAGS) $(LDFLAGS) $(INCLUDE) -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) tex_table_test: $(tex_table_test_obj)
$(CC) $(CFLAGS) $(LDFLAGS) $(INCLUDE) -o $@ $(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_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 xerror.o: $(KOLAN_INCLUDE)/xerror.c $(KOLAN_INCLUDE)/xerror.h

View File

@ -3,7 +3,8 @@
#include <string.h> #include <string.h>
#include <ctype.h> #include <ctype.h>
#include "tex_table_tags.h" #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) 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: case IN_TAG:
if (!isalpha(c)) { if (!isalpha(c)) {
size_t len = zmalloc_getlen(tag); //~ size_t len = zmalloc_getlen(tag);
zrealloc(&tag, len + 1); //~ zrealloc(&tag, len + 1);
tag[len] = c; //~ tag[len] = c;
} else { } else {
if (!strcmp(tag, TEX_TAG_BEGIN)) if (!strcmp(tag, TEX_TAG_BEGIN))
where = IN_TAG_BEGIN_END; 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; break;
case IN_TAG_PARAM: case IN_TAG_PARAM:
if () //~ if ()
if (!isspace(c) || c == '{') if (!isspace(c) || c == '{') {
else if (isspace(c)) { } else if (isspace(c)) {
} else { } else {
} }
break; break;
@ -68,6 +69,15 @@ int parse_table(const char *table_source, size_t len, struct table_s *table, str
} else { } else {
} }
break; break;
case IN_TAG_END:
break;
case IN_TAG_BEGIN_END:
break;
} }
} }

View File

@ -4,8 +4,8 @@
#include <errno.h> #include <errno.h>
#include "tex_table.h" #include "tex_table.h"
#include "zmalloc.h" #include "zalloc.h"
#include "xmalloc.h" #include "xalloc.h"
#include "xerror.h" #include "xerror.h"
int main(int argc, char *argv[]) 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); 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) 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); fclose(tex_file);
tex_buf[stat_buf.st_size] = 0; tex_buf[stat_buf.st_size] = 0;
struct xerror_s error; struct xerror_s error;
struct table_s table; struct table_s table;
/* Коммент по-русски */
parse_table(tex_buf, (size_t)stat_buf.st_size, &table, &error); parse_table(tex_buf, (size_t)stat_buf.st_size, &table, &error);
xfree(&tex_buf); xfree(&tex_buf);

View File

@ -16,13 +16,13 @@ long_line_behaviour=1
long_line_column=72 long_line_column=72
[files] [files]
current_page=0 current_page=1
FILE_NAME_0=262;C;0;16;1;1;1;/home/kolan/dev/c/zalloc_ext/zalloc_ext_test.c;0 FILE_NAME_0=1852;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_1=2168;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_2=1868;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_3=90;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_4=1193;Make;0;16;1;1;1;/home/kolan/dev/c/zalloc_ext/Makefile;0
FILE_NAME_5=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] [build-menu]
NF_00_LB=_Сделать NF_00_LB=_Сделать