Routino SVN Repository Browser

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

ViewVC logotype

Annotation of /trunk/src/translations.c

Parent Directory Parent Directory | Revision Log Revision Log


Revision 925 - (hide annotations) (download) (as text)
Tue Dec 6 17:18:22 2011 UTC (13 years, 3 months ago) by amb
File MIME type: text/x-csrc
File size: 41035 byte(s)
Add new translate-able strings for roundabouts.

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 754 This file Copyright 2010-2011 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 486 /* Global variables - default English values - Must not require any UTF-8 encoding */
33 amb 361
34 amb 893 char *translate_raw_copyright_creator[2]={"Creator","Routino - http://www.routino.org/"};
35     char *translate_raw_copyright_source[2] ={NULL,NULL};
36     char *translate_raw_copyright_license[2]={NULL,NULL};
37 amb 361
38 amb 893 char *translate_xml_copyright_creator[2]={"Creator","Routino - http://www.routino.org/"};
39     char *translate_xml_copyright_source[2] ={NULL,NULL};
40     char *translate_xml_copyright_license[2]={NULL,NULL};
41 amb 375
42 amb 925 char *translate_xml_heading[9] ={"South","South-West","West","North-West","North","North-East","East","South-East","South"};
43     char *translate_xml_turn[9] ={"Very sharp left","Sharp left","Left","Slight left","Straight on","Slight right","Right","Sharp right","Very sharp right"};
44     char *translate_xml_ordinal[10]={"First","Second","Third","Fourth","Fifth","Sixth","Seventh","Eighth","Ninth","Tenth"};
45 amb 361
46 amb 893 char *translate_raw_highway[Way_Count]={"","motorway","trunk road","primary road","secondary road","tertiary road","unclassified road","residential road","service road","track","cycleway","path","steps","ferry"};
47 amb 361
48 amb 893 char *translate_xml_route_shortest="Shortest";
49     char *translate_xml_route_quickest="Quickest";
50    
51 amb 925 char *translate_html_waypoint ="<span class='w'>Waypoint</span>";
52     char *translate_html_junction ="Junction";
53     char *translate_html_roundabout="Roundabout";
54 amb 378
55 amb 925 char *translate_html_title ="%s Route";
56     char *translate_html_start[2] ={"Start","At %s, head %s"};
57 amb 378 char *translate_html_segment[2]={"Follow","%s for %.3f km, %.1f min"};
58 amb 925 char *translate_html_node[2] ={"At","%s, go %s heading %s"};
59     char *translate_html_rbnode[2] ={"Leave","%s, take the %s exit heading %s"};
60     char *translate_html_stop[2] ={"Stop","At %s"};
61     char *translate_html_total[2] ={"Total","%.1f km, %.0f minutes"};
62 amb 378
63 amb 411 char *translate_gpx_desc ="%s between 'start' and 'finish' waypoints";
64     char *translate_gpx_name ="%s Route";
65     char *translate_gpx_step ="%s on '%s' for %.3f km, %.1 min";
66     char *translate_gpx_final="Total Journey %.1f km, %d minutes";
67    
68 amb 925 char *translate_gpx_start ="START";
69     char *translate_gpx_inter ="INTER";
70     char *translate_gpx_trip ="TRIP";
71 amb 361 char *translate_gpx_finish="FINISH";
72    
73    
74     /* Local variables */
75    
76     /*+ The language that is to be stored. +*/
77     static const char *store_lang=NULL;
78    
79     /*+ This current language is to be stored. +*/
80     static int store=0;
81    
82     /*+ The chosen language has been stored. +*/
83     static int stored=0;
84    
85    
86     /* The XML tag processing function prototypes */
87    
88 amb 373 //static int xmlDeclaration_function(const char *_tag_,int _type_,const char *version,const char *encoding);
89     //static int RoutinoTranslationsType_function(const char *_tag_,int _type_);
90     static int languageType_function(const char *_tag_,int _type_,const char *lang);
91     //static int GPXType_function(const char *_tag_,int _type_);
92     static int GPXFinalType_function(const char *_tag_,int _type_,const char *text);
93     static int GPXStepType_function(const char *_tag_,int _type_,const char *text);
94     static int GPXNameType_function(const char *_tag_,int _type_,const char *text);
95     static int GPXDescType_function(const char *_tag_,int _type_,const char *text);
96 amb 378 //static int HTMLType_function(const char *_tag_,int _type_);
97     static int HTMLTotalType_function(const char *_tag_,int _type_,const char *string,const char *text);
98     static int HTMLStopType_function(const char *_tag_,int _type_,const char *string,const char *text);
99     static int HTMLSegmentType_function(const char *_tag_,int _type_,const char *string,const char *text);
100 amb 925 static int HTMLRBNodeType_function(const char *_tag_,int _type_,const char *string,const char *text);
101 amb 378 static int HTMLNodeType_function(const char *_tag_,int _type_,const char *string,const char *text);
102     static int HTMLStartType_function(const char *_tag_,int _type_,const char *string,const char *text);
103     static int HTMLTitleType_function(const char *_tag_,int _type_,const char *text);
104     //static int CopyrightType_function(const char *_tag_,int _type_);
105 amb 373 static int GPXWaypointType_function(const char *_tag_,int _type_,const char *type,const char *string);
106 amb 378 static int HTMLWaypointType_function(const char *_tag_,int _type_,const char *type,const char *string);
107     static int RouteType_function(const char *_tag_,int _type_,const char *type,const char *string);
108 amb 411 static int HighwayType_function(const char *_tag_,int _type_,const char *type,const char *string);
109 amb 925 static int OrdinalType_function(const char *_tag_,int _type_,const char *number,const char *string);
110 amb 373 static int HeadingType_function(const char *_tag_,int _type_,const char *direction,const char *string);
111     static int TurnType_function(const char *_tag_,int _type_,const char *direction,const char *string);
112 amb 375 static int CopyrightLicenseType_function(const char *_tag_,int _type_,const char *string,const char *text);
113     static int CopyrightSourceType_function(const char *_tag_,int _type_,const char *string,const char *text);
114     static int CopyrightCreatorType_function(const char *_tag_,int _type_,const char *string,const char *text);
115 amb 361
116    
117     /* The XML tag definitions */
118    
119 amb 375 /*+ The CopyrightCreatorType type tag. +*/
120     static xmltag CopyrightCreatorType_tag=
121     {"creator",
122     2, {"string","text"},
123     CopyrightCreatorType_function,
124     {NULL}};
125    
126     /*+ The CopyrightSourceType type tag. +*/
127     static xmltag CopyrightSourceType_tag=
128     {"source",
129     2, {"string","text"},
130     CopyrightSourceType_function,
131     {NULL}};
132    
133     /*+ The CopyrightLicenseType type tag. +*/
134     static xmltag CopyrightLicenseType_tag=
135     {"license",
136     2, {"string","text"},
137     CopyrightLicenseType_function,
138     {NULL}};
139    
140 amb 361 /*+ The TurnType type tag. +*/
141 amb 367 static xmltag TurnType_tag=
142 amb 361 {"turn",
143     2, {"direction","string"},
144 amb 367 TurnType_function,
145 amb 361 {NULL}};
146    
147     /*+ The HeadingType type tag. +*/
148 amb 367 static xmltag HeadingType_tag=
149 amb 361 {"heading",
150     2, {"direction","string"},
151 amb 367 HeadingType_function,
152 amb 361 {NULL}};
153    
154 amb 925 /*+ The OrdinalType type tag. +*/
155     static xmltag OrdinalType_tag=
156     {"ordinal",
157     2, {"number","string"},
158     OrdinalType_function,
159     {NULL}};
160    
161 amb 411 /*+ The HighwayType type tag. +*/
162     static xmltag HighwayType_tag=
163     {"highway",
164     2, {"type","string"},
165     HighwayType_function,
166     {NULL}};
167    
168 amb 378 /*+ The RouteType type tag. +*/
169     static xmltag RouteType_tag=
170     {"route",
171     2, {"type","string"},
172     RouteType_function,
173 amb 361 {NULL}};
174    
175 amb 378 /*+ The HTMLWaypointType type tag. +*/
176     static xmltag HTMLWaypointType_tag=
177     {"waypoint",
178 amb 361 2, {"type","string"},
179 amb 378 HTMLWaypointType_function,
180 amb 361 {NULL}};
181    
182 amb 378 /*+ The GPXWaypointType type tag. +*/
183     static xmltag GPXWaypointType_tag=
184     {"waypoint",
185     2, {"type","string"},
186     GPXWaypointType_function,
187     {NULL}};
188    
189 amb 375 /*+ The CopyrightType type tag. +*/
190     static xmltag CopyrightType_tag=
191     {"copyright",
192     0, {NULL},
193     NULL,
194     {&CopyrightCreatorType_tag,&CopyrightSourceType_tag,&CopyrightLicenseType_tag,NULL}};
195    
196 amb 378 /*+ The HTMLTitleType type tag. +*/
197     static xmltag HTMLTitleType_tag=
198     {"title",
199     1, {"text"},
200     HTMLTitleType_function,
201 amb 361 {NULL}};
202    
203 amb 378 /*+ The HTMLStartType type tag. +*/
204     static xmltag HTMLStartType_tag=
205     {"start",
206     2, {"string","text"},
207     HTMLStartType_function,
208     {NULL}};
209    
210     /*+ The HTMLNodeType type tag. +*/
211     static xmltag HTMLNodeType_tag=
212     {"node",
213     2, {"string","text"},
214     HTMLNodeType_function,
215     {NULL}};
216    
217 amb 925 /*+ The HTMLRBNodeType type tag. +*/
218     static xmltag HTMLRBNodeType_tag=
219     {"rbnode",
220     2, {"string","text"},
221     HTMLRBNodeType_function,
222     {NULL}};
223    
224 amb 378 /*+ The HTMLSegmentType type tag. +*/
225     static xmltag HTMLSegmentType_tag=
226     {"segment",
227     2, {"string","text"},
228     HTMLSegmentType_function,
229     {NULL}};
230    
231     /*+ The HTMLStopType type tag. +*/
232     static xmltag HTMLStopType_tag=
233     {"stop",
234     2, {"string","text"},
235     HTMLStopType_function,
236     {NULL}};
237    
238     /*+ The HTMLTotalType type tag. +*/
239     static xmltag HTMLTotalType_tag=
240     {"total",
241     2, {"string","text"},
242     HTMLTotalType_function,
243     {NULL}};
244    
245     /*+ The HTMLType type tag. +*/
246     static xmltag HTMLType_tag=
247     {"output-html",
248     0, {NULL},
249     NULL,
250 amb 925 {&HTMLWaypointType_tag,&HTMLTitleType_tag,&HTMLStartType_tag,&HTMLNodeType_tag,&HTMLRBNodeType_tag,&HTMLSegmentType_tag,&HTMLStopType_tag,&HTMLTotalType_tag,NULL}};
251 amb 378
252 amb 361 /*+ The GPXDescType type tag. +*/
253 amb 367 static xmltag GPXDescType_tag=
254 amb 361 {"desc",
255     1, {"text"},
256 amb 367 GPXDescType_function,
257 amb 361 {NULL}};
258    
259     /*+ The GPXNameType type tag. +*/
260 amb 367 static xmltag GPXNameType_tag=
261 amb 361 {"name",
262     1, {"text"},
263 amb 367 GPXNameType_function,
264 amb 361 {NULL}};
265    
266     /*+ The GPXStepType type tag. +*/
267 amb 367 static xmltag GPXStepType_tag=
268 amb 361 {"step",
269     1, {"text"},
270 amb 367 GPXStepType_function,
271 amb 361 {NULL}};
272    
273     /*+ The GPXFinalType type tag. +*/
274 amb 367 static xmltag GPXFinalType_tag=
275 amb 361 {"final",
276     1, {"text"},
277 amb 367 GPXFinalType_function,
278 amb 361 {NULL}};
279    
280     /*+ The GPXType type tag. +*/
281 amb 367 static xmltag GPXType_tag=
282 amb 361 {"output-gpx",
283     0, {NULL},
284     NULL,
285 amb 378 {&GPXWaypointType_tag,&GPXDescType_tag,&GPXNameType_tag,&GPXStepType_tag,&GPXFinalType_tag,NULL}};
286 amb 361
287     /*+ The languageType type tag. +*/
288 amb 367 static xmltag languageType_tag=
289 amb 361 {"language",
290     1, {"lang"},
291 amb 367 languageType_function,
292 amb 925 {&CopyrightType_tag,&TurnType_tag,&HeadingType_tag,&OrdinalType_tag,&HighwayType_tag,&RouteType_tag,&HTMLType_tag,&GPXType_tag,NULL}};
293 amb 361
294     /*+ The RoutinoTranslationsType type tag. +*/
295 amb 367 static xmltag RoutinoTranslationsType_tag=
296 amb 361 {"routino-translations",
297     0, {NULL},
298     NULL,
299 amb 367 {&languageType_tag,NULL}};
300 amb 361
301 amb 367 /*+ The xmlDeclaration type tag. +*/
302     static xmltag xmlDeclaration_tag=
303 amb 361 {"xml",
304     2, {"version","encoding"},
305     NULL,
306     {NULL}};
307    
308    
309     /*+ The complete set of tags at the top level. +*/
310 amb 367 static xmltag *xml_toplevel_tags[]={&xmlDeclaration_tag,&RoutinoTranslationsType_tag,NULL};
311 amb 361
312    
313     /* The XML tag processing functions */
314    
315    
316     /*++++++++++++++++++++++++++++++++++++++
317 amb 375 The function that is called when the CopyrightCreatorType XSD type is seen
318    
319     int CopyrightCreatorType_function Returns 0 if no error occured or something else otherwise.
320    
321     const char *_tag_ Set to the name of the element tag that triggered this function call.
322    
323     int _type_ Set to XMLPARSE_TAG_START at the start of a tag and/or XMLPARSE_TAG_END at the end of a tag.
324    
325     const char *string The contents of the 'string' attribute (or NULL if not defined).
326    
327     const char *text The contents of the 'text' attribute (or NULL if not defined).
328     ++++++++++++++++++++++++++++++++++++++*/
329    
330     static int CopyrightCreatorType_function(const char *_tag_,int _type_,const char *string,const char *text)
331     {
332     if(_type_&XMLPARSE_TAG_START && store)
333     {
334 amb 486 char *xmlstring,*xmltext;
335    
336 amb 375 XMLPARSE_ASSERT_STRING(_tag_,string);
337     XMLPARSE_ASSERT_STRING(_tag_,text);
338    
339 amb 893 translate_raw_copyright_creator[0]=strcpy(malloc(strlen(string)+1),string);
340     translate_raw_copyright_creator[1]=strcpy(malloc(strlen(text)+1) ,text);
341    
342 amb 486 xmlstring=ParseXML_Encode_Safe_XML(string);
343     xmltext =ParseXML_Encode_Safe_XML(text);
344    
345 amb 893 translate_xml_copyright_creator[0]=strcpy(malloc(strlen(xmlstring)+1),xmlstring);
346     translate_xml_copyright_creator[1]=strcpy(malloc(strlen(xmltext)+1) ,xmltext);
347 amb 375 }
348    
349     return(0);
350     }
351    
352    
353     /*++++++++++++++++++++++++++++++++++++++
354     The function that is called when the CopyrightSourceType XSD type is seen
355    
356     int CopyrightSourceType_function Returns 0 if no error occured or something else otherwise.
357    
358     const char *_tag_ Set to the name of the element tag that triggered this function call.
359    
360     int _type_ Set to XMLPARSE_TAG_START at the start of a tag and/or XMLPARSE_TAG_END at the end of a tag.
361    
362     const char *string The contents of the 'string' attribute (or NULL if not defined).
363    
364     const char *text The contents of the 'text' attribute (or NULL if not defined).
365     ++++++++++++++++++++++++++++++++++++++*/
366    
367     static int CopyrightSourceType_function(const char *_tag_,int _type_,const char *string,const char *text)
368     {
369     if(_type_&XMLPARSE_TAG_START && store)
370     {
371 amb 486 char *xmlstring,*xmltext;
372    
373 amb 375 XMLPARSE_ASSERT_STRING(_tag_,string);
374     XMLPARSE_ASSERT_STRING(_tag_,text);
375    
376 amb 893 translate_raw_copyright_source[0]=strcpy(malloc(strlen(string)+1),string);
377     translate_raw_copyright_source[1]=strcpy(malloc(strlen(text)+1) ,text);
378    
379 amb 486 xmlstring=ParseXML_Encode_Safe_XML(string);
380     xmltext =ParseXML_Encode_Safe_XML(text);
381    
382 amb 893 translate_xml_copyright_source[0]=strcpy(malloc(strlen(xmlstring)+1),xmlstring);
383     translate_xml_copyright_source[1]=strcpy(malloc(strlen(xmltext)+1) ,xmltext);
384 amb 375 }
385    
386     return(0);
387     }
388    
389    
390     /*++++++++++++++++++++++++++++++++++++++
391     The function that is called when the CopyrightLicenseType XSD type is seen
392    
393     int CopyrightLicenseType_function Returns 0 if no error occured or something else otherwise.
394    
395     const char *_tag_ Set to the name of the element tag that triggered this function call.
396    
397     int _type_ Set to XMLPARSE_TAG_START at the start of a tag and/or XMLPARSE_TAG_END at the end of a tag.
398    
399     const char *string The contents of the 'string' attribute (or NULL if not defined).
400    
401     const char *text The contents of the 'text' attribute (or NULL if not defined).
402     ++++++++++++++++++++++++++++++++++++++*/
403    
404     static int CopyrightLicenseType_function(const char *_tag_,int _type_,const char *string,const char *text)
405     {
406     if(_type_&XMLPARSE_TAG_START && store)
407     {
408 amb 486 char *xmlstring,*xmltext;
409    
410 amb 375 XMLPARSE_ASSERT_STRING(_tag_,string);
411     XMLPARSE_ASSERT_STRING(_tag_,text);
412    
413 amb 893 translate_raw_copyright_license[0]=strcpy(malloc(strlen(string)+1),string);
414     translate_raw_copyright_license[1]=strcpy(malloc(strlen(text)+1) ,text);
415    
416 amb 486 xmlstring=ParseXML_Encode_Safe_XML(string);
417     xmltext =ParseXML_Encode_Safe_XML(text);
418    
419 amb 893 translate_xml_copyright_license[0]=strcpy(malloc(strlen(xmlstring)+1),xmlstring);
420     translate_xml_copyright_license[1]=strcpy(malloc(strlen(xmltext)+1) ,xmltext);
421 amb 375 }
422    
423     return(0);
424     }
425    
426    
427     /*++++++++++++++++++++++++++++++++++++++
428 amb 361 The function that is called when the TurnType XSD type is seen
429    
430 amb 367 int TurnType_function Returns 0 if no error occured or something else otherwise.
431 amb 363
432 amb 373 const char *_tag_ Set to the name of the element tag that triggered this function call.
433    
434 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.
435    
436     const char *direction The contents of the 'direction' attribute (or NULL if not defined).
437    
438     const char *string The contents of the 'string' attribute (or NULL if not defined).
439     ++++++++++++++++++++++++++++++++++++++*/
440    
441 amb 373 static int TurnType_function(const char *_tag_,int _type_,const char *direction,const char *string)
442 amb 361 {
443     if(_type_&XMLPARSE_TAG_START && store)
444     {
445 amb 486 char *xmlstring;
446 amb 361 int d;
447    
448 amb 774 XMLPARSE_ASSERT_INTEGER(_tag_,direction); d=atoi(direction);
449 amb 373 XMLPARSE_ASSERT_STRING(_tag_,string);
450 amb 361
451 amb 363 d+=4;
452 amb 361
453     if(d<0 || d>8)
454 amb 373 XMLPARSE_INVALID(_tag_,direction);
455 amb 361
456 amb 486 xmlstring=ParseXML_Encode_Safe_XML(string);
457    
458 amb 893 translate_xml_turn[d]=strcpy(malloc(strlen(xmlstring)+1),xmlstring);
459 amb 361 }
460 amb 363
461     return(0);
462 amb 361 }
463    
464    
465     /*++++++++++++++++++++++++++++++++++++++
466     The function that is called when the HeadingType XSD type is seen
467    
468 amb 367 int HeadingType_function Returns 0 if no error occured or something else otherwise.
469 amb 363
470 amb 373 const char *_tag_ Set to the name of the element tag that triggered this function call.
471    
472 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.
473    
474     const char *direction The contents of the 'direction' attribute (or NULL if not defined).
475    
476     const char *string The contents of the 'string' attribute (or NULL if not defined).
477     ++++++++++++++++++++++++++++++++++++++*/
478    
479 amb 373 static int HeadingType_function(const char *_tag_,int _type_,const char *direction,const char *string)
480 amb 361 {
481     if(_type_&XMLPARSE_TAG_START && store)
482     {
483 amb 486 char *xmlstring;
484 amb 361 int d;
485    
486 amb 774 XMLPARSE_ASSERT_INTEGER(_tag_,direction); d=atoi(direction);
487 amb 373 XMLPARSE_ASSERT_STRING(_tag_,string);
488 amb 361
489 amb 363 d+=4;
490 amb 361
491     if(d<0 || d>8)
492 amb 373 XMLPARSE_INVALID(_tag_,direction);
493 amb 361
494 amb 486 xmlstring=ParseXML_Encode_Safe_XML(string);
495    
496 amb 893 translate_xml_heading[d]=strcpy(malloc(strlen(xmlstring)+1),xmlstring);
497 amb 361 }
498 amb 363
499     return(0);
500 amb 361 }
501    
502    
503     /*++++++++++++++++++++++++++++++++++++++
504 amb 925 The function that is called when the OrdinalType XSD type is seen
505    
506     int OrdinalType_function Returns 0 if no error occured or something else otherwise.
507    
508     const char *_tag_ Set to the name of the element tag that triggered this function call.
509    
510     int _type_ Set to XMLPARSE_TAG_START at the start of a tag and/or XMLPARSE_TAG_END at the end of a tag.
511    
512     const char *number The contents of the 'number' attribute (or NULL if not defined).
513    
514     const char *string The contents of the 'string' attribute (or NULL if not defined).
515     ++++++++++++++++++++++++++++++++++++++*/
516    
517     static int OrdinalType_function(const char *_tag_,int _type_,const char *number,const char *string)
518     {
519     if(_type_&XMLPARSE_TAG_START && store)
520     {
521     char *xmlstring;
522     int n;
523    
524     XMLPARSE_ASSERT_INTEGER(_tag_,number); n=atoi(number);
525     XMLPARSE_ASSERT_STRING(_tag_,string);
526    
527     if(n<1 || n>10)
528     XMLPARSE_INVALID(_tag_,number);
529    
530     xmlstring=ParseXML_Encode_Safe_XML(string);
531    
532     translate_xml_ordinal[n-1]=strcpy(malloc(strlen(xmlstring)+1),xmlstring);
533     }
534    
535     return(0);
536     }
537    
538    
539     /*++++++++++++++++++++++++++++++++++++++
540 amb 411 The function that is called when the HighwayType XSD type is seen
541    
542     int HighwayType_function Returns 0 if no error occured or something else otherwise.
543    
544     const char *_tag_ Set to the name of the element tag that triggered this function call.
545    
546     int _type_ Set to XMLPARSE_TAG_START at the start of a tag and/or XMLPARSE_TAG_END at the end of a tag.
547    
548     const char *type The contents of the 'type' attribute (or NULL if not defined).
549    
550     const char *string The contents of the 'string' attribute (or NULL if not defined).
551     ++++++++++++++++++++++++++++++++++++++*/
552    
553     static int HighwayType_function(const char *_tag_,int _type_,const char *type,const char *string)
554     {
555     if(_type_&XMLPARSE_TAG_START && store)
556     {
557     Highway highway;
558    
559     XMLPARSE_ASSERT_STRING(_tag_,type);
560     XMLPARSE_ASSERT_STRING(_tag_,string);
561    
562     highway=HighwayType(type);
563    
564     if(highway==Way_Count)
565     XMLPARSE_INVALID(_tag_,type);
566    
567 amb 893 translate_raw_highway[highway]=strcpy(malloc(strlen(string)+1),string);
568 amb 411 }
569    
570     return(0);
571     }
572    
573    
574     /*++++++++++++++++++++++++++++++++++++++
575 amb 378 The function that is called when the RouteType XSD type is seen
576 amb 363
577 amb 378 int RouteType_function Returns 0 if no error occured or something else otherwise.
578 amb 363
579 amb 373 const char *_tag_ Set to the name of the element tag that triggered this function call.
580    
581 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.
582    
583 amb 361 const char *type The contents of the 'type' attribute (or NULL if not defined).
584    
585     const char *string The contents of the 'string' attribute (or NULL if not defined).
586     ++++++++++++++++++++++++++++++++++++++*/
587    
588 amb 378 static int RouteType_function(const char *_tag_,int _type_,const char *type,const char *string)
589 amb 361 {
590     if(_type_&XMLPARSE_TAG_START && store)
591     {
592 amb 486 char *xmlstring;
593    
594 amb 373 XMLPARSE_ASSERT_STRING(_tag_,type);
595     XMLPARSE_ASSERT_STRING(_tag_,string);
596 amb 361
597 amb 486 xmlstring=ParseXML_Encode_Safe_XML(string);
598    
599 amb 361 if(!strcmp(type,"shortest"))
600 amb 893 translate_xml_route_shortest=strcpy(malloc(strlen(xmlstring)+1),xmlstring);
601 amb 361 else if(!strcmp(type,"quickest"))
602 amb 893 translate_xml_route_quickest=strcpy(malloc(strlen(xmlstring)+1),xmlstring);
603 amb 361 else
604 amb 373 XMLPARSE_INVALID(_tag_,type);
605 amb 361 }
606 amb 363
607     return(0);
608 amb 361 }
609    
610    
611     /*++++++++++++++++++++++++++++++++++++++
612 amb 378 The function that is called when the HTMLWaypointType XSD type is seen
613 amb 375
614 amb 378 int HTMLWaypointType_function Returns 0 if no error occured or something else otherwise.
615 amb 375
616     const char *_tag_ Set to the name of the element tag that triggered this function call.
617    
618     int _type_ Set to XMLPARSE_TAG_START at the start of a tag and/or XMLPARSE_TAG_END at the end of a tag.
619 amb 378
620     const char *type The contents of the 'type' attribute (or NULL if not defined).
621    
622     const char *string The contents of the 'string' attribute (or NULL if not defined).
623 amb 375 ++++++++++++++++++++++++++++++++++++++*/
624    
625 amb 378 static int HTMLWaypointType_function(const char *_tag_,int _type_,const char *type,const char *string)
626     {
627     if(_type_&XMLPARSE_TAG_START && store)
628     {
629 amb 486 char *xmlstring;
630    
631 amb 378 XMLPARSE_ASSERT_STRING(_tag_,type);
632     XMLPARSE_ASSERT_STRING(_tag_,string);
633 amb 375
634 amb 486 xmlstring=ParseXML_Encode_Safe_XML(string);
635    
636 amb 378 if(!strcmp(type,"waypoint"))
637     {
638 amb 486 translate_html_waypoint=malloc(strlen(xmlstring)+1+sizeof("<span class='w'>")+sizeof("</span>"));
639     sprintf(translate_html_waypoint,"<span class='w'>%s</span>",xmlstring);
640 amb 378 }
641     else if(!strcmp(type,"junction"))
642 amb 486 translate_html_junction=strcpy(malloc(strlen(xmlstring)+1),xmlstring);
643 amb 925 else if(!strcmp(type,"roundabout"))
644     translate_html_roundabout=strcpy(malloc(strlen(xmlstring)+1),xmlstring);
645 amb 378 else
646     XMLPARSE_INVALID(_tag_,type);
647     }
648 amb 375
649 amb 378 return(0);
650     }
651    
652    
653 amb 375 /*++++++++++++++++++++++++++++++++++++++
654 amb 361 The function that is called when the GPXWaypointType XSD type is seen
655    
656 amb 367 int GPXWaypointType_function Returns 0 if no error occured or something else otherwise.
657 amb 363
658 amb 373 const char *_tag_ Set to the name of the element tag that triggered this function call.
659    
660 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.
661    
662     const char *type The contents of the 'type' attribute (or NULL if not defined).
663    
664     const char *string The contents of the 'string' attribute (or NULL if not defined).
665     ++++++++++++++++++++++++++++++++++++++*/
666    
667 amb 373 static int GPXWaypointType_function(const char *_tag_,int _type_,const char *type,const char *string)
668 amb 361 {
669     if(_type_&XMLPARSE_TAG_START && store)
670     {
671 amb 486 char *xmlstring;
672    
673 amb 373 XMLPARSE_ASSERT_STRING(_tag_,type);
674     XMLPARSE_ASSERT_STRING(_tag_,string);
675 amb 361
676 amb 486 xmlstring=ParseXML_Encode_Safe_XML(string);
677    
678 amb 361 if(!strcmp(type,"start"))
679 amb 486 translate_gpx_start=strcpy(malloc(strlen(xmlstring)+1),xmlstring);
680 amb 361 else if(!strcmp(type,"inter"))
681 amb 486 translate_gpx_inter=strcpy(malloc(strlen(xmlstring)+1),xmlstring);
682 amb 361 else if(!strcmp(type,"trip"))
683 amb 486 translate_gpx_trip=strcpy(malloc(strlen(xmlstring)+1),xmlstring);
684 amb 361 else if(!strcmp(type,"finish"))
685 amb 486 translate_gpx_finish=strcpy(malloc(strlen(xmlstring)+1),xmlstring);
686 amb 361 else
687 amb 373 XMLPARSE_INVALID(_tag_,type);
688 amb 361 }
689 amb 363
690     return(0);
691 amb 361 }
692    
693    
694     /*++++++++++++++++++++++++++++++++++++++
695 amb 378 The function that is called when the CopyrightType XSD type is seen
696    
697     int CopyrightType_function Returns 0 if no error occured or something else otherwise.
698    
699     const char *_tag_ Set to the name of the element tag that triggered this function call.
700    
701     int _type_ Set to XMLPARSE_TAG_START at the start of a tag and/or XMLPARSE_TAG_END at the end of a tag.
702     ++++++++++++++++++++++++++++++++++++++*/
703    
704     //static int CopyrightType_function(const char *_tag_,int _type_)
705     //{
706     // return(0);
707     //}
708    
709    
710     /*++++++++++++++++++++++++++++++++++++++
711     The function that is called when the HTMLTitleType XSD type is seen
712    
713     int HTMLTitleType_function Returns 0 if no error occured or something else otherwise.
714    
715     const char *_tag_ Set to the name of the element tag that triggered this function call.
716    
717     int _type_ Set to XMLPARSE_TAG_START at the start of a tag and/or XMLPARSE_TAG_END at the end of a tag.
718    
719     const char *text The contents of the 'text' attribute (or NULL if not defined).
720     ++++++++++++++++++++++++++++++++++++++*/
721    
722     static int HTMLTitleType_function(const char *_tag_,int _type_,const char *text)
723     {
724     if(_type_&XMLPARSE_TAG_START && store)
725     {
726 amb 486 char *xmltext;
727    
728 amb 378 XMLPARSE_ASSERT_STRING(_tag_,text);
729    
730 amb 486 xmltext=ParseXML_Encode_Safe_XML(text);
731    
732     translate_html_title=strcpy(malloc(strlen(xmltext)+1),xmltext);
733 amb 378 }
734    
735     return(0);
736     }
737    
738    
739     /*++++++++++++++++++++++++++++++++++++++
740     The function that is called when the HTMLStartType XSD type is seen
741    
742     int HTMLStartType_function Returns 0 if no error occured or something else otherwise.
743    
744     const char *_tag_ Set to the name of the element tag that triggered this function call.
745    
746     int _type_ Set to XMLPARSE_TAG_START at the start of a tag and/or XMLPARSE_TAG_END at the end of a tag.
747    
748     const char *string The contents of the 'string' attribute (or NULL if not defined).
749    
750     const char *text The contents of the 'text' attribute (or NULL if not defined).
751     ++++++++++++++++++++++++++++++++++++++*/
752    
753     static int HTMLStartType_function(const char *_tag_,int _type_,const char *string,const char *text)
754     {
755     if(_type_&XMLPARSE_TAG_START && store)
756     {
757 amb 486 char *xmlstring,*xmltext;
758    
759 amb 378 XMLPARSE_ASSERT_STRING(_tag_,string);
760     XMLPARSE_ASSERT_STRING(_tag_,text);
761    
762 amb 486 xmlstring=ParseXML_Encode_Safe_XML(string);
763     xmltext =ParseXML_Encode_Safe_XML(text);
764    
765     translate_html_start[0]=strcpy(malloc(strlen(xmlstring)+1),xmlstring);
766     translate_html_start[1]=malloc(strlen(xmltext)+1+sizeof("<span class='b'>")+sizeof("</span>"));
767     sprintf(translate_html_start[1],xmltext,"%s","<span class='b'>%s</span>");
768 amb 378 }
769    
770     return(0);
771     }
772    
773    
774     /*++++++++++++++++++++++++++++++++++++++
775     The function that is called when the HTMLNodeType XSD type is seen
776    
777     int HTMLNodeType_function Returns 0 if no error occured or something else otherwise.
778    
779     const char *_tag_ Set to the name of the element tag that triggered this function call.
780    
781     int _type_ Set to XMLPARSE_TAG_START at the start of a tag and/or XMLPARSE_TAG_END at the end of a tag.
782    
783     const char *string The contents of the 'string' attribute (or NULL if not defined).
784    
785     const char *text The contents of the 'text' attribute (or NULL if not defined).
786     ++++++++++++++++++++++++++++++++++++++*/
787    
788     static int HTMLNodeType_function(const char *_tag_,int _type_,const char *string,const char *text)
789     {
790     if(_type_&XMLPARSE_TAG_START && store)
791     {
792 amb 486 char *xmlstring,*xmltext;
793    
794 amb 378 XMLPARSE_ASSERT_STRING(_tag_,string);
795     XMLPARSE_ASSERT_STRING(_tag_,text);
796    
797 amb 486 xmlstring=ParseXML_Encode_Safe_XML(string);
798     xmltext =ParseXML_Encode_Safe_XML(text);
799    
800     translate_html_node[0]=strcpy(malloc(strlen(xmlstring)+1),xmlstring);
801     translate_html_node[1]=malloc(strlen(xmltext)+1+2*sizeof("<span class='b'>")+2*sizeof("</span>"));
802     sprintf(translate_html_node[1],xmltext,"%s","<span class='t'>%s</span>","<span class='b'>%s</span>");
803 amb 378 }
804    
805     return(0);
806     }
807    
808    
809     /*++++++++++++++++++++++++++++++++++++++
810 amb 925 The function that is called when the HTMLRBNodeType XSD type is seen
811    
812     int HTMLRBNodeType_function Returns 0 if no error occured or something else otherwise.
813    
814     const char *_tag_ Set to the name of the element tag that triggered this function call.
815    
816     int _type_ Set to XMLPARSE_TAG_START at the start of a tag and/or XMLPARSE_TAG_END at the end of a tag.
817    
818     const char *string The contents of the 'string' attribute (or NULL if not defined).
819    
820     const char *text The contents of the 'text' attribute (or NULL if not defined).
821     ++++++++++++++++++++++++++++++++++++++*/
822    
823     static int HTMLRBNodeType_function(const char *_tag_,int _type_,const char *string,const char *text)
824     {
825     if(_type_&XMLPARSE_TAG_START && store)
826     {
827     char *xmlstring,*xmltext;
828    
829     XMLPARSE_ASSERT_STRING(_tag_,string);
830     XMLPARSE_ASSERT_STRING(_tag_,text);
831    
832     xmlstring=ParseXML_Encode_Safe_XML(string);
833     xmltext =ParseXML_Encode_Safe_XML(text);
834    
835     translate_html_rbnode[0]=strcpy(malloc(strlen(xmlstring)+1),xmlstring);
836     translate_html_rbnode[1]=malloc(strlen(xmltext)+1+2*sizeof("<span class='b'>")+2*sizeof("</span>"));
837     sprintf(translate_html_rbnode[1],xmltext,"%s","<span class='t'>%s</span>","<span class='b'>%s</span>");
838     }
839    
840     return(0);
841     }
842    
843    
844     /*++++++++++++++++++++++++++++++++++++++
845 amb 378 The function that is called when the HTMLSegmentType XSD type is seen
846    
847     int HTMLSegmentType_function Returns 0 if no error occured or something else otherwise.
848    
849     const char *_tag_ Set to the name of the element tag that triggered this function call.
850    
851     int _type_ Set to XMLPARSE_TAG_START at the start of a tag and/or XMLPARSE_TAG_END at the end of a tag.
852    
853     const char *string The contents of the 'string' attribute (or NULL if not defined).
854    
855     const char *text The contents of the 'text' attribute (or NULL if not defined).
856     ++++++++++++++++++++++++++++++++++++++*/
857    
858     static int HTMLSegmentType_function(const char *_tag_,int _type_,const char *string,const char *text)
859     {
860     if(_type_&XMLPARSE_TAG_START && store)
861     {
862 amb 486 char *xmlstring,*xmltext;
863 amb 378 const char *p;
864     char *q;
865    
866     XMLPARSE_ASSERT_STRING(_tag_,string);
867     XMLPARSE_ASSERT_STRING(_tag_,text);
868    
869 amb 486 xmlstring=ParseXML_Encode_Safe_XML(string);
870     xmltext =ParseXML_Encode_Safe_XML(text);
871 amb 378
872 amb 486 translate_html_segment[0]=strcpy(malloc(strlen(xmlstring)+1),xmlstring);
873     translate_html_segment[1]=malloc(strlen(xmltext)+1+2*sizeof("<span class='b'>")+2*sizeof("</span>"));
874    
875     p=xmltext;
876 amb 378 q=translate_html_segment[1];
877    
878     while(*p!='%' && *(p+1)!='s')
879     *q++=*p++;
880    
881     p+=2;
882     strcpy(q,"<span class='h'>%s</span>"); q+=sizeof("<span class='h'>%s</span>")-1;
883    
884     while(*p!='%')
885     *q++=*p++;
886    
887     strcpy(q,"<span class='d'>"); q+=sizeof("<span class='d'>")-1;
888    
889     strcpy(q,p);
890     strcat(q,"</span>");
891     }
892    
893     return(0);
894     }
895    
896    
897     /*++++++++++++++++++++++++++++++++++++++
898     The function that is called when the HTMLStopType XSD type is seen
899    
900     int HTMLStopType_function Returns 0 if no error occured or something else otherwise.
901    
902     const char *_tag_ Set to the name of the element tag that triggered this function call.
903    
904     int _type_ Set to XMLPARSE_TAG_START at the start of a tag and/or XMLPARSE_TAG_END at the end of a tag.
905    
906     const char *string The contents of the 'string' attribute (or NULL if not defined).
907    
908     const char *text The contents of the 'text' attribute (or NULL if not defined).
909     ++++++++++++++++++++++++++++++++++++++*/
910    
911     static int HTMLStopType_function(const char *_tag_,int _type_,const char *string,const char *text)
912     {
913     if(_type_&XMLPARSE_TAG_START && store)
914     {
915 amb 486 char *xmlstring,*xmltext;
916    
917 amb 378 XMLPARSE_ASSERT_STRING(_tag_,string);
918     XMLPARSE_ASSERT_STRING(_tag_,text);
919    
920 amb 486 xmlstring=ParseXML_Encode_Safe_XML(string);
921     xmltext =ParseXML_Encode_Safe_XML(text);
922    
923     translate_html_stop[0]=strcpy(malloc(strlen(xmlstring)+1),xmlstring);
924     translate_html_stop[1]=strcpy(malloc(strlen(xmltext)+1) ,xmltext);
925 amb 378 }
926    
927     return(0);
928     }
929    
930    
931     /*++++++++++++++++++++++++++++++++++++++
932     The function that is called when the HTMLTotalType XSD type is seen
933    
934     int HTMLTotalType_function Returns 0 if no error occured or something else otherwise.
935    
936     const char *_tag_ Set to the name of the element tag that triggered this function call.
937    
938     int _type_ Set to XMLPARSE_TAG_START at the start of a tag and/or XMLPARSE_TAG_END at the end of a tag.
939    
940     const char *string The contents of the 'string' attribute (or NULL if not defined).
941    
942     const char *text The contents of the 'text' attribute (or NULL if not defined).
943     ++++++++++++++++++++++++++++++++++++++*/
944    
945     static int HTMLTotalType_function(const char *_tag_,int _type_,const char *string,const char *text)
946     {
947     if(_type_&XMLPARSE_TAG_START && store)
948     {
949 amb 486 char *xmlstring,*xmltext;
950    
951 amb 378 XMLPARSE_ASSERT_STRING(_tag_,string);
952     XMLPARSE_ASSERT_STRING(_tag_,text);
953    
954 amb 486 xmlstring=ParseXML_Encode_Safe_XML(string);
955     xmltext =ParseXML_Encode_Safe_XML(text);
956    
957     translate_html_total[0]=strcpy(malloc(strlen(xmlstring)+1),xmlstring);
958     translate_html_total[1]=strcpy(malloc(strlen(xmltext)+1) ,xmltext);
959 amb 378 }
960    
961     return(0);
962     }
963    
964    
965     /*++++++++++++++++++++++++++++++++++++++
966     The function that is called when the HTMLType XSD type is seen
967    
968     int HTMLType_function Returns 0 if no error occured or something else otherwise.
969    
970     const char *_tag_ Set to the name of the element tag that triggered this function call.
971    
972     int _type_ Set to XMLPARSE_TAG_START at the start of a tag and/or XMLPARSE_TAG_END at the end of a tag.
973     ++++++++++++++++++++++++++++++++++++++*/
974    
975     //static int HTMLType_function(const char *_tag_,int _type_)
976     //{
977     // return(0);
978     //}
979    
980    
981     /*++++++++++++++++++++++++++++++++++++++
982 amb 361 The function that is called when the GPXDescType XSD type is seen
983    
984 amb 367 int GPXDescType_function Returns 0 if no error occured or something else otherwise.
985 amb 363
986 amb 373 const char *_tag_ Set to the name of the element tag that triggered this function call.
987    
988 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.
989    
990     const char *text The contents of the 'text' attribute (or NULL if not defined).
991     ++++++++++++++++++++++++++++++++++++++*/
992    
993 amb 373 static int GPXDescType_function(const char *_tag_,int _type_,const char *text)
994 amb 361 {
995     if(_type_&XMLPARSE_TAG_START && store)
996     {
997 amb 486 char *xmltext;
998    
999 amb 373 XMLPARSE_ASSERT_STRING(_tag_,text);
1000 amb 361
1001 amb 486 xmltext=ParseXML_Encode_Safe_XML(text);
1002    
1003     translate_gpx_desc=strcpy(malloc(strlen(xmltext)+1),xmltext);
1004 amb 361 }
1005 amb 363
1006     return(0);
1007 amb 361 }
1008    
1009    
1010     /*++++++++++++++++++++++++++++++++++++++
1011     The function that is called when the GPXNameType XSD type is seen
1012    
1013 amb 367 int GPXNameType_function Returns 0 if no error occured or something else otherwise.
1014 amb 363
1015 amb 373 const char *_tag_ Set to the name of the element tag that triggered this function call.
1016    
1017 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.
1018    
1019     const char *text The contents of the 'text' attribute (or NULL if not defined).
1020     ++++++++++++++++++++++++++++++++++++++*/
1021    
1022 amb 373 static int GPXNameType_function(const char *_tag_,int _type_,const char *text)
1023 amb 361 {
1024     if(_type_&XMLPARSE_TAG_START && store)
1025     {
1026 amb 486 char *xmltext;
1027    
1028 amb 373 XMLPARSE_ASSERT_STRING(_tag_,text);
1029 amb 361
1030 amb 486 xmltext=ParseXML_Encode_Safe_XML(text);
1031    
1032     translate_gpx_name=strcpy(malloc(strlen(xmltext)+1),xmltext);
1033 amb 361 }
1034 amb 363
1035     return(0);
1036 amb 361 }
1037    
1038    
1039     /*++++++++++++++++++++++++++++++++++++++
1040     The function that is called when the GPXStepType XSD type is seen
1041    
1042 amb 367 int GPXStepType_function Returns 0 if no error occured or something else otherwise.
1043 amb 363
1044 amb 373 const char *_tag_ Set to the name of the element tag that triggered this function call.
1045    
1046 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.
1047    
1048     const char *text The contents of the 'text' attribute (or NULL if not defined).
1049     ++++++++++++++++++++++++++++++++++++++*/
1050    
1051 amb 373 static int GPXStepType_function(const char *_tag_,int _type_,const char *text)
1052 amb 361 {
1053     if(_type_&XMLPARSE_TAG_START && store)
1054     {
1055 amb 486 char *xmltext;
1056    
1057 amb 373 XMLPARSE_ASSERT_STRING(_tag_,text);
1058 amb 361
1059 amb 486 xmltext=ParseXML_Encode_Safe_XML(text);
1060    
1061     translate_gpx_step=strcpy(malloc(strlen(xmltext)+1),xmltext);
1062 amb 361 }
1063 amb 363
1064     return(0);
1065 amb 361 }
1066    
1067    
1068     /*++++++++++++++++++++++++++++++++++++++
1069     The function that is called when the GPXFinalType XSD type is seen
1070    
1071 amb 367 int GPXFinalType_function Returns 0 if no error occured or something else otherwise.
1072 amb 363
1073 amb 373 const char *_tag_ Set to the name of the element tag that triggered this function call.
1074    
1075 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.
1076    
1077     const char *text The contents of the 'text' attribute (or NULL if not defined).
1078     ++++++++++++++++++++++++++++++++++++++*/
1079    
1080 amb 373 static int GPXFinalType_function(const char *_tag_,int _type_,const char *text)
1081 amb 361 {
1082     if(_type_&XMLPARSE_TAG_START && store)
1083     {
1084 amb 486 char *xmltext;
1085    
1086 amb 373 XMLPARSE_ASSERT_STRING(_tag_,text);
1087 amb 361
1088 amb 486 xmltext=ParseXML_Encode_Safe_XML(text);
1089    
1090     translate_gpx_final=strcpy(malloc(strlen(xmltext)+1),xmltext);
1091 amb 361 }
1092 amb 363
1093     return(0);
1094 amb 361 }
1095    
1096    
1097     /*++++++++++++++++++++++++++++++++++++++
1098 amb 363 The function that is called when the GPXType XSD type is seen
1099    
1100 amb 367 int GPXType_function Returns 0 if no error occured or something else otherwise.
1101 amb 363
1102 amb 373 const char *_tag_ Set to the name of the element tag that triggered this function call.
1103    
1104 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.
1105     ++++++++++++++++++++++++++++++++++++++*/
1106    
1107 amb 373 //static int GPXType_function(const char *_tag_,int _type_)
1108 amb 363 //{
1109 amb 375 // return(0);
1110 amb 363 //}
1111    
1112    
1113     /*++++++++++++++++++++++++++++++++++++++
1114 amb 361 The function that is called when the languageType XSD type is seen
1115    
1116 amb 367 int languageType_function Returns 0 if no error occured or something else otherwise.
1117 amb 363
1118 amb 373 const char *_tag_ Set to the name of the element tag that triggered this function call.
1119    
1120 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.
1121    
1122     const char *lang The contents of the 'lang' attribute (or NULL if not defined).
1123     ++++++++++++++++++++++++++++++++++++++*/
1124    
1125 amb 373 static int languageType_function(const char *_tag_,int _type_,const char *lang)
1126 amb 361 {
1127     static int first=1;
1128    
1129     if(_type_&XMLPARSE_TAG_START)
1130     {
1131 amb 373 XMLPARSE_ASSERT_STRING(_tag_,lang);
1132 amb 361
1133     if(!store_lang && first)
1134     store=1;
1135 amb 432 else if(store_lang && !strcmp(store_lang,lang))
1136 amb 361 store=1;
1137     else
1138     store=0;
1139    
1140     first=0;
1141     }
1142    
1143     if(_type_&XMLPARSE_TAG_END && store)
1144     {
1145     store=0;
1146     stored=1;
1147     }
1148 amb 363
1149     return(0);
1150 amb 361 }
1151    
1152    
1153     /*++++++++++++++++++++++++++++++++++++++
1154 amb 363 The function that is called when the RoutinoTranslationsType XSD type is seen
1155    
1156 amb 367 int RoutinoTranslationsType_function Returns 0 if no error occured or something else otherwise.
1157 amb 363
1158 amb 373 const char *_tag_ Set to the name of the element tag that triggered this function call.
1159    
1160 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.
1161     ++++++++++++++++++++++++++++++++++++++*/
1162    
1163 amb 373 //static int RoutinoTranslationsType_function(const char *_tag_,int _type_)
1164 amb 363 //{
1165 amb 375 // return(0);
1166 amb 363 //}
1167    
1168    
1169     /*++++++++++++++++++++++++++++++++++++++
1170 amb 367 The function that is called when the XML declaration is seen
1171 amb 363
1172 amb 367 int xmlDeclaration_function Returns 0 if no error occured or something else otherwise.
1173 amb 363
1174 amb 373 const char *_tag_ Set to the name of the element tag that triggered this function call.
1175    
1176 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.
1177    
1178     const char *version The contents of the 'version' attribute (or NULL if not defined).
1179    
1180     const char *encoding The contents of the 'encoding' attribute (or NULL if not defined).
1181     ++++++++++++++++++++++++++++++++++++++*/
1182    
1183 amb 373 //static int xmlDeclaration_function(const char *_tag_,int _type_,const char *version,const char *encoding)
1184 amb 363 //{
1185 amb 375 // return(0);
1186 amb 363 //}
1187    
1188    
1189     /*++++++++++++++++++++++++++++++++++++++
1190 amb 361 The XML translation parser.
1191    
1192     int ParseXMLTranslations Returns 0 if OK or something else in case of an error.
1193    
1194     const char *filename The name of the file to read.
1195    
1196     const char *language The language to search for (NULL means first in file).
1197     ++++++++++++++++++++++++++++++++++++++*/
1198    
1199     int ParseXMLTranslations(const char *filename,const char *language)
1200     {
1201 amb 754 FILE *file;
1202 amb 361 int retval;
1203    
1204     store_lang=language;
1205    
1206     if(!ExistsFile(filename))
1207     {
1208     fprintf(stderr,"Error: Specified translations file '%s' does not exist.\n",filename);
1209     return(1);
1210     }
1211    
1212 amb 754 file=fopen(filename,"r");
1213 amb 361
1214     if(!file)
1215     {
1216     fprintf(stderr,"Error: Cannot open translations file '%s' for reading.\n",filename);
1217     return(1);
1218     }
1219    
1220 amb 375 retval=ParseXML(file,xml_toplevel_tags,XMLPARSE_UNKNOWN_ATTR_ERRNONAME|XMLPARSE_RETURN_ATTR_ENCODED);
1221 amb 361
1222     fclose(file);
1223    
1224 amb 363 if(retval)
1225 amb 361 return(1);
1226    
1227     if(language && !stored)
1228     fprintf(stderr,"Warning: Cannot find translations for language '%s' using English instead.\n",language);
1229    
1230     return(0);
1231     }

Properties

Name Value
cvs:description File containing translation parsing functions.