summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/source
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2019-03-04 22:11:44 +0000
committerKarl Berry <karl@freefriends.org>2019-03-04 22:11:44 +0000
commit6f09c23604d01bfecf6c820a6097dd5174c18f21 (patch)
treeb633bd744c84adcb00db6290176256b8af494847 /Master/texmf-dist/source
parent32e1fe3fb2e87465d7aa2afd713dcb95bbcf3092 (diff)
bibarts (4mar19)
git-svn-id: svn://tug.org/texlive/trunk@50226 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/source')
-rw-r--r--Master/texmf-dist/source/latex/bibarts/bibsort.c2012
1 files changed, 1688 insertions, 324 deletions
diff --git a/Master/texmf-dist/source/latex/bibarts/bibsort.c b/Master/texmf-dist/source/latex/bibarts/bibsort.c
index 98c95363c50..9df9a577cb5 100644
--- a/Master/texmf-dist/source/latex/bibarts/bibsort.c
+++ b/Master/texmf-dist/source/latex/bibarts/bibsort.c
@@ -1,5 +1,5 @@
-/* BibArts 2.1 assists you to write LaTeX texts in arts and humanities. */
-/* Copyright (C) 2016 Timo Baumann bibarts[at]gmx.de (2016/03/19) */
+/* BibArts 2.2 assists you to write LaTeX texts in arts and humanities. */
+/* Copyright (C) 2019 Timo Baumann bibarts[at]gmx.de (2019/03/03) */
/* This program is free software; you can redistribute it and/or modify */
/* it under the terms of the GNU General Public License as published by */
@@ -46,7 +46,7 @@
The C-compiled binary of this file is reading LaTeX .aux files.
It can NOT read the .bar files, which BibArts did use before 2.0.
- BibArts 2.1 ONLY has an EMULATION for 1.3 texts: Keep copies of 1.x?
+ BibArts 2.2 ONLY has an EMULATION for 1.3 texts: Keep copies of 1.x?
*/
@@ -64,7 +64,7 @@
#define MAXLINES 65536
#define MAXLEN 4096
#define MAXFILES 128
-#define MAXFILENAMLEN 256
+#define MAXFILENAMLEN 1024
#define AUX_SUFFIX ".aux"
#define VLI_SUFFIX ".vli"
@@ -89,8 +89,7 @@
#define RELAX "\\relax" /* Auch um folgende spaces zu ignorieren */
#define TeXITEM "\\item"
#define TYPEOUT "\\typeout@ba"
-#define IeC "\\IeC"
-#define IeClen 4
+#define IeC "\\IeC\t"
#define PREPARESPACE "\\bibsortpreparespace"
#define PREPAREXSPACE "\\bibsortpreparexspace"
#define PREPAREHEAD "\\bibsortpreparehead"
@@ -107,21 +106,21 @@
#define DOKILLK 4
#define OPENB "\'{\'"
-#define CLOSEB "\'}\'"
#define NUMLEN 16
int ignorespaces = 0;
+int hy_as_space = 0;
int kill = NOKILLAUTHORS;
int registpoints = 0;
char *lineptr[MAXLINES];
+int FntIndexOverPages = 1; /* new in 2.2 */
#define PCOLS 2
#define PCOLSSORT 1
#define ACOLS 2
#define ACOLSSORT 1
#define KCOLS 4
-#define KTIT "\\ktit"
#define VCOLS 4
#define IS_Q 2
#define IS_V 1
@@ -131,6 +130,24 @@ char *subAptr[MAXBACOLS][MAXLINES];
char *subBptr[MAXBACOLS][MAXLINES];
char *subCptr[MAXBACOLS][MAXLINES];
+#define PROTECT "\\protect"
+#define KTIT "\\ktit"
+#define KTITCMD "\\ktit\t"
+#define ANNOUNCEKTIT "\\announcektit"
+#define KURZ "\\kurz"
+#define KURZCMD "\\outkurz\t"
+#define KTITINTRO "\t"
+#define KTITINTROCH '\t'
+#define KTITERRORCH '\?' /* Insert ?? for bad inner \ktit */
+#define KTITSHA "\t<"
+#define KTITMISS "\t|"
+#define KTITEMPTY "\t>"
+#define KTITBEG "{"
+#define KTITEND "}"
+#define KTITOP '{'
+#define KTITCL '}'
+int otherktiterr = -1;
+
#define ACCEPTLINE 0
#define REJECTLINE 1
#define DOUBLELINE 2 /* \ */
@@ -188,11 +205,14 @@ const char bareststr[] = "{}{}[][]()";
#define TOMFNSYMBOL "\\TextOrMath"
#define TEXFILELINE "\\line@ba"
-#define BALOOPSPACE "\\ "
-#define BAINDEXLIST " \\first@baidx{"
+#define BS_SPACE "\\ "
+#define BANCOMMA ", "
+#define BAINDEXFIRS " \\first@baidx{"
#define BAINDEXFOLL " \\follo@baidx{"
#define BAINDEXEND "}\n"
-#define BAINDEXLOOPS 5
+#define CLOOPASTART -1
+#define CLOOPBSTART 0
+#define BAINDEXLEN 45
#define BADNUM 0
@@ -226,10 +246,18 @@ int ALPHmpfootnotes = 0;
int get_a_fn = BA_FALSE;
int igleichj = 0;
+#define METALINEHEAD "%%%%META%%%%"
+
+
+int bago = 0; /* new in 2.2 */
+#define BAGOCMD "\\bago"
+
char *soptarg = NULL;
char *foptarg = NULL;
void print_two(int line, int left, int right);
+int isLaTeXcmdletter(char a);
+int entkerne_IeC(char buf[], const char *s);
char *mydefault = "";
char *nofnt = "(nofnt)"; /* nur "" wuerde Fehler machen */
@@ -243,23 +271,54 @@ void openfailed(const char *s)
}
+void intern_err(int n)
+{
+ printf("%%%%\n%%%%> INTERNAL ERROR %d\n", n);
+}
+
+
void announceexit(const char *s)
{
fprintf(stderr, "%%%%> I give up my job, because I %s.\n", s);
}
+int mystrncpy(char *p, const char *s, int len)
+{
+ int l = 0, ll;
+
+ while(*s != '\0' && l < len)
+ {
+ *p++ = *s++;
+ ++l;
+ }
+
+ *p = '\0'; /* handle error: len < 0 */
+
+ ll = l;
+ while (ll <= len)
+ {
+ *p++ = '\0';
+ ++ll;
+ }
+
+ return l;
+}
+
+
char *strnmalloc(const char *q, int len)
{ char *p = mydefault;
- if (len < 1) { printf("\nmallocError: len=%d\n\n", len); len = 1; }
- p = (char *) calloc(1, len);
+ int l = 0;
+ if (len < 1) { intern_err(0); len = 1; } /* mallocError len */
+ p = (char *) malloc(len);
if (p == NULL)
{
printf("%%%%\n%%%%> Error: Not enough memory.\n");
announceexit("could not alloc enough memory");
exit(1);
}
- else strncpy(p, q, len-1);
+ else l = mystrncpy(p, q, len-1);
+ if (l != len-1) intern_err(1); /* alloc len l != len-1 */
return p;
}
#define HASFNTCH '@'
@@ -314,24 +373,24 @@ void licenseinfo(void)
void moreinfo(void)
{
- printf("%%%% -i=j Sorting of entries: I sort \'i\' as \'j\' (Prussian instructions).\n");
printf("%%%% -t1 You use [T1]{fontenc} and NO [...]{inputenc}: I sort ASCIIs > 127.\n");
printf("%%%% -m Write into files the meta arguments which I use to sort lines.\n");
- printf("%%%% \\printnumvkc etc. print your lists with an INDEX TO PAGES/FOOTNOTES:\n");
- printf("%%%% On default, OR with -s1 or -f1, I sort page and footnote numbers ALWAYS:\n");
- printf("%%%% * fnsymbol ** r/Roman * arabic ** a/Alph (z=26, aa=27, ab=28) * TEXT\n");
- printf("%%%% DEFAULT: *lower roman page numbers* are page numbers of introduction;\n");
- printf("%%%% *capital Alph page numbers* are page numbers of appendix;\n");
- printf("%%%% *lower alph footnote numbers* are footnote marks of minipages.\n");
- printf("%%%% Numbers, which I could not evaluate, are typed %sTEXT%s.\n", TEXTSYMBOPEN[0], TEXTSYMBCLOSE[0]);
- printf("%%%% -s1 Page style: EVALUATE capital Roman numbers before capital Alphs.\n");
- printf("%%%% -f1 Footnote style: EVALUATE lower roman numbers before lower alphs.\n");
- printf("%%%% NON-DEFAULT sorting order (with an evaluation affixed to that order):\n");
- printf("%%%% -s2 xxxx Page number style: -f2 xxxx Footnote mark style:\n");
- printf("%%%% xxxx is a permutation of 4 letters out of nRrAas in your order\n");
- printf("%%%% (a=alph, A=Alph, n=arabic, R=Roman, r=roman, s=fnsymbol);\n");
- printf("%%%% in xxxx, you (still) have to use n, s, R *or* A, and r *or* a.\n");
- printf("%%%% -c Numbers, which I could not evaluate, are typed %sTEXT%s.\n", TEXTSYMBOPEN[1], TEXTSYMBCLOSE[1]);
+ printf("%%%% -b If %s is in an arg, only text behind will have a sorting weight.\n", BAGOCMD);
+ printf("%%%% -n1 You reset fnt counters (no fnt-block-indexing over several pages).\n");
+ printf("%%%% INDEX TO PAGE AND FOOTNOTE NUMBERS (num-lists like \\printnumvkc):\n");
+ printf("%%%% (1) DEFAULT SORTING ORDER of page and footnote numbers:\n");
+ printf("%%%% fnsymbol r/Roman arabic a/Alph (z=26, aa=27, ab=28)\n");
+ printf("%%%% You may change the EVALUATION ORDER (r/Roman versus a/Alph):\n");
+ printf("%%%% / introduction = *lower roman page numbers*\n");
+ printf("%%%% DEFAULT < appendix = *capital Alph page numbers*\n");
+ printf("%%%% \\ minipages = *lower alph footnote numbers*\n");
+ printf("%%%% -s1 EVALUATE \'I\' as 1 in pages (intro Roman, appendix alph).\n");
+ printf("%%%% -f1 EVALUATE \'i\' as 1 in fnts (evaluate on roman before alph).\n");
+ printf("%%%% (2) NON-DEFAULT SORTING ORDER with an EVALUATION affixed to that order:\n");
+ printf("%%%% -s2 <xxxx> Page number style: -f2 <xxxx> Footnote mark style:\n");
+ printf("%%%% with a permutation of 4 letters out of nRrAas in free order\n");
+ printf("%%%% (a=alph, A=Alph, n=arabic, R=Roman, r=roman, s=fnsymbol);\n");
+ printf("%%%% but in <xxxx>, there must be n, s, and R *or* A, and r *or* a.\n");
printf("%%%%\n");
}
@@ -343,19 +402,19 @@ void maininfo(char *myname)
printf("%%%% %s Short titles %s Unpublished sources %s Person index\n", VKC_SUFFIX, ARQ_SUFFIX, PRR_SUFFIX);
printf("%%%% %s Periodicals %s Abbreviations %s Subject index\n", PER_SUFFIX, ABK_SUFFIX, SRR_SUFFIX);
printf("%%%%\n");
- printf("%%%% %s <LaTeXFile> [-o <OutFile>] [-g1/-g2] [-x] [-l] [-p] [-k] [-d]\n", getmyname(myname, 13));
+ printf("%%%% %s <LaTeXFile> [-o <OutFile>] [-g1 [OR] -g2] [<OtherOptions>]\n", getmyname(myname, 13));
printf("%%%%\n");
printf("%%%% DefaultSort: 0, .., 9, (A a), (B b), .., (s \\ss S), .., (Z z) and\n"); /* udtable */
printf("%%%% (a [\\.\\'\\`\\^\\\"\\=\\~]a \\aa=\\r{a} [\\b\\c\\k\\d\\H\\t\\u\\v]{a} \\ae), b, ..\n");
- printf("%%%% -g1/2 GermanSort: (a A), .., (z Z), 0, .., 9; and (\\\" or active \"):\n");
+ printf("%%%% -g<n> GermanSort: (a A), .., (z Z), 0, .., 9; and (\\\" or active \"):\n");
printf("%%%% -g1 GermanTelefonebookStyle: \"a = \\\"a = ae, ..., \"s = \\ss = ss;\n"); /* gweight */
printf("%%%% -g2 ModernGermanDictionary: \"a = \\\"a = a, ..., \"s = \\ss = ss.\n"); /* mweight */
- printf("%%%% -x DoNotExpectgerman.sty: Active \"-characters do NOT produce umlauts.\n");
- printf("%%%% -l Ignore spaces (leer). -p Sort \"P.S.\" before \"Peter\" (point).\n");
- printf("%%%% -k Idemize multiple used authors in the %s and %s lists (kill).\n", VLI_SUFFIX, VQU_SUFFIX);
- printf("%%%% -d Change your '/' with '\\' in paths on my %s files task list (dos).\n", AUX_SUFFIX);
- printf("%%%% -\?\? Read about options: -s1 -f1 -s2 xxxx -f2 xxxx -c -t1 -i=j -m\n");
- printf("%%%% -r Read informations about my license and documentation files.\n");
+ printf("%%%% -x DoNotExpect german.sty: Active \"-characters do NOT produce umlauts.\n");
+ printf("%%%% -k Idemize ~ multiple used authors in the %s and %s lists (kill).\n", VLI_SUFFIX, VQU_SUFFIX);
+ printf("%%%% -d \\include{ / is \\ } (dos). -h Sort a hyphen as a space.\n");
+ printf("%%%% -i=j Sort \'i\' as \'j\'. -p Sort \"P.S.\" before \"Peter\" (point).\n");
+ printf("%%%% -l Ignore spaces (leer). -c Don\'t set bad page/fnt nums in {}.\n"); /* TEXTSYMBOPEN[0], TEXTSYMBCLOSE[0] */
+ printf("%%%% -r Typeout license (read). -\?\? Further options.\n");
printf("%%%%\n");
}
@@ -363,6 +422,33 @@ void maininfo(char *myname)
/*--------------------------------------------------------------------------*/
+int isexactlcmd(const char *p, const char *s)
+{
+ while(*p == *s && *s != '\t' && *s != '\0' ) { ++p; ++s; }
+ if (*s == '\t' && isLaTeXcmdletter(*p) == 0) return 0;
+ return 1;
+}
+
+
+int num_of_cmds_in_str(const char *p, const char *s)
+{
+ int r = 0;
+
+ while (*p != '\0')
+ {
+ if (*p == '\\')
+ {
+ if (*(p+1) == '\\') ++p;
+ else
+ if (isexactlcmd(p, s) == 0) ++r;
+ }
+ ++p;
+ }
+
+ return r;
+}
+
+
int nextbracket(const char *p, const char opench, const char closech)
{
int c = 0, r = 0;
@@ -382,9 +468,32 @@ int nextbracket(const char *p, const char opench, const char closech)
}
-int artithmetic_overflow(const char *cc)
+int unshielded_cmds_in_str(const char *p, const char *s)
+{
+ int r = 0;
+
+ while (*p != '\0')
+ {
+ if (*p == '{') p += nextbracket(p, '{', '}') - 1;
+ else
+ if (*p == '\\')
+ {
+ if (*(p+1) == '\\') ++p;
+ else
+ if (*(p+1) == '{') ++p;
+ else
+ if (isexactlcmd(p, s) == 0) ++r;
+ }
+ ++p;
+ }
+
+ return r;
+}
+
+
+int artithmetic_overflow(const char *p, const char *cc)
{
- printf("%%%%\n%%%%> Warning: Arithmetic overflow num=%s.\n", cc);
+ printf("%%%%\n%%%%> Warning: Arithmetic overflow %s-eval \"%s\".\n", p, cc);
return INT_MAX;
}
@@ -402,7 +511,7 @@ int getarabicnum(const char *p)
while (*p >= '0' && *p <= '9' && num >= 0)
num = (10 * num) + (*p++ - '0');
- if (num < 0) num = artithmetic_overflow(mem);
+ if (num < 0) num = artithmetic_overflow("arabic", mem);
return num * vor;
}
@@ -442,7 +551,7 @@ int getLetterletternum(const char *p)
else break;
}
- if (num < 0) num = artithmetic_overflow(mem);
+ if (num < 0) num = artithmetic_overflow("a/Alph", mem);
return num * vor;
}
@@ -484,7 +593,7 @@ int getRomanromannum(const char *p)
++p;
}
- if (num < 0) num = artithmetic_overflow(mem);
+ if (num < 0) num = artithmetic_overflow("r/Roman", mem);
return num * vor;
}
@@ -688,7 +797,7 @@ int evalsymbol(int pg, const char *p, const int job)
p += len;
}
- if (num < 0) num = artithmetic_overflow(mem);
+ if (num < 0) num = artithmetic_overflow("fnsymbol", mem);
r = endnumberline(p, r);
@@ -1297,7 +1406,7 @@ int numcmp(const int pg, const int w, const char *p, const char *q)
else if (w == TEXT) j = igspstrcmp(p, q);
else if (w == MISSNUM) j = 0;
else if (w == OVERFLOW) j = 0;
- else printf("%%%%\n%%%%> INTERNAL ERROR: UNKNOWN PAGE-WEIGHT NUMBER\n");
+ else intern_err(2); /* UNKNOWN PAGE-WEIGHT NUMBER */
return j;
@@ -1489,92 +1598,760 @@ int ignFRONTSPACESgetline(char s[], int lim)
/*--------------------------------------------------------------------------*/
-void loesche_arg(char *s, char *p, const char *com, const int comlen, const char op, const char cl)
+int LaTeXcmp_endlen(const char *p, const char *s)
{
- int len;
- char *mem;
+ int len = 0;
+
+ while (*s != '\0' && *s != '\t' && *s == *p)
+ {
+ ++s; ++p; ++len;
+ }
+
+ if (*s == '\t' && isLaTeXcmdletter(*p) == 0)
+ {
+ while (*p == ' ') { ++p; ++len; }
+ }
+ else len = 0;
+
+ return len;
+}
+
+
+int loesche_arg(char s[], const char *p, const char *com, const char op, const char cl)
+{
+ int len, r = 0, reallen;
while (*p != '\0')
{
- if (strncmp(p, com, comlen) == 0)
+ if (*p == '\\')
{
- mem = p;
- p += comlen;
- while (*p == ' ') ++p;
- if (*p == op && (len = nextbracket(p, op, cl)) > 1) p += len;
+ if (*(p+1) == '\\')
+ {
+ s[r++] = *p++;
+ s[r++] = *p++;
+ }
+ else
+ if ((reallen = LaTeXcmp_endlen(p, com)) > 0)
+ {
+ p += reallen;
+
+ if (*p == '\0') break;
+
+ if (*p == op && (len = nextbracket(p, op, cl)) > 1)
+ {
+ p += len;
+ }
+ else
+ {
+ if (*p == '\\')
+ {
+ ++p;
+ if (isLaTeXcmdletter(*p) != 0)
+ {
+ while (isLaTeXcmdletter(*p) != 0) ++p;
+ while (*p == ' ') ++p;
+ }
+ else if (*p != '\0') ++p;
+ }
+ else
+ {
+ ++p; /* ungeklammerten Einzelbuchstaben loeschen */
+ }
+ }
+ }
else
- { p = mem;
- *s++ = *p++;
+ {
+ s[r++] = *p++;
}
}
- else *s++ = *p++;
+ else
+ {
+ s[r++] = *p++;
+ }
}
- *s = '\0';
+ s[r] = '\0';
+
+ return r;
}
-void entkerne_arg(char *s, const char *p, const char *com, const int comlen, const char op, const char cl)
+int entkerne_arg(char s[], const char *p, const char *com, const char op, const char cl)
{
- int l;
- const char *mem;
+ int l, r = 0, reallen;
while (*p != '\0')
{
- if (strncmp(p, com, comlen) == 0)
+ if (*p == '\\')
{
- mem = p;
- p += comlen;
- while (*p == ' ') ++p;
- if (*p == op && (l = nextbracket(p, op, cl)) > 1)
- {
- ++p;
- while (--l > 1) *s++ = *p++;
- ++p;
+ if (*(p+1) == '\\')
+ {
+ s[r++] = *p++;
+ s[r++] = *p++;
}
else
- { p = mem;
- *s++ = *p++;
+ if ((reallen = LaTeXcmp_endlen(p, com)) > 0)
+ {
+ p += reallen;
+
+ if (*p == '\0') break;
+
+ if (*p == op && (l = nextbracket(p, op, cl)) > 1)
+ {
+ ++p;
+ if (*p == ' ')
+ {
+ if (r > 1 && s[r-1] == ' ' && s[r-2] == ' ') --r;
+ s[r++] = '\\';
+ }
+ while (--l > 1) { s[r++] = *p++; }
+ ++p;
+ }
+ else
+ {
+ s[r++] = *p++;
+ }
+ }
+ else
+ {
+ s[r++] = *p++;
}
}
- else *s++ = *p++;
+ else
+ {
+ s[r++] = *p++;
+ }
}
- *s = '\0';
+ s[r] = '\0';
+
+ return r;
}
-#define ENTKERNEN 0
-#define LOESCHEN 1
+void print_not_tightly_err(const char *p, const char c)
+{
+ int len = strlen(p), sw = 0;
+
+ printf("%%%%\n%%%%> Warning: \'%c\' does not fit tightly after \"", c);
+
+ if (len > 2 && *(p+(len-1)) == c)
+ {
+ ++p; len -= 2;
+ }
-void killcmdarg(int i, int nlines, const char *cmd, int steuer)
+ while (len > 30) { --len; ++p; ++sw; }
+
+ if (sw > 0) printf("...");
+ printf("%.*s\".\n", len, p);
+}
+
+
+char *fillsubAptr(const char *p, int len, const char c)
{
- int l;
- const int cmdlen = strlen(cmd);
- char buf[MAXLEN];
+ char buf[MAXLEN];
+ int i;
+
+ ++p; len -= 2;
+ while (*p == ' ') { ++p; --len; }
+ strcpy(buf, p);
+
+ buf[len] = '\0';
+ if (len > 0 && buf[len-1] == ' ')
+ { i = 2;
+ while (len-i >= 0 && buf[len-i] == ' ') ++i;
+ while (len-i >= 0 && isLaTeXcmdletter(buf[len-i]) != 0) ++i;
+ if (len-i < 0 || buf[len-i] != '\\') print_not_tightly_err(buf, c);
+ }
+ while (len > 0 && buf[len-1] == ' ') --len;
+
+ return strnmalloc(buf, len+1);
+}
+
+
+int form_only(char buf[], char forml, const char *onlycmdp, const char *p)
+{
+ int len;
+
+ if (forml == 'l')
+ {
+ len = loesche_arg(buf, p, onlycmdp, '{', '}');
+ }
+ else
+ if (forml == 'e')
+ {
+ len = entkerne_arg(buf, p, onlycmdp, '{', '}');
+ }
+ else
+ {
+ strcpy(buf, p);
+ len = strlen(buf);
+ if (forml != 'X') intern_err(3); /* unexpected forml in khvo */
+ }
+
+ return len;
+}
+
+
+int innerentry(const char *p, const char *icmdlist[][2], const int num)
+{
+ int l = 0;
+
+ while (l < num)
+ {
+ if (LaTeXcmp_endlen(p, icmdlist[l][0]) > 0) break;
+ ++l;
+ }
+
+ if (l >= num) l = -1;
+ return l;
+}
+
+#define DELSTARARG '='
+#define DELNORMARG '_'
+
+int endofbracks(const char *p, const char fmt[])
+{
+ int l = 0, len = 0, pos;
+
+ while (1)
+ {
+ if (fmt[l] == '\0' || fmt[l+1] == '\0' || fmt[l+2] == '\0') break;
+
+ while (*p == ' ') { ++p; ++len; }
+ if (fmt[l] == '*' && *p != '*') { l += 3; continue; }
+ if (fmt[l] == '*' && *p == '*') { ++p; ++len; }
+ if (fmt[l] == DELSTARARG && *p != '*') { l += 3; continue; }
+ if (fmt[l] == DELSTARARG && *p == '*') { ++p; ++len; }
+ while (*p == ' ') { ++p; ++len; }
+
+ if ((pos=nextbracket(p, fmt[l+1], fmt[l+2])) > 1)
+ {
+ p += pos;
+ len += pos;
+ }
+
+ l += 3;
+ }
+
+ return len;
+}
+
+
+void maxprint(int len, const char *s)
+{
+ char buf[MAXLEN];
+ int buflen = entkerne_IeC(buf, s);
+
+ if (len > 4 && buflen > len) printf("%.*s....", len-4, buf);
+ else printf("%s", buf);
+}
+
+
+void printktiterr(const char *s)
+{
+ printf("%%%% ");
+ maxprint(72, s);
+ printf("\n");
+}
+
+
+ const char *innerVcmd[][2] = {
+ { "\\printonlyvli\t", "+[]_{}:{}*{}!{}" },
+ { "\\printonlyvqu\t", "+[]_{}:{}*{}!{}" },
+ { "\\xprintonlyvli\t", "+[]_{}:{}*{}!{}" },
+ { "\\xprintonlyvqu\t", "+[]_{}:{}*{}!{}" },
+ { "\\vli\t", "+[]_{}:{}*{}!{}" }, /* wegen der */
+ { "\\vqu\t", "+[]_{}:{}*{}!{}" }, /* Fehler- */
+ { "\\xvli\t", "+[]_{}:{}*{}!{}" }, /* behandlung */
+ { "\\xvqu\t", "+[]_{}:{}*{}!{}" }, /* von KTIT */
+ { "\\shadowv\t", "_[]_{}_{}={}_{}" },
+ { "\\addtovli\t", "_[]_{}_{}={}_{}" },
+ { "\\addtovqu\t", "_[]_{}_{}={}_{}" },
+ { "\\xaddtovli\t", "_[]_{}_{}={}_{}" },
+ { "\\xaddtovqu\t", "_[]_{}_{}={}_{}" },
+ { NULL, NULL }};
+ const char *exkv[] = {
+ "\\printonlykli",
+ "\\printonlykqu",
+ "\\xprintonlykli",
+ "\\xprintonlykqu",
+ "\\printonlykli",
+ "\\printonlykqu",
+ "\\xprintonlykli",
+ "\\xprintonlykqu",
+ "\\@shadowba{}",
+ "\\@shadowba{}",
+ "\\@shadowba{}",
+ "\\@shadowba{}",
+ "\\@shadowba{}",
+ NULL };
+#define XVNUM 8
+#define AVNUM 13
+
+
+void get_ktit(char s[], const char *p, const char *com, const char op, const char cl, const int line)
+{
+ int l, reallen, found = 0, r = 0, ll, llen, b = 0, shielded = 0;
+ char buf[MAXLEN], fub[MAXLEN];
+
+ while (*p != '\0')
+ {
+ if (*p == '{' && b > 0)
+ {
+ l = nextbracket(p, '{', '}');
+ ll = 0;
+ while (l-- > 0)
+ {
+ fub[ll++] = *p;
+ buf[b++] = *p++;
+ }
+ fub[ll] = '\0';
+ shielded += num_of_cmds_in_str(fub, com);
+ }
+ else
+ if (*p == '\\')
+ {
+ if (*(p+1) == '\\' || *(p+1) == '{')
+ {
+ buf[b++] = *p++; buf[b++] = *p++;
+ }
+ else
+ if ((ll=innerentry(p, innerVcmd, AVNUM)) > -1)
+ {
+ /* inneres v-cmd ueberspringen: dort darf weiteres \\ktit stehen */
+ llen = LaTeXcmp_endlen(p, innerVcmd[ll][0]);
+ p += llen;
+ llen = endofbracks(p, innerVcmd[ll][1]);
+ p += llen;
+ buf[b++] = '<'; buf[b++] = '#'; buf[b++] = '>';
+ }
+ else
+ if ((reallen = LaTeXcmp_endlen(p, com)) > 0)
+ {
+ while (reallen-- > 0) buf[b++] = *p++;
+ ++found;
+
+ if (*p == '\0') break;
+
+ if ((l = nextbracket(p, op, cl)) > 0)
+ {
+ r = 0; /* <= Copy only arg of last \\ktit */
+ if (l == 1)
+ {
+ s[r++] = op;
+ s[r++] = *p; buf[b++] = *p++;
+ s[r++] = cl;
+ }
+ else
+ if (l == 2 && *p == '\\' && *(p+1) != '\0')
+ {
+ if (isLaTeXcmdletter(*(p+1)) == 0);
+ else
+ while (isLaTeXcmdletter(*(p+l)) != 0) ++l;
+ s[r++] = op;
+ while (l-- > 0) { s[r++] = *p; buf[b++] = *p++; }
+ s[r++] = cl;
+ }
+ else
+ {
+ while (l-- > 0)
+ {
+ s[r++] = *p; buf[b++] = *p++;
+ }
+ }
+ }
+ }
+ else buf[b++] = *p++;
+ }
+ else buf[b++] = *p++;
+ }
+
+ s[r] = '\0';
+ buf[b] = '\0';
+
+
+ if (r == 0 || (s[0] == op && s[1] == cl) || (s[0] == op && s[1] == ' ' && s[2] == cl))
+ {
+ if ( strlen(KTITBEG)
+ + strlen(KTITSHA)
+ + strlen(KTITMISS)
+ + strlen(KTITEMPTY)
+ + strlen(KTITEND)
+ > MAXLEN-2
+ )
+ {
+ intern_err(29);
+ }
+ else
+ {
+ strcpy(s, KTITBEG);
+ printf("%%%%\n%%%%> ");
+
+ if (shielded > 0)
+ {
+ printf("Error: %d shadowed { %s } cmd(s), and ...\n%%%% ", shielded, KTIT);
+ strcat(s, KTITSHA);
+ }
+
+ if (found == 0)
+ {
+ printf("Error: Missing");
+ strcat(s, KTITMISS);
+ }
+ else
+ {
+ printf("Warning: Empty");
+ strcat(s, KTITEMPTY);
+ }
+
+ printf(" %s in last arg of *inner v-cmd* (%s-entry %d):\n", KTIT, AUX_SUFFIX, line);
+ printktiterr(buf);
+ strcat(s, KTITEND);
+ }
+ }
+
+ if (found > 1)
+ {
+ printf("%%%%\n%%%%> Warning: %s used %d times in *inner v-cmd* (%s-entry %d):\n", KTIT, found, AUX_SUFFIX, line);
+ printktiterr(buf);
+ }
+
+ if (r > 2 && s[r-1] == cl && s[r-2] == ' ')
+ {
+ l = 3;
+ while (r-l > 1 && s[r-l] == ' ') ++l;
+ while (r-l > 1 && isLaTeXcmdletter(s[r-l]) != 0) ++l;
+ if (s[r-l] != '\\') print_not_tightly_err(s, cl);
+ }
+}
+
+
+int get_add_ktit(const char *p, const int maxktit, const int argno, const int line, const int screen)
+{
+ int reallen, found = 0, ll, llen, b = 0;
+ char buf[MAXLEN];
+
+ while (*p != '\0')
+ {
+ if (*p == '\\')
+ {
+ if (*(p+1) == '\\')
+ {
+ buf[b++] = *p++; buf[b++] = *p++;
+ }
+ else
+ if ((ll=innerentry(p, innerVcmd, AVNUM)) > -1)
+ {
+ /* inneres v-cmd ueberspringen: dort darf weiteres \\ktit stehen */
+ llen = LaTeXcmp_endlen(p, innerVcmd[ll][0]);
+ p += llen;
+ llen = endofbracks(p, innerVcmd[ll][1]);
+ p += llen;
+ buf[b++] = '<'; buf[b++] = '#'; buf[b++] = '>';
+ }
+ else
+ if ((reallen = LaTeXcmp_endlen(p, KTITCMD)) > 0)
+ {
+ while (reallen-- > 0) buf[b++] = *p++;
+ ++found;
+ }
+ else buf[b++] = *p++;
+ }
+ else buf[b++] = *p++;
+ }
+
+ buf[b] = '\0';
+
+ if (screen == 1 && found > maxktit)
+ {
+ printf("%%%%\n%%%%> Warning: ");
+ if (maxktit == 1)
+ printf("%d %s too much", found-1, KTIT);
+ else printf("%d misplaced %s", found, KTIT);
+ printf(" in %s-file (entry %d, arg %d):\n", AUX_SUFFIX, line, argno);
+ printktiterr(buf);
+ }
+
+ return found;
+}
+
+
+void do_innerVstarArg(char ret[], const char *p)
+{
+ const char *starlist[][2] =
+ {
+ { "\\vauthor\t", ":{}:{}" },
+ { "\\midvauthor\t", ":{}:{}" },
+ { NULL, NULL }};
+ const char *exlist[] =
+ {
+ "\\kauthor",
+ "\\midkauthor",
+ NULL
+ };
+ #define VKNUM 2
+
+ int r = 0, l, len, end;
+
- if (cmdlen > 0)
+ strcpy(ret, p);
+
+ while (*p != '\0')
{
- while(i < nlines)
+ if (*p == '\\')
{
- if (steuer == LOESCHEN)
- loesche_arg(buf, lineptr[i], cmd, cmdlen, '{', '}');
+ if (*(p+1) == '\\')
+ {
+ p += 2; r += 2;
+ }
+ else
+ if ((l=innerentry(p, starlist, VKNUM)) > -1)
+ {
+ len = LaTeXcmp_endlen(p, starlist[l][0]);
+ p += len;
+ end = nextbracket(p, *(starlist[l][1]+1), *(starlist[l][1]+2));
+ if (end == 2 && *p == '\\' && *(p+1) != '\0')
+ {
+ if (isLaTeXcmdletter(*(p+1)) == 0);
+ else
+ while (isLaTeXcmdletter(*(p+end)) != 0) ++end;
+ }
+ p += end;
+ ret[r] = '\0';
+ strcat(ret, exlist[l]);
+ end = llstrlen(exlist[l]);
+ r += end;
+
+ while (*p == ' ') ++p;
+ end = nextbracket(p, *(starlist[l][1]+4), *(starlist[l][1]+5));
+ if (end == 1)
+ {
+ ret[r++] = *(starlist[l][1]+4);
+ ret[r++] = *p++;
+ ret[r++] = *(starlist[l][1]+5);
+ }
+ else
+ if (end == 2 && *p == '\\' && *(p+1) != '\0')
+ {
+ if (isLaTeXcmdletter(*(p+1)) == 0);
+ else
+ while (isLaTeXcmdletter(*(p+end)) != 0) ++end;
+ ret[r++] = *(starlist[l][1]+4);
+ while (end-- > 0) { ret[r++] = *p++; }
+ ret[r++] = *(starlist[l][1]+5);
+ while (*p == ' ') ++p;
+ }
+ else
+ {
+ while (end-- > 0)
+ {
+ ret[r++] = *p++;
+ }
+ }
+ ret[r] = '\0';
+ strcat(ret, p);
+ }
else
- if (steuer == ENTKERNEN)
- entkerne_arg(buf, lineptr[i], cmd, cmdlen, '{', '}');
+ {
+ ++p; ++r;
+ }
+ }
+ else
+ {
+ ++p; ++r;
+ }
+ }
+}
+
+
+int dobracks(char buf[], const char *p, const char fmt[], const int line)
+{
+ int l = 0, len = 0, pos;
+ char ibuf[MAXLEN], obuf[MAXLEN];
+
+ buf[0] = '\0';
- if ((l = strlen(buf)) != strlen(lineptr[i]))
+ while (1)
+ {
+ if (fmt[l] == '\0' || fmt[l+1] == '\0' || fmt[l+2] == '\0') break;
+
+ while (*p == ' ') { ++p; ++len; }
+ if (fmt[l] == '*' && *p != '*') { l += 3; continue; }
+ if (fmt[l] == '*' && *p == '*') { ++p; ++len; }
+ if (fmt[l] == DELSTARARG && *p != '*') { l += 3; continue; }
+ if (fmt[l] == DELSTARARG && *p == '*') { ++p; ++len; }
+ while (*p == ' ') { ++p; ++len; }
+
+ if ((pos=nextbracket(p, fmt[l+1], fmt[l+2])) > 1)
+ {
+ if (fmt[l] == '!')
{
- myfree(lineptr[i]);
- lineptr[i] = strnmalloc(buf, l+1);
+ mystrncpy(ibuf, p, pos);
+ get_ktit(obuf, ibuf, KTITCMD, KTITOP, KTITCL, line);
+ strcat(buf, obuf);
}
+ else
+ if (fmt[l] == '*' || fmt[l] == '+') /* +: \\vautkor => \\kauthor */
+ {
+ mystrncpy(ibuf, p, pos);
+ do_innerVstarArg(obuf, ibuf);
+ if (fmt[l] == '*')
+ strcat(buf, "*"); /* keep fmt[l] */
+ strcat(buf, obuf);
+ }
+ else
+ if (fmt[l] == DELNORMARG || fmt[l] == DELSTARARG)
+ ;
+ else
+ strncat(buf, p, pos);
+
+ p += pos;
+ len += pos;
+ }
- ++i;
+ l += 3;
+ }
+
+ return len;
+}
+
+
+int do_innercmd(char ret[], const char *p, const char *icmdlist[][2], const int num, const char *form)
+{
+ char buf[MAXLEN], cbuf[MAXLEN];
+ int r = 0, l, len, end;
+
+ strcpy(ret, p);
+
+ while (*p != '\0')
+ {
+ if (*p == '\\')
+ {
+ if (*(p+1) == '\\')
+ {
+ p += 2; r += 2;
+ }
+ else
+ if ((l=innerentry(p, icmdlist, num)) > -1)
+ {
+ len = LaTeXcmp_endlen(p, icmdlist[l][0]);
+ p += len; r += len;
+ end = endofbracks(p, icmdlist[l][1]);
+ mystrncpy(buf, p, end);
+ p += end;
+ end = do_only(cbuf, form, buf);
+ ret[r] = '\0';
+ strncat(ret, cbuf, end);
+ strcat(ret, p);
+ r += end;
+ }
+ else
+ {
+ ++p; ++r;
+ }
+ }
+ else
+ {
+ ++p; ++r;
+ }
+ }
+
+ return r;
+}
+
+
+int do_innerVcmd(char ret[], const char *p, const char *icmdlist[][2], const int num, const int line)
+{
+ char buf[MAXLEN], cbuf[MAXLEN];
+ const char *err = p;
+ int l, len, end, pos = 0;
+
+ strcpy(ret, p);
+
+ while (*p != '\0')
+ {
+ if (*p == '\\')
+ {
+ if (*(p+1) == '\\')
+ {
+ p += 2; pos += 2;
+ }
+ else
+ if ((l=innerentry(p, icmdlist, num)) > -1)
+ {
+ len = LaTeXcmp_endlen(p, icmdlist[l][0]);
+ p += len;
+ ret[pos] = '\0';
+ if (strlen(ret) + strlen(exkv[l]) < MAXLEN)
+ strcat(ret, exkv[l]); /* Exchange v-cmd => k-cmd; */
+ else { intern_err(4); break; }
+ pos += strlen(exkv[l]);
+ end = dobracks(buf, p, icmdlist[l][1], line);
+ p += end;
+ if (strlen(ret) + strlen(buf) < MAXLEN)
+ strcat(ret, buf);
+ else { intern_err(5); break; }
+ pos += strlen(buf);
+ if (strlen(ret) + strlen(p) < MAXLEN)
+ strcat(ret, p);
+ else { intern_err(6); break; }
+ }
+ else
+ {
+ ++p; ++pos;
+ }
+ }
+ else
+ {
+ ++p; ++pos;
}
}
+
+ return pos;
}
+int do_only(char ret[], const char form[], const char in[])
+{
+ int l = 0, len = 0;
+ char buf[MAXLEN];
+ const char *onlycmd[] = { "\\onlykurz\t",
+ "\\onlyhere\t",
+ "\\onlyvoll\t",
+ "\\onlyout\t",
+ NULL
+ };
+#define KHVONUM 4
+
+
+ if (form[0] == '\0' || strlen(form) != KHVONUM)
+ {
+ intern_err(7); /* len of khvo */
+ strcpy(ret, in);
+ len = strlen(ret);
+ }
+ else
+ {
+ len = form_only(buf, form[l], onlycmd[l], in);
+ ++l;
+ if (l == KHVONUM) strcpy(ret, buf);
+
+ while (l < KHVONUM)
+ {
+ len = form_only(ret, form[l], onlycmd[l], buf);
+ ++l;
+ if (l == KHVONUM) break;
+
+ len = form_only(buf, form[l], onlycmd[l], ret);
+ ++l;
+ if (l == KHVONUM) strcpy(ret, buf);
+ }
+ }
+
+ return len;
+}
+
/*--------------------------------------------------------------------------*/
@@ -1638,33 +2415,6 @@ int isLaTeXcmdletter(char a)
}
-char *fillsubAptr(const char *p, int len)
-{
- char buf[MAXLEN];
- int i;
-
- ++p; len -= 2;
- while (*p == ' ') { ++p; --len; }
- strcpy(buf, p);
-
- buf[len] = '\0';
- if (len > 0 && buf[len-1] == ' ')
- { i = 2;
- while (len-i >= 0 && buf[len-i] == ' ') ++i;
- while (len-i >= 0 && isLaTeXcmdletter(buf[len-i]) != 0) ++i;
- if (len-i < 0 || buf[len-i] != '\\')
- { printf("%%%%\n%%%%> Warning: %s does not fit tightly after ", CLOSEB);
- if (strlen(buf) > 30) printf("\"%.27s...", buf);
- else printf("\"%s", buf);
- printf("\".\n");
- }
- }
- while (len > 0 && buf[len-1] == ' ') --len;
-
- return strnmalloc(buf, len+1);
-}
-
-
char *setptrtofirstbracket(char *p)
{
while (*p != '\0')
@@ -1701,26 +2451,88 @@ void telldefault(int rest)
}
-char *makeAR(char *p, int lastline, int alllines, char bb, char eb, const char *ident, int linec, int i, char schalt)
+ const char *innerK_PER_ARQ_cmd[][2] = {
+ { "\\printonlykli\t", ":[]:{}*{}:{}" },
+ { "\\printonlykqu\t", ":[]:{}*{}:{}" },
+ { "\\xprintonlykli\t", ":[]:{}*{}:{}" },
+ { "\\xprintonlykqu\t", ":[]:{}*{}:{}" },
+ { "\\printonlyper\t", ":{}" },
+ { "\\printonlyarq\t", ":[]:{}:{}" },
+ { "\\printonlydefabk\t", ":{}:{}" },
+ { "\\printonlyabkdef\t", ":{}:{}" },
+ { "\\printonlyabk\t", ":{}" },
+ { NULL, NULL }};
+#define INNERTITLES 6
+#define XKPANUM 9
+
+
+int do_inneronly(char ret[], const char in[], const char *vf, const char *kpf)
{
- int len;
+ char buf[MAXLEN];
+ int len;
+
+ len = do_innercmd(buf, in, innerVcmd, XVNUM, vf); /* AVNUM unnecessary */
+ len = do_innercmd(ret, buf, innerK_PER_ARQ_cmd, XKPANUM, kpf);
+
+ return len;
+}
+
+
+char *makeAR(char *p, int cols, int rest, char bb, char eb, const char *ident, int linec, int i, char schalt, const char *formO, int ventry)
+{
+ int len, alen;
+ char ibuf[MAXLEN], cbuf[MAXLEN];
while (*p == ' ') ++p;
if (*p != bb)
- { printf("%%%%\n%%%%> %s error in arg %d: Missing \'%c\'.\n", ident, i+lastline, bb);
- telldefault(alllines-i);
+ { printf("%%%%\n%%%%> %s error in arg %d: Missing \'%c\'.\n", ident, i+cols, bb);
+ telldefault(rest-i);
return NULL;
}
else
{
if ((len = nextbracket(p, bb, eb)) < 0)
- { printf("%%%%\n%%%%> %s error in arg %d: Missing \'%c\' after \"%.*s\".\n", ident, i+lastline, eb, -len, p);
- telldefault(alllines-i);
+ { printf("%%%%\n%%%%> %s error in arg %d: Missing \'%c\' after \"%.*s\".\n", ident, i+cols, eb, -len, p);
+ telldefault(rest-i);
return NULL;
}
- if (schalt == 'A') subAptr[i][linec] = fillsubAptr(p, len);
+
+ if (schalt == 'A')
+ {
+ /* new in 2.2: Evaluate inner v-cmds in rest of v-cmds as k-cmds! */
+ if (ventry != IS_V && i == VCOLS-1)
+ {
+ /* alloc {li} or {qu} as 4th arg of k-cmds: */
+ alen = mystrncpy(cbuf, p, len);
+ }
+ else
+ {
+ mystrncpy(cbuf, p, len);
+ alen = do_inneronly(ibuf, cbuf, "eell", "leel");
+ alen = do_only(cbuf, formO, ibuf);
+
+ if (ventry == IS_V && i == VCOLS-1)
+ {
+ alen = do_innerVcmd(ibuf, cbuf, innerVcmd, AVNUM, linec+1);
+ strcpy(cbuf, ibuf);
+ get_add_ktit(cbuf, 1, i+cols, linec+1, 1); /* Rest v-cmd: Ein \\ktit erlaubt */
+ }
+ else
+ {
+ if(get_add_ktit(cbuf, 0, i+cols, linec+1, 1) > 0) /* sonst (auch andere Args v-cmd) */
+ { /* get_add_ktit schreibt Fehler!! */
+ if (otherktiterr < i+1) otherktiterr = i+1;
+ }
+ }
+ }
+
+ subAptr[i][linec] = fillsubAptr(cbuf, alen, eb);
+ }
+ else
if (schalt == 'R') subRptr[i][linec] = strnmalloc(p+1, len-1);
+ else intern_err(8); /* INTERNAL ERROR (A, R) */
+
p += len;
}
@@ -1854,7 +2666,7 @@ void set_inner_number_on_subRptr(char *p, int len, int col, int line, int start)
}
-void getbrackets(int linec, int alllines, const char *ident, int deep, int filenum)
+void getbrackets(int linec, int alllines, const char *ident, int deep, int filenum, const char *formO, int ventry)
{
char *p, buf[MAXLEN];
int len, i;
@@ -1872,7 +2684,7 @@ void getbrackets(int linec, int alllines, const char *ident, int deep, int filen
i = 0;
while (i < deep)
{
- if ((p = makeAR(p, 1, deep+BARESTCOLS, '{', '}', ident, linec, i, 'A')) == NULL)
+ if ((p = makeAR(p, 1, deep+BARESTCOLS, '{', '}', ident, linec, i, 'A', formO, ventry)) == NULL)
{
leval[linec] = REJECTLINE;
break;
@@ -1885,7 +2697,7 @@ void getbrackets(int linec, int alllines, const char *ident, int deep, int filen
i = 0;
while (i < BARESTCOLS)
{
- if ((p = makeAR(p, BARESTCOLS, BARESTCOLS, bareststr[2*i], bareststr[2*i+1], ident, linec, i, 'R')) == NULL)
+ if ((p = makeAR(p, BARESTCOLS, BARESTCOLS, bareststr[2*i], bareststr[2*i+1], ident, linec, i, 'R', "", ventry)) == NULL)
{
leval[linec] = REJECTLINE;
break;
@@ -2008,11 +2820,16 @@ const char *weighttable[][2] = {
{ "\\breve\t", "" },
{ "\\v\t", "" }, /* CTL+U */
{ "\\check\t", "" },
- { "\\underline\t", "" }, /* CTL+V */
- { "\\underbar\t", "" }, /* CTL+W */
- { "\\ul\t", "" }, /* CTL+W */
+ { "\\st\t", "" }, /* CTL+V */ /* NEW in 2.2 */
+ { "\\textst\t", "" }, /* NEW in 2.2 */
+ { "\\underline\t", "" }, /* CTL+W */ /* CHANGED in 2.2 */
+ { "\\underbar\t", "" },
+ { "\\ul\t", "" },
+ { "\\textul\t", "" }, /* NEW in 2.2 */
{ "\\,", " " },
{ "\\space\t", " " },
+ { "\\pteskip\t", " " }, /* 1\te 000 NEW in 2.2 */
+ { "\\te\t", ". " }, /* != 1000 NEW in 2.2 */
{ "\\i\t", "i" },
{ "\\imath\t", "i" },
{ "\\j\t", "j" },
@@ -2109,7 +2926,7 @@ const char *weighttable[][2] = {
{ "\\zeta\t", "z" },
{ "\\Zeta\t", "Z" }, /* bibarts.sty; new in 2.1 */
{ NULL, NULL }};
-#define NLATEX 130
+#define NLATEX 135
const char *udtable[][2] = {
@@ -2123,10 +2940,43 @@ const char *udtable[][2] = {
{ "\\SS\t", "SS" }, /* \SS */
{ "\\sz\t", "s" }, /* \sz */ /* new in 2.1 */
{ "\\SZ\t", "S" }, /* \SZ */ /* new in 2.1 */
+ { "\\flqq\t", "" }, /* \flqq */ /* new in 2.2 */
+ { "\\frqq\t", "" }, /* \frqq */ /* new in 2.2 */
+ { "\\glqq\t", "" }, /* \glqq */ /* new in 2.2 */
+ { "\\grqq\t", "" }, /* \grqq */ /* new in 2.2 */
+ { "\\/", "" }, /* \/ */ /* new in 2.2 */
+ { "\\-", "" }, /* \- */ /* new in 2.2 */
+ { "\\oldhyc\t", "c" }, /* [c-] */ /* \ */
+ { "\\OLDHYC\t", "C" }, /* [C-] */ /* | */
+ { "\\oldhyl\t", "l" }, /* [l-] */ /* | */
+ { "\\OLDHYL\t", "L" }, /* [L-] */ /* | */
+ { "\\oldhym\t", "m" }, /* [m-] */ /* | */
+ { "\\OLDHYM\t", "M" }, /* [M-] */ /* | */
+ { "\\oldhyn\t", "n" }, /* [n-] */ /* | new */
+ { "\\OLDHYN\t", "N" }, /* [N-] */ /* | in */
+ { "\\oldhyp\t", "p" }, /* [p-] */ /* | 2.2 */
+ { "\\OLDHYP\t", "P" }, /* [P-] */ /* | */
+ { "\\oldhyr\t", "r" }, /* [r-] */ /* | */
+ { "\\OLDHYR\t", "R" }, /* [R-] */ /* | */
+ { "\\oldhyt\t", "t" }, /* [t-] */ /* | */
+ { "\\OLDHYT\t", "T" }, /* [T-] */ /* | */
+ { "\\oldhyf\t", "f" }, /* [f-] */ /* | */
+ { "\\OLDHYF\t", "F" }, /* [F-] */ /* / */
+ { "\\hy\t", "-" }, /* MINUS \hy */ /* new in 2.2 */
+ { "\\fhy\t", "-" }, /* MINUS \fhy*/ /* new in 2.2 */
{ "\\\"", "" }, /* / \" */
{ "\\3", "s" }, /* \3 */
+ { "\\ck\t", "ck" }, /* [c-k] */ /* new in 2.2 */
+ { "\\CK\t", "CK" }, /* [C-K] */ /* new in 2.2 */
+ { "\\oldhyss\t", "s" }, /* [s-s] */ /* \ */
+ { "\\OLDHYSS\t", "SS" }, /* [S-S] */ /* | new */
+ { "\\newhyss\t", "s" }, /* [-ss] */ /* | in */
+ { "\\NEWHYSS\t", "SS" }, /* [-SS] */ /* | 2.2 */
+ { "\\hyss\t", "s" }, /* [s-s/-ss] */ /* | */
+ { "\\HYSS\t", "SS" }, /* [S-S/-SS] */ /* / */
{ NULL, NULL }};
-#define NUMTEX 12
+#define NUMTEX 44
+
const char *gstylist[][2] = {
{ "\"a", NULL }, /* \ "a */
@@ -2139,26 +2989,83 @@ const char *gstylist[][2] = {
{ "\"S", NULL }, /* "S */
{ "\"z", NULL }, /* "z */ /* new in 2.1 */
{ "\"Z", NULL }, /* "Z */ /* new in 2.1 */
+ { "\"<", NULL }, /* "` */ /* new in 2.2 */
+ { "\">", NULL }, /* "' */ /* new in 2.2 */
+ { "\"`", NULL }, /* "` */ /* new in 2.2 */
+ { "\"\'", NULL }, /* "' */ /* new in 2.2 */
+ { "\"|", NULL }, /* "| */ /* new in 2.2 */
+ { "\"-", NULL }, /* "- */ /* new in 2.2 */
+ { "\"c", NULL }, /* [c-] */ /* \ */
+ { "\"C", NULL }, /* [C-] */ /* | */
+ { "\"l", NULL }, /* [l-] */ /* | */
+ { "\"L", NULL }, /* [L-] */ /* | */
+ { "\"m", NULL }, /* [m-] */ /* | */
+ { "\"M", NULL }, /* [M-] */ /* | */
+ { "\"n", NULL }, /* [n-] */ /* | new */
+ { "\"N", NULL }, /* [N-] */ /* | in */
+ { "\"p", NULL }, /* [p-] */ /* | 2.2 */
+ { "\"P", NULL }, /* [P-] */ /* | */
+ { "\"r", NULL }, /* [r-] */ /* | */
+ { "\"R", NULL }, /* [R-] */ /* | */
+ { "\"t", NULL }, /* [t-] */ /* | */
+ { "\"T", NULL }, /* [T-] */ /* | */
+ { "\"f", NULL }, /* [f-] */ /* | */
+ { "\"F", NULL }, /* [F-] */ /* | */
+ { "\"=", NULL }, /* MINUS "= */ /* new in 2.2 */
+ { "\"~", NULL }, /* MINUS "~ */ /* new in 2.2 */
{ "\"", NULL }, /* / " */
{ NULL, NULL }};
-#define NUMGER 11
+#define NUMGER 35
const char *gweight[][2] = {
- { NULL, "ae" }, /* \ \"a "a */
- { NULL, "oe" }, /* | \"o "o */
- { NULL, "ue" }, /* CTL+E \"u "u */
- { NULL, "Ae" }, /* | \"A "A */
- { NULL, "Oe" }, /* | \"O "O */
- { NULL, "Ue" }, /* | \"U "U */
- { NULL, "ss" }, /* \ss "s */
- { NULL, "SS" }, /* \SS "S */
- { NULL, "ss" }, /* \sz "z */ /* new in 2.1 */
- { NULL, "SS" }, /* \SZ "Z */ /* new in 2.1 */
- { NULL, "" }, /* / \" " */
- { NULL, "ss" }, /* \3 [] */
+ { NULL, "ae" }, /* \ \"a "a */
+ { NULL, "oe" }, /* | \"o "o */
+ { NULL, "ue" }, /* CTL+E \"u "u */
+ { NULL, "Ae" }, /* | \"A "A */
+ { NULL, "Oe" }, /* | \"O "O */
+ { NULL, "Ue" }, /* | \"U "U */
+ { NULL, "ss" }, /* \ss "s */
+ { NULL, "SS" }, /* \SS "S */
+ { NULL, "ss" }, /* \sz "z */ /* new in 2.1 */
+ { NULL, "SS" }, /* \SZ "Z */ /* new in 2.1 */
+ { NULL, "" }, /* \flqq "< */ /* new in 2.2 */
+ { NULL, "" }, /* \frqq "> */ /* new in 2.2 */
+ { NULL, "" }, /* \glqq "` */ /* new in 2.2 */
+ { NULL, "" }, /* \grqq "' */ /* new in 2.2 */
+ { NULL, "" }, /* \/ "| */ /* new in 2.2 */
+ { NULL, "" }, /* \- "- */ /* new in 2.2 */
+ { NULL, "c" }, /* [c-] "c */ /* \ */
+ { NULL, "C" }, /* [C-] "C */ /* | */
+ { NULL, "l" }, /* [l-] "l */ /* | */
+ { NULL, "L" }, /* [L-] "L */ /* | */
+ { NULL, "m" }, /* [m-] "m */ /* | */
+ { NULL, "M" }, /* [M-] "M */ /* | */
+ { NULL, "n" }, /* [n-] "n */ /* | new */
+ { NULL, "N" }, /* [N-] "N */ /* | in */
+ { NULL, "p" }, /* [p-] "p */ /* | 2.2 */
+ { NULL, "P" }, /* [P-] "P */ /* | */
+ { NULL, "r" }, /* [r-] "r */ /* | */
+ { NULL, "R" }, /* [R-] "R */ /* | */
+ { NULL, "t" }, /* [t-] "t */ /* | */
+ { NULL, "T" }, /* [T-] "T */ /* | */
+ { NULL, "f" }, /* [f-] "f */ /* | */
+ { NULL, "F" }, /* [F-] "F */ /* / */
+ { NULL, "-" }, /* MINUS \hy "= */ /* new in 2.2 */
+ { NULL, "-" }, /* MINUS \fhy "~ */ /* new in 2.2 */
+ { NULL, "" }, /* / \" " */
+ { NULL, "ss" }, /* \3 [] */
+ { NULL, "ck" }, /* \ck */ /* new in 2.2 */
+ { NULL, "CK" }, /* \CK */ /* new in 2.2 */
+ { NULL, "ss" }, /* [s-s] */ /* \ */
+ { NULL, "SS" }, /* [S-S] */ /* | new */
+ { NULL, "ss" }, /* [-ss] */ /* | in */
+ { NULL, "SS" }, /* [-SS] */ /* | 2.2 */
+ { NULL, "ss" }, /* [s-s/-ss] */ /* | */
+ { NULL, "SS" }, /* [S-S/-SS] */ /* / */
{ NULL, NULL }};
+
const char *mweight[][2] = {
{ NULL, "a" }, /* \ \"a "a */
{ NULL, "o" }, /* | \"o "o */
@@ -2170,8 +3077,40 @@ const char *mweight[][2] = {
{ NULL, "SS" }, /* \SS "S */
{ NULL, "ss" }, /* \sz "z */ /* new in 2.1 */
{ NULL, "SS" }, /* \SZ "Z */ /* new in 2.1 */
+ { NULL, "" }, /* \flqq "< */ /* new in 2.2 */
+ { NULL, "" }, /* \frqq "> */ /* new in 2.2 */
+ { NULL, "" }, /* \glqq "` */ /* new in 2.2 */
+ { NULL, "" }, /* \grqq "' */ /* new in 2.2 */
+ { NULL, "" }, /* \/ "| */ /* new in 2.2 */
+ { NULL, "" }, /* \- "- */ /* new in 2.2 */
+ { NULL, "c" }, /* [c-] "c */ /* \ */
+ { NULL, "C" }, /* [C-] "C */ /* | */
+ { NULL, "l" }, /* [l-] "l */ /* | */
+ { NULL, "L" }, /* [L-] "L */ /* | */
+ { NULL, "m" }, /* [m-] "m */ /* | */
+ { NULL, "M" }, /* [M-] "M */ /* | */
+ { NULL, "n" }, /* [n-] "n */ /* | new */
+ { NULL, "N" }, /* [N-] "N */ /* | in */
+ { NULL, "p" }, /* [p-] "p */ /* | 2.2 */
+ { NULL, "P" }, /* [P-] "P */ /* | */
+ { NULL, "r" }, /* [r-] "r */ /* | */
+ { NULL, "R" }, /* [R-] "R */ /* | */
+ { NULL, "t" }, /* [t-] "t */ /* | */
+ { NULL, "T" }, /* [T-] "T */ /* | */
+ { NULL, "f" }, /* [f-] "f */ /* | */
+ { NULL, "F" }, /* [F-] "F */ /* / */
+ { NULL, "-" }, /* \hy "= */ /* new in 2.2 */
+ { NULL, "-" }, /* \fhy "~ */ /* new in 2.2 */
{ NULL, "" }, /* / \" " */
{ NULL, "ss" }, /* \3 [] */
+ { NULL, "ck" }, /* \ck */ /* new in 2.2 */
+ { NULL, "CK" }, /* \CK */ /* new in 2.2 */
+ { NULL, "ss" }, /* [s-s] */ /* \ */
+ { NULL, "SS" }, /* [S-S] */ /* | new */
+ { NULL, "ss" }, /* [-ss] */ /* | in */
+ { NULL, "SS" }, /* [-SS] */ /* | 2.2 */
+ { NULL, "ss" }, /* [s-s/-ss] */ /* | */
+ { NULL, "SS" }, /* [S-S/-SS] */ /* / */
{ NULL, NULL }};
@@ -2233,6 +3172,14 @@ int insertweight(char in[], int i, int pos, int max)
}
+int nichtvorziehen(char a)
+{
+ if (issonder(a) == 1 && a != '')
+ return 1; /* 31 */
+ return 0;
+}
+
+
void nzvorziehen(char in[], char *p)
{
int pos = 0, l;
@@ -2240,10 +3187,10 @@ void nzvorziehen(char in[], char *p)
while (*p != '\0')
{
- if (issonder(*p) == 1)
+ if (nichtvorziehen(*p) == 1)
{
l = pos;
- while (issonder(*p) == 1) in[l++] = *p++;
+ while (nichtvorziehen(*p) == 1) in[l++] = *p++;
mem = in[l-1];
in[l-1] = in[pos];
in[pos] = mem;
@@ -2261,7 +3208,7 @@ char *austauschen(char in[], char *p, int dqcat)
while (*p != '\0' && pos < MAXLEN-1)
{
- if (*p == '\\')
+ if (*p == '\\') /* "\\\\" ist schon ' ' */
{
if ((i=texlistnum(p, NUMTEX, udtable)) > -1)
{ p += (len=llstrlen( udtable[i][0]));
@@ -2273,6 +3220,7 @@ char *austauschen(char in[], char *p, int dqcat)
pos = insposmaxstr(in, weighttable[i][1], pos, MAXLEN-1);
p = overspacesafterlettercmd(len, weighttable[i][0], p);
}
+ else if (*(p+1) == '~') p += 2; /* falls \~ nicht in weighttable */
else if (isLaTeXcmdletter(*(p+1)) != 0)
{ ++p; while (isLaTeXcmdletter(*p) != 0) ++p;
while (*p == ' ') ++p;
@@ -2286,10 +3234,11 @@ char *austauschen(char in[], char *p, int dqcat)
else
if (*p == '\"' && dqcat == TeXACTIVE) /* nogsty == 0 */
{
- if (*(p+1) == '\"') p += 2;
- else if ((i=texlistnum(p, NUMGER, gstylist)) > -1)
- { p += llstrlen( gstylist[i][0]);
- pos = insertweight(in, i, pos, MAXLEN-1);
+ if (*(p+1) == '\"') p += 2; /* "" ist nicht in gstylist */
+ else /* "~ muss in gstylist sein */
+ if ((i=texlistnum(p, NUMGER, gstylist)) > -1)
+ { p += llstrlen( gstylist[i][0]);
+ pos = insertweight(in, i, pos, MAXLEN-1);
}
else
{
@@ -2297,7 +3246,7 @@ char *austauschen(char in[], char *p, int dqcat)
++p;
}
}
- else if (*p == '~') /* nur zusammen mit MARK_TILDE */
+ else if (*p == '~') /* MARK_TILDE */
{
in[pos++] = ' ';
++p;
@@ -2535,10 +3484,15 @@ const char *transformtable[][2] = {
{ "\\parbox\t", "[]{}" },
{ "\\raisebox\t", "{}[][]" },
{ "\\rule\t", "[]{}{}" },
- { "\\printonlyvqu\t", "[]{}{}*{}{}" },
- { "\\printonlyvli\t", "[]{}{}*{}{}" },
- { "\\xprintonlyvqu\t", "[]{}{}*{}{}" },
- { "\\xprintonlyvli\t", "[]{}{}*{}{}" },
+ { "\\printonlyvqu\t", "[]{}{}*{}{}" }, /* innerVcmd */
+ { "\\vqu\t", "[]{}{}*{}{}" },
+ { "\\printonlyvli\t", "[]{}{}*{}{}" }, /* olny */
+ { "\\vli\t", "[]{}{}*{}{}" },
+ { "\\xprintonlyvqu\t", "[]{}{}*{}{}" }, /* changes */
+ { "\\xvqu\t", "[]{}{}*{}{}" },
+ { "\\xprintonlyvli\t", "[]{}{}*{}{}" }, /* IS_V */
+ { "\\xvli\t", "[]{}{}*{}{}" },
+ { "\\@shadowba\t", "{}" }, /* new. in 2.2 */
{ "\\shadowv\t", "[]{}{}{}{}" },
{ "\\addtovli\t", "[]{}{}{}{}" },
{ "\\addtovqu\t", "[]{}{}{}{}" },
@@ -2558,11 +3512,12 @@ const char *transformtable[][2] = {
{ "\\midvauthor\t", "{}{}" },
{ "\\kauthor\t", "{}" },
{ "\\midkauthor\t", "{}" },
- { "\\begin\t", "{}" },
- { "\\end\t", "{}" },
{ "\\ersch\t", "{}[]{}{}" },
{ "\\persch\t", "{}[]{}{}" },
{ "\\printonlyper\t", "{}" },
+ { "\\printonlyarq\t", "[]{}{}" }, /* new in 2.2 */
+ { "\\printonlydefabk\t", "{}{}" }, /* new in 2.2 */
+ { "\\printonlyabkdef\t", "{}{}" }, /* new in 2.2 */
{ "\\shadowo\t", "{}" },
{ "\\addtoper\t", "{}" },
{ "\\shadowt\t", "{}{}" },
@@ -2598,10 +3553,13 @@ const char *transformtable[][2] = {
{ "\\pxbibref\t", "{}" }, /* bearbeiten! */
{ "\\pbibmark\t", "{}" },
{ "\\bibmark\t", "{}" },
- { "\\outkurz\t", "{}" },
+ { KURZCMD, "{}" },
{ "\\delkurz\t", "{}" },
+ { "\\begin\t", "{}" },
+ { "\\end\t", "{}" },
+ { "\\pfordinal\t", "{}" }, /* new in 2.2 */
{ NULL, NULL }};
-#define NUMTRANSV 90
+#define NUMTRANSV 99
/* Muessen im Bereich von issonder liegen: */
@@ -2615,7 +3573,7 @@ char *bracketsformward(char *q, char c)
if (c == '}') *q = WINGBR;
else if (c == ']') *q = ANGUBR;
else if (c == ')') *q = ROUNDBR;
- else printf("%%%%\n%%%%> INTERNAL ERROR: BRACKETS LOST\n");
+ else intern_err(9); /* BRACKETS LOST */
return q;
}
@@ -2640,7 +3598,7 @@ void exchange_v(char *p, const char *bra, int num)
k = 0; while (k < i) *anf++ = buf[k++];
}
}
- else printf("%%%%\n%%%%> INTERNAL ERROR: No formatter Strg+Q after Strg+P\n");
+ else intern_err(10); /* No formatter Strg+Q after Strg+P */
}
}
@@ -2779,7 +3737,7 @@ void transformline(char buf[], char *p)
if (*p == WINGBR) buf[pos++] = '}';
else if (*p == ANGUBR) buf[pos++] = ']';
else if (*p == ROUNDBR) buf[pos++] = ')';
- else printf("%%%%\n%%%%> INTERNAL ERROR: unknown bracket symbol\n");
+ else intern_err(11); /* unknown bracket symbol */
buf[pos++] = ' ';
}
++p;
@@ -2802,6 +3760,39 @@ void nosondercpy(char *s, const char *p)
}
+const char *overbago(const char *s)
+{
+ const char *p = s;
+ int got = 0;
+
+ if (bago > 0)
+ {
+ while (*p != '\0')
+ {
+ if (*p == '\\')
+ {
+ if (*(p+1) == '\\')
+ {
+ ++p;
+ }
+ else
+ if (lcmdcmp(p, BAGOCMD) == 0)
+ {
+ p+=strlen(BAGOCMD);
+ while (*p == ' ') ++p;
+ got = 1;
+ break;
+ }
+ }
+ ++p;
+ }
+ }
+
+ if (got == 0) return s;
+ return p;
+}
+
+
void vorbereiten(int linec, int alllines, int deepsort, int ventry)
{
char *p, in[MAXLEN], out[MAXLEN], num[2*NUMLEN], last, buf[MAXLEN];
@@ -2818,23 +3809,37 @@ void vorbereiten(int linec, int alllines, int deepsort, int ventry)
i = 0;
while (i < deepsort)
{
- nosondercpy ( in, subAptr[i][linec]);
+ nosondercpy ( in, overbago(subAptr[i][linec]));
transformline(buf, in); /* veraendert zweites Arg! */
erweitert ( in, buf);
p = austauschen(buf, in, dqsort[linec]);
+
+
pos = 0; last = '\0';
while (*p != '\0' && pos < MAXLEN-1)
{
if ( isalpha (*p) != 0
|| issonder(*p) == 1
- || (*p == ' ')
+ || *p == ' '
+ || *p == '-'
|| (*p == '.' && registpoints == 1) /* nur zusammen mit MARK_POINT */
)
{
if (*p == ' ' && ignorespaces == 1)
- out[pos] = ''; /* 31 */ /* "" */
- else out[pos] = *p;
- ++pos;
+ {
+ if (pos > 0 && out[pos-1] == '') --pos;
+ out[pos] = ''; /* 31 */
+ }
+ else
+ if (*p == '-') /* MINUS */
+ {
+ out[pos] = ''; /* 31 */
+ if (hy_as_space == 1 && pos < MAXLEN-2)
+ out[++pos] = ' ';
+ }
+ else out[pos] = *p;
+
+ ++pos;
}
else
if (isdigit(*p) != 0 && last != '\\')
@@ -2845,6 +3850,7 @@ void vorbereiten(int linec, int alllines, int deepsort, int ventry)
pos = strlen(out);
--p;
}
+
last = *p;
++p;
}
@@ -2854,7 +3860,7 @@ void vorbereiten(int linec, int alllines, int deepsort, int ventry)
kill_unnecessary_spaces(in, out);
nzvorziehen(out, in);
-
+
subBptr[i][linec] = strnmalloc(out, strlen(out)+1);
pos = 0;
@@ -3042,17 +4048,15 @@ void getfirsttwoargs(char *s, const char *p)
}
-int spacebreak(int cloop)
+int baidxloop(int cloop, const char *p)
{
+ cloop += fprintf(outfile, "%s", p);
- fprintf(outfile, "%s", BALOOPSPACE);
-
- if (cloop >= BAINDEXLOOPS)
+ if (cloop > BAINDEXLEN)
{
- fprintf(outfile, "%s", BAINDEXEND);
- cloop = 0;
- fprintf(outfile, "%s", BAINDEXFOLL);
- ++cloop;
+ fprintf(outfile, "%s", BAINDEXEND);
+ fprintf(outfile, "%s", BAINDEXFOLL); /* neustart cloop */
+ cloop = CLOOPBSTART;
}
return cloop;
@@ -3075,53 +4079,75 @@ int printipagefnt(const char *arraysep, int begin, int end, int lasti, int cloop
&& numcmp(1, pagewgt[begin], subRptr[PAGECOL][lasti], subRptr[PAGECOL][begin]) == 0
)
{
- fprintf(outfile, "$^{,}$");
- cloop = spacebreak(cloop);
+ cloop += fprintf(outfile, "$^{,}$");
+ cloop = baidxloop(cloop, BS_SPACE);
}
else
{
- fprintf(outfile, "%s", arraysep);
- if (pagewgt[begin] == MISSNUM) fprintf(outfile, "{%s}", MISSINGSYMB);
- else if (pagewgt[begin] == EMPTYNUM) fprintf(outfile, "%s", EMPTYSYMB);
- else if (pagewgt[begin] == OVERFLOW) fprintf(outfile, "%s", OVERFLOWSYMB);
- else if (pagewgt[begin] == INTERNALERR) printf("%%%%\n%%%%> INTERNAL ERROR: Bad pageno\n");
- else if (pagewgt[begin] == UNUSED) printf("%%%%\n%%%%> INTERNAL ERROR: Unused pageno\n");
- else if (pagewgt[begin] == TEXT) fprintf(outfile, "%s%s%s", TEXTSYMBOPEN[notext], subRptr[PAGECOL][begin], TEXTSYMBCLOSE[notext]);
- else fprintf(outfile, "%s", subRptr[PAGECOL][begin]);
+ cloop = baidxloop(cloop, arraysep);
+ if (pagewgt[begin] == MISSNUM) cloop += fprintf(outfile, "{%s}", MISSINGSYMB);
+ else if (pagewgt[begin] == EMPTYNUM) cloop += fprintf(outfile, "%s", EMPTYSYMB);
+ else if (pagewgt[begin] == OVERFLOW) cloop += fprintf(outfile, "%s", OVERFLOWSYMB);
+ else if (pagewgt[begin] == INTERNALERR) intern_err(12); /* Bad pageno */
+ else if (pagewgt[begin] == UNUSED) intern_err(13); /* Unused pageno */
+ else if (pagewgt[begin] == TEXT) cloop += fprintf(outfile, "%s%s%s", TEXTSYMBOPEN[notext], subRptr[PAGECOL][begin], TEXTSYMBCLOSE[notext]);
+ else cloop += fprintf(outfile, "%s", subRptr[PAGECOL][begin]);
}
if (end > begin)
{
fnc = numcmp(0, fntwgt[begin], subRptr[FNTCOL][end], subRptr[FNTCOL][begin]);
pnc = numcmp(1, pagewgt[begin], subRptr[PAGECOL][end], subRptr[PAGECOL][begin]);
+
if (fnc == 1)
{
- if (pnc > 0) fprintf(outfile, "$^{%s}$,", subRptr[FNTCOL][begin]);
- else fprintf(outfile, "$^{%s}$$^{,}$", subRptr[FNTCOL][begin]);
- cloop = spacebreak(cloop);
- if (pnc > 0) fprintf(outfile, "%s$^{", subRptr[PAGECOL][end]);
- else fprintf(outfile, "$^{");
+ if (pnc > 0)
+ {
+ cloop += fprintf(outfile, "$^{%s}$", subRptr[FNTCOL][begin]);
+ cloop = baidxloop(cloop, BANCOMMA);
+ }
+ else
+ {
+ cloop += fprintf(outfile, "$^{%s}$$^{,}$", subRptr[FNTCOL][begin]);
+ cloop = baidxloop(cloop, BS_SPACE);
+ }
+
+ if (pnc > 0)
+ {
+ cloop += fprintf(outfile, "%s$^{", subRptr[PAGECOL][end]);
+ }
+ else
+ {
+ cloop += fprintf(outfile, "$^{");
+ }
}
else
if (fnc > 1)
{
- if (pnc > 0) fprintf(outfile, "$^{%s}$--%s%s$^{", subRptr[FNTCOL][begin], negnum(subRptr[PAGECOL][end]), subRptr[PAGECOL][end]);
- else fprintf(outfile, "$^{%s-", subRptr[FNTCOL][begin]);
+ if (pnc > 0)
+ {
+ cloop += fprintf(outfile, "$^{%s}$--%s%s$^{", subRptr[FNTCOL][begin], negnum(subRptr[PAGECOL][end]), subRptr[PAGECOL][end]);
+ }
+ else
+ {
+ cloop += fprintf(outfile, "$^{%s-", subRptr[FNTCOL][begin]);
+ }
}
else
if ( fntwgt[end] != INTERNALERR
&& fntwgt[end] != NOFOOTNOTE
- ) fprintf(outfile, "$^{");
+ )
+ cloop += fprintf(outfile, "$^{");
}
- else fprintf(outfile, "$^{");
+ else cloop += fprintf(outfile, "$^{");
- if ( fntwgt[end] == MISSNUM) fprintf(outfile, "%s}$", MISSINGSYMB);
- else if ( fntwgt[end] == EMPTYNUM) fprintf(outfile, "%s}$", EMPTYSYMB);
- else if ( fntwgt[end] == OVERFLOW) fprintf(outfile, "%s}$", OVERFLOWSYMB);
- else if ( fntwgt[end] == INTERNALERR) printf("%%%%\n%%%%> INTERNAL ERROR: Bad fntno\n");
- else if ( fntwgt[end] == NOFOOTNOTE) printf("%%%%\n%%%%> INTERNAL ERROR: That is not a footnote\n");
- else if ( fntwgt[end] == TEXT) fprintf(outfile, "%s%s%s}$", TEXTSYMBOPEN[notext], subRptr[FNTCOL][end], TEXTSYMBCLOSE[notext]);
- else fprintf(outfile, "%s%s}$", negnum(subRptr[FNTCOL][end]), subRptr[FNTCOL][end]);
+ if ( fntwgt[end] == MISSNUM) cloop += fprintf(outfile, "%s}$", MISSINGSYMB);
+ else if ( fntwgt[end] == EMPTYNUM) cloop += fprintf(outfile, "%s}$", EMPTYSYMB);
+ else if ( fntwgt[end] == OVERFLOW) cloop += fprintf(outfile, "%s}$", OVERFLOWSYMB);
+ else if ( fntwgt[end] == INTERNALERR) intern_err(14); /* Bad fntno */
+ else if ( fntwgt[end] == NOFOOTNOTE) intern_err(15); /* That is not a footnote */
+ else if ( fntwgt[end] == TEXT) cloop += fprintf(outfile, "%s%s%s}$", TEXTSYMBOPEN[notext], subRptr[FNTCOL][end], TEXTSYMBCLOSE[notext]);
+ else cloop += fprintf(outfile, "%s%s}$", negnum(subRptr[FNTCOL][end]), subRptr[FNTCOL][end]);
return cloop;
}
@@ -3131,23 +4157,25 @@ int printipage(const char *arraysep, int begin, int end, int cloop)
{
int pnc;
- fprintf(outfile, "%s", arraysep);
- if (pagewgt[begin] == MISSNUM) fprintf(outfile, "{%s}", MISSINGSYMB);
- else if (pagewgt[begin] == EMPTYNUM) fprintf(outfile, "%s", EMPTYSYMB);
- else if (pagewgt[begin] == OVERFLOW) fprintf(outfile, "%s", OVERFLOWSYMB);
- else if (pagewgt[begin] == TEXT) fprintf(outfile, "%s%s%s", TEXTSYMBOPEN[notext], subRptr[PAGECOL][begin], TEXTSYMBCLOSE[notext]);
- else fprintf(outfile, "%s", subRptr[PAGECOL][begin]);
+ cloop = baidxloop(cloop, arraysep);
+ if (pagewgt[begin] == MISSNUM) cloop += fprintf(outfile, "{%s}", MISSINGSYMB);
+ else if (pagewgt[begin] == EMPTYNUM) cloop += fprintf(outfile, "%s", EMPTYSYMB);
+ else if (pagewgt[begin] == OVERFLOW) cloop += fprintf(outfile, "%s", OVERFLOWSYMB);
+ else if (pagewgt[begin] == TEXT) cloop += fprintf(outfile, "%s%s%s", TEXTSYMBOPEN[notext], subRptr[PAGECOL][begin], TEXTSYMBCLOSE[notext]);
+ else cloop += fprintf(outfile, "%s", subRptr[PAGECOL][begin]);
if (end > begin)
{
pnc = numcmp(1, pagewgt[begin], subRptr[PAGECOL][end], subRptr[PAGECOL][begin]);
if (pnc == 1)
{
- fprintf(outfile, ",");
- cloop = spacebreak(cloop);
- fprintf(outfile, "%s", subRptr[PAGECOL][end]);
+ cloop = baidxloop(cloop, BANCOMMA);
+ cloop += fprintf(outfile, "%s", subRptr[PAGECOL][end]);
+ }
+ else if (pnc > 1)
+ {
+ cloop += fprintf(outfile, "--%s%s", negnum(subRptr[PAGECOL][end]), subRptr[PAGECOL][end]);
}
- else if (pnc > 1) fprintf(outfile, "--%s%s", negnum(subRptr[PAGECOL][end]), subRptr[PAGECOL][end]);
}
return cloop;
@@ -3156,9 +4184,9 @@ int printipage(const char *arraysep, int begin, int end, int cloop)
void makeipagefnt(int i, int line, int end)
{
- int begblock, lasti = -1, j, cloop = -1;
+ int begblock, lasti = -1, j, k, cloop = CLOOPASTART;
char *asfirst = "";
- char *assecond = ", ";
+ char *assecond = BANCOMMA;
char *arraysep = asfirst;
@@ -3170,14 +4198,13 @@ void makeipagefnt(int i, int line, int end)
while (i <= end)
{
- if (cloop == -1)
+ if (cloop == CLOOPASTART)
{
- fprintf(outfile, "%s", BAINDEXLIST);
- cloop = 0;
+ fprintf(outfile, "%s", BAINDEXFIRS); /* Erststart cloop */
+ cloop = CLOOPBSTART;
}
- else if (cloop == 0) printf("%%%%\n%%%%> INTERNAL ERROR: cloop == 0\n");
-
- ++cloop;
+ else
+ if (cloop == CLOOPBSTART) intern_err(16);
begblock = i;
@@ -3189,8 +4216,9 @@ void makeipagefnt(int i, int line, int end)
&& fntwgt[i+1] == NOFOOTNOTE
&& pagewgt[i] != MISSNUM
&& pagewgt[i] == pagewgt[i+1]
- && (pagewgt[i] != TEXT || strcmp(subRptr[PAGECOL][i], subRptr[PAGECOL][i+1]) == 0)
- && (pagewgt[i] == TEXT || (j=numcmp(1, pagewgt[i], subRptr[PAGECOL][i+1], subRptr[PAGECOL][i])) == 0 || j == 1)
+ && ( (pagewgt[i] == TEXT && strcmp(subRptr[PAGECOL][i], subRptr[PAGECOL][i+1]) == 0)
+ || (pagewgt[i] != TEXT && ((j=numcmp(1, pagewgt[i], subRptr[PAGECOL][i+1], subRptr[PAGECOL][i])) == 0 || j == 1))
+ )
) ++i;
else break;
}
@@ -3201,15 +4229,19 @@ void makeipagefnt(int i, int line, int end)
{
while (i < end)
{
+ k = -1;
if ( fntwgt[i] != NOFOOTNOTE
&& pagewgt[i] != MISSNUM
&& pagewgt[i] == pagewgt[i+1]
- && (pagewgt[i] != TEXT || strcmp(subRptr[PAGECOL][i], subRptr[PAGECOL][i+1]) == 0)
- && (pagewgt[i] == TEXT || (j=numcmp(1, pagewgt[i], subRptr[PAGECOL][i+1], subRptr[PAGECOL][i])) == 0 || j == 1)
+ && ( (pagewgt[i] == TEXT && strcmp(subRptr[PAGECOL][i], subRptr[PAGECOL][i+1]) == 0)
+ || (pagewgt[i] != TEXT && ((k=numcmp(1, pagewgt[i], subRptr[PAGECOL][i+1], subRptr[PAGECOL][i])) == 0 || (k == 1 && FntIndexOverPages == 1)))
+ )
&& fntwgt[i] != MISSNUM
&& fntwgt[i] == fntwgt[i+1]
- && ( fntwgt[i] != TEXT || strcmp(subRptr[ FNTCOL][i], subRptr[ FNTCOL][i+1]) == 0)
- && ( fntwgt[i] == TEXT || (j=numcmp(0, fntwgt[i], subRptr[ FNTCOL][i+1], subRptr[ FNTCOL][i])) == 0 || j == 1)
+ && ( ( fntwgt[i] == TEXT && (k == 0 || pagewgt[i] == TEXT)
+ && strcmp(subRptr[ FNTCOL][i], subRptr[ FNTCOL][i+1]) == 0)
+ || ( fntwgt[i] != TEXT && (((j=numcmp(0, fntwgt[i], subRptr[ FNTCOL][i+1], subRptr[ FNTCOL][i])) == 0 && k == 0) || j == 1))
+ )
) ++i;
else break;
}
@@ -3221,7 +4253,6 @@ void makeipagefnt(int i, int line, int end)
arraysep = assecond;
}
- if (cloop != 0)
fprintf(outfile, "%s", BAINDEXEND);
}
}
@@ -3261,7 +4292,7 @@ void printsortline(int line, int deepsort)
if (deepsort > 0)
{
- fprintf(outfile, " %%%%META%%%%");
+ fprintf(outfile, " %s", METALINEHEAD);
while (l < deepsort)
{
@@ -3274,14 +4305,36 @@ void printsortline(int line, int deepsort)
}
-int writetheline(char *p, const int nlines, const int line, const int deepsort, int filec, int printsort)
+void del_ktitintro(char *s)
+{
+ while(*s != '\0')
+ {
+ if (*s == KTITINTROCH)
+ {
+ if (*(s+1) != '\0')
+ {
+ *s++ = KTITERRORCH; /* "????" is possible here, */
+ *s++ = KTITERRORCH; /* whereas BibArts prints "??" */
+ }
+ else
+ {
+ intern_err(30);
+ break;
+ }
+ }
+ else ++s;
+ }
+}
+
+
+int writetheline(char *p, const int nlines, const int line, const int deepsort, int filec, int printsort, int kandkused, int oktitused)
{
- int doprint = 0, pagenum = 0, fntnum = 0, uu = 0, tn = getthirdnum(line), j;
+ int doprint = 0, pagenum = 0, fntnum = 0, uu = 0, tn = getthirdnum(line), j, ok, ie, sha, tha, uha, oerr;
if (*p != '%')
{ if (leval[line] != ACCEPTLINE)
*p = '%';
- printf("%%%%\n%%%%> INTERNAL ERROR: LINE WITHOUT \'%%\'\n");
+ intern_err(17); /* LINE WITHOUT \'%%\' */
}
@@ -3294,7 +4347,7 @@ int writetheline(char *p, const int nlines, const int line, const int deepsort,
|| (leval[j] != ACCEPTLINE)
)
{
- if (leval[j] != ACCEPTLINE && j != 0) printf("%%%%\n%%%%> INTERNAL ERROR: misplaced %s/%s\n", PREPARESPACE, PREPAREHEAD);
+ if (leval[j] != ACCEPTLINE && j != 0) intern_err(18); /* misplaced PREPARESPACE/PREPAREHEAD */
if (isalpha(*subCptr[0][line]) != 0)
{
@@ -3320,7 +4373,7 @@ int writetheline(char *p, const int nlines, const int line, const int deepsort,
else if (leval[line] == REDEF1LINE) { doprint = 6; }
else if (leval[line] == REDEF2LINE) { doprint = 7; }
else if (leval[line] == ABBREVLINE) { doprint = 0; /* *p = '+'; */ }
- else printf("%%%%\n%%%%> INTERNAL ERROR: UNKNOWN WRITELINES-leval\n");
+ else intern_err(19); /* UNKNOWN WRITELINES-leval */
if (pagewgt[line] == EMPTYNUM) pagenum = 1;
else if (pagewgt[line] == MISSNUM) pagenum = 2;
@@ -3344,8 +4397,74 @@ int writetheline(char *p, const int nlines, const int line, const int deepsort,
if (filec > 1) fprintf(outfile, "%%%% Entry from %s ...\n", subRptr[LINECOL][line]);
if (printsort == 1 && doprint == 1) printsortline(line, deepsort);
fprintf(outfile, "%s\n", p);
+
+ if (kandkused == 1 && num_of_cmds_in_str(p, KURZCMD) > 0)
+ fprintf(outfile, "%%%% <- Warning: You have used %s here, but %s elsewhere.\n", KURZ, KTIT);
+
+ if (otherktiterr > 0)
+ {
+ j = 0;
+ while (j < otherktiterr && subAptr[j][line] != mydefault)
+ {
+ if ((oerr = get_add_ktit(subAptr[j][line], 0, -1, -1, 0)) > 0)
+ fprintf(outfile, "%%%% <- Warning: %d misplaced %s in arg %d.\n", oerr, KTIT, j+1);
+ ++j;
+ }
+ }
+
+ if (oktitused > 0 && subAptr[VCOLS-1][line] != mydefault)
+ {
+ ok = num_of_cmds_in_str(subAptr[VCOLS-1][line], KTITCMD);
+ ie = hasinnerentry(subAptr[VCOLS-1][line], innerK_PER_ARQ_cmd, INNERTITLES);
+
+ if ( (oktitused == 3 || oktitused == 4)
+ && ok == 0
+ && ie > -1
+ )
+ fprintf(outfile, "%%%% <- Info: No outer %s used in **item with inner title**, but elsewhere you have %s in that case.\n", KTIT, KTIT);
+ else if (ok == 0 && oktitused < 5)
+ {
+ fprintf(outfile, "%%%% <- Info: No");
+ if (ie > -1) fprintf(outfile, " OUTER");
+ fprintf(outfile, " %s in arg %d (other entries have %s).\n", KTIT, VCOLS, KTIT);
+ }
+ else if (ok > 1)
+ {
+ fprintf(outfile, "%%%% <- Warning: %d", ok);
+ fprintf(outfile, " %s in last arg outside inner v-cmd found. Also check %s file.\n", KTIT, VKC_SUFFIX); /* VCOLS */
+ }
+
+ if (oktitused == 2 || oktitused == 4)
+ {
+ if (ok > (j=unshielded_cmds_in_str(subAptr[VCOLS-1][line], KTITCMD)))
+ {
+ fprintf(outfile, "%%%% <- Warning: %d", ok-j);
+ fprintf(outfile, " { %s } shadowed by brackets (in last arg outside inner v-cmd).\n", KTIT); /* VCOLS */
+ }
+ }
+
+ if ( isinstr(subAptr[VCOLS-1][line], KTITINTRO) == 1)
+ {
+ fprintf(outfile, "%%%% -> Info: An inner v-cmd should be printed as shortened reference (created by the arg of your %s cmd).\n", KTIT);
+ if ((sha=isinstr(subAptr[VCOLS-1][line], KTITSHA )) == 1)
+ fprintf(outfile, "%%%% <- Error: INNER { %s } is shadowed by brackets, and ...\n", KTIT);
+ if ((tha=isinstr(subAptr[VCOLS-1][line], KTITMISS )) == 1)
+ fprintf(outfile, "%%%% <- Error: INNER %s is missing.\n", KTIT);
+ if ((uha=isinstr(subAptr[VCOLS-1][line], KTITEMPTY)) == 1)
+ {
+ fprintf(outfile, "%%%% <- Warning: Arg of");
+ if (sha == 1) fprintf(outfile, " (last non-shadowed)");
+ fprintf(outfile, " INNER %s is empty.\n", KTIT);
+ }
+ if (sha != 1 && tha != 1 && uha != 1) intern_err(28); /* extra KTITINTRO found */
+
+ del_ktitintro(subAptr[VCOLS-1][line]); /* aus Prinzip: "\tX" => "??" */
+ }
+ }
+
}
+
if (doprint > 3) { fprintf(outfile, "%%%% <- TextArg-Warning");
if (uu == 0) fprintf(outfile, " (NUMBERS of entry are not necessarily rejected)");
fprintf(outfile, ":\n");
@@ -3414,42 +4533,52 @@ static void timestamp (FILE *file)
}
+void outhline(void)
+{
+ printf("%%%% ======================================\n");
+}
+
+
void printfilelist(FILE *file, int filec, int cc, const char *vor, const char *nach)
{
int i = 0;
if (cc == 1)
- fprintf(file, "\n%%%% BibArts 2.1 (C) Timo Baumann 2016 [%s]\n", __DATE__);
+ fprintf(file, "\n%%%% BibArts 2.2 (C) Timo Baumann 2019 [%s]\n", __DATE__);
fprintf(file, "%%%%\n");
timestamp(file);
fprintf(file, "%%%% Sort arg(s):\n");
- fprintf(file, "%s", vor);
- if (german == 1) fprintf(file, " -g1");
- if (german == 2) fprintf(file, " -g2");
- if (nogsty == 1) fprintf(file, " -x");
- if (ignorespaces == 1) fprintf(file, " -l");
- if (registpoints == 1) fprintf(file, " -p");
- if (encode == 1) fprintf(file, " -t1");
- if (kill == DOKILLAUTHORS) fprintf(file, " -k");
- if (EinlROEMseiten == 1) fprintf(file, " -s1");
- if (ALPHmpfootnotes == 1) fprintf(file, " -f1");
+ fprintf(file, "%s", vor);
+ if (german == 1) fprintf(file, " -g1");
+ if (german == 2) fprintf(file, " -g2");
+ if (nogsty == 1) fprintf(file, " -x");
+ if (ignorespaces == 1) fprintf(file, " -l");
+ if (hy_as_space == 1) fprintf(file, " -h");
+ if (registpoints == 1) fprintf(file, " -p");
+ if (encode == 1) fprintf(file, " -t1");
+ if (kill == DOKILLAUTHORS) fprintf(file, " -k");
+ if (EinlROEMseiten == 1) fprintf(file, " -s1");
+ if (ALPHmpfootnotes == 1) fprintf(file, " -f1");
if ( get_R_pg == BA_TRUE
|| get_A_pg == BA_TRUE
|| get_a_pg == BA_TRUE
|| get_r_pg == BA_TRUE
- ) fprintf(file, " -s2 %s", soptarg);
+ ) fprintf(file, " -s2 %s", soptarg);
if ( get_R_fn == BA_TRUE
|| get_A_fn == BA_TRUE
|| get_a_fn == BA_TRUE
|| get_r_fn == BA_TRUE
- ) fprintf(file, " -f2 %s", foptarg);
- if (igleichj == 1) fprintf(file, " -i=j");
- if (notext == 1) fprintf(file, " -c");
+ ) fprintf(file, " -f2 %s", foptarg);
+ if (igleichj == 1) fprintf(file, " -i=j");
+ if (bago == 1) fprintf(file, " -b");
+ if (FntIndexOverPages == 0) fprintf(file, " -n1");
+ if (notext == 1) fprintf(file, " -c");
if ( german == 0
&& nogsty == 0
&& ignorespaces == 0
+ && hy_as_space == 0
&& registpoints == 0
&& encode == 0
&& kill != DOKILLAUTHORS
@@ -3458,11 +4587,15 @@ void printfilelist(FILE *file, int filec, int cc, const char *vor, const char *n
&& (get_R_fn == BA_FALSE && get_A_fn == BA_FALSE && get_a_fn == BA_FALSE && get_r_fn == BA_FALSE)
&& (get_R_pg == BA_FALSE && get_A_pg == BA_FALSE && get_a_pg == BA_FALSE && get_r_pg == BA_FALSE)
&& igleichj == 0
+ && bago == 0
+ && FntIndexOverPages == 1
&& notext == 0
) fprintf(file, " Default");
fprintf(file, "%s\n", nach);
- fprintf(file, "%%%%> Input file list:\n");
+ if (igleichj == 1 && cc == 1) fprintf(file, "%%%% \n%%%% Note, that you will not see i=j in %s lines here.\n", METALINEHEAD); /* "-m" + "-i=j" */
+
+ fprintf(file, "%%%%\n%%%%> Input file list:\n");
if (filec == 1)
fprintf(file, "%%%% only \"%s\".\n", filelist[i]);
@@ -3475,11 +4608,14 @@ void printfilelist(FILE *file, int filec, int cc, const char *vor, const char *n
if (cc == 1)
fprintf(file, "\n\n");
- else printf("%%%%\n");
+ else
+ { printf("%%%%\n");
+ outhline();
+ }
}
-int writelines(int nlines, const int dqcol, const int lancol, const int commentANDignlines, const int deepsort, int filec, int printsort)
+int writelines(int nlines, const int dqcol, const int lancol, const int commentANDignlines, const int deepsort, int filec, int printsort, int kandkused, int oktitused)
{
int i = 0, dqcat, lancat = 0, lancatbuf, extralines = 0, didsetorig, nerr = 0;
@@ -3487,7 +4623,7 @@ int writelines(int nlines, const int dqcol, const int lancol, const int commentA
while (i < nlines && leval[i] != ACCEPTLINE)
{
- nerr = nerr + writetheline(lineptr[i], 0, i, 0, filec, printsort);
+ nerr = nerr + writetheline(lineptr[i], 0, i, 0, filec, printsort, kandkused, oktitused);
++i;
}
@@ -3517,7 +4653,7 @@ int writelines(int nlines, const int dqcol, const int lancol, const int commentA
if ((dqcol > -1 && nogsty == 0) || lancol > -1) fprintf(outfile, "\n");
- nerr = nerr + writetheline(lineptr[i], nlines, i, deepsort, filec, printsort);
+ nerr = nerr + writetheline(lineptr[i], nlines, i, deepsort, filec, printsort, kandkused, oktitused);
++i;
}
@@ -3551,7 +4687,7 @@ int writelines(int nlines, const int dqcol, const int lancol, const int commentA
}
}
- nerr = nerr + writetheline(lineptr[i], nlines, i, deepsort, filec, printsort);
+ nerr = nerr + writetheline(lineptr[i], nlines, i, deepsort, filec, printsort, kandkused, oktitused);
++i;
}
@@ -3683,11 +4819,16 @@ int findFEmale(const char *s)
while(*s != '\0')
{
- if ( lcmdcmp(s, MALE) == 0
- || lcmdcmp(s, FEMALE) == 0
- )
- { r = 1;
- break;
+ if (*s == '\\')
+ {
+ if (*(s+1) == '\\') ++s;
+ else
+ if ( lcmdcmp(s, MALE) == 0
+ || lcmdcmp(s, FEMALE) == 0
+ )
+ { r = 1;
+ break;
+ }
}
++s;
}
@@ -3825,21 +4966,9 @@ int checkifabbrisdefined(int nlines, int ret, char *Thead, const char *Thold, in
int entkerne_IeC(char buf[], const char *s)
{
- if (strlen(s) < MAXLEN)
- entkerne_arg(buf, s, IeC, IeClen, '{', '}');
- else strncpy(buf, s, MAXLEN-1);
-
- return strlen(buf);
-}
-
-
-void maxprint(int len, const char *s)
-{
- char buf[MAXLEN];
- int buflen = entkerne_IeC(buf, s);
-
- if (len > 4 && buflen > len) printf("%.*s....", len-4, buf);
- else printf("%s", buf);
+ int r = entkerne_arg(buf, s, IeC, '{', '}');
+ del_ktitintro(buf);
+ return r;
}
@@ -3957,7 +5086,7 @@ void checkSTUFFblock(const char *msg, int i, const int nlines, const int deepsor
&& deepsort != deep-1
)
{
- printf("%%%%\n%%%%> INTERNAL ERROR: deep/deepsort\n");
+ intern_err(20); /* deep/deepsort */
}
else
{
@@ -4224,7 +5353,7 @@ void print_three(int i, int e, int z, int d)
}
if (llen + mlen + rlen > LEFTMAX + MIDMAX + RIGHTMAX)
- printf("%%%%\n%%%%> INTERNAL ERROR: Bad screen print\n");
+ intern_err(21); /* Bad screen print */
printcline(llen, bufa);
printcline(mlen, bufb);
@@ -4594,11 +5723,15 @@ int checkifisfullcited(int i, int nlines, int ret)
{
++cnt;
if (cnt == 1)
- printf("%%%%\n%%%%> Info: ");
- else printf("%%%%> ");
- printf("Introduction %d of ", cnt+1);
- if (cnt > 1) printf("that ");
- printf("short-%s-title in %s.\n", subAptr[3][i], subRptr[LINECOL][i]);
+ printf("%%%%\n%%%%> Info: ");
+ else if (cnt < MAXINFO)
+ printf("%%%%> ");
+ if (cnt < MAXINFO)
+ {
+ printf("Re-introduction of "); /* intro cnt+1 */
+ if (cnt > 1) printf("that ");
+ printf("short-%s-title in %s.\n", subAptr[3][i], subRptr[LINECOL][i]);
+ }
if (cnt == 1)
{
printK(i);
@@ -4615,6 +5748,9 @@ int checkifisfullcited(int i, int nlines, int ret)
}
}
+ if (cnt+1 > MAXINFO)
+ printf("%%%%> This have been the first %d (of %d) intros of that short-title.\n", MAXINFO, cnt+1);
+
rest = i;
}
@@ -4646,7 +5782,7 @@ void checkmanipulationk(int i)
&& isvintroduced(i) == ERRENTRY
)
{
- printf("%%%%\n%%%%> Warning: Citation %s has unknown status.\n", subRptr[LINECOL][i]);
+ printf("%%%%\n%%%%> Warning: Reference %s has unknown status.\n", subRptr[LINECOL][i]);
printK(i);
}
}
@@ -4743,7 +5879,7 @@ int double_k(int nlines, int deepsort)
int doubleventries(int nlines, int deepsort)
{
- int ret = 0, i = 1, alast = -1, ainfos = 0, aget = 0, mem = -1;
+ int ret = 0, i = 1, alast = -1, ainfos = 0, aget = 0, mem = -1, difftitle = 0, shown = 0;
/* geht davon aus, dass count_rejected nur REJECTLINE behandelt */
/* und doubleauthor commentANDignlines unveraendert laesst! */
@@ -4765,7 +5901,10 @@ int doubleventries(int nlines, int deepsort)
printf("%%%%\n%%%%> Info: Identical full-titles %s, %s:\n", subRptr[LINECOL][i-1], subRptr[LINECOL][i]);
printV(i);
ainfos+=2;
+ ++shown;
}
+ else
+ ++difftitle;
aget +=2;
}
else
@@ -4796,7 +5935,15 @@ int doubleventries(int nlines, int deepsort)
}
if (ainfos > 1)
- printf("%%%%\n%%%%> This have been the first %d (of %d) identical full-titles.\n", ainfos, aget);
+ {
+ printf("%%%%\n%%%%> This have been the first %d (of %d) entries", ainfos, aget);
+ if (shown > 1)
+ printf(" (%d different titles)", shown);
+ printf("\n%%%% which are repeatingly cited");
+ if (aget > MAXINFO)
+ printf(" (further %d different titles)", difftitle);
+ printf(".\n%%%%\n");
+ }
return ret;
}
@@ -4812,7 +5959,7 @@ int doubleauthor(const char *entry, int nlines)
i = 0; while (i < nlines)
{
if (findFEmale(subAptr[0][i]) != 0)
- { printf("%%%%\n%%%%> Warning: %s or %s in lastname %s:\n", FEMALE, MALE, subRptr[LINECOL][i]);
+ { printf("%%%%\n%%%%> Warning: %s or %s in lastname instead firstname %s:\n", FEMALE, MALE, subRptr[LINECOL][i]);
printV(i);
}
if (findFEmale(subAptr[2][i]) != 0)
@@ -4947,7 +6094,7 @@ int subdoubleauthors(int found, int addtxt, char a[], int remi, int i, const cha
while(*q == ' ') ++q;
if (*q == '{' && (ql = nextbracket(q, '{', '}')) > 1)
{
- strncpy(qbuf, q, ql);
+ ql = mystrncpy(qbuf, q, ql);
q += ql;
while(*q == ' ') ++q;
ql = ql + (len=nextbracket(q, '{', '}'));
@@ -4987,7 +6134,7 @@ int subdoubleauthors(int found, int addtxt, char a[], int remi, int i, const cha
while(*p == ' ') ++p;
if (*p == '{' && (pl = nextbracket(p, '{', '}')) > 1)
{
- strncpy(pbuf, p, pl);
+ pl = mystrncpy(pbuf, p, pl);
p += pl;
while(*p == ' ') ++p;
pl = pl + (len=nextbracket(p, '{', '}'));
@@ -5185,14 +6332,24 @@ int surp_option(int argc, char *argv[])
char *makename(const char *prefix, const char *suffix)
{
- char fname[MAXFILENAMLEN];
- strncpy(fname, prefix, MAXFILENAMLEN-1);
- strncat(fname, suffix, MAXFILENAMLEN-strlen(prefix)-1);
- return strnmalloc(fname, MAXFILENAMLEN);
+ char fname[MAXFILENAMLEN];
+ int plen;
+
+ plen = mystrncpy(fname, prefix, MAXFILENAMLEN-1);
+ strncat(fname, suffix, MAXFILENAMLEN-plen-1);
+
+ if (plen + strlen(suffix) > MAXFILENAMLEN-1)
+ {
+ announceexit("get a too long path/file name");
+ printf("%%%%\n%%%% \"%s%s\"\n", prefix, suffix);
+ exit(1);
+ }
+
+ return strnmalloc(fname, strlen(fname)+1);
}
-int dofile(int filenum, char *filenam, int nlines, const char *entry, const char *cmdA, const char *cmdB, const char *cmdC, const char *cmdD, int deep, int deepsort, int ventry)
+int dofile(int filenum, char *filenam, int nlines, const char *entry, const char *formO, int deep, int deepsort, int ventry)
{
int alllines = nlines;
@@ -5211,11 +6368,7 @@ int dofile(int filenum, char *filenam, int nlines, const char *entry, const char
printf(" [reach %d%% of capacity]", alllines*100/MAXLINES);
printf(".\n");
}
- killcmdarg(nlines, alllines, cmdA, LOESCHEN); /* vor QQsort */
- killcmdarg(nlines, alllines, cmdB, LOESCHEN); /* vor QQsort */
- killcmdarg(nlines, alllines, cmdC, ENTKERNEN); /* vor QQsort */
- killcmdarg(nlines, alllines, cmdD, ENTKERNEN); /* vor QQsort */
- getbrackets(nlines, alllines, entry, deep, filenum);
+ getbrackets(nlines, alllines, entry, deep, filenum, formO, ventry);
dopgfntnumberweight(nlines, alllines);
dodqdeepsort(nlines, alllines, deepsort);
vorbereiten(nlines, alllines, deepsort, ventry);
@@ -5296,35 +6449,208 @@ void freeall(int nlines, int deep, int deepsort)
{
int linec = 0, i;
- if (deepsort > deep) printf("%%%%\n%%%%> INTERNAL ERROR: deepsort > deep\n");
+ if (deepsort > deep) intern_err(22); /* deepsort > deep */
while(linec < nlines)
{ myfree(lineptr[linec]);
i = 0; while (i < deep) myfree(subAptr[i++][linec]);
i = 0; while (i < deepsort) myfree(subBptr[i++][linec]);
- while (i < deep ) if (subBptr[i++][linec] != mydefault) printf("%%%%\n%%%%> INTERNAL ERROR: FREEALL\n");
+ while (i < deep ) if (subBptr[i++][linec] != mydefault) intern_err(23); /* FREEALL */
i = 0; while (i < deepsort) myfree(subCptr[i++][linec]);
- while (i < deep ) if (subCptr[i++][linec] != mydefault) printf("%%%%\n%%%%> INTERNAL ERROR: FREEALL\n");
+ while (i < deep ) if (subCptr[i++][linec] != mydefault) intern_err(24); /* FREEALL */
i = 0; while (i < BAALLRCOLS) myfree(subRptr[i++][linec]);
++linec;
}
}
-void prepareoutput(const char *entry, const char *suffix, int deep, int deepsort, int filec, char *arg_i, char *arg_o, int prep_kill, const char *cmdA, const char *cmdB, const char *cmdC, const char *cmdD, int ventry, int printsort)
+void testdrucken(int linec, int alllines, int deep, char *subptr[MAXBACOLS][MAXLINES])
+{
+ int i;
+
+ while (linec < alllines)
+ {
+ i = 0;
+ while (i < deep)
+ {
+ printf(" (%s)", subptr[i][linec]);
+ ++i;
+ }
+ printf(" [\"=%d, %d]", dqsort[linec], getarabicnum(subRptr[DQCOL][linec]));
+ printf("\n");
+ ++linec;
+ }
+}
+
+
+int check_kandk(int nlines)
+{
+ int i = 0;
+ int outkurz = 0;
+ int ktit = 0;
+
+ while (i < nlines)
+ {
+ outkurz += num_of_cmds_in_str(lineptr[i], KURZCMD);
+ ktit += num_of_cmds_in_str(lineptr[i], KTITCMD);
+ ++i;
+ }
+
+ if (outkurz > 0 && ktit > 0)
+ {
+ printf("%%%%\n%%%%> Warning: %d time(s) %s and %d time(s) %s found;\n", outkurz, KURZ, ktit, KTIT);
+ printf("%%%% see %s warnings in the output file.\n", KURZ);
+ }
+
+ if (outkurz > 0 && ktit > 0) return 1;
+ return 0;
+}
+
+
+int hasinnerentry(const char *p, const char *icmdlist[][2], const int num)
+{
+ int r = -1;
+
+ while (*p != '\0')
+ {
+ if (*p == '\\')
+ {
+ if (*(p+1) == '\\') ++p;
+ else
+ if ((r=innerentry(p, icmdlist, num)) > -1) break;
+ }
+ ++p;
+ }
+
+ return r;
+}
+
+
+int check_ktit(int nlines, int ventry)
+{
+ int i = 0, ohask = 0, ohasnok = 0, elsehask = 0, shadowedlines = 0, unshadnum = 0, l, ll, badlines = 0;
+ int ohk[MAXINFO];
+
+ if (ventry != IS_V) return 0;
+
+ while (i < nlines)
+ {
+ if (subAptr[VCOLS-1][i] == mydefault)
+ {
+ ++badlines;
+ }
+ else
+ {
+ l = num_of_cmds_in_str(subAptr[VCOLS-1][i], KTITCMD);
+ unshadnum += (ll=unshielded_cmds_in_str(subAptr[VCOLS-1][i], KTITCMD));
+
+ if (l > ll)
+ {
+ if (shadowedlines == 0)
+ printf("%%%%\n%%%%> Warning: { %s } is shadowed by brackets ...\n", KTIT);
+ printf("%%%% ... in entry from %s:\n", subRptr[LINECOL][i]);
+ printV(i);
+ ++shadowedlines;
+ }
+
+ if (hasinnerentry(subAptr[VCOLS-1][i], innerK_PER_ARQ_cmd, INNERTITLES) > -1)
+ {
+ if (l > 0)
+ {
+ ++ohask;
+ }
+ else
+ {
+ if (ohasnok < MAXINFO) ohk[ohasnok] = i;
+ ++ohasnok;
+ }
+ }
+ else
+ if (l > 0)
+ ++elsehask;
+ }
+ ++i;
+ }
+
+ if (shadowedlines > 0) printf("%%%%> A shadowed outer %s can not create %s in your text;\n%%%% a shadowed inner %s can not create a shortened reference in the list.\n%%%%\n", KTIT, ANNOUNCEKTIT, KTIT);
+
+ if (badlines > 0)
+ printf("%%%%> %s: Can\'t check all entries (%d are corrupt).\n", KTIT, badlines);
+
+
+ if (badlines < nlines)
+ {
+
+ if (ohask > 0 && ohasnok > 0)
+ {
+ printf("%%%%> Info: Items with inner title: %d with outer %s found, %d without.\n", ohask, KTIT, ohasnok);
+ }
+
+
+ if (ohasnok > 0)
+ {
+ printf("%%%%\n%%%%> Info: Entries with inner reference and no outer %s ...\n", KTIT);
+ i = 0;
+ while (i < MAXINFO && i < ohasnok)
+ {
+ l = ohk[i];
+ printf("%%%% ... from %s:\n", subRptr[LINECOL][l]);
+ printV(l);
+ ++i;
+ }
+ if (ohasnok > 0)
+ printf("%%%%> This have been the first %d (of %d) entries without outer %s.\n%%%%\n", i, ohasnok, KTIT);
+ }
+
+
+ if ( (shadowedlines == 0 && badlines == 0)
+ || (elsehask + ohask == 0 && badlines == 0)
+ )
+ printf("%%%%> Info: ");
+
+
+ if (shadowedlines == 0 && badlines == 0 && (ohask > 0 || elsehask > 0))
+ {
+ if (elsehask+ohask == nlines) printf("All");
+ else printf("NOT all");
+ printf(" v-entries have (outer) %s cmds in their last arg", KTIT); /* VCOLS */
+ if (elsehask+ohask == nlines) printf(".\n");
+ else printf(":\n%%%% In case of %s see messages in the output file.\n", ANNOUNCEKTIT);
+
+ if (nlines < unshadnum)
+ printf("%%%% I count %d unshadowed %s in %d entries (%d too much).\n", unshadnum, KTIT, nlines, unshadnum-nlines);
+ }
+ else if (elsehask + ohask == 0 && badlines == 0)
+ {
+ printf("You\'ve never used %s in last v-args:\n", KTIT);
+ printf("%%%% No info on outer %s in output file; no %s done.\n", KTIT, ANNOUNCEKTIT);
+ }
+ }
+
+
+ l = 1;
+ if (elsehask + ohask == 0) l += 4;
+ if (ohask > 0 && ohasnok > 0) l += 2;
+ if (shadowedlines > 0) ++l;
+ return l;
+}
+
+
+void prepareoutput(const char *entry, const char *suffix, int deep, int deepsort, int filec, char *arg_i, char *arg_o, int prep_kill, const char *formO, int ventry, int printsort)
{
int nlines = 0, i = 0, extralines = 0, commentANDignlines = 0;
- int filenum = -1;
+ int filenum = -1, kandkused = 0, oktitused = 0;
char *outname = mydefault;
if (arg_o == NULL) outname = makename(arg_i, suffix);
else outname = makename(arg_o, suffix);
+ otherktiterr = 0;
while (i < filec)
{
if (filec > 0) filenum = i+1;
- if ((nlines = dofile(filenum, filelist[i++], nlines, entry, cmdA, cmdB, cmdC, cmdD, deep, deepsort, ventry)) < 0)
+ if ((nlines = dofile(filenum, filelist[i++], nlines, entry, formO, deep, deepsort, ventry)) < 0)
{
announceexit("get a too big list of entries");
exit(1);
@@ -5335,6 +6661,12 @@ void prepareoutput(const char *entry, const char *suffix, int deep, int deepsort
printf("%%%% *** WARNING: Have capacity for only %d further entries! ***\n%%%%\n", MAXLINES-nlines);
+ /* printf("\nC: "); testdrucken(0, nlines, deep, subCptr); */
+ /* printf("\nB: "); testdrucken(0, nlines, deep, subBptr); */
+ /* printf("\nA: "); testdrucken(0, nlines, deep, subAptr); */
+ /* testdrucken(0, nlines, BAALLRCOLS, subRptr); */
+
+
if (nlines > 0)
{
if (nlines > 1) printf("%%%% Sort %d lines. Wait.\n", nlines);
@@ -5343,7 +6675,7 @@ void prepareoutput(const char *entry, const char *suffix, int deep, int deepsort
if (prep_kill == DOKILLAUTHORS && nlines > 1)
{ printf("%%%%> -k: Search multiply used authors ...\n");
- printf("%%%% -k: Authors in %d line(s) IDEMized [identical full-titles included].\n", doubleauthor(entry, nlines));
+ printf("%%%%> -k: Authors in %d line(s) IDEMized [identical full-titles included].\n", doubleauthor(entry, nlines));
commentANDignlines = count_rejected(nlines);
}
else
@@ -5356,7 +6688,7 @@ void prepareoutput(const char *entry, const char *suffix, int deep, int deepsort
{ printf("%%%% Search multiply used or empty entries ...\n");
if (*suffix == '.')
commentANDignlines = double_or_empty_arqperregisters(nlines, ventry, suffix+1, deepsort, deep);
- else printf("%%%%\n%%%%> INTERNAL ERROR with \\fill...\n");
+ else intern_err(25); /* ERROR with \\fill... */
}
else
if (prep_kill == DOKILLK && nlines > 0)
@@ -5370,9 +6702,11 @@ void prepareoutput(const char *entry, const char *suffix, int deep, int deepsort
{
if (deep == VCOLS && ventry == IS_V)
commentANDignlines = commentANDignlines + doubleventries(nlines, deepsort);
- else printf("%%%%\n%%%%> INTERNAL ERROR with doubleventries\n");
+ else intern_err(26); /* ERROR with doubleventries */
}
+ kandkused = check_kandk(nlines);
+ oktitused = check_ktit(nlines, ventry);
if ((outfile = fopen(outname, "w")) == NULL)
{
@@ -5381,14 +6715,12 @@ void prepareoutput(const char *entry, const char *suffix, int deep, int deepsort
}
else
{ printf("%%%%> Write %d item(s) to file \"%s\".\n", nlines-commentANDignlines, outname);
- if ((extralines = writelines(nlines, DQCOL, LANCOL, commentANDignlines, deepsort, filec, printsort)) > 0)
+ if ((extralines = writelines(nlines, DQCOL, LANCOL, commentANDignlines, deepsort, filec, printsort, kandkused, oktitused)) > 0)
printf("%%%% (Have added %d line(s) containing commands for LaTeX.)\n", extralines);
}
if (outfile != NULL) { fclose(outfile); fflush(outfile); }
freeall(nlines, deep, deepsort);
-
- printf("%%%% ======================================\n");
}
else
{
@@ -5408,6 +6740,8 @@ void prepareoutput(const char *entry, const char *suffix, int deep, int deepsort
printf(" file \"%s\".\n", outname);
}
+ outhline();
+
myfree(outname);
}
@@ -5519,7 +6853,7 @@ void setnewweight(const int pg, const char *p, const char *opt)
}
if ((pg == 0 || pg == 1) && lauf == ENDWEIGHT);
- else printf("%%%%\n%%%%> INTERNAL ERROR: setnewweight.\n");
+ else intern_err(27); /* setnewweight */
}
@@ -5540,9 +6874,23 @@ int main(int argc, char *argv[])
char *inname = mydefault, *arg_i = NULL, *arg_o = NULL;
- printf("\n%%%%> This is bibsort 2.1 (for help: %s -\?)\n", getmyname(argv[0], 37));
- fprintf(stderr, "%%%% bibsort 2.1 is part of BibArts 2.1 (C) Timo Baumann 2016.\n");
+ printf("\n%%%%> This is bibsort 2.2 (for help: %s -\?)\n", getmyname(argv[0], 37));
+ fprintf(stderr, "%%%% bibsort 2.2 is part of BibArts 2.2 (C) Timo Baumann 2019.\n");
+
+ argc = single_option(argc, argv, "-B", "-b");
+ if (argc < 0)
+ {
+ bago = 1;
+ argc = -argc;
+ }
+
+ argc = single_option(argc, argv, "-N1", "-n1");
+ if (argc < 0)
+ {
+ FntIndexOverPages = 0;
+ argc = -argc;
+ }
argc = single_option(argc, argv, "-c", "-C");
if (argc < 0)
@@ -5624,6 +6972,12 @@ int main(int argc, char *argv[])
ignorespaces = 1;
}
+ argc = single_option(argc, argv, "-H", "-h");
+ if (argc < 0)
+ { argc = -argc;
+ hy_as_space = 1;
+ }
+
argc = single_option(argc, argv, "-P", "-p");
if (argc < 0)
{ argc = -argc;
@@ -5668,7 +7022,7 @@ int main(int argc, char *argv[])
exit(1);
}
- argc = single_option(argc, argv, "-\?", "-h");
+ argc = single_option(argc, argv, "-\?", "-h1"); /* 2.2: -h => hyphen */
if (argc < 0)
{
argc = -argc;
@@ -5677,7 +7031,7 @@ int main(int argc, char *argv[])
exit(1);
}
- argc = single_option(argc, argv, "-\?\?", "-hh");
+ argc = single_option(argc, argv, "-\?\?", "-h2"); /* 2.2: -hh => -h2 */
if (argc < 0)
{
argc = -argc;
@@ -5773,17 +7127,27 @@ int main(int argc, char *argv[])
printfilelist( stdout, filec, 0, "%% ", "");
- prepareoutput("%\\literentry", VLI_SUFFIX, VCOLS, VCOLS, filec, arg_i, arg_o, kill, "\\onlykurz", "\\onlyhere", "\\onlyvoll", "\\onlyout", IS_V, printsort);
- prepareoutput("%\\quellentry", VQU_SUFFIX, VCOLS, VCOLS, filec, arg_i, arg_o, kill, "\\onlykurz", "\\onlyhere", "\\onlyvoll", "\\onlyout", IS_V, printsort);
- prepareoutput("%\\vkcitentry", VKC_SUFFIX, KCOLS, KCOLS, filec, arg_i, arg_o, DOKILLK, "\\onlyvoll", "\\onlyhere", "\\onlykurz", "\\onlyout", NO_V, printsort);
- prepareoutput("%\\abkrzentry", ABK_SUFFIX, ACOLS, ACOLSSORT, filec, arg_i, arg_o, DOKILLABBREVS, "", "\\onlyhere", "", "\\onlyout", NO_V, printsort);
- prepareoutput("%\\perioentry", PER_SUFFIX, PCOLS, PCOLSSORT, filec, arg_i, arg_o, DOKILLREGISTS, "", "\\onlyhere", "", "\\onlyout", NO_V, printsort);
- prepareoutput("%\\archqentry", ARQ_SUFFIX, PCOLS, PCOLSSORT, filec, arg_i, arg_o, DOKILLREGISTS, "", "\\onlyhere", "", "\\onlyout", IS_Q, printsort);
- prepareoutput("%\\geogrentry", GRR_SUFFIX, PCOLS, PCOLSSORT, filec, arg_i, arg_o, DOKILLREGISTS, "", "\\onlyhere", "", "\\onlyout", NO_V, printsort);
- prepareoutput("%\\persrentry", PRR_SUFFIX, PCOLS, PCOLSSORT, filec, arg_i, arg_o, DOKILLREGISTS, "", "\\onlyhere", "", "\\onlyout", NO_V, printsort);
- prepareoutput("%\\subjrentry", SRR_SUFFIX, PCOLS, PCOLSSORT, filec, arg_i, arg_o, DOKILLREGISTS, "", "\\onlyhere", "", "\\onlyout", NO_V, printsort);
+ /* changed in 2.2 => inner \\printonlyvli \\printonlyvqu */
+ /* l = loeschen */
+ /* e = entkernen */
+ /* X = weder loeschen noch entkernen */
+ /* "----" KHVONUM Positionen: \\onlykurz \\onlyhere \\onlyvoll \\onlyout */
+
+ prepareoutput("%\\literentry", VLI_SUFFIX, VCOLS, VCOLS, filec, arg_i, arg_o, kill, "llee", IS_V, printsort);
+ prepareoutput("%\\quellentry", VQU_SUFFIX, VCOLS, VCOLS, filec, arg_i, arg_o, kill, "llee", IS_V, printsort);
+ prepareoutput("%\\vkcitentry", VKC_SUFFIX, KCOLS, KCOLS, filec, arg_i, arg_o, DOKILLK, "elle", NO_V, printsort);
+
+ prepareoutput("%\\abkrzentry", ABK_SUFFIX, ACOLS, ACOLSSORT, filec, arg_i, arg_o, DOKILLABBREVS, "llee", NO_V, printsort);
+ prepareoutput("%\\perioentry", PER_SUFFIX, PCOLS, PCOLSSORT, filec, arg_i, arg_o, DOKILLREGISTS, "llee", NO_V, printsort);
+ prepareoutput("%\\archqentry", ARQ_SUFFIX, PCOLS, PCOLSSORT, filec, arg_i, arg_o, DOKILLREGISTS, "llee", IS_Q, printsort);
+
+ prepareoutput("%\\geogrentry", GRR_SUFFIX, PCOLS, PCOLSSORT, filec, arg_i, arg_o, DOKILLREGISTS, "llee", NO_V, printsort);
+ prepareoutput("%\\persrentry", PRR_SUFFIX, PCOLS, PCOLSSORT, filec, arg_i, arg_o, DOKILLREGISTS, "llee", NO_V, printsort);
+ prepareoutput("%\\subjrentry", SRR_SUFFIX, PCOLS, PCOLSSORT, filec, arg_i, arg_o, DOKILLREGISTS, "llee", NO_V, printsort);
+
+
if (upperascii < 0)
{