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

read-line and paste



I'm having a problem porting a simple command interpreter to MCL.  
This shell supports both lisp evaluation as well as command  
dispatching.  It was developed in unix environments and works under  
terminal shells and emacs subjobs, but breaks in MCL because of  
differences in how line-editing and copy/paste operate. The problem  
lies in my underlying parser, which eventually calls read-line to  
return whatever the user has activated by typing a carriage return.   
On the unix environments, my reader doesn't see any COPY/PASTE input  
until a user actually types a carriage return after pasting, even if  
a pasted form itself contains some line breaks. Thus, if i pasted (or  
brought to the insertion point) something like:
	(algorithm foo midi-note (amplitude .5 length 100)
          (setf note (items (notes c4 d ef f g in palindrome)))
          (setf rhythm (between .1 .4)
                duration (+ rhythm .01)))
my code wont start processing any of this input until I actually type  
a carriage return. This means that the pasted material is still  
available to be edited until hitting carriage return to activate my  
parsing routines.  However, in MCL, my parsing routines are being  
called on each of the lines in this form as PASTE does its  
processing.  (This problem also occurs if i activate earlier input in  
the listener's window by hitting carriage return to bring it to the  
reading point) The net effect is that, since the input is processed  
as it is pasted, I can only edit the last line of multi line code  
because the earlier lines have already been read!  So my question is,  
what - if any - is the easiest way to fix this?  Note that I can't  
simply use READ because the my interpreter decides if the input data  
should be read-from-string/evaled or processed as a command and data.

Rick Taube
Zentrum fuer Kunst und Medientechnologie
7500 Karlsruhe 41, Germany
hkt@zkm.de, hkt@ccrma.stanford.edu