Is this a good place to report a problem with includes? It does not fall under the Compiler Problems section of the Great Cow BASIC forum.
softserial.h contains...
so that it is exactly the same name as the actual files '/opt/GCBASIC/include/softserialch1.h' and '/opt/GCBASIC/include/softserialch2.h' and '/opt/GCBASIC/include/softserialch3.h'
Linux has case sensitive file naming.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
And on the same theme... http://gcbasic.sourceforge.net/help/_ssd1306_controllers.html
Search for '#define GLCD_TYPE_SSD1306_CHARACTER_MODE_ONLY'
Running that example "drive a SSD1306 based Graphic I2C LCD module with the built in commands of Great Cow BASIC using Low Memory Mode GLCD"
we get an error on a Linux based system...
(Below we search for the file that glcd.h has missing using a case insensitive method)
$ find ~/. -iname GLCD_ST7789.h
~/./GreatCowBASIC/include/glcd_st7789.h (It found this one file!)
glcd.h contains
'#include <GLCD_ST7789.h>'
Please could that be changed before next release to
'#include <glcd_st7789.h>'
so that it is exactly the same name as the actual file '~/./GreatCowBASIC/include/glcd_st7789.h'
Linux has case sensitive file naming.
Windows operation is not affected by such a change.
Last edit: Jon Nelson 2022-06-11
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
So, can anyone in the community write a script to change all instants of upper case includes ro lowercase includes for ALL .h files?
or,
I can change the compiler to force only lowercase. This implies EVERYTHING for includes usage is lowercase across all systems (OSs) and source files. I am happy to do this.
Please let me know the best way forward.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Anobium,
Thanks for kind reply.
May we say the second option changing compiler fits in better with the following philosophy...
"Is Great Cow BASIC case sensitive?
No! For example, Set, SET, set, SeT, etc are all treated exactly the same way by Great Cow BASIC"
and only needs change in one place.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I am back home and I can now look to resolve the Linux file handler issue.
Can you please edit preprocessor.bi adding the LCASE() function at line 658. As shown below. Recompile for your OS, test and report back please.
This will now enforce lower case file handling in all operating systems. Where the user can use any case they like but the compiler will always looks for lowercase files - this is the best implementation I can think of. The installation process already makes all files lowercase - so this should work.
@Anobium Test was:
from http://gcbasic.sourceforge.net/help/_ssd1306_controllers.html
Search for '#define GLCD_TYPE_SSD1306_CHARACTER_MODE_ONLY'
Copy example "drive a SSD1306 based Graphic I2C LCD module with the built in commands of Great Cow BASIC using Low Memory Mode GLCD" into temp.gcb
$ cd ~/Ref/gcbasic (where temp.gcb lives)
$ gcbasic /A:GCASM test.gcb
Great Cow BASIC (0.98.<<>> 2021-<<>>-24 (Linux 64 bit) : Build 1005)
Compiling test.gcb ...
Cannot find /opt/GCBASIC/include//GLCD_ST7789.h
Done
Assembling program ...
Program assembled successfully
A warning has been generated:
/opt/GCBASIC/include//glcd.h (168): Warning: Cannot find
/opt/GCBASIC/include//GLCD_ST7789.h
The message has been logged to the file Errors.txt.
Modify preprocessor.bi as above...
and "add Print Temp on a new line after the Lcase()"
$cd/GreatCowBASIC/sources/linuxbuild(Followreadme-linux-install.txt)$chmod+xinstall.sh$sudomv/opt/GCBASIC/opt/GCBASIC_old(NOTEStep7:Suggestchangetoread"Execute [sudo] mv /opt/GCBASIC /opt/GCBASIC_old")$sudopwd~/GreatCowBASIC/sources/linuxbuild$sudo./install.shinstall(Waitfor"*** Installed successfully to /opt/GCBASIC !")cd~/Ref/gcbasic$gcbasic/version0.98.<<>>2021-<<>>-24(Linux64bit):Build1005$gcbasic/A:GCASMtest.gcb
Result same warning message viz:
/opt/GCBASIC/include//glcd.h (168): Warning: Cannot find
/opt/GCBASIC/include//GLCD_ST7789.h
No 'Print Temp' so deducing not compiled !
Possibly missing a step in re-compilation procedure.
20:23 Update Missed out
$ ./install.sh build (as Step 5)
Recompiled okay now and trying to make sense of new error messages
21:12 Progress
$ more test.gcb
#chip mega328p,16#include <glcd.h>
$ gcbasic /A:GCASM test.gcb
Great Cow BASIC (0.98.<<>> 2021-<<>>-24 (Linux 64 bit) : Build 1005++)
Compiling test.gcb ...
/opt/gcbasic/include//glcd.h (This is from debug 'print Temp')
Cannot find /opt/gcbasic/include//glcd.h
Done
Conclude:
1) "Temp = LCase(ShortName(Temp))" is a path AND filename. The path casing must be preserved. It is only the filename part that must change to be consistent throughout case-wise.
2) $ ls -al /opt/GCBASIC/include/////////glcd.h
-rw-r--r-- 1 root root 140332 Jun 28 20:13 /opt/GCBASIC/include/////////glcd.h
Multiple slashes amazingly appear to be tolerated but are not nice.
The // shown in Temp might be due to a bad concatenation.
Likely an OS independent path and file concatenation, like the 'os.path.join' in Python is needed. https://stackoverflow.com/questions/10918682/platform-independent-path-concatenation-using
I will clean up above test method after a new day begins :-)
29 June 2022
Change Proposed. Modify preprocessor.bi so new code is...
Above works for <> include but note assumption that might throw a warning if untrue.
In the double quoted include case presumably the caller has ability to ensure filenames match case-wise.
From http://gcbasic.sourceforge.net/help/_ssd1306_controllers.html
Search for '#define GLCD_TYPE_SSD1306_CHARACTER_MODE_ONLY'
Copy first two lines from example "drive a SSD1306 based Graphic I2C LCD module with the built in commands of Great Cow BASIC using Low Memory Mode GLCD" into temp.gcb
$ more test.gcb
#chip mega328p,16#include <glcd.h>
$ cd ~/Ref/gcbasic (where temp.gcb lives)
$ gcbasic /A:GCASM test.gcb
Great Cow BASIC (0.98.<<>> 2021-<<>>-24 (Linux 64 bit) : Build 1005)
Compiling test.gcb ...
Cannot find /opt/GCBASIC/include//GLCD_ST7789.h
Done
Assembling program ...
Program assembled successfully
A warning has been generated:
/opt/GCBASIC/include//glcd.h (168): Warning: Cannot find
/opt/GCBASIC/include//GLCD_ST7789.h
The message has been logged to the file Errors.txt.
Only moved your LCASE earlier on in code so it affects the file and not both Path and File
Please see (above) marked 29 June 2022
Change Proposed. Modify preprocessor.bi so new code is...
The secondary // issue affects utils.bi (below)
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
$ diff preprocessor.bi.ref preprocessor.bi
609a610
> 'Double quote seen so treat as full path and filename616c617,621< Temp = AddFullPath(Temp, ID + "\include\")---> 'Lcase (below) is needed to heal mismatch between Linux case sensitive file naming and GCB adopting opposite,
> 'as, by convention(?), all GCB library include filenames happen to be only lower case. > 'So to comply, ensure filename between angle brackets (not path) is made lowercase before attempting file retrieval.
> 'Assume only a filename lies between < and > and now stored in Temp> Temp = AddFullPath(LCase(Temp), ID + "\include\") 'was Temp= AddFullPath(Temp, ID + "\include\")618c623,625< Temp = ShortName(Temp)---> Temp = ShortName(Temp) 'Path and Filename> 'Print Temp 'Temporary for testing, see https://sourceforge.net/p/gcbasic/discussion/579125/thread/587d4c0f/?page=1>
$ diff utils.bi.ref utils.bi
57a58
> If Right(FullPath, 1)="\" Then FullPath = Left(FullPath, Len(FullPath) - 1)62d62<
Attached: preprocessor.bi and utils.bi with suggested changes
Regarding The // shown in Temp might be due to a bad concatenation.
Secondary discovery in utils.bi Function AddFullPath
Here we have added two temporary print statements
L and R are Left and Right parts of the Path and File concatenation before the / is inserted inbetween
#Ifdef__FB_UNIX__'Remove trailing slash from full pathIfRight(FullPath,1)="/"ThenFullPath=Left(FullPath,Len(FullPath)-1)'If CurrPath not FQ, add full pathIfLeft(OutPath,1)<>"/"AndLeft(OutPath,1)<>"~"Thenprint"L:"+FullPath+" R:"+CurrPath'debugOutPath=FullPath+"/"+CurrPathEndIfprint"OutPath:"+OutPath
'Remove trailing slash from full pathIfRight(FullPath, 1)="/"ThenFullPath=Left(FullPath, Len(FullPath)-1)IfRight(FullPath, 1)="\"ThenFullPath=Left(FullPath, Len(FullPath)-1)
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
When you 'merge into build 1136' do you paste the changes into the latest sources (e.g. Build 1135 sources) or use the entire source files I sent?
It is just that I notice I was working with
I am building the compete distribution at the moment. I was incorrect to say archive.. I meant distribution build. I will be build 1137- I have fixed another issue this morning.
Step 2: This test build will replace e.g. 0.99.01 2022-01-27 (Linux 64 bit) : Build 1073
Rename ~/GreatCowBASIC to ~/GreatCowBASICbuild1073 or simply remove old version.
If just testing a change to any of the GCB sources skip above steps.
Step 3: Below adjust path after Change Directory, cd, to wherever you keep compileGCB.sh (attached)
Is this a good place to report a problem with includes? It does not fall under the Compiler Problems section of the Great Cow BASIC forum.
softserial.h contains...
Please could that be changed before next release to
so that it is exactly the same name as the actual files '/opt/GCBASIC/include/softserialch1.h' and '/opt/GCBASIC/include/softserialch2.h' and '/opt/GCBASIC/include/softserialch3.h'
Linux has case sensitive file naming.
And on the same theme...
http://gcbasic.sourceforge.net/help/_ssd1306_controllers.html
Search for '#define GLCD_TYPE_SSD1306_CHARACTER_MODE_ONLY'
Running that example "drive a SSD1306 based Graphic I2C LCD module with the built in commands of Great Cow BASIC using Low Memory Mode GLCD"
we get an error on a Linux based system...
(Below we search for the file that glcd.h has missing using a case insensitive method)
glcd.h contains
Please could that be changed before next release to
so that it is exactly the same name as the actual file '~/./GreatCowBASIC/include/glcd_st7789.h'
Linux has case sensitive file naming.
Windows operation is not affected by such a change.
Last edit: Jon Nelson 2022-06-11
Jon,
A very reasonable ask. So, yes.
So, can anyone in the community write a script to change all instants of upper case includes ro lowercase includes for ALL .h files?
or,
I can change the compiler to force only lowercase. This implies EVERYTHING for includes usage is lowercase across all systems (OSs) and source files. I am happy to do this.
Please let me know the best way forward.
Anobium,
Thanks for kind reply.
May we say the second option changing compiler fits in better with the following philosophy...
"Is Great Cow BASIC case sensitive?
No! For example, Set, SET, set, SeT, etc are all treated exactly the same way by Great Cow BASIC"
and only needs change in one place.
I like the use of caps for making a File/Variable name more 'readable'.
I would SecondTheSecondOption.
This change would only apply to #include statements. No change to variable etc.
@Jon Nelson
I am back home and I can now look to resolve the Linux file handler issue.
Can you please edit preprocessor.bi adding the LCASE() function at line 658. As shown below. Recompile for your OS, test and report back please.
This will now enforce lower case file handling in all operating systems. Where the user can use any case they like but the compiler will always looks for lowercase files - this is the best implementation I can think of. The installation process already makes all files lowercase - so this should work.
to
@Anobium Test was:
from http://gcbasic.sourceforge.net/help/_ssd1306_controllers.html
Search for '#define GLCD_TYPE_SSD1306_CHARACTER_MODE_ONLY'
Copy example "drive a SSD1306 based Graphic I2C LCD module with the built in commands of Great Cow BASIC using Low Memory Mode GLCD" into temp.gcb
Modify preprocessor.bi as above...
and "add Print Temp on a new line after the Lcase()"
Do "Recompile for your OS"
Result same warning message viz:
/opt/GCBASIC/include//glcd.h (168): Warning: Cannot find
/opt/GCBASIC/include//GLCD_ST7789.h
No 'Print Temp' so deducing not compiled !
Possibly missing a step in re-compilation procedure.
20:23 Update Missed out
$ ./install.sh build (as Step 5)
Recompiled okay now and trying to make sense of new error messages
21:12 Progress
but...
Conclude:
1) "Temp = LCase(ShortName(Temp))" is a path AND filename. The path casing must be preserved. It is only the filename part that must change to be consistent throughout case-wise.
2) $ ls -al /opt/GCBASIC/include/////////glcd.h
-rw-r--r-- 1 root root 140332 Jun 28 20:13 /opt/GCBASIC/include/////////glcd.h
Multiple slashes amazingly appear to be tolerated but are not nice.
The // shown in Temp might be due to a bad concatenation.
Likely an OS independent path and file concatenation, like the 'os.path.join' in Python is needed.
https://stackoverflow.com/questions/10918682/platform-independent-path-concatenation-using
I will clean up above test method after a new day begins :-)
29 June 2022
Change Proposed. Modify preprocessor.bi so new code is...
Above works for <> include but note assumption that might throw a warning if untrue.
In the double quoted include case presumably the caller has ability to ensure filenames match case-wise.
Test Report/Method Used
Platform:
From http://gcbasic.sourceforge.net/help/_ssd1306_controllers.html
Search for '#define GLCD_TYPE_SSD1306_CHARACTER_MODE_ONLY'
Copy first two lines from example "drive a SSD1306 based Graphic I2C LCD module with the built in commands of Great Cow BASIC using Low Memory Mode GLCD" into temp.gcb
We note mismatch:
Preserve original sources that we intend to edit for this test
Only do once and make reference copies read only.
$ diff preprocessor.bi.ref preprocessor.bi (can be used to check changes from original)
Update buildVersion in gcbasic.bas to confirm re-compilation, example below
Do "Recompile for your OS" as Anobium requested. Basically a two step process.
Wait for "*** Installed successfully to /opt/GCBASIC !"
Check new test version
Re-run test with test code
Last edit: Jon Nelson 2022-06-30
Interesting.
Why is the .h file still in uppercase?
add Print Temp on a new line after the Lcase()
Send the revise code thru - the source gcbasic.bas. I will merge with the master source. We are at build 1135.
Regret not understood "Send the revise code thru - the source gcbasic.bas."
You edited some source files. I have assumed it was called gcbasic.bas
Send the source file(s) you edited. You can upload as attachments or send me a personal message (PM) then attach to the PM.
Only moved your LCASE earlier on in code so it affects the file and not both Path and File
Please see (above) marked 29 June 2022
Change Proposed. Modify preprocessor.bi so new code is...
The secondary // issue affects utils.bi (below)
@Anobium
Suggested changes are
Attached: preprocessor.bi and utils.bi with suggested changes
Regarding The // shown in Temp might be due to a bad concatenation.
Secondary discovery in utils.bi Function AddFullPath
Here we have added two temporary print statements
L and R are Left and Right parts of the Path and File concatenation before the / is inserted inbetween
Proposed fix (add another line):
Thank you.
Can you attach these source files so I can merge. Cheers.
Done. Please see above
I have merged into build 1136. There are many changes from the last full Linux release.
Hopefully. all is good.
I am running all the 1100 test programs under Windows. This will throw up and #include errors.. if there any.
I will report back soon with test results.
When you 'merge into build 1136' do you paste the changes into the latest sources (e.g. Build 1135 sources) or use the entire source files I sent?
It is just that I notice I was working with
whereas you mention making build 1136.
Downloading latest sources from https://sourceforge.net/projects/gcbasic/files/GCBasic%20-%20Linux%20Distribution/ the sources differ, viz:
I merged the changes into 1136
I will create a new complete archive for Linux tomorrow. This will be a 1136 build. Can you please test against 1136 please?
Certainly.
BTW Where does one locate new builds under test?
Last evening we downloaded from https://sourceforge.net/projects/gcbasic/
and it builds into...
0.99.01 2022-01-27 (Linux 64 bit) : Build 1073
but expected Build 1135 if you are about to release 1136
Googling: 'great cow basic latest build' results...
http://gcbasic.sourceforge.net/Typesetter/index.php/Download
Download latest version dated 30Jan2022 - not the latest build
https://sourceforge.net/projects/gcbasic/
The latest RELEASE is Jan 2022 (not build)
http://gcbasic.sourceforge.net/Typesetter/index.php/Download
Package heading: You want the latest VERSION
Usage heading: This is the latest BUILD with the Great Cow BASIC
Surely latest Version is not same as latest Build.
You write "I will create a new complete archive"
https://sourceforge.net/projects/gcbasic/files/GCBasic%20-%20Linux%20Distribution/Archived%20Versions/
Latest 29 Jan 2022 Archived usually implies historic/old versions
Where please?
I am building the compete distribution at the moment. I was incorrect to say archive.. I meant distribution build. I will be build 1137- I have fixed another issue this morning.
In the past I have only posted Linux distributions when I do a major release I will upload to the https://sourceforge.net/projects/gcbasic/files/Release%20Candidates/Patches/full_distros/ shortly.
Last edit: Anobium 2022-07-01
Re-run the 'include' test
The test code...
That looks good!!
Thank you
Below is the method to update GCB under Linux e.g. Xubuntu in case useful to anybody.
Step 1: Downloaded GCB@Syn_build_1137.rar
Step 2: This test build will replace e.g. 0.99.01 2022-01-27 (Linux 64 bit) : Build 1073
Rename ~/GreatCowBASIC to ~/GreatCowBASICbuild1073 or simply remove old version.
If just testing a change to any of the GCB sources skip above steps.
Step 3: Below adjust path after Change Directory, cd, to wherever you keep compileGCB.sh (attached)
Check new version is shown as expected.
Last edit: Jon Nelson 2022-07-02