docbook.tcl, instant: finish remaining help generation issues with tcl

In this commit, we convert FreeBSD and OpenBSD to use a system version
of TCL (8.6).

We also get rid of the hairy and buggy "CompareI18NStrings" custom Tcl
function and use the newer Tcl's builtin dictionary sort mechanism for
generating the Indexes and Glossaries, which were silently broken in
previous commits.

It was just not possible to use the same Tcl code in modern versions
of Tcl in addition to the ancient version included with CDE - so, now
we will always depend on the system version.  It's been tested with
8.6 and 8.7 versions of Tcl with great results.
This commit is contained in:
Jon Trulson
2018-09-22 12:27:27 -06:00
parent 1fb82e3327
commit 77a027039c
4 changed files with 22 additions and 122 deletions

View File

@@ -2,12 +2,15 @@ XCOMM $XConsortium: Imakefile /main/6 1996/11/29 11:06:09 rswiston $
XLATESRC = $(DTSVCSRC)/DtUtil2
TCLINC =
TCLLIB =
#if defined(LinuxArchitecture)
TCLINC = -I/usr/include/tcl
TCLLIB = -ltcl
#else
TCLINC = -I../tcl
TCLLIB = ../tcl/libtcl.a
#elif defined(FreeBSDArchitecture) || defined(OpenBSDArchitecture)
TCLINC = -I/usr/local/include/tcl8.6
TCLLIB = -ltcl86
#endif
INCLUDES = -I../lib/tptregexp -I$(XLATESRC) $(TCLINC)

View File

@@ -116,10 +116,6 @@ static int DefaultOutputString(ClientData clientData,
Tcl_Interp *interp,
int argc,
const char *argv[]);
static int CompareI18NStrings(ClientData clientData,
Tcl_Interp *interp,
int argc,
const char *argv[]);
static int TclReadLocaleStrings(ClientData clientData,
Tcl_Interp *interp,
int argc,
@@ -208,17 +204,6 @@ main(
0,
0);
/* Add a function to the interpreter to compare to strings. Our
* comparison will unmung any i18n characters (see
* {Un}EscapeI18NChars()) and uppercase the strings before
* comparison to insure we get a dictionary sort. We also use the
* nl_strcmp() function to get proper i18n collation */
Tcl_CreateCommand(interpreter,
"CompareI18NStrings",
CompareI18NStrings,
0,
0);
/* Add a function to read a localized set of data from a file.
* We'll make sure the munging takes place so we can parse it
* in Tcl and any strings we get will output properly when
@@ -444,77 +429,6 @@ static int DefaultOutputString(ClientData clientData,
return retCode;
}
static int CompareI18NStrings(ClientData clientData,
Tcl_Interp *interp,
int argc,
const char *argv[])
{
int ret_val, len;
char *ret_string, *cp;
if (argc < 3) {
Tcl_SetResult(interpreter,
"Missing string(s) to compare",
TCL_VOLATILE);
return TCL_ERROR;
}
if (argc > 3) {
Tcl_SetResult(interpreter, "Too many arguments", TCL_VOLATILE);
return TCL_ERROR;
}
/* unmung the two strings (see {Un}EscapeI18NChars()) */
UnEscapeI18NChars(argv[1]);
UnEscapeI18NChars(argv[2]);
/* upper case the strings to insure a dictionary sort */
cp = argv[1];
while (*cp) {
if ((len = mblen(cp, MB_CUR_MAX)) == 1) {
if (isalpha(*cp)) {
*cp = toupper(*cp);
}
cp++;
} else {
if (len > 0)
cp += len;
else
break; /* JET - we should be done here... */
}
}
cp = argv[2];
while (*cp) {
if ((len = mblen(cp, MB_CUR_MAX)) == 1) {
if (isalpha(*cp)) {
*cp = toupper(*cp);
}
cp++;
} else {
if (len > 0)
cp += len;
else
break; /* JET - we should be done here... */
}
}
/* compare the strings using an I18N safe sort */
ret_val = strcoll(argv[1], argv[2]);
if (ret_val > 0) {
ret_string = "1";
} else if (ret_val < 0) {
ret_string = "-1";
} else {
ret_string = "0";
}
Tcl_SetResult(interpreter, ret_string, TCL_VOLATILE);
return TCL_OK;
}
static int TclPrintLocation(ClientData clientData,
Tcl_Interp *interp,
int argc,
@@ -943,7 +857,7 @@ EscapeI18NChars(
static char *
ReadLocaleStrings(char *file_name, int *ret_code) {
ReadLocaleStrings(const char *file_name, int *ret_code) {
int fd;
char *pBuf;
char *i18nBuf;