3 registered members (Ayumi, Akow, AndrewAMD),
1,505
guests, and 9
spiders. |
Key:
Admin,
Global Mod,
Mod
|
|
|
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
OP
Expert
|
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
OP
Expert
|
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]
#386239
10/31/11 12:03
10/31/11 12:03
|
Joined: Apr 2007
Posts: 3,751 Canada
WretchedSid
Expert
|
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:
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
OP
Expert
|
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:
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:
#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
Serious User
|
Serious User
Joined: Dec 2008
Posts: 1,218
Germany
|
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
OP
Expert
|
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
Expert
|
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... 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: jcl]
#387794
11/23/11 18:33
11/23/11 18:33
|
Joined: Feb 2008
Posts: 3,232 Australia
EvilSOB
Expert
|
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.
//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
|
|
|
|