SEARCH
0-9 A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
Prev | Current Page 500 | Next

Steven Kelly and Juha-Pekka Tolvanen

"Domain-Specific Modeling"

Any kind of
generator will cope well with these, and the template-based generators are at their
strongest here.
Models that generate con?¬?guration and settings ?¬?les tend to use a simple
mapping between the structures in the ?¬?le and those in the model. For instance,
sections in an ini ?¬?le may correspond to object types, with each setting and value
corresponding to a property slot in that object. The crawler-based approach in
Listing 11.3 would generate such a ?¬?le, treating empty properties as meaning they
should not be generated, and thus whatever reads the resulting ?¬?le will use a default
value for them.
Listing 11.3 Crawler-based generator for .ini ?¬?les.
foreach .() /* iterate over objects, expecting one instance
per type */
{
'[' type ']' newline
do :() /* iterate over all properties of the object */
{
if not id='' then
type '=' id newline
endif
}
newline
}
One thing that can be dif?¬?cult in con?¬?guration ?¬?les is that the output language, and
the program that processes it, tend to have little intelligence. As the values in the ?¬?le
tend to be expressed in a machine-friendly format, this can require some translation
from the human-friendly format used in the models. For instance, the models may
specify numbers in decimal notation, but the con?¬?guration ?¬?le may require them in
GENERATOR OUTPUT PATTERNS 277
hexadecimal.


Pages:
488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512
hotel jelenia góra Russian bride Free English grammar and study guid powiekszenia wielkoformatowe counter strike 1.6