Gamestudio Links
Zorro Links
Newest Posts
M1 Oversampling
by Petra. 04/24/24 10:34
Zorro FIX plugin - Experimental
by flink. 04/21/24 07:12
Data from CSV not parsed correctly
by EternallyCurious. 04/20/24 21:39
Scripts not found
by juergen_wue. 04/20/24 18:51
zorro 64bit command line support
by 7th_zorro. 04/20/24 10:06
StartWeek not working as it should
by jcl. 04/20/24 08:38
folder management functions
by VoroneTZ. 04/17/24 06:52
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
5 registered members (Petra, AndrewAMD, Quad, VoroneTZ, 1 invisible), 488 guests, and 3 spiders.
Key: Admin, Global Mod, Mod
Newest Members
Mega_Rod, EternallyCurious, howardR, 11honza11, ccorrea
19048 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
assert #477358
06/19/19 14:50
06/19/19 14:50
Joined: May 2015
Posts: 390
Czech Republic
G
Grat Offline OP
Senior Member
Grat  Offline OP
Senior Member
G

Joined: May 2015
Posts: 390
Czech Republic
Hi,

how to realize macro assert?

Code
#define ASSERT(expr) if (!(expr)) printf("\nError at line: %d ", __LINE__)


how to get a line in script?

thanks

Last edited by Grat; 06/19/19 14:50.
Re: assert [Re: Grat] #477360
06/19/19 14:59
06/19/19 14:59
Joined: Jul 2000
Posts: 27,982
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 27,982
Frankfurt
There is no __LINE__ in lite-C, but the rest of the assert macro should work.

Re: assert [Re: Grat] #481504
09/22/20 12:14
09/22/20 12:14
Joined: May 2015
Posts: 390
Czech Republic
G
Grat Offline OP
Senior Member
Grat  Offline OP
Senior Member
G

Joined: May 2015
Posts: 390
Czech Republic
if anybody want

Code
#include <profile.c>
#define assert(expr,line) if (!(expr)) printf("\nError at line: %d ", line)

// ------
int myDEF_ERR=0;
// -- ALFA --------------
#define ALFA 1

// -- BETA --------------
#define BETA 1
// --- control  
    #ifdef ALFA 
    #ifdef BETA
        myDEF_ERR = 1;
    #endif
    #endif

// -- GAMA --------------


void main(){
    assert(myDEF_ERR>0,22);
}


this code produce:
Quote


protoGen compiling............... ok

Error at line: 22


Last edited by Grat; 09/22/20 12:15.

Moderated by  Petra 

Powered by UBB.threads™ PHP Forum Software 7.7.1