[comp.lang.lisp.x] More XLISP Bugs

toma@tekgvs.LABS.TEK.COM (Tom Almy) (12/05/89)

								12/4/89

I was trying some examples in Common Lisp: The Reference, and found some
bugs (both real and compatibility) in XLISP 2.0/2.1

********************

Double quotes are not escaped when printing.
(Fix needed in putqstring to handle case of '"').

change:
    if (ch < 040 || ch == '\\' || ch > 0176) {
to:
    if (ch < 040 || ch == '\\' || ch == '"' || ch > 0176) {

change:
    case '\\':
	xlputc(fptr,'\\');
	break;

to:
    case '\\':
    case '"':
	xlputc(fptr,ch);
	break;

******************
In version 2.1, #S() construct doesn't quote element values. 
":" not allowed on keywords, nor are the printed.

Example:

(defstruct foo (x 10))


#S(foo)   prints #S(foo x 10) instead of #S(foo :x 10)

#S(foo :x 10)  gives an error

#S(foo x (+ 3 4)) gives #S(foo x 7) instead of #S(foo :x (+3 4))

In xlrdstruct() (xlstruct.c)

change:
	sprintf(buf,":%s",getstring(getpname(slotname)));

	/* add the slot keyword */
	rplacd(last,cons(xlenter(buf),NIL));

to:


	/* add the slot keyword */
	if (*(getstring(getpname(slotname))) != ':') { /* add colon */
		sprintf(buf,":%s",getstring(getpname(slotname)));
		rplacd(last,cons(xlenter(buf),NIL));
	}
	else {
		rplacd(last,cons(slotname,NIL));
	}

and change:
	/* add the value expression */
	rplacd(last,cons(car(list),NIL));
	last = cdr(last);
	list = cdr(list);

to:
	/* add the value expression  -- QUOTED (TAA MOD) */
	rplacd(last,cons(NIL,NIL));
	last = cdr(last);
	rplaca(last, (slotname = cons(s_quote,NIL)));
	rplacd(slotname, cons(car(list), NIL));
	list = cdr(list);



In xlprstruct(), replace:
	xlputc(fptr,' ');

with:
	xlputstr(fptr," :");	/* TAA MOD, colons should show */

****************
In XLISP 2.1, attempts to write to a structure element beyond the end of
the structure (i.e. wrong access function used) tends to cause a crash.

FIX: in both xstrref() and xstrset() (in xlstruct.c) 

after:
    xllastarg(); 

add:
    if (i >= getsize(str)) /* wrong structure*/
	xlerror("Bad structure reference",str);


*********************
I added #. macro, to eval at read time.	
To switch statement in rmhash add:

	case '.':
		readone(fptr,&car(val));
		rplaca(val,xleval(car(val)));
		break;

Tom Almy
toma@tekgvs.labs.tek.com
Standard Disclaimers Apply

880716a@aucs.uucp (Dave Astels) (12/08/89)

I see much mention of XLISP 2.1 lately.  Could someone post the sources?
Preferably with many of the fixes already made, or with a list of fixes 
devised so far.




-- 
- Dave

Internet: 880716a@AcadiaU.CA
Bitnet:   880716a@Acadia