diff options
Diffstat (limited to 'macros/latex/contrib/bibarts/bibsort.c')
-rw-r--r-- | macros/latex/contrib/bibarts/bibsort.c | 78 |
1 files changed, 52 insertions, 26 deletions
diff --git a/macros/latex/contrib/bibarts/bibsort.c b/macros/latex/contrib/bibarts/bibsort.c index 332eb2c700..41b0b6347a 100644 --- a/macros/latex/contrib/bibarts/bibsort.c +++ b/macros/latex/contrib/bibarts/bibsort.c @@ -1,5 +1,5 @@ -/* BibArts 2.5 assists you to write LaTeX texts in arts and humanities. */ -/* Copyright (C) 2022b Timo Baumann bibarts[at]gmx.de (2022/10/01) */ +/* BibArts 2.6 assists you to write LaTeX texts in arts and humanities. */ +/* Copyright (C) 2023 Timo Baumann bibarts[at]gmx.de (2023/06/18) */ /* 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 */ @@ -36,7 +36,7 @@ /* COMPATIBILITY - For my tests on Windows 10, I compiled bibsort.c 2.5 with MinGW, and with + For my tests on Windows 10, I compiled bibsort.c 2.6 with MinGW, and with MS VisualStudio C/C++; I typed gcc ..., or cl ..., TO THE COMMAND PROMPT. Do NOT change this file when you do not have a qualified text @@ -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 1.x did use. - BibArts 2.5 ONLY has an EMULATION for 1.3 texts: Keep copies of 1.x? + BibArts 2.6 ONLY has an EMULATION for 1.3 texts: Keep copies of 1.x? */ @@ -433,11 +433,11 @@ void licenseinfo(void) void moremoreinfo(const char *myname) { printf("%%%% CODEPAGES\n"); - printf("%%%% LaTeX today writes ASCIIs > 127 in your %s-file(s), if you use\n", AUX_SUFFIX); - printf("%%%% \\usepackage[utf8]{inputenc}. Then, you may start me using option\n"); + printf("%%%% LaTeX will write ASCIIs > 127 in your %s-file(s), if you use\n", AUX_SUFFIX); + printf("%%%% \\usepackage[utf8]{inputenc} (today the default). With option\n"); printf("%%%% -utf8 I expect characters as definded in utf8enc.dfu 2022/06/07 v1.3c,\n"); - printf("%%%% except those, which execute \\cyr...- or \\CYR...-cmds. Those and\n"); - printf("%%%% further utf8-characters will be reported to screen as unknown.\n"); + printf("%%%% except those, which execute \\cyr...- or \\CYR...-cmds. I report\n"); + printf("%%%% every unknown utf8 character only once.\n"); printf("%%%% -t1 You set \\UseRawInputEncoding, and ASCIIs > 127, which you use in\n"); printf("%%%% your .tex-file(s), reach the %s-file(s); I interpret them.\n", AUX_SUFFIX); printf("%%%% **For apparently all other codepages, LaTeX writes \\cmds.**\n"); @@ -449,7 +449,7 @@ void moremoreinfo(const char *myname) printf("%%%% Smith, John / Peter Young: ... [Title] ...\n"); printf("%%%% -e Exchanges the args of %s (and of %s). \\printvli:\n", authortable[0][1], authortable[1][1]); printf("%%%% Smith, John / Young, Peter: ... [Title] ...\n"); - printf("%%%% In BOTH cases, this entry is sorted as: Smith John Young Peter\n"); + printf("%%%% In BOTH cases, the entry is sorted as: Smith John Young Peter\n"); printf("%%%%\n"); } @@ -457,8 +457,8 @@ void moremoreinfo(const char *myname) void moreinfo(const char *myname) { printf("%%%% -utf8 See %s -\?\?\?\n", getmyname(myname, 40)); - printf("%%%% -m Write into files the meta arguments which I use to sort lines.\n"); - printf("%%%% -b If %s is in an arg, only text behind will have a sorting weight.\n", BAGOCMD); + printf("%%%% -m Print the strings which I internally use for sorting (meta-lines).\n"); + printf("%%%% -b If %s is in an argument, I will begin the comparison at %s.\n", BAGOCMD, 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"); @@ -1531,6 +1531,9 @@ void QQsort(int left, int right, const int deep, const int deepsort) } + if (j == 0) /* Completely */ + j = dqsort[i] - dqsort[left]; /* new in 2.6 */ + if (j == 0) j = leval[i] - leval[left]; @@ -2984,7 +2987,7 @@ const char *weighttable[][2] = { { "\\ddot\t", "" }, /* CTL+E math-dieresis != umlaut */ { "\\=\t", "" }, /* CTL+F */ { "\\@tabacckludge\t=\t", "" }, /* new in 2.3, changed in 2.5 */ - { "\\a\t=\t", "" }, /* new in 2.3, chamged in 2.5 */ + { "\\a\t=\t", "" }, /* new in 2.3, changed in 2.5 */ { "\\bar\t", "" }, { "\\capitalmacron\t", "" }, /* new in 2.5 = \@tabacckludge= */ { "\\vec\t", "" }, /* CTL+F + [ESC] changed in 2.3 */ @@ -3224,6 +3227,10 @@ const char *udtable[][2] = { { "\\OLDHYF\t", "F" }, /* [F-] */ /* / */ { "\\hy\t", "-" }, /* MINUS \hy */ /* new in 2.2 */ { "\\fhy\t", "-" }, /* MINUS \fhy*/ /* new in 2.2 */ + { "\\\"e", "e" }, /* \"e */ /* new in 2.6 */ + { "\\\"E", "E" }, /* \"E */ /* new in 2.6 */ + { "\\\"i", "i" }, /* \"i */ /* new in 2.6 */ + { "\\\"I", "I" }, /* \"I */ /* new in 2.6 */ { "\\\"\t", "" }, /* / \" */ /* changend in 2.5*/ { "\\3", "s" }, /* \3 */ { "\\ck\t", "ck" }, /* [c-k] */ /* new in 2.2 */ @@ -3256,7 +3263,7 @@ const char *udtable[][2] = { { "\\@tabacckludge\t\"\t", "" }, /* new in 2.5 = \" */ { "\\a\t\"\t", "" }, /* new in 2.5 = \" */ { NULL, NULL }}; -#define NUMTEX 65 +#define NUMTEX 69 /* \" changed to \"\t in 2.5 */ @@ -3295,9 +3302,14 @@ const char *gstylist[][2] = { { "\"\tF", NULL }, /* [F-] */ /* | */ { "\"\t=", NULL }, /* MINUS "= */ /* new in 2.2 */ { "\"\t~", NULL }, /* MINUS "~ */ /* new in 2.2 */ - { "\"\t", NULL }, /* / " */ + { "\"\te", NULL }, /* \ "e */ /* new in 2.6 */ + { "\"\tE", NULL }, /* \ "E */ /* new in 2.6 */ + { "\"\ti", NULL }, /* \ "i */ /* new in 2.6 */ + { "\"\tI", NULL }, /* \ "I */ /* new in 2.6 */ + { "\"\t", NULL }, /* / " */ /* OFF in 2.6 */ { NULL, NULL }}; -#define NUMGER 35 +#define NUMGER 38 + /* 39 if you want "b=\"b, "y=\"y, etc. <= "\"\t" OFF in 2.6 */ const char *gweight[][2] = { @@ -3335,7 +3347,11 @@ const char *gweight[][2] = { { NULL, "F" }, /* [F-] "F */ /* / */ { NULL, "-" }, /* MINUS \hy "= */ /* new in 2.2 */ { NULL, "-" }, /* MINUS \fhy "~ */ /* new in 2.2 */ - { NULL, "" }, /* / \" " */ + { NULL, "e" }, /* \ \"e */ /* new in 2.6 */ + { NULL, "E" }, /* \ \"E */ /* new in 2.6 */ + { NULL, "i" }, /* \ \"i */ /* new in 2.6 */ + { NULL, "I" }, /* \ \"I */ /* new in 2.6 */ + { NULL, "" }, /* / \" (" OFF in 2.6) */ { NULL, "ss" }, /* \3 [] */ { NULL, "ck" }, /* \ck */ /* new in 2.2 */ { NULL, "CK" }, /* \CK */ /* new in 2.2 */ @@ -3404,7 +3420,11 @@ const char *mweight[][2] = { { NULL, "F" }, /* [F-] "F */ /* / */ { NULL, "-" }, /* \hy "= */ /* new in 2.2 */ { NULL, "-" }, /* \fhy "~ */ /* new in 2.2 */ - { NULL, "" }, /* / \" " */ + { NULL, "e" }, /* \"e */ /* new in 2.6 */ + { NULL, "E" }, /* \"E */ /* new in 2.6 */ + { NULL, "i" }, /* \"i */ /* new in 2.6 */ + { NULL, "I" }, /* \"I */ /* new in 2.6 */ + { NULL, "" }, /* \" (" OFF in 2.6) */ { NULL, "ss" }, /* \3 [] */ { NULL, "ck" }, /* \ck */ /* new in 2.2 */ { NULL, "CK" }, /* \CK */ /* new in 2.2 */ @@ -3495,17 +3515,19 @@ int texlistnum(const char *p, int n, const char *list[][2]) } - if ( *entry == '\0' - || (*entry == '\t' && *(entry+1) == '\0' && ((len == 2 && *p == '\\' && isLaTeXcmdletter(*(p+1)) == 0) || isLaTeXcmdletter(*line) == 0)) - ) + if (*entry == '\0') break; if (*entry == '\t' && ((len == 1 && *p == '\"') || (len == 2 && *p == '\\' && isLaTeXcmdletter(*(p+1)) == 0) || isLaTeXcmdletter(*line) == 0)) { + /* moved in 2.6: also "y etc. (not only as in 2.5: " y) */ + if (*(entry+1) == '\0') + break; + while (*line == ' ') ++line; /* now, isLaTeXcmdletter(*line) != 0 */ - /* new in 2.3, changed in 2.5 */ + /* new in 2.3, changed in 2.5 */ if ((atlen=lenofMATCHaftertab(entry, line)) > 0) /* atlen=1,3 !! */ break; } @@ -5260,8 +5282,12 @@ const char *transformtable[][2] = { {"\\@inpenc@undefined@\t", "{}" }, /* new in 2.3 */ {"\\G@refundefinedtrue\t", "{}" }, /* new in 2.3 */ { "\\GenericWarning\t", "{}{}" }, /* new in 2.3 */ + { "\\shorthandon\t", "{}" }, /* new in 2.6 */ + { "\\shorthandoff\t", "{}" }, /* new in 2.6 */ + { "\\foreignlanguage\t", "[]{}" }, /* new in 2.6 */ + { "\\hyphenrules\t", "{}" }, /* new in 2.6 */ { NULL, NULL }}; -#define NUMTRANSV 102 +#define NUMTRANSV 106 /* Muessen im Bereich von issonder liegen: */ @@ -6400,8 +6426,8 @@ void printfilelist(FILE *file, int filec, int cc, const char *vor, const char *n if (cc == 1) { - fprintf(file, "\n%%%% BibArts 2.5 (C) Timo Baumann 2022b [%s]\n", __DATE__); - fprintf(file, "\\gdef\\@bibsortvers{2.5}\n"); /* new in 2.5 */ + fprintf(file, "\n%%%% BibArts 2.6 (C) Timo Baumann 2023 [%s]\n", __DATE__); + fprintf(file, "\\gdef\\@bibsortvers{2.6}\n"); /* new in 2.5 */ } fprintf(file, "%%%%\n"); @@ -8870,8 +8896,8 @@ int main(int argc, char *argv[]) char *inname = mydefault, *arg_i = NULL, *arg_o = NULL; - printf("\n%%%%> This is bibsort 2.5 (for help: %s -\?)\n", getmyname(argv[0], 37)); - fprintf(stderr, "%%%% bibsort 2.5 is part of BibArts 2.5 (C) Timo Baumann 2022b.\n"); + printf("\n%%%%> This is bibsort 2.6 (for help: %s -\?)\n", getmyname(argv[0], 37)); + fprintf(stderr, "%%%% bibsort 2.6 is part of BibArts 2.6 (C) Timo Baumann 2023.\n"); argc = single_option(argc, argv, "-B", "-b"); |