Routino SVN Repository Browser

Check out the latest version of Routino: svn co http://routino.org/svn/trunk routino

ViewVC logotype

Annotation of /branches/destination-access/src/translations.c

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1807 - (hide 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)
Merge the trunk changes back into the destination-access branch.

1 amb 361 /***************************************
2     Load the translations from a file and the functions for handling them.
3    
4     Part of the Routino routing software.
5     ******************/ /******************
6 amb 1647 This file Copyright 2010-2015 Andrew M. Bishop
7 amb 361
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 amb 449 #include "files.h"
28 amb 361 #include "translations.h"
29     #include "xmlparse.h"
30    
31    
32 amb 1807 /* Default English translations - Must not require any UTF-8 encoding */
33 amb 361
34 amb 1807 static Translation default_translation=
35     {
36     .lang = "--",
37     .language = "English (built-in)",
38 amb 361
39 amb 1807 .raw_copyright_creator = {"Creator","Routino - http://www.routino.org/"},
40     .raw_copyright_source = {NULL,NULL},
41     .raw_copyright_license = {NULL,NULL},
42 amb 375
43 amb 1807 .xml_copyright_creator = {"Creator","Routino - http://www.routino.org/"},
44     .xml_copyright_source = {NULL,NULL},
45     .xml_copyright_license = {NULL,NULL},
46 amb 361
47 amb 1807 .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 amb 361
51 amb 1807 .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 amb 893
55 amb 1807 .raw_highway = {"","motorway","trunk road","primary road","secondary road","tertiary road","unclassified road","residential road","service road","track","cycleway","path","steps","ferry"},
56 amb 378
57 amb 1807 .xml_route_shortest = "Shortest",
58     .xml_route_quickest = "Quickest",
59 amb 378
60 amb 1807 .html_waypoint = "<span class='w'>Waypoint</span>", /* span tag added when reading XML translations file */
61     .html_junction = "Junction",
62     .html_roundabout = "Roundabout",
63 amb 411
64 amb 1807 .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 amb 361
73 amb 1807 .nothtml_waypoint = "Waypoint",
74     .nothtml_junction = "Junction",
75     .nothtml_roundabout = "Roundabout",
76 amb 361
77 amb 1807 .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 amb 361
86 amb 1807 .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 amb 361
91 amb 1807 .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 amb 361 /*+ This current language is to be stored. +*/
116 amb 1807 static int store;
117 amb 361
118     /*+ The chosen language has been stored. +*/
119 amb 1807 static int stored;
120 amb 361
121    
122     /* The XML tag processing function prototypes */
123    
124 amb 373 //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 amb 1807 static int LanguageType_function(const char *_tag_,int _type_,const char *lang,const char *language);
127 amb 1204 //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 amb 373 //static int GPXType_function(const char *_tag_,int _type_);
135 amb 1204 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 amb 1807 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 amb 373 static int GPXWaypointType_function(const char *_tag_,int _type_,const char *type,const char *string);
148 amb 1204 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 amb 361
153    
154 amb 1204 /* The XML tag definitions (forward declarations) */
155 amb 361
156 amb 1807 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 amb 375
185    
186 amb 1204 /* The XML tag definition values */
187    
188     /*+ The complete set of tags at the top level. +*/
189 amb 1807 static const xmltag * const xml_toplevel_tags[]={&xmlDeclaration_tag,&RoutinoTranslationsType_tag,NULL};
190 amb 1204
191     /*+ The xmlDeclaration type tag. +*/
192 amb 1807 static const xmltag xmlDeclaration_tag=
193 amb 1204 {"xml",
194     2, {"version","encoding"},
195     NULL,
196 amb 375 {NULL}};
197    
198 amb 1204 /*+ The RoutinoTranslationsType type tag. +*/
199 amb 1807 static const xmltag RoutinoTranslationsType_tag=
200 amb 1204 {"routino-translations",
201     0, {NULL},
202     NULL,
203 amb 1205 {&LanguageType_tag,NULL}};
204 amb 1204
205 amb 1205 /*+ The LanguageType type tag. +*/
206 amb 1807 static const xmltag LanguageType_tag=
207 amb 1204 {"language",
208 amb 1807 2, {"lang","language"},
209 amb 1205 LanguageType_function,
210 amb 1204 {&CopyrightType_tag,&TurnType_tag,&HeadingType_tag,&OrdinalType_tag,&HighwayType_tag,&RouteType_tag,&HTMLType_tag,&GPXType_tag,NULL}};
211    
212     /*+ The CopyrightType type tag. +*/
213 amb 1807 static const xmltag CopyrightType_tag=
214 amb 1204 {"copyright",
215     0, {NULL},
216     NULL,
217     {&CopyrightCreatorType_tag,&CopyrightSourceType_tag,&CopyrightLicenseType_tag,NULL}};
218    
219 amb 361 /*+ The TurnType type tag. +*/
220 amb 1807 static const xmltag TurnType_tag=
221 amb 361 {"turn",
222     2, {"direction","string"},
223 amb 367 TurnType_function,
224 amb 361 {NULL}};
225    
226     /*+ The HeadingType type tag. +*/
227 amb 1807 static const xmltag HeadingType_tag=
228 amb 361 {"heading",
229     2, {"direction","string"},
230 amb 367 HeadingType_function,
231 amb 361 {NULL}};
232    
233 amb 925 /*+ The OrdinalType type tag. +*/
234 amb 1807 static const xmltag OrdinalType_tag=
235 amb 925 {"ordinal",
236     2, {"number","string"},
237     OrdinalType_function,
238     {NULL}};
239    
240 amb 411 /*+ The HighwayType type tag. +*/
241 amb 1807 static const xmltag HighwayType_tag=
242 amb 411 {"highway",
243     2, {"type","string"},
244     HighwayType_function,
245     {NULL}};
246    
247 amb 378 /*+ The RouteType type tag. +*/
248 amb 1807 static const xmltag RouteType_tag=
249 amb 378 {"route",
250     2, {"type","string"},
251     RouteType_function,
252 amb 361 {NULL}};
253    
254 amb 1204 /*+ The HTMLType type tag. +*/
255 amb 1807 static const xmltag HTMLType_tag=
256 amb 1204 {"output-html",
257     0, {NULL},
258     NULL,
259 amb 1807 {&HTMLWaypointType_tag,&HTMLTitleType_tag,&HTMLStartType_tag,&HTMLNodeType_tag,&HTMLRBNodeType_tag,&HTMLSegmentType_tag,&HTMLStopType_tag,&HTMLTotalType_tag,&HTMLSubtotalType_tag,NULL}};
260 amb 1204
261     /*+ The GPXType type tag. +*/
262 amb 1807 static const xmltag GPXType_tag=
263 amb 1204 {"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 amb 1807 static const xmltag CopyrightCreatorType_tag=
270 amb 1204 {"creator",
271     2, {"string","text"},
272     CopyrightCreatorType_function,
273     {NULL}};
274    
275     /*+ The CopyrightSourceType type tag. +*/
276 amb 1807 static const xmltag CopyrightSourceType_tag=
277 amb 1204 {"source",
278     2, {"string","text"},
279     CopyrightSourceType_function,
280     {NULL}};
281    
282     /*+ The CopyrightLicenseType type tag. +*/
283 amb 1807 static const xmltag CopyrightLicenseType_tag=
284 amb 1204 {"license",
285     2, {"string","text"},
286     CopyrightLicenseType_function,
287     {NULL}};
288    
289 amb 378 /*+ The HTMLWaypointType type tag. +*/
290 amb 1807 static const xmltag HTMLWaypointType_tag=
291 amb 378 {"waypoint",
292 amb 361 2, {"type","string"},
293 amb 378 HTMLWaypointType_function,
294 amb 361 {NULL}};
295    
296 amb 378 /*+ The HTMLTitleType type tag. +*/
297 amb 1807 static const xmltag HTMLTitleType_tag=
298 amb 378 {"title",
299     1, {"text"},
300     HTMLTitleType_function,
301 amb 361 {NULL}};
302    
303 amb 378 /*+ The HTMLStartType type tag. +*/
304 amb 1807 static const xmltag HTMLStartType_tag=
305 amb 378 {"start",
306 amb 1807 1, {"text"},
307 amb 378 HTMLStartType_function,
308     {NULL}};
309    
310     /*+ The HTMLNodeType type tag. +*/
311 amb 1807 static const xmltag HTMLNodeType_tag=
312 amb 378 {"node",
313 amb 1807 1, {"text"},
314 amb 378 HTMLNodeType_function,
315     {NULL}};
316    
317 amb 925 /*+ The HTMLRBNodeType type tag. +*/
318 amb 1807 static const xmltag HTMLRBNodeType_tag=
319 amb 925 {"rbnode",
320 amb 1807 1, {"text"},
321 amb 925 HTMLRBNodeType_function,
322     {NULL}};
323    
324 amb 378 /*+ The HTMLSegmentType type tag. +*/
325 amb 1807 static const xmltag HTMLSegmentType_tag=
326 amb 378 {"segment",
327 amb 1807 1, {"text"},
328 amb 378 HTMLSegmentType_function,
329     {NULL}};
330    
331     /*+ The HTMLStopType type tag. +*/
332 amb 1807 static const xmltag HTMLStopType_tag=
333 amb 378 {"stop",
334 amb 1807 1, {"text"},
335 amb 378 HTMLStopType_function,
336     {NULL}};
337    
338     /*+ The HTMLTotalType type tag. +*/
339 amb 1807 static const xmltag HTMLTotalType_tag=
340 amb 378 {"total",
341 amb 1807 1, {"text"},
342 amb 378 HTMLTotalType_function,
343     {NULL}};
344    
345 amb 1807 /*+ The HTMLSubtotalType type tag. +*/
346     static const xmltag HTMLSubtotalType_tag=
347     {"subtotal",
348     1, {"text"},
349     HTMLSubtotalType_function,
350     {NULL}};
351    
352 amb 1204 /*+ The GPXWaypointType type tag. +*/
353 amb 1807 static const xmltag GPXWaypointType_tag=
354 amb 1204 {"waypoint",
355     2, {"type","string"},
356     GPXWaypointType_function,
357     {NULL}};
358 amb 378
359 amb 361 /*+ The GPXDescType type tag. +*/
360 amb 1807 static const xmltag GPXDescType_tag=
361 amb 361 {"desc",
362     1, {"text"},
363 amb 367 GPXDescType_function,
364 amb 361 {NULL}};
365    
366     /*+ The GPXNameType type tag. +*/
367 amb 1807 static const xmltag GPXNameType_tag=
368 amb 361 {"name",
369     1, {"text"},
370 amb 367 GPXNameType_function,
371 amb 361 {NULL}};
372    
373     /*+ The GPXStepType type tag. +*/
374 amb 1807 static const xmltag GPXStepType_tag=
375 amb 361 {"step",
376     1, {"text"},
377 amb 367 GPXStepType_function,
378 amb 361 {NULL}};
379    
380     /*+ The GPXFinalType type tag. +*/
381 amb 1807 static const xmltag GPXFinalType_tag=
382 amb 361 {"final",
383     1, {"text"},
384 amb 367 GPXFinalType_function,
385 amb 361 {NULL}};
386    
387    
388     /* The XML tag processing functions */
389    
390    
391     /*++++++++++++++++++++++++++++++++++++++
392 amb 1204 The function that is called when the XML declaration is seen
393 amb 375
394 amb 1204 int xmlDeclaration_function Returns 0 if no error occured or something else otherwise.
395 amb 375
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 amb 1204 const char *version The contents of the 'version' attribute (or NULL if not defined).
401 amb 375
402 amb 1204 const char *encoding The contents of the 'encoding' attribute (or NULL if not defined).
403 amb 375 ++++++++++++++++++++++++++++++++++++++*/
404    
405 amb 1204 //static int xmlDeclaration_function(const char *_tag_,int _type_,const char *version,const char *encoding)
406     //{
407     // return(0);
408     //}
409 amb 486
410 amb 375
411 amb 1204 /*++++++++++++++++++++++++++++++++++++++
412     The function that is called when the RoutinoTranslationsType XSD type is seen
413 amb 893
414 amb 1204 int RoutinoTranslationsType_function Returns 0 if no error occured or something else otherwise.
415 amb 486
416 amb 1204 const char *_tag_ Set to the name of the element tag that triggered this function call.
417 amb 375
418 amb 1204 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 amb 375
421 amb 1204 //static int RoutinoTranslationsType_function(const char *_tag_,int _type_)
422     //{
423     // return(0);
424     //}
425 amb 375
426 amb 1204
427 amb 375 /*++++++++++++++++++++++++++++++++++++++
428 amb 1205 The function that is called when the LanguageType XSD type is seen
429 amb 375
430 amb 1205 int LanguageType_function Returns 0 if no error occured or something else otherwise.
431 amb 375
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 amb 1204 const char *lang The contents of the 'lang' attribute (or NULL if not defined).
437 amb 1807
438     const char *language The contents of the 'language' attribute (or NULL if not defined).
439 amb 375 ++++++++++++++++++++++++++++++++++++++*/
440    
441 amb 1807 static int LanguageType_function(const char *_tag_,int _type_,const char *lang,const char *language)
442 amb 375 {
443 amb 1204 if(_type_&XMLPARSE_TAG_START)
444 amb 375 {
445 amb 1204 XMLPARSE_ASSERT_STRING(_tag_,lang);
446 amb 1807 XMLPARSE_ASSERT_STRING(_tag_,language);
447 amb 486
448 amb 1807 if(store_all)
449 amb 1204 store=1;
450 amb 1807 else if(!store_lang && !stored)
451     store=1;
452 amb 1204 else if(store_lang && !strcmp(store_lang,lang))
453     store=1;
454     else
455     store=0;
456 amb 375
457 amb 1807 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 amb 1204 }
478 amb 893
479 amb 1204 if(_type_&XMLPARSE_TAG_END && store)
480     {
481     store=0;
482     stored=1;
483 amb 375 }
484    
485     return(0);
486     }
487    
488    
489     /*++++++++++++++++++++++++++++++++++++++
490 amb 1204 The function that is called when the CopyrightType XSD type is seen
491 amb 375
492 amb 1204 int CopyrightType_function Returns 0 if no error occured or something else otherwise.
493 amb 375
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 amb 1204 //static int CopyrightType_function(const char *_tag_,int _type_)
500     //{
501     // return(0);
502     //}
503 amb 486
504 amb 375
505     /*++++++++++++++++++++++++++++++++++++++
506 amb 361 The function that is called when the TurnType XSD type is seen
507    
508 amb 367 int TurnType_function Returns 0 if no error occured or something else otherwise.
509 amb 363
510 amb 373 const char *_tag_ Set to the name of the element tag that triggered this function call.
511    
512 amb 361 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 amb 373 static int TurnType_function(const char *_tag_,int _type_,const char *direction,const char *string)
520 amb 361 {
521     if(_type_&XMLPARSE_TAG_START && store)
522     {
523 amb 486 char *xmlstring;
524 amb 361 int d;
525    
526 amb 774 XMLPARSE_ASSERT_INTEGER(_tag_,direction); d=atoi(direction);
527 amb 373 XMLPARSE_ASSERT_STRING(_tag_,string);
528 amb 361
529 amb 363 d+=4;
530 amb 361
531     if(d<0 || d>8)
532 amb 373 XMLPARSE_INVALID(_tag_,direction);
533 amb 361
534 amb 1807 loaded_translations[nloaded_translations-1]->notxml_turn[d]=strcpy(malloc(strlen(string)+1),string);
535    
536 amb 486 xmlstring=ParseXML_Encode_Safe_XML(string);
537 amb 1807 loaded_translations[nloaded_translations-1]->xml_turn[d]=strcpy(malloc(strlen(xmlstring)+1),xmlstring);
538 amb 361 }
539 amb 363
540     return(0);
541 amb 361 }
542    
543    
544     /*++++++++++++++++++++++++++++++++++++++
545     The function that is called when the HeadingType XSD type is seen
546    
547 amb 367 int HeadingType_function Returns 0 if no error occured or something else otherwise.
548 amb 363
549 amb 373 const char *_tag_ Set to the name of the element tag that triggered this function call.
550    
551 amb 361 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 amb 373 static int HeadingType_function(const char *_tag_,int _type_,const char *direction,const char *string)
559 amb 361 {
560     if(_type_&XMLPARSE_TAG_START && store)
561     {
562 amb 486 char *xmlstring;
563 amb 361 int d;
564    
565 amb 774 XMLPARSE_ASSERT_INTEGER(_tag_,direction); d=atoi(direction);
566 amb 373 XMLPARSE_ASSERT_STRING(_tag_,string);
567 amb 361
568 amb 363 d+=4;
569 amb 361
570     if(d<0 || d>8)
571 amb 373 XMLPARSE_INVALID(_tag_,direction);
572 amb 361
573 amb 1807 loaded_translations[nloaded_translations-1]->notxml_heading[d]=strcpy(malloc(strlen(string)+1),string);
574    
575 amb 486 xmlstring=ParseXML_Encode_Safe_XML(string);
576 amb 1807 loaded_translations[nloaded_translations-1]->xml_heading[d]=strcpy(malloc(strlen(xmlstring)+1),xmlstring);
577 amb 361 }
578 amb 363
579     return(0);
580 amb 361 }
581    
582    
583     /*++++++++++++++++++++++++++++++++++++++
584 amb 925 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 amb 1807 loaded_translations[nloaded_translations-1]->notxml_ordinal[n-1]=strcpy(malloc(strlen(string)+1),string);
611    
612 amb 925 xmlstring=ParseXML_Encode_Safe_XML(string);
613 amb 1807 loaded_translations[nloaded_translations-1]->xml_ordinal[n-1]=strcpy(malloc(strlen(xmlstring)+1),xmlstring);
614 amb 925 }
615    
616     return(0);
617     }
618    
619    
620     /*++++++++++++++++++++++++++++++++++++++
621 amb 411 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 amb 1174 if(highway==Highway_None)
646 amb 411 XMLPARSE_INVALID(_tag_,type);
647    
648 amb 1807 loaded_translations[nloaded_translations-1]->raw_highway[highway]=strcpy(malloc(strlen(string)+1),string);
649 amb 411 }
650    
651     return(0);
652     }
653    
654    
655     /*++++++++++++++++++++++++++++++++++++++
656 amb 378 The function that is called when the RouteType XSD type is seen
657 amb 363
658 amb 378 int RouteType_function Returns 0 if no error occured or something else otherwise.
659 amb 363
660 amb 373 const char *_tag_ Set to the name of the element tag that triggered this function call.
661    
662 amb 363 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 amb 361 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 amb 378 static int RouteType_function(const char *_tag_,int _type_,const char *type,const char *string)
670 amb 361 {
671     if(_type_&XMLPARSE_TAG_START && store)
672     {
673 amb 486 char *xmlstring;
674    
675 amb 373 XMLPARSE_ASSERT_STRING(_tag_,type);
676     XMLPARSE_ASSERT_STRING(_tag_,string);
677 amb 361
678 amb 486 xmlstring=ParseXML_Encode_Safe_XML(string);
679    
680 amb 361 if(!strcmp(type,"shortest"))
681 amb 1807 loaded_translations[nloaded_translations-1]->xml_route_shortest=strcpy(malloc(strlen(xmlstring)+1),xmlstring);
682 amb 361 else if(!strcmp(type,"quickest"))
683 amb 1807 loaded_translations[nloaded_translations-1]->xml_route_quickest=strcpy(malloc(strlen(xmlstring)+1),xmlstring);
684 amb 361 else
685 amb 373 XMLPARSE_INVALID(_tag_,type);
686 amb 361 }
687 amb 363
688     return(0);
689 amb 361 }
690    
691    
692     /*++++++++++++++++++++++++++++++++++++++
693 amb 1204 The function that is called when the HTMLType XSD type is seen
694 amb 375
695 amb 1204 int HTMLType_function Returns 0 if no error occured or something else otherwise.
696 amb 375
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 amb 1204 ++++++++++++++++++++++++++++++++++++++*/
701 amb 378
702 amb 1204 //static int HTMLType_function(const char *_tag_,int _type_)
703     //{
704     // return(0);
705     //}
706 amb 378
707 amb 1204
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 amb 378 const char *string The contents of the 'string' attribute (or NULL if not defined).
734 amb 1204
735     const char *text The contents of the 'text' attribute (or NULL if not defined).
736 amb 375 ++++++++++++++++++++++++++++++++++++++*/
737    
738 amb 1204 static int CopyrightCreatorType_function(const char *_tag_,int _type_,const char *string,const char *text)
739 amb 378 {
740     if(_type_&XMLPARSE_TAG_START && store)
741     {
742 amb 1204 char *xmlstring,*xmltext;
743 amb 486
744 amb 378 XMLPARSE_ASSERT_STRING(_tag_,string);
745 amb 1204 XMLPARSE_ASSERT_STRING(_tag_,text);
746 amb 375
747 amb 1807 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 amb 1204
750 amb 486 xmlstring=ParseXML_Encode_Safe_XML(string);
751 amb 1807 loaded_translations[nloaded_translations-1]->xml_copyright_creator[0]=strcpy(malloc(strlen(xmlstring)+1),xmlstring);
752 amb 486
753 amb 1807 xmltext=ParseXML_Encode_Safe_XML(text);
754     loaded_translations[nloaded_translations-1]->xml_copyright_creator[1]=strcpy(malloc(strlen(xmltext)+1),xmltext);
755 amb 378 }
756 amb 375
757 amb 378 return(0);
758     }
759    
760    
761 amb 375 /*++++++++++++++++++++++++++++++++++++++
762 amb 1204 The function that is called when the CopyrightSourceType XSD type is seen
763 amb 361
764 amb 1204 int CopyrightSourceType_function Returns 0 if no error occured or something else otherwise.
765 amb 363
766 amb 373 const char *_tag_ Set to the name of the element tag that triggered this function call.
767    
768 amb 361 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 amb 1204 const char *string The contents of the 'string' attribute (or NULL if not defined).
771 amb 361
772 amb 1204 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 amb 1807 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 amb 1204
787     xmlstring=ParseXML_Encode_Safe_XML(string);
788 amb 1807 loaded_translations[nloaded_translations-1]->xml_copyright_source[0]=strcpy(malloc(strlen(xmlstring)+1),xmlstring);
789 amb 1204
790 amb 1807 xmltext=ParseXML_Encode_Safe_XML(text);
791     loaded_translations[nloaded_translations-1]->xml_copyright_source[1]=strcpy(malloc(strlen(xmltext)+1),xmltext);
792 amb 1204 }
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 amb 361 const char *string The contents of the 'string' attribute (or NULL if not defined).
808 amb 1204
809     const char *text The contents of the 'text' attribute (or NULL if not defined).
810 amb 361 ++++++++++++++++++++++++++++++++++++++*/
811    
812 amb 1204 static int CopyrightLicenseType_function(const char *_tag_,int _type_,const char *string,const char *text)
813 amb 361 {
814     if(_type_&XMLPARSE_TAG_START && store)
815     {
816 amb 1204 char *xmlstring,*xmltext;
817 amb 486
818 amb 373 XMLPARSE_ASSERT_STRING(_tag_,string);
819 amb 1204 XMLPARSE_ASSERT_STRING(_tag_,text);
820 amb 361
821 amb 1807 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 amb 1204
824 amb 486 xmlstring=ParseXML_Encode_Safe_XML(string);
825 amb 1807 loaded_translations[nloaded_translations-1]->xml_copyright_license[0]=strcpy(malloc(strlen(xmlstring)+1),xmlstring);
826 amb 486
827 amb 1807 xmltext=ParseXML_Encode_Safe_XML(text);
828     loaded_translations[nloaded_translations-1]->xml_copyright_license[1]=strcpy(malloc(strlen(xmltext)+1),xmltext);
829 amb 361 }
830 amb 363
831     return(0);
832 amb 361 }
833    
834    
835     /*++++++++++++++++++++++++++++++++++++++
836 amb 1204 The function that is called when the HTMLWaypointType XSD type is seen
837 amb 378
838 amb 1204 int HTMLWaypointType_function Returns 0 if no error occured or something else otherwise.
839 amb 378
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 amb 1204
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 amb 378 ++++++++++++++++++++++++++++++++++++++*/
848    
849 amb 1204 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 amb 378
855 amb 1204 XMLPARSE_ASSERT_STRING(_tag_,type);
856     XMLPARSE_ASSERT_STRING(_tag_,string);
857 amb 378
858 amb 1204 xmlstring=ParseXML_Encode_Safe_XML(string);
859    
860     if(!strcmp(type,"waypoint"))
861     {
862 amb 1807 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 amb 1204 }
867     else if(!strcmp(type,"junction"))
868 amb 1807 {
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 amb 1204 else if(!strcmp(type,"roundabout"))
874 amb 1807 {
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 amb 1204 else
880     XMLPARSE_INVALID(_tag_,type);
881     }
882    
883     return(0);
884     }
885    
886    
887 amb 378 /*++++++++++++++++++++++++++++++++++++++
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 amb 486 char *xmltext;
904    
905 amb 378 XMLPARSE_ASSERT_STRING(_tag_,text);
906    
907 amb 486 xmltext=ParseXML_Encode_Safe_XML(text);
908    
909 amb 1807 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 amb 378 }
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 amb 1807 static int HTMLStartType_function(const char *_tag_,int _type_,const char *text)
931 amb 378 {
932     if(_type_&XMLPARSE_TAG_START && store)
933     {
934 amb 1807 char *xmltext;
935     const char *p;
936     char *q;
937 amb 486
938 amb 378 XMLPARSE_ASSERT_STRING(_tag_,text);
939    
940 amb 1807 xmltext=ParseXML_Encode_Safe_XML(text);
941 amb 486
942 amb 1807 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 amb 378 }
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 amb 1807 static int HTMLNodeType_function(const char *_tag_,int _type_,const char *text)
983 amb 378 {
984     if(_type_&XMLPARSE_TAG_START && store)
985     {
986 amb 1807 char *xmltext;
987     const char *p;
988     char *q;
989 amb 486
990 amb 378 XMLPARSE_ASSERT_STRING(_tag_,text);
991    
992 amb 1807 xmltext=ParseXML_Encode_Safe_XML(text);
993 amb 486
994 amb 1807 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 amb 378 }
1023    
1024     return(0);
1025     }
1026    
1027    
1028     /*++++++++++++++++++++++++++++++++++++++
1029 amb 925 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 amb 1807 static int HTMLRBNodeType_function(const char *_tag_,int _type_,const char *text)
1041 amb 925 {
1042     if(_type_&XMLPARSE_TAG_START && store)
1043     {
1044 amb 1807 char *xmltext;
1045     const char *p;
1046     char *q;
1047 amb 925
1048     XMLPARSE_ASSERT_STRING(_tag_,text);
1049    
1050 amb 1807 xmltext=ParseXML_Encode_Safe_XML(text);
1051 amb 925
1052 amb 1807 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 amb 925 }
1081    
1082     return(0);
1083     }
1084    
1085    
1086     /*++++++++++++++++++++++++++++++++++++++
1087 amb 378 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 amb 1807 static int HTMLSegmentType_function(const char *_tag_,int _type_,const char *text)
1099 amb 378 {
1100     if(_type_&XMLPARSE_TAG_START && store)
1101     {
1102 amb 1807 char *xmltext;
1103 amb 378 const char *p;
1104     char *q;
1105    
1106     XMLPARSE_ASSERT_STRING(_tag_,text);
1107    
1108 amb 1807 xmltext=ParseXML_Encode_Safe_XML(text);
1109 amb 378
1110 amb 1807 loaded_translations[nloaded_translations-1]->nothtml_segment=strcpy(malloc(strlen(text)+1),text);
1111 amb 486
1112 amb 1807 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 amb 486 p=xmltext;
1115 amb 1807 q=loaded_translations[nloaded_translations-1]->html_segment;
1116 amb 378
1117 amb 1807 strcpy(q,"<tr class='s'><td>"); q+=sizeof("<tr class='s'><td>")-1;
1118    
1119     while(*p!='%')
1120 amb 378 *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 amb 1807 static int HTMLStopType_function(const char *_tag_,int _type_,const char *text)
1151 amb 378 {
1152     if(_type_&XMLPARSE_TAG_START && store)
1153     {
1154 amb 1807 char *xmltext;
1155 amb 486
1156 amb 378 XMLPARSE_ASSERT_STRING(_tag_,text);
1157    
1158 amb 1807 xmltext=ParseXML_Encode_Safe_XML(text);
1159 amb 486
1160 amb 1807 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 amb 378 }
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 amb 1807 const char *text The contents of the 'text' attribute (or NULL if not defined).
1183     ++++++++++++++++++++++++++++++++++++++*/
1184 amb 378
1185 amb 1807 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 amb 378 const char *text The contents of the 'text' attribute (or NULL if not defined).
1220     ++++++++++++++++++++++++++++++++++++++*/
1221    
1222 amb 1807 static int HTMLSubtotalType_function(const char *_tag_,int _type_,const char *text)
1223 amb 378 {
1224     if(_type_&XMLPARSE_TAG_START && store)
1225     {
1226 amb 1807 char *xmltext;
1227 amb 486
1228 amb 378 XMLPARSE_ASSERT_STRING(_tag_,text);
1229    
1230 amb 1807 xmltext=ParseXML_Encode_Safe_XML(text);
1231 amb 486
1232 amb 1807 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 amb 378 }
1241    
1242     return(0);
1243     }
1244    
1245    
1246     /*++++++++++++++++++++++++++++++++++++++
1247 amb 1204 The function that is called when the GPXWaypointType XSD type is seen
1248 amb 378
1249 amb 1204 int GPXWaypointType_function Returns 0 if no error occured or something else otherwise.
1250 amb 378
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 amb 1204
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 amb 378 ++++++++++++++++++++++++++++++++++++++*/
1259    
1260 amb 1204 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 amb 378
1266 amb 1204 XMLPARSE_ASSERT_STRING(_tag_,type);
1267     XMLPARSE_ASSERT_STRING(_tag_,string);
1268 amb 378
1269 amb 1204 xmlstring=ParseXML_Encode_Safe_XML(string);
1270    
1271     if(!strcmp(type,"start"))
1272 amb 1807 loaded_translations[nloaded_translations-1]->gpx_start=strcpy(malloc(strlen(xmlstring)+1),xmlstring);
1273 amb 1204 else if(!strcmp(type,"inter"))
1274 amb 1807 loaded_translations[nloaded_translations-1]->gpx_inter=strcpy(malloc(strlen(xmlstring)+1),xmlstring);
1275 amb 1204 else if(!strcmp(type,"trip"))
1276 amb 1807 loaded_translations[nloaded_translations-1]->gpx_trip=strcpy(malloc(strlen(xmlstring)+1),xmlstring);
1277 amb 1204 else if(!strcmp(type,"finish"))
1278 amb 1807 loaded_translations[nloaded_translations-1]->gpx_finish=strcpy(malloc(strlen(xmlstring)+1),xmlstring);
1279 amb 1204 else
1280     XMLPARSE_INVALID(_tag_,type);
1281     }
1282    
1283     return(0);
1284     }
1285    
1286    
1287 amb 378 /*++++++++++++++++++++++++++++++++++++++
1288 amb 361 The function that is called when the GPXDescType XSD type is seen
1289    
1290 amb 367 int GPXDescType_function Returns 0 if no error occured or something else otherwise.
1291 amb 363
1292 amb 373 const char *_tag_ Set to the name of the element tag that triggered this function call.
1293    
1294 amb 361 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 amb 373 static int GPXDescType_function(const char *_tag_,int _type_,const char *text)
1300 amb 361 {
1301     if(_type_&XMLPARSE_TAG_START && store)
1302     {
1303 amb 486 char *xmltext;
1304    
1305 amb 373 XMLPARSE_ASSERT_STRING(_tag_,text);
1306 amb 361
1307 amb 486 xmltext=ParseXML_Encode_Safe_XML(text);
1308 amb 1807 loaded_translations[nloaded_translations-1]->gpx_desc=strcpy(malloc(strlen(xmltext)+1),xmltext);
1309 amb 361 }
1310 amb 363
1311     return(0);
1312 amb 361 }
1313    
1314    
1315     /*++++++++++++++++++++++++++++++++++++++
1316     The function that is called when the GPXNameType XSD type is seen
1317    
1318 amb 367 int GPXNameType_function Returns 0 if no error occured or something else otherwise.
1319 amb 363
1320 amb 373 const char *_tag_ Set to the name of the element tag that triggered this function call.
1321    
1322 amb 361 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 amb 373 static int GPXNameType_function(const char *_tag_,int _type_,const char *text)
1328 amb 361 {
1329     if(_type_&XMLPARSE_TAG_START && store)
1330     {
1331 amb 486 char *xmltext;
1332    
1333 amb 373 XMLPARSE_ASSERT_STRING(_tag_,text);
1334 amb 361
1335 amb 486 xmltext=ParseXML_Encode_Safe_XML(text);
1336 amb 1807 loaded_translations[nloaded_translations-1]->gpx_name=strcpy(malloc(strlen(xmltext)+1),xmltext);
1337 amb 361 }
1338 amb 363
1339     return(0);
1340 amb 361 }
1341    
1342    
1343     /*++++++++++++++++++++++++++++++++++++++
1344     The function that is called when the GPXStepType XSD type is seen
1345    
1346 amb 367 int GPXStepType_function Returns 0 if no error occured or something else otherwise.
1347 amb 363
1348 amb 373 const char *_tag_ Set to the name of the element tag that triggered this function call.
1349    
1350 amb 361 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 amb 373 static int GPXStepType_function(const char *_tag_,int _type_,const char *text)
1356 amb 361 {
1357     if(_type_&XMLPARSE_TAG_START && store)
1358     {
1359 amb 486 char *xmltext;
1360    
1361 amb 373 XMLPARSE_ASSERT_STRING(_tag_,text);
1362 amb 361
1363 amb 486 xmltext=ParseXML_Encode_Safe_XML(text);
1364 amb 1807 loaded_translations[nloaded_translations-1]->gpx_step=strcpy(malloc(strlen(xmltext)+1),xmltext);
1365 amb 361 }
1366 amb 363
1367     return(0);
1368 amb 361 }
1369    
1370    
1371     /*++++++++++++++++++++++++++++++++++++++
1372     The function that is called when the GPXFinalType XSD type is seen
1373    
1374 amb 367 int GPXFinalType_function Returns 0 if no error occured or something else otherwise.
1375 amb 363
1376 amb 373 const char *_tag_ Set to the name of the element tag that triggered this function call.
1377    
1378 amb 361 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 amb 373 static int GPXFinalType_function(const char *_tag_,int _type_,const char *text)
1384 amb 361 {
1385     if(_type_&XMLPARSE_TAG_START && store)
1386     {
1387 amb 486 char *xmltext;
1388    
1389 amb 373 XMLPARSE_ASSERT_STRING(_tag_,text);
1390 amb 361
1391 amb 486 xmltext=ParseXML_Encode_Safe_XML(text);
1392 amb 1807 loaded_translations[nloaded_translations-1]->gpx_final=strcpy(malloc(strlen(xmltext)+1),xmltext);
1393 amb 361 }
1394 amb 363
1395     return(0);
1396 amb 361 }
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 amb 1807 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 amb 361 ++++++++++++++++++++++++++++++++++++++*/
1410    
1411 amb 1807 int ParseXMLTranslations(const char *filename,const char *lang,int all)
1412 amb 361 {
1413 amb 1186 int fd;
1414 amb 361 int retval;
1415    
1416     if(!ExistsFile(filename))
1417     return(1);
1418    
1419 amb 1412 fd=OpenFile(filename);
1420 amb 361
1421 amb 1807 /* 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 amb 1186 retval=ParseXML(fd,xml_toplevel_tags,XMLPARSE_UNKNOWN_ATTR_ERRNONAME|XMLPARSE_RETURN_ATTR_ENCODED);
1438 amb 361
1439 amb 1412 CloseFile(fd);
1440 amb 361
1441 amb 363 if(retval)
1442 amb 1807 {
1443     FreeXMLTranslations();
1444 amb 361
1445 amb 1807 return(2);
1446     }
1447 amb 361
1448     return(0);
1449     }
1450 amb 1807
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.