Routino SVN Repository Browser

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

ViewVC logotype

Contents of /trunk/src/profiles.c

Parent Directory Parent Directory | Revision Log Revision Log


Revision 341 - (show annotations) (download) (as text)
Mon Mar 29 18:20:06 2010 UTC (14 years, 11 months ago) by amb
File MIME type: text/x-csrc
File size: 21224 byte(s)
Added command line option to specify a file containing profiles.
Added command line option to select profile by name from loaded set.
Use XML parser to read in the profiles.

1 /***************************************
2 $Header: /home/amb/CVS/routino/src/profiles.c,v 1.32 2010-03-29 18:20:06 amb Exp $
3
4 The pre-defined profiles and the functions for handling them.
5
6 Part of the Routino routing software.
7 ******************/ /******************
8 This file Copyright 2008-2010 Andrew M. Bishop
9
10 This program is free software: you can redistribute it and/or modify
11 it under the terms of the GNU Affero General Public License as published by
12 the Free Software Foundation, either version 3 of the License, or
13 (at your option) any later version.
14
15 This program is distributed in the hope that it will be useful,
16 but WITHOUT ANY WARRANTY; without even the implied warranty of
17 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 GNU Affero General Public License for more details.
19
20 You should have received a copy of the GNU Affero General Public License
21 along with this program. If not, see <http://www.gnu.org/licenses/>.
22 ***************************************/
23
24
25 #include <stdio.h>
26 #include <string.h>
27 #include <stdlib.h>
28
29 #include "profiles.h"
30 #include "types.h"
31 #include "ways.h"
32 #include "xmlparse.h"
33
34
35 /*+ The profiles that have been loaded from file. +*/
36 static Profile **loaded_profiles=NULL;
37
38 /*+ The number of profiles that have been loaded from file. +*/
39 static int nloaded_profiles=0;
40
41
42 /* The XML tag processing function prototypes */
43
44 static void profile_function(char *name,char *transport);
45 static void length_function(char *limit);
46 static void width_function(char *limit);
47 static void height_function(char *limit);
48 static void weight_function(char *limit);
49 static void oneway_function(char *obey);
50 static void property_function(char *type,char *percent);
51 static void preference_function(char *highway,char *percent);
52 static void speed_function(char *highway,char *kph);
53
54
55 /* The XML tag definitions */
56
57 /*+ The speedType type tag. +*/
58 static xmltag speed_tag=
59 {"speed",
60 {"highway","kph",NULL},
61 speed_function,
62 {NULL}};
63
64 /*+ The speedsType type tag. +*/
65 static xmltag speeds_tag=
66 {"speeds",
67 {NULL},
68 NULL,
69 {&speed_tag,NULL}};
70
71 /*+ The preferenceType type tag. +*/
72 static xmltag preference_tag=
73 {"preference",
74 {"highway","percent",NULL},
75 preference_function,
76 {NULL}};
77
78 /*+ The preferencesType type tag. +*/
79 static xmltag preferences_tag=
80 {"preferences",
81 {NULL},
82 NULL,
83 {&preference_tag,NULL}};
84
85 /*+ The propertyType type tag. +*/
86 static xmltag property_tag=
87 {"property",
88 {"type","percent",NULL},
89 property_function,
90 {NULL}};
91
92 /*+ The onewayType type tag. +*/
93 static xmltag oneway_tag=
94 {"oneway",
95 {"obey",NULL},
96 oneway_function,
97 {NULL}};
98
99 /*+ The propertiesType type tag. +*/
100 static xmltag properties_tag=
101 {"properties",
102 {NULL},
103 NULL,
104 {&property_tag,NULL}};
105
106 /*+ The weightType type tag. +*/
107 static xmltag weight_tag=
108 {"weight",
109 {"limit",NULL},
110 weight_function,
111 {NULL}};
112
113 /*+ The heightType type tag. +*/
114 static xmltag height_tag=
115 {"height",
116 {"limit",NULL},
117 height_function,
118 {NULL}};
119
120 /*+ The widthType type tag. +*/
121 static xmltag width_tag=
122 {"width",
123 {"limit",NULL},
124 width_function,
125 {NULL}};
126
127 /*+ The lengthType type tag. +*/
128 static xmltag length_tag=
129 {"length",
130 {"limit",NULL},
131 length_function,
132 {NULL}};
133
134 /*+ The restrictionsType type tag. +*/
135 static xmltag restrictions_tag=
136 {"restrictions",
137 {NULL},
138 NULL,
139 {&oneway_tag,&weight_tag,&height_tag,&width_tag,&length_tag,NULL}};
140
141 /*+ The profileType type tag. +*/
142 static xmltag profile_tag=
143 {"profile",
144 {"name","transport",NULL},
145 profile_function,
146 {&speeds_tag,&preferences_tag,&properties_tag,&restrictions_tag,NULL}};
147
148 /*+ The RoutinoProfilesType type tag. +*/
149 static xmltag routino_profiles_tag=
150 {"routino-profiles",
151 {NULL},
152 NULL,
153 {&profile_tag,NULL}};
154
155 /*+ The ?xmlType type tag. +*/
156 static xmltag _xml_tag=
157 {"?xml",
158 {"version","encoding",NULL},
159 NULL,
160 {NULL}};
161
162
163 /*+ The complete set of tags at the top level. +*/
164 static xmltag *xml_toplevel_tags[]={&_xml_tag,&routino_profiles_tag,NULL};
165
166
167 /* The XML tag processing functions */
168
169
170 /*++++++++++++++++++++++++++++++++++++++
171 The function that is called when the speedType type is seen
172
173 char *highway The contents of the 'highway' attribute (or NULL if not defined).
174
175 char *kph The contents of the 'kph' attribute (or NULL if not defined).
176 ++++++++++++++++++++++++++++++++++++++*/
177
178 static void speed_function(char *highway,char *kph)
179 {
180 Highway highwaytype=HighwayType(highway);
181
182 loaded_profiles[nloaded_profiles-1]->speed[highwaytype]=kph_to_speed(atoi(kph));
183 }
184
185
186 /*++++++++++++++++++++++++++++++++++++++
187 The function that is called when the preferenceType type is seen
188
189 char *highway The contents of the 'highway' attribute (or NULL if not defined).
190
191 char *percent The contents of the 'percent' attribute (or NULL if not defined).
192 ++++++++++++++++++++++++++++++++++++++*/
193
194 static void preference_function(char *highway,char *percent)
195 {
196 Highway highwaytype=HighwayType(highway);
197
198 loaded_profiles[nloaded_profiles-1]->highway[highwaytype]=atoi(percent);
199 }
200
201
202 /*++++++++++++++++++++++++++++++++++++++
203 The function that is called when the propertyType type is seen
204
205 char *type The contents of the 'type' attribute (or NULL if not defined).
206
207 char *percent The contents of the 'percent' attribute (or NULL if not defined).
208 ++++++++++++++++++++++++++++++++++++++*/
209
210 static void property_function(char *type,char *percent)
211 {
212 Property property=PropertyType(type);
213
214 loaded_profiles[nloaded_profiles-1]->props_yes[property]=atoi(percent);
215 }
216
217
218 /*++++++++++++++++++++++++++++++++++++++
219 The function that is called when the onewayType type is seen
220
221 char *obey The contents of the 'obey' attribute (or NULL if not defined).
222 ++++++++++++++++++++++++++++++++++++++*/
223
224 static void oneway_function(char *obey)
225 {
226 loaded_profiles[nloaded_profiles-1]->oneway=!!atoi(obey);
227 }
228
229
230 /*++++++++++++++++++++++++++++++++++++++
231 The function that is called when the weightType type is seen
232
233 char *limit The contents of the 'limit' attribute (or NULL if not defined).
234 ++++++++++++++++++++++++++++++++++++++*/
235
236 static void weight_function(char *limit)
237 {
238 loaded_profiles[nloaded_profiles-1]->weight=tonnes_to_weight(atof(limit));
239 }
240
241
242 /*++++++++++++++++++++++++++++++++++++++
243 The function that is called when the heightType type is seen
244
245 char *limit The contents of the 'limit' attribute (or NULL if not defined).
246 ++++++++++++++++++++++++++++++++++++++*/
247
248 static void height_function(char *limit)
249 {
250 loaded_profiles[nloaded_profiles-1]->height=metres_to_height(atof(limit));
251 }
252
253
254 /*++++++++++++++++++++++++++++++++++++++
255 The function that is called when the widthType type is seen
256
257 char *limit The contents of the 'limit' attribute (or NULL if not defined).
258 ++++++++++++++++++++++++++++++++++++++*/
259
260 static void width_function(char *limit)
261 {
262 loaded_profiles[nloaded_profiles-1]->width=metres_to_width(atof(limit));
263 }
264
265
266 /*++++++++++++++++++++++++++++++++++++++
267 The function that is called when the lengthType type is seen
268
269 char *limit The contents of the 'limit' attribute (or NULL if not defined).
270 ++++++++++++++++++++++++++++++++++++++*/
271
272 static void length_function(char *limit)
273 {
274 loaded_profiles[nloaded_profiles-1]->length=metres_to_length(atof(limit));
275 }
276
277
278 /*++++++++++++++++++++++++++++++++++++++
279 The function that is called when the profileType type is seen
280
281 char *name The contents of the 'name' attribute (or NULL if not defined).
282
283 char *transport The contents of the 'transport' attribute (or NULL if not defined).
284 ++++++++++++++++++++++++++++++++++++++*/
285
286 static void profile_function(char *name,char *transport)
287 {
288 if((nloaded_profiles%16)==0)
289 loaded_profiles=(Profile**)realloc((void*)loaded_profiles,(nloaded_profiles+16)*sizeof(Profile*));
290
291 nloaded_profiles++;
292
293 loaded_profiles[nloaded_profiles-1]=(Profile*)calloc(1,sizeof(Profile));
294
295 loaded_profiles[nloaded_profiles-1]->name=strcpy(malloc(strlen(name)+1),name);
296 loaded_profiles[nloaded_profiles-1]->transport=TransportType(transport);
297 }
298
299
300 /*++++++++++++++++++++++++++++++++++++++
301 The XML profile parser.
302
303 int ParseXMLProfiles Returns 0 if OK or something else in case of an error.
304
305 const char *filename The name of the file to read.
306 ++++++++++++++++++++++++++++++++++++++*/
307
308 int ParseXMLProfiles(const char *filename)
309 {
310 FILE *file=fopen(filename,"r");
311
312 if(!file)
313 return(1);
314
315 ParseXML(file,xml_toplevel_tags,2);
316
317 fclose(file);
318
319 return(0);
320 }
321
322
323 /*++++++++++++++++++++++++++++++++++++++
324 Get the profile for a type of transport.
325
326 Profile *GetProfile Returns a pointer to the profile.
327
328 const char *name The name of the profile.
329 ++++++++++++++++++++++++++++++++++++++*/
330
331 Profile *GetProfile(const char *name)
332 {
333 int i;
334
335 for(i=0;i<nloaded_profiles;i++)
336 if(!strcmp(loaded_profiles[i]->name,name))
337 return(loaded_profiles[i]);
338
339 return(NULL);
340 }
341
342
343 /*++++++++++++++++++++++++++++++++++++++
344 Update a profile with highway preference scaling factor.
345
346 Profile *profile The profile to be updated.
347 ++++++++++++++++++++++++++++++++++++++*/
348
349 void UpdateProfile(Profile *profile)
350 {
351 score_t hmax=0;
352 int i;
353
354 profile->allow=ALLOWED(profile->transport);
355
356 /* Normalise the highway preferences into the range 0 -> 1 */
357
358 for(i=1;i<Way_Count;i++)
359 {
360 if(profile->highway[i]<0)
361 profile->highway[i]=0;
362
363 if(profile->highway[i]>hmax)
364 hmax=profile->highway[i];
365 }
366
367 for(i=1;i<Way_Count;i++)
368 profile->highway[i]/=hmax;
369
370 /* Normalise the attribute preferences into the range 0 -> 1 */
371
372 for(i=1;i<Property_Count;i++)
373 {
374 if(profile->props_yes[i]<0)
375 profile->props_yes[i]=0;
376
377 if(profile->props_yes[i]>100)
378 profile->props_yes[i]=100;
379
380 profile->props_yes[i]/=100;
381 profile->props_no [i] =1-profile->props_yes[i];
382 }
383
384 /* Find the fastest and most preferred highway type */
385
386 profile->max_speed=0;
387
388 for(i=1;i<Way_Count;i++)
389 if(profile->speed[i]>profile->max_speed)
390 profile->max_speed=profile->speed[i];
391
392 profile->max_pref=1; /* since highway prefs were normalised to 1 */
393
394 for(i=1;i<Property_Count;i++)
395 if(profile->props_yes[i]>profile->props_no[i])
396 profile->max_pref*=profile->props_yes[i];
397 else if(profile->props_no[i]>profile->props_yes[i])
398 profile->max_pref*=profile->props_no[i];
399 }
400
401
402 /*++++++++++++++++++++++++++++++++++++++
403 Print out a profile.
404
405 const Profile *profile The profile to print.
406 ++++++++++++++++++++++++++++++++++++++*/
407
408 void PrintProfile(const Profile *profile)
409 {
410 unsigned int i;
411
412 printf("Profile\n=======\n");
413
414 printf("\n");
415
416 printf("Transport: %s\n",TransportName(profile->transport));
417
418 printf("\n");
419
420 for(i=1;i<Way_Count;i++)
421 printf("Highway %-12s: %3d%%\n",HighwayName(i),(int)profile->highway[i]);
422
423 printf("\n");
424
425 for(i=1;i<Way_Count;i++)
426 if(profile->highway[i])
427 printf("Speed on %-12s: %3d km/h / %2.0f mph\n",HighwayName(i),profile->speed[i],(double)profile->speed[i]/1.6);
428
429 printf("\n");
430
431 for(i=1;i<Property_Count;i++)
432 printf("Highway property %-12s: %3d%%\n",PropertyName(i),(int)profile->props_yes[i]);
433
434 printf("\n");
435
436 printf("Obey one-way : %s\n",profile->oneway?"yes":"no");
437 printf("Minimum weight: %.1f tonnes\n",weight_to_tonnes(profile->weight));
438 printf("Minimum height: %.1f metres\n",height_to_metres(profile->height));
439 printf("Minimum width : %.1f metres\n",width_to_metres(profile->width));
440 printf("Minimum length: %.1f metres\n",length_to_metres(profile->length));
441 }
442
443
444 /*++++++++++++++++++++++++++++++++++++++
445 Print out the profiles as XML for use as program input.
446 ++++++++++++++++++++++++++++++++++++++*/
447
448 void PrintProfilesXML(void)
449 {
450 unsigned int i,j;
451 char *padding=" ";
452
453 printf("<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\n");
454 printf("\n");
455
456 printf("<routino-profiles xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:noNamespaceSchemaLocation=\"routino-profiles.xsd\">\n");
457 printf("\n");
458
459 for(j=0;j<nloaded_profiles;j++)
460 {
461 printf(" <profile name=\"%s\" transport=\"%s\">\n",loaded_profiles[j]->name,TransportName(loaded_profiles[j]->transport));
462
463 printf(" <speeds>\n");
464 for(i=1;i<Way_Count;i++)
465 printf(" <speed highway=\"%s\"%s kph=\"%d\" />\n",HighwayName(i),padding+3+strlen(HighwayName(i)),loaded_profiles[j]->speed[i]);
466 printf(" </speeds>\n");
467
468 printf(" <preferences>\n");
469 for(i=1;i<Way_Count;i++)
470 printf(" <preference highway=\"%s\"%s percent=\"%.0f\" />\n",HighwayName(i),padding+3+strlen(HighwayName(i)),loaded_profiles[j]->highway[i]);
471 printf(" </preferences>\n");
472
473 printf(" <properties>\n");
474 for(i=1;i<Property_Count;i++)
475 printf(" <property type=\"%s\"%s percent=\"%.0f\" />\n",PropertyName(i),padding+6+strlen(PropertyName(i)),loaded_profiles[j]->props_yes[i]);
476 printf(" </properties>\n");
477
478 printf(" <restrictions>\n");
479 printf(" <oneway obey=\"%d\" /> \n",loaded_profiles[j]->oneway);
480 printf(" <weight limit=\"%.1f\" />\n",weight_to_tonnes(loaded_profiles[j]->weight));
481 printf(" <height limit=\"%.1f\" />\n",height_to_metres(loaded_profiles[j]->height));
482 printf(" <width limit=\"%.1f\" />\n",width_to_metres(loaded_profiles[j]->width));
483 printf(" <length limit=\"%.1f\" />\n",length_to_metres(loaded_profiles[j]->length));
484 printf(" </restrictions>\n");
485
486 printf(" </profile>\n");
487 printf("\n");
488 }
489
490 printf("</routino-profiles>\n");
491 }
492
493
494 /*++++++++++++++++++++++++++++++++++++++
495 Print out the profiles as Javascript for use in a web form.
496 ++++++++++++++++++++++++++++++++++++++*/
497
498 void PrintProfilesJS(void)
499 {
500 unsigned int i,j;
501
502 printf("var routino={ // contains all default Routino options (generated using \"--help-profile-js\").\n");
503 printf("\n");
504
505 printf(" // Default transport type\n");
506 printf(" transport: 'motorcar',\n");
507 printf("\n");
508
509 printf(" // Transport types\n");
510 printf(" transports: {");
511 for(j=0;j<nloaded_profiles;j++)
512 printf("%s%s: %d",j==1?"":", ",TransportName(loaded_profiles[j]->transport),j);
513 printf("},\n");
514 printf("\n");
515
516 printf(" // Highway types\n");
517 printf(" highways: {");
518 for(i=1;i<Way_Count;i++)
519 printf("%s%s: %d",i==1?"":", ",HighwayName(i),i);
520 printf("},\n");
521 printf("\n");
522
523 printf(" // Property types\n");
524 printf(" properties: {");
525 for(i=1;i<Property_Count;i++)
526 printf("%s%s: %d",i==1?"":", ",PropertyName(i),i);
527 printf("},\n");
528 printf("\n");
529
530 printf(" // Restriction types\n");
531 printf(" restrictions: {oneway: 1, weight: 2, height: 3, width: 4, length: 5},\n");
532 printf("\n");
533
534 printf(" // Allowed highways\n");
535 printf(" profile_highway: {\n");
536 for(i=1;i<Way_Count;i++)
537 {
538 printf(" %12s: {",HighwayName(i));
539 for(j=0;j<nloaded_profiles;j++)
540 printf("%s%s: %3d",j==1?"":", ",TransportName(loaded_profiles[j]->transport),(int)loaded_profiles[j]->highway[i]);
541 printf("}%s\n",i==(Way_Count-1)?"":",");
542 }
543 printf(" },\n");
544 printf("\n");
545
546 printf(" // Speed limits\n");
547 printf(" profile_speed: {\n");
548 for(i=1;i<Way_Count;i++)
549 {
550 printf(" %12s: {",HighwayName(i));
551 for(j=0;j<nloaded_profiles;j++)
552 printf("%s%s: %3d",j==1?"":", ",TransportName(loaded_profiles[j]->transport),loaded_profiles[j]->speed[i]);
553 printf("}%s\n",i==(Way_Count-1)?"":",");
554 }
555 printf(" },\n");
556 printf("\n");
557
558 printf(" // Highway properties\n");
559 printf(" profile_property: {\n");
560 for(i=1;i<Property_Count;i++)
561 {
562 printf(" %12s: {",PropertyName(i));
563 for(j=0;j<nloaded_profiles;j++)
564 printf("%s%s: %3d",j==1?"":", ",TransportName(loaded_profiles[j]->transport),(int)loaded_profiles[j]->props_yes[i]);
565 printf("}%s\n",i==(Property_Count-1)?"":",");
566 }
567 printf(" },\n");
568 printf("\n");
569
570 printf(" // Restrictions\n");
571 printf(" profile_restrictions: {\n");
572 printf(" %12s: {","oneway");
573 for(j=0;j<nloaded_profiles;j++)
574 printf("%s%s: %4d",j==1?"":", ",TransportName(loaded_profiles[j]->transport),loaded_profiles[j]->oneway);
575 printf("},\n");
576 printf(" %12s: {","weight");
577 for(j=0;j<nloaded_profiles;j++)
578 printf("%s%s: %4.1f",j==1?"":", ",TransportName(loaded_profiles[j]->transport),weight_to_tonnes(loaded_profiles[j]->weight));
579 printf("},\n");
580 printf(" %12s: {","height");
581 for(j=0;j<nloaded_profiles;j++)
582 printf("%s%s: %4.1f",j==1?"":", ",TransportName(loaded_profiles[j]->transport),height_to_metres(loaded_profiles[j]->height));
583 printf("},\n");
584 printf(" %12s: {","width");
585 for(j=0;j<nloaded_profiles;j++)
586 printf("%s%s: %4.1f",j==1?"":", ",TransportName(loaded_profiles[j]->transport),width_to_metres(loaded_profiles[j]->width));
587 printf("},\n");
588 printf(" %12s: {","length");
589 for(j=0;j<nloaded_profiles;j++)
590 printf("%s%s: %4.1f",j==1?"":", ",TransportName(loaded_profiles[j]->transport),length_to_metres(loaded_profiles[j]->length));
591 printf("}\n");
592 printf(" }\n");
593 printf("\n");
594
595 printf("}; // end of routino variable\n");
596 }
597
598
599 /*++++++++++++++++++++++++++++++++++++++
600 Print out the profiles as Perl for use in a web CGI.
601 ++++++++++++++++++++++++++++++++++++++*/
602
603 void PrintProfilesPerl(void)
604 {
605 unsigned int i,j;
606
607 printf("$routino={ # contains all default Routino options (generated using \"--help-profile-pl\").\n");
608 printf("\n");
609
610 printf(" # Default transport type\n");
611 printf(" transport => 'motorcar',\n");
612 printf("\n");
613
614 printf(" # Transport types\n");
615 printf(" transports => {");
616 for(j=0;j<nloaded_profiles;j++)
617 printf("%s%s => %d",j==1?"":", ",TransportName(loaded_profiles[j]->transport),j);
618 printf("},\n");
619 printf("\n");
620
621 printf(" # Highway types\n");
622 printf(" highways => {");
623 for(i=1;i<Way_Count;i++)
624 printf("%s%s => %d",i==1?"":", ",HighwayName(i),i);
625 printf("},\n");
626 printf("\n");
627
628 printf(" # Property types\n");
629 printf(" properties => {");
630 for(i=1;i<Property_Count;i++)
631 printf("%s%s => %d",i==1?"":", ",PropertyName(i),i);
632 printf("},\n");
633 printf("\n");
634
635 printf(" # Restriction types\n");
636 printf(" restrictions => {oneway => 1, weight => 2, height => 3, width => 4, length => 5},\n");
637 printf("\n");
638
639 printf(" # Allowed highways\n");
640 printf(" profile_highway => {\n");
641 for(i=1;i<Way_Count;i++)
642 {
643 printf(" %12s => {",HighwayName(i));
644 for(j=0;j<nloaded_profiles;j++)
645 printf("%s %s => %3d",j==1?"":", ",TransportName(loaded_profiles[j]->transport),(int)loaded_profiles[j]->highway[i]);
646 printf("}%s\n",i==(Way_Count-1)?"":",");
647 }
648 printf(" },\n");
649 printf("\n");
650
651 printf(" # Speed limits\n");
652 printf(" profile_speed => {\n");
653 for(i=1;i<Way_Count;i++)
654 {
655 printf(" %12s => {",HighwayName(i));
656 for(j=0;j<nloaded_profiles;j++)
657 printf("%s %s => %3d",j==1?"":", ",TransportName(loaded_profiles[j]->transport),loaded_profiles[j]->speed[i]);
658 printf("}%s\n",i==(Way_Count-1)?"":",");
659 }
660 printf(" },\n");
661 printf("\n");
662
663 printf(" # Highway properties\n");
664 printf(" profile_property => {\n");
665 for(i=1;i<Property_Count;i++)
666 {
667 printf(" %12s => {",PropertyName(i));
668 for(j=0;j<nloaded_profiles;j++)
669 printf("%s %s => %3d",j==1?"":", ",TransportName(loaded_profiles[j]->transport),(int)loaded_profiles[j]->props_yes[i]);
670 printf("}%s\n",i==(Property_Count-1)?"":",");
671 }
672 printf(" },\n");
673 printf("\n");
674
675 printf(" # Restrictions\n");
676 printf(" profile_restrictions => {\n");
677 printf(" %12s => {","oneway");
678 for(j=0;j<nloaded_profiles;j++)
679 printf("%s %s => %4d",j==1?"":", ",TransportName(loaded_profiles[j]->transport),loaded_profiles[j]->oneway);
680 printf("},\n");
681 printf(" %12s => {","weight");
682 for(j=0;j<nloaded_profiles;j++)
683 printf("%s %s => %4.1f",j==1?"":", ",TransportName(loaded_profiles[j]->transport),weight_to_tonnes(loaded_profiles[j]->weight));
684 printf("},\n");
685 printf(" %12s => {","height");
686 for(j=0;j<nloaded_profiles;j++)
687 printf("%s %s => %4.1f",j==1?"":", ",TransportName(loaded_profiles[j]->transport),height_to_metres(loaded_profiles[j]->height));
688 printf("},\n");
689 printf(" %12s => {","width");
690 for(j=0;j<nloaded_profiles;j++)
691 printf("%s %s => %4.1f",j==1?"":", ",TransportName(loaded_profiles[j]->transport),width_to_metres(loaded_profiles[j]->width));
692 printf("},\n");
693 printf(" %12s => {","length");
694 for(j=0;j<nloaded_profiles;j++)
695 printf("%s %s => %4.1f",j==1?"":", ",TransportName(loaded_profiles[j]->transport),length_to_metres(loaded_profiles[j]->length));
696 printf("}\n");
697 printf(" },\n");
698 printf("\n");
699
700 printf("}; # end of routino variable\n");
701 }

Properties

Name Value
cvs:description Definition of built-in profiles and other functions.