Esempio n. 1
0
void BSODPrint(const char *aLine)
{
    if (G_bsodActive) {
        swim_put_text(&G_bsodWin, aLine);
        swim_put_newline(&G_bsodWin);
    }
}
/* Puts a string of text in a window with breaks */
void swim_put_ltext(SWIM_WINDOW_T *win,
					const CHAR *text)
{
	int32_t i = 0;

	/* Continue until the entire string is output */
	while (text[i] != '\0') {
		if (text[i] == '\n') {
			swim_put_newline(win);
			i++;
		}
		else if (((uint8_t) text[i] >= win->font->first_char)
				 && ((uint8_t) text[i] <= win->font->last_char)) {
			/* Check for entire words first */
			if (((uint8_t) text[i] > ' ') && ((uint8_t) text[i] <= 0x7E)) {
				/* Put entire word on screen */
				i = i + swim_put_word(win, &text[i]);
			}
			else {
				swim_put_char(win, text[i]);
				i++;
			}
		}
		else {
			/* Put a space out */
			swim_put_char(win, ' ');
			i++;
		}
	}
}
Esempio n. 3
0
/***********************************************************************
 *
 * Function: swim_put_text
 *
 * Purpose: Puts a string of text in a window
 *
 * Processing:
 *     Each character will be routed to the swim_put_char function until
 *     a string terminator is reached. For newline characters, a newline
 *     will occur instead of a character output.
 *
 * Parameters:
 *     win  : Window identifier
 *     text : Text string to output in window
 *
 * Outputs: None
 *
 * Returns: Nothing
 *
 * Notes:  None
 *
 **********************************************************************/
void swim_put_text(SWIM_WINDOW_T *win, const CHAR *text)
{
    INT_32 i = 0;

    /* Continue until the entire string is output */
    while (text[i] != '\0') {
        if (text[i] == '\n') {
            swim_put_newline(win);
        } else if (((UNS_8)text[i] >= win->font->first_char)
            && ((UNS_8)text[i] <= win->font->last_char)) {
            /* Put character on screen */
            swim_put_char(win, text[i]);
        }

        i++;
    }
}
Esempio n. 4
0
/***********************************************************************
 *
 * Function: swim_put_word
 *
 * Purpose: Puts a word in the window, but adds a newline to keep the
 *          word contiguous (without an edge break) if necessary.
 *
 * Processing:
 *     The first word in the string (up to the first whitespace
 *     character) has its total length (based on font) computed and
 *     compared to the right window edge. If the length exceeds the
 *     window edge, a newline occurs and then the word is output.
 *
 * Parameters:
 *     win  : Window identifier
 *     text : Text string to output in window
 *
 * Outputs:  None
 *
 * Returns: The number of characters output to the display.
 *
 * Notes: None
 *
 **********************************************************************/
INT_32 swim_put_word(SWIM_WINDOW_T *win, const CHAR *text)
{
    INT_32 i;

    /* Will the length of the next word exceed the window margin? */
    if ((swim_get_word_len(win, text) + win->xvpos) > win->xpvmax) {
        /* Do a newline */
        swim_put_newline(win);
    }

    /* Put just the word characters on the display up to the next
     non-whitespace character or the end of the string */
    i = 0;
    while (((UNS_8)text[i] > ' ') && ((UNS_8)text[i] <= 0x7E)) {
        swim_put_char(win, text[i]);
        i++;
    }

    return i;
}
/* Puts a single character in the window */
void swim_put_char(SWIM_WINDOW_T *win,
				   const CHAR textchar)
{
	int32_t i, j;
	int32_t charindex;
	uint16_t *charfields, chardata;
	COLOR_T *fb;

	/* If this is a carriage return, do a newline */
	if (textchar == '\n') {
		swim_put_newline(win);
	}
	else {
		/* Determine index to character data */
		charindex = (int32_t) textchar - (int32_t) win->font->first_char;

		/* Will the character fit on the display? */
		if ((win->xvpos +
			 (int32_t) win->font->font_width_table[charindex]) >
			win->xpvmax) {
			/* Will not fit, do a newline */
			swim_put_newline(win);
		}

		/* Determine the start of the bitfields for the character */
		charfields = win->font->font_table + (charindex *
											  win->font->font_height);

		/* Map character to the window */
		for (i = 0; i < (int32_t) win->font->font_height; i++) {
			/* Get starting pixel location for font mapping in window */
			fb = win->fb + win->xvpos + ((win->yvpos + i) * win->xpsize);

			/* Get character line mapping data */
			chardata = charfields[i];

			/* Convert character line bit data to a pixel line in
			   window */
			for (j =
					 (int32_t) win->font->font_width_table[charindex];
				 j > 0; j--) {
				if ((chardata & 0x8000) != 0) {
					*fb++ = win->pen;
				}
				else if (win->tfont != 0) {
					*fb++ = win->bkg;
				}
				else {
					fb++;
				}

				/* Next bit in character line */
				chardata = chardata << 1;
			}
		}

		/* Increment to next text location */
		win->xvpos = win->xvpos +
					 (int32_t) win->font->font_width_table[charindex];
	}
}
Esempio n. 6
0
/***********************************************************************
 *
 * Function: swim_put_char
 *
 * Purpose: Puts a character in the window.
 *
 * Processing:
 *     See function.
 *
 * Parameters:
 *     win      : Window identifier
 *     textchar : Text string to output in window
 *
 * Outputs: None
 *
 * Returns: Nothing
 *
 * Notes: None
 *
 **********************************************************************/
void swim_put_char(SWIM_WINDOW_T *win, const CHAR textchar)
{
    INT_32 i, j, jMax, kMax, drawChar = 1;
    INT_32 charindex;
    const UNS_16 *charfields;
    UNS_16 chardata;
    UNS_16 x;

    /* If this is a carriage return, do a newline */
    if (textchar == '\n') {
        swim_put_newline(win);
    } else {
        /* Determine index to character data */
        charindex = (INT_32)textchar - (INT_32)win->font->first_char;

        /* Will the character fit on the display? */
        if ((win->xvpos + (INT_32)win->font->font_width_table[charindex])
            > win->xpvmax) {
            /* Will not fit, do a newline */
            swim_put_newline(win);
        }

        /* Determine the start of the bitfields for the character */
        if (win->font->font_start_table == NULL)
            charfields = win->font->font_table
                + (charindex * win->font->font_height);
        else
            charfields = win->font->font_table
                + (win->font->font_start_table[charindex]
                    * win->font->font_height);

        /* Map character to the window */
        for (i = 0; i < (INT_32)win->font->font_height; i++) {
            /* Get character line mapping data */
            if (win->font->font_width_table[charindex] == 0)
                jMax = 0;
            else {
                if (win->font->font_start_table == NULL)
                    jMax = (INT_32)((win->font->font_width_table[charindex] - 1)
                        >> 4);
                else {
                    if ((win->font->font_width_table[charindex])
                        >= (((win->font->font_start_table[charindex + 1])
                            - (win->font->font_start_table[charindex])) << 4)) {
                        // character is officially wider than what is stored in the font table; this can happen for example for the space (' ') character
                        if (((win->font->font_start_table[charindex + 1])
                            - (win->font->font_start_table[charindex])) > 0)
                            jMax =
                                (INT_32)((win->font->font_start_table[charindex
                                    + 1])
                                    - (win->font->font_start_table[charindex]))
                                    - 1;
                        else {
                            jMax = 0;
                            drawChar = 0; // we don't have any information stored in the table, so don't draw
                        }
                    } else
                        jMax = (INT_32)((win->font->font_width_table[charindex]
                            - 1) >> 4);
                }
            }
            for (j = 0, x = win->xvpos; (j <= jMax) && (drawChar); j++) {
                chardata = charfields[i * (jMax + 1) + j];

                if (j < jMax)
                    kMax = 16;
                else
                    kMax = (win->font->font_width_table[charindex] - j * 16);

                /* Convert character line bit data to a pixel line in
                 window */
                if (win->tfont)
                    swim_driver_put_transparent_bit_pattern(win, x,
                        win->yvpos + i, ((UNS_32)chardata) << 16, kMax);
                else
                    swim_driver_put_opaque_bit_pattern(win, x, win->yvpos + i,
                        ((UNS_32)chardata) << 16, kMax);
                x += 16;
            }
        }

        /* Increment to next text location */
        win->xvpos = win->xvpos
            + (INT_32)win->font->font_width_table[charindex];
    }