Starting a web browser: Difference between revisions

Content added Content deleted
m (→‎{{header|Wren}}: Wren-trait -> Wren-iterate)
m (→‎{{header|Wren}}: Minor tidy)
 
Line 1,054: Line 1,054:


The Wren code is based in part on the Nim example and uses the same color scheme.
The Wren code is based in part on the Nim example and uses the same color scheme.
<syntaxhighlight lang="ecmascript">/* starting_web_browser.wren */
<syntaxhighlight lang="wren">/* Starting_a_web_browser.wren */


import "./pattern" for Pattern
import "./pattern" for Pattern
Line 1,179: Line 1,179:
<br>
<br>
We now embed this in the following C program, compile and run it.
We now embed this in the following C program, compile and run it.
<syntaxhighlight lang="c">/* gcc starting_web_browser.c -o starting_web_browser -lwren -lm */
<syntaxhighlight lang="c">/* gcc Starting_a_web_browser.c -o Starting_a_web_browser -lwren -lm */


#include <stdio.h>
#include <stdio.h>
Line 1,314: Line 1,314:
WrenVM* vm = wrenNewVM(&config);
WrenVM* vm = wrenNewVM(&config);
const char* module = "main";
const char* module = "main";
const char* fileName = "starting_web_browser.wren";
const char* fileName = "Starting_a_web_browser.wren";
char *script = readFile(fileName);
char *script = readFile(fileName);
WrenInterpretResult result = wrenInterpret(vm, module, script);
WrenInterpretResult result = wrenInterpret(vm, module, script);