guile-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: JACAL, scm


From: Mikael Djurfeldt
Subject: Re: JACAL, scm
Date: 09 Oct 2001 13:22:46 +0200
User-agent: Gnus/5.0808 (Gnus v5.8.8) Emacs/20.7

Aubrey Jaffer <address@hidden> writes:

> I wrote a new SLIB/guile.init (replacing ice-9/slib.scm) which works
> with both Guile-1.3.4 and Guile-1.4.

Thank you.  (And sorry for not responding earlier---hope to be able to
respond further to your messages within a few days.)

> I made SLIB:LOAD and READ case-insensitive by essentially fluid binding
> the global read property.  It is cumbersome with READ-OPTIONS-INTERFACE
> and READ-ENABLE/READ-DISABLE.  READ-OPTIONS-INTERFACE seems to return
> the same alist no matter what argument it is given; and I could find no
> arguments to READ-SET! which resulted in any action other than ERROR.
> Are there save and restore options primitives?

(The options interface is an old part of Guile.  I was an
inexperienced programmer when writing it.)

  (read-options) --> CURRENT-STATE
  (read-options NEW-STATE)  ;; sets the configuration state to NEW-STATE
  (read-options #t)         ;; prints current state with documentation

  (read-set! NAME VALUE) --> NEW-STATE
  (read-enable NAME)     --> NEW-STATE
  (read-disable NAME)    --> NEW_STATE

This is the low-level primitive on top of which the option procedures
are implemented:

  (read-options-interface) --> CURRENT-STATE
  (read-options-interface NEW-STATE) --> OLD-STATE
  (read-options-interface #t) --> list with values and documentation

where CURRENT-STATE, NEW-STATE and OLD-STATE are
<configuration state>s and

  <configuration state> ::= <begin list> <option>* <end list>
  <option>              ::= <boolean option> | <option with value>
  <boolean option>      ::= <symbol>
  <value option>        ::= <symbol> <datum>

I.e., the <configuration state> is a list where the presence/absence
of a boolean option name (symbol) indicates a true/false state of that
option and the presence of a value option name followed by a value
indicates the value of that option, so

  (let ((old '()))
    (dynamic-wind (lambda () (set! old (read-options))
                  (lambda () (read-enable 'case-insensitive) ...)
                  (lambda () (read-options old)))))

should work.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]