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

more on yesterday's TYIPEEK lossage



INCST3:	TLNE T,SO.TIP		;FOO! TYIPEEK IS DIFFERENT!
	 TDZA C,C		;  BUT IF NOT TYIPEEK THEN USE
	  MOVEI C,INCST3	;  NEW EOF VALUE, SOMETHING UNIQUE
	PUSHJ P,ISTCAL		;CALL THE SFA
	POP P,C			;RESTORE EOF VALUE
	CAIN A,INCST3		;DID THE SFA RETURN EOF?
	 JRST INCST4		;YES, HANDLE IT
	JSP T,FXNV1		;ELSE THE VALUE RETURNED MUST BE A FIXNUM
	POPJ P,
-----
Note how SFA's get sent a NIL but on return check for INCST3 ...? How is 
the guy going to know to return that? I just did

(SETQ STREAM (SFA-CREATE #'(LAMBDA (SELF OP DATA)
			     (CASEQ OP
			       ((WHICH-OPERATIONS) '(TYIPEEK))
			       ((TYIPEEK) '#,(MUNKAM (GETDDTSYM 'INCST3)))
			       (T (ERROR "Loss" OP))))
			 0. "Loss"))

(TYIPEEK NIL STREAM)    => -1.
(TYIPEEK NIL STREAM -3) => -3.

which is the kind of behavior that I want... Somehow this need for
#,(MUNKAM ...) seems awkward, though.