Cosmos
Cosmos copied to clipboard
Console Class list of not implemented methods
List of Console not implemented methods
In the following issue there is a list of the properties methods not implemented for the Console class.
Properties or Methods regarding streaming redirection
This is the list of not implemented properties:
- [ ] IsErrorRedirected
- [ ] IsInputRedirected
- [ ] IsOutputRedirecte
This is the list not implemented methods:
- [ ] OpenStandardError()
- [ ] OpenStandardInput()
- [ ] OpenStandardOutput()
- [ ] OpenStandardError(Int32)
- [ ] OpenStandardInput(Int32)
- [ ] OpenStandardOutput()
- [ ] SetError(TextWriter)
- [ ] SetIn(TextReader)
- [ ] SetOut(TextWriter)
Possible Implementation
The original Console has two objects inside it TextWriter and TextReader that abstract the console standard out, standard error and standard input. The Cosmos console is based on a TextScreen that is a low level implementation of BIOS console. This difference could be a problem?
Properties regarding Cursor
This is the list of not implemented properties:
- [x] CursorSize
- [x] CursorVisible
Possible Implementation:
It is possible to change the size (shape) of the Cursor and hide / show it writing in the BIOS register documented here. The code is really similar to the one used for the implementation SetCursorPosition.
Properties or Methods regarding Virtual Consoles
This is the list of not implemented properties:
- [ ] BufferHeight
- [ ] BufferWidth
- [ ] LargestWindowHeight
- [ ] LargestWindowWidth
- [ ] WindowHeight
- [ ] WindowWidth
This is the list of not implemented methods:
- [ ] MoveBufferArea(Int32, Int32, Int32, Int32, Int32, Int32)
- [ ] MoveBufferArea(Int32, Int32, Int32, Int32, Int32, Int32, Char, ConsoleColor, ConsoleColor)
- [ ] SetWindowPosition(Int32, Int32)
- [x] SetWindowSize(Int32, Int32)
Possible Implementation:
These properties / methods regards surely Virtual Consoles as the BIOS have not these properties these could have sense if - in future - we have Virtual Consoles implemented in VGA / VESA for this could be implemented later.
Properties / Methods regarding Keyboard
This is the list of not implemented properties:
- [x] CapsLock
- [ ] KeyAvailable
- [x] NumberLock
- [ ] TreatControlCAsInput
This is the list of partially implemented methods but that have bugs:
- [ ] Read(): should block until a key pressed (not only the character but ENTER, Function keys and so on). Instead it does not block and always return -1 (EOF)
- [ ] ReadKey(): halts the CPU with exception 0x0
- [ ] ReadKey(Boolean): halts the CPU with exception 0x0
Possible Implementation:
To be yet investigated. I suggest to give the "method not implemented" string instead of bugged / wrong behavior in any case.
Methods to write values on Console
This is the list of partially implemented methods but that have bugs::
- [ ] Write(Decimal): The Decimal type is not really implemented as only the declaration returns an error. It seems, in particular, that the underlying method System.Number.FormatDecimal(System.Decimal, System.String, System.Globalization.NumberFormatInfo) is missing
- [x] Write(Double): The conversion to string seems to not have sense it returns "Double Underrange"???
- [ ] Write(Object): Object.ToString() is not implemented!
- [x] Write(Single): halt the CPU with exception 0x0!
- [ ] WriteLine(Decimal): same problem of Write(Decimal)
- [x] WriteLine(Double): same problem of Write(Double)
This is the list of not implemented methods:
- [ ] Write(String, Object): the formatted Write that we all hate and love! This is really important to implement
- [ ] Write(String, Object, Object): same of Write(String, Object)
- [ ] Write(String, Object, Object, Object): same of Write(String, Object)
- [ ] Write(String, Object[]): same of Write(String, Object)
- [ ] WriteLine(String, Object): same of Write(String, Object)
- [ ] WriteLine(String, Object, Object)): same of WriteLine(String, Object)
- [ ] WriteLine(String, Object, Object, Object): same of WriteLine(String, Object)
- [ ] Write(String, Object[]): same of WriteLine(String, Object)
Possible Implementation:
It seems that a lot of problems are because the method toString() is not yet implemented (or be incorrectly implemented) for a lot Objects as a lot of Write() could be simply implemented as a call to the corresponding toString() for example:
String Write(Double d) {
return d.toString();
}
The Write()/WriteLine() with format are really useful from the programmer point of view but seems a nightmare to implement: not only the placeholder substitution is needed but printf() like format specifiers could be used (for example to print a number as hexadecimal), localization takes a place here too: a Date could shown in the user culture preferred way (2015/11/23 for en/US but 23/11/2015 for it/EU!). A first version could be simplified:
- Let's implement only the array version and not all the overloads that exist because array give a boxing penalty if all value passed are ValueTypes. For now better have at least a working version we could optimize the thing later.
- Ignore complex formats do only place holder substitution is in yet case better that use the '+' operator
- Ignore culture for now Cosmos is only en / US.
Properties regarding Input / Output encoding
This is the list of not implemented properties:
- [ ] InputEncoding
- [ ] OutputEncoding
Possible implementation:
For the BIOS Console a character has the size of one Byte, the characters from 0 to 127 are the classical ASCII characters, the characters with value > 127 have a representation that depends from the code pages used. For .NET, instead, a character is expressed in UFT-16 (typically 2 byte) so if the user enters a not ASCII character a conversion from UTF-16 to the specified code page is needed and when a character not ASCII is read (for example with Console.ReadLine()) the inverse conversion should happen.
This a possible list of the modification to do:
- A method to select the code page in BIOS should be implemented. Console in its constructor should select a default code page for example 850 / 858 (to have the € sign). Possible extension to the Console class a property to set / get CodePage or it need to be put in some other place?
- When a character is read from keyboard if is more that > 127 it should be converted in the target code page. This class should be used.
- When a character is read from the keyboard (for example with Console.ReadLine()) a conversion from the code page to UFT-16 should be done when read in a String
As this issue has received no new activity, it has been marked as stale
This is very outdated as of today
Which part of it? Quickly going through the list, it seems accurate.
It is 7 years old, for sure most of them have been plugged, I'll check when I get on my pc