|
MythTV
0.26-pre
|
00001 #include <string.h> 00002 #include "vt.h" 00003 #include "lang.h" 00004 00005 int latin1 = -1; 00006 00007 static unsigned char lang_char[256]; 00008 00009 /* Yankable latin charset :-) 00010 !"#$%&'()*+,-./0123456789:;<=>? 00011 @ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_ 00012 `abcdefghijklmnopqrstuvwxyz{|}~ 00013 ¡¢£¤¥¦§¨©ª«¬®¯°±²³´µ¶·¸¹º»¼½¾¿ 00014 ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖרÙÚÛÜÝÞß 00015 àáâãäåæçèéêëìíîïðñòóôõö÷øùúûüýþÿ 00016 */ 00017 00018 00019 00020 static struct mark { const char *g0, *latin1, *latin2; } marks[16] = 00021 { 00022 /* none */ { "#", 00023 "¤", 00024 "$" }, 00025 /* grave - ` */ { " aeiouAEIOU", 00026 "`àèìòùÀÈÌÒÙ", 00027 "`aeiouAEIOU" }, 00028 /* acute - ' */ { " aceilnorsuyzACEILNORSUYZ", 00029 "'ácéílnórsúýzÁCÉÍLNÓRSÚÝZ", 00030 "'áæéíåñóà¶úý¼ÁÆÉÍÅÑÓÀ¦Úݬ" }, 00031 /* cirumflex - ^ */ { " aeiouAEIOU", 00032 "^âêîôûÂÊÎÔÛ", 00033 "^âeîôuÂEÎÔU" }, 00034 /* tilde - ~ */ { " anoANO", 00035 "~ãñõÃÑÕ", 00036 "~anoANO" }, 00037 /* ??? - ¯ */ { "", 00038 "", 00039 "" }, 00040 /* breve - u */ { "aA", 00041 "aA", 00042 "ãÃ" }, 00043 /* abovedot - · */ { "zZ", 00044 "zZ", 00045 "¿¯" }, 00046 /* diaeresis ¨ */ { "aeiouAEIOU", 00047 "äëïöüÄËÏÖÜ", 00048 "äëiöüÄËIÖÜ" }, 00049 /* ??? - . */ { "", 00050 "", 00051 "" }, 00052 /* ringabove - ° */ { " auAU", 00053 "°åuÅU", 00054 "°aùAÙ" }, 00055 /* cedilla - ¸ */ { "cstCST", 00056 "çstÇST", 00057 "çºþǪÞ" }, 00058 /* ??? - _ */ { " ", 00059 "_", 00060 "_" }, 00061 /* dbl acute - " */ { " ouOU", 00062 "\"ouOU", 00063 "\"õûÕÛ" }, 00064 /* ogonek - \, */ { "aeAE", 00065 "aeAE", 00066 "±ê¡Ê" }, 00067 /* caron - v */ { "cdelnrstzCDELNRSTZ", 00068 "cdelnrstzCDELNRSTZ", 00069 "èïìµòø¹»¾ÈÏÌ¥ÒØ©«®" }, 00070 }; 00071 00072 static unsigned char g2map_latin1[] = 00073 /*0123456789abcdef*/ 00074 " ¡¢£$¥#§¤'\"« " 00075 "°±²³×µ¶·÷'\"»¼½¾¿" 00076 " `´^~ ¨.°¸_\" " 00077 "_¹®© " 00078 " ÆÐªH ILLØ ºÞTNn" 00079 "Kædðhiillø ßþtn\x7f"; 00080 00081 static unsigned char g2map_latin2[] = 00082 /*0123456789abcdef*/ 00083 " icL$Y#§¤'\"< " 00084 "° ×u ÷'\"> " 00085 " `´^~ ¢ÿ¨.°¸_½²·" 00086 "- RC " 00087 " ÐaH iL£O opTNn" 00088 "K ðdhiil³o ßptn\x7f"; 00089 00090 00091 00092 void 00093 lang_init(void) 00094 { 00095 int i; 00096 00097 memset(lang_char, 0, sizeof(lang_char)); 00098 for (i = 1; i <= 13; i++) 00099 lang_char[lang_chars[0][i]] = i; 00100 } 00101 00102 00103 void 00104 conv2latin(unsigned char *p, int n, int lang) 00105 { 00106 int c, gfx = 0; 00107 00108 while (n--) 00109 { 00110 if (lang_char[c = *p]) 00111 { 00112 if (! gfx || (c & 0xa0) != 0x20) 00113 *p = lang_chars[lang + 1][lang_char[c]]; 00114 } 00115 else if ((c & 0xe8) == 0) 00116 gfx = c & 0x10; 00117 p++; 00118 } 00119 } 00120 00121 00122 00123 void 00124 init_enhance(struct enhance *eh) 00125 { 00126 eh->next_des = 0; 00127 } 00128 00129 void 00130 add_enhance(struct enhance *eh, int dcode, unsigned int *t) 00131 { 00132 if (dcode == eh->next_des) 00133 { 00134 memcpy(eh->trip + dcode * 13, t, 13 * sizeof(*t)); 00135 eh->next_des++; 00136 } 00137 else 00138 eh->next_des = -1; 00139 } 00140 00141 void 00142 enhance(struct enhance *eh, struct vt_page *vtp) 00143 { 00144 int row = 0; 00145 unsigned int *p, *e; 00146 00147 if (eh->next_des < 1) 00148 return; 00149 00150 for (p = eh->trip, e = p + eh->next_des * 13; p < e; p++) 00151 if (*p % 2048 != 2047) 00152 { 00153 int adr = *p % 64; 00154 int mode = *p / 64 % 32; 00155 int data = *p / 2048 % 128; 00156 00157 //printf("%2x,%d,%d ", mode, adr, data); 00158 if (adr < 40) 00159 { 00160 // col functions 00161 switch (mode) 00162 { 00163 case 15: // char from G2 set 00164 if (adr < VT_WIDTH && row < VT_HEIGHT) 00165 { 00166 if (latin1) 00167 vtp->data[row][adr] = g2map_latin1[data-32]; 00168 else 00169 vtp->data[row][adr] = g2map_latin2[data-32]; 00170 } 00171 break; 00172 case 16 ... 31: // char from G0 set with diacritical mark 00173 if (adr < VT_WIDTH && row < VT_HEIGHT) 00174 { 00175 struct mark *mark = marks + (mode - 16); 00176 char *x; 00177 00178 if ((x = strchr(mark->g0, data))) 00179 { 00180 if (latin1) 00181 data = mark->latin1[x - mark->g0]; 00182 else 00183 data = mark->latin2[x - mark->g0]; 00184 } 00185 vtp->data[row][adr] = data; 00186 } 00187 break; 00188 } 00189 } 00190 else 00191 { 00192 // row functions 00193 if ((adr -= 40) == 0) 00194 adr = 24; 00195 00196 switch (mode) 00197 { 00198 case 1: // full row color 00199 row = adr; 00200 break; 00201 case 4: // set active position 00202 row = adr; 00203 break; 00204 case 7: // address row 0 (+ full row color) 00205 if (adr == 23) 00206 row = 0; 00207 break; 00208 } 00209 } 00210 } 00211 //printf("\n"); 00212 } 00213
1.7.6.1