|Page 251 of 800||Search internet|
text "hello.txt" : "Hello","World" end text
results in a 'text' rendering event. That event generates a text file named hello.txt containing the text HelloWorld.
The rendering of the file name must be a single string whereas the rendering of the contents can be a vector tree.
The rendering of the text...end text construct is defined thus:
tex use define text x : y end text as "text"[ x ]y end define
Thus, the text...end text construct generates the event name 'text' followed by the file name x and the contents y.
The base page does not define constructs for generating the other three file generation events ('file', 'exec', and 'script'), but if you need them, you can define them yourself.
For 'file' and 'exec', the raw bytes of y are dumped to the generated file. For 'text' and 'script', Logiweb newlines (LF) are converted to host newline sequences (LF, CR, CRLF, or LFCR).
For 'file' and 'text', the generated file is non-executable. For 'exec' and 'script', the generated file is executable.
The 'text' and 'script' events are convenient but not really needed. The renderer knows the host newline convention, so the renderer would be able to use e.g. 'file' instead of 'text' and do the newline conversion itself.
At the time of writing, file generation events have been used for generating .html, .tex, .c, .h, .png, .eps, .ico, bash scripts, makefiles, and many other file formats. Since rendering is Turing complete, one can use it for rendering any kind of file. As an example, one could implement a C-compiler using the rendering machinery and let it generate ELF binaries if desired.
|Page 251 of 800||Search logiweb.eu|