home *** CD-ROM | disk | FTP | other *** search
/ The Fred Fish Collection 1.5 / ffcollection-1-5-1992-11.iso / ff_disks / 300-399 / ff339.lzh / PCQ / Runtime.lzh / Runtime / Extras / ConsoleIO.p next >
Text File  |  1989-10-21  |  2KB  |  70 lines

  1. External;
  2.  
  3. {
  4.     ConsoleIO.p
  5.  
  6.     This file implements all the normal console.device stuff for
  7. dealing with windows.  The first set of routines is standard Amiga stuff,
  8. culled from the ROM Kernel Manual.  The last few routines partially mimic
  9. similar routines from Turbo Pascal.  See ConsoleTest.p for an example of
  10. using these routines.
  11. }
  12.  
  13.  
  14. {$I "Include/Exec.i"}
  15. {$I "Include/Ports.i"}
  16. {$I "Include/ExecIO.i"}
  17.  
  18. Procedure ConPutChar(Request : IOStdReqPtr; Character : Char);
  19. var
  20.     Error : Integer;
  21. begin
  22.     Request^.ioReq.ioCommand := CMD_WRITE;
  23.     Request^.ioData := Adr(Character);
  24.     Request^.ioLength := 1;
  25.     Error := DoIO(IORequestPtr(Request));
  26. end;
  27.  
  28. Procedure ConWrite(Request : IOStdReqPtr; Str : String; length : Integer);
  29. var
  30.    Error : Integer;
  31. begin
  32.     Request^.ioReq.ioCommand := CMD_WRITE;
  33.     Request^.ioData := Str;
  34.     Request^.ioLength := Length;
  35.     Error := DoIO(IORequestPtr(Request));
  36. end;
  37.  
  38. Procedure ConPutStr(Request : IOStdReqPtr; Str : String);
  39. var
  40.     Error : Integer;
  41. begin
  42.     Request^.ioReq.ioCommand := CMD_WRITE;
  43.     Request^.ioData := Str;
  44.     Request^.ioLength := -1;
  45.     Error := DoIO(IORequestPtr(Request));
  46. end;
  47.  
  48. Procedure QueueRead(Request : IOStdReqPtr; Where : String);
  49. begin
  50.     Request^.ioReq.ioCommand := CMD_READ;
  51.     Request^.ioData := Where;
  52.     Request^.ioLength := 1;
  53.     SendIO(IORequestPtr(Request));
  54. end;
  55.  
  56. Function ConGetChar(consolePort : MsgPortPtr; Request : IOStdReqPtr;
  57.             WhereTo : String) : Char;
  58. var
  59.     Temp : Char;
  60.     TempMsg : MessagePtr;
  61. begin
  62.     if GetMsg(consolePort) = Nil then begin
  63.     TempMsg := WaitPort(consolePort);
  64.     TempMsg := GetMsg(consolePort);
  65.     end;
  66.     Temp := WhereTo^;
  67.     QueueRead(Request, WhereTo);
  68.     ConGetChar := Temp;
  69. end;
  70.