tex_parser разбиваю на модули

This commit is contained in:
Kolan Sh 2011-06-30 16:38:54 +04:00
parent 1ff0c07d86
commit 5934035bf6
10 changed files with 221 additions and 10 deletions

View File

@ -38,7 +38,7 @@ ifneq ($(mode),profile)
ifneq ($(mode),develop) ifneq ($(mode),develop)
ifneq ($(mode),release) ifneq ($(mode),release)
@echo "Invalid build mode." @echo "Invalid build mode."
@echo "Please use 'make mode=release' or 'make mode=develop' or 'make mode=debug'" @echo "Please use 'make mode=release', 'make mode=develop' or 'make mode=debug'"
@exit 1 @exit 1
endif endif
endif endif
@ -53,13 +53,13 @@ endif
%.o : %.o :
$(CC) -c $(CFLAGS) $(LDFLAGS) $(INCLUDE) -o $@ $< $(CC) -c $(CFLAGS) $(LDFLAGS) $(INCLUDE) -o $@ $<
tex_parser_test_obj = tex_parser_test.o tex_parser.o zalloc_ext.o zalloc.o xalloc.o xerror.o tex_parser_test_obj = tex_parser_test.o tex_parser.o zalloc_ext.o zalloc.o xalloc.o zerror.o xerror.o
tex_parser_test: $(tex_parser_test_obj) tex_parser_test: $(tex_parser_test_obj)
$(CC) $(CFLAGS) $(LDFLAGS) $(INCLUDE) -o $@ $(tex_parser_test_obj) $(CC) $(CFLAGS) $(LDFLAGS) $(INCLUDE) -o $@ $(tex_parser_test_obj)
tex_parser_test.o: tex_parser_test.c tex_parser.o tex_parser_test.o: tex_parser_test.c tex_parser.o
tex_parser.o: tex_parser.c tex_parser.h zalloc_ext.o zalloc.o xalloc.o tex_parser.o: tex_parser.c tex_parser.h zalloc_ext.o zalloc.o xalloc.o zerror.o
zalloc_ext.o: $(KOLAN_INCLUDE)/zalloc_ext.c $(KOLAN_INCLUDE)/zalloc_ext.h zalloc.o xerror.o zalloc_ext.o: $(KOLAN_INCLUDE)/zalloc_ext.c $(KOLAN_INCLUDE)/zalloc_ext.h zalloc.o xerror.o
@ -67,6 +67,8 @@ zalloc.o: $(KOLAN_INCLUDE)/zalloc.c $(KOLAN_INCLUDE)/zalloc.h xerror.o
xalloc.o: $(KOLAN_INCLUDE)/xalloc.c $(KOLAN_INCLUDE)/xalloc.h xerror.o xalloc.o: $(KOLAN_INCLUDE)/xalloc.c $(KOLAN_INCLUDE)/xalloc.h xerror.o
zerror.o: $(KOLAN_INCLUDE)/zerror.c $(KOLAN_INCLUDE)/zerror.h
xerror.o: $(KOLAN_INCLUDE)/xerror.c $(KOLAN_INCLUDE)/xerror.h xerror.o: $(KOLAN_INCLUDE)/xerror.c $(KOLAN_INCLUDE)/xerror.h
clean: clean:

View File

@ -12,7 +12,7 @@
#include <stdio.h> #include <stdio.h>
int tex_parse(const char *source, size_t len, struct xerror_s *error) int tex_parse(const char *source, size_t len, struct zerror_s *error)
{ {
error->code = 0; error->code = 0;
error->message = NULL; error->message = NULL;

View File

@ -16,8 +16,18 @@ long_line_behaviour=1
long_line_column=72 long_line_column=72
[files] [files]
current_page=0 current_page=10
FILE_NAME_0=1859;Make;0;16;1;1;1;/home/kolan/dev/c/tex_parser/Makefile;0 FILE_NAME_0=1032;C;0;16;1;1;1;/home/kolan/dev/c/tex_parser/tex_parser_test.c;0
FILE_NAME_1=1320;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=1871;Make;0;16;1;1;1;/home/kolan/dev/c/tex_parser/Makefile;0
FILE_NAME_4=334;C;0;16;1;1;1;/home/kolan/dev/c/tex_parser/tex_parser.h;0
FILE_NAME_5=0;C;0;16;1;1;1;/home/kolan/projects/include/xerror.c;0
FILE_NAME_6=1146;C;0;16;1;1;1;/home/kolan/projects/include/xerror.h;0
FILE_NAME_7=3137;C;0;16;1;1;1;/home/kolan/projects/include/zerror.c;0
FILE_NAME_8=1902;C;0;16;1;1;1;/home/kolan/projects/include/zerror.h;0
FILE_NAME_9=2406;C;0;16;1;1;1;/home/kolan/projects/include/xalloc.c;0
FILE_NAME_10=3312;C;0;16;1;1;1;/home/kolan/projects/include/xalloc.h;0
[build-menu] [build-menu]
NF_00_LB=_Сделать NF_00_LB=_Сделать

View File

@ -3,12 +3,26 @@
#include <sys/types.h> #include <sys/types.h>
#include "xerror.h" #include "zerror.h"
//~ #include "tex_table.h"
//~ #include "tex_image.h"
#define MAX_TEX_STACK_LEVEL 128 #define MAX_TEX_STACK_LEVEL 128
//~
//~ struct node_s {
//~ enum {
//~ TEXOBJ_UNDEF = 0,
//~ TEXOBJ_TABLE,
//~ TEXOBJ_IMAGE,
//~ } type;
//~ };
//~
//~ struct tex_tree_s {
//~
//~ };
/* LaTeX parser /* LaTeX parser
*/ */
int tex_parse(const char *source, size_t len, struct xerror_s *error); int tex_parse(const char *source, size_t len, struct zerror_s *error);
#endif #endif

View File

@ -29,13 +29,16 @@ int main(int argc, char *argv[])
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 zerror_s error;
memset(&error, 0, sizeof(struct xerror_s)); memset(&error, 0, sizeof(struct zerror_s));
//~ setlocale(LC_ALL, "ru_RU.KOI8-R"); //~ setlocale(LC_ALL, "ru_RU.KOI8-R");
/* Коммент по-русски */ /* Коммент по-русски */
int result = tex_parse(tex_buf, (size_t)stat_buf.st_size, &error); int result = tex_parse(tex_buf, (size_t)stat_buf.st_size, &error);
//~ setlocale(LC_ALL, "");
if (result) { if (result) {
printf("Parsing error at %d, symb=%c: %s\n", error.code + 1, tex_buf[error.code], error.message); printf("Parsing error at %d, symb=%c: %s\n", error.code + 1, tex_buf[error.code], error.message);
} }

6
tex/twocols/twocols1.aux Normal file
View File

@ -0,0 +1,6 @@
\relax
\catcode`"\active
\select@language{russian}
\@writefile{toc}{\select@language{russian}}
\@writefile{lof}{\select@language{russian}}
\@writefile{lot}{\select@language{russian}}

BIN
tex/twocols/twocols1.pdf Normal file

Binary file not shown.

28
tex/twocols/twocols1.tex Normal file
View File

@ -0,0 +1,28 @@
\documentclass[russian]{article}
%~ \usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
%~ \usepackage{textcomp}
%~ \usepackage{amstext}
\usepackage[russian]{babel}
\usepackage{array}
\usepackage{longtable}
\usepackage{rotating}
\usepackage{setspace}
\usepackage{geometry}
\usepackage{float}
\usepackage{multirow}
\usepackage{multicol}
\begin{document}
\begin{multicols}{3}
Она начинает новую страницу (используя команду \clearpage) и начинает пе-
чать следующего за ней текста в две колонки. Если имеется необязательный ар-
гумент text, он будет напечатан в верхней части новой страницы в одну колонку;
если опция отсутствует, то печать в две колонки начинается от начала страницы.
Возврат к одноколоночному формату осуществляет команда
\end{multicols}
\end{document}

74
tex/twocols/twocols2.lyx Normal file
View File

@ -0,0 +1,74 @@
#LyX 1.6.8 created this file. For more info see http://www.lyx.org/
\lyxformat 345
\begin_document
\begin_header
\textclass article
\begin_preamble
\usepackage[russian]{babel}
\usepackage{array,longtable}
\usepackage{rotating}
\usepackage{setspace}
\usepackage{geometry}
\usepackage{float}
\usepackage{multirow}
%\usepackage{multicol}
\renewcommand{\multirowsetup}{\centering}
\end_preamble
\use_default_options true
\language english
\inputencoding auto
\font_roman default
\font_sans default
\font_typewriter default
\font_default_family default
\font_sc false
\font_osf false
\font_sf_scale 100
\font_tt_scale 100
\graphics default
\paperfontsize default
\spacing single
\use_hyperref false
\papersize default
\use_geometry false
\use_amsmath 1
\use_esint 1
\cite_engine basic
\use_bibtopic false
\paperorientation portrait
\secnumdepth 3
\tocdepth 3
\paragraph_separation indent
\defskip medskip
\quotes_language english
\papercolumns 1
\papersides 1
\paperpagestyle default
\tracking_changes false
\output_changes false
\author ""
\author ""
\end_header
\begin_body
\begin_layout Standard
\begin_inset Graphics
filename /home/kolan/img/dragon022.jpg
scale 50
\end_inset
\begin_inset Graphics
filename /home/kolan/img/akinator_9_confiant.png
scale 50
\end_inset
\end_layout
\end_body
\end_document

74
tex/twocols/twopics.lyx Normal file
View File

@ -0,0 +1,74 @@
#LyX 1.6.8 created this file. For more info see http://www.lyx.org/
\lyxformat 345
\begin_document
\begin_header
\textclass article
\begin_preamble
\usepackage[russian]{babel}
\usepackage{array,longtable}
\usepackage{rotating}
\usepackage{setspace}
\usepackage{geometry}
\usepackage{float}
\usepackage{multirow}
%\usepackage{multicol}
\renewcommand{\multirowsetup}{\centering}
\end_preamble
\use_default_options true
\language english
\inputencoding auto
\font_roman default
\font_sans default
\font_typewriter default
\font_default_family default
\font_sc false
\font_osf false
\font_sf_scale 100
\font_tt_scale 100
\graphics default
\paperfontsize default
\spacing single
\use_hyperref false
\papersize default
\use_geometry false
\use_amsmath 1
\use_esint 1
\cite_engine basic
\use_bibtopic false
\paperorientation portrait
\secnumdepth 3
\tocdepth 3
\paragraph_separation indent
\defskip medskip
\quotes_language english
\papercolumns 1
\papersides 1
\paperpagestyle default
\tracking_changes false
\output_changes false
\author ""
\author ""
\end_header
\begin_body
\begin_layout Standard
\begin_inset Graphics
filename /home/kolan/img/dragon022.jpg
scale 50
\end_inset
\begin_inset Graphics
filename /home/kolan/img/akinator_9_confiant.png
scale 50
\end_inset
\end_layout
\end_body
\end_document