"As to the Win32, editing etc, perhaps [...] not "complete" in those systems."
I had been working against a comparatively simple abstraction under the assumption we could glue them together easily enough. I'll post the terminal/console part of the abstraction. Unfortunately, my changes to the interpreter made it unusable in the context of the original and may have been too slow from the considerable use of polymorphic composition.
I should probably explain that... just in case Sebastiani is headed down that same road. My changes were able to load existing "mini-basic" files easily enough, but the expression simplification and name aliasing stuff left the source far different than what was loaded. It performed the same mechanic, but did not result in the same source. So, if you loaded a file and promptly saved it the result wold be drastically different from the original. Any constant mathematic expressions with important magic numbers, which is obviously all that is available to the original, were compressed to the constant result before being passed to the interpreter or saved. It, basically, mangled the source.
Anyway, I like the idea of having a dedicated trace/debug area, but I don't want to add to many dependencies either. It's pretty basic to split the terminal area up into multiple windows with `curses' so for now how about we just do that (only with the WIN32API)? For example, if the debug flag is set keep the height 2 lines longer with some arbitrary byte, maybe just `-', separating the status line from the actual buffer area. Will that work for everyone else? Possibly adding a dedicated `???::trace(const std::string)' function/method this purpose?
I figure you guys can guess what exactly these methods return so I'm not going to label anything for now.
Soma
Code:
typedef uint32_t colour_type;
typedef std::pair<uint32_t, uint32_t> dimension_type;
typedef std::pair<colour_type, colour_type> font_type;
class terminal_server // singleton
{
public:
std::pair<bool, font_type> colour
(
colour_type new_foreground_colour,
colour_type new_background_colour
);
std::pair<bool, font_type> colour_at
(
uint32_t x_offset,
uint32_t y_offset
);
std::pair<bool, bool> echo_mode
(
bool with_echo
);
std::pair<bool, dimension_type> move
(
uint32_t new_x_offset,
uint32_t new_y_offset
);
// modified virtual character code (F5, "Up Arrow", Escape)
std::pair<bool, uint32_t> read();
std::pair<bool, dimension_type> resize
(
uint32_t new_width,
uint32_t new_height
);
std::pair<bool, std::string> text
(
const std::string & new_text
);
std::pair<bool, std::string> text_at
(
uint32_t x_offset,
uint32_t y_offset
);
std::pair<bool, std::string> title
(
const std::string & new_title
);
public:
private:
???::any_like
private:
};
class line_editor // implied singleton
{
public:
// ??? (glue)
std::pair<bool, std::string> read_some();
public:
private:
terminal_server terminal;
ubasic_interpreter interpreter;
private:
};