/* vi:ts=4:sw=4
jptab.h generator (EUC file)
*/
#ifndef JP
#define JP
#endif
#include <stdio.h>
#include "jp.h"
char * /* 络矢机胺いの淡规 */
UPSYMS = "】”¢★←※〕〈》、。‰ˇ∧…∑∪♂°′≤■◇∶〖∈∷⌒⊙≈∽";
char * /* 井矢机胺いの淡规 */
LOSYMS = "±〔£○↑→〉《」·ˉ☆【∨‘∏∩♀″℃∞∵∴÷≥∫∮√⊥∝≠";
char * /* 敦搂借妄を乖う淡规 */
PCSYMS = "〖≥、。·ˉ¨〃々—~‖‰§№☆…〕〈〉《∧∨∏∩∷⊥∠⊙∮≌∽≠≯";
char * PCKANA = "ぁぃぅぇぉゃゅょゎっ"; /* 敦搂借妄を乖う簿叹 */
char * PCASCI = ".,:;!?>)}]-"; /* 敦搂借妄を乖うASCII矢机*/
char * POSYMS = "‘∑∪∈√∥⌒∫≡≈∝≮★○●◎▲";/* 敦搂借妄(close)の淡规 */
char * POASCI = "<({[@`"; /* 敦搂借妄(close) */
char *SPSYMS = " "; /* 鄂球胺いの淡规 */
char *KJSYMS = "「」『"; /* 戳机胺いの淡规 */
char *KTSYMS = "〖≥"; /* カタカナ胺いの淡规 */
char *HRSYMS = "〕〈〉《"; /* ひらがな胺いの淡规 */
char *SESYMS = "。ˉ々—"; /* 矢琐の淡规 */
/* JIS X 0201 染逞カナ と JIS X0208 链逞戳机のカタカナ婶尸との滦炳 */
char *JISX0201 =
" 。≈∽、ˇヲァィゥェォャュョッ≥アイウエオカキクケコサシスセソタチツテトナニヌネノハヒフヘホマミムメモヤユヨラリルレロワン~‖";
/* tracktabの泣塑胳矢机セット */
char *trackset[] =
{
"tracktab_jp",
" ", "", "", "á", "ⅹ", "ē", "à", "ī",
"", "é", "ǎ", "ě", "ā", "í", "è", "ǐ", "",
"tracktab_bj",
" ", "", "", "ō", "ⅹ", "ò", "ǒ", "ù",
"", "ū", "ó", "ú", "ì", "ǖ", "ǔ", "ǘ", "",
"tracktab_hj",
" ", "", "", "á", "ⅹ", "ē", "à", "ň",
"", "ū", "ó", "ḿ", "ì", "ê", "ǜ", "ɑ", "",
"tracktab_vj",
" ", "", "", "ō", "- ", "ò", "ǒ", "ü",
" -", "ū", "ó", "ǚ", "ā", "ǹ", "ń", "ɡ", "",
# ifdef DOSGEN
"tracktab_pc98",
" ", "", "", "", "ⅹ", "", "", "",
"", "", "", "", "", "", "", "", "",
"tracktab_pc98b",
" ", "", "", "", "ⅹ", "", "", "",
"", "", "", "", "", "", "", "", "",
# endif
NULL
};
#define JPC_NG ((char)-1)
#define JUPS 1
#define JLOS 2
struct jptab
{
char cls1, cls2;
#ifdef DOSGEN
/* Turbo C++ doesn't handle bitfields correctly... */
char punccsym, puncckana, punccasc;
char puncosym, puncoasc, stcend;
unsigned int scase;
#else
int punccsym:1, puncckana:1, punccasc:1;
int puncosym:1, puncoasc:1, stcend:1;
unsigned int scase:2;
#endif
char swap;
} jptab[128];
char *macroJPC[128];
main()
{
int i;
char *cp, *dp;
printf("/*\n");
printf(" This table is generated by jptab.c. \n");
printf("*/\n\n");
printf("#ifndef JP_TRACKTAB\n");
printf("#define JUPS 1\n");
printf("#define JLOS 2\n\n");
printf("#define JPCS TRUE\n");
printf("#define JPOS TRUE\n");
printf("#define JPCK TRUE\n");
printf("#define JPCA TRUE\n\n");
printf("#define JPOA TRUE\n\n");
printf("static struct jptab\n");
printf("{\n");
printf("\tchar\tcls1, cls2;\n");
printf("\tint\tpunccsym:1, puncckana:1, punccasc:1;\n");
printf("\tint\tpuncosym:1, puncoasc:1, stcend:1;\n");
printf("\tunsigned int\tscase:2;\n");
printf("\tchar\tswap;\n");
printf("}\t");
for(i = 0; i < 128; i++)
{
jptab[i].cls1 = jptab[i].cls2 = JPC_NG;
jptab[i].scase = 0;
jptab[i].punccsym = jptab[i].puncckana = jptab[i].punccasc = 0;
jptab[i].puncosym = jptab[i].puncoasc = jptab[i].stcend = 0;
jptab[i].swap = i;
}
/* init cls1 */
for(i = ' ' + 1; i < '\177'; i++)
jptab[i].cls1 = JPC_KANJI;
jptab[JP1_ALNUM & 0x7f].cls1 = JPC_ALNUM;
jptab[JP1_HIRA & 0x7f].cls1 = JPC_HIRA;
jptab[JP1_KATA & 0x7f].cls1 = JPC_KATA;
jptab[JP1_KIGOU & 0x7f].cls1 = JPC_KIGOU;
for(i = 0; i < 128; i++)
macroJPC[i] = "JPTAB macro JPC_XXX ERROR";
macroJPC[0] = "/*Spc*/ 0";
macroJPC[JPC_ALNUM] = "JPC_ALNUM";
macroJPC[JPC_HIRA ] = "JPC_HIRA ";
macroJPC[JPC_KATA ] = "JPC_KATA ";
macroJPC[JPC_KIGOU] = "JPC_KIGOU";
macroJPC[JPC_KANJI] = "JPC_KANJI";
/* init cls2 */
for(i = ' ' + 1; i < '\177'; i++)
jptab[i].cls2 = JPC_KIGOU;
for(cp = SPSYMS; *cp; cp+=2) jptab[ *(cp + 1) & 0x7f ].cls2 = 0;
for(cp = KJSYMS; *cp; cp+=2) jptab[ *(cp + 1) & 0x7f ].cls2 = JPC_KANJI;
for(cp = KTSYMS; *cp; cp+=2) jptab[ *(cp + 1) & 0x7f ].cls2 = JPC_KATA;
for(cp = HRSYMS; *cp; cp+=2) jptab[ *(cp + 1) & 0x7f ].cls2 = JPC_HIRA;
/* init puncsym, punckana */
for(cp = PCSYMS; *cp; cp+=2) jptab[ *(cp + 1) & 0x7f ].punccsym = 1;
for(cp = PCKANA; *cp; cp+=2) jptab[ *(cp + 1) & 0x7f ].puncckana = 1;
for(cp = PCASCI; *cp; cp++) jptab[ *cp & 0x7f ].punccasc = 1;
for(cp = POSYMS; *cp; cp+=2) jptab[ *(cp + 1) & 0x7f ].puncosym = 1;
for(cp = POASCI; *cp; cp++) jptab[ *cp & 0x7f ].puncoasc = 1;
/* init stcend */
for(cp = SESYMS; *cp; cp++) jptab[ *cp & 0x7f ].stcend = 1;
/* init scase */
for(cp = UPSYMS; *cp; cp+=2) jptab[ *(cp + 1) & 0x7f ].scase = JUPS;
for(cp = LOSYMS; *cp; cp+=2) jptab[ *(cp + 1) & 0x7f ].scase = JLOS;
/* init swap */
for(cp = UPSYMS, dp = LOSYMS; *cp; cp+=2, dp+=2)
jptab[ *(cp + 1) & 0x7f ].swap = *(dp + 1) | 0x80;
for(cp = LOSYMS, dp = UPSYMS; *cp; cp+=2, dp+=2)
jptab[ *(cp + 1) & 0x7f ].swap = *(dp + 1) | 0x80;
printf("\tjptab[128] = {\n");
for(i = 0; i < 128; i++)
{
printf("{");
/* cls1 */
printf("%9s,", jptab[i].cls1==JPC_NG ? "-1": macroJPC[jptab[i].cls1]);
/* cls2 */
printf("%9s,", jptab[i].cls2==JPC_NG ? "-1": macroJPC[jptab[i].cls2]);
/* punccsym */
printf("%s,", jptab[i].punccsym ? "JPCS": " 0");
/* puncckana */
printf("%s,", jptab[i].puncckana ? "JPCK": " 0");
/* punccasc */
printf("%s,", jptab[i].punccasc ? "JPCA": " 0");
/* puncosym */
printf("%s,", jptab[i].puncosym ? "JPOS": " 0");
/* puncoasc */
printf("%s,", jptab[i].puncoasc ? "JPOA": " 0");
/* stcend */
printf("%s,", jptab[i].stcend ? "1": "0");
/* scase */
switch(jptab[i].scase)
{
case JUPS: printf("JUPS,");break;
case JLOS: printf("JLOS,");break;
default: printf(" 0,");
}
/* swap */
if ((jptab[i].swap & 0x7f) > ' '&& (jptab[i].swap & 0x7f) < '\177')
printf("/*%c%c*/", JP1_KIGOU | 0x80, jptab[i].swap | 0x80);
else
printf("/*%2x*/", jptab[i].swap & 0x7f);
/*printf(" ");*/
printf("'\\%03o' ", (jptab[i].swap | 0x80) & 0xff);
/* */
printf("}");
if ( i > ' ' && i < '\177')
printf("/*%c %c%c%c%c */ ",
i, JP1_HIRA|0x80, i|0x80,
JP1_KIGOU|0x80,i|0x80);
else
printf("/* 0x%02x */ ", i);
printf(i != '\177' ? ",\n": "\n");
}
printf("};\n\n");
/*
* JIS X 0201R <-> JIS X 0208 conversion table
*/
printf("char jisx0201r[] =");
printf("{\n");
for(cp = JISX0201; *cp; cp+=2)
printf("\t '\\%03o', '\\%03o', /* %c%c */\n",
*cp & 0xff , *(cp + 1) & 0xff, *cp, *(cp + 1));
printf("};\n\n");
/*
*
* JP_TRACKTAB
*
*/
printf("#else /* JP_TRACKTAB */\n");
{
char **tp;
for(tp = trackset; *tp; tp++)
{
int i;
printf("char *%s[] =\n", *tp++);
printf("{\n");
for(i = 1; **tp; tp++, i++)
{
unsigned char *cp;
int n;
printf(" \"");
for(n = 0, cp = (unsigned char *)*tp; *cp; cp++)
if (IsKanji(*cp))
{
printf("\\%03o", *cp);
n += 4;
}
else
{
printf("%c", *cp);
n ++;
}
printf("\"");
for(; n < 8; n++)
printf(" ");
printf("/*%s*/", *tp);
if (**(tp + 1))
printf(",");
if (i % 4 == 0)
printf("\n");
}
printf("};\n");
}
}
printf("#endif /* JP_TRACKTAB */\n");
return 0;
}
syntax highlighted by Code2HTML, v. 0.9.1