osdk Syntax error in C compilation : MULI_CCD(3,-1,tmp0)

Questions, bug reports, features requests, ... about the Oric Software Development Kit. Please indicate clearly in the title the related element (OSDK for generic questions, PictConv, FilePack, XA, Euphoric, etc...) to make it easy to locate messages.

User avatar
waskol
Flight Lieutenant
Posts: 414
Joined: Wed Jun 13, 2007 8:20 pm
Location: FRANCE, Paris

osdk Syntax error in C compilation : MULI_CCD(3,-1,tmp0)

Post by waskol »

When compiling a C program I got a Syntax Error at the Assembling step.

It complains about a macro in the generated .s file.

The fact is that in MACRO.H, I do not see this macro anywhere.
Do you have an Idea how we could correct this bad bug ?

thank you
User avatar
Chema
Game master
Posts: 3014
Joined: Tue Jan 17, 2006 10:55 am
Location: Gijón, SPAIN
Contact:

Re: osdk Syntax error in C compilation : MULI_CCD(3,-1,tmp0

Post by Chema »

waskol wrote:When compiling a C program I got a Syntax Error at the Assembling step.

It complains about a macro in the generated .s file.

The fact is that in MACRO.H, I do not see this macro anywhere.
Do you have an Idea how we could correct this bad bug ?

thank you
There are several missing macros. Maybe there is something in the documentation of the compiler, at least about what the macro should do, so we could write it. But I think Dbug should help here...

Also you could try to figure out which instruction generated the macro and re-write it in another way :)
User avatar
waskol
Flight Lieutenant
Posts: 414
Joined: Wed Jun 13, 2007 8:20 pm
Location: FRANCE, Paris

Post by waskol »

herrrrrrrrrrrr........ :shock:
Chema, you ar funny ! :D
I think you over-estimate me :lol:

The thing is that I search a bit everywhere (osdk svn, google) and found nothing :stuck !

I am pretty sure that this MULTI__CCD macro comes from the cpp.exe excutable but i did not find the source code anywhere.
More over I am not sure at all that one day in my all life I should be able to write this macro myself in MACROS.H : I am not clever enough for that ! :lol:
User avatar
Chema
Game master
Posts: 3014
Joined: Tue Jan 17, 2006 10:55 am
Location: Gijón, SPAIN
Contact:

Post by Chema »

waskol wrote:herrrrrrrrrrrr........ :shock:
Chema, you ar funny ! :D
I think you over-estimate me :lol:
I was never able to write any of these macros myself too :lol:

But it is not in the sources of the compiler where we should look at. I know there must be some kind of documentation where each macro is explained (never saw it, but must exist). Then it is a matter of implementing it in 6502 asm (they are not too difficult, really) and adding it to the macros.h file.

Anyway, when talking about C code, I meant you (maybe) can figure out which of your instructions generated the offending macro, and try to doit differently.

Imagine you have something like

Code: Select all

k=3*(-1);
which is surprisingly similar to the params of MULI_CCD(3,-1,tmp0), two signed integers and store the result in tmp0. I also suppose it is related to an integer muitiplication, but no idea what CCD could mean.

Anyway, you can comment the code and see if the error still exists. If it does not, then you can try to change your code to something like:

Code: Select all

 t=-1; k=3*t;
and see if that works...

It is a quick hack. I had to do something similar once to avoid a missing macro, but I cannot remember the exact case.

If you cannot relate the macro to your code at any point, you can try by simply commenting parts until you find it.

Not the nicest thing to do, but I see no other chance...
User avatar
waskol
Flight Lieutenant
Posts: 414
Joined: Wed Jun 13, 2007 8:20 pm
Location: FRANCE, Paris

Post by waskol »

haha, nice clue !!!!!!!

I have some *-1 in my code !!!

Thank you chema ! You are the best !

Edit : yesssssssssss, it compiles ! :lol:
User avatar
Dbug
Site Admin
Posts: 4444
Joined: Fri Jan 06, 2006 10:00 pm
Location: Oslo, Norway
Contact:

Post by Dbug »

Could you send me a minimum example of program that shows the problem ?
Guess if I spend some time with Fabrice we could add the missing macros :)
User avatar
waskol
Flight Lieutenant
Posts: 414
Joined: Wed Jun 13, 2007 8:20 pm
Location: FRANCE, Paris

Post by waskol »

I reproduced it, here it is :P :

Code: Select all

//
// This is a simple compilation error test
//

#include <lib.h>
#define MY_CONSTANT 10

void main()
{
int n;

  n=MY_CONSTANT *-1;
  printf("%d",n);
}
of course, things are gone when you correct like this :

Code: Select all

n=-MY_CONSTANT;
User avatar
waskol
Flight Lieutenant
Posts: 414
Joined: Wed Jun 13, 2007 8:20 pm
Location: FRANCE, Paris

Post by waskol »

I dig up this thing a little bit, here are my results :

Code: Select all

//
// This is a simple compile error test sample
//

#include <lib.h>
#define C1 10
#define C2 -3
#define C3 6

void main()
{
int n;
char m;
  m=-5;

  n=C1*C2; //MULI_CCD syntax error (2nd member is a negative constant 
           //                       AND 1st member is a constant)
  printf("%d",n);  

  n=C1*C3; //no error (2nd member is a positive)
  printf("%d",n);  

  n=C2*m;  //no error (2nd member is a variable)

  printf("%d",n);
  
  n=m*C2;  //no error (1st member is a variable)
  printf("%d",n);

  n=C2*C1;  //no error (2nd member is a positive)
  printf("%d",n);
}
Conclusion : this happens only when
the 1st member is a constant AND when 2nd member is a negative constant
Post Reply