Gamestudio Links
Zorro Links
Newest Posts
Zorro 2.70
by jcl. 09/29/25 09:24
optimize global parameters SOLVED
by dBc. 09/27/25 17:07
ZorroGPT
by TipmyPip. 09/27/25 10:05
assetHistory one candle shift
by jcl. 09/21/25 11:36
Plugins update
by Grant. 09/17/25 16:28
AUM Magazine
Latest Screens
Rocker`s Revenge
Stug 3 Stormartillery
Iljuschin 2
Galactic Strike X
Who's Online Now
3 registered members (AndrewAMD, Ayumi, NewbieZorro), 13,972 guests, and 6 spiders.
Key: Admin, Global Mod, Mod
Newest Members
krishna, DrissB, James168, Ed_Love, xtns
19168 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Migrating from C-Script to Lite-C #164356
10/30/07 05:36
10/30/07 05:36
Joined: Jul 2005
Posts: 24
C
cwc Offline OP
Newbie
cwc  Offline OP
Newbie
C

Joined: Jul 2005
Posts: 24
I have a large project in C-Script and need to begin migrating to Lite-C using the step-by-step approach recommended in the manual. However, I can't seem to get Lite-C and C-Script to work in the same project. I understand C-Script cannot be used in a Lite-C project. My main file is still a WDL and main program is still C-Script. Here's what I'm doing. Where am I going wrong with my includes?

WDL file:
include <liteCfile.c>;
function main()
{
...
liteCfunction();
...
}

C file:

#include <acknex.h>;
function liteCfunction()
{
...
}

I get the following error: Syntax error - nonexistent/empty function liteCfunction

Where am I going wrong?

Re: Migrating from C-Script to Lite-C [Re: cwc] #164357
10/30/07 05:47
10/30/07 05:47
Joined: Apr 2006
Posts: 1,551
Netherlands
D3D Offline
Serious User
D3D  Offline
Serious User

Joined: Apr 2006
Posts: 1,551
Netherlands
What your doing is not possible! Have you tried the lite-c workshops? If you follow instructions inside the Gamestudio manual you'll notice that when you have a c-script coded file called main.wdl and you want to convert it to Litec you would:

1: create a file called main.c in the same folder
2: add #include <acknex.h> to main.c
3: port c-script code into main.c and correct syntax errors
4: only use main.wdl for paths and such (see manual)


smile
Re: Migrating from C-Script to Lite-C [Re: D3D] #164358
10/30/07 07:23
10/30/07 07:23
Joined: Jul 2005
Posts: 24
C
cwc Offline OP
Newbie
cwc  Offline OP
Newbie
C

Joined: Jul 2005
Posts: 24
According to the manual:

"For migrating a whole C-Script project over to lite-C, the best way is a step by step approach. Include an empty .c script at the end of your include list. The .c script may just contain the line #include <acknex.h> and empty .c #includes for every previously included .wdl file. Then move more and more declarations and functions from your C-Script code over to that .c script or to its includes, and make a test run after every block that you've moved over. Eventually you'll end up with empty .wdl files, and all code moved over to the .c files."

This implies that it's possible for C-Script code to include Lite-C code. Otherwise the step-by-step approach in the manual would be impossible. I also read a post from JCL indicating the same thing. He indicated it's not possible to run C-Script from a Lite-C program (because C-Script must be used only for declarations in a Lite-C program), but the reverse is possible.

Unfortunately, I haven't yet figured out exactly how to do what the manual and JCL seem to indicate is possible. If anyone knows how a Lite-C function can be referenced by a C-Script program, I'd love to know exactly how.

Re: Migrating from C-Script to Lite-C [Re: cwc] #164359
10/30/07 07:41
10/30/07 07:41
Joined: Apr 2006
Posts: 1,551
Netherlands
D3D Offline
Serious User
D3D  Offline
Serious User

Joined: Apr 2006
Posts: 1,551
Netherlands
With that the manual means:

You have a Lite-C project and it's main file is main.c and now want to use and convert a C-Script coded file called materials.wdl to Lite-C. So you would want to create an empty file called materials.c and include it inside your main.c file. Then step by step port sth from materials.wdl to your materials.c file.

What you're trying to do right now isn't converting the code. You tried to include file.c inside file.wdl and call a Lite-C function from file.c!?


smile
Re: Migrating from C-Script to Lite-C [Re: D3D] #164360
10/30/07 12:28
10/30/07 12:28
Joined: Jul 2000
Posts: 28,024
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 28,024
Frankfurt
The possibility to include one .c file in a .wdl main file was implemented during the A6 -> A7 transition phase, but should still work. However, for calling external functions you always need to declare a function prototype in the .wdl file, otherwise C-Script won't find it.

Re: Migrating from C-Script to Lite-C [Re: jcl] #164361
10/30/07 16:58
10/30/07 16:58
Joined: Jul 2005
Posts: 24
C
cwc Offline OP
Newbie
cwc  Offline OP
Newbie
C

Joined: Jul 2005
Posts: 24
JCL, thanks, but I've already tried declaring the function prototype both before and after the include statement referencing the Lite-C script. With or without any prototypes, I get the same error. Is it possible this functionality has been removed in 7.06? Or, is it possible I need to do something to compile the Lite-C code separately beforehand?

Re: Migrating from C-Script to Lite-C [Re: cwc] #164362
10/30/07 17:09
10/30/07 17:09
Joined: Mar 2007
Posts: 75
Hamburg, Ger
Altimeter Offline
Junior Member
Altimeter  Offline
Junior Member

Joined: Mar 2007
Posts: 75
Hamburg, Ger
during my migration I tried the same like you and neither succeded.
My step by step migration finally looked like this:
1.) say goodby to full functionality of your beloved program for some weeks.
2.) create a main.c file with a dummy function (hello world) and make it work.
3.) take a simple one of your wdl.files (e.g. a menu.wdl) and transform it to a menu.h and menu.c file. Include these files in your include list of main.c and bring it to the point where it runs.
4.) repeat 3.) for all other wdl-files. Step by step you regain you full functionality.
Like JCL says, you will end up with a Lite-C program and empty wdl-files.
Of course, this is the long and stony way. It took me some weeks to finish migration of a 30 000 line program. But believe me, you will learn C-Lite very fast and you understand how it works.
And, last but not least, you will notice a lot of chances to improve and clean your old code. It's all these 'I will do it later, when I have time'. But you never found the time to do it. NOW is the chance to do it.

Re: Migrating from C-Script to Lite-C [Re: Altimeter] #164363
10/30/07 22:07
10/30/07 22:07
Joined: Apr 2006
Posts: 1,551
Netherlands
D3D Offline
Serious User
D3D  Offline
Serious User

Joined: Apr 2006
Posts: 1,551
Netherlands
Altimeter that's also how I do it and find the other solution a little strange, almost like working against yourself. Guess I not understand the OP intentions though as he first wanted to migrate to Lite-C and now want to just use Lite-C functions inside C-Script.


smile
Re: Migrating from C-Script to Lite-C [Re: D3D] #164364
10/30/07 23:19
10/30/07 23:19
Joined: Jul 2005
Posts: 24
C
cwc Offline OP
Newbie
cwc  Offline OP
Newbie
C

Joined: Jul 2005
Posts: 24
Altimeter & D3D, I know exactly where you're coming from and completely agree with your migration process. If I saw someone with a forum status of "Newbie" asking a question like the one I asked, I would probably question why he wants to mix languages, too. Although my forum status is "newbie" I have a couple decades of programming experience and several years with C-Script, so please don't worry about me making a silly newbie mistake trying to migrate my code in some weird, backwards way. Since you've asked about why I would want to mix the two languages, here's the explanation:

Simply put, I just don't have time for a full migration yet. When I do have the time for a full migration, I will do it exactly as you guys are describing. Unfortunately, right now my release schedule doesn't allow for a couple months of migration time and I have 43,000 lines of C-Script code that would need porting. However, there are some features Lite-C offers that C-Script doesn't that I would like to use in the short run before I can do the full migration. So, since I've read that it's possible for a Lite-C function to be referenced from what is still fundamentally a C-Script application, I'd just like to know how that's done (if it's even still possible in 7.06).

Hopefully JCL can shed some more light on this.

Again, sorry if I sound like a newbie getting ready to make a hash of his code. I promise not to hose my code and then come begging for help.


Moderated by  HeelX, Lukas, rayp, Rei_Ayanami, Superku, Tobias, TWO, VeT 

Gamestudio download | 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