Number: 826

Date: 24-Apr-84 16':02':08

Submitter: Sannella.PA

Source: JonL

Subject: "The infamous PEEKC bug"

Lisp Version: 

Description: '
Date': 24 Apr 84 10':18 PST'
From': JonL.pa'
Subject': Why DEdit has yet-another-RDTBL'
To': Sheil,vanMelle,Cooper'
cc': LispSupport'
'
Bill''s comments a couple weeks ago about KEYACTIONs and INTERRUPTCHARs under DEdit remind me that many of us have long wanted a single, standard readtable used by DEdit, LISPX, LOAD etc.  '
'
I seem to remember your main reason for implementing certain commands as interrupt characters -- hence requiring a private DEdit readtable -- was the infamous PEEKC bug prevented the obvious implementation.'
'
Time to fix PEEKC?'
'
  -- JonL --'
'
-----'
'
Date': 24 Apr 84 10':32 PST'
From': Sheil.pa'
Subject': Re': Why DEdit has yet-another-RDTBL'
In-reply-to': JonL.pa''s message of 24 Apr 84 10':18 PST'
To': JonL.pa'
cc': vanMelle.pa, Cooper.pa, LispSupport.pa'
'
It''s long since time to fix PEEKC, but I''m not sure anyone knows how to do it without causing all kinds of existing code to break.'
'
Beau'
'
-----'
'
Date': 28 Oct 83 19':44 PDT'
From': vanMelle.pa'
Subject': Re': Infamous peekc bug'
In-reply-to': KAPLAN.PA''s message of 28 OCT 83 17':39 PDT'
To': KAPLAN.PA'
cc': vanMelle.PA, Masinter'
'
The bug is simply that, following (PEEKC T), you can''t backspace over the character that was peeked.  The problem is that tty input is driven off the refill function of the input stream, and the refill function is invoked only when the contents of the stream (in this case, the one character stuck there by the PEEKC) have been exhausted, at which point the peeked character has been consumed by the READ or whatever.  On the 10, I think the system peeks by doing a BIN followed by BKJFN, and Tenex does the right thing.'
'
The most obvious fix is to have the PEEKBIN function of the tty input NOT stick the peeked character into its buffer, but rather put it in a special cache in the stream, along with a flag that says whether or not it got echoed.  Then when someone actually goes to read the line of input, the buffer will be completely empty, the refill fn gets invoked, which pulls the peeked character out of the cache and unreads it, echoing it if necessary (if it was read unechoed and echoing is now on).'
'
Better solutions are welcome.  Almost any solution will have an impact on TTYIN, but I will be more than happy to fix TTYIN accordingly.'
'
	Bill'
'
'


Workaround: 

Test Case: 

Edit-By: Sannella.PA

Edit-Date: 17-Aug-84 10':01':31

Attn: 

Assigned To: vanMelle

In/By: Harmony

Disposition: [bvm fixed 5/13/84]

System: Operating System

Subsystem: Generic File Operations

Machine: 

Disk: 

Microcode Version: 

Memory Size: 

File Server: 

Server Software Version: 

Difficulty: Moderate

Frequency: Everytime

Impact: Serious

Priority: Hopefully

Status: Closed

Problem Type: Bug

Source Files: