Example #1
0
/*
 * flush_buffer
 *
 * Copy the contents of the text buffer to the output streams.
 *
 */
void flush_buffer (void)
{
    static bool locked = FALSE;

    /* Make sure we stop when flush_buffer is called from flush_buffer.
       Note that this is difficult to avoid as we might print a newline
       during flush_buffer, which might cause a newline interrupt, that
       might execute any arbitrary opcode, which might flush the buffer. */

    if (locked || bufpos == 0)
	return;

    /* Send the buffer to the output streams */

    buffer[bufpos] = 0;


    locked = TRUE;

    if (islua_play) {
        // DREW: pass the current word to the lua
        lua_getglobal(L, "appendState");                 /* Tell it to run callfuncscript.lua->square() */
        lua_pushstring(L, buffer);                       /* Submit 6 as the argument to square() */
        if (lua_pcall(L, 1, 0, 0))                  /* Run function, !!! NRETURN=1 !!! */
            bail(L, "lua_pcall() failed");
    }
    
    // ERMO: this put word on screen
    stream_word (buffer);


#ifdef SPEECH_OUTPUT
    os_speech_output(buffer);
#endif

    locked = FALSE;

    /* Reset the buffer */

    bufpos = 0;
    prev_c = 0;

}/* flush_buffer */
Example #2
0
void flush_buffer (void)
{
    /* Make sure we stop when flush_buffer is called from flush_buffer.
       Note that this is difficult to avoid as we might print a newline
       during flush_buffer, which might cause a newline interrupt, that
       might execute any arbitrary opcode, which might flush the buffer. */

    if (locked || bufpos == 0)
	return;

    /* Send the buffer to the output streams */

    buffer[bufpos] = 0;

    locked = TRUE; stream_word (buffer); locked = FALSE;

    /* Reset the buffer */

    bufpos = 0;
    prev_c = 0;

}/* flush_buffer */