Ah... the confusion is actually a constraint of the compiler.
The #includes are not processed conditionally. Think of them as always being processed, so, they will always be loaded.
18 months ago I changed the overall behaviour of conditional compilation so constants are actually processed correctly. But, #includes are always processed.
I am not sure, yet, why a file called glcdx.h is issuing the messages. What is glcdx.h ? Is this the issue ?
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
no, rather than modifying the real glcd.h, I just made an experimental version, glcdx.h, and included it in the test program instead of glcd.h, so I could easily switch between the two.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Where is glcdx.h getting loaded? If this is loaded then glcd.h is loaded then as the two files are different things would go wrong.
Delete glcdx.h and reset.
You can always get the latest build by using GCStudio and force an update. You would have to ensure your .BAS and BI are safely stored away... as these will be replaced.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
So, a conditional include would probably be something to look into in the future.
You said:
Change the For RF- Next loop to a Do While RF <= SourceFiles Loop
Set RF = 0 before the new Do-Loop. And, increment RF each time throught the loop
In the #DEFINE test, if the usersource program and the GLCD_TYPE constant exists, add the code to extract the correct GLCD library from GLCD.DAT and then add this filename to the sourcefile array, incrementing the SourceFiles variables.
Now the new Do While RF <= SourceFiles Loop will open only this specfic GLCD library.
This seems like a lot of special processing hard coded into the compiler just for glcd's.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
It looks specific to GLCD but I think we can extend this approach to essentially prune 'lowlevel.dat'. I have just removed all the GLCDs, pruned the 'lowlevel.dat'. Got this compiler from 7.2s to 2.062s. 'Lowlevel.dat' costs 0.5-0.6secs on my SSD drive.
This would have a much impact on a hard drive in terms of end to end timing.
GLCD would be the first step.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
then the compile fails.
This makes no sense to me, since the if will fail at execution time and none of the sets will execute anyway. I've done this over and over, and it runs when it's not a #if.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I'll give it a try, so long as you aren't expecting something "professional".
Also it just dawned on me how to make a conditional include so you wouldn't have to make such a big change in the future if a similar situation comes up.
#definemylibdummy'where dummy is some file always included#if somecondition #undefine mylib #define mylib LibIReallyWant#endif
#includemylib' will be dummy or LibIReallyWant
Last edit: Jim giordano 2024-02-05
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
This should be a simple test - is it faster by 2 seconds?
That conditional will work. I like that.
I am running the tests here on the new faster build. There take many hours and if there are issues then I have to resolve before posting to here.
The build is faster by 2 ish seconds. It is proven not only by the clock... but look at the number of subroutines being processed! was 1024 now 523, program lines are down.. hugely.
Ah ... that idea will not work. I am sorry but it obvious after the fact. :-(
The #include is process before the #define constants, and, there is no constant replacement of #include statements.
So, nice idea. Will not work.
The new compiler failed on test. I am fixing now. The issue is the cross library GLCD dependencies. In the past as all libraries were loaded, all methods were available... not the case in the new compiler. So, I need to figure out how to support cross library GLCD dependencies.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Sounds like a real can of worms.
Is there anyway to write a program to read the include files to see which devices needs which items, or is it just something you have to know about the device when you are programming it?
Is this going to require a complete restructuring of the libraries putting all common items in glcd.h and removing them from the specific device files?
I mean isn't this what you are already doing? It just not perfect yet?
Last edit: Jim giordano 2024-02-05
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
The is GLCD entry 29, named 'glcd_type_epd_epd7in5' and it required the libraries 'epd_epd7in5.h&epd_epd2in13d.h&glcd_ssd1289.h' - now i had no idea the these GLCD needed the ssd1289 library. Makes sense now.
So, the glcd.dat has all the information required information. glcd.dat is can be extended with ease, so no code changes.
Running the tests nows.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Sounds like all this is still just because we don't have a conditional #include. If we did the original glcd.h would have worked as intended. (assuming you updated the individual device files to have the needed includes). It can still have a great deal of unnecessary things included. eg.- glcd_type_epd_epd7in5 may only need a few of the things in glcd_ssd1289.h, I'm not familiar enough with these to know.
But the glcd.dat file seems easier to maintain rather than updating the individual library files, so still a good idea.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I documented this process when I change the conditional operations in 2022. That was a lot of work. Essentially, the #defines were ignore before that change.
The change would be to some how to process steps 3.i to 3.xi then using rerun again from step 3.i but this time using the conditions determined from the first run. Could work it would lot of work but it could work. Added to the list!
Last edit: Anobium 2024-02-05
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Ah... the confusion is actually a constraint of the compiler.
The #includes are not processed conditionally. Think of them as always being processed, so, they will always be loaded.
18 months ago I changed the overall behaviour of conditional compilation so constants are actually processed correctly. But, #includes are always processed.
I am not sure, yet, why a file called
glcdx.h
is issuing the messages. What is glcdx.h ? Is this the issue ?no, rather than modifying the real glcd.h, I just made an experimental version, glcdx.h, and included it in the test program instead of glcd.h, so I could easily switch between the two.
Maybe this is still the issue.
Where is glcdx.h getting loaded? If this is loaded then glcd.h is loaded then as the two files are different things would go wrong.
Delete glcdx.h and reset.
You can always get the latest build by using GCStudio and force an update. You would have to ensure your .BAS and BI are safely stored away... as these will be replaced.
So, a conditional include would probably be something to look into in the future.
You said:
Change the For RF- Next loop to a Do While RF <= SourceFiles Loop
Set RF = 0 before the new Do-Loop. And, increment RF each time throught the loop
In the #DEFINE test, if the usersource program and the GLCD_TYPE constant exists, add the code to extract the correct GLCD library from GLCD.DAT and then add this filename to the sourcefile array, incrementing the SourceFiles variables.
Now the new Do While RF <= SourceFiles Loop will open only this specfic GLCD library.
This seems like a lot of special processing hard coded into the compiler just for glcd's.
It looks specific to GLCD but I think we can extend this approach to essentially prune 'lowlevel.dat'. I have just removed all the GLCDs, pruned the 'lowlevel.dat'. Got this compiler from 7.2s to 2.062s. 'Lowlevel.dat' costs 0.5-0.6secs on my SSD drive.
This would have a much impact on a hard drive in terms of end to end timing.
GLCD would be the first step.
Sounds pretty good to me.
I've been working on finding why I was getting the errors I mentioned above.
It seem that if I comment out any of these includes-
glcd_ssd1289.h
glcd_st7920.h
glcd_ili9326.h
then I get error comments.
So there is something in those files that the ILI9341 needs that should probably be in the glcd_ili9341.h file.
Last edit: Jim giordano 2024-02-04
I took a clean install. Commented put the includes in GLCD.H, and, then add the specific back to my source - that works.
Excellent.
Something else I found-
if I convert the following "If" statement a "#if" in glcd.h, eg.
then the compile fails.
This makes no sense to me, since the if will fail at execution time and none of the sets will execute anyway. I've done this over and over, and it runs when it's not a #if.
The scripts that you edited do not have #IF only IF. Scripts are not conditional and always happen.
So, changing a script from if to #if will fail to compile.
Well gee. Wish I had known that hours ago :(
Perhaps this part of the compiler that handles scripts should be able to ignore includes in a non-executed if.
Was there no meaningful error message?
This wasn't really meaningful to me, if just meant the last thing I did was an error, and that was making that if a #if.
zzztest.gcb (284): Error: Syntax Error
zzztest.gcb (286): Error: Syntax Error
zzztest.gcb (298): Error: ,BANKEDSyntax Error
zzztest.gcb (302): Error: Syntax Error
zzztest.gcb (305): Error: Syntax Error
zzztest.gcb (308): Error: Syntax Error
zzztest.gcb (326): Error: Array/Function GLCDDRAWCHAR_SSD1351 has not been
declared
zzztest.gcb (326): Error: Syntax Error
zzztest.gcb (330): Error: Syntax Error
glcdx.h * (2078): Error: Syntax Error (Library Include)
glcdx.h * (2088): Error: Syntax Error (Library Include)
I had a look at these errors.
If a script has #IF but no #END IF then it would throw a meaningful error.
If a script has #IF and #END IF then is seemed to compile with no error.
I will add more syntax checking to prevent #IF usage in scripts.
So I'm guessing we're done here, right?
I think your analysis has shown a huge time saving opportunity.
I can make the changes and if I get to you can you test?
I should be able to do step 1 tomorrow.
You up to test?
I'll give it a try, so long as you aren't expecting something "professional".
Also it just dawned on me how to make a conditional include so you wouldn't have to make such a big change in the future if a similar situation comes up.
Last edit: Jim giordano 2024-02-05
This should be a simple test - is it faster by 2 seconds?
That conditional will work. I like that.
I am running the tests here on the new faster build. There take many hours and if there are issues then I have to resolve before posting to here.
The build is faster by 2 ish seconds. It is proven not only by the clock... but look at the number of subroutines being processed! was 1024 now 523, program lines are down.. hugely.
This is before
Now
Excellent.
And, of course, my simple idea doesn't work. This-
gives error-
[{
"resource": "/k:/gcbasic-code-r1580-GCBASIC-trunk/zprog.gcb",
"owner": "gcb",
"severity": 4,
"message": "Cannot find #include mystuff",
"source": "gcb",
"startLineNumber": 4,
"startColumn": 1,
"endLineNumber": 4,
"endColumn": 2147483647
}]
Such a simple concept.
Ah ... that idea will not work. I am sorry but it obvious after the fact. :-(
The #include is process before the #define constants, and, there is no constant replacement of #include statements.
So, nice idea. Will not work.
The new compiler failed on test. I am fixing now. The issue is the cross library GLCD dependencies. In the past as all libraries were loaded, all methods were available... not the case in the new compiler. So, I need to figure out how to support cross library GLCD dependencies.
Sounds like a real can of worms.
Is there anyway to write a program to read the include files to see which devices needs which items, or is it just something you have to know about the device when you are programming it?
Is this going to require a complete restructuring of the libraries putting all common items in glcd.h and removing them from the specific device files?
I mean isn't this what you are already doing? It just not perfect yet?
Last edit: Jim giordano 2024-02-05
The new method requires no changes to the libraries, only glcd.h to comment out the includes.
An example will help.
29,glcd_type_epd_epd7in5,epd_epd7in5.h&epd_epd2in13d.h&glcd_ssd1289.h
The is GLCD entry 29, named 'glcd_type_epd_epd7in5' and it required the libraries 'epd_epd7in5.h&epd_epd2in13d.h&glcd_ssd1289.h' - now i had no idea the these GLCD needed the ssd1289 library. Makes sense now.
So, the glcd.dat has all the information required information. glcd.dat is can be extended with ease, so no code changes.
Running the tests nows.
Sounds like all this is still just because we don't have a conditional #include. If we did the original glcd.h would have worked as intended. (assuming you updated the individual device files to have the needed includes). It can still have a great deal of unnecessary things included. eg.- glcd_type_epd_epd7in5 may only need a few of the things in glcd_ssd1289.h, I'm not familiar enough with these to know.
But the glcd.dat file seems easier to maintain rather than updating the individual library files, so still a good idea.
I fully take onboard and agree with your point re conditional includes.
The task to make is work would be huge, see https://github.com/GreatCowBASIC/Help/wiki/development_guide_for_gcbasic_exe_compiler step 3.i This is where all the includes are handled, ifdefs are at 3.xiv
I documented this process when I change the conditional operations in 2022. That was a lot of work. Essentially, the #defines were ignore before that change.
The change would be to some how to process steps 3.i to 3.xi then using rerun again from step 3.i but this time using the conditions determined from the first run. Could work it would lot of work but it could work. Added to the list!
Last edit: Anobium 2024-02-05
Here is a URL to the build. It is the gcbasic folder structure.
Please extract to your gcbasic folder and test.
https://1drv.ms/u/s!Ase-PX_n_4cvhNtxrrcy5O65-0xieQ?e=QzrnbN
Once you have downloaded, let me know and I will delete.
Last edit: Anobium 2024-02-05
AMAZING... the static tests that took nearly three hours... now 47 mins.
Jim this is huge saving.
It will just be nice and fast for the users!
Ignore the errors.. they are because these programs are using incorrect color constants.