Using a speech engine to highlight words: Difference between revisions

m
m (syntax highlighting fixup automation)
m (→‎{{header|Wren}}: Minor tidy)
 
(One intermediate revision by one other user not shown)
Line 443:
{{libheader|Wren-str}}
The ability to call external processes such as ''espeak'' is expected to be added to Wren-cli in the next release. In the meantime, we embed the following Wren script in a minimal C host (no error checking) to complete this task.
<syntaxhighlight lang="ecmascriptwren">/* speech_engine_highlight_wordsUsing_a_speech_engine_to_highlight_words.wren */
 
import "./str" for Str
Line 472:
<br>
We now embed this in the following C program, compile and run it.
<syntaxhighlight lang="c">#include/* <stdiogcc Using_a_speech_engine_to_highlight_words.h>c -o Using_a_speech_engine_to_highlight_words -lwren -lm */
 
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
Line 552 ⟶ 554:
WrenVM* vm = wrenNewVM(&config);
const char* module = "main";
const char* fileName = "speech_engine_highlight_wordsUsing_a_speech_engine_to_highlight_words.wren";
char *script = readFile(fileName);
wrenInterpret(vm, module, script);
Line 559 ⟶ 561:
return 0;
}</syntaxhighlight>
 
{{omit from|EasyLang}}
9,482

edits