| 1234567891011121314151617181920212223242526272829303132333435363738 |
- MODULE editor2;
- (* based on the kilo editor building course*)
- (* Step 5 *)
- (* using different libreries for the same purpose, some lowlevel, some higher level *)
- (* IO mode *)
- IMPORT IO, termios, FIO;
- VAR
- c : CHAR;
- theTermios : termios.TERMIOS;
- PROCEDURE enablerawMode;
- BEGIN
- theTermios := termios.InitTermios();
- IF termios.tcgetattr(FIO.StdIn, theTermios) = -1 THEN
- HALT
- END;
- IO.UnBufferedMode(0,TRUE);
- IO.UnBufferedMode(1,TRUE);
- END enablerawMode;
- BEGIN
- enablerawMode;
- LOOP
- IO.Read(c);
- IF c = "q" THEN
- EXIT
- END;
- END;
- theTermios := termios.KillTermios(theTermios);
- END editor2.
|