I've been working on writing an ANSI escape code interpreter in TI-84 Plus CE C. I had just added a do-while loop to parse a semicolon-separated list, and I came across this compilation error:
Quote:
"[compiling C] src/main.c"
C:\path\to\src\main.c
C:\PATH\TO\SRC\MAIN.C (1331,27) : ERROR (193) Missing "22" detected
C:\PATH\TO\SRC\MAIN.C (1331,27) : ERROR (100) Syntax error
make: *** [obj/main.src] Error -1

Can anybody tell me what that error actually means?
The coordinates are pointing to an if statement that was working fine before, and I can't seem to find a problem anywhere else in the code.

Here's the code:

Code:
////////////////////////////////////////////////////////////////
// { CEsh } { v0.1a }                                         //
// Author: calclover2514                                      //
// License: GPL                                               //
// Description: A (ba)sh-inspired shell for the TI-84 Plus CE //
////////////////////////////////////////////////////////////////



/* Keep these headers */
#include <stdbool.h>
#include <stddef.h>
#include <stdint.h>
#include <tice.h>

/* Standard headers */
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

/* Library headers */
#include <graphx.h>
#include <fontlibc.h>
#include <keypadc.h>

/* Include converted data */
#include "gfx/gfx.h"
#include "fonts/fonts.h"



/* Function declarations */
void fInit();
void fSplash();
void fShell();
void fUnSplash();
void fEnd();
void fGetUserInput(char * msg, bool maskInput, uint16_t offsetX);
void fParseUserInput();
void fParseAndDrawString(const char * string, bool justDraw);



/* Variable declarations */
const char * pCalcName = (char *)0x3B000E;
const char cursors[4] = {129, 130, 128, 95};
char input[257];
char parserData[257];
char path[257];
char calcName[25];
uint8_t textIndex = 0;

uint16_t cursorPos[2] = {2, 2};
bool startOnNewLine = true;
bool underlineText = false;
bool italicText = false;
bool boldText = false;



char user[4] = "Ben";
char pwd[9] = "password";



/* Main code */
int main(void)
{

    /* Initialize program */
    fInit();

    /* Start the shell loop */
    fShell();

    /* End program */
    fEnd();

    return 0;
}



/* Functions */

/* Initialize program */
void fInit() {

    /* Initialize graphics */
    gfx_Begin();

    /* Initialize palette */
    gfx_SetPalette(imgPalette, sizeof_imgPalette, 0);
    gfx_SetTextBGColor(0);
    gfx_SetTextFGColor(7);
    gfx_SetColor(7);

    /* Draw to back buffer */
    gfx_SetDrawBuffer();

    /* Set up font */
    fontlib_SetFont(terminus_font, 0);
    fontlib_SetColors(0x07, 0x00);
    fontlib_SetTransparency(false);
    fontlib_SetLineSpacing(0, 0);
    fontlib_SetWindow(2, 2, 316, 236);
    fontlib_SetNewlineOptions(FONTLIB_ENABLE_AUTO_WRAP | FONTLIB_AUTO_SCROLL | FONTLIB_AUTO_CLEAR_TO_EOL | FONTLIB_PRECLEAR_NEWLINE);
    fontlib_HomeUp();
    fontlib_ClearWindow();

    /* Fill screen */
    gfx_FillScreen(0);

    /* Set up path */
    strcpy(path, "~sdjkfhgifjsdhfk");

    /* Set up calcName */
    strcpy(calcName, pCalcName);

}

/* Main shell loop */
void fShell() {
   
    /* Declare variables */
    uint8_t temp;

    /* Display startup text */
    fontlib_DrawString("CEsh v0.1a - The TI-84 Plus CE terminal");
    fontlib_Newline();
    fontlib_Newline();

    // /* Login prompt */
    // do {

        // fontlib_DrawString(calcName);
        // fGetUserInput(" login: ", false, (strlen(calcName) * 6) + 2);

    // } while (strcmp(input, user) != 0);

    // fontlib_Newline();

    // /* Password prompt */
    // do {

        // fGetUserInput("Password: ", true, 0);

    // } while (strcmp(input, pwd) != 0);

    /* Display startup info */
    fontlib_Newline();
    fontlib_DrawString("Last login: Dow Mon dd hh:mm:ss yyyy");
    fontlib_Newline();
    fontlib_Newline();
    fontlib_DrawString("The programs included with the CE shell are free");
    fontlib_Newline();
    fontlib_DrawString("software; the exact distribution terms for each");
    fontlib_Newline();
    fontlib_DrawString("program are described in their respective README");
    fontlib_Newline();
    fontlib_DrawString("files.");
    fontlib_Newline();
    fontlib_Newline();
    fontlib_DrawString("CEsh comes with ABSOLUTELY NO WARRANTY, to the");
    fontlib_Newline();
    fontlib_DrawString("extent permitted by applicable law.");
    fontlib_Newline();


    /* Main loop */
    do {

        /* Define whether to start the prompt on a new line or not */
        if (startOnNewLine) {

            /* Insert a newline */
            fontlib_Newline();

        } else {

            /* Reset startOnNewLine */
            startOnNewLine = true;

        }

        /* Display colored prompt */
        temp = fontlib_GetForegroundColor();
        fontlib_SetForegroundColor(0x02);
        fParseAndDrawString(user, true);
        fParseAndDrawString("@", true);
        fParseAndDrawString(calcName, true);
        fontlib_SetForegroundColor(temp);
        fParseAndDrawString(":", true);
        fontlib_SetForegroundColor(0x0C);
        fParseAndDrawString(path, true);
        fontlib_SetForegroundColor(temp);

        /* Get user input */
        fGetUserInput("$ ", false, fontlib_GetCursorX());

        /* Parse user input */
        fParseUserInput();

    /* Keep going if user didn't type exit */
    } while (strcmp(input, "exit"));

}

/* End program */
void fEnd() {

    /* End graphics drawing */
    gfx_End();

    /* End the program */
    exit(0);

}

/* Get user input */
void fGetUserInput(char * msg, bool maskInput, uint16_t offsetX) {

    /* Declare variables */
    bool key = false, prevkey = true, done = false;
    uint16_t cursorY = fontlib_GetCursorY();
    int16_t i, j = 0, lineWrap;
    char temp[2] = {0, 0};

    /* Empty output */
    for (i = 0; i <= 256; i++) {
        input[i] = 0;
    }

    /* Reset textIndex */
    textIndex = 3;

    /* Initialize lineWrap with the current X offset plus the width of the cursor */
    lineWrap = offsetX + 6;

    /* Copy buffer to the screen */
    gfx_BlitBuffer();

    do {

        /* Update keyboard data */
        kb_Scan();
        key = kb_Data[1] || kb_Data[2] || kb_Data[3] || kb_Data[4] || kb_Data[5] || kb_Data[6] || kb_Data[7];

        /* Blink Cursor */
        if (j == 0) {

            /* Update screen output w/o cursor */

            /* Loop backwards through wrapped lines and clear everything back to original X offset until redraw */
            for (i = fontlib_GetCursorY(); i >= cursorY; i = i - 12) {
                fontlib_Home();
                if ((i == cursorY) && offsetX) {
                    fontlib_SetCursorPosition(offsetX, fontlib_GetCursorY());
                }
                fontlib_ClearEOL();
                fontlib_SetCursorPosition(fontlib_GetCursorX(), i);
            }

            /* Redraw string */
            fParseAndDrawString(msg, true);

            /* Draw stars if masking input, otherwise output plain text */
            if (maskInput) {

                for (i = 1; i <= strlen(input); i++) {
                    fParseAndDrawString("*", true);
                }

            } else {

                fParseAndDrawString(input, true);

            }

            /* Redraw cursor */
            temp[0] = cursors[textIndex];
            fParseAndDrawString(temp, true);

            /* Copy buffer to the screen */
            gfx_BlitBuffer();

        } else if (j == 500) {

            /* Update screen output w/ cursor */

            /* Loop backwards through wrapped lines and clear everything back to original X offset until redraw */
            for (i = fontlib_GetCursorY(); i >= cursorY; i = i - 12) {
                fontlib_Home();
                if ((i == cursorY) && offsetX) {
                    fontlib_SetCursorPosition(offsetX, fontlib_GetCursorY());
                }
                fontlib_ClearEOL();
                fontlib_SetCursorPosition(fontlib_GetCursorX(), i);
            }

            /* Redraw string */
            fParseAndDrawString(msg, true);

            /* Draw stars if masking input, otherwise output plain text */
            if (maskInput) {

                for (i = 1; i <= strlen(input); i++) {
                    fParseAndDrawString("*", true);
                }

            } else {

                fParseAndDrawString(input, true);

            }

            /* DO NOT REDRAW CURSOR */

            /* Copy buffer to the screen */
            gfx_BlitBuffer();

        } else if (j == 1000) {

            j = -1;

        }

        /* Update j */
        j++;

        /* Update output */
        if (key && !prevkey) {

            /* Parse kb_Data */
            switch (kb_Data[1]) {

                case kb_2nd:
                    if ((textIndex == 2) || (textIndex == 3)) {
                        textIndex = 0;
                    } else if (textIndex == 0) {
                        textIndex = 1;
                    } else if (textIndex == 1) {
                        textIndex = 3;
                    }
                    break;

                case kb_Mode:
                    if (textIndex == 1) {
                        fEnd();
                    }
                    break;

                case kb_Del:
                    if (strlen(input)) {
                        input[strlen(input)-1] = 0;
                        lineWrap = lineWrap - 6;
                    }
                    break;

                default:
                    break;

            }

            switch (kb_Data[2]) {

                case kb_Sto:
                    if ((textIndex == 2) && (strlen(input) < 255)) {
                        input[strlen(input)] = 'X';
                        input[strlen(input)+1] = 0;
                        lineWrap = lineWrap + 6;
                    }
                    if ((textIndex == 3) && (strlen(input) < 255)) {
                        input[strlen(input)] = 'x';
                        input[strlen(input)+1] = 0;
                        lineWrap = lineWrap + 6;
                    }
                    break;

                case kb_Ln:
                    if ((textIndex == 2) && (strlen(input) < 255)) {
                        input[strlen(input)] = 'S';
                        input[strlen(input)+1] = 0;
                        lineWrap = lineWrap + 6;
                    }
                    if ((textIndex == 3) && (strlen(input) < 255)) {
                        input[strlen(input)] = 's';
                        input[strlen(input)+1] = 0;
                        lineWrap = lineWrap + 6;
                    }
                    break;

                case kb_Log:
                    if ((textIndex == 2) && (strlen(input) < 255)) {
                        input[strlen(input)] = 'N';
                        input[strlen(input)+1] = 0;
                        lineWrap = lineWrap + 6;
                    }
                    if ((textIndex == 3) && (strlen(input) < 255)) {
                        input[strlen(input)] = 'n';
                        input[strlen(input)+1] = 0;
                        lineWrap = lineWrap + 6;
                    }
                    break;

                case kb_Square:
                    if ((textIndex == 2) && (strlen(input) < 255)) {
                        input[strlen(input)] = 'I';
                        input[strlen(input)+1] = 0;
                        lineWrap = lineWrap + 6;
                    }
                    if ((textIndex == 3) && (strlen(input) < 255)) {
                        input[strlen(input)] = 'i';
                        input[strlen(input)+1] = 0;
                        lineWrap = lineWrap + 6;
                    }
                    break;

                case kb_Recip:
                    if ((textIndex == 0) && (strlen(input) < 255)) {
                        input[strlen(input)] = '\\';
                        input[strlen(input)+1] = 0;
                        lineWrap = lineWrap + 6;
                    }
                    if ((textIndex == 2) && (strlen(input) < 255)) {
                        input[strlen(input)] = 'D';
                        input[strlen(input)+1] = 0;
                        lineWrap = lineWrap + 6;
                    }
                    if ((textIndex == 3) && (strlen(input) < 255)) {
                        input[strlen(input)] = 'd';
                        input[strlen(input)+1] = 0;
                        lineWrap = lineWrap + 6;
                    }
                    break;

                case kb_Math:
                    if ((textIndex == 2) && (strlen(input) < 255)) {
                        input[strlen(input)] = 'A';
                        input[strlen(input)+1] = 0;
                        lineWrap = lineWrap + 6;
                    }
                    if ((textIndex == 3) && (strlen(input) < 255)) {
                        input[strlen(input)] = 'a';
                        input[strlen(input)+1] = 0;
                        lineWrap = lineWrap + 6;
                    }
                    break;

                case kb_Alpha:
                    if (textIndex != 2) {
                        textIndex = 2;
                    } else {
                        textIndex = 3;
                    }
                    break;

                default:
                    break;

            }

            switch (kb_Data[3]) {

                case kb_0:
                    if ((textIndex == 0) && (strlen(input) < 255)) {
                        input[strlen(input)] = '0';
                        input[strlen(input)+1] = 0;
                        lineWrap = lineWrap + 6;
                    }
                    if ((textIndex == 2) || (textIndex == 3)) {
                        input[strlen(input)] = ' ';
                        input[strlen(input)+1] = 0;
                        lineWrap = lineWrap + 6;
                    }
                    break;

                case kb_1:
                    if ((textIndex == 0) && (strlen(input) < 255)) {
                        input[strlen(input)] = '1';
                        input[strlen(input)+1] = 0;
                        lineWrap = lineWrap + 6;
                    }
                    if ((textIndex == 2) && (strlen(input) < 255)) {
                        input[strlen(input)] = 'Y';
                        input[strlen(input)+1] = 0;
                        lineWrap = lineWrap + 6;
                    }
                    if ((textIndex == 3) && (strlen(input) < 255)) {
                        input[strlen(input)] = 'y';
                        input[strlen(input)+1] = 0;
                        lineWrap = lineWrap + 6;
                    }
                    break;

                case kb_4:
                    if ((textIndex == 0) && (strlen(input) < 255)) {
                        input[strlen(input)] = '4';
                        input[strlen(input)+1] = 0;
                        lineWrap = lineWrap + 6;
                    }
                    if ((textIndex == 2) && (strlen(input) < 255)) {
                        input[strlen(input)] = 'T';
                        input[strlen(input)+1] = 0;
                        lineWrap = lineWrap + 6;
                    }
                    if ((textIndex == 3) && (strlen(input) < 255)) {
                        input[strlen(input)] = 't';
                        input[strlen(input)+1] = 0;
                        lineWrap = lineWrap + 6;
                    }
                    break;

                case kb_7:
                    if ((textIndex == 0) && (strlen(input) < 255)) {
                        input[strlen(input)] = '7';
                        input[strlen(input)+1] = 0;
                        lineWrap = lineWrap + 6;
                    }
                    if ((textIndex == 2) && (strlen(input) < 255)) {
                        input[strlen(input)] = 'O';
                        input[strlen(input)+1] = 0;
                        lineWrap = lineWrap + 6;
                    }
                    if ((textIndex == 3) && (strlen(input) < 255)) {
                        input[strlen(input)] = 'o';
                        input[strlen(input)+1] = 0;
                        lineWrap = lineWrap + 6;
                    }
                    break;

                case kb_Comma:
                    if ((textIndex == 0) && (strlen(input) < 255)) {
                        input[strlen(input)] = ',';
                        input[strlen(input)+1] = 0;
                        lineWrap = lineWrap + 6;
                    }
                    if ((textIndex == 1) && (strlen(input) < 255)) {
                        input[strlen(input)] = '=';
                        input[strlen(input)+1] = 0;
                        lineWrap = lineWrap + 6;
                    }
                    if ((textIndex == 2) && (strlen(input) < 255)) {
                        input[strlen(input)] = 'J';
                        input[strlen(input)+1] = 0;
                        lineWrap = lineWrap + 6;
                    }
                    if ((textIndex == 3) && (strlen(input) < 255)) {
                        input[strlen(input)] = 'j';
                        input[strlen(input)+1] = 0;
                        lineWrap = lineWrap + 6;
                    }
                    break;

                case kb_Sin:
                    if ((textIndex == 2) && (strlen(input) < 255)) {
                        input[strlen(input)] = 'E';
                        input[strlen(input)+1] = 0;
                        lineWrap = lineWrap + 6;
                    }
                    if ((textIndex == 3) && (strlen(input) < 255)) {
                        input[strlen(input)] = 'e';
                        input[strlen(input)+1] = 0;
                        lineWrap = lineWrap + 6;
                    }
                    break;

                case kb_Apps:
                    if ((textIndex == 2) && (strlen(input) < 255)) {
                        input[strlen(input)] = 'B';
                        input[strlen(input)+1] = 0;
                        lineWrap = lineWrap + 6;
                    }
                    if ((textIndex == 3) && (strlen(input) < 255)) {
                        input[strlen(input)] = 'b';
                        input[strlen(input)+1] = 0;
                        lineWrap = lineWrap + 6;
                    }
                    break;

                default:
                    break;

            }

            switch (kb_Data[4]) {

                case kb_DecPnt:
                    if ((textIndex == 0) && (strlen(input) < 255)) {
                        input[strlen(input)] = '.';
                        input[strlen(input)+1] = 0;
                        lineWrap = lineWrap + 6;
                    }
                    if ((textIndex == 1) && (strlen(input) < 255)) {
                        input[strlen(input)] = '!';
                        input[strlen(input)+1] = 0;
                        lineWrap = lineWrap + 6;
                    }
                    if ((textIndex == 2) && (strlen(input) < 255)) {
                        input[strlen(input)] = ':';
                        input[strlen(input)+1] = 0;
                        lineWrap = lineWrap + 6;
                    }
                    if ((textIndex == 3) && (strlen(input) < 255)) {
                        input[strlen(input)] = ';';
                        input[strlen(input)+1] = 0;
                        lineWrap = lineWrap + 6;
                    }
                    break;

                case kb_2:
                    if ((textIndex == 0) && (strlen(input) < 255)) {
                        input[strlen(input)] = '2';
                        input[strlen(input)+1] = 0;
                        lineWrap = lineWrap + 6;
                    }
                    if ((textIndex == 2) && (strlen(input) < 255)) {
                        input[strlen(input)] = 'Z';
                        input[strlen(input)+1] = 0;
                        lineWrap = lineWrap + 6;
                    }
                    if ((textIndex == 3) && (strlen(input) < 255)) {
                        input[strlen(input)] = 'z';
                        input[strlen(input)+1] = 0;
                        lineWrap = lineWrap + 6;
                    }
                    break;

                case kb_5:
                    if ((textIndex == 0) && (strlen(input) < 255)) {
                        input[strlen(input)] = '5';
                        input[strlen(input)+1] = 0;
                        lineWrap = lineWrap + 6;
                    }
                    if ((textIndex == 2) && (strlen(input) < 255)) {
                        input[strlen(input)] = 'U';
                        input[strlen(input)+1] = 0;
                        lineWrap = lineWrap + 6;
                    }
                    if ((textIndex == 3) && (strlen(input) < 255)) {
                        input[strlen(input)] = 'u';
                        input[strlen(input)+1] = 0;
                        lineWrap = lineWrap + 6;
                    }
                    break;

                case kb_8:
                    if ((textIndex == 0) && (strlen(input) < 255)) {
                        input[strlen(input)] = '8';
                        input[strlen(input)+1] = 0;
                        lineWrap = lineWrap + 6;
                    }
                    if ((textIndex == 2) && (strlen(input) < 255)) {
                        input[strlen(input)] = 'P';
                        input[strlen(input)+1] = 0;
                        lineWrap = lineWrap + 6;
                    }
                    if ((textIndex == 3) && (strlen(input) < 255)) {
                        input[strlen(input)] = 'p';
                        input[strlen(input)+1] = 0;
                        lineWrap = lineWrap + 6;
                    }
                    break;

                case kb_LParen:
                    if ((textIndex == 0) && (strlen(input) < 255)) {
                        input[strlen(input)] = '(';
                        input[strlen(input)+1] = 0;
                        lineWrap = lineWrap + 6;
                    }
                    if ((textIndex == 1) && (strlen(input) < 255)) {
                        input[strlen(input)] = '{';
                        input[strlen(input)+1] = 0;
                        lineWrap = lineWrap + 6;
                    }
                    if ((textIndex == 2) && (strlen(input) < 255)) {
                        input[strlen(input)] = 'K';
                        input[strlen(input)+1] = 0;
                        lineWrap = lineWrap + 6;
                    }
                    if ((textIndex == 3) && (strlen(input) < 255)) {
                        input[strlen(input)] = 'k';
                        input[strlen(input)+1] = 0;
                        lineWrap = lineWrap + 6;
                    }
                    break;

                case kb_Cos:
                    if ((textIndex == 2) && (strlen(input) < 255)) {
                        input[strlen(input)] = 'F';
                        input[strlen(input)+1] = 0;
                        lineWrap = lineWrap + 6;
                    }
                    if ((textIndex == 3) && (strlen(input) < 255)) {
                        input[strlen(input)] = 'f';
                        input[strlen(input)+1] = 0;
                        lineWrap = lineWrap + 6;
                    }
                    break;

                case kb_Prgm:
                    if ((textIndex == 2) && (strlen(input) < 255)) {
                        input[strlen(input)] = 'C';
                        input[strlen(input)+1] = 0;
                        lineWrap = lineWrap + 6;
                    }
                    if ((textIndex == 3) && (strlen(input) < 255)) {
                        input[strlen(input)] = 'c';
                        input[strlen(input)+1] = 0;
                        lineWrap = lineWrap + 6;
                    }
                    break;

                default:
                    break;

            }

            switch (kb_Data[5]) {

                case kb_Chs:
                    if ((textIndex == 0) && (strlen(input) < 255)) {
                        input[strlen(input)] = '_';
                        input[strlen(input)+1] = 0;
                        lineWrap = lineWrap + 6;
                    }
                    if ((textIndex == 2) || (textIndex == 3)) {
                        input[strlen(input)] = '?';
                        input[strlen(input)+1] = 0;
                        lineWrap = lineWrap + 6;
                    }
                    break;

                case kb_3:
                    if ((textIndex == 0) && (strlen(input) < 255)) {
                        input[strlen(input)] = '3';
                        input[strlen(input)+1] = 0;
                        lineWrap = lineWrap + 6;
                    }
                    if ((textIndex == 2) || (textIndex == 3)) {
                        input[strlen(input)] = '@';
                        input[strlen(input)+1] = 0;
                        lineWrap = lineWrap + 6;
                    }
                    break;

                case kb_6:
                    if ((textIndex == 0) && (strlen(input) < 255)) {
                        input[strlen(input)] = '6';
                        input[strlen(input)+1] = 0;
                        lineWrap = lineWrap + 6;
                    }
                    if ((textIndex == 2) && (strlen(input) < 255)) {
                        input[strlen(input)] = 'V';
                        input[strlen(input)+1] = 0;
                        lineWrap = lineWrap + 6;
                    }
                    if ((textIndex == 3) && (strlen(input) < 255)) {
                        input[strlen(input)] = 'v';
                        input[strlen(input)+1] = 0;
                        lineWrap = lineWrap + 6;
                    }
                    break;

                case kb_9:
                    if ((textIndex == 0) && (strlen(input) < 255)) {
                        input[strlen(input)] = '9';
                        input[strlen(input)+1] = 0;
                        lineWrap = lineWrap + 6;
                    }
                    if ((textIndex == 2) && (strlen(input) < 255)) {
                        input[strlen(input)] = 'Q';
                        input[strlen(input)+1] = 0;
                        lineWrap = lineWrap + 6;
                    }
                    if ((textIndex == 3) && (strlen(input) < 255)) {
                        input[strlen(input)] = 'q';
                        input[strlen(input)+1] = 0;
                        lineWrap = lineWrap + 6;
                    }
                    break;

                case kb_RParen:
                    if ((textIndex == 0) && (strlen(input) < 255)) {
                        input[strlen(input)] = ')';
                        input[strlen(input)+1] = 0;
                        lineWrap = lineWrap + 6;
                    }
                    if ((textIndex == 1) && (strlen(input) < 255)) {
                        input[strlen(input)] = '}';
                        input[strlen(input)+1] = 0;
                        lineWrap = lineWrap + 6;
                    }
                    if ((textIndex == 2) && (strlen(input) < 255)) {
                        input[strlen(input)] = 'L';
                        input[strlen(input)+1] = 0;
                        lineWrap = lineWrap + 6;
                    }
                    if ((textIndex == 3) && (strlen(input) < 255)) {
                        input[strlen(input)] = 'l';
                        input[strlen(input)+1] = 0;
                        lineWrap = lineWrap + 6;
                    }
                    break;

                case kb_Tan:
                    if ((textIndex == 2) && (strlen(input) < 255)) {
                        input[strlen(input)] = 'G';
                        input[strlen(input)+1] = 0;
                        lineWrap = lineWrap + 6;
                    }
                    if ((textIndex == 3) && (strlen(input) < 255)) {
                        input[strlen(input)] = 'g';
                        input[strlen(input)+1] = 0;
                        lineWrap = lineWrap + 6;
                    }
                    break;

                default:
                    break;

            }

            switch (kb_Data[6]) {

                case kb_Enter:
                    done = true;
                    break;

                case kb_Add:
                    if ((textIndex == 0) && (strlen(input) < 255)) {
                        input[strlen(input)] = '+';
                        input[strlen(input)+1] = 0;
                        lineWrap = lineWrap + 6;
                    }
                    if ((textIndex == 2) && (strlen(input) < 255)) {
                        input[strlen(input)] = '\'';
                        input[strlen(input)+1] = 0;
                        lineWrap = lineWrap + 6;
                    }
                    if ((textIndex == 3) && (strlen(input) < 255)) {
                        input[strlen(input)] = '"';
                        input[strlen(input)+1] = 0;
                        lineWrap = lineWrap + 6;
                    }
                    break;

                case kb_Sub:
                    if ((textIndex == 0) && (strlen(input) < 255)) {
                        input[strlen(input)] = '-';
                        input[strlen(input)+1] = 0;
                        lineWrap = lineWrap + 6;
                    }
                    if ((textIndex == 1) && (strlen(input) < 255)) {
                        input[strlen(input)] = ']';
                        input[strlen(input)+1] = 0;
                        lineWrap = lineWrap + 6;
                    }
                    if ((textIndex == 2) && (strlen(input) < 255)) {
                        input[strlen(input)] = 'W';
                        input[strlen(input)+1] = 0;
                        lineWrap = lineWrap + 6;
                    }
                    if ((textIndex == 3) && (strlen(input) < 255)) {
                        input[strlen(input)] = 'w';
                        input[strlen(input)+1] = 0;
                        lineWrap = lineWrap + 6;
                    }
                    break;

                case kb_Mul:
                    if ((textIndex == 0) && (strlen(input) < 255)) {
                        input[strlen(input)] = '*';
                        input[strlen(input)+1] = 0;
                        lineWrap = lineWrap + 6;
                    }
                    if ((textIndex == 1) && (strlen(input) < 255)) {
                        input[strlen(input)] = '[';
                        input[strlen(input)+1] = 0;
                        lineWrap = lineWrap + 6;
                    }
                    if ((textIndex == 2) && (strlen(input) < 255)) {
                        input[strlen(input)] = 'R';
                        input[strlen(input)+1] = 0;
                        lineWrap = lineWrap + 6;
                    }
                    if ((textIndex == 3) && (strlen(input) < 255)) {
                        input[strlen(input)] = 'r';
                        input[strlen(input)+1] = 0;
                        lineWrap = lineWrap + 6;
                    }
                    break;

                case kb_Div:
                    if ((textIndex == 0) && (strlen(input) < 255)) {
                        input[strlen(input)] = '/';
                        input[strlen(input)+1] = 0;
                        lineWrap = lineWrap + 6;
                    }
                    if ((textIndex == 1) && (strlen(input) < 255)) {
                        input[strlen(input)] = '&';
                        input[strlen(input)+1] = 0;
                        lineWrap = lineWrap + 6;
                    }
                    if ((textIndex == 2) && (strlen(input) < 255)) {
                        input[strlen(input)] = 'M';
                        input[strlen(input)+1] = 0;
                        lineWrap = lineWrap + 6;
                    }
                    if ((textIndex == 3) && (strlen(input) < 255)) {
                        input[strlen(input)] = 'm';
                        input[strlen(input)+1] = 0;
                        lineWrap = lineWrap + 6;
                    }
                    break;

                case kb_Power:
                    if ((textIndex == 0) && (strlen(input) < 255)) {
                        input[strlen(input)] = '^';
                        input[strlen(input)+1] = 0;
                        lineWrap = lineWrap + 6;
                    }
                    if ((textIndex == 1) && (strlen(input) < 255)) {
                        input[strlen(input)] = '|';
                        input[strlen(input)+1] = 0;
                        lineWrap = lineWrap + 6;
                    }
                    if ((textIndex == 2) && (strlen(input) < 255)) {
                        input[strlen(input)] = 'H';
                        input[strlen(input)+1] = 0;
                        lineWrap = lineWrap + 6;
                    }
                    if ((textIndex == 3) && (strlen(input) < 255)) {
                        input[strlen(input)] = 'h';
                        input[strlen(input)+1] = 0;
                        lineWrap = lineWrap + 6;
                    }
                    break;

                case kb_Clear:
                    for (i = 0; i <= 256; i++) {
                        input[i] = 0;
                    }
                    lineWrap = offsetX + 6;
                    break;

                default:
                    break;

            }

            switch (kb_Data[7]) {

                case kb_Down:
                    break;

                case kb_Up:
                    break;

                default:
                    break;

            }

            /* Immediately update screen output on input string changed */

            /* Update lineWrap and cursorY (prevents fontlib's autoscroll) */
            if ((lineWrap >= 308) && (fontlib_GetCursorY() >= 218)) {

                lineWrap = 0;
                cursorY = cursorY - 12;

                /* Manually scroll the window */
                fontlib_ScrollWindowDown();
            }

            if (lineWrap >= 308) lineWrap = 0;

            /* Loop backwards through wrapped lines and clear everything back to original X offset until redraw */
            for (i = fontlib_GetCursorY(); i >= cursorY; i = i - 12) {
                fontlib_Home();
                if ((i == cursorY) && offsetX) {
                    fontlib_SetCursorPosition(offsetX, fontlib_GetCursorY());
                }
                fontlib_ClearEOL();
                fontlib_SetCursorPosition(fontlib_GetCursorX(), i);
            }

            /* Redraw string */
            fParseAndDrawString(msg, true);

            /* Draw stars if masking input, otherwise output plain text */
            if (maskInput) {

                for (i = 1; i <= strlen(input); i++) {
                    fParseAndDrawString("*", true);
                }

            } else {

                fParseAndDrawString(input, true);

            }

            /* Redraw cursor */
            if (j < 500) {

                temp[0] = cursors[textIndex];
                fParseAndDrawString(temp, true);

            }

            /* Copy buffer to the screen */
            gfx_BlitBuffer();

        }

        /* Update prevkey */
        prevkey = key;

    } while (!done);

    /* When user hits enter, update screen output without cursor */

    /* Loop backwards through wrapped lines and clear everything back to original X offset until redraw */
    for (i = fontlib_GetCursorY(); i >= cursorY; i = i - 12) {
        fontlib_Home();
        if ((i == cursorY) && offsetX) {
            fontlib_SetCursorPosition(offsetX, fontlib_GetCursorY());
        }
        fontlib_ClearEOL();
        fontlib_SetCursorPosition(fontlib_GetCursorX(), i);
    }

    /* Redraw string */
    fParseAndDrawString(msg, true);

    /* Draw stars if masking input, otherwise output plain text */
    if (maskInput) {

        for (i = 1; i <= strlen(input); i++) {
            fParseAndDrawString("*", true);
        }

    } else {

        fParseAndDrawString(input, true);

    }

    /* DO NOT REDRAW CURSOR */

    /* Copy buffer to the screen */
    gfx_BlitBuffer();

}

/* Parse user input */
void fParseUserInput() {

    /* Declare variables */
    uint16_t i;
    char * ptr, * lastArg;
    size_t p, q;

    /* Split input into args */
    ptr = strtok(input, " ");

    while (ptr != NULL) {

      ptr = strtok(NULL, " ");

        if (ptr != NULL) {
            lastArg = ptr;
        }

   }

    /* Parse commands */

    /* Command: echo */
    if (!strcmp(input, "echo")) {

        fontlib_Newline();
        fParseAndDrawString(&input[5], false);
        startOnNewLine = false;

    /* If not a built-in command and not empty */
    } else if ((strcmp(input, "")) && (input[0] != ' ') && (input[0] != 0)) {

        fontlib_Newline();
        fParseAndDrawString(input, true);
        fParseAndDrawString(": command not found", true);

    }

    /* Copy buffer to the screen */
    gfx_BlitBuffer();

}

/* Parse strings */
void fParseAndDrawString(const char * string, bool justDraw) {

    /* Declare variables */
    uint16_t i, j;
    uint8_t k, l;
    char temp[2];
    bool displayNextChar;
    uint8_t cursorY;

    /* Empty input */
    for (i = 0; i <= 256; i++) {
        parserData[i] = 0;
    }

    /* Put null terminator in temp */
    temp[1] = 0;

    displayNextChar = true;

    /* Copy string into parserData */
    strcpy(parserData, string);

    /* Only run if we are parsing the string */
    if (!justDraw) {
   
        /* If the string has quotes, remove them, otherwise, stay the same */
        if (parserData[0] == '"') {
   
            for (i = 1; i < strlen(parserData); i++) {
   
                if ((parserData[i] == '"') && (parserData[i - 1] != '\\')) {
                    parserData[i] = 0;
                    break;
                }
   
            }
   
            memmove(&parserData[0], &parserData[1], strlen(parserData));
   
        } else if (parserData[0] == '\'') {
   
            for (i = 1; i < strlen(parserData); i++) {
   
                if ((parserData[i] == '\'') && (parserData[i - 1] != '\\')) {
                    parserData[i] = 0;
                    break;
                }
   
            }
   
            memmove(&parserData[0], &parserData[1], strlen(parserData));
   
        }
       
    }

    /* Begin displaying and parsing actual string */
    for (i = 0; i < 256; i++) {

        /* Only run if we are parsing the string */
        if (!justDraw) {
               
            /* Parse backslash-escaped characters */
            if (parserData[i] == '\\') {
   
                /* Parse \\, \", and \' by not displaing the backslash */
                if ((parserData[i + 1] == '\'') || (parserData[i + 1] == '"') || (parserData[i + 1] == '\\')) {
                    i++;
                }
   
                /* Parse \b */
                if (parserData[i + 1] == 'b') {
   
                    /* Delete backspaced character */
                    parserData[i - 1] = 0;
   
                    /* Shift string 3 chars to the left to remove backspaced character and \b */
                    memmove(&parserData[i - 1], &parserData[i + 2], strlen(&parserData[i + 2]) + 1);
   
                    /* Reset fontlib's cursor position */
                    fontlib_SetCursorPosition(fontlib_GetCursorX() - 6, fontlib_GetCursorY());
   
                    /* Don't display characters until next parser check */
                    displayNextChar = false;
   
                    /* Move i back as if the deleted character didn't exist in the first place */
                    i = i - 2;
   
                }
   
                /* Parse \e[ */
                if ((parserData[i + 1] == 'e') && (parserData[i + 2] == '[')) {
   
                    /* Loop through remaining characters until a letter is encountered, then break */
                    /* This leaves j as the index in the array of the first letter in the escape code */
                    /* As the letter in an ANSI escape code is always last, this is the end of the code */
                    for (j = i + 3; j < 256; j++) {
                        if (((parserData[j] >= 65) && (parserData[j] <= 90)) || ((parserData[j] >= 97) && (parserData[j] <= 122))) break;
                    }
   
                    l = j + 2;
                   
                    do {
                       
                        /* Reset l */
                        l = j - 2;
                       
                        if (parserData[l - 1] == ';') {
                            l--;
                        }
   
                        /* Handle clearing parts of/the whole screen */
                        if (parserData[j] == 'J') {
       
                            /* Clear the whole screen */
                            if (parserData[j - 1] == '2') {
       
                                fontlib_ClearWindow();
       
                            }
       
                        }
       
                        /* Handle text styling */
                        if (parserData[j] == 'm') {
                           
                            /* Reset text attributes */
                            if ((parserData[l - 1] == '[') || (parserData[l - 1] == '0')) {
                                fontlib_SetColors(0x07, 0x00);
                                fontlib_SetFont(terminus_font, 0);
                                underlineText = false;
                                italicText = false;
                                boldText = false;
                            }
                           
                            /* Enable bold text */
                            if (parserData[l - 1] == '1') {
                                if (italicText) {
                                    fontlib_SetFont(terminus_font_bold_italic, 0);
                                } else {
                                    fontlib_SetFont(terminus_font_bold, 0);
                                }
                                boldText = true;
                            }
                           
                            /* Enable italic text */
                            if (parserData[l - 1] == '3') {
                                if (boldText) {
                                    fontlib_SetFont(terminus_font_bold_italic, 0);
                                } else {
                                    fontlib_SetFont(terminus_font_italic, 0);
                                }
                                italicText = true;
                            }
                           
                            /* Enable underlined text */
                            if (parserData[l - 1] == '4') {
                                underlineText = true;
                            }
                           
                            /* Enable reverse video */
                            if (parserData[l - 1] == '7') {
                                k = fontlib_GetForegroundColor();
                                fontlib_SetForegroundColor(fontlib_GetBackgroundColor());
                                fontlib_SetBackgroundColor(k);
                            }
                           
                            /* Enable concealed text */
                            if (parserData[l - 1] == '8') {
                                fontlib_SetForegroundColor(fontlib_GetBackgroundColor());
                            }}
                           
                            /* Enable colored foreground text */
                            if ((parserData[l - 2] == '3') && (parserData[l - 1] == '0')) {
                                fontlib_SetForegroundColor(0x00);
                            }
                            if ((parserData[l - 2] == '3') && (parserData[l - 1] == '1')) {
                                fontlib_SetForegroundColor(0x01);
                            }
                            if ((parserData[l - 2] == '3') && (parserData[l - 1] == '2')) {
                                fontlib_SetForegroundColor(0x02);
                            }
                            if ((parserData[l - 2] == '3') && (parserData[l - 1] == '3')) {
                                fontlib_SetForegroundColor(0x03);
                            }
                            if ((parserData[l - 2] == '3') && (parserData[l - 1] == '4')) {
                                fontlib_SetForegroundColor(0x04);
                            }
                            if ((parserData[l - 2] == '3') && (parserData[l - 1] == '5')) {
                                fontlib_SetForegroundColor(0x05);
                            }
                            if ((parserData[l - 2] == '3') && (parserData[l - 1] == '6')) {
                                fontlib_SetForegroundColor(0x06);
                            }
                            if ((parserData[l - 2] == '3') && (parserData[l - 1] == '7')) {
                                fontlib_SetForegroundColor(0x07);
                            }
                           
                            /* Enable colored background text */
                            if ((parserData[l - 2] == '4') && (parserData[l - 1] == '0')) {
                                fontlib_SetBackgroundColor(0x00);
                            }
                            if ((parserData[l - 2] == '4') && (parserData[l - 1] == '1')) {
                                fontlib_SetBackgroundColor(0x01);
                            }
                            if ((parserData[l - 2] == '4') && (parserData[l - 1] == '2')) {
                                fontlib_SetBackgroundColor(0x02);
                            }
                            if ((parserData[l - 2] == '4') && (parserData[l - 1] == '3')) {
                                fontlib_SetBackgroundColor(0x03);
                            }
                            if ((parserData[l - 2] == '4') && (parserData[l - 1] == '4')) {
                                fontlib_SetBackgroundColor(0x04);
                            }
                            if ((parserData[l - 2] == '4') && (parserData[l - 1] == '5')) {
                                fontlib_SetBackgroundColor(0x05);
                            }
                            if ((parserData[l - 2] == '4') && (parserData[l - 1] == '6')) {
                                fontlib_SetBackgroundColor(0x06);
                            }
                            if ((parserData[l - 2] == '4') && (parserData[l - 1] == '7')) {
                                fontlib_SetBackgroundColor(0x07);
                            }
       
                        }
       
                        /* Save current cursor location */
                        if (parserData[j] == 's') {
                            cursorPos[0] = fontlib_GetCursorX();
                            cursorPos[1] = fontlib_GetCursorY();
                        }
       
                        /* Load saved cursor location */
                        if (parserData[j] == 'u') {
                            fontlib_SetCursorPosition(cursorPos[0], cursorPos[1]);
                        }
   
                    } while (l > i + 2);
   
                    /* Set i to the correct value so we don't skip/display unwanted characters */
                    i = j + 1;
                   
                    if (parserData[i] == '\\') {
                        i--;
                        displayNextChar = false;
                    }
   
                }
   
            }
           
        }

        if (parserData[i] == 0) break;

        /* Output next character */
        if (displayNextChar) {

            temp[0] = parserData[i];
            fontlib_DrawString(temp);

            if (underlineText) {
                gfx_SetColor(fontlib_GetForegroundColor());
                gfx_HorizLine(fontlib_GetCursorX() - 6, fontlib_GetCursorY() + 10, 6);
            }

        } else {

            displayNextChar = true;

        }

    }

}
Line 1274 has two close braces.


Code:
}}
MateoConLechuga wrote:
Line 1274 has two close braces.


Code:
}}

Gotta love dyslexia Razz
Thanks
  
Register to Join the Conversation
Have your own thoughts to add to this or any other topic? Want to ask a question, offer a suggestion, share your own programs and projects, upload a file to the file archives, get help with calculator and computer programming, or simply chat with like-minded coders and tech and calculator enthusiasts via the site-wide AJAX SAX widget? Registration for a free Cemetech account only takes a minute.

» Go to Registration page
Page 1 of 1
» All times are UTC - 5 Hours
 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

 

Advertisement