OSDK: Problems with C/C++ intermixed comments

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
Dbug
Site Admin
Posts: 4444
Joined: Fri Jan 06, 2006 10:00 pm
Location: Oslo, Norway
Contact:

OSDK: Problems with C/C++ intermixed comments

Post by Dbug »

Ok, I found out the problem with Chema's code.
It's actually quite classic (I got the same problem in my own parser some years ago). All is due to this:

Code: Select all

//*******************************************
// Tile information generated by wcgraph.
// DO NOT edit by hand
//*******************************************
XA does not really handle C++ comments. Let's say that it's handled at linker level... but the files that are directly treated by XA are not supposed to have C++ comments at all...

In this particular case we got something vicious:

//*************

this is not considered as a C++ "//" comment folloed by a bunch of "***"... for XA it's "/" followed by a "/*" (C opening block comments)... and XA indefinitively wait for a matching "*/" to close the bloc... effectively skiping everything in the scope of the file, and get back to the parent file without having actually done anything.

As a temporary solution until I fix the parser, I propose to replace by this:

Code: Select all

/*******************************************
 Tile information generated by wcgraph.
 DO NOT edit by hand
*******************************************/
User avatar
Chema
Game master
Posts: 3014
Joined: Tue Jan 17, 2006 10:55 am
Location: Gijón, SPAIN
Contact:

Re: OSDK: Problems with C/C++ intermixed comments

Post by Chema »

Dbug wrote:Ok, I found out the problem with Chema's code.
It's actually quite classic (I got the same problem in my own parser some years ago). All is due to this:

Code: Select all

//*******************************************
// Tile information generated by wcgraph.
// DO NOT edit by hand
//*******************************************
XA does not really handle C++ comments. Let's say that it's handled at linker level... but the files that are directly treated by XA are not supposed to have C++ comments at all...

In this particular case we got something vicious:

//*************

this is not considered as a C++ "//" comment folloed by a bunch of "***"... for XA it's "/" followed by a "/*" (C opening block comments)... and XA indefinitively wait for a matching "*/" to close the bloc... effectively skiping everything in the scope of the file, and get back to the parent file without having actually done anything.

As a temporary solution until I fix the parser, I propose to replace by this:

Code: Select all

/*******************************************
 Tile information generated by wcgraph.
 DO NOT edit by hand
*******************************************/
Thanks for the quick response DBug! I should have imagined it was related with the comments... Better will change them all to standard C type.

Thanks indeed!
Post Reply