Bigloo supports various SRFIs (Scheme Request For Implementation). Some of
them are integrated in the Bigloo core libraries. Some others are implemented
by the means of Bigloo libraries (see 
Bigloo Libraries). Only the
first ones are described in the manual. 
Check the Bigloo web page
(
http://www-sop.inria.fr/indes/fp/Bigloo).
The current Bigloo core library support the following SRFIs:
- srfi-0(Conditional execution).
- srfi-2(AND-LET*: an AND with local bindings, a guarded LET* special form).
- srfi-6(Basic String Ports).
- srfi-8(Binding to multiple values).
- srfi-9(Records specification).
- srfi-18(Multithreading support).
- srfi-22(Script interpreter invocation).
- srfi-28(Basic Format Strings).
- srfi-30(Multi-line comments).
- srfi-34(Exception Handling for Programs).
| 
The| cond-expand [clause] | bigloo syntax |  cond-expandform tests for the existence of features at
macro-expansion time. It either expands into the body of one of its
clauses or signals and error during syntactic
processing.cond-expandexpands into the body of the first clause
whose feature requirement is currently satisfied (theelseclause, if present, is selected if none of the previous clauses is
selected).
 A feature requirement has an obvious interpretation as a logical
formula, where the variables have meaning true is the feature
corresponding to the feature identifier, as specified in the SRFI
registry, is in effect at the location of the
 cond-expandform,
and false otherwise. A feature requirement is satisfied it its
formula is true under this interpretation. The formula may make use of
identifier,and,orandnotoperators.
 Since Bigloo version 3.1b,
 cond-expandformula may use the newlibraryoperator that checks if a library exists and is available.
Its syntax is:(library <libname>).
 Examples:
 
 
 
The second example assumes that| (write (cond-expand
          (srfi-0 (* 1 2))
          ((or (library fthread) (library pthread)) (- 4 1))
          (else (+ 3 4))))
   -| 2
 (cond-expand 
   (bigloo (define (command-line-arguments) (command-line)))
   (else (define (command-line-arguments) '())))
 |  bigloois an alias for the SRFI 
associated with the specification of Bigloo (i.e. the documentation for that
Scheme system).
 Since Bigloo 3.4b,
 cond-expandformula may use the newconfigoperator that checks the value of a configuration entry.
Its syntax is:(config endianeness little-endian). This
feature relies on thebigloo-configfunction. See
System Programming for additional details.
 When writing portable code, the case used for the feature identifier
should match the one in the SRFI registry. This is to ensure that the
feature identifier will be correctly recognized whether or not the
Scheme system is case-sensitive. To support case-insensitive Scheme
systems, the feature identifiers in the SRFI registry are guaranteed to
be unique even when ignoring the case.
 
 In order to distinguish Bigloo versions, the following symbols are
recognized in
 cond-expandforms.
 
 When finalizers have been configured, the two following symbols are
recognized bybigloobigloo<branch-release>bigloo<major-release>bigloo<major-release><minor-release>
 cond-expand:
 
 Bigloo implements differents SRFI for the compiler and the interpreter.
Thus, their are two Bigloo SRFI registers. One for the compiler and one
for the interpreter. Bigloo compiler SRFI register contains at least the 
following symbols:bigloo-finalizerbigloo-weakptr
 
 
 With respect to the currently used Bigloo back-end, one of these symbols
is registered:srfi-0srfi-1srfi-2srfi-6srfi-8srfi-9srfi-22srfi-28srfi-30
 
 Bigloo compiler implements the following SRFI:
 
 
 Then thebigloobigloo-compilebigloo<major-release>bigloo<major-release><minor-release>
 -gflag is used, the Bigloo compiler additionally implements
the SRFI:
 
 
 Bigloo interpreter implements the following SRFI:
 
 
 When a library is used, the name of the library is added to the compiler SRFI
register. That is:bigloobigloo-evalbigloo<major-release>bigloo<major-release><minor-release>
 
 
 
A property representing actual integers bit size is defined:| (module foo
   (library srfi1))
 (print (cond-expand (srfi1 'with-srfi1) (else 'nothing)))
   -| 'with-srfi1
(print (eval '(cond-expand (srfi1 'with-srfi1) (else 'nothing))))
   -| 'with-srfi1
 |  
 
 The frequently defined values are:bint<integers-bit-size>elong<exact-long-bit-size>
 
 
 Other values could be observed in the future. Note that the actual
values of a particular setting can be obtained with:bint30: 32 bits architectures (e.g., x86)elong32: 32 bits architectures (e.g., x86)bint32: JVMelong64: JVMbint61: 64 bits architectures (e.g., x86_64)elong64: 64 bits architectures (e.g., x86_64)
 
 
 
A configuration can be tested with:| (bigloo-config 'int-size)
(bigloo-config 'elong-size)
 |  
 For instance:
 
 
 
| (cond-expand
  ((and bigloo-c (config have-c99-stack-alloc #t)) ...)
  ...)
 |  | 
| 
| register-srfi! srfi-name | bigloo procedure |  
| unregister-srfi! srfi-name | bigloo procedure |  
| unregister-eval-srfi! srfi-name | bigloo procedure |  
| register-compile-srfi! srfi-name | bigloo procedure |  
This argument| unregister-compile-srfi! srfi-name | bigloo procedure |  srfi-nameis a symbol. It registerssrfi-namein the Bigloo interpreter SRFI register. This function must only be
used when implementing a library. The code of that library must contain
one unique call toregister-eval-srfi!. Let's suppose, for instance,
aformatlibrary. The implementation for that library must contain
an expression like:
 The functions
 unregister-XXX-srfi!unregisters a srfi.
 
 
Calling| (register-eval-srfi! 'format)
 |  (register-eval-srfi! name)makesnamesupported
by interpretedcond-expandforms.
 Note: There is no
 register-compiler-srfi!because the
compiler automatically registers SRFI when the-libraryflags are used. However, it exists several ways to tell the
compiler that it actually supports some srfis when compiling some modules.
 
 The first way is to insert calls to register-eval-srfi!in the.bigloorcfile (see Compiler Description).
 
The second, is to use option(see Module Declaration) module 
clause, such as:
 
 
| (module example
   ...
   (option (register-srfi! 'srfi-foobar)))
 ...
 | The last way is to use the command line option -srfi(see Compiler Description).
 | 
 
The SRFI 1 is implemented as a Bigloo library. Hence, in order to use
the functions it provides, a module must import it.
| (module ex
   (library srfi1))
 (print (find-tail even? '(3 1 37 -8 -5 0 0)))
 => '(-8 -5 0 0))
 | 
 
The SRFI 22 describes basic prerequisites for running Scheme programs as
Unix scripts in a uniform way. A file (henceforth a 
scipt) conforming
SRFI 22 has the following syntax:
| <script>         ==> <script prelude>? <program>
<script prelude> ==> #!<space> <all but linebreak>* <linebreak> | 
A Scheme script interpreter loads the 
<script>. It ignores the
script prelude and interprets the rest of the file according to the
language dialect specified by the name of the interpreter.
The Scheme script interpreter may also load a different file after
making a reasonable check that loading it is semantically equivalent to
loading 
<script>. For example, the script interpreter may assume
that a file with a related name (say, with an additional extension) is a
compiled version of 
<script>.
| 32.3.1 An example of SRFI-22 script
 | 
Let us consider the following Bigloo script located in a file
`foo.scm':
| #! /usr/bin/env ./execute
(module foo
   (main main))
 (define (main argv)
   (print "foo: " argv))
 | 
Let us consider the following `execute' shell script:
| $ cat > execute
#!/bin/sh
bigloo -i $*
 | 
Provided that `foo.scm' as the execute flag switched on, it is
possible to 
execute it:
| $ chmod u+x foo.scm
$ ./foo.scm
  -| foo: (./foo.scm)
 | 
The same Bigloo module can be compiled and executed such as:
| $ bigloo foo.scm
$ ./a.out
  -| foo: (a.out)
 | 
| 32.3.2 Lazy compilation with SRFI-22
 | 
SRFI-22 can be used to implement 
lazy compilation. For instance,
let us consider the following shell script:
| $ cat > bgl
#!/bin/sh
SOURCEFILE=$1
case $SOURCEFILE in
    *.scm)
        OUTFILE=${SOURCEFILE%.scm}
        if ( bigloo -s -o $OUTFILE $SOURCEFILE ); then
            /bin/rm $OUTFILE.o
            shift
            ./$OUTFILE $@
        fi
        ;;
    *)
        echo Error: need a \*.scm file!
        ;;
esac
 | 
And the following Bigloo script:
| #! /usr/bin/env ./bgl
(module foo
   (main main))
 (define (main argv)
   (print "foo: " argv))
 | 
When executed in the following way:
| $ chmod u+x foo.scm
$ ./foo.scm
  -| foo: (./foo.scm)
 | 
The Bigloo module 
foo.scm will first be compiled and then executed.
Of course, one may consider more complex compiler drivers where it is
first checked that the module is not already compiled.