Check out the latest version of Routino: svn co http://routino.org/svn/trunk routino
Contents of /branches/destination-access/src/translations.c
Parent Directory
|
Revision Log
Revision 1807 -
(show annotations)
(download)
(as text)
Wed Sep 23 18:20:13 2015 UTC (9 years, 5 months ago) by amb
File MIME type: text/x-csrc
File size: 57891 byte(s)
Wed Sep 23 18:20:13 2015 UTC (9 years, 5 months ago) by amb
File MIME type: text/x-csrc
File size: 57891 byte(s)
Merge the trunk changes back into the destination-access branch.
1 | /*************************************** |
2 | Load the translations from a file and the functions for handling them. |
3 | |
4 | Part of the Routino routing software. |
5 | ******************/ /****************** |
6 | This file Copyright 2010-2015 Andrew M. Bishop |
7 | |
8 | This program is free software: you can redistribute it and/or modify |
9 | it under the terms of the GNU Affero General Public License as published by |
10 | the Free Software Foundation, either version 3 of the License, or |
11 | (at your option) any later version. |
12 | |
13 | This program is distributed in the hope that it will be useful, |
14 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
16 | GNU Affero General Public License for more details. |
17 | |
18 | You should have received a copy of the GNU Affero General Public License |
19 | along with this program. If not, see <http://www.gnu.org/licenses/>. |
20 | ***************************************/ |
21 | |
22 | |
23 | #include <stdio.h> |
24 | #include <string.h> |
25 | #include <stdlib.h> |
26 | |
27 | #include "files.h" |
28 | #include "translations.h" |
29 | #include "xmlparse.h" |
30 | |
31 | |
32 | /* Default English translations - Must not require any UTF-8 encoding */ |
33 | |
34 | static Translation default_translation= |
35 | { |
36 | .lang = "--", |
37 | .language = "English (built-in)", |
38 | |
39 | .raw_copyright_creator = {"Creator","Routino - http://www.routino.org/"}, |
40 | .raw_copyright_source = {NULL,NULL}, |
41 | .raw_copyright_license = {NULL,NULL}, |
42 | |
43 | .xml_copyright_creator = {"Creator","Routino - http://www.routino.org/"}, |
44 | .xml_copyright_source = {NULL,NULL}, |
45 | .xml_copyright_license = {NULL,NULL}, |
46 | |
47 | .xml_heading = {"South","South-West","West","North-West","North","North-East","East","South-East","South"}, |
48 | .xml_turn = {"Very sharp left","Sharp left","Left","Slight left","Straight on","Slight right","Right","Sharp right","Very sharp right"}, |
49 | .xml_ordinal = {"First","Second","Third","Fourth","Fifth","Sixth","Seventh","Eighth","Ninth","Tenth"}, |
50 | |
51 | .notxml_heading = {"South","South-West","West","North-West","North","North-East","East","South-East","South"}, |
52 | .notxml_turn = {"Very sharp left","Sharp left","Left","Slight left","Straight on","Slight right","Right","Sharp right","Very sharp right"}, |
53 | .notxml_ordinal = {"First","Second","Third","Fourth","Fifth","Sixth","Seventh","Eighth","Ninth","Tenth"}, |
54 | |
55 | .raw_highway = {"","motorway","trunk road","primary road","secondary road","tertiary road","unclassified road","residential road","service road","track","cycleway","path","steps","ferry"}, |
56 | |
57 | .xml_route_shortest = "Shortest", |
58 | .xml_route_quickest = "Quickest", |
59 | |
60 | .html_waypoint = "<span class='w'>Waypoint</span>", /* span tag added when reading XML translations file */ |
61 | .html_junction = "Junction", |
62 | .html_roundabout = "Roundabout", |
63 | |
64 | .html_title = "%s Route", |
65 | .html_start = "<tr class='n'>Start at %s, head <span class='b'>%s</span>\n", /* span tags added when reading XML translations file */ |
66 | .html_node = "<tr class='n'>At %s, go <span class='t'>%s</span> heading <span class='b'>%s</span>\n", /* span tags added when reading XML translations file */ |
67 | .html_rbnode = "<tr class='n'>Leave %s, take the <span class='b'>%s</span> exit heading <span class='b'>%s</span>\n", /* span tags added when reading XML translations file */ |
68 | .html_segment = "<tr class='s'>Follow <span class='h'>%s</span> for <span class='d'>%.3f km, %.1f min</span>", /* span tags added when reading XML translations file */ |
69 | .html_stop = "<tr class='n'>Stop at %s\n", |
70 | .html_total = "<tr class='t'><span class='j'>Total %.1f km, %.0f minutes</span>\n",/* span tags added when reading XML translations file */ |
71 | .html_subtotal= "<span class='j'>%.1f km, %.0f minutes</span>\n",/* span tag added when reading XML translations file */ |
72 | |
73 | .nothtml_waypoint = "Waypoint", |
74 | .nothtml_junction = "Junction", |
75 | .nothtml_roundabout = "Roundabout", |
76 | |
77 | .nothtml_title = "%s Route", |
78 | .nothtml_start = "Start at %s, head %s", |
79 | .nothtml_node = "At %s, go %s heading %s", |
80 | .nothtml_rbnode = "Leave %s, take the %s exit heading %s", |
81 | .nothtml_segment = "Follow %s for %.3f km, %.1f min", |
82 | .nothtml_stop = "Stop at %s", |
83 | .nothtml_total = "Total %.1f km, %.0f minutes", |
84 | .nothtml_subtotal= "%.1f km, %.0f minutes", |
85 | |
86 | .gpx_desc = "%s route between 'start' and 'finish' waypoints", |
87 | .gpx_name = "%s route", |
88 | .gpx_step = "%s on '%s' for %.3f km, %.1f min", |
89 | .gpx_final = "Total Journey %.1f km, %.0f minutes", |
90 | |
91 | .gpx_start = "START", |
92 | .gpx_inter = "INTER", |
93 | .gpx_trip = "TRIP", |
94 | .gpx_finish = "FINISH" |
95 | }; |
96 | |
97 | |
98 | /* Local variables (re-intialised by FreeXMLTranslations() function) */ |
99 | |
100 | /*+ The translations that have been loaded from file. +*/ |
101 | static Translation **loaded_translations=NULL; |
102 | |
103 | /*+ The number of translations that have been loaded from file. +*/ |
104 | static int nloaded_translations=0; |
105 | |
106 | |
107 | /* Local variables (re-initialised for each file) */ |
108 | |
109 | /*+ Store all of the translations. +*/ |
110 | static int store_all; |
111 | |
112 | /*+ The translation language that is to be stored. +*/ |
113 | static const char *store_lang; |
114 | |
115 | /*+ This current language is to be stored. +*/ |
116 | static int store; |
117 | |
118 | /*+ The chosen language has been stored. +*/ |
119 | static int stored; |
120 | |
121 | |
122 | /* The XML tag processing function prototypes */ |
123 | |
124 | //static int xmlDeclaration_function(const char *_tag_,int _type_,const char *version,const char *encoding); |
125 | //static int RoutinoTranslationsType_function(const char *_tag_,int _type_); |
126 | static int LanguageType_function(const char *_tag_,int _type_,const char *lang,const char *language); |
127 | //static int CopyrightType_function(const char *_tag_,int _type_); |
128 | static int TurnType_function(const char *_tag_,int _type_,const char *direction,const char *string); |
129 | static int HeadingType_function(const char *_tag_,int _type_,const char *direction,const char *string); |
130 | static int OrdinalType_function(const char *_tag_,int _type_,const char *number,const char *string); |
131 | static int HighwayType_function(const char *_tag_,int _type_,const char *type,const char *string); |
132 | static int RouteType_function(const char *_tag_,int _type_,const char *type,const char *string); |
133 | //static int HTMLType_function(const char *_tag_,int _type_); |
134 | //static int GPXType_function(const char *_tag_,int _type_); |
135 | static int CopyrightCreatorType_function(const char *_tag_,int _type_,const char *string,const char *text); |
136 | static int CopyrightSourceType_function(const char *_tag_,int _type_,const char *string,const char *text); |
137 | static int CopyrightLicenseType_function(const char *_tag_,int _type_,const char *string,const char *text); |
138 | static int HTMLWaypointType_function(const char *_tag_,int _type_,const char *type,const char *string); |
139 | static int HTMLTitleType_function(const char *_tag_,int _type_,const char *text); |
140 | static int HTMLStartType_function(const char *_tag_,int _type_,const char *text); |
141 | static int HTMLNodeType_function(const char *_tag_,int _type_,const char *text); |
142 | static int HTMLRBNodeType_function(const char *_tag_,int _type_,const char *text); |
143 | static int HTMLSegmentType_function(const char *_tag_,int _type_,const char *text); |
144 | static int HTMLStopType_function(const char *_tag_,int _type_,const char *text); |
145 | static int HTMLTotalType_function(const char *_tag_,int _type_,const char *text); |
146 | static int HTMLSubtotalType_function(const char *_tag_,int _type_,const char *text); |
147 | static int GPXWaypointType_function(const char *_tag_,int _type_,const char *type,const char *string); |
148 | static int GPXDescType_function(const char *_tag_,int _type_,const char *text); |
149 | static int GPXNameType_function(const char *_tag_,int _type_,const char *text); |
150 | static int GPXStepType_function(const char *_tag_,int _type_,const char *text); |
151 | static int GPXFinalType_function(const char *_tag_,int _type_,const char *text); |
152 | |
153 | |
154 | /* The XML tag definitions (forward declarations) */ |
155 | |
156 | static const xmltag xmlDeclaration_tag; |
157 | static const xmltag RoutinoTranslationsType_tag; |
158 | static const xmltag LanguageType_tag; |
159 | static const xmltag CopyrightType_tag; |
160 | static const xmltag TurnType_tag; |
161 | static const xmltag HeadingType_tag; |
162 | static const xmltag OrdinalType_tag; |
163 | static const xmltag HighwayType_tag; |
164 | static const xmltag RouteType_tag; |
165 | static const xmltag HTMLType_tag; |
166 | static const xmltag GPXType_tag; |
167 | static const xmltag CopyrightCreatorType_tag; |
168 | static const xmltag CopyrightSourceType_tag; |
169 | static const xmltag CopyrightLicenseType_tag; |
170 | static const xmltag HTMLWaypointType_tag; |
171 | static const xmltag HTMLTitleType_tag; |
172 | static const xmltag HTMLStartType_tag; |
173 | static const xmltag HTMLNodeType_tag; |
174 | static const xmltag HTMLRBNodeType_tag; |
175 | static const xmltag HTMLSegmentType_tag; |
176 | static const xmltag HTMLStopType_tag; |
177 | static const xmltag HTMLTotalType_tag; |
178 | static const xmltag HTMLSubtotalType_tag; |
179 | static const xmltag GPXWaypointType_tag; |
180 | static const xmltag GPXDescType_tag; |
181 | static const xmltag GPXNameType_tag; |
182 | static const xmltag GPXStepType_tag; |
183 | static const xmltag GPXFinalType_tag; |
184 | |
185 | |
186 | /* The XML tag definition values */ |
187 | |
188 | /*+ The complete set of tags at the top level. +*/ |
189 | static const xmltag * const xml_toplevel_tags[]={&xmlDeclaration_tag,&RoutinoTranslationsType_tag,NULL}; |
190 | |
191 | /*+ The xmlDeclaration type tag. +*/ |
192 | static const xmltag xmlDeclaration_tag= |
193 | {"xml", |
194 | 2, {"version","encoding"}, |
195 | NULL, |
196 | {NULL}}; |
197 | |
198 | /*+ The RoutinoTranslationsType type tag. +*/ |
199 | static const xmltag RoutinoTranslationsType_tag= |
200 | {"routino-translations", |
201 | 0, {NULL}, |
202 | NULL, |
203 | {&LanguageType_tag,NULL}}; |
204 | |
205 | /*+ The LanguageType type tag. +*/ |
206 | static const xmltag LanguageType_tag= |
207 | {"language", |
208 | 2, {"lang","language"}, |
209 | LanguageType_function, |
210 | {&CopyrightType_tag,&TurnType_tag,&HeadingType_tag,&OrdinalType_tag,&HighwayType_tag,&RouteType_tag,&HTMLType_tag,&GPXType_tag,NULL}}; |
211 | |
212 | /*+ The CopyrightType type tag. +*/ |
213 | static const xmltag CopyrightType_tag= |
214 | {"copyright", |
215 | 0, {NULL}, |
216 | NULL, |
217 | {&CopyrightCreatorType_tag,&CopyrightSourceType_tag,&CopyrightLicenseType_tag,NULL}}; |
218 | |
219 | /*+ The TurnType type tag. +*/ |
220 | static const xmltag TurnType_tag= |
221 | {"turn", |
222 | 2, {"direction","string"}, |
223 | TurnType_function, |
224 | {NULL}}; |
225 | |
226 | /*+ The HeadingType type tag. +*/ |
227 | static const xmltag HeadingType_tag= |
228 | {"heading", |
229 | 2, {"direction","string"}, |
230 | HeadingType_function, |
231 | {NULL}}; |
232 | |
233 | /*+ The OrdinalType type tag. +*/ |
234 | static const xmltag OrdinalType_tag= |
235 | {"ordinal", |
236 | 2, {"number","string"}, |
237 | OrdinalType_function, |
238 | {NULL}}; |
239 | |
240 | /*+ The HighwayType type tag. +*/ |
241 | static const xmltag HighwayType_tag= |
242 | {"highway", |
243 | 2, {"type","string"}, |
244 | HighwayType_function, |
245 | {NULL}}; |
246 | |
247 | /*+ The RouteType type tag. +*/ |
248 | static const xmltag RouteType_tag= |
249 | {"route", |
250 | 2, {"type","string"}, |
251 | RouteType_function, |
252 | {NULL}}; |
253 | |
254 | /*+ The HTMLType type tag. +*/ |
255 | static const xmltag HTMLType_tag= |
256 | {"output-html", |
257 | 0, {NULL}, |
258 | NULL, |
259 | {&HTMLWaypointType_tag,&HTMLTitleType_tag,&HTMLStartType_tag,&HTMLNodeType_tag,&HTMLRBNodeType_tag,&HTMLSegmentType_tag,&HTMLStopType_tag,&HTMLTotalType_tag,&HTMLSubtotalType_tag,NULL}}; |
260 | |
261 | /*+ The GPXType type tag. +*/ |
262 | static const xmltag GPXType_tag= |
263 | {"output-gpx", |
264 | 0, {NULL}, |
265 | NULL, |
266 | {&GPXWaypointType_tag,&GPXDescType_tag,&GPXNameType_tag,&GPXStepType_tag,&GPXFinalType_tag,NULL}}; |
267 | |
268 | /*+ The CopyrightCreatorType type tag. +*/ |
269 | static const xmltag CopyrightCreatorType_tag= |
270 | {"creator", |
271 | 2, {"string","text"}, |
272 | CopyrightCreatorType_function, |
273 | {NULL}}; |
274 | |
275 | /*+ The CopyrightSourceType type tag. +*/ |
276 | static const xmltag CopyrightSourceType_tag= |
277 | {"source", |
278 | 2, {"string","text"}, |
279 | CopyrightSourceType_function, |
280 | {NULL}}; |
281 | |
282 | /*+ The CopyrightLicenseType type tag. +*/ |
283 | static const xmltag CopyrightLicenseType_tag= |
284 | {"license", |
285 | 2, {"string","text"}, |
286 | CopyrightLicenseType_function, |
287 | {NULL}}; |
288 | |
289 | /*+ The HTMLWaypointType type tag. +*/ |
290 | static const xmltag HTMLWaypointType_tag= |
291 | {"waypoint", |
292 | 2, {"type","string"}, |
293 | HTMLWaypointType_function, |
294 | {NULL}}; |
295 | |
296 | /*+ The HTMLTitleType type tag. +*/ |
297 | static const xmltag HTMLTitleType_tag= |
298 | {"title", |
299 | 1, {"text"}, |
300 | HTMLTitleType_function, |
301 | {NULL}}; |
302 | |
303 | /*+ The HTMLStartType type tag. +*/ |
304 | static const xmltag HTMLStartType_tag= |
305 | {"start", |
306 | 1, {"text"}, |
307 | HTMLStartType_function, |
308 | {NULL}}; |
309 | |
310 | /*+ The HTMLNodeType type tag. +*/ |
311 | static const xmltag HTMLNodeType_tag= |
312 | {"node", |
313 | 1, {"text"}, |
314 | HTMLNodeType_function, |
315 | {NULL}}; |
316 | |
317 | /*+ The HTMLRBNodeType type tag. +*/ |
318 | static const xmltag HTMLRBNodeType_tag= |
319 | {"rbnode", |
320 | 1, {"text"}, |
321 | HTMLRBNodeType_function, |
322 | {NULL}}; |
323 | |
324 | /*+ The HTMLSegmentType type tag. +*/ |
325 | static const xmltag HTMLSegmentType_tag= |
326 | {"segment", |
327 | 1, {"text"}, |
328 | HTMLSegmentType_function, |
329 | {NULL}}; |
330 | |
331 | /*+ The HTMLStopType type tag. +*/ |
332 | static const xmltag HTMLStopType_tag= |
333 | {"stop", |
334 | 1, {"text"}, |
335 | HTMLStopType_function, |
336 | {NULL}}; |
337 | |
338 | /*+ The HTMLTotalType type tag. +*/ |
339 | static const xmltag HTMLTotalType_tag= |
340 | {"total", |
341 | 1, {"text"}, |
342 | HTMLTotalType_function, |
343 | {NULL}}; |
344 | |
345 | /*+ The HTMLSubtotalType type tag. +*/ |
346 | static const xmltag HTMLSubtotalType_tag= |
347 | {"subtotal", |
348 | 1, {"text"}, |
349 | HTMLSubtotalType_function, |
350 | {NULL}}; |
351 | |
352 | /*+ The GPXWaypointType type tag. +*/ |
353 | static const xmltag GPXWaypointType_tag= |
354 | {"waypoint", |
355 | 2, {"type","string"}, |
356 | GPXWaypointType_function, |
357 | {NULL}}; |
358 | |
359 | /*+ The GPXDescType type tag. +*/ |
360 | static const xmltag GPXDescType_tag= |
361 | {"desc", |
362 | 1, {"text"}, |
363 | GPXDescType_function, |
364 | {NULL}}; |
365 | |
366 | /*+ The GPXNameType type tag. +*/ |
367 | static const xmltag GPXNameType_tag= |
368 | {"name", |
369 | 1, {"text"}, |
370 | GPXNameType_function, |
371 | {NULL}}; |
372 | |
373 | /*+ The GPXStepType type tag. +*/ |
374 | static const xmltag GPXStepType_tag= |
375 | {"step", |
376 | 1, {"text"}, |
377 | GPXStepType_function, |
378 | {NULL}}; |
379 | |
380 | /*+ The GPXFinalType type tag. +*/ |
381 | static const xmltag GPXFinalType_tag= |
382 | {"final", |
383 | 1, {"text"}, |
384 | GPXFinalType_function, |
385 | {NULL}}; |
386 | |
387 | |
388 | /* The XML tag processing functions */ |
389 | |
390 | |
391 | /*++++++++++++++++++++++++++++++++++++++ |
392 | The function that is called when the XML declaration is seen |
393 | |
394 | int xmlDeclaration_function Returns 0 if no error occured or something else otherwise. |
395 | |
396 | const char *_tag_ Set to the name of the element tag that triggered this function call. |
397 | |
398 | int _type_ Set to XMLPARSE_TAG_START at the start of a tag and/or XMLPARSE_TAG_END at the end of a tag. |
399 | |
400 | const char *version The contents of the 'version' attribute (or NULL if not defined). |
401 | |
402 | const char *encoding The contents of the 'encoding' attribute (or NULL if not defined). |
403 | ++++++++++++++++++++++++++++++++++++++*/ |
404 | |
405 | //static int xmlDeclaration_function(const char *_tag_,int _type_,const char *version,const char *encoding) |
406 | //{ |
407 | // return(0); |
408 | //} |
409 | |
410 | |
411 | /*++++++++++++++++++++++++++++++++++++++ |
412 | The function that is called when the RoutinoTranslationsType XSD type is seen |
413 | |
414 | int RoutinoTranslationsType_function Returns 0 if no error occured or something else otherwise. |
415 | |
416 | const char *_tag_ Set to the name of the element tag that triggered this function call. |
417 | |
418 | int _type_ Set to XMLPARSE_TAG_START at the start of a tag and/or XMLPARSE_TAG_END at the end of a tag. |
419 | ++++++++++++++++++++++++++++++++++++++*/ |
420 | |
421 | //static int RoutinoTranslationsType_function(const char *_tag_,int _type_) |
422 | //{ |
423 | // return(0); |
424 | //} |
425 | |
426 | |
427 | /*++++++++++++++++++++++++++++++++++++++ |
428 | The function that is called when the LanguageType XSD type is seen |
429 | |
430 | int LanguageType_function Returns 0 if no error occured or something else otherwise. |
431 | |
432 | const char *_tag_ Set to the name of the element tag that triggered this function call. |
433 | |
434 | int _type_ Set to XMLPARSE_TAG_START at the start of a tag and/or XMLPARSE_TAG_END at the end of a tag. |
435 | |
436 | const char *lang The contents of the 'lang' attribute (or NULL if not defined). |
437 | |
438 | const char *language The contents of the 'language' attribute (or NULL if not defined). |
439 | ++++++++++++++++++++++++++++++++++++++*/ |
440 | |
441 | static int LanguageType_function(const char *_tag_,int _type_,const char *lang,const char *language) |
442 | { |
443 | if(_type_&XMLPARSE_TAG_START) |
444 | { |
445 | XMLPARSE_ASSERT_STRING(_tag_,lang); |
446 | XMLPARSE_ASSERT_STRING(_tag_,language); |
447 | |
448 | if(store_all) |
449 | store=1; |
450 | else if(!store_lang && !stored) |
451 | store=1; |
452 | else if(store_lang && !strcmp(store_lang,lang)) |
453 | store=1; |
454 | else |
455 | store=0; |
456 | |
457 | if(store) |
458 | { |
459 | int i; |
460 | |
461 | for(i=0;i<nloaded_translations;i++) |
462 | if(!strcmp(lang,loaded_translations[i]->lang)) |
463 | XMLPARSE_MESSAGE(_tag_,"translation name must be unique"); |
464 | |
465 | if((nloaded_translations%16)==0) |
466 | loaded_translations=(Translation**)realloc((void*)loaded_translations,(nloaded_translations+16)*sizeof(Translation*)); |
467 | |
468 | nloaded_translations++; |
469 | |
470 | loaded_translations[nloaded_translations-1]=(Translation*)calloc(1,sizeof(Translation)); |
471 | |
472 | *loaded_translations[nloaded_translations-1]=default_translation; |
473 | |
474 | loaded_translations[nloaded_translations-1]->lang =strcpy(malloc(strlen(lang )+1),lang ); |
475 | loaded_translations[nloaded_translations-1]->language=strcpy(malloc(strlen(language)+1),language); |
476 | } |
477 | } |
478 | |
479 | if(_type_&XMLPARSE_TAG_END && store) |
480 | { |
481 | store=0; |
482 | stored=1; |
483 | } |
484 | |
485 | return(0); |
486 | } |
487 | |
488 | |
489 | /*++++++++++++++++++++++++++++++++++++++ |
490 | The function that is called when the CopyrightType XSD type is seen |
491 | |
492 | int CopyrightType_function Returns 0 if no error occured or something else otherwise. |
493 | |
494 | const char *_tag_ Set to the name of the element tag that triggered this function call. |
495 | |
496 | int _type_ Set to XMLPARSE_TAG_START at the start of a tag and/or XMLPARSE_TAG_END at the end of a tag. |
497 | ++++++++++++++++++++++++++++++++++++++*/ |
498 | |
499 | //static int CopyrightType_function(const char *_tag_,int _type_) |
500 | //{ |
501 | // return(0); |
502 | //} |
503 | |
504 | |
505 | /*++++++++++++++++++++++++++++++++++++++ |
506 | The function that is called when the TurnType XSD type is seen |
507 | |
508 | int TurnType_function Returns 0 if no error occured or something else otherwise. |
509 | |
510 | const char *_tag_ Set to the name of the element tag that triggered this function call. |
511 | |
512 | int _type_ Set to XMLPARSE_TAG_START at the start of a tag and/or XMLPARSE_TAG_END at the end of a tag. |
513 | |
514 | const char *direction The contents of the 'direction' attribute (or NULL if not defined). |
515 | |
516 | const char *string The contents of the 'string' attribute (or NULL if not defined). |
517 | ++++++++++++++++++++++++++++++++++++++*/ |
518 | |
519 | static int TurnType_function(const char *_tag_,int _type_,const char *direction,const char *string) |
520 | { |
521 | if(_type_&XMLPARSE_TAG_START && store) |
522 | { |
523 | char *xmlstring; |
524 | int d; |
525 | |
526 | XMLPARSE_ASSERT_INTEGER(_tag_,direction); d=atoi(direction); |
527 | XMLPARSE_ASSERT_STRING(_tag_,string); |
528 | |
529 | d+=4; |
530 | |
531 | if(d<0 || d>8) |
532 | XMLPARSE_INVALID(_tag_,direction); |
533 | |
534 | loaded_translations[nloaded_translations-1]->notxml_turn[d]=strcpy(malloc(strlen(string)+1),string); |
535 | |
536 | xmlstring=ParseXML_Encode_Safe_XML(string); |
537 | loaded_translations[nloaded_translations-1]->xml_turn[d]=strcpy(malloc(strlen(xmlstring)+1),xmlstring); |
538 | } |
539 | |
540 | return(0); |
541 | } |
542 | |
543 | |
544 | /*++++++++++++++++++++++++++++++++++++++ |
545 | The function that is called when the HeadingType XSD type is seen |
546 | |
547 | int HeadingType_function Returns 0 if no error occured or something else otherwise. |
548 | |
549 | const char *_tag_ Set to the name of the element tag that triggered this function call. |
550 | |
551 | int _type_ Set to XMLPARSE_TAG_START at the start of a tag and/or XMLPARSE_TAG_END at the end of a tag. |
552 | |
553 | const char *direction The contents of the 'direction' attribute (or NULL if not defined). |
554 | |
555 | const char *string The contents of the 'string' attribute (or NULL if not defined). |
556 | ++++++++++++++++++++++++++++++++++++++*/ |
557 | |
558 | static int HeadingType_function(const char *_tag_,int _type_,const char *direction,const char *string) |
559 | { |
560 | if(_type_&XMLPARSE_TAG_START && store) |
561 | { |
562 | char *xmlstring; |
563 | int d; |
564 | |
565 | XMLPARSE_ASSERT_INTEGER(_tag_,direction); d=atoi(direction); |
566 | XMLPARSE_ASSERT_STRING(_tag_,string); |
567 | |
568 | d+=4; |
569 | |
570 | if(d<0 || d>8) |
571 | XMLPARSE_INVALID(_tag_,direction); |
572 | |
573 | loaded_translations[nloaded_translations-1]->notxml_heading[d]=strcpy(malloc(strlen(string)+1),string); |
574 | |
575 | xmlstring=ParseXML_Encode_Safe_XML(string); |
576 | loaded_translations[nloaded_translations-1]->xml_heading[d]=strcpy(malloc(strlen(xmlstring)+1),xmlstring); |
577 | } |
578 | |
579 | return(0); |
580 | } |
581 | |
582 | |
583 | /*++++++++++++++++++++++++++++++++++++++ |
584 | The function that is called when the OrdinalType XSD type is seen |
585 | |
586 | int OrdinalType_function Returns 0 if no error occured or something else otherwise. |
587 | |
588 | const char *_tag_ Set to the name of the element tag that triggered this function call. |
589 | |
590 | int _type_ Set to XMLPARSE_TAG_START at the start of a tag and/or XMLPARSE_TAG_END at the end of a tag. |
591 | |
592 | const char *number The contents of the 'number' attribute (or NULL if not defined). |
593 | |
594 | const char *string The contents of the 'string' attribute (or NULL if not defined). |
595 | ++++++++++++++++++++++++++++++++++++++*/ |
596 | |
597 | static int OrdinalType_function(const char *_tag_,int _type_,const char *number,const char *string) |
598 | { |
599 | if(_type_&XMLPARSE_TAG_START && store) |
600 | { |
601 | char *xmlstring; |
602 | int n; |
603 | |
604 | XMLPARSE_ASSERT_INTEGER(_tag_,number); n=atoi(number); |
605 | XMLPARSE_ASSERT_STRING(_tag_,string); |
606 | |
607 | if(n<1 || n>10) |
608 | XMLPARSE_INVALID(_tag_,number); |
609 | |
610 | loaded_translations[nloaded_translations-1]->notxml_ordinal[n-1]=strcpy(malloc(strlen(string)+1),string); |
611 | |
612 | xmlstring=ParseXML_Encode_Safe_XML(string); |
613 | loaded_translations[nloaded_translations-1]->xml_ordinal[n-1]=strcpy(malloc(strlen(xmlstring)+1),xmlstring); |
614 | } |
615 | |
616 | return(0); |
617 | } |
618 | |
619 | |
620 | /*++++++++++++++++++++++++++++++++++++++ |
621 | The function that is called when the HighwayType XSD type is seen |
622 | |
623 | int HighwayType_function Returns 0 if no error occured or something else otherwise. |
624 | |
625 | const char *_tag_ Set to the name of the element tag that triggered this function call. |
626 | |
627 | int _type_ Set to XMLPARSE_TAG_START at the start of a tag and/or XMLPARSE_TAG_END at the end of a tag. |
628 | |
629 | const char *type The contents of the 'type' attribute (or NULL if not defined). |
630 | |
631 | const char *string The contents of the 'string' attribute (or NULL if not defined). |
632 | ++++++++++++++++++++++++++++++++++++++*/ |
633 | |
634 | static int HighwayType_function(const char *_tag_,int _type_,const char *type,const char *string) |
635 | { |
636 | if(_type_&XMLPARSE_TAG_START && store) |
637 | { |
638 | Highway highway; |
639 | |
640 | XMLPARSE_ASSERT_STRING(_tag_,type); |
641 | XMLPARSE_ASSERT_STRING(_tag_,string); |
642 | |
643 | highway=HighwayType(type); |
644 | |
645 | if(highway==Highway_None) |
646 | XMLPARSE_INVALID(_tag_,type); |
647 | |
648 | loaded_translations[nloaded_translations-1]->raw_highway[highway]=strcpy(malloc(strlen(string)+1),string); |
649 | } |
650 | |
651 | return(0); |
652 | } |
653 | |
654 | |
655 | /*++++++++++++++++++++++++++++++++++++++ |
656 | The function that is called when the RouteType XSD type is seen |
657 | |
658 | int RouteType_function Returns 0 if no error occured or something else otherwise. |
659 | |
660 | const char *_tag_ Set to the name of the element tag that triggered this function call. |
661 | |
662 | int _type_ Set to XMLPARSE_TAG_START at the start of a tag and/or XMLPARSE_TAG_END at the end of a tag. |
663 | |
664 | const char *type The contents of the 'type' attribute (or NULL if not defined). |
665 | |
666 | const char *string The contents of the 'string' attribute (or NULL if not defined). |
667 | ++++++++++++++++++++++++++++++++++++++*/ |
668 | |
669 | static int RouteType_function(const char *_tag_,int _type_,const char *type,const char *string) |
670 | { |
671 | if(_type_&XMLPARSE_TAG_START && store) |
672 | { |
673 | char *xmlstring; |
674 | |
675 | XMLPARSE_ASSERT_STRING(_tag_,type); |
676 | XMLPARSE_ASSERT_STRING(_tag_,string); |
677 | |
678 | xmlstring=ParseXML_Encode_Safe_XML(string); |
679 | |
680 | if(!strcmp(type,"shortest")) |
681 | loaded_translations[nloaded_translations-1]->xml_route_shortest=strcpy(malloc(strlen(xmlstring)+1),xmlstring); |
682 | else if(!strcmp(type,"quickest")) |
683 | loaded_translations[nloaded_translations-1]->xml_route_quickest=strcpy(malloc(strlen(xmlstring)+1),xmlstring); |
684 | else |
685 | XMLPARSE_INVALID(_tag_,type); |
686 | } |
687 | |
688 | return(0); |
689 | } |
690 | |
691 | |
692 | /*++++++++++++++++++++++++++++++++++++++ |
693 | The function that is called when the HTMLType XSD type is seen |
694 | |
695 | int HTMLType_function Returns 0 if no error occured or something else otherwise. |
696 | |
697 | const char *_tag_ Set to the name of the element tag that triggered this function call. |
698 | |
699 | int _type_ Set to XMLPARSE_TAG_START at the start of a tag and/or XMLPARSE_TAG_END at the end of a tag. |
700 | ++++++++++++++++++++++++++++++++++++++*/ |
701 | |
702 | //static int HTMLType_function(const char *_tag_,int _type_) |
703 | //{ |
704 | // return(0); |
705 | //} |
706 | |
707 | |
708 | /*++++++++++++++++++++++++++++++++++++++ |
709 | The function that is called when the GPXType XSD type is seen |
710 | |
711 | int GPXType_function Returns 0 if no error occured or something else otherwise. |
712 | |
713 | const char *_tag_ Set to the name of the element tag that triggered this function call. |
714 | |
715 | int _type_ Set to XMLPARSE_TAG_START at the start of a tag and/or XMLPARSE_TAG_END at the end of a tag. |
716 | ++++++++++++++++++++++++++++++++++++++*/ |
717 | |
718 | //static int GPXType_function(const char *_tag_,int _type_) |
719 | //{ |
720 | // return(0); |
721 | //} |
722 | |
723 | |
724 | /*++++++++++++++++++++++++++++++++++++++ |
725 | The function that is called when the CopyrightCreatorType XSD type is seen |
726 | |
727 | int CopyrightCreatorType_function Returns 0 if no error occured or something else otherwise. |
728 | |
729 | const char *_tag_ Set to the name of the element tag that triggered this function call. |
730 | |
731 | int _type_ Set to XMLPARSE_TAG_START at the start of a tag and/or XMLPARSE_TAG_END at the end of a tag. |
732 | |
733 | const char *string The contents of the 'string' attribute (or NULL if not defined). |
734 | |
735 | const char *text The contents of the 'text' attribute (or NULL if not defined). |
736 | ++++++++++++++++++++++++++++++++++++++*/ |
737 | |
738 | static int CopyrightCreatorType_function(const char *_tag_,int _type_,const char *string,const char *text) |
739 | { |
740 | if(_type_&XMLPARSE_TAG_START && store) |
741 | { |
742 | char *xmlstring,*xmltext; |
743 | |
744 | XMLPARSE_ASSERT_STRING(_tag_,string); |
745 | XMLPARSE_ASSERT_STRING(_tag_,text); |
746 | |
747 | loaded_translations[nloaded_translations-1]->raw_copyright_creator[0]=strcpy(malloc(strlen(string)+1),string); |
748 | loaded_translations[nloaded_translations-1]->raw_copyright_creator[1]=strcpy(malloc(strlen(text)+1) ,text); |
749 | |
750 | xmlstring=ParseXML_Encode_Safe_XML(string); |
751 | loaded_translations[nloaded_translations-1]->xml_copyright_creator[0]=strcpy(malloc(strlen(xmlstring)+1),xmlstring); |
752 | |
753 | xmltext=ParseXML_Encode_Safe_XML(text); |
754 | loaded_translations[nloaded_translations-1]->xml_copyright_creator[1]=strcpy(malloc(strlen(xmltext)+1),xmltext); |
755 | } |
756 | |
757 | return(0); |
758 | } |
759 | |
760 | |
761 | /*++++++++++++++++++++++++++++++++++++++ |
762 | The function that is called when the CopyrightSourceType XSD type is seen |
763 | |
764 | int CopyrightSourceType_function Returns 0 if no error occured or something else otherwise. |
765 | |
766 | const char *_tag_ Set to the name of the element tag that triggered this function call. |
767 | |
768 | int _type_ Set to XMLPARSE_TAG_START at the start of a tag and/or XMLPARSE_TAG_END at the end of a tag. |
769 | |
770 | const char *string The contents of the 'string' attribute (or NULL if not defined). |
771 | |
772 | const char *text The contents of the 'text' attribute (or NULL if not defined). |
773 | ++++++++++++++++++++++++++++++++++++++*/ |
774 | |
775 | static int CopyrightSourceType_function(const char *_tag_,int _type_,const char *string,const char *text) |
776 | { |
777 | if(_type_&XMLPARSE_TAG_START && store) |
778 | { |
779 | char *xmlstring,*xmltext; |
780 | |
781 | XMLPARSE_ASSERT_STRING(_tag_,string); |
782 | XMLPARSE_ASSERT_STRING(_tag_,text); |
783 | |
784 | loaded_translations[nloaded_translations-1]->raw_copyright_source[0]=strcpy(malloc(strlen(string)+1),string); |
785 | loaded_translations[nloaded_translations-1]->raw_copyright_source[1]=strcpy(malloc(strlen(text)+1) ,text); |
786 | |
787 | xmlstring=ParseXML_Encode_Safe_XML(string); |
788 | loaded_translations[nloaded_translations-1]->xml_copyright_source[0]=strcpy(malloc(strlen(xmlstring)+1),xmlstring); |
789 | |
790 | xmltext=ParseXML_Encode_Safe_XML(text); |
791 | loaded_translations[nloaded_translations-1]->xml_copyright_source[1]=strcpy(malloc(strlen(xmltext)+1),xmltext); |
792 | } |
793 | |
794 | return(0); |
795 | } |
796 | |
797 | |
798 | /*++++++++++++++++++++++++++++++++++++++ |
799 | The function that is called when the CopyrightLicenseType XSD type is seen |
800 | |
801 | int CopyrightLicenseType_function Returns 0 if no error occured or something else otherwise. |
802 | |
803 | const char *_tag_ Set to the name of the element tag that triggered this function call. |
804 | |
805 | int _type_ Set to XMLPARSE_TAG_START at the start of a tag and/or XMLPARSE_TAG_END at the end of a tag. |
806 | |
807 | const char *string The contents of the 'string' attribute (or NULL if not defined). |
808 | |
809 | const char *text The contents of the 'text' attribute (or NULL if not defined). |
810 | ++++++++++++++++++++++++++++++++++++++*/ |
811 | |
812 | static int CopyrightLicenseType_function(const char *_tag_,int _type_,const char *string,const char *text) |
813 | { |
814 | if(_type_&XMLPARSE_TAG_START && store) |
815 | { |
816 | char *xmlstring,*xmltext; |
817 | |
818 | XMLPARSE_ASSERT_STRING(_tag_,string); |
819 | XMLPARSE_ASSERT_STRING(_tag_,text); |
820 | |
821 | loaded_translations[nloaded_translations-1]->raw_copyright_license[0]=strcpy(malloc(strlen(string)+1),string); |
822 | loaded_translations[nloaded_translations-1]->raw_copyright_license[1]=strcpy(malloc(strlen(text)+1) ,text); |
823 | |
824 | xmlstring=ParseXML_Encode_Safe_XML(string); |
825 | loaded_translations[nloaded_translations-1]->xml_copyright_license[0]=strcpy(malloc(strlen(xmlstring)+1),xmlstring); |
826 | |
827 | xmltext=ParseXML_Encode_Safe_XML(text); |
828 | loaded_translations[nloaded_translations-1]->xml_copyright_license[1]=strcpy(malloc(strlen(xmltext)+1),xmltext); |
829 | } |
830 | |
831 | return(0); |
832 | } |
833 | |
834 | |
835 | /*++++++++++++++++++++++++++++++++++++++ |
836 | The function that is called when the HTMLWaypointType XSD type is seen |
837 | |
838 | int HTMLWaypointType_function Returns 0 if no error occured or something else otherwise. |
839 | |
840 | const char *_tag_ Set to the name of the element tag that triggered this function call. |
841 | |
842 | int _type_ Set to XMLPARSE_TAG_START at the start of a tag and/or XMLPARSE_TAG_END at the end of a tag. |
843 | |
844 | const char *type The contents of the 'type' attribute (or NULL if not defined). |
845 | |
846 | const char *string The contents of the 'string' attribute (or NULL if not defined). |
847 | ++++++++++++++++++++++++++++++++++++++*/ |
848 | |
849 | static int HTMLWaypointType_function(const char *_tag_,int _type_,const char *type,const char *string) |
850 | { |
851 | if(_type_&XMLPARSE_TAG_START && store) |
852 | { |
853 | char *xmlstring; |
854 | |
855 | XMLPARSE_ASSERT_STRING(_tag_,type); |
856 | XMLPARSE_ASSERT_STRING(_tag_,string); |
857 | |
858 | xmlstring=ParseXML_Encode_Safe_XML(string); |
859 | |
860 | if(!strcmp(type,"waypoint")) |
861 | { |
862 | loaded_translations[nloaded_translations-1]->nothtml_waypoint=strcpy(malloc(strlen(string)+1),string); |
863 | |
864 | loaded_translations[nloaded_translations-1]->html_waypoint=malloc(strlen(xmlstring)+1+sizeof("<span class='w'>")+sizeof("</span>")); |
865 | sprintf(loaded_translations[nloaded_translations-1]->html_waypoint,"<span class='w'>%s</span>",xmlstring); |
866 | } |
867 | else if(!strcmp(type,"junction")) |
868 | { |
869 | loaded_translations[nloaded_translations-1]->nothtml_junction=strcpy(malloc(strlen(string)+1),string); |
870 | |
871 | loaded_translations[nloaded_translations-1]->html_junction=strcpy(malloc(strlen(xmlstring)+1),xmlstring); |
872 | } |
873 | else if(!strcmp(type,"roundabout")) |
874 | { |
875 | loaded_translations[nloaded_translations-1]->nothtml_roundabout=strcpy(malloc(strlen(string)+1),string); |
876 | |
877 | loaded_translations[nloaded_translations-1]->html_roundabout=strcpy(malloc(strlen(xmlstring)+1),xmlstring); |
878 | } |
879 | else |
880 | XMLPARSE_INVALID(_tag_,type); |
881 | } |
882 | |
883 | return(0); |
884 | } |
885 | |
886 | |
887 | /*++++++++++++++++++++++++++++++++++++++ |
888 | The function that is called when the HTMLTitleType XSD type is seen |
889 | |
890 | int HTMLTitleType_function Returns 0 if no error occured or something else otherwise. |
891 | |
892 | const char *_tag_ Set to the name of the element tag that triggered this function call. |
893 | |
894 | int _type_ Set to XMLPARSE_TAG_START at the start of a tag and/or XMLPARSE_TAG_END at the end of a tag. |
895 | |
896 | const char *text The contents of the 'text' attribute (or NULL if not defined). |
897 | ++++++++++++++++++++++++++++++++++++++*/ |
898 | |
899 | static int HTMLTitleType_function(const char *_tag_,int _type_,const char *text) |
900 | { |
901 | if(_type_&XMLPARSE_TAG_START && store) |
902 | { |
903 | char *xmltext; |
904 | |
905 | XMLPARSE_ASSERT_STRING(_tag_,text); |
906 | |
907 | xmltext=ParseXML_Encode_Safe_XML(text); |
908 | |
909 | loaded_translations[nloaded_translations-1]->nothtml_title=strcpy(malloc(strlen(text)+1),text); |
910 | |
911 | loaded_translations[nloaded_translations-1]->html_title=strcpy(malloc(strlen(xmltext)+1),xmltext); |
912 | } |
913 | |
914 | return(0); |
915 | } |
916 | |
917 | |
918 | /*++++++++++++++++++++++++++++++++++++++ |
919 | The function that is called when the HTMLStartType XSD type is seen |
920 | |
921 | int HTMLStartType_function Returns 0 if no error occured or something else otherwise. |
922 | |
923 | const char *_tag_ Set to the name of the element tag that triggered this function call. |
924 | |
925 | int _type_ Set to XMLPARSE_TAG_START at the start of a tag and/or XMLPARSE_TAG_END at the end of a tag. |
926 | |
927 | const char *text The contents of the 'text' attribute (or NULL if not defined). |
928 | ++++++++++++++++++++++++++++++++++++++*/ |
929 | |
930 | static int HTMLStartType_function(const char *_tag_,int _type_,const char *text) |
931 | { |
932 | if(_type_&XMLPARSE_TAG_START && store) |
933 | { |
934 | char *xmltext; |
935 | const char *p; |
936 | char *q; |
937 | |
938 | XMLPARSE_ASSERT_STRING(_tag_,text); |
939 | |
940 | xmltext=ParseXML_Encode_Safe_XML(text); |
941 | |
942 | loaded_translations[nloaded_translations-1]->nothtml_start=strcpy(malloc(strlen(text)+1),text); |
943 | |
944 | loaded_translations[nloaded_translations-1]->html_start=malloc(sizeof("<tr class='n'><td>")+strlen(xmltext)+sizeof("<span class='b'>")+sizeof("</span>")+1+1); |
945 | |
946 | p=xmltext; |
947 | q=loaded_translations[nloaded_translations-1]->html_start; |
948 | |
949 | strcpy(q,"<tr class='n'><td>"); q+=sizeof("<tr class='n'><td>")-1; |
950 | |
951 | while(*p!='%') |
952 | *q++=*p++; |
953 | |
954 | *q++=*p++; |
955 | |
956 | while(*p!='%') |
957 | *q++=*p++; |
958 | |
959 | p+=2; |
960 | strcpy(q,"<span class='b'>%s</span>"); q+=sizeof("<span class='b'>%s</span>")-1; |
961 | |
962 | strcpy(q,p); |
963 | strcat(q,"\n"); |
964 | } |
965 | |
966 | return(0); |
967 | } |
968 | |
969 | |
970 | /*++++++++++++++++++++++++++++++++++++++ |
971 | The function that is called when the HTMLNodeType XSD type is seen |
972 | |
973 | int HTMLNodeType_function Returns 0 if no error occured or something else otherwise. |
974 | |
975 | const char *_tag_ Set to the name of the element tag that triggered this function call. |
976 | |
977 | int _type_ Set to XMLPARSE_TAG_START at the start of a tag and/or XMLPARSE_TAG_END at the end of a tag. |
978 | |
979 | const char *text The contents of the 'text' attribute (or NULL if not defined). |
980 | ++++++++++++++++++++++++++++++++++++++*/ |
981 | |
982 | static int HTMLNodeType_function(const char *_tag_,int _type_,const char *text) |
983 | { |
984 | if(_type_&XMLPARSE_TAG_START && store) |
985 | { |
986 | char *xmltext; |
987 | const char *p; |
988 | char *q; |
989 | |
990 | XMLPARSE_ASSERT_STRING(_tag_,text); |
991 | |
992 | xmltext=ParseXML_Encode_Safe_XML(text); |
993 | |
994 | loaded_translations[nloaded_translations-1]->nothtml_node=strcpy(malloc(strlen(text)+1),text); |
995 | |
996 | loaded_translations[nloaded_translations-1]->html_node=malloc(sizeof("<tr class='n'><td>")+strlen(xmltext)+2*sizeof("<span class='b'>")+2*sizeof("</span>")+1+1); |
997 | |
998 | p=xmltext; |
999 | q=loaded_translations[nloaded_translations-1]->html_node; |
1000 | |
1001 | strcpy(q,"<tr class='n'><td>"); q+=sizeof("<tr class='n'><td>")-1; |
1002 | |
1003 | while(*p!='%') |
1004 | *q++=*p++; |
1005 | |
1006 | *q++=*p++; |
1007 | |
1008 | while(*p!='%') |
1009 | *q++=*p++; |
1010 | |
1011 | p+=2; |
1012 | strcpy(q,"<span class='t'>%s</span>"); q+=sizeof("<span class='t'>%s</span>")-1; |
1013 | |
1014 | while(*p!='%') |
1015 | *q++=*p++; |
1016 | |
1017 | p+=2; |
1018 | strcpy(q,"<span class='b'>%s</span>"); q+=sizeof("<span class='b'>%s</span>")-1; |
1019 | |
1020 | strcpy(q,p); |
1021 | strcat(q,"\n"); |
1022 | } |
1023 | |
1024 | return(0); |
1025 | } |
1026 | |
1027 | |
1028 | /*++++++++++++++++++++++++++++++++++++++ |
1029 | The function that is called when the HTMLRBNodeType XSD type is seen |
1030 | |
1031 | int HTMLRBNodeType_function Returns 0 if no error occured or something else otherwise. |
1032 | |
1033 | const char *_tag_ Set to the name of the element tag that triggered this function call. |
1034 | |
1035 | int _type_ Set to XMLPARSE_TAG_START at the start of a tag and/or XMLPARSE_TAG_END at the end of a tag. |
1036 | |
1037 | const char *text The contents of the 'text' attribute (or NULL if not defined). |
1038 | ++++++++++++++++++++++++++++++++++++++*/ |
1039 | |
1040 | static int HTMLRBNodeType_function(const char *_tag_,int _type_,const char *text) |
1041 | { |
1042 | if(_type_&XMLPARSE_TAG_START && store) |
1043 | { |
1044 | char *xmltext; |
1045 | const char *p; |
1046 | char *q; |
1047 | |
1048 | XMLPARSE_ASSERT_STRING(_tag_,text); |
1049 | |
1050 | xmltext=ParseXML_Encode_Safe_XML(text); |
1051 | |
1052 | loaded_translations[nloaded_translations-1]->nothtml_rbnode=strcpy(malloc(strlen(text)+1),text); |
1053 | |
1054 | loaded_translations[nloaded_translations-1]->html_rbnode=malloc(sizeof("<tr class='n'><td>")+strlen(xmltext)+2*sizeof("<span class='b'>")+2*sizeof("</span>")+1+1); |
1055 | |
1056 | p=xmltext; |
1057 | q=loaded_translations[nloaded_translations-1]->html_rbnode; |
1058 | |
1059 | strcpy(q,"<tr class='n'><td>"); q+=sizeof("<tr class='n'><td>")-1; |
1060 | |
1061 | while(*p!='%') |
1062 | *q++=*p++; |
1063 | |
1064 | *q++=*p++; |
1065 | |
1066 | while(*p!='%') |
1067 | *q++=*p++; |
1068 | |
1069 | p+=2; |
1070 | strcpy(q,"<span class='t'>%s</span>"); q+=sizeof("<span class='t'>%s</span>")-1; |
1071 | |
1072 | while(*p!='%') |
1073 | *q++=*p++; |
1074 | |
1075 | p+=2; |
1076 | strcpy(q,"<span class='b'>%s</span>"); q+=sizeof("<span class='b'>%s</span>")-1; |
1077 | |
1078 | strcpy(q,p); |
1079 | strcat(q,"\n"); |
1080 | } |
1081 | |
1082 | return(0); |
1083 | } |
1084 | |
1085 | |
1086 | /*++++++++++++++++++++++++++++++++++++++ |
1087 | The function that is called when the HTMLSegmentType XSD type is seen |
1088 | |
1089 | int HTMLSegmentType_function Returns 0 if no error occured or something else otherwise. |
1090 | |
1091 | const char *_tag_ Set to the name of the element tag that triggered this function call. |
1092 | |
1093 | int _type_ Set to XMLPARSE_TAG_START at the start of a tag and/or XMLPARSE_TAG_END at the end of a tag. |
1094 | |
1095 | const char *text The contents of the 'text' attribute (or NULL if not defined). |
1096 | ++++++++++++++++++++++++++++++++++++++*/ |
1097 | |
1098 | static int HTMLSegmentType_function(const char *_tag_,int _type_,const char *text) |
1099 | { |
1100 | if(_type_&XMLPARSE_TAG_START && store) |
1101 | { |
1102 | char *xmltext; |
1103 | const char *p; |
1104 | char *q; |
1105 | |
1106 | XMLPARSE_ASSERT_STRING(_tag_,text); |
1107 | |
1108 | xmltext=ParseXML_Encode_Safe_XML(text); |
1109 | |
1110 | loaded_translations[nloaded_translations-1]->nothtml_segment=strcpy(malloc(strlen(text)+1),text); |
1111 | |
1112 | loaded_translations[nloaded_translations-1]->html_segment=malloc(sizeof("<tr class='s'><td>")+strlen(xmltext)+2*sizeof("<span class='b'>")+2*sizeof("</span>")+1); |
1113 | |
1114 | p=xmltext; |
1115 | q=loaded_translations[nloaded_translations-1]->html_segment; |
1116 | |
1117 | strcpy(q,"<tr class='s'><td>"); q+=sizeof("<tr class='s'><td>")-1; |
1118 | |
1119 | while(*p!='%') |
1120 | *q++=*p++; |
1121 | |
1122 | p+=2; |
1123 | strcpy(q,"<span class='h'>%s</span>"); q+=sizeof("<span class='h'>%s</span>")-1; |
1124 | |
1125 | while(*p!='%') |
1126 | *q++=*p++; |
1127 | |
1128 | strcpy(q,"<span class='d'>"); q+=sizeof("<span class='d'>")-1; |
1129 | |
1130 | strcpy(q,p); |
1131 | strcat(q,"</span>"); |
1132 | } |
1133 | |
1134 | return(0); |
1135 | } |
1136 | |
1137 | |
1138 | /*++++++++++++++++++++++++++++++++++++++ |
1139 | The function that is called when the HTMLStopType XSD type is seen |
1140 | |
1141 | int HTMLStopType_function Returns 0 if no error occured or something else otherwise. |
1142 | |
1143 | const char *_tag_ Set to the name of the element tag that triggered this function call. |
1144 | |
1145 | int _type_ Set to XMLPARSE_TAG_START at the start of a tag and/or XMLPARSE_TAG_END at the end of a tag. |
1146 | |
1147 | const char *text The contents of the 'text' attribute (or NULL if not defined). |
1148 | ++++++++++++++++++++++++++++++++++++++*/ |
1149 | |
1150 | static int HTMLStopType_function(const char *_tag_,int _type_,const char *text) |
1151 | { |
1152 | if(_type_&XMLPARSE_TAG_START && store) |
1153 | { |
1154 | char *xmltext; |
1155 | |
1156 | XMLPARSE_ASSERT_STRING(_tag_,text); |
1157 | |
1158 | xmltext=ParseXML_Encode_Safe_XML(text); |
1159 | |
1160 | loaded_translations[nloaded_translations-1]->nothtml_stop=strcpy(malloc(strlen(text)+1),text); |
1161 | |
1162 | loaded_translations[nloaded_translations-1]->html_stop=malloc(sizeof("<tr class='n'><td>")+strlen(xmltext)+1+1); |
1163 | |
1164 | strcpy(loaded_translations[nloaded_translations-1]->html_stop,"<tr class='n'><td>"); |
1165 | strcat(loaded_translations[nloaded_translations-1]->html_stop,xmltext); |
1166 | strcat(loaded_translations[nloaded_translations-1]->html_stop,"\n"); |
1167 | } |
1168 | |
1169 | return(0); |
1170 | } |
1171 | |
1172 | |
1173 | /*++++++++++++++++++++++++++++++++++++++ |
1174 | The function that is called when the HTMLTotalType XSD type is seen |
1175 | |
1176 | int HTMLTotalType_function Returns 0 if no error occured or something else otherwise. |
1177 | |
1178 | const char *_tag_ Set to the name of the element tag that triggered this function call. |
1179 | |
1180 | int _type_ Set to XMLPARSE_TAG_START at the start of a tag and/or XMLPARSE_TAG_END at the end of a tag. |
1181 | |
1182 | const char *text The contents of the 'text' attribute (or NULL if not defined). |
1183 | ++++++++++++++++++++++++++++++++++++++*/ |
1184 | |
1185 | static int HTMLTotalType_function(const char *_tag_,int _type_,const char *text) |
1186 | { |
1187 | if(_type_&XMLPARSE_TAG_START && store) |
1188 | { |
1189 | char *xmltext; |
1190 | |
1191 | XMLPARSE_ASSERT_STRING(_tag_,text); |
1192 | |
1193 | xmltext=ParseXML_Encode_Safe_XML(text); |
1194 | |
1195 | loaded_translations[nloaded_translations-1]->nothtml_total=strcpy(malloc(strlen(text)+1),text); |
1196 | |
1197 | loaded_translations[nloaded_translations-1]->html_total=malloc(sizeof("<tr class='t'><td>")+strlen(xmltext)+sizeof("<span class='j'>")+sizeof("</span>")+1+1); |
1198 | |
1199 | strcpy(loaded_translations[nloaded_translations-1]->html_total,"<tr class='t'><td>"); |
1200 | strcat(loaded_translations[nloaded_translations-1]->html_total,"<span class='j'>"); |
1201 | strcat(loaded_translations[nloaded_translations-1]->html_total,xmltext); |
1202 | strcat(loaded_translations[nloaded_translations-1]->html_total,"</span>"); |
1203 | strcat(loaded_translations[nloaded_translations-1]->html_total,"\n"); |
1204 | } |
1205 | |
1206 | return(0); |
1207 | } |
1208 | |
1209 | |
1210 | /*++++++++++++++++++++++++++++++++++++++ |
1211 | The function that is called when the HTMLSubtotalType XSD type is seen |
1212 | |
1213 | int HTMLSubtotalType_function Returns 0 if no error occured or something else otherwise. |
1214 | |
1215 | const char *_tag_ Set to the name of the element tag that triggered this function call. |
1216 | |
1217 | int _type_ Set to XMLPARSE_TAG_START at the start of a tag and/or XMLPARSE_TAG_END at the end of a tag. |
1218 | |
1219 | const char *text The contents of the 'text' attribute (or NULL if not defined). |
1220 | ++++++++++++++++++++++++++++++++++++++*/ |
1221 | |
1222 | static int HTMLSubtotalType_function(const char *_tag_,int _type_,const char *text) |
1223 | { |
1224 | if(_type_&XMLPARSE_TAG_START && store) |
1225 | { |
1226 | char *xmltext; |
1227 | |
1228 | XMLPARSE_ASSERT_STRING(_tag_,text); |
1229 | |
1230 | xmltext=ParseXML_Encode_Safe_XML(text); |
1231 | |
1232 | loaded_translations[nloaded_translations-1]->nothtml_subtotal=strcpy(malloc(strlen(text)+1),text); |
1233 | |
1234 | loaded_translations[nloaded_translations-1]->html_subtotal=malloc(sizeof(" [<span class='j'>")+strlen(xmltext)+sizeof("</span>]")+1+1); |
1235 | |
1236 | strcpy(loaded_translations[nloaded_translations-1]->html_subtotal," [<span class='j'>"); |
1237 | strcat(loaded_translations[nloaded_translations-1]->html_subtotal,xmltext); |
1238 | strcat(loaded_translations[nloaded_translations-1]->html_subtotal,"</span>]"); |
1239 | strcat(loaded_translations[nloaded_translations-1]->html_subtotal,"\n"); |
1240 | } |
1241 | |
1242 | return(0); |
1243 | } |
1244 | |
1245 | |
1246 | /*++++++++++++++++++++++++++++++++++++++ |
1247 | The function that is called when the GPXWaypointType XSD type is seen |
1248 | |
1249 | int GPXWaypointType_function Returns 0 if no error occured or something else otherwise. |
1250 | |
1251 | const char *_tag_ Set to the name of the element tag that triggered this function call. |
1252 | |
1253 | int _type_ Set to XMLPARSE_TAG_START at the start of a tag and/or XMLPARSE_TAG_END at the end of a tag. |
1254 | |
1255 | const char *type The contents of the 'type' attribute (or NULL if not defined). |
1256 | |
1257 | const char *string The contents of the 'string' attribute (or NULL if not defined). |
1258 | ++++++++++++++++++++++++++++++++++++++*/ |
1259 | |
1260 | static int GPXWaypointType_function(const char *_tag_,int _type_,const char *type,const char *string) |
1261 | { |
1262 | if(_type_&XMLPARSE_TAG_START && store) |
1263 | { |
1264 | char *xmlstring; |
1265 | |
1266 | XMLPARSE_ASSERT_STRING(_tag_,type); |
1267 | XMLPARSE_ASSERT_STRING(_tag_,string); |
1268 | |
1269 | xmlstring=ParseXML_Encode_Safe_XML(string); |
1270 | |
1271 | if(!strcmp(type,"start")) |
1272 | loaded_translations[nloaded_translations-1]->gpx_start=strcpy(malloc(strlen(xmlstring)+1),xmlstring); |
1273 | else if(!strcmp(type,"inter")) |
1274 | loaded_translations[nloaded_translations-1]->gpx_inter=strcpy(malloc(strlen(xmlstring)+1),xmlstring); |
1275 | else if(!strcmp(type,"trip")) |
1276 | loaded_translations[nloaded_translations-1]->gpx_trip=strcpy(malloc(strlen(xmlstring)+1),xmlstring); |
1277 | else if(!strcmp(type,"finish")) |
1278 | loaded_translations[nloaded_translations-1]->gpx_finish=strcpy(malloc(strlen(xmlstring)+1),xmlstring); |
1279 | else |
1280 | XMLPARSE_INVALID(_tag_,type); |
1281 | } |
1282 | |
1283 | return(0); |
1284 | } |
1285 | |
1286 | |
1287 | /*++++++++++++++++++++++++++++++++++++++ |
1288 | The function that is called when the GPXDescType XSD type is seen |
1289 | |
1290 | int GPXDescType_function Returns 0 if no error occured or something else otherwise. |
1291 | |
1292 | const char *_tag_ Set to the name of the element tag that triggered this function call. |
1293 | |
1294 | int _type_ Set to XMLPARSE_TAG_START at the start of a tag and/or XMLPARSE_TAG_END at the end of a tag. |
1295 | |
1296 | const char *text The contents of the 'text' attribute (or NULL if not defined). |
1297 | ++++++++++++++++++++++++++++++++++++++*/ |
1298 | |
1299 | static int GPXDescType_function(const char *_tag_,int _type_,const char *text) |
1300 | { |
1301 | if(_type_&XMLPARSE_TAG_START && store) |
1302 | { |
1303 | char *xmltext; |
1304 | |
1305 | XMLPARSE_ASSERT_STRING(_tag_,text); |
1306 | |
1307 | xmltext=ParseXML_Encode_Safe_XML(text); |
1308 | loaded_translations[nloaded_translations-1]->gpx_desc=strcpy(malloc(strlen(xmltext)+1),xmltext); |
1309 | } |
1310 | |
1311 | return(0); |
1312 | } |
1313 | |
1314 | |
1315 | /*++++++++++++++++++++++++++++++++++++++ |
1316 | The function that is called when the GPXNameType XSD type is seen |
1317 | |
1318 | int GPXNameType_function Returns 0 if no error occured or something else otherwise. |
1319 | |
1320 | const char *_tag_ Set to the name of the element tag that triggered this function call. |
1321 | |
1322 | int _type_ Set to XMLPARSE_TAG_START at the start of a tag and/or XMLPARSE_TAG_END at the end of a tag. |
1323 | |
1324 | const char *text The contents of the 'text' attribute (or NULL if not defined). |
1325 | ++++++++++++++++++++++++++++++++++++++*/ |
1326 | |
1327 | static int GPXNameType_function(const char *_tag_,int _type_,const char *text) |
1328 | { |
1329 | if(_type_&XMLPARSE_TAG_START && store) |
1330 | { |
1331 | char *xmltext; |
1332 | |
1333 | XMLPARSE_ASSERT_STRING(_tag_,text); |
1334 | |
1335 | xmltext=ParseXML_Encode_Safe_XML(text); |
1336 | loaded_translations[nloaded_translations-1]->gpx_name=strcpy(malloc(strlen(xmltext)+1),xmltext); |
1337 | } |
1338 | |
1339 | return(0); |
1340 | } |
1341 | |
1342 | |
1343 | /*++++++++++++++++++++++++++++++++++++++ |
1344 | The function that is called when the GPXStepType XSD type is seen |
1345 | |
1346 | int GPXStepType_function Returns 0 if no error occured or something else otherwise. |
1347 | |
1348 | const char *_tag_ Set to the name of the element tag that triggered this function call. |
1349 | |
1350 | int _type_ Set to XMLPARSE_TAG_START at the start of a tag and/or XMLPARSE_TAG_END at the end of a tag. |
1351 | |
1352 | const char *text The contents of the 'text' attribute (or NULL if not defined). |
1353 | ++++++++++++++++++++++++++++++++++++++*/ |
1354 | |
1355 | static int GPXStepType_function(const char *_tag_,int _type_,const char *text) |
1356 | { |
1357 | if(_type_&XMLPARSE_TAG_START && store) |
1358 | { |
1359 | char *xmltext; |
1360 | |
1361 | XMLPARSE_ASSERT_STRING(_tag_,text); |
1362 | |
1363 | xmltext=ParseXML_Encode_Safe_XML(text); |
1364 | loaded_translations[nloaded_translations-1]->gpx_step=strcpy(malloc(strlen(xmltext)+1),xmltext); |
1365 | } |
1366 | |
1367 | return(0); |
1368 | } |
1369 | |
1370 | |
1371 | /*++++++++++++++++++++++++++++++++++++++ |
1372 | The function that is called when the GPXFinalType XSD type is seen |
1373 | |
1374 | int GPXFinalType_function Returns 0 if no error occured or something else otherwise. |
1375 | |
1376 | const char *_tag_ Set to the name of the element tag that triggered this function call. |
1377 | |
1378 | int _type_ Set to XMLPARSE_TAG_START at the start of a tag and/or XMLPARSE_TAG_END at the end of a tag. |
1379 | |
1380 | const char *text The contents of the 'text' attribute (or NULL if not defined). |
1381 | ++++++++++++++++++++++++++++++++++++++*/ |
1382 | |
1383 | static int GPXFinalType_function(const char *_tag_,int _type_,const char *text) |
1384 | { |
1385 | if(_type_&XMLPARSE_TAG_START && store) |
1386 | { |
1387 | char *xmltext; |
1388 | |
1389 | XMLPARSE_ASSERT_STRING(_tag_,text); |
1390 | |
1391 | xmltext=ParseXML_Encode_Safe_XML(text); |
1392 | loaded_translations[nloaded_translations-1]->gpx_final=strcpy(malloc(strlen(xmltext)+1),xmltext); |
1393 | } |
1394 | |
1395 | return(0); |
1396 | } |
1397 | |
1398 | |
1399 | /*++++++++++++++++++++++++++++++++++++++ |
1400 | The XML translation parser. |
1401 | |
1402 | int ParseXMLTranslations Returns 0 if OK or something else in case of an error. |
1403 | |
1404 | const char *filename The name of the file to read. |
1405 | |
1406 | const char *lang The abbreviated language name to search for (NULL means first in file). |
1407 | |
1408 | int all Set to true to load all the translations. |
1409 | ++++++++++++++++++++++++++++++++++++++*/ |
1410 | |
1411 | int ParseXMLTranslations(const char *filename,const char *lang,int all) |
1412 | { |
1413 | int fd; |
1414 | int retval; |
1415 | |
1416 | if(!ExistsFile(filename)) |
1417 | return(1); |
1418 | |
1419 | fd=OpenFile(filename); |
1420 | |
1421 | /* Delete the existing translations */ |
1422 | |
1423 | if(nloaded_translations) |
1424 | FreeXMLTranslations(); |
1425 | |
1426 | /* Initialise variables used for parsing */ |
1427 | |
1428 | store_all=all; |
1429 | |
1430 | store_lang=lang; |
1431 | |
1432 | store=0; |
1433 | stored=0; |
1434 | |
1435 | /* Parse the file */ |
1436 | |
1437 | retval=ParseXML(fd,xml_toplevel_tags,XMLPARSE_UNKNOWN_ATTR_ERRNONAME|XMLPARSE_RETURN_ATTR_ENCODED); |
1438 | |
1439 | CloseFile(fd); |
1440 | |
1441 | if(retval) |
1442 | { |
1443 | FreeXMLTranslations(); |
1444 | |
1445 | return(2); |
1446 | } |
1447 | |
1448 | return(0); |
1449 | } |
1450 | |
1451 | |
1452 | /*++++++++++++++++++++++++++++++++++++++ |
1453 | Return a list of the languages that have been loaded from the XML file. |
1454 | |
1455 | char **GetTranslationLanguages Returns a NULL terminated list of strings - all allocated. |
1456 | ++++++++++++++++++++++++++++++++++++++*/ |
1457 | |
1458 | char **GetTranslationLanguages(void) |
1459 | { |
1460 | char **list=calloc(1+nloaded_translations,sizeof(char*)); |
1461 | int i; |
1462 | |
1463 | for(i=0;i<nloaded_translations;i++) |
1464 | list[i]=strcpy(malloc(strlen(loaded_translations[i]->lang)+1),loaded_translations[i]->lang); |
1465 | |
1466 | return(list); |
1467 | } |
1468 | |
1469 | |
1470 | /*++++++++++++++++++++++++++++++++++++++ |
1471 | Return a list of the full names of the languages that have been loaded from the XML file. |
1472 | |
1473 | char **GetTranslationLanguageFullNames Returns a NULL terminated list of strings - all allocated. |
1474 | ++++++++++++++++++++++++++++++++++++++*/ |
1475 | |
1476 | char **GetTranslationLanguageFullNames(void) |
1477 | { |
1478 | char **list=calloc(1+nloaded_translations,sizeof(char*)); |
1479 | int i; |
1480 | |
1481 | for(i=0;i<nloaded_translations;i++) |
1482 | list[i]=strcpy(malloc(strlen(loaded_translations[i]->language)+1),loaded_translations[i]->language); |
1483 | |
1484 | return(list); |
1485 | } |
1486 | |
1487 | |
1488 | /*++++++++++++++++++++++++++++++++++++++ |
1489 | Get a named translation. |
1490 | |
1491 | Translation *GetTranslation Returns a pointer to the translation. |
1492 | |
1493 | const char *lang The abbreviated name of the language of the translation or NULL to get the default or an empty string to get the first one. |
1494 | ++++++++++++++++++++++++++++++++++++++*/ |
1495 | |
1496 | Translation *GetTranslation(const char *lang) |
1497 | { |
1498 | int i; |
1499 | |
1500 | if(!lang) |
1501 | return(&default_translation); |
1502 | |
1503 | if(!*lang && nloaded_translations>0) |
1504 | return(loaded_translations[0]); |
1505 | |
1506 | for(i=0;i<nloaded_translations;i++) |
1507 | if(!strcmp(loaded_translations[i]->lang,lang)) |
1508 | return(loaded_translations[i]); |
1509 | |
1510 | return(NULL); |
1511 | } |
1512 | |
1513 | |
1514 | /*++++++++++++++++++++++++++++++++++++++ |
1515 | Free the memory that has been allocated for the translations. |
1516 | ++++++++++++++++++++++++++++++++++++++*/ |
1517 | |
1518 | void FreeXMLTranslations() |
1519 | { |
1520 | int i,j; |
1521 | |
1522 | if(!loaded_translations) |
1523 | return; |
1524 | |
1525 | for(i=0;i<nloaded_translations;i++) |
1526 | { |
1527 | free(loaded_translations[i]->lang); |
1528 | |
1529 | for(j=0;j<2;j++) |
1530 | { |
1531 | if(loaded_translations[i]->raw_copyright_creator[j] != default_translation.raw_copyright_creator[j]) free(loaded_translations[i]->raw_copyright_creator[j]); |
1532 | if(loaded_translations[i]->raw_copyright_source[j] != default_translation.raw_copyright_source[j]) free(loaded_translations[i]->raw_copyright_source[j]); |
1533 | if(loaded_translations[i]->raw_copyright_license[j] != default_translation.raw_copyright_license[j]) free(loaded_translations[i]->raw_copyright_license[j]); |
1534 | |
1535 | if(loaded_translations[i]->xml_copyright_creator[j] != default_translation.xml_copyright_creator[j]) free(loaded_translations[i]->xml_copyright_creator[j]); |
1536 | if(loaded_translations[i]->xml_copyright_source[j] != default_translation.xml_copyright_source[j]) free(loaded_translations[i]->xml_copyright_source[j]); |
1537 | if(loaded_translations[i]->xml_copyright_license[j] != default_translation.xml_copyright_license[j]) free(loaded_translations[i]->xml_copyright_license[j]); |
1538 | } |
1539 | |
1540 | for(j=0;j<9;j++) |
1541 | { |
1542 | if(loaded_translations[i]->xml_heading[j] != default_translation.xml_heading[j]) free(loaded_translations[i]->xml_heading[j]); |
1543 | if(loaded_translations[i]->xml_turn[j] != default_translation.xml_turn[j]) free(loaded_translations[i]->xml_turn[j]); |
1544 | } |
1545 | |
1546 | for(j=0;j<10;j++) |
1547 | if(loaded_translations[i]->xml_ordinal[j] != default_translation.xml_ordinal[j]) free(loaded_translations[i]->xml_ordinal[j]); |
1548 | |
1549 | for(j=0;j<9;j++) |
1550 | { |
1551 | if(loaded_translations[i]->notxml_heading[j] != default_translation.notxml_heading[j]) free(loaded_translations[i]->notxml_heading[j]); |
1552 | if(loaded_translations[i]->notxml_turn[j] != default_translation.notxml_turn[j]) free(loaded_translations[i]->notxml_turn[j]); |
1553 | } |
1554 | |
1555 | for(j=0;j<10;j++) |
1556 | if(loaded_translations[i]->notxml_ordinal[j] != default_translation.notxml_ordinal[j]) free(loaded_translations[i]->notxml_ordinal[j]); |
1557 | |
1558 | for(j=0;j<Highway_Count;j++) |
1559 | if(loaded_translations[i]->raw_highway[j] != default_translation.raw_highway[j]) free(loaded_translations[i]->raw_highway[j]); |
1560 | |
1561 | if(loaded_translations[i]->xml_route_shortest != default_translation.xml_route_shortest) free(loaded_translations[i]->xml_route_shortest); |
1562 | if(loaded_translations[i]->xml_route_quickest != default_translation.xml_route_quickest) free(loaded_translations[i]->xml_route_quickest); |
1563 | |
1564 | if(loaded_translations[i]->html_waypoint != default_translation.html_waypoint) free(loaded_translations[i]->html_waypoint); |
1565 | if(loaded_translations[i]->html_junction != default_translation.html_junction) free(loaded_translations[i]->html_junction); |
1566 | if(loaded_translations[i]->html_roundabout != default_translation.html_roundabout) free(loaded_translations[i]->html_roundabout); |
1567 | |
1568 | if(loaded_translations[i]->html_title != default_translation.html_title) free(loaded_translations[i]->html_title); |
1569 | |
1570 | if(loaded_translations[i]->html_start != default_translation.html_start) free(loaded_translations[i]->html_start); |
1571 | if(loaded_translations[i]->html_node != default_translation.html_node) free(loaded_translations[i]->html_node); |
1572 | if(loaded_translations[i]->html_rbnode != default_translation.html_rbnode) free(loaded_translations[i]->html_rbnode); |
1573 | if(loaded_translations[i]->html_segment != default_translation.html_segment) free(loaded_translations[i]->html_segment); |
1574 | if(loaded_translations[i]->html_stop != default_translation.html_stop) free(loaded_translations[i]->html_stop); |
1575 | if(loaded_translations[i]->html_total != default_translation.html_total) free(loaded_translations[i]->html_total); |
1576 | if(loaded_translations[i]->html_subtotal!= default_translation.html_subtotal)free(loaded_translations[i]->html_subtotal); |
1577 | |
1578 | if(loaded_translations[i]->nothtml_waypoint != default_translation.nothtml_waypoint) free(loaded_translations[i]->nothtml_waypoint); |
1579 | if(loaded_translations[i]->nothtml_junction != default_translation.nothtml_junction) free(loaded_translations[i]->nothtml_junction); |
1580 | if(loaded_translations[i]->nothtml_roundabout != default_translation.nothtml_roundabout) free(loaded_translations[i]->nothtml_roundabout); |
1581 | |
1582 | if(loaded_translations[i]->nothtml_title != default_translation.nothtml_title) free(loaded_translations[i]->nothtml_title); |
1583 | |
1584 | if(loaded_translations[i]->nothtml_start != default_translation.nothtml_start) free(loaded_translations[i]->nothtml_start); |
1585 | if(loaded_translations[i]->nothtml_node != default_translation.nothtml_node) free(loaded_translations[i]->nothtml_node); |
1586 | if(loaded_translations[i]->nothtml_rbnode != default_translation.nothtml_rbnode) free(loaded_translations[i]->nothtml_rbnode); |
1587 | if(loaded_translations[i]->nothtml_segment != default_translation.nothtml_segment) free(loaded_translations[i]->nothtml_segment); |
1588 | if(loaded_translations[i]->nothtml_stop != default_translation.nothtml_stop) free(loaded_translations[i]->nothtml_stop); |
1589 | if(loaded_translations[i]->nothtml_total != default_translation.nothtml_total) free(loaded_translations[i]->nothtml_total); |
1590 | if(loaded_translations[i]->nothtml_subtotal!= default_translation.nothtml_subtotal)free(loaded_translations[i]->nothtml_subtotal); |
1591 | |
1592 | if(loaded_translations[i]->gpx_desc != default_translation.gpx_desc) free(loaded_translations[i]->gpx_desc); |
1593 | if(loaded_translations[i]->gpx_name != default_translation.gpx_name) free(loaded_translations[i]->gpx_name); |
1594 | if(loaded_translations[i]->gpx_step != default_translation.gpx_step) free(loaded_translations[i]->gpx_step); |
1595 | if(loaded_translations[i]->gpx_final != default_translation.gpx_final) free(loaded_translations[i]->gpx_final); |
1596 | |
1597 | if(loaded_translations[i]->gpx_start != default_translation.gpx_start) free(loaded_translations[i]->gpx_start); |
1598 | if(loaded_translations[i]->gpx_inter != default_translation.gpx_inter) free(loaded_translations[i]->gpx_inter); |
1599 | if(loaded_translations[i]->gpx_trip != default_translation.gpx_trip) free(loaded_translations[i]->gpx_trip); |
1600 | if(loaded_translations[i]->gpx_finish != default_translation.gpx_finish) free(loaded_translations[i]->gpx_finish); |
1601 | |
1602 | free(loaded_translations[i]); |
1603 | } |
1604 | |
1605 | free(loaded_translations); |
1606 | |
1607 | loaded_translations=NULL; |
1608 | nloaded_translations=0; |
1609 | } |
Properties
Name | Value |
---|---|
cvs:description | File containing translation parsing functions. |