A special problem, maybe I am the only one who concern about it :-)
Symptom: Source can not compiled:
Fatal error executing:
echo ' awk -f /opt/GCBASIC/preprocess.awk r1.1.gcb'
awk -f /opt/GCBASIC/preprocess.awk r1.1.gcb
exit
After digging around a while I found the reason.
The reason is that my source code has several dots "." in the file name.
I noticed by chance.
The error comes from the fact that makehex.sh can only handle one dot in the file name.
I have adapted makehex accordingly and ask other Linux and MAC (?) users to try it.
At some point, I had noticed this. A kind GCB member who understands the LINUX command line far better than I do, was helping me out in writing a script that extracted the #Chip directive in source code so that it could be passed to the NSDSP programmer when programming the device. When writing this script I came across this very problem and managed to remedy it, with a similar solution to yours.
An insight. The AWK is there to inspect for errors that the compiler did not/was not picking up and to ensure the libraries where valid.
I will look to remove the AWK processing at the 0.98.08. I think that is possible.
So, if you do not execute the AWK, today, what is the impact? You may get strange error messages relating to the following (as the AWK preprocessing issues proper messages):
Unmatched Braces
If - Else errors
Casting errors
Loops that are not terminated errors
Subs and Function that are not terminated errors
All these errors are masked today. If someone wants to help move these checks into the compiler... please let us know.
Evan
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
So, if you do not execute the AWK, today, what is the impact? You may get strange error messages relating to the following (as the AWK preprocessing issues proper messages):
I am sure that in more recent macOS versions, AWK doesn't run correctly? Which is why I initially stopped using it...
Unmatched Braces
Tested, I get the error: CS_V2_11.gcb (956): Error: Brackets do not match up
If - Else errors
Tested, I get the error: CS_V2_11.gcb (972): Error: Else outside of If ... End If block
Or: CS_V2_11.gcb (953): Error: If without matching End If
Casting errors
Untested
Loops that are not terminated errors
Tested, I get the error: CS_V2_11.gcb (1397): Error: Do without matching Loop
Or: CS_V2_11.gcb (1420): Error: Loop without matching Do
Subs and Function that are not terminated error
Tested, I get the error: None, no error raised for Un-terminated Sub [Though looking at the .ASM it appears as though the sub did terminate normally?]
When compiling this Sub with the "End Sub" commented out:
SubPrintAnimALetD_Lat=0'Start output data latchShiftData(254)'-ShiftData(255)'ShiftData(255)'ShiftData(247)'-LetD_Lat=1'End output data latch'End Sub
The .ASM looks like this:
PRINTANIMA;LetD_Lat=0'Start output data latchbankselLATCbcfLATC,4;ShiftData(254)'-movlw254bankselDATAOUTmovwfDATAOUTcallSHIFTDATA;ShiftData(255)'movlw255movwfDATAOUTcallSHIFTDATA;ShiftData(255)'movlw255movwfDATAOUTcallSHIFTDATA;ShiftData(247)'-movlw247movwfDATAOUTcallSHIFTDATA;LetD_Lat=1'End output data latchbankselLATCbsfLATC,4;EndSubbankselSTATUSreturn
Remove the commented out "'End Sub" completely and the .ASM looks like this:
PRINTANIMA;LetD_Lat=0'Start output data latchbankselLATCbcfLATC,4;ShiftData(254)'-movlw254bankselDATAOUTmovwfDATAOUTcallSHIFTDATA;ShiftData(255)'movlw255movwfDATAOUTcallSHIFTDATA;ShiftData(255)'movlw255movwfDATAOUTcallSHIFTDATA;ShiftData(247)'-movlw247movwfDATAOUTcallSHIFTDATA;LetD_Lat=1'End output data latchbankselLATCbsfLATC,4bankselSTATUSreturn
And with the "End Sub" included as normal I get:
PRINTANIMA;LetD_Lat=0'Start output data latchbankselLATCbcfLATC,4;ShiftData(254)'-movlw254bankselDATAOUTmovwfDATAOUTcallSHIFTDATA;ShiftData(255)'movlw255movwfDATAOUTcallSHIFTDATA;ShiftData(255)'movlw255movwfDATAOUTcallSHIFTDATA;ShiftData(247)'-movlw247movwfDATAOUTcallSHIFTDATA;LetD_Lat=1'End output data latchbankselLATCbsfLATC,4bankselSTATUSreturn
The only "Odd" errors I have had have been with my own "included" files. If I have made an error within one of my header files, the program fails to compile, throwing an unknown error:
An error has been found: [With no further information shown]
As I now know that this indicates an error in an "included" file, I know approximately where to look for this one.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Just spent a few hours returning the preprocessor options to the script. I did get the commands working to some degree. I have them reporting errors in the header files, though as I can't persuade the script to stop executing by the time the rest of the compilation has completed they are all but invisible, being way off the compiler output window.
They still seem to not report where any error might be. Although they do if you scroll right to the top of the output window note an error of some sort in a header file. They still fail to make any note of any unterminated sub routines.
I am far from an expert in shell scripting and I probably have not done things correctly, but I am struggling to see what, if anything, I've acheived?
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
The script uses the "filename.html" file to extract the #Chip parameter from it on compile so that it can be passed to the command line of the NSDSP programmer
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
A special problem, maybe I am the only one who concern about it :-)
Symptom: Source can not compiled:
Fatal error executing:
echo ' awk -f /opt/GCBASIC/preprocess.awk r1.1.gcb'
awk -f /opt/GCBASIC/preprocess.awk r1.1.gcb
exit
After digging around a while I found the reason.
The reason is that my source code has several dots "." in the file name.
I noticed by chance.
The error comes from the fact that makehex.sh can only handle one dot in the file name.
I have adapted makehex accordingly and ask other Linux and MAC (?) users to try it.
in makehex.sh begin with line 22
Last edit: bed 2020-04-04
Hello.
At some point, I had noticed this. A kind GCB member who understands the LINUX command line far better than I do, was helping me out in writing a script that extracted the #Chip directive in source code so that it could be passed to the NSDSP programmer when programming the device. When writing this script I came across this very problem and managed to remedy it, with a similar solution to yours.
As for various reasons the 'awk' processes failed to work on the Mac, I have that section commented out any way.
An insight. The AWK is there to inspect for errors that the compiler did not/was not picking up and to ensure the libraries where valid.
I will look to remove the AWK processing at the 0.98.08. I think that is possible.
So, if you do not execute the AWK, today, what is the impact? You may get strange error messages relating to the following (as the AWK preprocessing issues proper messages):
All these errors are masked today. If someone wants to help move these checks into the compiler... please let us know.
Evan
That's a question there...
I am sure that in more recent macOS versions, AWK doesn't run correctly? Which is why I initially stopped using it...
Tested, I get the error: CS_V2_11.gcb (956): Error: Brackets do not match up
Tested, I get the error: CS_V2_11.gcb (972): Error: Else outside of If ... End If block
Or: CS_V2_11.gcb (953): Error: If without matching End If
Untested
Tested, I get the error: CS_V2_11.gcb (1397): Error: Do without matching Loop
Or: CS_V2_11.gcb (1420): Error: Loop without matching Do
Tested, I get the error: None, no error raised for Un-terminated Sub [Though looking at the .ASM it appears as though the sub did terminate normally?]
When compiling this Sub with the "End Sub" commented out:
The .ASM looks like this:
Remove the commented out "'End Sub" completely and the .ASM looks like this:
And with the "End Sub" included as normal I get:
The only "Odd" errors I have had have been with my own "included" files. If I have made an error within one of my header files, the program fails to compile, throwing an unknown error:
An error has been found: [With no further information shown]
As I now know that this indicates an error in an "included" file, I know approximately where to look for this one.
Just spent a few hours returning the preprocessor options to the script. I did get the commands working to some degree. I have them reporting errors in the header files, though as I can't persuade the script to stop executing by the time the rest of the compilation has completed they are all but invisible, being way off the compiler output window.
They still seem to not report where any error might be. Although they do if you scroll right to the top of the output window note an error of some sort in a header file. They still fail to make any note of any unterminated sub routines.
I am far from an expert in shell scripting and I probably have not done things correctly, but I am struggling to see what, if anything, I've acheived?
In Linux build .. makehex.sh isn't html_file anaway.
What does MAC do with it?
The script uses the "filename.html" file to extract the #Chip parameter from it on compile so that it can be passed to the command line of the NSDSP programmer
When we release 0.98.07 you may want to use the new compiler switch that outputs only the chipname and the config.
Evan
But does that work in the macOS version, and it needs to be processed in a way that gives the result similar to:
PIC16F1825
From the #Chip 16F1829, 32 directive.
This value then needs passing to the NSDSP programmer command line.
Ohh, My posted script has a typo $1 not $2 , sorry.
My Script is ok. Wonder why here stands $1, I am a messy.
(corrected in Post above)