void screen_write_input (const zchar *buf, zchar key) { int width; if (units_left () < (width = os_string_width (buf))) screen_new_line (); os_display_string (buf); cwp->x_cursor += width; if (key == ZC_RETURN) screen_new_line (); }/* screen_write_input */
void screen_char (zchar c) { int width; if (discarding) return; if (c == ZC_INDENT && cwp->x_cursor != cwp->left + 1) c = ' '; if (units_left () < (width = os_char_width (c))) { if (!enable_wrapping) { cwp->x_cursor = cwp->x_size - cwp->right; return; } screen_new_line (); } os_display_char (c); cwp->x_cursor += width; }/* screen_char */
/* * screen_mssg_off * * Stop printing a "debugging" message. * */ void screen_mssg_off (void) { if (cwin == 0) { /* messages in window 0 only */ screen_new_line (); refresh_text_style (); } else discarding = FALSE; /* message has been discarded */ }/* screen_mssg_off */
void Processor::stream_new_line() { if (ostream_memory && !message) memory_new_line(); else { if (ostream_screen) screen_new_line(); if (ostream_script && enable_scripting) script_new_line(); if (enable_scripting) os_scrollback_char ('\n'); } }
/* * screen_mssg_on * * Start printing a so-called debugging message. The contents of the * message are passed to the message stream, a Frotz specific output * stream with maximum priority. * */ void screen_mssg_on (void) { if (cwin == 0) { /* messages in window 0 only */ os_set_text_style (0); if (cwp->x_cursor != cwp->left + 1) screen_new_line (); screen_char (ZC_INDENT); } else discarding = TRUE; /* discard messages in other windows */ }/* screen_mssg_on */
zchar console_read_input (int max, zchar *buf, zword timeout, bool continued) { zchar key; int i; /* Make sure there is some space for input */ if (cwin == 0 && units_left () + os_string_width (buf) < 10 * font_width) screen_new_line (); /* Make sure the input line is visible */ if (continued && input_redraw) screen_write_input (buf, -1); input_window = cwin; input_redraw = FALSE; /* Get input line from IO interface */ cwp->x_cursor -= os_string_width (buf); key = os_read_line (max, buf, timeout, units_left (), continued); cwp->x_cursor += os_string_width (buf); if (key != ZC_TIME_OUT) for (i = 0; i < 8; i++) wp[i].line_count = 0; /* Add a newline if the input was terminated normally */ if (key == ZC_RETURN) screen_new_line (); return key; }/* console_read_input */
/* * screen_word * * Display a string of characters on the screen. If the word doesn't fit * then use wrapping or clipping depending on the current setting of the * enable_wrapping flag. * */ void screen_word (const zchar *s) { int width; if (discarding) return; if (*s == ZC_INDENT && cwp->x_cursor != cwp->left + 1) screen_char (*s++); if (units_left () < (width = os_string_width (s))) { if (!enable_wrapping) { zchar c; while ((c = *s++) != 0) if (c == ZC_NEW_FONT || c == ZC_NEW_STYLE) { int arg = (int) *s++; if (c == ZC_NEW_FONT) os_set_font (arg); if (c == ZC_NEW_STYLE) os_set_text_style (arg); } else screen_char (c); return; } if (*s == ' ' || *s == ZC_INDENT || *s == ZC_GAP) width = os_string_width (++s); #ifdef AMIGA if (cwin == 0) Justifiable (); #endif screen_new_line (); } os_display_string (s); cwp->x_cursor += width; }/* screen_word */
void stream_new_line (void) { if (ostream_memory && !message) memory_new_line (); else { if (ostream_screen) screen_new_line (); if (ostream_script && enable_scripting) script_new_line (); } }/* stream_new_line */