home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 7 / 07.iso / c / c221 / 5.ddi / MWHC.005 / E3 < prev    next >
Encoding:
Text File  |  1992-12-09  |  2.4 KB  |  66 lines

  1. pragma On(Optimize_for_space);
  2. {*********************************************************************
  3. (C) Copyright       1983-92;  Franklin L. DeRemer, Thomas J. Pennello,
  4.              MetaWare Incorporated;  Santa Cruz, CA 95060.
  5. This program is the unpublished property and trade secret of the above
  6. three.    It is to be utilized solely under license from MetaWare and it
  7. is to be maintained on a confidential basis for internal  company  use
  8. only.  The  security  and  protection  of  the program is paramount to
  9. maintenance of the trade secret status.  It is to  be  protected  from
  10. disclosure  to    unauthorized parties, both within the Licensee company
  11. and outside, in a manner not less stringent than that utilized for Li-
  12. censee's own proprietary  internal  information.   No  copies  of  the
  13. Source or Object Code are to leave the premises of Licensee's business
  14. except    in  strict accordance with the license agreement signed by Li-
  15. censee with MetaWare.
  16. *********************************************************************}
  17. {
  18.     MetaWare Pascal Runtime Support: Console read/write.
  19.     8086 - MS/DOS Version 2
  20. }
  21. Export(Console);
  22. pragma C_include('Console.pf');
  23. pragma C_include('SYSTEM.pf');
  24. pragma C_include('LINETERM.pf');
  25. pragma C_include('Implement.pf');
  26.  
  27. program Implement_Console1;
  28. pragma Alias(Implement_Console1,Implement.RTE || 'Console1');
  29. with Loopholes:[Adr,Retype];
  30.  
  31. with Lineterm;
  32. pragma Off(With_warnings);
  33. with System;
  34. pragma Pop(With_warnings);
  35.  
  36. {
  37.   Read a string from the keyboard.
  38. }
  39.  
  40. procedure Gets(var S: String);
  41. pragma data(Common,Implement.RTE || 'KBDATA');
  42.    var Fd:File_handle;
  43.        KB_opened:Boolean;
  44.    value KB_opened := False;
  45.    var Con: packed array[1..4] of char; value Con := 'CON' || Chr(0);
  46. pragma data;
  47.    var Len,L: Integer; LT1:char;
  48.    begin
  49.    if not KB_opened then begin
  50.       Fd := C_Open(Adr(Con) %Retype Implement.Charp,For_reading);
  51.       KB_opened := True;
  52.       end;
  53.    Len := Read(Fd,Adr(S[1]),Maxlength(S));
  54.    Set_length(S,Len);
  55.    L := Length(LTConv_in); LT1 := LTConv_in[1];
  56.    if Len >= L then begin
  57.       { Attempt to strip off LTConv_in from end. }
  58.       if L = 1 then if S[Len] = LT1 then Set_length(S,Len-1);
  59.       if L = 2 then if (S[Len-1]=LT1) and (S[Len]=LTconv_in[2]) then
  60.      Set_length(S,Len-2);
  61.       end;
  62.    end;
  63.  
  64. { (C) Copyright   1983;     unpublished property and trade secret of }
  65. { MetaWare Incorporated; Santa Cruz, CA 95060; detailed notice above.}
  66.