Opened 12 years ago

Closed 12 years ago

#90 closed defect (fixed)

Implement proper console I/O for SDK mode

Reported by: dmik Owned by:
Priority: major Milestone: 0.8.8
Component: odin Version: 0.8.7
Severity: medium Keywords:
Cc:

Description

When using Odin in SDK mode, the console I/O is not done properly. This means that STDIN/STDOUT handles are implemented using a very restricted set of functions (HMDeviceStandardClass) which only implements reading and writing (regardless of if the handles are the real console or redirected to files etc).

As a result things like GetNumberOfConsoleInputEvents() and PeekConsoleInput() don't work in real console mode (although the code implementing them is present in classes HMDeviceConsoleInClass and HMDeviceConsoleOutClass). And things like SetFilePointer() don't work in redirected mode (although the HMDeviceFile class implements them properly).

Due to these defects, the console I/O got partially broken after r22024 (which fixed a lot of inconsistencies in return codes). In particular, this affects Java which will throw an exception if you e.g. attempt to read something from STDIN.

Change History (5)

comment:1 by dmik, 12 years ago

I sorted it out and made STDIN/STDOUT work in console mode in r22050. Further things to do:

  1. Make reading from the standard input work in redirected and piped mode (should be a matter of delegating some calls to HMDeviceFileClass).
  1. Make Backspace actually erase the last character on the screen when reading the standard input in console mode. Now it is left untouched (the buffer is properly updated though).

When done, I will enable this console code for SDK mode (by calling iConsoleInit() in Win32LxExe::Win32LxExe() when the application is a VIO session).

comment:2 by dmik, 12 years ago

Problem 1 is solved in r22051. Problem 2 is really minor -> for tomorrow.

comment:3 by dmik, 12 years ago

Resolution: fixed
Status: newclosed

Problem 2 turned out to be more complex. But now (after r22052) it works as it would do in a native Java.

I also enabled the console mode for VIO applications in r22053.

This seems to be done.

comment:4 by dmik, 12 years ago

Resolution: fixed
Status: closedreopened

Hmm, when redirecting to nul, OS/2 reports it's a CHAR device (i.e. console) and this causes the console object to be created and used which prints directly to the attached VIO window ignoring redirection.

comment:5 by dmik, 12 years ago

Resolution: fixed
Status: reopenedclosed

I fixed this in r22055 (see the code for a tricky solution).

Note: See TracTickets for help on using tickets.