diff options
author | Thomas E. Dickey <dickey@invisible-island.net> | 1997-07-18 14:09:51 -0400 |
---|---|---|
committer | Thomas E. Dickey <dickey@invisible-island.net> | 1997-07-18 14:09:51 -0400 |
commit | 57bfc74ff4ec4c2980b2330f2badc54a8990842d (patch) | |
tree | 81bffba3be5c8037a5064ec5d49cf243130697fb /src/chrtrans | |
parent | fb4db89ab1d82336978b68a66532da971702e2fb (diff) | |
download | lynx-snapshots-57bfc74ff4ec4c2980b2330f2badc54a8990842d.tar.gz |
snapshot of project "lynx", label v2-7-1ac_0-36
Diffstat (limited to 'src/chrtrans')
-rw-r--r-- | src/chrtrans/README.tables | 20 | ||||
-rw-r--r-- | src/chrtrans/UCkd.h | 21 | ||||
-rw-r--r-- | src/chrtrans/build-chrtrans.com | 125 | ||||
-rw-r--r-- | src/chrtrans/build-header.com | 37 | ||||
-rw-r--r-- | src/chrtrans/makeuctb.c | 883 | ||||
-rw-r--r-- | src/chrtrans/mnemonic_suni.tbl | 2 |
6 files changed, 662 insertions, 426 deletions
diff --git a/src/chrtrans/README.tables b/src/chrtrans/README.tables index c9a86605..8e4366d1 100644 --- a/src/chrtrans/README.tables +++ b/src/chrtrans/README.tables @@ -2,13 +2,13 @@ The translation table files in this directory are _examples only_. They were collected from several sources (among them Linux kbd package, ftp://dkuug.dk/, ftp://unicode.org/) and automatically comverted (if applicable), but not checked in detail. The Unicode/UCS2 values -for some of the RFC1345 Mnemonic codes are out of date, a cleanup and +for some of the RFC 1345 Mnemonic codes are out of date, a cleanup and update would be needed for serious use (including removing the mappings from the "private zone" U+E000 etc.). More tranlation files can be easily provided (and new character entities added to HTMLDTD.c), this set is just to test whether the system works -in principle (and also how it behaves with of incomplete data...) +in principle (and also how it behaves with incomplete data...) See the file README.format for a brief explanation of what's in the table files. @@ -18,8 +18,10 @@ doesn't really matter. The auxiliary program makeuctb (MAKE UniCode TaBle) is used to "compile" them into C header files, which can be included by UCdomap.c. -Ideally this should be taken care of by the Makefiles.. - +Ideally, this should be taken care of by the Makefiles. On VMS, use +build-chrtrans.com to compile and link makeuctb.exe and create the +set of .h files from the current set of .tlb files. Thereafter, use +build-header.com to update particular .h files. To make a new chartrans table available to Lynx (and thereby make a new charset known to Lynx) you currently have to manually edit UCdomap.c, in @@ -27,7 +29,11 @@ two places: a) Near the top, you will find a bunch of lines (some may be commented out) + #ifdef VMS + #include "[.chrtrans]<fn>.h" + #else #include "chrtrans/<fn>.h" + #endif /* VMS */ Add or comment out as you wish. (But it's probably safest to leave the first one, referring to "chrtrans/iso01_uni.h", in place...) @@ -50,5 +56,9 @@ named makefile.in before running ./configure, or makefile after running ./configure. (That may be inconvenient, but I didn't want to depend on features than not all makes may have.) Note that for recompiling Lynx, a `make clean' should not be necessary if you have *only* made -changes to the files in src/chrtrans. +changes to the files in src/chrtrans. On VMS, add entries for new +tables to build-chrtrans.com, but you can update the particular file +with build-header.com, then use the top directory's build.com and +answer 'n' to it's prompts about whether to update the WWWlibrary +and chrtrans modules. diff --git a/src/chrtrans/UCkd.h b/src/chrtrans/UCkd.h index 2cc2ebdb..083afe49 100644 --- a/src/chrtrans/UCkd.h +++ b/src/chrtrans/UCkd.h @@ -1,19 +1,22 @@ #ifndef _UC_KD_H #define _UC_KD_H -#include <sys/types.h> - -/* NOTE: THE FOLLOWING #define MAY NEED ADJUSTMENT. - u16 should be an unsigned type of 16 bit length (two octets). - u8 should be an unsigned type of 8 bit length (one octet). - */ +#ifdef NOTDEFINED +#include <sys/types.h> /* Included via tcp.h. */ +#endif /* NOTDEFINED */ + +/* + * NOTE: THE FOLLOWING #define MAY NEED ADJUSTMENT. + * u16 should be an unsigned type of 16 bit length (two octets). + * u8 should be an unsigned type of 8 bit length (one octet). + */ #ifndef u16 #define u16 unsigned short -#endif +#endif /* u16 */ #ifndef u8 #define u8 unsigned char -#endif +#endif /* u8 */ #ifdef NOTDEFINED struct consolefontdesc { @@ -21,7 +24,7 @@ struct consolefontdesc { u_short charheight; /* scan lines per character (1-32) */ char *chardata; /* font data in expanded form */ }; -#endif +#endif /* NOTDEFINED */ typedef char scrnmap_t; #define E_TABSZ 256 diff --git a/src/chrtrans/build-chrtrans.com b/src/chrtrans/build-chrtrans.com new file mode 100644 index 00000000..b9a3d515 --- /dev/null +++ b/src/chrtrans/build-chrtrans.com @@ -0,0 +1,125 @@ +$ v = 'f$verify(0)' +$! BUILD-CHRTRANS.COM +$! +$! Command file to build MAKEUCTB.EXE on VMS systems +$! and then use it to create the chrtrans header files. +$! +$! 28-Jun-1997 F.Macrides macrides@sci.wfeb.edu +$! Initial version, for Lynx v2.7.1+fotemods +$! +$ ON CONTROL_Y THEN GOTO CLEANUP +$ ON ERROR THEN GOTO CLEANUP +$ CHRproc = f$environment("PROCEDURE") +$ CHRwhere = f$parse(CHRproc,,,"DEVICE") + f$parse(CHRproc,,,"DIRECTORY") +$! +$ if p1 .nes. "" +$ then +$ CHRcc_opts = "/DEBUG/NOOPT" +$ CHRlink_opts = "/DEBUG" +$ else +$ CHRcc_opts = "" +$ CHRlink_opts = "" +$ endif +$! +$ Compile_makeuctb: +$!================ +$ v1 = f$verify(1) +$! +$! Compile the Lynx [.SRC.CHRTRANS]makeuctb module. +$! +$ v1 = 'f$verify(0)' +$ IF f$trnlnm("VAXCMSG") .eqs. "DECC$MSG" .or. - + f$trnlnm("DECC$CC_DEFAULT") .eqs. "/DECC" .or. - + f$trnlnm("DECC$CC_DEFAULT") .eqs. "/VAXC" +$ THEN +$ CHRcompiler := "DECC" +$ v1 = f$verify(1) +$! DECC: +$ cc := cc/decc/prefix=all /nomember 'CHRcc_opts'- + /INCLUDE=([-],[--],[--.WWW.Library.Implementation]) +$ v1 = 'f$verify(0)' +$ ELSE +$ IF f$search("gnu_cc:[000000]gcclib.olb") .nes. "" +$ THEN +$ CHRcompiler := "GNUC" +$ v1 = f$verify(1) +$! GNUC: +$ cc := gcc 'cc_opts'/INCLUDE=([-],[--],[--.WWW.Library.Implementation]) +$ v1 = 'f$verify(0)' +$ ELSE +$ CHRcompiler := "VAXC" +$ v1 = f$verify(1) +$! VAXC: +$ cc := cc 'cc_opts'/INCLUDE=([-],[--],[--.WWW.Library.Implementation]) +$ v1 = 'f$verify(0)' +$ ENDIF +$ ENDIF +$! +$ v1 = f$verify(1) +$ cc makeuctb +$ v1 = 'f$verify(0)' +$! +$ Link_makeuctb: +$!============= +$ v1 = f$verify(1) +$! +$! Link the Lynx [.SRC.CHRTRANS]makeuctb module. +$! +$ link/exe=makeuctb.exe'link_opts' makeuctb, - +sys$disk:[-]'CHRcompiler'.opt/opt +$ v1 = 'f$verify(0)' +$! +$ Create_headers: +$!============== +$ v1 = f$verify(1) +$! +$! Create the Lynx [.SRC.CHRTRANS] header files. +$! +$ makeuctb := $'CHRwhere'makeuctb +$ define/user sys$output 'CHRwhere'iso01_uni.h +$ makeuctb iso01_uni.tbl +$ define/user sys$output 'CHRwhere'iso02_uni.h +$ makeuctb iso02_uni.tbl +$ define/user sys$output 'CHRwhere'def7_uni.h +$ makeuctb def7_uni.tbl +$ define/user sys$output 'CHRwhere'iso03_uni.h +$ makeuctb iso03_uni.tbl +$ define/user sys$output 'CHRwhere'iso04_uni.h +$ makeuctb iso04_uni.tbl +$ define/user sys$output 'CHRwhere'iso05_uni.h +$ makeuctb iso05_uni.tbl +$ define/user sys$output 'CHRwhere'iso07_uni.h +$ makeuctb iso07_uni.tbl +$ define/user sys$output 'CHRwhere'iso09_uni.h +$ makeuctb iso09_uni.tbl +$ define/user sys$output 'CHRwhere'iso10_uni.h +$ makeuctb iso10_uni.tbl +$ define/user sys$output 'CHRwhere'koi8r_uni.h +$ makeuctb koi8r_uni.tbl +$ define/user sys$output 'CHRwhere'cp437_uni.h +$ makeuctb cp437_uni.tbl +$ define/user sys$output 'CHRwhere'cp850_uni.h +$ makeuctb cp850_uni.tbl +$ define/user sys$output 'CHRwhere'cp852_uni.h +$ makeuctb cp852_uni.tbl +$ define/user sys$output 'CHRwhere'cp1250_uni.h +$ makeuctb cp1250_uni.tbl +$ define/user sys$output 'CHRwhere'cp1252_uni.h +$ makeuctb cp1252_uni.tbl +$ define/user sys$output 'CHRwhere'utf8_uni.h +$ makeuctb utf8_uni.tbl +$ define/user sys$output 'CHRwhere'mnemonic_suni.h +$ makeuctb mnemonic_suni.tbl +$ define/user sys$output 'CHRwhere'mnem_suni.h +$ makeuctb mnem_suni.tbl +$ define/user sys$output 'CHRwhere'rfc_suni.h +$ makeuctb rfc_suni.tbl +$ v1 = 'f$verify(0)' +$ exit +$! +$ CLEANUP: +$ v1 = 'f$verify(0)' +$ write sys$output "Default directory:" +$ show default +$ v1 = f$verify(v) +$ exit diff --git a/src/chrtrans/build-header.com b/src/chrtrans/build-header.com new file mode 100644 index 00000000..963825dd --- /dev/null +++ b/src/chrtrans/build-header.com @@ -0,0 +1,37 @@ +$ v = 'f$verify(0)' +$! BUILD-HEADER.COM +$! +$! Command file to use MAKEUCTB.EXE on VMS systems for creating +$! a chrtrans header (foo.h) file from a table (foo.tbl) file. +$! Use the file root as P1, e.g.: +$! +$! $ @build-header iso05_uni +$! +$! will create iso05_uni.h from iso05_uni.tbl. +$! +$! 28-Jun-1997 F.Macrides macrides@sci.wfeb.edu +$! Initial version, for Lynx v2.7.1+fotemods +$! +$ ON CONTROL_Y THEN GOTO CLEANUP +$ ON ERROR THEN GOTO CLEANUP +$ CHRproc = f$environment("PROCEDURE") +$ CHRwhere = f$parse(CHRproc,,,"DEVICE") + f$parse(CHRproc,,,"DIRECTORY") +$! +$ Create_header: +$!============= +$ v1 = f$verify(1) +$! +$! Create a Lynx [.SRC.CHRTRANS] header file. +$! +$ makeuctb := $'CHRwhere'makeuctb +$ define/user sys$output 'CHRwhere''P1'.h +$ makeuctb 'P1'.tbl +$ v1 = 'f$verify(0)' +$ exit +$! +$ CLEANUP: +$ v1 = 'f$verify(0)' +$ write sys$output "Default directory:" +$ show default +$ v1 = f$verify(v) +$ exit diff --git a/src/chrtrans/makeuctb.c b/src/chrtrans/makeuctb.c index f5f73066..95ba076d 100644 --- a/src/chrtrans/makeuctb.c +++ b/src/chrtrans/makeuctb.c @@ -1,18 +1,18 @@ /* - * makeuctb.c, derived from conmakehash.c + * makeuctb.c, derived from conmakehash.c * - * [ original comments: - kw ] - * Create arrays for initializing the kernel folded tables (using a hash - * table turned out to be to limiting...) Unfortunately we can't simply - * preinitialize the tables at compile time since kfree() cannot accept - * memory not allocated by kmalloc(), and doing our own memory management - * just for this seems like massive overkill. + * [ original comments: - kw ] + * Create arrays for initializing the kernel folded tables (using a hash + * table turned out to be to limiting...) Unfortunately we can't simply + * preinitialize the tables at compile time since kfree() cannot accept + * memory not allocated by kmalloc(), and doing our own memory management + * just for this seems like massive overkill. * - * Copyright (C) 1995 H. Peter Anvin + * Copyright (C) 1995 H. Peter Anvin * - * This program is a part of the Linux kernel, and may be freely - * copied under the terms of the GNU General Public License (GPL), - * version 2, or at your option any later version. + * This program is a part of the Linux kernel, and may be freely + * copied under the terms of the GNU General Public License (GPL), + * version 2, or at your option any later version. */ #ifdef NOTDEFINED @@ -22,123 +22,143 @@ #include <string.h> #include <ctype.h> #else +#include "HTUtils.h" #include "tcp.h" -#undef exit /* don't try to use LYexit() */ -#endif +/* + * Don't try to use LYexit(). + */ +#ifdef exit +#undef exit +#endif /* exit */ +#endif /* NODEFINED */ #ifndef TOLOWER #define TOLOWER(c) (isupper((unsigned char)c) ? tolower((unsigned char)c) : (c)) -#endif /* ndef TOLOWER */ +#endif /* !TOLOWER */ #include "UCkd.h" #include "UCDefs.h" #define MAX_FONTLEN 256 -/* We don't deal with UCS4 here... -kw */ +/* + * We don't deal with UCS4 here. - KW + */ typedef u16 unicode; -PRIVATE void usage ARGS1(char *, argv0) +PRIVATE void usage ARGS1( + char *, argv0) { - fprintf(stderr, "Usage: \n"); - fprintf(stderr, " %s chartable [charsetmimename] [charsetdisplayname]\n", argv0); - fprintf(stderr, "Utility to convert .tbl into .h files for Lynx compilation.\n"); - exit(EX_USAGE); + fprintf(stderr, "Usage: \n"); + fprintf(stderr, + " %s chartable [charsetmimename] [charsetdisplayname]\n", + argv0); + fprintf(stderr, + "Utility to convert .tbl into .h files for Lynx compilation.\n"); + exit(EX_USAGE); } -PRIVATE int getunicode ARGS1(char **, p0) +PRIVATE int getunicode ARGS1( + char **, p0) { - char *p = *p0; - - while (*p == ' ' || *p == '\t') - p++; - if (*p == '-') - return -2; - else if (*p != 'U' || p[1] != '+' || - !isxdigit(p[2]) || !isxdigit(p[3]) || !isxdigit(p[4]) || - !isxdigit(p[5]) || isxdigit(p[6])) - return -1; - *p0 = p+6; - return strtol(p+2,0,16); + char *p = *p0; + + while (*p == ' ' || *p == '\t') + p++; + + if (*p == '-') { + return -2; + } else if (*p != 'U' || p[1] != '+' || + !isxdigit(p[2]) || !isxdigit(p[3]) || !isxdigit(p[4]) || + !isxdigit(p[5]) || isxdigit(p[6])) { + return -1; + } + *p0 = p+6; + return strtol((p + 2), 0, 16); } +/* + * Massive overkill, but who cares? + */ unicode unitable[MAX_FONTLEN][255]; - /* Massive overkill, but who cares? */ int unicount[MAX_FONTLEN]; struct unimapdesc_str themap_str = {0, NULL}; char *tblname; -PRIVATE void addpair_str ARGS2(char *, str, int, un) +PRIVATE void addpair_str ARGS2( + char *, str, + int, un) { - int i; - - - if ( un <= 0xfffe ) - { - /* Initialize the map for replacement strings */ - - if (!themap_str.entry_ct) { - themap_str.entries = + int i; + + if (un <= 0xfffe) { + if (!themap_str.entry_ct) { + /* + * Initialize the map for replacement strings. + */ + themap_str.entries = (struct unipair_str *) malloc (2000 * sizeof (struct unipair_str)); - if (! themap_str.entries) - { + if (!themap_str.entries) { fprintf(stderr, "%s: Out of memory\n", tblname); exit(EX_DATAERR); - } - } - - /* Check it isn't a duplicate */ - - else for ( i = 0 ; i < themap_str.entry_ct ; i++ ) - if ( themap_str.entries[i].unicode == un ) { - themap_str.entries[i].replace_str = str; - return; + } + } else { + /* + * Check that it isn't a duplicate. + */ + for (i = 0 ; i < themap_str.entry_ct; i++) { + if (themap_str.entries[i].unicode == un ) { + themap_str.entries[i].replace_str = str; + return; + } + } } - /* Add to list */ - - if ( themap_str.entry_ct > 1999 ) - { - fprintf(stderr, "ERROR: Only 2000 unicode replacement strings permitted!\n"); - exit(EX_DATAERR); + /* + * Add to list. + */ + if (themap_str.entry_ct > 1999) { + fprintf(stderr, + "ERROR: Only 2000 unicode replacement strings permitted!\n"); + exit(EX_DATAERR); } - - themap_str.entries[themap_str.entry_ct].unicode = un; - themap_str.entries[themap_str.entry_ct].replace_str = str; - themap_str.entry_ct++; + themap_str.entries[themap_str.entry_ct].unicode = un; + themap_str.entries[themap_str.entry_ct].replace_str = str; + themap_str.entry_ct++; } - - /* otherwise: ignore */ + /* otherwise: ignore */ } -PRIVATE void addpair ARGS2(int, fp, int, un) +PRIVATE void addpair ARGS2( + int, fp, + int, un) { - int i; - - if ( un <= 0xfffe ) - { - /* Check it isn't a duplicate */ - - for ( i = 0 ; i < unicount[fp] ; i++ ) - if ( unitable[fp][i] == un ) - return; - - /* Add to list */ - - if ( unicount[fp] > 254 ) - { - fprintf(stderr, "ERROR: Only 255 unicodes/glyph permitted!\n"); - exit(EX_DATAERR); + int i; + + if (un <= 0xfffe) { + /* + * Check that it isn't a duplicate. + */ + for (i = 0; i < unicount[fp]; i++) { + if (unitable[fp][i] == un) { + return; + } } - unitable[fp][unicount[fp]] = un; - unicount[fp]++; + /* + * Add to list. + */ + if (unicount[fp] > 254) { + fprintf(stderr, "ERROR: Only 255 unicodes/glyph permitted!\n"); + exit(EX_DATAERR); + } + unitable[fp][unicount[fp]] = un; + unicount[fp]++; } - - /* otherwise: ignore */ + /* otherwise: ignore */ } char this_MIMEcharset[UC_MAXLEN_MIMECSNAME +1]; @@ -148,422 +168,463 @@ int this_isDefaultMap = -1; int RawUni = 0; int lowest_eight = 999; -int main ARGS2(int, argc, char **, argv) +PUBLIC int main ARGS2( + int, argc, + char **, argv) { - FILE *ctbl; - char buffer[65536]; - int fontlen; - int i, nuni, nent; - int fp0, fp1, un0, un1; - char *p, *p1; - char *tbuf, ch; - - if ( argc < 2 || argc > 4 ) - usage(argv[0]); - - if ( !strcmp(argv[1],"-") ) - { - ctbl = stdin; - tblname = "stdin"; + FILE *ctbl; + char buffer[65536]; + int fontlen; + int i, nuni, nent; + int fp0, fp1, un0, un1; + char *p, *p1; + char *tbuf, ch; + + if (argc < 2 || argc > 4) { + usage(argv[0]); } - else - { - ctbl = fopen(tblname = argv[1], "r"); - if ( !ctbl ) - { - perror(tblname); - exit(EX_NOINPUT); + + if (!strcmp(argv[1], "-")) { + ctbl = stdin; + tblname = "stdin"; + } else { + ctbl = fopen(tblname = argv[1], "r"); + if (!ctbl) { + perror(tblname); + exit(EX_NOINPUT); } } - /* For now we assume the default font is always 256 characters. */ - fontlen = 256; + /* + * For now we assume the default font is always 256 characters. + */ + fontlen = 256; - /* Initialize table */ - - for ( i = 0 ; i < fontlen ; i++ ) - unicount[i] = 0; + /* + * Initialize table. + */ + for (i = 0; i < fontlen; i++) { + unicount[i] = 0; + } - /* Now we come to the tricky part. Parse the input table. */ + /* + * Now we comes to the tricky part. Parse the input table. + */ + while (fgets(buffer, sizeof(buffer), ctbl) != NULL) { + if ((p = strchr(buffer, '\n')) != NULL) { + *p = '\0'; + } else { + fprintf(stderr, "%s: Warning: line too long\n", tblname); + } - while ( fgets(buffer, sizeof(buffer), ctbl) != NULL ) - { - if ( (p = strchr(buffer, '\n')) != NULL ) - *p = '\0'; - else - fprintf(stderr, "%s: Warning: line too long\n", tblname); + /* + * Syntax accepted: + * <fontpos> <unicode> <unicode> ... + * <fontpos> <unicode range> <unicode range> ... + * <fontpos> idem + * <range> idem + * <range> <unicode range> + * <unicode> :<replace> + * <unicode range> :<replace> + * + * where <range> ::= <fontpos>-<fontpos> + * and <unicode> ::= U+<h><h><h><h> + * and <h> ::= <hexadecimal digit> + * and <replace> any string not containing '\n' or '\0' + */ + p = buffer; + while (*p == ' ' || *p == '\t') { + p++; + } + if (!(*p) || *p == '#') { + /* + * Skip comment or blank line. + */ + continue; + } - p = buffer; + switch (*p) { + /* + * Raw Unicode? I.e. needs some special + * processing. One digit code. + */ + case 'R': + p++; + while (*p == ' ' || *p == '\t') { + p++; + } + RawUni = strtol(p,0,10); + continue; -/* - * Syntax accepted: - * <fontpos> <unicode> <unicode> ... - * <fontpos> <unicode range> <unicode range> ... - * <fontpos> idem - * <range> idem - * <range> <unicode range> - * <unicode> :<replace> - * <unicode range> :<replace> - * - * where <range> ::= <fontpos>-<fontpos> - * and <unicode> ::= U+<h><h><h><h> - * and <h> ::= <hexadecimal digit> - * and <replace> any string not containing '\n' or '\0' - */ + /* + * Is this the default display font? + */ + case 'D': + p++; + while (*p == ' ' || *p == '\t') { + p++; + } + this_isDefaultMap = (*p == '1'); + continue; - while (*p == ' ' || *p == '\t') - p++; - if (!*p || *p == '#') - continue; /* skip comment or blank line */ + case 'M': + p++; + while (*p == ' ' || *p == '\t') { + p++; + } + sscanf(p,"%40s",this_MIMEcharset); + continue; - switch (*p) { - case 'R': /* Raw Unicode? I.e. needs some special - processing. One digit code. */ - p++; - while (*p == ' ' || *p == '\t') - p++; - RawUni = strtol(p,0,10); - continue; + /* + * Display charset name for options screen. + */ + case 'O': + p++; + while (*p == ' ' || *p == '\t') { + p++; + } + for (i = 0; *p && i < UC_MAXLEN_LYNXCSNAME; p++, i++) { + this_LYNXcharset[i] = *p; + } + this_LYNXcharset[i] = '\0'; + continue; + } - case 'D': /* Is this the default display font? */ - p++; - while (*p == ' ' || *p == '\t') - p++; - this_isDefaultMap = (*p == '1'); - continue; - case 'M': - p++; - while (*p == ' ' || *p == '\t') - p++; - sscanf(p,"%40s",this_MIMEcharset); - continue; - case 'O': /* Display charset name for options screen */ - p++; - while (*p == ' ' || *p == '\t') - p++; - for (i=0; *p && i<UC_MAXLEN_LYNXCSNAME; p++,i++) - this_LYNXcharset[i] = *p; - this_LYNXcharset[i] = '\0'; - continue; - } - - if(*p == 'U') - { - un0 = getunicode(&p); - if (un0 < 0) - { - fprintf(stderr, "Bad input line: %s\n", buffer); - exit(EX_DATAERR); - fprintf(stderr, - "%s: Bad Unicode range corresponding to font position range 0x%x-0x%x\n", - tblname, fp0, fp1); - exit(EX_DATAERR); + if (*p == 'U') { + un0 = getunicode(&p); + if (un0 < 0) { + fprintf(stderr, "Bad input line: %s\n", buffer); + exit(EX_DATAERR); + fprintf(stderr, + "%s: Bad Unicode range corresponding to font position range 0x%x-0x%x\n", + tblname, fp0, fp1); + exit(EX_DATAERR); } - un1 = un0; - while (*p == ' ' || *p == '\t') - p++; - if (*p == '-') - { - p++; - while (*p == ' ' || *p == '\t') + un1 = un0; + while (*p == ' ' || *p == '\t') { p++; - un1 = getunicode(&p); - if (un1 < 0 || un1 < un0) - { - fprintf(stderr, - "%s: Bad Unicode range U+%x-U+%x\n", - tblname, un0, un1); - fprintf(stderr, "Bad input line: %s\n", buffer); - exit(EX_DATAERR); - } - while (*p == ' ' || *p == '\t') + } + if (*p == '-') { p++; + while (*p == ' ' || *p == '\t') { + p++; + } + un1 = getunicode(&p); + if (un1 < 0 || un1 < un0) { + fprintf(stderr, + "%s: Bad Unicode range U+%x-U+%x\n", + tblname, un0, un1); + fprintf(stderr, "Bad input line: %s\n", buffer); + exit(EX_DATAERR); + } + while (*p == ' ' || *p == '\t') { + p++; + } } - if (*p != ':') - { - fprintf(stderr, "No ':' where expected: %s\n", buffer); - continue; + if (*p != ':') { + fprintf(stderr, "No ':' where expected: %s\n", buffer); + continue; } - tbuf = (char *) malloc (4*strlen(++p) + 1); - if (!(p1 = tbuf)) - { - fprintf(stderr, - "%s: Out of memory\n", tblname); - exit(EX_DATAERR); + tbuf = (char *) malloc (4*strlen(++p) + 1); + if (!(p1 = tbuf)) { + fprintf(stderr, "%s: Out of memory\n", tblname); + exit(EX_DATAERR); } - for(ch = *p; (ch = *p) != '\0'; p++,p1++) - { - if ((unsigned char)ch < 32 || ch == '\\' || ch == '\"' || - (unsigned char)ch >= 127) - { - sprintf(p1,"\\%.3o",(unsigned char)ch); -/* fprintf(stderr,"%s\n",tbuf); */ - p1 += 3; + for (ch = *p; (ch = *p) != '\0'; p++, p1++) { + if ((unsigned char)ch < 32 || ch == '\\' || ch == '\"' || + (unsigned char)ch >= 127) { + sprintf(p1, "\\%.3o", (unsigned char)ch); +/* fprintf(stderr, "%s\n", tbuf); */ + p1 += 3; + } else { + *p1 = ch; } - else - *p1 = ch; } - *p1 = '\0'; - for(i=un0; i<=un1; i++) -/* printf("U+0x%x:%s\n",i,tbuf); */ - addpair_str(tbuf,i); + *p1 = '\0'; + for (i = un0; i <= un1; i++) { +/* printf("U+0x%x:%s\n", i, tbuf); */ + addpair_str(tbuf,i); + } continue; } - fp0 = strtol(p, &p1, 0); - if (p1 == p) - { - fprintf(stderr, "Bad input line: %s\n", buffer); - exit(EX_DATAERR); + fp0 = strtol(p, &p1, 0); + if (p1 == p) { + fprintf(stderr, "Bad input line: %s\n", buffer); + exit(EX_DATAERR); } - p = p1; + p = p1; - while (*p == ' ' || *p == '\t') - p++; - if (*p == '-') - { - p++; - fp1 = strtol(p, &p1, 0); - if (p1 == p) - { - fprintf(stderr, "Bad input line: %s\n", buffer); - exit(EX_DATAERR); + while (*p == ' ' || *p == '\t') { + p++; + } + if (*p == '-') { + p++; + fp1 = strtol(p, &p1, 0); + if (p1 == p) { + fprintf(stderr, "Bad input line: %s\n", buffer); + exit(EX_DATAERR); } - p = p1; - } - else - fp1 = 0; + p = p1; + } else { + fp1 = 0; + } - if ( fp0 < 0 || fp0 >= fontlen ) - { + if (fp0 < 0 || fp0 >= fontlen) { fprintf(stderr, "%s: Glyph number (0x%x) larger than font length\n", tblname, fp0); exit(EX_DATAERR); } - if ( fp1 && (fp1 < fp0 || fp1 >= fontlen) ) - { + if (fp1 && (fp1 < fp0 || fp1 >= fontlen)) { fprintf(stderr, "%s: Bad end of range (0x%x)\n", tblname, fp1); exit(EX_DATAERR); } - if (fp1) - { - /* we have a range; expect the word "idem" or a Unicode range of the - same length */ - while (*p == ' ' || *p == '\t') - p++; - if (!strncmp(p, "idem", 4)) - { - for (i=fp0; i<=fp1; i++) - addpair(i,i); - p += 4; - } - else - { - un0 = getunicode(&p); - while (*p == ' ' || *p == '\t') + if (fp1) { + /* + * We have a range; expect the word "idem" + * or a Unicode range of the same length. + */ + while (*p == ' ' || *p == '\t') { p++; - if (*p != '-') - { - fprintf(stderr, -"%s: Corresponding to a range of font positions, there should be a Unicode range\n", - tblname); - exit(EX_DATAERR); + } + if (!strncmp(p, "idem", 4)) { + for (i = fp0; i <= fp1; i++) { + addpair(i,i); + } + p += 4; + } else { + un0 = getunicode(&p); + while (*p == ' ' || *p == '\t') { + p++; + } + if (*p != '-') { + fprintf(stderr, + "%s: Corresponding to a range of font positions,", + tblname); + fprintf(stderr, + " there should be a Unicode range.\n"); + exit(EX_DATAERR); } - p++; - un1 = getunicode(&p); - if (un0 < 0 || un1 < 0) - { - fprintf(stderr, -"%s: Bad Unicode range corresponding to font position range 0x%x-0x%x\n", - tblname, fp0, fp1); - exit(EX_DATAERR); + p++; + un1 = getunicode(&p); + if (un0 < 0 || un1 < 0) { + fprintf(stderr, + "%s: Bad Unicode range corresponding to font position range 0x%x-0x%x\n", + tblname, fp0, fp1); + exit(EX_DATAERR); } - if (un1 - un0 != fp1 - fp0) - { - fprintf(stderr, -"%s: Unicode range U+%x-U+%x not of the same length as font position range 0x%x-0x%x\n", - tblname, un0, un1, fp0, fp1); - exit(EX_DATAERR); + if (un1 - un0 != fp1 - fp0) { + fprintf(stderr, + "%s: Unicode range U+%x-U+%x not of the same length", + tblname, un0, un1); + fprintf(stderr, + " as font position range 0x%x-0x%x\n", + fp0, fp1); + exit(EX_DATAERR); } - for(i=fp0; i<=fp1; i++) - addpair(i,un0-fp0+i); + for (i = fp0; i <= fp1; i++) { + addpair(i,un0-fp0+i); + } } - } - else - { - /* no range; expect a list of unicode values or unicode ranges - for a single font position, or the word "idem" */ - - while (*p == ' ' || *p == '\t') + } else { + /* + * No range; expect a list of unicode values + * or unicode ranges for a single font position, + * or the word "idem" + */ + while (*p == ' ' || *p == '\t') { p++; - if (!strncmp(p, "idem", 4)) - { + } + if (!strncmp(p, "idem", 4)) { addpair(fp0,fp0); p += 4; } - while ( (un0 = getunicode(&p)) >= 0 ) { + while ((un0 = getunicode(&p)) >= 0) { addpair(fp0, un0); - while (*p == ' ' || *p == '\t') + while (*p == ' ' || *p == '\t') { p++; + } if (*p == '-') { p++; un1 = getunicode(&p); - if (un1 < un0) - { + if (un1 < un0) { fprintf(stderr, "%s: Bad Unicode range 0x%x-0x%x\n", tblname, un0, un1); exit(EX_DATAERR); } - for(un0++; un0 <= un1; un0++) + for (un0++; un0 <= un1; un0++) { addpair(fp0, un0); + } } } } - while (*p == ' ' || *p == '\t') - p++; - if (*p && *p != '#') - fprintf(stderr, "%s: trailing junk (%s) ignored\n", tblname, p); + while (*p == ' ' || *p == '\t') { + p++; + } + if (*p && *p != '#') { + fprintf(stderr, "%s: trailing junk (%s) ignored\n", tblname, p); + } } - /* Okay, we hit EOF, now output hash table */ - - fclose(ctbl); + /* + * Okay, we hit EOF, now output hash table. + */ + fclose(ctbl); - /* Compute total size of Unicode list */ - nuni = 0; - for ( i = 0 ; i < fontlen ; i++ ) - nuni += unicount[i]; - - if (argc >=3 ) - strncpy(this_MIMEcharset,argv[2],UC_MAXLEN_MIMECSNAME); - else if (!this_MIMEcharset || ! *this_MIMEcharset) { - strncpy(this_MIMEcharset,tblname,UC_MAXLEN_MIMECSNAME); - if ((p = strchr(this_MIMEcharset,'.')) != 0) - *p = '\0'; - } - for (p=this_MIMEcharset; *p; p++) - *p = TOLOWER(*p); - if (argc >=4 ) - strncpy(this_LYNXcharset,argv[3],UC_MAXLEN_LYNXCSNAME); - else if (!this_LYNXcharset || ! *this_LYNXcharset) { - strncpy(this_LYNXcharset,this_MIMEcharset,UC_MAXLEN_LYNXCSNAME); - } - if ((i=strlen(this_LYNXcharset)) < UC_LEN_LYNXCSNAME) { - for (;i<UC_LEN_LYNXCSNAME;i++) - this_LYNXcharset[i] = ' '; - this_LYNXcharset[i] = '\0'; - } -/* - fprintf(stderr,"this_MIMEcharset: %s.\n",this_MIMEcharset); - fprintf(stderr,"this_LYNXcharset: %s.\n",this_LYNXcharset); -*/ - if (this_isDefaultMap == -1) - this_isDefaultMap = !strncmp(this_MIMEcharset,"iso-8859-1",10); - fprintf(stderr,"makeuctb: %s: %stranslation map", - this_MIMEcharset, (this_isDefaultMap ? "default " : "")); - if (this_isDefaultMap == 1) - *id_append = '\0'; - else - for (i=0,p=this_MIMEcharset; *p && (i < UC_MAXLEN_ID_APPEND-1); p++,i++) - id_append[i+1] = isalnum(*p) ? *p : '_'; - id_append[i+1] = '\0'; - fprintf(stderr," (%s).\n", id_append); - - - printf("\ + /* + * Compute total size of Unicode list. + */ + nuni = 0; + for (i = 0 ; i < fontlen ; i++) { + nuni += unicount[i]; + } + + if (argc >= 3) { + strncpy(this_MIMEcharset,argv[2],UC_MAXLEN_MIMECSNAME); + } else if (!this_MIMEcharset || !(*this_MIMEcharset)) { + strncpy(this_MIMEcharset,tblname,UC_MAXLEN_MIMECSNAME); + if ((p = strchr(this_MIMEcharset,'.')) != 0) { + *p = '\0'; + } + } + for (p = this_MIMEcharset; *p; p++) { + *p = TOLOWER(*p); + } + if (argc >= 4) { + strncpy(this_LYNXcharset,argv[3],UC_MAXLEN_LYNXCSNAME); + } else if (!this_LYNXcharset || !(*this_LYNXcharset)) { + strncpy(this_LYNXcharset,this_MIMEcharset,UC_MAXLEN_LYNXCSNAME); + } + if ((i = strlen(this_LYNXcharset)) < UC_LEN_LYNXCSNAME) { + for (; i < UC_LEN_LYNXCSNAME; i++) { + this_LYNXcharset[i] = ' '; + } + this_LYNXcharset[i] = '\0'; + } +#ifdef NOTDEFINED + fprintf(stderr,"this_MIMEcharset: %s.\n",this_MIMEcharset); + fprintf(stderr,"this_LYNXcharset: %s.\n",this_LYNXcharset); +#endif /* NOTDEFINED */ + if (this_isDefaultMap == -1) { + this_isDefaultMap = !strncmp(this_MIMEcharset,"iso-8859-1", 10); + } + fprintf(stderr, + "makeuctb: %s: %stranslation map", + this_MIMEcharset, (this_isDefaultMap ? "default " : "")); + if (this_isDefaultMap == 1) { + *id_append = '\0'; + } else { + for (i = 0, p = this_MIMEcharset; + *p && (i < UC_MAXLEN_ID_APPEND-1); + p++, i++) { + id_append[i+1] = isalnum(*p) ? *p : '_'; + } + } + id_append[i+1] = '\0'; + fprintf(stderr, " (%s).\n", id_append); + + printf("\ /*\n\ - * uni_hash.tbl\n\ + * uni_hash.tbl\n\ *\n\ - * Do not edit this file; it was automatically generated by\n\ + * Do not edit this file; it was automatically generated by\n\ *\n\ - * %s %s\n\ + * %s %s\n\ *\n\ */\n\ \n\ static u8 dfont_unicount%s[%d] = \n\ {\n\t", argv[0], argv[1], id_append, fontlen); - for ( i = 0 ; i < fontlen ; i++ ) - { - if (i >= 128 && unicount[i] > 0 && i < lowest_eight) - lowest_eight = i; - printf("%3d", unicount[i]); - if ( i == fontlen-1 ) - printf("\n};\n"); - else if ( i % 8 == 7 ) - printf(",\n\t"); - else - printf(", "); + for (i = 0; i < fontlen; i++) { + if (i >= 128 && unicount[i] > 0 && i < lowest_eight) { + lowest_eight = i; + } + printf("%3d", unicount[i]); + if (i == (fontlen - 1)) { + printf("\n};\n"); + } else if ((i % 8) == 7) { + printf(",\n\t"); + } else { + printf(", "); + } + } + + /* + * If lowest_eightbit is anything else but 999, + * this can't be 7-bit only. + */ + if (lowest_eight != 999 && !RawUni) { + RawUni = UCT_ENC_8BIT; } - /* If lowest_eightbit is anything else but 999, this can't be 7-bit - * only. */ - if (lowest_eight != 999 && !RawUni) - RawUni = UCT_ENC_8BIT; - - if (nuni) - printf("\nstatic u16 dfont_unitable%s[%d] = \n{\n\t", id_append, nuni); - else - printf("\nstatic u16 dfont_unitable%s[1]; /* dummy */\n", id_append); - - fp0 = 0; - nent = 0; - for ( i = 0 ; i < nuni ; i++ ) - { - while ( nent >= unicount[fp0] ) - { - fp0++; - nent = 0; - } - printf("0x%04x", unitable[fp0][nent++]); - if ( i == nuni-1 ) - printf("\n};\n"); - else if ( i % 8 == 7 ) - printf(",\n\t"); - else - printf(", "); + if (nuni) { + printf("\nstatic u16 dfont_unitable%s[%d] = \n{\n\t", + id_append, nuni); + } else { + printf("\nstatic u16 dfont_unitable%s[1]; /* dummy */\n", id_append); } - if (themap_str.entry_ct) - printf("\n\ + fp0 = 0; + nent = 0; + for (i = 0; i < nuni; i++) { + while (nent >= unicount[fp0]) { + fp0++; + nent = 0; + } + printf("0x%04x", unitable[fp0][nent++]); + if (i == (nuni - 1)) { + printf("\n};\n"); + } else if ((i % 8) == 7) { + printf(",\n\t"); + } else { + printf(", "); + } + } + + if (themap_str.entry_ct) { + printf("\n\ static struct unipair_str repl_map%s[%d] = \n\ {\n\t", id_append, themap_str.entry_ct); - else -printf("\n\ + } else { + printf("\n\ /* static struct unipair_str repl_map%s[]; */\n", id_append); + } - for ( i = 0 ; i < themap_str.entry_ct ; i++ ) - { - printf("{0x%x,\"%s\"}", themap_str.entries[i].unicode, - themap_str.entries[i].replace_str); - if ( i == themap_str.entry_ct-1 ) - printf("\n};\n"); - else if ( i % 4 == 3 ) - printf(",\n\t"); - else - printf(", "); + for (i = 0; i < themap_str.entry_ct; i++) { + printf("{0x%x,\"%s\"}", + themap_str.entries[i].unicode, + themap_str.entries[i].replace_str); + if (i == (themap_str.entry_ct - 1)) { + printf("\n};\n"); + } else if ((i % 4) == 3) { + printf(",\n\t"); + } else { + printf(", "); + } } - if (themap_str.entry_ct) - printf("\n\ + if (themap_str.entry_ct) { + printf("\n\ static struct unimapdesc_str dfont_replacedesc%s = {%d,repl_map%s};\n", id_append, themap_str.entry_ct, id_append); - else - printf("\n\ + } else { + printf("\n\ static struct unimapdesc_str dfont_replacedesc%s = {0,NULL};\n",id_append); + } - printf("#define UC_CHARSET_SETUP%s UC_Charset_Setup(\ + printf("#define UC_CHARSET_SETUP%s UC_Charset_Setup(\ \"%s\",\\\n\"%s\",\\\n\ dfont_unicount%s,dfont_unitable%s,%i,\\\n\ dfont_replacedesc%s,%i,%i)\n", id_append, this_MIMEcharset, this_LYNXcharset, id_append, id_append, nuni, id_append, lowest_eight, RawUni); - exit(EX_OK); + exit(EX_OK); } diff --git a/src/chrtrans/mnemonic_suni.tbl b/src/chrtrans/mnemonic_suni.tbl index d2f05d89..7f08408c 100644 --- a/src/chrtrans/mnemonic_suni.tbl +++ b/src/chrtrans/mnemonic_suni.tbl @@ -2,7 +2,7 @@ Mmnemonic #Name as a Display Charset (used on Options screen) -ORFC1345 Mnemonic +ORFC 1345 Mnemonic # U+0020:&SP U+0021:! |