| iMatix home page | Libero home page | Libero documentation | << | < | > | >> |
Libero Version 2.32 |
This is the basic logic of Libero's code generator:
This is a 'hello world' schema:
:echo "Hello, World."
This is more realistic schema fragment:
! Example Libero of schema ! :if not exist $source.c :echo "lr I: creating skeleton program $source.c..." :output $source.c /*=============================================================== * $source.c description... * Written: $date $author * Revised: $date * Skeleton generated by LIBERO $version on $fulldate, $time. *===============================================================*/ #include "$dialog.d" /* Include dialog data */ /******************** INITIALISE THE PROGRAM ******************/ MODULE $"initialise_the_program" (void) { $"the_next_event" = $"ok_event"; } :close :endif
How does this schema work?
When Libero replaces variables, it keeps the text as aligned as possible by treating white-space (blanks or tabs) as elastic. For instance, here is some 'C' code before and after replacement. Notice how the right-hand margin does not move:
/* Source generated on $date - Libero $version */ /* Source generated on 93/07/12 - Libero 2.10 */
A variable name ends with the first non-name character (A-Z, a-z, 0-9, _). To mark the end of a variable name that is 'pasted' to some text, use a '\'. For instance, this is a line before and after inserting the $source variable:
:output $source\d.d ==> :output myprogd.d
If you capitalise (at least) the first letter of a variable name, Libero inserts the whole value in uppercase. For example:
:output $Source\d.d ==> :output MYPROGd.d
To output a name that matches the current -style setting, do this (e.g. -style=caps):
$"the_next_event" = $"ok_event"; ==> TheNextEvent = OkEvent;
To output a '$', use two '$'s together:
$"the_next_event" = $$$"ok_event"; ==> TheNextEvent = $OkEvent;
| << | <
| > | >>
| Libero Technical Reference | Read-Only Variables | Schema Commands | Syntax Of Expressions | Syntax Of Logical Conditions | Control Variables | Standard :do Conditions | Extra Variables In A :do Loop | General Rules for Code Generation | Generating Module Stubs | Generating COBOL Code | The State Machine Algorithm | Compiled-In Limitations | Quick Reference - Libero Schema Language |
Copyright © 1996-97 iMatix |