Next: libutils libraries global-env, Up: libutils libraries [Index]
<library>
object typeThe following bindings are exported by the library (vicare
libraries)
.
Record type representing Scheme libraries.
Return #t
if obj is an object of type <library>
;
otherwise return #f
.
<library>
: library-uid libReturn a gensym uniquely identifying this interned library; it also identifies the corresponding serialised library. This gensym is registered in:
<library>
object created by a vicare
process at
run–time.
Whenever a compiled library imports this one, the UID stored in the
binary file is compared to this field: if they are eq?
the
compiled versions are in sync, otherwise the importing library must be
recompiled.
<library>
: library-name libA library name as defined by R6RS; it is the symbolic expression:
(?identifier0 ?identifier ...) (?identifier0 ?identifier ... ?version)
where the ?identifier are symbols and ?version is a list of non–negative fixnums representing the version numbers. Library names can be manipulated with appropriate functions, Library name utilities.
<library>
: library-imp-lib* libThe list of <library>
objects selected by the import
clause in the source code of lib.
<library>
: library-vis-lib* libThe list of <library>
objects selecting libraries needed by the
visit code.
<library>
: library-inv-lib* libThe list of <library>
objects selecting libraries needed by the
invoke code.
<library>
: library-export-subst libReturn the export-subst
of lib: an alist representing the
global bindings exported by the library. The cars of the alist are
symbols representing the public names of the exported syntactic
bindings. The cdrs of the alist are the label gensyms of the exported
syntactic bindings.
The export-subst
includes both syntactic bindings defined by the
library itself and syntactic bindings imported and re–exported by the
library. For example:
(define ell (expand-library->sexp '(library (demo) (options typed-language) (export display <fixnum>) (import (vicare)) (define {x <fixnum>} 123)))) (cdr (assq 'export-subst ell)) ⇒ ((<fixnum> . prim-label.<fixnum>) (display . g14256)) (cdr (assq 'global-env ell)) ⇒ ((g9 . (global-typed . g8)))
notice that the re–exported bindings do not appear in the
global-env
.
<library>
: library-typed-locs libReturn an alist having labels as keys and loc gensyms as values. The
labels are the ones of the global-env
whose descriptor has type
global-typed
or global-typed-mutable
. The loc gensyms are
the ones of the variables actually holding the typed values. This alist
allows to map the public name of global typed variables to the loc
gensyms holding the values.
<library>
: library-visit-state libWhen set to a procedure: it is the thunk to call to compile and evaluate the visit code. When set to something else: this library has been already visited.
<library>
: library-invoke-state libWhen set to a procedure: it is the thunk to call to compile and evaluate the invoke code. When set to something else: this library has been already invoked.
<library>
: library-visit-code libWhen lib is created from source code: this field is a core language symbolic expression representing the visit code. When lib is created from a binary file: this field is a thunk to evaluate to visit the library.
<library>
: library-invoke-code libWhen lib is created from source code: this field is a core language symbolic expression representing the invoke code. When lib is created from a binary file: this field is a thunk to evaluate to invoke the library.
<library>
: library-guard-code libWhen lib is created from source code: this field is a core
language symbolic expression representing the guard code. When
lib is created from a binary file: this field is a thunk to
evaluate to run the stale-when
composite test expression.
<library>
: library-guard-lib* libThe list of <library>
objects selecting libraries needed by the
stale-when
composite test expression.
NOTE These are the libraries accumulated by the
inv-collector
while expanding thestale-when
test expressions.
<library>
: library-visible? libA boolean determining if the library is visible. This attribute is used
by interned-libraries
to select libraries to report as interned.
A library should be marked as visible if it is meant to be imported by
client code in “normal” use; unsafe libraries in the hierarchy
(vicare system ---))
should not be visible.
<library>
: library-source-file-name libThe boolean #f
or a string representing the pathname of the file
from which the source code of the library was read.
<library>
: library-option* libA list of symbolic expressions holding library options.
<library>
: library-foreign-library* libA list of strings each representing the identifier of a foreign library that must be dynamically loaded for this lib object. These libraries are the ones especially written to interface Vicare with platform–specific services.
The argument lib must be a <library>
object. Return
#t
if lib was loaded from a source file; otherwise return
#f
.
The argument lib must be a <library>
object. Return
#t
if lib was loaded from a binary file; otherwise return
#f
.
Given a <library>
object return an object representing the
library descriptor. Library descriptors are uniquely associated to a
compiled library.
Return #t
if obj is a library descriptor object; otherwise
return #f
.
Given a library descriptor object return the UID.
Given a library descriptor object return the R6RS library name.
As example of <library>
fields, expanding the library:
(library (ciao) (export var fun mac etv) (import (vicare)) (define var 1) (define (fun) 2) (define-syntax (mac stx) 3) (define-syntax etv (make-expand-time-value (+ 4 5))))
yields the invoke-code
:
(library-letrec* ((lex.var loc.var '1) (lex.fun loc.fun (annotated-case-lambda fun (() '2)))) ((primitive void)))
the visit-code
:
(begin (set! loc.mac (annotated-case-lambda (#'lambda (#'stx) #'3) ((lex.stx) '3))) (set! loc.etv (annotated-call (make-expand-time-value (+ 4 5)) (primitive make-expand-time-value) (annotated-call (+ 4 5) (primitive +) '4 '5))))
the export-subst
:
((etv . lab.etv) (mac . lab.mac) (fun . lab.fun) (var . lab.var))
the global-env
:
((lab.var global . loc.var) (lab.fun global . loc.fun) (lab.mac global-macro . loc.mac) (lab.etv global-etv . loc.etv))
Another example, for the library:
(library (ciao (1 2)) (export doit) (import (vicare)) (stale-when (< 1 2) (define a 123)) (stale-when (< 2 3) (define b 123)) (define (doit) 123))
the guard-code
is:
(if (if '#f '#t (annotated-call (< 1 2) (primitive <) '1 '2)) '#t (annotated-call (< 2 3) (primitive <) '2 '3))
Next: libutils libraries global-env, Up: libutils libraries [Index]