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 173 - (show annotations) (download) (as text)
Wed May 13 18:06:53 2009 UTC (15 years, 10 months ago) by amb
File MIME type: text/x-csrc
File size: 26874 byte(s)
Move some common code into the profile.

1 /***************************************
2 $Header: /home/amb/CVS/routino/src/profiles.c,v 1.15 2009-05-13 18:06:53 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,2009 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
27 #include "profiles.h"
28 #include "types.h"
29 #include "ways.h"
30
31
32 static Profile builtin_profiles[]=
33 {
34 /* The profile for travel by Foot */
35
36 [Transport_Foot] = {
37 .transport=Transport_Foot,
38 .allow =Allow_Foot,
39 .highway = {
40 [Way_Motorway ] = 0,
41 [Way_Trunk ] = 40,
42 [Way_Primary ] = 50,
43 [Way_Secondary ] = 60,
44 [Way_Tertiary ] = 70,
45 [Way_Unclassified] = 80,
46 [Way_Residential ] = 90,
47 [Way_Service ] = 90,
48 [Way_Track ] = 95,
49 [Way_Path ] = 100,
50 [Way_Bridleway ] = 100,
51 [Way_Cycleway ] = 95,
52 [Way_Footway ] = 100,
53 },
54 .speed = {
55 [Way_Motorway ] = 0,
56 [Way_Trunk ] = kph_to_speed(4),
57 [Way_Primary ] = kph_to_speed(4),
58 [Way_Secondary ] = kph_to_speed(4),
59 [Way_Tertiary ] = kph_to_speed(4),
60 [Way_Unclassified] = kph_to_speed(4),
61 [Way_Residential ] = kph_to_speed(4),
62 [Way_Service ] = kph_to_speed(4),
63 [Way_Track ] = kph_to_speed(4),
64 [Way_Path ] = kph_to_speed(4),
65 [Way_Bridleway ] = kph_to_speed(4),
66 [Way_Cycleway ] = kph_to_speed(4),
67 [Way_Footway ] = kph_to_speed(4),
68 },
69 .oneway = 0,
70 .weight = 0,
71 .height = 0,
72 .width = 0,
73 .length = 0,
74 },
75
76 /* The profile for travel by Bicycle */
77
78 [Transport_Bicycle] = {
79 .transport=Transport_Bicycle,
80 .allow =Allow_Bicycle,
81 .highway = {
82 [Way_Motorway ] = 0,
83 [Way_Trunk ] = 30,
84 [Way_Primary ] = 70,
85 [Way_Secondary ] = 80,
86 [Way_Tertiary ] = 90,
87 [Way_Unclassified] = 90,
88 [Way_Residential ] = 90,
89 [Way_Service ] = 90,
90 [Way_Track ] = 90,
91 [Way_Path ] = 90,
92 [Way_Bridleway ] = 90,
93 [Way_Cycleway ] = 100,
94 [Way_Footway ] = 0,
95 },
96 .speed = {
97 [Way_Motorway ] = 0,
98 [Way_Trunk ] = 0,
99 [Way_Primary ] = kph_to_speed(20),
100 [Way_Secondary ] = kph_to_speed(20),
101 [Way_Tertiary ] = kph_to_speed(20),
102 [Way_Unclassified] = kph_to_speed(20),
103 [Way_Residential ] = kph_to_speed(20),
104 [Way_Service ] = kph_to_speed(20),
105 [Way_Track ] = kph_to_speed(20),
106 [Way_Path ] = kph_to_speed(20),
107 [Way_Bridleway ] = kph_to_speed(20),
108 [Way_Cycleway ] = kph_to_speed(20),
109 [Way_Footway ] = 0,
110 },
111 .oneway = 1,
112 .weight = 0,
113 .height = 0,
114 .width = 0,
115 .length = 0,
116 },
117
118 /* The profile for travel by Horse */
119
120 [Transport_Horse] = {
121 .transport=Transport_Horse,
122 .allow =Allow_Horse,
123 .highway = {
124 [Way_Motorway ] = 0,
125 [Way_Trunk ] = 25,
126 [Way_Primary ] = 50,
127 [Way_Secondary ] = 50,
128 [Way_Tertiary ] = 75,
129 [Way_Unclassified] = 75,
130 [Way_Residential ] = 75,
131 [Way_Service ] = 75,
132 [Way_Track ] = 100,
133 [Way_Path ] = 100,
134 [Way_Bridleway ] = 100,
135 [Way_Cycleway ] = 0,
136 [Way_Footway ] = 0,
137 },
138 .speed = {
139 [Way_Motorway ] = 0,
140 [Way_Trunk ] = 0,
141 [Way_Primary ] = kph_to_speed(10),
142 [Way_Secondary ] = kph_to_speed(10),
143 [Way_Tertiary ] = kph_to_speed(10),
144 [Way_Unclassified] = kph_to_speed(10),
145 [Way_Residential ] = kph_to_speed(10),
146 [Way_Service ] = kph_to_speed(10),
147 [Way_Track ] = kph_to_speed(10),
148 [Way_Path ] = kph_to_speed(10),
149 [Way_Bridleway ] = kph_to_speed(10),
150 [Way_Cycleway ] = 0,
151 [Way_Footway ] = 0,
152 },
153 .oneway = 1,
154 .weight = 0,
155 .height = 0,
156 .width = 0,
157 .length = 0,
158 },
159
160 /* The profile for travel by Motorbike */
161
162 [Transport_Motorbike] = {
163 .transport=Transport_Motorbike,
164 .allow =Allow_Motorbike,
165 .highway = {
166 [Way_Motorway ] = 100,
167 [Way_Trunk ] = 100,
168 [Way_Primary ] = 90,
169 [Way_Secondary ] = 80,
170 [Way_Tertiary ] = 70,
171 [Way_Unclassified] = 60,
172 [Way_Residential ] = 50,
173 [Way_Service ] = 80,
174 [Way_Track ] = 0,
175 [Way_Path ] = 0,
176 [Way_Bridleway ] = 0,
177 [Way_Cycleway ] = 0,
178 [Way_Footway ] = 0,
179 },
180 .speed = {
181 [Way_Motorway ] = kph_to_speed(70*1.6),
182 [Way_Trunk ] = kph_to_speed(60*1.6),
183 [Way_Primary ] = kph_to_speed(60*1.6),
184 [Way_Secondary ] = kph_to_speed(55*1.6),
185 [Way_Tertiary ] = kph_to_speed(50*1.6),
186 [Way_Unclassified] = kph_to_speed(40*1.6),
187 [Way_Residential ] = kph_to_speed(30*1.6),
188 [Way_Service ] = kph_to_speed(20*1.6),
189 [Way_Track ] = 0,
190 [Way_Path ] = 0,
191 [Way_Bridleway ] = 0,
192 [Way_Cycleway ] = 0,
193 [Way_Footway ] = 0,
194 },
195 .oneway = 1,
196 .weight = 0,
197 .height = 0,
198 .width = 0,
199 .length = 0,
200 },
201
202 /* The profile for travel by Motorcar */
203
204 [Transport_Motorcar] = {
205 .transport=Transport_Motorcar,
206 .allow =Allow_Motorcar,
207 .highway = {
208 [Way_Motorway ] = 100,
209 [Way_Trunk ] = 100,
210 [Way_Primary ] = 90,
211 [Way_Secondary ] = 80,
212 [Way_Tertiary ] = 70,
213 [Way_Unclassified] = 60,
214 [Way_Residential ] = 50,
215 [Way_Service ] = 80,
216 [Way_Track ] = 0,
217 [Way_Path ] = 0,
218 [Way_Bridleway ] = 0,
219 [Way_Cycleway ] = 0,
220 [Way_Footway ] = 0,
221 },
222 .speed = {
223 [Way_Motorway ] = kph_to_speed(70*1.6),
224 [Way_Trunk ] = kph_to_speed(60*1.6),
225 [Way_Primary ] = kph_to_speed(60*1.6),
226 [Way_Secondary ] = kph_to_speed(55*1.6),
227 [Way_Tertiary ] = kph_to_speed(50*1.6),
228 [Way_Unclassified] = kph_to_speed(40*1.6),
229 [Way_Residential ] = kph_to_speed(30*1.6),
230 [Way_Service ] = kph_to_speed(20*1.6),
231 [Way_Track ] = 0,
232 [Way_Path ] = 0,
233 [Way_Bridleway ] = 0,
234 [Way_Cycleway ] = 0,
235 [Way_Footway ] = 0,
236 },
237 .oneway = 1,
238 .weight = 0,
239 .height = 0,
240 .width = 0,
241 .length = 0,
242 },
243
244 /* The profile for travel by Goods */
245
246 [Transport_Goods] = {
247 .transport=Transport_Goods,
248 .allow =Allow_Goods,
249 .highway = {
250 [Way_Motorway ] = 100,
251 [Way_Trunk ] = 100,
252 [Way_Primary ] = 90,
253 [Way_Secondary ] = 80,
254 [Way_Tertiary ] = 70,
255 [Way_Unclassified] = 60,
256 [Way_Residential ] = 50,
257 [Way_Service ] = 80,
258 [Way_Track ] = 0,
259 [Way_Path ] = 0,
260 [Way_Bridleway ] = 0,
261 [Way_Cycleway ] = 0,
262 [Way_Footway ] = 0,
263 },
264 .speed = {
265 [Way_Motorway ] = kph_to_speed(60*1.6),
266 [Way_Trunk ] = kph_to_speed(60*1.6),
267 [Way_Primary ] = kph_to_speed(60*1.6),
268 [Way_Secondary ] = kph_to_speed(55*1.6),
269 [Way_Tertiary ] = kph_to_speed(50*1.6),
270 [Way_Unclassified] = kph_to_speed(40*1.6),
271 [Way_Residential ] = kph_to_speed(30*1.6),
272 [Way_Service ] = kph_to_speed(20*1.6),
273 [Way_Track ] = 0,
274 [Way_Path ] = 0,
275 [Way_Bridleway ] = 0,
276 [Way_Cycleway ] = 0,
277 [Way_Footway ] = 0,
278 },
279 .oneway = 1,
280 .weight = tonnes_to_weight(5),
281 .height = metres_to_height(2.5),
282 .width = metres_to_width (2),
283 .length = metres_to_length(5),
284 },
285
286 /* The profile for travel by HGV */
287
288 [Transport_HGV] = {
289 .transport=Transport_HGV,
290 .allow =Allow_HGV,
291 .highway = {
292 [Way_Motorway ] = 100,
293 [Way_Trunk ] = 100,
294 [Way_Primary ] = 90,
295 [Way_Secondary ] = 80,
296 [Way_Tertiary ] = 70,
297 [Way_Unclassified] = 60,
298 [Way_Residential ] = 50,
299 [Way_Service ] = 80,
300 [Way_Track ] = 0,
301 [Way_Path ] = 0,
302 [Way_Bridleway ] = 0,
303 [Way_Cycleway ] = 0,
304 [Way_Footway ] = 0,
305 },
306 .speed = {
307 [Way_Motorway ] = kph_to_speed(56*1.6),
308 [Way_Trunk ] = kph_to_speed(50*1.6),
309 [Way_Primary ] = kph_to_speed(50*1.6),
310 [Way_Secondary ] = kph_to_speed(50*1.6),
311 [Way_Tertiary ] = kph_to_speed(50*1.6),
312 [Way_Unclassified] = kph_to_speed(40*1.6),
313 [Way_Residential ] = kph_to_speed(30*1.6),
314 [Way_Service ] = kph_to_speed(20*1.6),
315 [Way_Track ] = 0,
316 [Way_Path ] = 0,
317 [Way_Bridleway ] = 0,
318 [Way_Cycleway ] = 0,
319 [Way_Footway ] = 0,
320 },
321 .oneway = 1,
322 .weight = tonnes_to_weight(10),
323 .height = metres_to_height(3),
324 .width = metres_to_width (2.5),
325 .length = metres_to_length(6),
326 },
327
328 /* The profile for travel by PSV */
329
330 [Transport_PSV] = {
331 .transport=Transport_PSV,
332 .allow =Allow_PSV,
333 .highway = {
334 [Way_Motorway ] = 100,
335 [Way_Trunk ] = 100,
336 [Way_Primary ] = 90,
337 [Way_Secondary ] = 80,
338 [Way_Tertiary ] = 70,
339 [Way_Unclassified] = 60,
340 [Way_Residential ] = 50,
341 [Way_Service ] = 80,
342 [Way_Track ] = 0,
343 [Way_Path ] = 0,
344 [Way_Bridleway ] = 0,
345 [Way_Cycleway ] = 0,
346 [Way_Footway ] = 0,
347 },
348 .speed = {
349 [Way_Motorway ] = kph_to_speed(56*1.6),
350 [Way_Trunk ] = kph_to_speed(50*1.6),
351 [Way_Primary ] = kph_to_speed(50*1.6),
352 [Way_Secondary ] = kph_to_speed(50*1.6),
353 [Way_Tertiary ] = kph_to_speed(50*1.6),
354 [Way_Unclassified] = kph_to_speed(40*1.6),
355 [Way_Residential ] = kph_to_speed(30*1.6),
356 [Way_Service ] = kph_to_speed(20*1.6),
357 [Way_Track ] = 0,
358 [Way_Path ] = 0,
359 [Way_Bridleway ] = 0,
360 [Way_Cycleway ] = 0,
361 [Way_Footway ] = 0,
362 },
363 .oneway = 1,
364 .weight = tonnes_to_weight(15),
365 .height = metres_to_height(3),
366 .width = metres_to_width (2.5),
367 .length = metres_to_length(6),
368 },
369 };
370
371
372 /*++++++++++++++++++++++++++++++++++++++
373 Get the profile for a type of transport.
374
375 Profile *GetProfile Returns a pointer to the profile.
376
377 Transport transport The type of transport.
378 ++++++++++++++++++++++++++++++++++++++*/
379
380 Profile *GetProfile(Transport transport)
381 {
382 return(&builtin_profiles[transport]);
383 }
384
385
386 /*++++++++++++++++++++++++++++++++++++++
387 Update a profile with highway preference scaling factor.
388
389 Profile *profile The profile to be updated.
390 ++++++++++++++++++++++++++++++++++++++*/
391
392 void UpdateProfile(Profile *profile)
393 {
394 score_t hmax=0;
395 int i;
396
397 /* Normalise the highway preferences into the range 0 -> 1 */
398
399 for(i=1;i<Way_Unknown;i++)
400 if(profile->highway[i]>hmax)
401 hmax=profile->highway[i];
402
403 for(i=1;i<Way_Unknown;i++)
404 if(profile->highway[i]>0)
405 profile->highway[i]/=hmax;
406 else
407 profile->highway[i]=0;
408
409 /* Find the fastest and most preferred highway type */
410
411 profile->max_speed=0;
412
413 for(i=0;i<Way_Unknown;i++)
414 if(profile->speed[i]>profile->max_speed)
415 profile->max_speed=profile->speed[i];
416
417 profile->max_pref=0;
418
419 for(i=0;i<Way_Unknown;i++)
420 if(profile->highway[i]>profile->max_pref)
421 profile->max_pref=profile->highway[i];
422 }
423
424
425 /*++++++++++++++++++++++++++++++++++++++
426 Print out a profile.
427
428 const Profile *profile The profile to print.
429 ++++++++++++++++++++++++++++++++++++++*/
430
431 void PrintProfile(const Profile *profile)
432 {
433 int i;
434
435 printf("Profile\n=======\n");
436
437 printf("\n");
438
439 printf("Transport: %s\n",TransportName(profile->transport));
440
441 printf("\n");
442
443 for(i=1;i<Way_Unknown;i++)
444 printf("Highway %-12s: %3d%%\n",HighwayName(i),(int)profile->highway[i]);
445
446 printf("\n");
447
448 for(i=1;i<Way_Unknown;i++)
449 if(profile->highway[i])
450 printf("Speed on %-12s: %3d km/h / %2.0f mph\n",HighwayName(i),profile->speed[i],(double)profile->speed[i]/1.6);
451
452 printf("\n");
453
454 printf("Obey one-way : %s\n",profile->oneway?"yes":"no");
455 printf("Minimum weight: %.1f tonnes\n",weight_to_tonnes(profile->weight));
456 printf("Minimum height: %.1f metres\n",height_to_metres(profile->height));
457 printf("Minimum width : %.1f metres\n",width_to_metres(profile->width));
458 printf("Minimum length: %.1f metres\n",length_to_metres(profile->length));
459 }
460
461
462 /*++++++++++++++++++++++++++++++++++++++
463 Print out the profiles as Javascript for use in a web form.
464 ++++++++++++++++++++++++++++++++++++++*/
465
466 void PrintProfilesJS(void)
467 {
468 int i,j;
469
470 printf("// Transport types\n");
471 printf("var router_transports={");
472 for(j=1;j<sizeof(builtin_profiles)/sizeof(builtin_profiles[0]);j++)
473 printf("%s%s: %d",j==1?"":", ",TransportName(j),j-1);
474 printf("};\n");
475 printf("\n");
476
477 printf("// Highway types\n");
478 printf("var router_highways={");
479 for(i=1;i<Way_Unknown;i++)
480 printf("%s%s: %d",i==1?"":", ",HighwayName(i),i-1);
481 printf("};\n");
482 printf("\n");
483
484 printf("// Restriction types\n");
485 printf("var router_restrictions={oneway: 1, weight: 2, height: 3, width: 4, length: 5};\n");
486 printf("\n");
487
488 printf("// Allowed highways\n");
489 printf("var router_profile_highway={\n");
490 for(i=1;i<Way_Unknown;i++)
491 {
492 printf(" %12s: {",HighwayName(i));
493 for(j=1;j<sizeof(builtin_profiles)/sizeof(builtin_profiles[0]);j++)
494 printf("%s%s: %3d",j==1?"":", ",TransportName(j),(int)builtin_profiles[j].highway[i]);
495 printf("}%s\n",i==(Way_Unknown-1)?"":", ");
496 }
497 printf(" };\n");
498 printf("\n");
499
500 printf("// Speed limits\n");
501 printf("var router_profile_speed={\n");
502 for(i=1;i<Way_Unknown;i++)
503 {
504 printf(" %12s: {",HighwayName(i));
505 for(j=1;j<sizeof(builtin_profiles)/sizeof(builtin_profiles[0]);j++)
506 printf("%s%s: %3d",j==1?"":", ",TransportName(j),builtin_profiles[j].speed[i]);
507 printf("}%s\n",i==(Way_Unknown-1)?"":", ");
508 }
509 printf(" };\n");
510 printf("\n");
511
512 printf("// Restrictions\n");
513 printf("var router_profile_restrictions={\n");
514 printf(" %12s: {","oneway");
515 for(j=1;j<sizeof(builtin_profiles)/sizeof(builtin_profiles[0]);j++)
516 printf("%s%s: %4d",j==1?"":", ",TransportName(j),builtin_profiles[j].oneway);
517 printf("},\n");
518 printf(" %12s: {","weight");
519 for(j=1;j<sizeof(builtin_profiles)/sizeof(builtin_profiles[0]);j++)
520 printf("%s%s: %4.1f",j==1?"":", ",TransportName(j),weight_to_tonnes(builtin_profiles[j].weight));
521 printf("},\n");
522 printf(" %12s: {","height");
523 for(j=1;j<sizeof(builtin_profiles)/sizeof(builtin_profiles[0]);j++)
524 printf("%s%s: %4.1f",j==1?"":", ",TransportName(j),height_to_metres(builtin_profiles[j].height));
525 printf("},\n");
526 printf(" %12s: {","width");
527 for(j=1;j<sizeof(builtin_profiles)/sizeof(builtin_profiles[0]);j++)
528 printf("%s%s: %4.1f",j==1?"":", ",TransportName(j),width_to_metres(builtin_profiles[j].width));
529 printf("},\n");
530 printf(" %12s: {","length");
531 for(j=1;j<sizeof(builtin_profiles)/sizeof(builtin_profiles[0]);j++)
532 printf("%s%s: %4.1f",j==1?"":", ",TransportName(j),length_to_metres(builtin_profiles[j].length));
533 printf("}\n");
534 printf(" };\n");
535 printf("\n");
536 }
537
538
539 /*++++++++++++++++++++++++++++++++++++++
540 Print out the profiles as Perl for use in a web CGI.
541 ++++++++++++++++++++++++++++++++++++++*/
542
543 void PrintProfilesPerl(void)
544 {
545 int i,j;
546
547 printf("# Transport types\n");
548 printf("@router_transports=(");
549 for(j=1;j<sizeof(builtin_profiles)/sizeof(builtin_profiles[0]);j++)
550 printf("%s'%s'",j==1?"":", ",TransportName(j));
551 printf(");\n");
552 printf("\n");
553
554 printf("# Highway types\n");
555 printf("@router_highways=(");
556 for(i=1;i<Way_Unknown;i++)
557 printf("%s'%s'",i==1?"":", ",HighwayName(i));
558 printf(");\n");
559 printf("\n");
560
561 printf("# Restriction types\n");
562 printf("@router_restrictions=('oneway', 'weight', 'height', 'width', 'length');\n");
563 printf("\n");
564
565 printf("# Allowed highways\n");
566 printf("%%router_profile_highway=(\n");
567 for(i=1;i<Way_Unknown;i++)
568 {
569 printf(" %12s => {",HighwayName(i));
570 for(j=1;j<sizeof(builtin_profiles)/sizeof(builtin_profiles[0]);j++)
571 printf("%s %s => %3d",j==1?"":", ",TransportName(j),(int)builtin_profiles[j].highway[i]);
572 printf("}%s\n",i==(Way_Unknown-1)?"":", ");
573 }
574 printf(" );\n");
575 printf("\n");
576
577 printf("# Speed limits\n");
578 printf("%%router_profile_speed=(\n");
579 for(i=1;i<Way_Unknown;i++)
580 {
581 printf(" %12s => {",HighwayName(i));
582 for(j=1;j<sizeof(builtin_profiles)/sizeof(builtin_profiles[0]);j++)
583 printf("%s %s => %3d",j==1?"":", ",TransportName(j),builtin_profiles[j].speed[i]);
584 printf("}%s\n",i==(Way_Unknown-1)?"":", ");
585 }
586 printf(" );\n");
587 printf("\n");
588
589 printf("# Restrictions\n");
590 printf("%%router_profile_restrictions=(\n");
591 printf(" %12s => {","oneway");
592 for(j=1;j<sizeof(builtin_profiles)/sizeof(builtin_profiles[0]);j++)
593 printf("%s %s => %4d",j==1?"":", ",TransportName(j),builtin_profiles[j].oneway);
594 printf("},\n");
595 printf(" %12s => {","weight");
596 for(j=1;j<sizeof(builtin_profiles)/sizeof(builtin_profiles[0]);j++)
597 printf("%s %s => %4.1f",j==1?"":", ",TransportName(j),weight_to_tonnes(builtin_profiles[j].weight));
598 printf("},\n");
599 printf(" %12s => {","height");
600 for(j=1;j<sizeof(builtin_profiles)/sizeof(builtin_profiles[0]);j++)
601 printf("%s %s => %4.1f",j==1?"":", ",TransportName(j),height_to_metres(builtin_profiles[j].height));
602 printf("},\n");
603 printf(" %12s => {","width");
604 for(j=1;j<sizeof(builtin_profiles)/sizeof(builtin_profiles[0]);j++)
605 printf("%s %s => %4.1f",j==1?"":", ",TransportName(j),width_to_metres(builtin_profiles[j].width));
606 printf("},\n");
607 printf(" %12s => {","length");
608 for(j=1;j<sizeof(builtin_profiles)/sizeof(builtin_profiles[0]);j++)
609 printf("%s %s => %4.1f",j==1?"":", ",TransportName(j),length_to_metres(builtin_profiles[j].length));
610 printf("}\n");
611 printf(" );\n");
612 printf("\n");
613 }

Properties

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