home *** CD-ROM | disk | FTP | other *** search
- pragma On(Optimize_for_space);
- {*********************************************************************
- (C) Copyright 1983-92; Franklin L. DeRemer, Thomas J. Pennello,
- MetaWare Incorporated; Santa Cruz, CA 95060.
- This program is the unpublished property and trade secret of the above
- three. It is to be utilized solely under license from MetaWare and it
- is to be maintained on a confidential basis for internal company use
- only. The security and protection of the program is paramount to
- maintenance of the trade secret status. It is to be protected from
- disclosure to unauthorized parties, both within the Licensee company
- and outside, in a manner not less stringent than that utilized for Li-
- censee's own proprietary internal information. No copies of the
- Source or Object Code are to leave the premises of Licensee's business
- except in strict accordance with the license agreement signed by Li-
- censee with MetaWare.
- *********************************************************************}
- {
- MetaWare Pascal Runtime Support: Console read/write.
- 8086 - MS/DOS Version 2
- }
- Export(Console);
- pragma C_include('Console.pf');
- pragma C_include('SYSTEM.pf');
- pragma C_include('LINETERM.pf');
- pragma C_include('Implement.pf');
-
- program Implement_Console1;
- pragma Alias(Implement_Console1,Implement.RTE || 'Console1');
- with Loopholes:[Adr,Retype];
-
- with Lineterm;
- pragma Off(With_warnings);
- with System;
- pragma Pop(With_warnings);
-
- {
- Read a string from the keyboard.
- }
-
- procedure Gets(var S: String);
- pragma data(Common,Implement.RTE || 'KBDATA');
- var Fd:File_handle;
- KB_opened:Boolean;
- value KB_opened := False;
- var Con: packed array[1..4] of char; value Con := 'CON' || Chr(0);
- pragma data;
- var Len,L: Integer; LT1:char;
- begin
- if not KB_opened then begin
- Fd := C_Open(Adr(Con) %Retype Implement.Charp,For_reading);
- KB_opened := True;
- end;
- Len := Read(Fd,Adr(S[1]),Maxlength(S));
- Set_length(S,Len);
- L := Length(LTConv_in); LT1 := LTConv_in[1];
- if Len >= L then begin
- { Attempt to strip off LTConv_in from end. }
- if L = 1 then if S[Len] = LT1 then Set_length(S,Len-1);
- if L = 2 then if (S[Len-1]=LT1) and (S[Len]=LTconv_in[2]) then
- Set_length(S,Len-2);
- end;
- end;
-
- { (C) Copyright 1983; unpublished property and trade secret of }
- { MetaWare Incorporated; Santa Cruz, CA 95060; detailed notice above.}
-