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

SFA reading gets stale data



Of course, READ and GENSYM share the same PNBUF.  The GENSYM done by
the macro-expansion of the POP clobbers READ's buffer with each char tyi'ed.

    Date: 22 SEP 1980 1258-EDT
    From: KMP,GJC at MIT-MC
    Sent-by: GJC at MIT-MC

    (DEFUN MY-SFA-HANDLER (SELF OP DATA) 
      (CASEQ OP ((WHICH-OPERATIONS) '(TYI UNTYI))
    	    ((TYI) (POP (SFA-GET SELF 0.)))
    	    ((UNTYI) (COMMENT I DON/'T REALLY CARE))
    	    ((INIT) (SETF (SFA-GET SELF 0.) DATA))
    	    (T (ERROR "Unsupported call" (LIST 'SFA-CALL SELF OP DATA))))) 

    (DEFUN MAKE-AN-SFA (DATA) 
      (LET ((SFA (SFA-CREATE 'MY-SFA-HANDLER 1. "My SFA")))
           (SFA-CALL SFA 'INIT (EXPLODEN DATA))
           SFA)) 

    (SETQ A (MAKE-AN-SFA "ABC "))
    (READ A) => G00

    (GENSYM (ASCII 2.))
    (SETQ A (MAKE-AN-SFA "ABC "))
    (READ A) => /^B00

    (SETQ A (MAKE-AN-SFA "ABCDEFGHIJKLMNOPQRSTUVWXYZ "))
    (READ A) => /^B0043FGHIJKLMNOPQRSTUVWXYZ


    Where is this coming from? Naturally it does manifest itself in 'real'
    programs as well.  -kmp

    ps GJC says there is a similar effect with READLINE.