[ACC 1.42] defining the size of an array in a library

Bugs that have been investigated and resolved somehow.

Moderator: GZDoom Developers

Forum rules
Please don't bump threads here if you have a problem - it will often be forgotten about if you do. Instead, make a new thread here.
Post Reply
Cyb
Posts: 912
Joined: Tue Jul 15, 2003 5:12 pm

[ACC 1.42] defining the size of an array in a library

Post by Cyb »

Tested with ACC 1.42 DOS/Wadauthor version. If you create a library as such (for example):

Code: Select all

#library "test"
#include "zcommon.acs"

#define TEST_DEF 5

str strings[TEST_DEF] = { "one", "two", "three", "four", "five" };
And then in the scripts lump you

Code: Select all

#include "zcommon.acs"
#import "../levels/test.acs"
...and attempt to compile it, you get a syntax error. Putting that same code into the scripts lump (without the #library line of course) does not yeild any error. A library I had before that compiled with previous versions now does not work now with 1.42. Strangley enough if I attempt to compile the library itself then it compiles fine, so this is apparently due to whatever checks ACC runs on the library file prior to compiling the map scripts.
User avatar
Necromage
Posts: 484
Joined: Thu Feb 10, 2005 3:13 pm
Location: NJ
Contact:

Re: [ACC 1.42] defining the size of an array in a library

Post by Necromage »

Give this a try. I am not positive if it will work but I have a hunch that it may.

Code: Select all

#library "test"
#include "zcommon.acs"


str strings[] = { "one", "two", "three", "four", "five" };
User avatar
solarsnowfall
Posts: 1581
Joined: Thu Jun 30, 2005 1:44 am

Post by solarsnowfall »

It would need to be global or world scope for an open ended array size.
Cyb
Posts: 912
Joined: Tue Jul 15, 2003 5:12 pm

Re: [ACC 1.42] defining the size of an array in a library

Post by Cyb »

Necromage wrote:Give this a try. I am not positive if it will work but I have a hunch that it may.
Nope. Now it says "Missing array size". That's not really the point anyway, because the script I once had used to work but now does not. Not sure if it's a fix, but it seems more like a bug since you can use a constant for an array size in the actual library, and in map scripts, but the map script looking at the library spits out an error.
User avatar
randi
Site Admin
Posts: 7749
Joined: Wed Jul 09, 2003 10:30 pm
Contact:

Post by randi »

The problem is that when you import a library into another script file, it processes the library for function and variable names and ignores defines so that they can stay private to the library. Using #libdefine instead of #define will process the definition when the library is imported so that it is accessible to the main script as well. So to make this script compile with the current ACC, you should use "#libdefine TEST_DEF 5" instead of "#define TEST_DEF 5".

However, I agree that this needs to be fixed so that you don't need to advertise the size of the array to the main script if you don't want to.
User avatar
randi
Site Admin
Posts: 7749
Joined: Wed Jul 09, 2003 10:30 pm
Contact:

Post by randi »

Fixed.
Post Reply

Return to “Closed Bugs [GZDoom]”