Rev 6377 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 6377 | Rev 6378 | ||
---|---|---|---|
Line 101... | Line 101... | ||
101 | 101 | ||
102 | struct _text { |
102 | struct _text { |
103 | dword start; |
103 | dword start; |
104 | char str[7]; |
104 | char str[7]; |
105 | int x, y; |
105 | int x, y; |
106 | void fixSpecial(); |
106 | void fixSpecial(dword text); |
Line 107... | Line -... | ||
107 | }; |
- | |
108 | - | ||
109 | // function to be called to fix the special symbols |
- | |
110 | void _text::fixSpecial() { |
- | |
111 | get_char(start); |
- | |
112 | clean_str(); |
- | |
113 | } |
- | |
114 | - | ||
115 | // function that traverse the text in sarch for a special |
- | |
116 | // character starting with & |
- | |
117 | // if found, try to look for the conversion |
- | |
118 | void get_char(dword text) { |
- | |
119 | byte ch; |
- | |
120 | int i = 0, j = 0; |
- | |
121 | dword text2 = text; |
- | |
122 | loop () { |
- | |
123 | ch = ESBYTE[text]; |
- | |
124 | if (!ch) return; |
- | |
125 | if (ch=='&') { |
- | |
126 | i = 0; |
- | |
127 | text++; |
- | |
128 | while ( i < 7) { |
- | |
129 | ch = ESBYTE[text]; |
- | |
130 | if (ch == ';') { |
- | |
131 | ESBYTE[text2] = get_symbol(); |
- | |
132 | while (j < i) { |
- | |
133 | j++; |
- | |
134 | text2++; |
- | |
135 | ESBYTE[text2] = 0; |
- | |
136 | } |
- | |
137 | //debugln(#str); |
- | |
138 | break; |
- | |
139 | } |
- | |
140 | str[i] = ch; |
- | |
141 | if (!ch) return; |
- | |
142 | text++; |
- | |
143 | i++; |
- | |
144 | } |
- | |
145 | } |
- | |
146 | text++; |
- | |
147 | text2++; |
- | |
Line 148... | Line 107... | ||
148 | } |
107 | }; |
149 | } |
108 | |
150 | 109 | ||
151 | // unicode conversion for special characters |
110 | // unicode conversion for special characters |
152 | char *unicode_tags[]={ |
111 | char *unicode_tags[]={ |
Line 153... | Line 112... | ||
153 | "nbsp", " ", |
112 | "nbsp", " ", |
154 | "#38", " ", |
113 | "#38", " ", |
155 | "#160", " ", |
114 | "#160", " ", |
Line 156... | Line 115... | ||
156 | 115 | ||
157 | "ntilde", "ñ", // spanish n special ñ |
116 | "ntilde", "n", // spanish n special ñ |
Line 158... | Line 117... | ||
158 | "#224", 0xC3A0, // spanish a with grove accent 'à' |
117 | "#224", "à", // spanish a with grove accent 'à' |
Line 215... | Line 174... | ||
215 | "bull", "-", //âîîáùå çäåñü òî÷êà |
174 | "bull", "-", //âîîáùå çäåñü òî÷êà |
216 | "percnt","%", |
175 | "percnt","%", |
Line 217... | Line 176... | ||
217 | 176 | ||
Line -... | Line 177... | ||
- | 177 | 0}; |
|
- | 178 | ||
- | 179 | // function to be called to fix the special symbols |
|
- | 180 | void _text::fixSpecial(dword text) { |
|
- | 181 | //dword text = start; |
|
- | 182 | byte ch; |
|
- | 183 | int i , j, z; |
|
- | 184 | dword aux; |
|
- | 185 | dword text2 = text; |
|
- | 186 | loop () { |
|
- | 187 | ch = ESBYTE[text]; |
|
- | 188 | if (!ch) return; |
|
- | 189 | if (ch=='&') { |
|
- | 190 | i = 0; |
|
- | 191 | j = 0; |
|
- | 192 | text++; |
|
- | 193 | while ( i < 7) { |
|
- | 194 | ch = ESBYTE[text]; |
|
- | 195 | if (ch == ';') { |
|
- | 196 | z = get_symbol(#str); |
|
- | 197 | //debugval("z: ", z); |
|
- | 198 | aux = unicode_tags[z]; |
|
- | 199 | strtrim(aux); |
|
- | 200 | debugln(aux); |
|
- | 201 | ch = ESBYTE[aux]; |
|
- | 202 | while (ch) { |
|
- | 203 | ESBYTE[text2] = ch; |
|
- | 204 | aux++; |
|
- | 205 | text2++; |
|
- | 206 | ch = ESBYTE[aux]; |
|
- | 207 | } |
|
- | 208 | ch = ESBYTE[text2]; |
|
- | 209 | //debugval("i: ", i); |
|
- | 210 | while (ch != ';') { |
|
- | 211 | //debugval("j: ", j); |
|
- | 212 | ESBYTE[text2] = ' '; |
|
- | 213 | text2++; |
|
- | 214 | ch = ESBYTE[text2]; |
|
- | 215 | } |
|
- | 216 | ESBYTE[text2] = ' '; |
|
- | 217 | //for (j=0;j |
|
- | 218 | //debugln(#str); |
|
- | 219 | //clean_str(); |
|
- | 220 | break; |
|
- | 221 | } |
|
- | 222 | str[i] = ch; |
|
- | 223 | if (!ch) return; |
|
- | 224 | text++; |
|
- | 225 | i++; |
|
- | 226 | } |
|
- | 227 | for (i=0; i < 7; i++) str[i] = 0; |
|
- | 228 | } |
|
- | 229 | text++; |
|
- | 230 | text2++; |
|
- | 231 | } |
|
- | 232 | } |
|
- | 233 | ||
218 | 0}; |
234 | |
219 | 235 | ||
220 | // function to look for the conversion od special characters |
236 | // function to look for the conversion od special characters |
221 | // if not found--> return 0 |
237 | // if not found--> return 0 |
222 | char get_symbol() { |
238 | int get_symbol(char *str2) { |
223 | int i; |
239 | int i,j; |
224 | //debugln(#str); |
240 | //debugln(#str2); |
- | 241 | for (i=0; unicode_tags[i]!=0; i+=2) { |
|
225 | for (i=0; unicode_tags[i]!=0; i+=2) { |
242 | if (strcmp(str2, unicode_tags[i]) == 0) { |
226 | if (strcmp(#str, unicode_tags[i]) == 0) { |
243 | //j = strlen(unicode_tags[i+1]); |
- | 244 | //debugval("i: ", i); |
|
- | 245 | //strcat(text2, unicode_tags[i+1]); |
|
227 | //debugval("i: ", i); |
246 | i++; |
228 | return unicode_tags[i+1]); |
247 | return i; |
229 | } |
248 | } |
230 | } |
249 | } |
Line 231... | Line -... | ||
231 | return 0; |
- | |
232 | } |
- | |
233 | - | ||
234 | // function to clean string str |
- | |
235 | void clean_str() { |
- | |
236 | int i; |
- | |
237 | for (i=0; i < 7; i++) { |
- |