|
string->obj string | bigloo procedure |
This function converts a string which has been produced by
obj->string into a Bigloo object.
|
obj->string object | bigloo procedure |
This function converts into a string any Bigloo object
which does not contain a procedure.
|
The implementation of the last two functions ensures that for every
Bigloo object obj (containing no procedure), the expression:
(equal? obj (string->obj (obj->string obj)))
=> #t
|
binary-port? obj | bigloo procedure |
open-output-binary-file file-name | bigloo procedure |
append-output-binary-file file-name | bigloo procedure |
open-input-binary-file file-name | bigloo procedure |
close-binary-port binary-port | bigloo procedure |
input-obj binary-port | bigloo procedure |
output-obj binary-port obj | bigloo procedure |
input-char binary-port | bigloo procedure |
output-char binary-port char | bigloo procedure |
Bigloo allows Scheme objects to be dumped into, and restored from, files.
These operations are performed by the previous functions. The dump and
the restore use the two functions obj->string and
string->obj .
It is also possible to use a binary file as a flat character file. This can
be done by the means of output-char and input-char functions.
|
register-procedure-serialization serializer unserializer | bigloo procedure |
There is no existing portable method to dump and restore a procedure. Thus,
if obj->string is passed a procedure, it will emit an error message.
Sometime, using strict restrictions, it may be convenient to use an
ad-hoc framework to serialize and unserialize procedures. User may
specify there own procedure serializer and unserializer. This is the
role of register-procedure-serialization . The argument
serializer is a procedure of one argument, converting a procedure
into a characters strings. The argument unserializer is a procedure
of one argument, converting a characters string into a procedure. It belongs
to the user to provide correct serializer and unserializer.
Here is an example of procedure serializer and unserializer that
may be correct under some Unix platform:
(module foo
(extern (macro %sprintf::int (::string ::string ::procedure) "sprintf")))
(define (string->procedure str)
(pragma "(obj_t)(strtoul(BSTRING_TO_STRING($1), 0, 16))" str))
(define (procedure->string proc)
(let ((item (make-string 10)))
(%sprintf item "#p%lx" proc)
item))
(register-procedure-serialization procedure->string string->procedure)
(let ((x 4))
(let ((obj (cons "toto" (lambda (y) (+ x y)))))
(let ((nobj (string->obj (obj->string obj))))
(print ((cdr nobj) 5)))))
|
|
get-procedure-serialization | bigloo procedure |
Returns the a pair whose car is the current procedure serializer
and the cdr is the current procedure unserializer.
|
register-process-serialization serializer unserializer | bigloo procedure |
Same as register-procedure-serialization for Bigloo processes.
|
get-process-serialization | bigloo procedure |
Same as get-procedure-serialization for Bigloo processes.
|
|