Terminal control/Unicode output: Difference between revisions
Content added Content deleted
Thundergnat (talk | contribs) m (syntax highlighting fixup automation) |
m (→{{header|Wren}}: Minor tidy) |
||
Line 629: | Line 629: | ||
{{trans|C}} |
{{trans|C}} |
||
As there is currently no way to obtain this information via Wren CLI, we instead embed a Wren script in a C application and ask the host program to get it for us. |
As there is currently no way to obtain this information via Wren CLI, we instead embed a Wren script in a C application and ask the host program to get it for us. |
||
<syntaxhighlight lang=" |
<syntaxhighlight lang="wren">/* Terminal_control_Unicode_output.wren */ |
||
class C { |
class C { |
||
Line 642: | Line 642: | ||
<br> |
<br> |
||
We now embed this Wren script in the following C program, compile and run it. |
We now embed this Wren script in the following C program, compile and run it. |
||
syntaxhighlight lang="c">/* gcc Terminal_control_Unicode_output.c -o Terminal_control_Unicode_output -lwren -lm */ |
|||
#include <stdlib.h> |
|||
#include <stdio.h> |
#include <stdio.h> |
||
#include <string.h> |
#include <string.h> |
||
Line 715: | Line 717: | ||
WrenVM* vm = wrenNewVM(&config); |
WrenVM* vm = wrenNewVM(&config); |
||
const char* module = "main"; |
const char* module = "main"; |
||
const char* fileName = " |
const char* fileName = "Terminal_control_Unicode_output.wren"; |
||
char *script = readFile(fileName); |
char *script = readFile(fileName); |
||
WrenInterpretResult result = wrenInterpret(vm, module, script); |
WrenInterpretResult result = wrenInterpret(vm, module, script); |