Page 1 of 1
Error with too many #defines
Posted: Thu Feb 23, 2017 7:54 pm
by Chema
Hi all. I solved it temporary, but I faced today an error with the OSDK related with a too high number of #defines. I know this, because I simply commented some I did not need, and it worked.
I am not sure if it is cpp which is producing the error, but I guess so. The error message is:
fa77:no more memory error
Dbug, I guess it is related with the size of an internal table, but anyway it should be changed to something practically unlimited
EDIT: I traced the error in the sources of xa. It is flagged as E_OUT_OF_MEMORY whenever a number of entries (I think) is greater than a constant ANZDEF, defined in xah.h as
Code: Select all
#define ANZDEF 2340 /* mal 14 -> Byte , ANZDEF*14<32768 */
BTW, I
love clear comments
Re: Error with too many #defines
Posted: Thu Feb 23, 2017 9:13 pm
by iss
Chema wrote:BTW, I
love clear comments
The comments are clear in German
:
"ANZDEF" = Anzahl der Defines = Number of defines
"mal 14" = multiplication by 14
Else, as workaround I can recommend you to use C pre-processor before XA.
I added permanently "cpp" to my OSDK toolchain and it's called by make.
I use an old version like this one here:
https://dev.w3.org/Amaya/cpp/
If you need I can zip and my version of these sources or I can try to compile them for Windows.
Re: Error with too many #defines
Posted: Thu Feb 23, 2017 11:17 pm
by Chema
Thanks iss, now I understand
. My comments are usually even more obscure.
I solved the error for now, but I think it's better to patch this, so it does not become an issue. It is probably a limit of using 16bit signed integers, but visual studio has been using 32 bit integers for quite some time... If I am not mistaken.
Re: Error with too many #defines
Posted: Fri Feb 24, 2017 9:01 am
by Dbug
iss wrote:Else, as workaround I can recommend you to use C pre-processor before XA.
I added permanently "cpp" to my OSDK toolchain and it's called by make.
I use an old version like this one here:
https://dev.w3.org/Amaya/cpp/
If you need I can zip and my version of these sources or I can try to compile them for Windows.
There is a CPP already in the bin folder of the OSDK (It's used before the C compiler is called, and also to apply the macros.)
Did you miss it, or is it that it did not work for what you needed?
Re: Error with too many #defines
Posted: Fri Feb 24, 2017 1:01 pm
by iss
Dbug wrote:Did you miss it, or is it that it did not work for what you needed?
Yes, you are right, there is "cpp.exe" in OSDK!
Code: Select all
cpp.exe -v
GNU CPP version 2.8.1 (80386, BSD syntax)
But now I recall the case...
Because I'm using Linux and cpp's sources are missing in the svn,
I found them (the same version 2.8.1) from somewhere on the net and added them, so I can fully recompile OSDK for Linux.
Re: Error with too many #defines
Posted: Fri Feb 24, 2017 4:55 pm
by Dbug
I guess we could totally have the cpp sources in the osdk source tree on SVN, assuming there's no licencing issues and that it's not a monster that drags 20 billions dependencies?
Re: Error with too many #defines
Posted: Fri Feb 24, 2017 4:58 pm
by Chema
In any case, XA is not using cpp but it's own preprocessing, and I am not sure they are fully compatible or if there will be any kind of lateral effect.
As I use assembly only, I'd be very grateful if this one is fixed
please? <insert begging here>
Re: Error with too many #defines
Posted: Fri Feb 24, 2017 9:44 pm
by Dbug
Could you try this version:
- xa.zip
- XA v2.2.4
Extended the size of MAXBLK from 16 to 32, MAXFILE from 7 to 15, MAXLINE from 8192 to 16000 and ANZDEF from 2340 to 10000 - (77.27 KiB) Downloaded 522 times
While I was at it, I changed some other values:
Code: Select all
#define MAXBLK 32 // Was 16
#define MAXFILE 15 // Was 7
#define MAXLINE 16000 // Was 8192 // 2048 -> Explodes with large recursions
#define ANZDEF 10000 // Was 2340 /* mal 14 -> Byte , ANZDEF*14<32768 */
Re: Error with too many #defines
Posted: Fri Feb 24, 2017 10:56 pm
by iss
This new defines are OK by me.
One curious detail: Can you guess what is the maximum usable value for ANZDEF?
It's exactly
89557
I used generated file with 100,000 defines and after some trial-and-error found this limit.
If "#define ANZDEF 89558" the program exits with "Segmentation fault".
Else, for cpp sources - I think it's not worth to bother with them.
What still puzzles me is - from where I've got these sources?!? maybe it was from LCC65...
Re: Error with too many #defines
Posted: Sun Feb 26, 2017 8:49 pm
by Chema
Yeah! This version seems to work perfectly!
I was starting to need it badly. A single more #define and I got the error. I found a limit in the number of labels (I think) when developing 1337 and now this... but Dbug came to rescue
Re: Error with too many #defines
Posted: Mon Feb 27, 2017 7:00 pm
by Dbug
Just for the sake of not forgetting, and also to test the new server, I added an issue on that one:
http://osdk.org/index.php?page=issues