NO

Author Topic: Problem with this partial code from TinyCC  (Read 4790 times)

Offline TimoVJL

  • Global Moderator
  • Member
  • *****
  • Posts: 2115
Problem with this partial code from TinyCC
« on: April 06, 2010, 10:15:43 AM »
Problem with this partial code from TinyCC:
Code: [Select]
#include <stdio.h>

/* WARNING: the content of this string encodes token numbers */
static const unsigned char tok_two_chars[] =
    "<=\236>=\235!=\225&&\240||\241++\244--\242==\224<<\1>>\2+=\253"
    "-=\255*=\252/=\257%=\245&=\246^=\336|=\374->\313..\250##\266";

int main(int argc, char **argv)
{
int i;
for (i=0; i<sizeof(tok_two_chars); i+=3)
printf("%c%c %2X\n", tok_two_chars[i], tok_two_chars[i+1], tok_two_chars[i+2]);
}

/*
<= 9E
>= 9D
!= 95
&& A0
|| A1
++ A4
-- A2
== 94
<<  1
>>  2
+= AB
-= AD
*= AA
/= AF
%= A5
&= A6
^= DE
|= FC
-> CB
.. A8
## B6
 % 63
*/
tok_two_chars_test.c(5): warning #2223: Unable to convert character '\u009e' to codepage 1252; using default character.
tok_two_chars_test.c(5): warning #2223: Unable to convert character '\u0095' to codepage 1252; using default character.
tok_two_chars_test.c(5): warning #2223: Unable to convert character '\u0094' to codepage 1252; using default character.

Portable way to handle that string:
static const unsigned char tok_two_chars[] =
    "<=\x9E>=\x9D!=\x95&&\xA0||\xA1++\xA4--\xA2==\x94<<\x01>>\x02+=\xAB"
    "-=\xAD*=\xAA/=\xAF%=\xA5&=\xA6^=\xDE|=\xFC->\xCB..\xA8##\xB6";
« Last Edit: April 06, 2010, 10:31:25 AM by timovjl »
May the source be with you

Offline AlexN

  • Global Moderator
  • Member
  • *****
  • Posts: 394
    • Alex's Link Sammlung
Re: Problem with this partial code from TinyCC
« Reply #1 on: April 06, 2010, 02:07:19 PM »
Witch version of TinyCC do you use (I get much more error messages with the version 9.25)?

Can you again post, what is necessary to compile TinyCC with Pelles C?

Have you also tried to compile TinyCC for PocketPC?

best regards
 Alex ;)

Offline TimoVJL

  • Global Moderator
  • Member
  • *****
  • Posts: 2115
Re: Problem with this partial code from TinyCC
« Reply #2 on: April 06, 2010, 05:44:04 PM »
Quote
Witch version of TinyCC do you use (I get much more error messages with the version 9.25)?
Many of  them. Now tcc version 0.9.25 ->
http://forum.pellesc.de/index.php?topic=2278.0
I use these defines now: -DNOTALLINONE -D__GNUC__ -DMSVC_COMP
Quote
Can you again post, what is necessary to compile TinyCC with Pelles C?
Just for debugging purboses.
Quote
Have you also tried to compile TinyCC for PocketPC?
Not recently, last time i failed to do that.

Tip:
Code: [Select]
//MsgBox.c
void _start(void)
{
MessageBoxA(0, "Test", "Test", 0);
ExitProcess(0);
}
With plain tcc.exe without any headers/libraries:
tcc.exe MsgBox.c -nostdlib -lkernel32 -luser32
« Last Edit: April 07, 2010, 06:59:30 AM by timovjl »
May the source be with you