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

Complex accept method definition question



I am on a SPARC using CLIM 1.0 in the Allegro LISP environment.

I am trying to write a complex accept method for inputting intervals of
time.  I already have the present and accept methods for accepting time
values (such as 1991-335/14:36:23) for a 'time type working.  Now I am
trying to build on that with accepting and presenting intervals in time.
For a compound type that reads multiple tokens I am at a lost in using
accept.  The documentation and examples provided with CLIM were inadequate
to illustrate how you handle multiple token accept forms with built-in
error handling and different blip and activation characters.  All I need is
a simple example to for doing this, so to simplify things if someone out
there with the knowledge could provide me with how they would do the following example I can figure it out.

SIMPLE PROBLEM EXAMPLE:

Assume you have a presentation type called 'integer-intervals
that is just a list of conses of integers with a present method that
would present it as open form list ie: (1 10) (15 25) (30 60) for 'integer-
intervals that is `((1 . 10) (15 . 25) (30 . 60)).  The present
method is trivial so you can skip that.  How do I do write an accept method
to handle the open form lists as input?

example:

(accept 'integer-intervals :prompt "enter intervals")

To which appears "Enter Intervals"

The user would then type the following ->  (1 23) (35 50) (60 70) <return>

The accept method would return '((1 . 23) (35 . 50) (60 . 70)).  I wish to have the accept method insure that the second number within each sub-list is
greater than the first AND each successive list's first number is
always greater than the prior list's second number within accept's own error conditioning handling.  So if the user types (10 9 and then #\)
an error is signaled or if the user types (10 12) (5 and then a #\space
a different error is signal so the user can back up and edit the input.
How can I do this?    Would it be simpler to forego the open form and require the user to input those surrounding parens like ((1 23) (35 50) (60 70))
instead?  I know I need to call accept within the accept method
definition for each number, but how do you handle the parens and the spaces,
while allowing for the user to go back and edit? Do you use the open paren as 
an activation character for the first number's accept call and the space as an
additional activation character for the second number's accept call?

Future thanks to anybody out there that can help me with this problem!!!!!!!