For Development HEAD DRAFTSearch (procedure/syntax/module):

Next: , Previous: , Up: Library modules - SRFIs   [Contents][Index]

11.5 srfi.7 - Feature-based program configuration language

Module: srfi.7

This module provides a program configuration metalanguage (program form) defined in srfi-7. Gauche autoloads srfi.7 module, so you don’t need to say (use srfi.7) explicitly. Note that the program form isn’t necessary to be a Scheme expression. SRFI-7 allows an implementation to preprocess the program form to produce a Scheme program, then executes it with different means. Gauche implements program form as a macro, so it can evaluates the form directly. Nonetheless, it doesn’t make sense to mix program form and other forms in one file, or expecting a return value of program form. A typical usage of program form is to prepare a single file which just contains program form. (It can load other files using files clause (see below) within the program form.) To execute such a program file in Gauche, you can just load it.

Configuration Language: program program-clause program-clause2 …

[SRFI-7]{srfi.7} This is a configuration language to structure a Scheme program, based on availability of the features.

A Scheme program is constructed from the program form. Gauche evaluates the constructed Scheme program on-the-fly.

Each program-clause needs to be one of the "Program Clauses" below.

Program Clause: requires feature-id feature-id2 …

[SRFI-7] The feature-id’s are the same as SRFI-0’s (see Feature conditional). It tells that the following code requires these feature-id’s.

If a feature-id which is not supported in Gauche is given, an error is signaled.

Program Clause: files filename …

[SRFI-7] Inserts the content of the filenames into a program. In Gauche, this clause just causes filenames to be loaded into the current module.

Program Clause: code scheme-expression …

[SRFI-7] The scheme-expressions are inserted into a program.

Program Clause: feature-cond clause clause2 …

[SRFI-7] Clause is a following form:

(requirement program-clause program-clause2 …)

Where requirement should be one of the following:

  • feature-id
  • (and requirement …)
  • (or requirement …)
  • (not requirement)

The requirement of the last clause may be else.

Gauche checks each requirement one by one, and if it finds a fulfilled requirement, inserts the program-clauses in that clause into the program.

Next: , Previous: , Up: Library modules - SRFIs   [Contents][Index]

For Development HEAD DRAFTSearch (procedure/syntax/module):