Gamestudio Links
Zorro Links
Newest Posts
New FXCM FIX Plugin
by flink. 06/04/24 07:30
AlpacaZorroPlugin v1.3.0 Released
by kzhao. 05/22/24 13:41
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
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
3 registered members (Ayumi, Akow, AndrewAMD), 1,505 guests, and 9 spiders.
Key: Admin, Global Mod, Mod
Newest Members
AemStones, LucasJoshua, Baklazhan, Hanky27, firatv
19058 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Page 2 of 5 1 2 3 4 5
Re: Manipulating the function scheduler? [Re: Superku] #386058
10/27/11 16:50
10/27/11 16:50
Joined: Jun 2006
Posts: 2,640
Earth
Germanunkol Offline OP
Expert
Germanunkol  Offline OP
Expert

Joined: Jun 2006
Posts: 2,640
Earth
I can't get your macro to work, JustSid.

Throws an error when it comes to the first wait(1) in:
while(inetrequest_running == ON || updateRunning == ON) wait(1);

#define wait(i) do{char *funct; engine_gettaskinfo(0, &funct, NULL); debugFct(funct); wait(i); } while(0)

Also tried it without the do while(0).

I've never worked with function macros before...

The error thrown is:
"info" undeclared identifier
which is curious, because it seems to be talking about the "info" in engine_gettaskinfo. (When changing the code a little, I got "ttaskinfo" undeclared identifier)


~"I never let school interfere with my education"~
-Mark Twain
Re: Manipulating the function scheduler? [Re: Germanunkol] #386237
10/31/11 11:05
10/31/11 11:05
Joined: Jun 2006
Posts: 2,640
Earth
Germanunkol Offline OP
Expert
Germanunkol  Offline OP
Expert

Joined: Jun 2006
Posts: 2,640
Earth
I hate to bump...
but can anyone help me with the macro? From what I can tell it looks pretty much correct. But I don't know if LiteC macros are any different, and I can't find it in the manual.


~"I never let school interfere with my education"~
-Mark Twain
Re: Manipulating the function scheduler? [Re: Germanunkol] #386238
10/31/11 11:56
10/31/11 11:56
Joined: Jul 2000
Posts: 27,986
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 27,986
Frankfurt
I see no reason for an error message in the single line above, but can you post a small script that shows a problem with such a macro? I'll check it.

You should however never declare something within a macro. This can become very messy. Use a global declaration.

Re: Manipulating the function scheduler? [Re: Germanunkol] #386239
10/31/11 12:03
10/31/11 12:03
Joined: Apr 2007
Posts: 3,751
Canada
WretchedSid Offline
Expert
WretchedSid  Offline
Expert

Joined: Apr 2007
Posts: 3,751
Canada
The macro should be correct and I can't give you any further help regarding this since I'm not on a Windows PC at the moment (and too lazy to reboot... FML)
Anyway, I thought I might clarify the while(0) thingie since some other people asked me about this on ICQ too, so here we go:
do {} while(x); executes once and then checks if x evaluates to true and if so, repeats again. Unlike a normal while loop where the condition is checked prior running the loop, so do {} while(0); executes the block of code inbetween exactly once. The reason why its in anyway although it does nothing special has two reasons:
1) It gives you a new scope, meaning that char *funct; is only visible within this block of code and can be redeclared later again by "calling" the macro again. Although this is not really needed in Lite-C which doesn't care about redeclaring variables, even with a different type, its still considered nice.
2) More interesting for Lite-C users is that it behaves like it was only a single execution of something, thus it allows you to use it in conditions where it would normally need a extra scope like in ifs. Without the do{}while() construct, this wouldn't be possible:
Code:
if(foo)
   macro();




Shitlord by trade and passion. Graphics programmer at Laminar Research.
I write blog posts at feresignum.com
Re: Manipulating the function scheduler? [Re: WretchedSid] #386952
11/11/11 16:18
11/11/11 16:18
Joined: Jun 2006
Posts: 2,640
Earth
Germanunkol Offline OP
Expert
Germanunkol  Offline OP
Expert

Joined: Jun 2006
Posts: 2,640
Earth
Sorry, I have been gone for a while.
I tried to recreate the Problem, this is what I get:

When I run the code below (A7.86.6) the program does not compile properly, it crashes ("acknex.exe hat ein Problem festgestellt und musste beendet werden") leaving the acklog.txt in the following state:
Code:
Log of A7 Engine 7.86.6 run at Fri Nov 11 16:26:25 2011
Micha on Windows NT/2000/XP version 5.1 Build 2600
Options SchedulerTest.c -diag  -tc
App: H:\ArtTools\3DGS\GStudio7\acknex.exe in H:\ArtWork\3DGS\Test\SchedulerList\

MM mixer opened
DSOUND device opened
DI interface opened
Start Window opened
(c) Conitec - Dieburg - San Diego - www.3dgamestudio.com
A7 Engine - Pro Edition V7.86.6 - Aug  7 2010
Development version
Registered to: Micha Pfeiffer

DI Microsoft-PC-Joysticktreiber 4 axes 12 buttons initialized
Mouse found
Joystick found
Realtek HD Audio output opened
NVIDIA GeForce 9800 GT   pure T&L device 1ff9 detected
D3D device NVIDIA GeForce 9800 GT   1ff9 selected.
acknet.dll opened
ackwii.dll opened
t7.dll opened
Compiling SCHEDULERTEST.C - [Esc] to abort....



And here's the code:
Code:
#include <default.c>
#include <acknex.h>


#define NDEBUG

void debugFct(char* funct);


#ifdef NDEBUG
#define wait(i) do{char *funct; engine_gettaskinfo(0, &funct, NULL); debugFct(funct); wait(i); } while(0)
#endif


void debugFct(char* funct) {
	diag(funct);
}

void loopFunctions() {
	int i = 0;
	while(1) {
		diag("\n");
		diag(str_for_num(NULL, i));
		wait(1);	
		i+= 1;
	}
}


int main() {
	wait(3);
	loopFunctions();
	wait(3);
	sys_exit("");
}




~"I never let school interfere with my education"~
-Mark Twain
Re: Manipulating the function scheduler? [Re: Germanunkol] #386963
11/11/11 18:18
11/11/11 18:18
Joined: Dec 2008
Posts: 1,218
Germany
Rackscha Offline
Serious User
Rackscha  Offline
Serious User

Joined: Dec 2008
Posts: 1,218
Germany
Reproduced on current A8


MY Website with news of my projects:
(for example my current
Muliplayer Bomberman,
GenesisPrecompiler for LiteC
and TileMaster, an easy to use Tile editor)
Sparetime-Development

Re: Manipulating the function scheduler? [Re: Rackscha] #387599
11/21/11 11:23
11/21/11 11:23
Joined: Jun 2006
Posts: 2,640
Earth
Germanunkol Offline OP
Expert
Germanunkol  Offline OP
Expert

Joined: Jun 2006
Posts: 2,640
Earth
Hm. I guess I'll just have to search and replace the code instead. But that's kinda ugly...


~"I never let school interfere with my education"~
-Mark Twain
Re: Manipulating the function scheduler? [Re: Germanunkol] #387610
11/21/11 15:52
11/21/11 15:52
Joined: Feb 2008
Posts: 3,232
Australia
EvilSOB Offline
Expert
EvilSOB  Offline
Expert

Joined: Feb 2008
Posts: 3,232
Australia
I cant even get close with 8.30.3

All I can get is the following compile error...

Quote:
Error in 'common.h' line 138:
'wait' : Recursive definition

(FYI, that location is the first wait the compiler sees...)


"There is no fate but what WE make." - CEO Cyberdyne Systems Corp.
A8.30.5 Commercial
Re: Manipulating the function scheduler? [Re: EvilSOB] #387786
11/23/11 16:18
11/23/11 16:18
Joined: Jul 2000
Posts: 27,986
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 27,986
Frankfurt
For avoiding a recursive definition, don't use the defined name already in the definition.

Re: Manipulating the function scheduler? [Re: jcl] #387794
11/23/11 18:33
11/23/11 18:33
Joined: Feb 2008
Posts: 3,232
Australia
EvilSOB Offline
Expert
EvilSOB  Offline
Expert

Joined: Feb 2008
Posts: 3,232
Australia
I tried that too, still the same.

Heres are the examples Ive tried a few minutes ago with 8.30.3 commercial,
listed along with their respective compile-errors.
All code here has just been tested and copy/paste'd from source-code to here.

Code:
//generates "'wait': recursive definition" error [What I originally tried in the past]
#define wait(i)		do{ diag("waiting\n"); wait(i); } while(0)


//generates "'_wait': recursive definition" error [what I understand your last post to mean]
#define wait(i)		_wait(i);
#define _wait(i)	do{ diag("waiting\n"); wait(i); } while(0)


//generates "'my_wait': recursive definition" error [duplicate of above with different name]
#define wait(i)		my_wait(i);
#define my_wait(i)	do{ diag("waiting\n"); wait(i); } while(0)


//compiles sucessfully but ODDLY ENOUGH doesnt executes waits correctly and locks up... ;D 
_wait()	{	wait(1);	}
#define wait(i)	do{ diag("waiting\n"); _wait(i); } while(0)

So ... any other ideas?


"There is no fate but what WE make." - CEO Cyberdyne Systems Corp.
A8.30.5 Commercial
Page 2 of 5 1 2 3 4 5

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