Hello Cemetech,

It's been a while ... I have been working on Oxygen's input routine and need some help / explanations. I have currently set up the basic functionality of text and number input. But I also want to input math characters like basic operations (+, -, /, *, ^ , `,`) and parenthesis. Could someone point me to documentation or whatnot? I'll be extremely grateful.

Current (character encoding) code:


Code:

// Keys[0] = Upper Case Alpha | Keys[1] = Lower Case Alpha | Key[2] = Numerical
const char *keys[3] = {"\0\0\0\0\0\0\0\0\0\0\0WRMH\0\0?\0VQLG\0\0.ZUPKFC\0 YTOJEB\0\0XSNIDA\0\0\0\0\0\0\0\0\0",
                     "\0\0\0\0\0\0\0\0\0\0\0wrmh\0\0?\0vqlg\0\0.zupkfc\0 ytojeb\0\0xsnida\0\0\0\0\0\0\0\0\0",
                     "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0-\x33\x36\x39)\0\0\0.\x32\x35\x38(\0\0\0\x30\x31\x34\x37,\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"};

// ... Keystrokes code below


I am assuming that I should change the string encoding on the Key[2] but to what exactly, I don't know where to find font encoding and where to look?
Assuming this is for C strings and not tokens, you can type most characters directly into the string (The only ones you need to worry about are really '\' and numbers, and even then the numbers are only an issue if you started an escape sequence with '\' already.
If you do need to encode more characters, you could check an ASCII table, such as one on this page: https://en.wikipedia.org/wiki/ASCII
Minxrod wrote:
Assuming this is for C strings and not tokens, you can type most characters directly into the string (The only ones you need to worry about are really '\' and numbers, and even then the numbers are only an issue if you started an escape sequence with '\' already.
If you do need to encode more characters, you could check an ASCII table, such as the one on this page: https://en.wikipedia.org/wiki/ASCII


Thank you! I assumed it was ASCII characters but thought it would be encoded differently because it was the TI-84PCE.

I came up with a temporary fix:


Code:

if (oxy_stringinput.type == 2 && oxy_stringinput.charsamount - 1 != oxy_stringinput.max_char)
{
    char* append_str = NULL;

    switch (skKey)
    {
    case sk_Add:
        append_str = "+";
        break;

    case sk_Sub:
        append_str = "-";
        break;

    case sk_Div:
        append_str = "/";
        break;

    case sk_Mul:
        append_str = "*";
        break;

    case sk_Comma:
        append_str = ",";
        break;

    case sk_LParen:
        append_str = "(";
        break;

    case sk_RParen:
        append_str = ")";
        break;

    case sk_Sin:
        append_str = "Sin(";
        break;
    case sk_Cos:
        append_str = "Cos(";
        break;
    case sk_Tan:
        append_str = "Tan(";
        break;
    case sk_Recip:
        append_str = "^-1";
        break;
    case sk_Square:
        append_str = "^2";
        break;
    case sk_Log:
        append_str = "Log(";
        break;
    case sk_Ln:
        append_str = "Ln(";
        break;

    case sk_Power:
        append_str = "^";
        break;
    }

    if (append_str)
    {
        oxy_stringinput.charsamount += strlen(append_str);
        strcat(oxy_stringinput.text, append_str);
    }
}
  
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