Παρασκευή 13 Σεπτεμβρίου 2019

Revision 39 Version 9.8

New revision and now we can use surrogates for UTF16LE, which is the encoding system for M2000 strings. M2000 is an interpreter written and compiled in Visual Basic 6.



M2000 Environment is built with VB6 naked forms (without title and control buttons). The problem of control buttons in VB6 exist in exit button [X}. When we press this button any thread halted until button released,or perform the hit. Because M2000 has a thread internal system, which implements an interval per thread, this halt is not allowed. So from version 7 of M2000 interpreter introduced a GUI system based in a single type form, and with a basic user control the glis4.ctl .This gui control in association with other objects, which can handle events make all the GUI controls of M2000. Before the GUI system was a form to emulate a console with graphics, like the screen of an 8-bit computer, with scolling, and split screen function (the low part of console can scroll, and the top part is static). This form actually exist, and is the main form when we open the interpreter in immediate mode. The editor for M2000 works with a TextViewer.cls (an object in VB6) similar to EditBox, the editor for gui. All gui elements have siblings for some utility forms, with a basic difference: The gui controls send events to interpreted user program at execution time, the other controls send the events to compiled code inside the interpreter.



So the job to include the surrogates for M2000 had three parts:

1. The console form which commands like INPUT and PRINT (similar to BASIC) use an internal key buffer (we can wait for key using KEY$ without stopping any thread - $ used when a string to indicate a string type of identifier). Characters on console layers (there are 32 plus 2 more layers)  and on user forms layers. can be displayed in a canvas style, using the Print command, where each character is at specific row and column, or using proportional spacing  using columns, justification, at specific rows, or by using the Report command we use proportional spacing but without columns, using tabs characters if we wish, for rendering text at a specific with, where only the left margin adjusted to the cursor row position. A last option is the Legend command which we can print text at graphic positions, using angle and justification.



From these four types of printing text in forms (same for printer paper), the last one (Legend command) use Win32 calls to perform all the tasks. The Report command has own justification routine (written by me), and before this revision only utf-16 diacritics handled proper. The same for the Print command



2. Editors updated to include the surrogates. The cursor always move one byte, but when discover a surrogate advance one more, or do the opposite if the cursor move to the left. Del and backspace/

3. Functions Chrcode$(numeric_expression) and Chtcode(string_expression) now work with surrogates. chrcode(chrcode$(0x10437))=0x10437.


This is an image of five programs running, one with full screen, another with modification to console, using transparency (a clock gadget), plus three editors using M2000 user forms. One editor for M2000 code, one for C# and another for an educational tiny language called ΓΛΩΣΣΑ (means language). From all editors we can copy to clipboard each time to two forms, one for plain text (utf-16) and one for html (utf-8).



Δεν υπάρχουν σχόλια:

Δημοσίευση σχολίου

You can feel free to write any suggestion, or idea on the subject.