maxkleiner / maXbox4

code compiler script studio
GNU General Public License v3.0
23 stars 10 forks source link

IPascal Jupyter Kernel #22

Open maxkleiner opened 3 years ago

maxkleiner commented 3 years ago

A kernel for Pascal is essential.

python pascal console attach example

with GetDOSOutput und AttachConsole is just the first step. The kernel and client live in different processes. They communicate via messaging protocols implemented on top of network sockets. Currently, these messages are encoded in JSON, a structured, text-based document format.

Our kernel receives code from the client (the notebook, for example). The do_execute() function is called whenever the user sends a cell's code.

The kernel can send messages back to the client with the self.send_response() method:

The first argument is the socket, here, the IOPub socket
The second argument is the message type, here, stream, to send back standard output or a standard error, or display_data to send back rich data
The third argument is the contents of the message, represented as a Python dictionary

The data can contain multiple MIME representations: text, HTML, SVG, images, and others. It is up to the client to handle these data types. In particular, the Notebook client knows how to represent all these types in the browser.

maxkleiner commented 2 years ago

command line with -c now possible, it reroutes the output with nativewriteln() to the open DOS-box: C:\maXbox\mx4\mx4_v38\mx4\source>maxbox4_7.exe -c examples\440_xml_tutor2.txt

Version maXbox4 is: 4.7.6.10 compiled... XCompiler Message Count: 3 compiled[Hint] (384:10): Variable 'Result' never used [Hint] (384:10): Variable 'Result' never used compiled[Hint] (31:7): Variable 'FWAIT' never used [Hint] (31:7): Variable 'FWAIT' never used compiled[Hint] (31:7): Variable 'SWITCH' never used [Hint] (31:7): Variable 'SWITCH' never used executed... exec[Hint] (384:10): Variable 'Result' never used exec[Hint] (31:7): Variable 'FWAIT' never used exec[Hint] (31:7): Variable 'SWITCH' never used

maxkleiner commented 2 years ago

In maXbox4 a reroute with itself is also possible with -c:

CaptureConsoleOutput('maXbox4 -c firstdemo.txt', memo2);

memo2 is the console (output) window in maXbox editor!

maXbox4 actual Version Total of Function Calls: 35771 SHA1: 4.7.6.10 30bace36b037686509bbbee256e22daa52b3df70 CRC32: 500F69DD: 31.8 MB (33,400,088 bytes) ZIP maxbox4.zip SHA1: 9DA15BFD72471108FCF746669C6AFD96E9A0E54C