Gamestudio Links
Zorro Links
Newest Posts
Free Live Data for Zorro with Paper Trading?
by AbrahamR. 05/18/24 13:28
Change chart colours
by 7th_zorro. 05/11/24 09:25
Data from CSV not parsed correctly
by dr_panther. 05/06/24 18:50
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
4 registered members (AndrewAMD, ozgur, AbrahamR, wdlmaster), 849 guests, and 7 spiders.
Key: Admin, Global Mod, Mod
Newest Members
Hanky27, firatv, wandaluciaia, Mega_Rod, EternallyCurious
19051 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
#define question... #401026
05/11/12 15:15
05/11/12 15:15
Joined: Aug 2003
Posts: 902
Van Buren, Ar
Gordon Offline OP
User
Gordon  Offline OP
User

Joined: Aug 2003
Posts: 902
Van Buren, Ar
Is there a way to add a new line in the define? Many preprocessors have a way to do this. what I need to do is have output like this from the macro:

int foo;
#define debug_foo ce_adddebugvar(&foo,ce_debug_int,"foo");

I can get the results I want with 2 macros but would rather have just one for maintenance reasons. BTW defining a macro in a macro works right now... Please don't change this!!!


Our new web site:Westmarch Studios
Re: #define question... [Re: Gordon] #401027
05/11/12 15:16
05/11/12 15:16
Joined: Apr 2007
Posts: 3,751
Canada
WretchedSid Offline
Expert
WretchedSid  Offline
Expert

Joined: Apr 2007
Posts: 3,751
Canada
Why doesn't this work for you?
Code:
#define debug_foo int foo; ce_adddebugvar(&foo,ce_debug_int,"foo");





Shitlord by trade and passion. Graphics programmer at Laminar Research.
I write blog posts at feresignum.com
Re: #define question... [Re: WretchedSid] #401055
05/12/12 13:43
05/12/12 13:43
Joined: Aug 2003
Posts: 902
Van Buren, Ar
Gordon Offline OP
User
Gordon  Offline OP
User

Joined: Aug 2003
Posts: 902
Van Buren, Ar
Well I almost got it to work... turns out we need a stringize macro operator to make everything work

the macro should be:

Code:
#define NEWVAR(type,name,tbtype) type name; #define debug_##name ce_adddebugvar(&name,dbtype,#name)



You would define a global like:

NEWVAR(int,foo,ce_debug_int)

then later in the code in a function could call

debug_foo;

This would add the variable pointer to the console to be viewed and modified. but the problem is we don't have an # operator in macros in lite-c The solution I came up with for now is to just include a quoted copy of the name as an additional parameter. The real solution may just be to write a preprocessor for lite-c as a separate program. I think I have some source from about 20 years ago that would be a good starting point....


Our new web site:Westmarch Studios
Re: #define question... [Re: Gordon] #401877
05/25/12 13:45
05/25/12 13:45
Joined: Aug 2003
Posts: 902
Van Buren, Ar
Gordon Offline OP
User
Gordon  Offline OP
User

Joined: Aug 2003
Posts: 902
Van Buren, Ar
New preprocessor is working well :-) As soon as I document it I will give JCL the code and see if they want to integrate it into lite-c. Otherwise I will post the source in the contributions forum.. It is a full preprocessor that includes #if, #elif, #error etc. Supports the defined(sym) psudo function in #if and #elif. They also support full c expressions. macros with up to 63 parameters. And the list goes on... Maybe later I tackle lite-c++ to add classes and enum to the language...


Our new web site:Westmarch Studios

Moderated by  old_bill, Tobias 

Gamestudio download | chip programmers | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1