[ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
27.2 The very dangerous “pragma” Bigloo special forms
Bigloo has a special form which allows the inclusion of C text into the produced code. It is only applicable to the C back-end. In particular, the JVM back-end (see Chapter The Java interface) does not support it.
- bigloo syntax: pragma::ident string [args]
- bigloo syntax: free-pragma::ident string [args]
This force Bigloo to include string in the produced C code as a regular C fragment of code. This form must not be used without an in depth understanding of Bigloo C code production; with unskilled use, the produced C file may be unacceptable to the C compiler.
Values can be passed to a
pragma
form, being referenced in string by expressions of the form$number
. Such expression are replaced by the corresponding values, the number of referenced values in string being exactly the number of values provided. Here is an example ofpragma
usage:(define (fibo x::long) (pragma "printf( \"fib(%d):%d\\n\", $1, $2 );" x (fib x)))
Arguments provided to a pragma form are not converted during compilation. Hence, pragma arguments can be of any types, including, foreign types.
A pragma result type can be specified using the notation
pragma::name
where the default type isunspecified
. Then, for instance, the expression(pragma::bool "$1 == 0" x)
will be considered to be returning a object of typebool
(C boolean) while the expression(pragma "$1 == 0" x)
will be considered by Bigloo to be returning theunspecified
typed object.The compiler assumes that a
pragma
forms operates a side effects and that it writes into its parameters. This assumption no long holds withfree-pragma
. This is the only difference between the two forms.
[ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
This document was generated on March 31, 2014 using texi2html 5.0.