From b2acdb1b9f6c1c30447c930f9ff600f0ffccbae9 Mon Sep 17 00:00:00 2001 From: Kolan Sh Date: Mon, 27 Jun 2011 19:26:59 +0400 Subject: [PATCH] =?UTF-8?q?=D0=B4=D0=BE=20671-=D0=B3=D0=BE=20=D1=81=D0=B8?= =?UTF-8?q?=D0=BC=D0=B2=D0=BE=D0=BB=D0=B0=20=D0=B4=D0=BE=D1=88=D0=BB=D0=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- c/tex_parser/tables4.tex | 146 ++++++++++++++++++++++----------------- c/tex_parser/tex_table.c | 25 ++++--- 2 files changed, 96 insertions(+), 75 deletions(-) diff --git a/c/tex_parser/tables4.tex b/c/tex_parser/tables4.tex index 543d83e..1033598 100644 --- a/c/tex_parser/tables4.tex +++ b/c/tex_parser/tables4.tex @@ -1,3 +1,19 @@ +\D{\c}{% + \f{T}\s\d\e{T}} +\D{\t}[1]{\l{\c #1}} +\A{\D{T}{}{}} + +%% B +\p{\t}{\\} + +%% U +\u[r]{b} + +\end{HA} + +%\t{\T{p}} +%\end{haha} + %% LyX 1.6.8 created this file. For more info, see http://www.lyx.org/. %% Do not edit unless you really know what you are doing. \documentclass[english,russian]{article} @@ -37,128 +53,128 @@ DrosselTable1 \begin{longtable}{|>{\centering}p{0.11\linewidth}|>{\raggedright}p{0.05\linewidth}|>{\centering}p{0.07\paperwidth}|>{\centering}p{0.07\paperwidth}|>{\centering}m{0.07\paperheight}|>{\centering}m{0.07\paperheight}|>{\centering}p{0.07\paperheight}|>{\centering}p{0.07\paperheight}|} \hline -\multicolumn{8}{|c|}{ 7-117 \textnumero{}}\tabularnewline -\multicolumn{8}{|c|}{ \textnumero{}18 ~~ ~ : ~~~~~~~~ . : -~~~~~~~~~ = ~~~ ~~ t = ~~~ $\,^{\circ}\mbox{C}$}\tabularnewline -\multicolumn{8}{|c|}{ ~~~~~~~ , }\tabularnewline +\multicolumn{8}{|c|}{Сводный протокол результатов испытания двигателя ТВ7-117В \textnumero{}}\tabularnewline +\multicolumn{8}{|c|}{Стенд \textnumero{}18 ~~ ИУД СИК ~ Дата: ~~~~~~~~ г. Время: +~~~~~~~~~ Рн = ~~~ мм рт ст~~ tвх = ~~~ $\,^{\circ}\mbox{C}$}\tabularnewline +\multicolumn{8}{|c|}{Характеристика ~~~~~~~ Акт сдачи, контрольные точки}\tabularnewline \hline \endhead \hline -\multicolumn{2}{|>{\centering}m{0.11\linewidth}|}{\centering{}} & \multicolumn{2}{c|}{ } & & & \multicolumn{2}{c|}{ }\tabularnewline +\multicolumn{2}{|>{\centering}m{0.11\linewidth}|}{\centering{}Составил} & \multicolumn{2}{c|}{Инженер по испытаниям} & Начальник БТК & Начальник участка УИД СИК & \multicolumn{2}{c|}{Представитель заказчика}\tabularnewline \hline -\multicolumn{2}{|>{\centering}p{0.11\linewidth}|}{\centering{}\textit{}} & \multicolumn{2}{c|}{\textit{}} & \centering{}\textit{} & \centering{}\textit{} & \multicolumn{2}{c|}{\textit{}}\tabularnewline -\multicolumn{2}{|>{\centering}p{0.11\linewidth}|}{\textit{}} & \multicolumn{2}{c|}{\textit{}} & \multicolumn{1}{c|}{\textit{}} & \textit{} & \multicolumn{2}{c|}{\textit{}}\tabularnewline +\multicolumn{2}{|>{\centering}p{0.11\linewidth}|}{\centering{}\textit{Подпись}} & \multicolumn{2}{c|}{\textit{Подпись}} & \centering{}\textit{Подпись} & \centering{}\textit{Подпись} & \multicolumn{2}{c|}{\textit{Подпись}}\tabularnewline +\multicolumn{2}{|>{\centering}p{0.11\linewidth}|}{\textit{фамилия}} & \multicolumn{2}{c|}{\textit{фамилия}} & \multicolumn{1}{c|}{\textit{фамилия}} & \textit{фамилия} & \multicolumn{2}{c|}{\textit{фамилия}}\tabularnewline \hline \endfoot -\multicolumn{8}{|l|}{Σ }\tabularnewline +\multicolumn{8}{|l|}{Усреднённые значения по режимам}\tabularnewline \hline -\multicolumn{2}{|c|}{} & N & Ce & G & n & t{*}z & \tabularnewline +\multicolumn{2}{|c|}{Параметр} & Nепр & Ce & Gт пр & nтк пр & t{*}z ст пр & Пк\tabularnewline \hline -\multicolumn{2}{|>{\centering}p{0.07\paperwidth}|}{\centering{}} & & & & & & \tabularnewline +\multicolumn{2}{|>{\centering}p{0.07\paperwidth}|}{\centering{}Режим} & & & & & & \tabularnewline \hline -\multicolumn{2}{|l|}{} & & & & & & \tabularnewline +\multicolumn{2}{|l|}{ЗМГ} & & & & & & \tabularnewline \hline -\multicolumn{2}{|l|}{0,4 } & & & & & & \tabularnewline +\multicolumn{2}{|l|}{0,4 мП} & & & & & & \tabularnewline \hline \multicolumn{2}{|l|}{Ne1650} & & & & & & \tabularnewline \hline -\multicolumn{2}{|l|}{} & & & & & & \tabularnewline +\multicolumn{2}{|l|}{Мкр} & & & & & & \tabularnewline \hline -\multicolumn{2}{|l|}{} & & & & & & \tabularnewline +\multicolumn{2}{|l|}{МП} & & & & & & \tabularnewline \hline \multicolumn{2}{|l|}{Ne2500} & & & & & & \tabularnewline \hline -\multicolumn{2}{|l|}{} & & & & & & \tabularnewline +\multicolumn{2}{|l|}{Взл} & & & & & & \tabularnewline \hline -\multicolumn{2}{|l|}{30-..} & & & & & & \tabularnewline +\multicolumn{2}{|l|}{30-мин.м.} & & & & & & \tabularnewline \hline -\multicolumn{8}{|c|}{ }\tabularnewline +\multicolumn{8}{|c|}{Замеренные параметры}\tabularnewline \hline -\multicolumn{2}{|c|}{} & Ne & Ce & G & n & t{*}z & \tabularnewline +\multicolumn{2}{|c|}{Параметр} & Ne & Ce & Gт & nтк & t{*}z ст & Пк\tabularnewline \hline -\multicolumn{2}{|l|}{} & & & & & & \tabularnewline +\multicolumn{2}{|l|}{ЗМГ} & & & & & & \tabularnewline \hline -\multicolumn{2}{|l|}{2,5 ..} & & & & & & \tabularnewline +\multicolumn{2}{|l|}{2,5 мин.м.} & & & & & & \tabularnewline \hline -\multicolumn{8}{|c|}{ }\tabularnewline +\multicolumn{8}{|c|}{Оценка режимов по ТУ}\tabularnewline \hline -\multicolumn{2}{|c|}{} & \selectlanguage{english}% -\inputencoding{latin9}\multirow{2}{0.07\paperwidth}{\inputencoding{koi8-r}\foreignlanguage{russian}{Ne}}\selectlanguage{russian} +\multicolumn{2}{|c|}{Параметр} & \selectlanguage{english}% +\inputencoding{latin9}\multirow{2}{0.07\paperwidth}{\inputencoding{koi8-r}\foreignlanguage{russian}{Neпр}}\selectlanguage{russian} & \selectlanguage{english}% -\inputencoding{latin9}\multirow{2}{0.07\paperwidth}{\inputencoding{koi8-r}\foreignlanguage{russian}{ - n ,\%}}\selectlanguage{russian} +\inputencoding{latin9}\multirow{2}{0.07\paperwidth}{\inputencoding{koi8-r}\foreignlanguage{russian}{не +более nтк пр,\%}}\selectlanguage{russian} & \selectlanguage{english}% -\inputencoding{latin9}\multirow{2}{0.07\paperwidth}{\inputencoding{koi8-r}\foreignlanguage{russian}{n,\%}}\selectlanguage{russian} +\inputencoding{latin9}\multirow{2}{0.07\paperwidth}{\inputencoding{koi8-r}\foreignlanguage{russian}{nст,\%}}\selectlanguage{russian} & \selectlanguage{english}% -\inputencoding{latin9}\multirow{2}{0.09\paperwidth}{\inputencoding{koi8-r}\foreignlanguage{russian}{ - t{*}z ,$\,^{\circ}\mbox{C}$}}\selectlanguage{russian} +\inputencoding{latin9}\multirow{2}{0.09\paperwidth}{\inputencoding{koi8-r}\foreignlanguage{russian}{не +более t{*}z ст пр,$\,^{\circ}\mbox{C}$}}\selectlanguage{russian} & \selectlanguage{english}% -\inputencoding{latin9}\multirow{2}{0.08\paperwidth}{\inputencoding{koi8-r}\foreignlanguage{russian}{ - Ce /...}}\selectlanguage{russian} +\inputencoding{latin9}\multirow{2}{0.08\paperwidth}{\inputencoding{koi8-r}\foreignlanguage{russian}{не +более Ce г/л.с.ч.}}\selectlanguage{russian} & \selectlanguage{english}% -\inputencoding{latin9}\multirow{2}{0.07\paperwidth}{\inputencoding{koi8-r}\foreignlanguage{russian}{G -, /}}\selectlanguage{russian} +\inputencoding{latin9}\multirow{2}{0.07\paperwidth}{\inputencoding{koi8-r}\foreignlanguage{russian}{Gт +пр, кг/час}}\selectlanguage{russian} \tabularnewline \cline{1-2} -\multicolumn{2}{|c|}{} & & & & & & \tabularnewline +\multicolumn{2}{|c|}{Режим} & & & & & & \tabularnewline \hline - & & 1900 & 93,0 & 98,0$\pm$0,5 & 680 & 221 & -\tabularnewline + & ТУ & 1900 & 93,0 & 98,0$\pm$0,5 & 680 & 221 & -\tabularnewline \cline{2-8} - & & & & & & & \tabularnewline +Мкр & Факт & & & & & & \tabularnewline \cline{2-8} - & . & & & & & & \tabularnewline + & Откл. & & & & & & \tabularnewline \hline - & & 2100 & 94,0 & 98,0$\pm$0,5 & 705 & - & -\tabularnewline + & ТУ & 2100 & 94,0 & 98,0$\pm$0,5 & 705 & - & -\tabularnewline \cline{2-8} - & & & & & & & \tabularnewline +МП & Факт & & & & & & \tabularnewline \cline{2-8} - & . & & & & & & \tabularnewline + & Откл. & & & & & & \tabularnewline \hline - & & 2800 & 97,5 & 98,0$\pm$0,5 & 775 & 205 & -\tabularnewline + & ТУ & 2800 & 97,5 & 98,0$\pm$0,5 & 775 & 205 & -\tabularnewline \cline{2-8} - & & & & & & & \tabularnewline +Взл & Факт & & & & & & \tabularnewline \cline{2-8} - & . & & & & & & \tabularnewline + & Откл. & & & & & & \tabularnewline \hline - & & 3000 & 98,5 & 98,0$\pm$0,5 & 795 & - & -\tabularnewline + & ТУ & 3000 & 98,5 & 98,0$\pm$0,5 & 795 & - & -\tabularnewline \cline{2-8} -30-.. & & & & & & & \tabularnewline +30-мин.м. & Факт & & & & & & \tabularnewline \cline{2-8} - & . & & & & & & \tabularnewline + & Откл. & & & & & & \tabularnewline \hline -\multicolumn{8}{|c|}{ }\tabularnewline +\multicolumn{8}{|c|}{Замеренные параметры}\tabularnewline \hline -\multicolumn{2}{|c|}{} & \selectlanguage{english}% +\multicolumn{2}{|c|}{Параметр} & \selectlanguage{english}% \inputencoding{latin9}\multirow{2}{0.07\paperwidth}{\inputencoding{koi8-r}\foreignlanguage{russian}{Ne}}\selectlanguage{russian} & \selectlanguage{english}% -\inputencoding{latin9}\multirow{2}{0.07\paperwidth}{\inputencoding{koi8-r}\foreignlanguage{russian}{ - n,\%}}\selectlanguage{russian} +\inputencoding{latin9}\multirow{2}{0.07\paperwidth}{\inputencoding{koi8-r}\foreignlanguage{russian}{не +более nтк,\%}}\selectlanguage{russian} & \selectlanguage{english}% -\inputencoding{latin9}\multirow{2}{0.07\paperwidth}{\inputencoding{koi8-r}\foreignlanguage{russian}{n,\%}}\selectlanguage{russian} +\inputencoding{latin9}\multirow{2}{0.07\paperwidth}{\inputencoding{koi8-r}\foreignlanguage{russian}{nст,\%}}\selectlanguage{russian} & \selectlanguage{english}% -\inputencoding{latin9}\multirow{2}{0.09\paperwidth}{\inputencoding{koi8-r}\foreignlanguage{russian}{ - t{*}z ,$\,^{\circ}\mbox{C}$}}\selectlanguage{russian} +\inputencoding{latin9}\multirow{2}{0.09\paperwidth}{\inputencoding{koi8-r}\foreignlanguage{russian}{не +более t{*}z ст,$\,^{\circ}\mbox{C}$}}\selectlanguage{russian} & \selectlanguage{english}% -\inputencoding{latin9}\multirow{2}{0.08\paperwidth}{\inputencoding{koi8-r}\foreignlanguage{russian}{ - Ce /...}}\selectlanguage{russian} +\inputencoding{latin9}\multirow{2}{0.08\paperwidth}{\inputencoding{koi8-r}\foreignlanguage{russian}{не +более Ce г/л.с.ч.}}\selectlanguage{russian} & \selectlanguage{english}% -\inputencoding{latin9}\multirow{2}{0.07\paperwidth}{\inputencoding{koi8-r}\foreignlanguage{russian}{G, -/}}\selectlanguage{russian} +\inputencoding{latin9}\multirow{2}{0.07\paperwidth}{\inputencoding{koi8-r}\foreignlanguage{russian}{Gт, +кг/час}}\selectlanguage{russian} \tabularnewline \cline{1-2} -\multicolumn{2}{|c|}{} & & & & & & \tabularnewline +\multicolumn{2}{|c|}{Режим} & & & & & & \tabularnewline \hline - & & - & & 80,0$\pm$0,5 & - & - & -\tabularnewline + & ТУ & - & & 80,0$\pm$0,5 & - & - & -\tabularnewline \cline{2-8} - & & & & & & & \tabularnewline +ЗМГ & Факт & & & & & & \tabularnewline \cline{2-8} - & . & & & & & & \tabularnewline + & Откл. & & & & & & \tabularnewline \hline - & & - & 101,0 & 98,0$\pm$0,5 & 805 & - & -\tabularnewline + & ТУ & - & 101,0 & 98,0$\pm$0,5 & 805 & - & -\tabularnewline \cline{2-8} -2,5 .. & & & & & & & \tabularnewline +2,5 мин.м. & Факт & & & & & & \tabularnewline \cline{2-8} - & . & & & & & & \tabularnewline + & Откл. & & & & & & \tabularnewline \hline \multicolumn{3}{|c|}{A0} & & & & & \tabularnewline \hline @@ -166,8 +182,8 @@ DrosselTable1 \hline \multicolumn{3}{|c|}{A2} & & & & & \tabularnewline \hline -\multicolumn{3}{|c|}{} & & & & & \tabularnewline +\multicolumn{3}{|c|}{СКО} & & & & & \tabularnewline \hline -\multicolumn{3}{|c|}{} & \multicolumn{5}{c|}{}\tabularnewline +\multicolumn{3}{|c|}{Примечание} & \multicolumn{5}{c|}{}\tabularnewline \end{longtable} \end{document} diff --git a/c/tex_parser/tex_table.c b/c/tex_parser/tex_table.c index 26bea06..78158f7 100644 --- a/c/tex_parser/tex_table.c +++ b/c/tex_parser/tex_table.c @@ -59,7 +59,7 @@ int parse_table(const char *table_source, size_t len, struct table_s *table, str /* read one character from input stream */ char c = table_source[i]; - +printf("tex_level = %lu, c = %c\n", tex_level, c); /* looking at where_stack and encountered character */ switch (where_stack[tex_level]) { case IN_UNDEF: @@ -67,6 +67,10 @@ 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; + + } else if (isspace(c)) { + where_stack[++tex_level] = IN_SPACE; + } else if (c == '%') { where_stack[++tex_level] = IN_COMMENT; @@ -206,7 +210,7 @@ int parse_table(const char *table_source, size_t len, struct table_s *table, str where_stack[tex_level] = IN_TAG_UNKNOWN; } - if (c == '\\') + if (c == '\\' || c == '}' || c == ']') i--; } break; @@ -260,8 +264,9 @@ int parse_table(const char *table_source, size_t len, struct table_s *table, str } else if (isspace(c)) { where_stack[++tex_level] = IN_SPACE; - } else if (c == '}') { + } else if (c == '}' || c == ']') { where_stack[tex_level--] = IN_UNDEF; + i--; } else if (isgraph(c) || c < 0) { @@ -286,7 +291,7 @@ int parse_table(const char *table_source, size_t len, struct table_s *table, str } else if (isspace(c)) { where_stack[++tex_level] = IN_SPACE; - } else if (c == '}') { + } else if (c == '}' || c == ']') { where_stack[tex_level--] = IN_UNDEF; } else if (isalnum(c) || c == '#') { @@ -312,7 +317,7 @@ int parse_table(const char *table_source, size_t len, struct table_s *table, str } else if (isspace(c)) { where_stack[++tex_level] = IN_SPACE; - } else if (c == '}') { + } else if (c == '}' || c == ']') { where_stack[tex_level--] = IN_UNDEF; } else if (isgraph(c) || c < 0) { @@ -338,7 +343,7 @@ int parse_table(const char *table_source, size_t len, struct table_s *table, str } else if (isspace(c)) { where_stack[++tex_level] = IN_SPACE; - } else if (c == '}') { + } else if (c == '}' || c == ']') { where_stack[tex_level--] = IN_UNDEF; } else if (isgraph(c) || c < 0) { @@ -381,7 +386,7 @@ int parse_table(const char *table_source, size_t len, struct table_s *table, str } else if (isspace(c)) { where_stack[++tex_level] = IN_SPACE; - } else if (c == '}') { + } else if (c == '}' || c == ']') { where_stack[tex_level--] = IN_UNDEF; } else if (isalnum(c) || c == '#') { @@ -407,7 +412,7 @@ int parse_table(const char *table_source, size_t len, struct table_s *table, str } else if (isspace(c)) { where_stack[++tex_level] = IN_SPACE; - } else if (c == '}') { + } else if (c == '}' || c == ']') { where_stack[tex_level--] = IN_UNDEF; } else if (isgraph(c) || c < 0) { @@ -433,7 +438,7 @@ int parse_table(const char *table_source, size_t len, struct table_s *table, str } else if (isspace(c)) { where_stack[++tex_level] = IN_SPACE; - } else if (c == '}') { + } else if (c == '}' || c == ']') { where_stack[tex_level--] = IN_UNDEF; } else if (isalnum(c) || c == '#') { @@ -464,7 +469,7 @@ int parse_table(const char *table_source, size_t len, struct table_s *table, str break; } } - +printf("tex_level = %lu\n", tex_level); table->id = "Drossel1.Table1"; return 0;