Rev 6377 | Go to most recent revision | Only display areas with differences | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 6377 | Rev 6378 | ||
---|---|---|---|
1 | struct _tag { |
1 | struct _tag { |
2 | dword start; |
2 | dword start; |
3 | dword name; |
3 | dword name; |
4 | dword param[10]; |
4 | dword param[10]; |
5 | dword value[10]; |
5 | dword value[10]; |
6 | void parce(); |
6 | void parce(); |
7 | int nameis(); |
7 | int nameis(); |
8 | void clear(); |
8 | void clear(); |
9 | }; |
9 | }; |
10 | 10 | ||
11 | void _tag::parce() |
11 | void _tag::parce() |
12 | { |
12 | { |
13 | dword o = name = start; |
13 | dword o = name = start; |
14 | while (ESBYTE[o]!=' ') && (ESBYTE[o]) o++; //searching for a space after tag name |
14 | while (ESBYTE[o]!=' ') && (ESBYTE[o]) o++; //searching for a space after tag name |
15 | ESBYTE[o] = '\0'; |
15 | ESBYTE[o] = '\0'; |
16 | strlwr(name); |
16 | strlwr(name); |
17 | } |
17 | } |
18 | 18 | ||
19 | int _tag::nameis(dword _in_tag_name) |
19 | int _tag::nameis(dword _in_tag_name) |
20 | { |
20 | { |
21 | if (name) && (strcmp(_in_tag_name, name)==0) return true; |
21 | if (name) && (strcmp(_in_tag_name, name)==0) return true; |
22 | return false; |
22 | return false; |
23 | } |
23 | } |
24 | 24 | ||
25 | void _tag::clear() |
25 | void _tag::clear() |
26 | { |
26 | { |
27 | start=name=0; |
27 | start=name=0; |
28 | } |
28 | } |
29 | 29 | ||
30 | 30 | ||
31 | /* |
31 | /* |
32 | unsigned int GetNextParam() |
32 | unsigned int GetNextParam() |
33 | { |
33 | { |
34 | byte kavichki=0; |
34 | byte kavichki=0; |
35 | int i = strlen(#tagparam) - 1; |
35 | int i = strlen(#tagparam) - 1; |
36 | 36 | ||
37 | if (!tagparam) return 0; |
37 | if (!tagparam) return 0; |
38 | 38 | ||
39 | WHILE((i > 0) && ((tagparam[i] == '"') || (tagparam[i] == ' ') || (tagparam[i] == '\'') || (tagparam[i] == '/'))) |
39 | WHILE((i > 0) && ((tagparam[i] == '"') || (tagparam[i] == ' ') || (tagparam[i] == '\'') || (tagparam[i] == '/'))) |
40 | { |
40 | { |
41 | IF (tagparam[i] == '"') || (tagparam[i] == '\'') kavichki=tagparam[i]; |
41 | IF (tagparam[i] == '"') || (tagparam[i] == '\'') kavichki=tagparam[i]; |
42 | tagparam[i] = 0x00; |
42 | tagparam[i] = 0x00; |
43 | i--; |
43 | i--; |
44 | } |
44 | } |
45 | 45 | ||
46 | if (kavichki) |
46 | if (kavichki) |
47 | { |
47 | { |
48 | i=strrchr(#tagparam, kavichki); |
48 | i=strrchr(#tagparam, kavichki); |
49 | strlcpy(#val, #tagparam + i, sizeof(val)); |
49 | strlcpy(#val, #tagparam + i, sizeof(val)); |
50 | } |
50 | } |
51 | else |
51 | else |
52 | { |
52 | { |
53 | WHILE((i > 0) && (tagparam[i] <>'=')) i--; //i=strrchr(#tagparam, '=')+1; |
53 | WHILE((i > 0) && (tagparam[i] <>'=')) i--; //i=strrchr(#tagparam, '=')+1; |
54 | i++; |
54 | i++; |
55 | strlcpy(#val, #tagparam + i, sizeof(val)); |
55 | strlcpy(#val, #tagparam + i, sizeof(val)); |
56 | 56 | ||
57 | WHILE (val[0] == ' ') strcpy(#val, #val+1); |
57 | WHILE (val[0] == ' ') strcpy(#val, #val+1); |
58 | } |
58 | } |
59 | tagparam[i] = 0x00; |
59 | tagparam[i] = 0x00; |
60 | 60 | ||
61 | FOR ( ; ((tagparam[i] <>' ') && (i > 0); i--) |
61 | FOR ( ; ((tagparam[i] <>' ') && (i > 0); i--) |
62 | { |
62 | { |
63 | IF (tagparam[i] == '=') //äåðçêàÿ çàãëóøêà |
63 | IF (tagparam[i] == '=') //äåðçêàÿ çàãëóøêà |
64 | tagparam[i + 1] = 0x00; |
64 | tagparam[i + 1] = 0x00; |
65 | } |
65 | } |
66 | strlcpy(#attr, #tagparam + i + 1, sizeof(attr)); |
66 | strlcpy(#attr, #tagparam + i + 1, sizeof(attr)); |
67 | tagparam[i] = 0x00; |
67 | tagparam[i] = 0x00; |
68 | strlwr(#attr); |
68 | strlwr(#attr); |
69 | return 1; |
69 | return 1; |
70 | } |
70 | } |
71 | */ |
71 | */ |
72 | 72 | ||
73 | // |
73 | // |
74 | // STYLE |
74 | // STYLE |
75 | // |
75 | // |
76 | 76 | ||
77 | struct _style { |
77 | struct _style { |
78 | bool b, u, i, s; |
78 | bool b, u, i, s; |
79 | bool h1, h2, h3, h4, h5, h6; |
79 | bool h1, h2, h3, h4, h5, h6; |
80 | bool a; |
80 | bool a; |
81 | bool pre; |
81 | bool pre; |
82 | bool ignore; |
82 | bool ignore; |
83 | dword color; |
83 | dword color; |
84 | void clear(); |
84 | void clear(); |
85 | } style; |
85 | } style; |
86 | 86 | ||
87 | void _style::clear() |
87 | void _style::clear() |
88 | { |
88 | { |
89 | b=u=i=s=0; |
89 | b=u=i=s=0; |
90 | h1=h2=h3=h4=h5=h6=0; |
90 | h1=h2=h3=h4=h5=h6=0; |
91 | a=0; |
91 | a=0; |
92 | pre=0; |
92 | pre=0; |
93 | ignore=0; |
93 | ignore=0; |
94 | color=0; |
94 | color=0; |
95 | } |
95 | } |
96 | 96 | ||
97 | 97 | ||
98 | // |
98 | // |
99 | // TEXT |
99 | // TEXT |
100 | // |
100 | // |
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); |
107 | }; |
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++; |
- | |
148 | } |
- | |
149 | } |
108 | |
150 | 109 | ||
151 | // unicode conversion for special characters |
110 | // unicode conversion for special characters |
152 | char *unicode_tags[]={ |
111 | char *unicode_tags[]={ |
153 | "nbsp", " ", |
112 | "nbsp", " ", |
154 | "#38", " ", |
113 | "#38", " ", |
155 | "#160", " ", |
114 | "#160", " ", |
156 | 115 | ||
157 | "ntilde", "ñ", // spanish n special ñ |
116 | "ntilde", "n", // spanish n special ñ |
158 | "#224", 0xC3A0, // spanish a with grove accent 'à' |
117 | "#224", "à", // spanish a with grove accent 'à' |
159 | "#241", 0xC3B1, // spanish symbol |
118 | "#241", "n", // spanish symbol |
160 | 119 | ||
161 | "copy", "(c)", |
120 | "copy", "(c)", |
162 | "#169", "(c)", |
121 | "#169", "(c)", |
163 | 122 | ||
164 | "trade", "[TM]", |
123 | "trade", "[TM]", |
165 | 124 | ||
166 | "reg", "(r)", |
125 | "reg", "(r)", |
167 | "#174", "(r)", |
126 | "#174", "(r)", |
168 | 127 | ||
169 | "bdquo", ",,", |
128 | "bdquo", ",,", |
170 | 129 | ||
171 | "amp", "&", |
130 | "amp", "&", |
172 | "#38", "&", |
131 | "#38", "&", |
173 | 132 | ||
174 | "lt", "<", |
133 | "lt", "<", |
175 | "#60", "<", |
134 | "#60", "<", |
176 | 135 | ||
177 | "gt", ">", |
136 | "gt", ">", |
178 | "#62", ">", |
137 | "#62", ">", |
179 | 138 | ||
180 | "minus", "-", |
139 | "minus", "-", |
181 | "ndash", "-", |
140 | "ndash", "-", |
182 | "mdash", "-", //-- |
141 | "mdash", "-", //-- |
183 | "#8722", "-", |
142 | "#8722", "-", |
184 | "#8211", "-", |
143 | "#8211", "-", |
185 | "#151", "-", |
144 | "#151", "-", |
186 | "#149", "-", |
145 | "#149", "-", |
187 | 146 | ||
188 | "rsquo", "'", |
147 | "rsquo", "'", |
189 | "#39", "'", |
148 | "#39", "'", |
190 | "#96", "'", |
149 | "#96", "'", |
191 | "#8217", "'", |
150 | "#8217", "'", |
192 | 151 | ||
193 | "quot", "\"", |
152 | "quot", "\"", |
194 | "#34", "\"", |
153 | "#34", "\"", |
195 | "ldquo", "\"", |
154 | "ldquo", "\"", |
196 | "rdquo", "\"", |
155 | "rdquo", "\"", |
197 | "#8222", "\"", |
156 | "#8222", "\"", |
198 | "#8221", "\"", |
157 | "#8221", "\"", |
199 | 158 | ||
200 | "laquo", "<<", |
159 | "laquo", "<<", |
201 | "#171", "<<", |
160 | "#171", "<<", |
202 | "raquo", ">>", |
161 | "raquo", ">>", |
203 | "#187", ">>", |
162 | "#187", ">>", |
204 | 163 | ||
205 | "uarr", "\24", |
164 | "uarr", "\24", |
206 | "darr", "\25", |
165 | "darr", "\25", |
207 | "rarr", "\26", |
166 | "rarr", "\26", |
208 | "larr", "\27", |
167 | "larr", "\27", |
209 | 168 | ||
210 | "#1028", "\242", |
169 | "#1028", "\242", |
211 | "#1030", "I", |
170 | "#1030", "I", |
212 | "#1031", "\244", |
171 | "#1031", "\244", |
213 | 172 | ||
214 | "#8470", "N", |
173 | "#8470", "N", |
215 | "bull", "-", //âîîáùå çäåñü òî÷êà |
174 | "bull", "-", //âîîáùå çäåñü òî÷êà |
216 | "percnt","%", |
175 | "percnt","%", |
217 | 176 | ||
- | 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); |
225 | for (i=0; unicode_tags[i]!=0; i+=2) { |
241 | for (i=0; unicode_tags[i]!=0; i+=2) { |
226 | if (strcmp(#str, unicode_tags[i]) == 0) { |
242 | if (strcmp(str2, unicode_tags[i]) == 0) { |
- | 243 | //j = strlen(unicode_tags[i+1]); |
|
227 | //debugval("i: ", i); |
244 | //debugval("i: ", i); |
228 | return unicode_tags[i+1]); |
245 | //strcat(text2, unicode_tags[i+1]); |
- | 246 | i++; |
|
- | 247 | return i; |
|
229 | } |
248 | } |
230 | } |
249 | } |
231 | return 0; |
250 | return ' '; |
232 | } |
251 | }>>", |
233 | - | ||
234 | // function to clean string str |
- | |
235 | void clean_str() { |
- | |
236 | int i; |
- | |
237 | for (i=0; i < 7; i++) { |
- | |
238 | str[i] = 0; |
- | |
239 | } |
- | |
240 | }>", |
252 | "raquo",><", |
241 | "raquo",><", |
253 | "raquo",>", |
242 | "raquo",>", |
254 | "#171",><", |
243 | "#171",><", |
255 | "#171",>", |
244 | "#171",>", |
256 | |
245 | 257 | "gt",>", |
|
246 | "gt",>", |
258 | "#60",>>> |
247 | "#60",>>>>> |
- |