home *** CD-ROM | disk | FTP | other *** search
- Unit Unread;
-
- INTERFACE
- Procedure UnreadChar(X : Char);
-
- IMPLEMENTATION
-
- CONST
- IPCSEG = $0040;
- BUFFHEADOFF = $001A;
- BUFFTAILOFF = $001C;
- KEYBUFFSTART= $001E;
- KEYBUFFEND = $003E;
- Scan_Table : array [0..255] of Word = ( { Note that Some Converted to spaces }
- $3920, $3920, $3920, $3920, $3920, $3920, $3920, $3920, { 0-7 IG}
- $3920, $3920, $3920, $3920, $3920, $1C0D, $3920, $3920, { 8-15 IG}
- $3920, $3920, $3920, $3920, $3920, $3920, $3920, $3920, { 16-23 IG}
- $3920, $3920, $3920, $3920, $3920, $3920, $3920, $3920, { 24-31 IG}
- $3920, $0221, $2822, $0423, $0524, $0625, $0826, $3920, { 32-39 }
- $0A28, $0B29, $3920, $0D2B, $3920, $0C2D, $3920, $3920, { 40-47 }
- $0B30, $0231, $0332, $0433, $0534, $0635, $0736, $0837, { '0'-'7' }
- $0938, $0A39, $3920, $3920, $3920, $3920, $3920, $3920, { '8','9' IG}
- $3920, $1E41, $3042, $2E43, $2044, $1245, $2146, $2247, {IG 'A'..'G'}
- $2348, $1749, $244A, $254B, $264C, $324D, $314E, $184F, {'H'..'O'}
- $1950, $1051, $1352, $1F53, $1454, $1655, $2F56, $1157, {'P'..'W'}
- $2D58, $1559, $2C5A, $3920, $3920, $3920, $3920, $0C5F, {'X'..'Z', IG... '_'}
- $3920, $1E61, $3062, $2E63, $2064, $1265, $2166, $2267, {IG 'a'..'g'}
- $2368, $1769, $246A, $256B, $266C, $326D, $316E, $186F, {'h'..'o'}
- $1970, $1071, $1372, $1F73, $1474, $1675, $2F76, $1177, {'p'..'w'}
- $2D78, $1579, $2C7A, $3920, $3920, $3920, $3920, $3920, {'x'..'z', IG}
- $3920, $3920, $3920, $3920, $3920, $3920, $3920, $3920, { ig }
- $3920, $3920, $3920, $3920, $3920, $3920, $3920, $3920, { Ig }
- $3920, $3920, $3920, $3920, $3920, $3920, $3920, $3920,
- $3920, $3920, $3920, $3920, $3920, $3920, $3920, $3920,
- $3920, $3920, $3920, $3920, $3920, $3920, $3920, $3920,
- $3920, $3920, $3920, $3920, $3920, $3920, $3920, $3920,
- $3920, $3920, $3920, $3920, $3920, $3920, $3920, $3920,
- $3920, $3920, $3920, $3920, $3920, $3920, $3920, $3920,
- $3920, $3920, $3920, $3920, $3920, $3920, $3920, $3920,
- $3920, $3920, $3920, $3920, $3920, $3920, $3920, $3920,
- $3920, $3920, $3920, $3920, $3920, $3920, $3920, $3920,
- $3920, $3920, $3920, $3920, $3920, $3920, $3920, $3920,
- $3920, $3920, $3920, $3920, $3920, $3920, $3920, $3920,
- $3920, $3920, $3920, $3920, $3920, $3920, $3920, $3920,
- $3920, $3920, $3920, $3920, $3920, $3920, $3920, $3920,
- $3920, $3920, $3920, $3920, $3920, $3920, $3920, $3920);
-
- Procedure UnreadChar(X : Char);
- Var
- HeadPtr, TailPtr, CurrPtr : ^Word; { Pointers to Locations }
- HeadIndx, TailIndx : Word;
- ScanValue : Word;
- Begin
- HeadPtr := Ptr(IPCSEG,BUFFHEADOFF); { Make pointer to head }
- TailPtr := Ptr(IPCSEG,BUFFTAILOFF); { Make pointer to tail }
- HeadIndx := Word(HeadPtr^); { Get the HEad Value }
- TailIndx := Word(TailPtr^); { Get the Tail Value }
- CurrPtr := Ptr(IPCSEG,TailIndx); { Make a pointer to the actual buffer }
- ScanValue := Scan_Table[Ord(X)]; { Get the scan }
- CurrPtr^ := ScanValue; { Place it into the buffer }
- Inc(TailIndx,2); { Add 2 to the address tail }
- If (TailIndx = KEYBUFFEND) Then TailIndx := KEYBUFFSTART;
- TailPtr^ := TailIndx;
- End;
-
- Begin { Initialization }
- End.