Path: utzoo!attcan!utgpu!jarvis.csri.toronto.edu!cs.utexas.edu!wuarchive!mit-eddie!uw-beaver!zephyr.ens.tek.com!tekcrl!tekgvs!toma From: toma@tekgvs.LABS.TEK.COM (Tom Almy) Newsgroups: comp.lang.lisp.x Subject: More XLISP Bugs Message-ID: <6460@tekgvs.LABS.TEK.COM> Date: 4 Dec 89 18:18:34 GMT Reply-To: toma@tekgvs.LABS.TEK.COM (Tom Almy) Organization: Tektronix, Inc., Beaverton, OR. Lines: 110 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