The below TSE program will convert a list of compiler options to a compile.dat compatible file.
It is the inverse of the TSE program shown a few days earlier.
Note: Interesting was that it showed that my original TSE
compiler.dat was not structured correctly, thus basically corrupted.
Somewhere in all the merging of the TSE compiler file options in the
years something must have gone wrong somewhere in time. I did
found that out because when converting (from compile.dat to text
output) back and forth of the compiler options the result of the
below program was a much smaller file size file. It should have
been equal in size to the original compile.dat. But it still
worked and that was very puzzling. How was that possible. When
looking inside the original compile.dat file it showed that
interspersed were compiler
options which e.g. were missing the file extension (and thus all
other option lines) which were skipped by my parser, because it
only searched for file extensions as the start of a compiler
record. So at the end creating a much smaller file which still
worked though.
Use case =
1. -Troubleshooting and comparing the correct parameters to compile any
computer language from within TSE.
2. -E.g. merging and editing the list after editing and e.g. pruning
Usage =
1. -Highlight the below block including the 'Extension' line
and the separator line '------...---'
2. -Run the TSE macro
3. -It will then create a compile.dat compatible file in a buffer.
You will have to save that buffer manually.
Optionally backup and replace the resulting file with the original
compile.dat located in the TSE main directory.
E.g.
Extension=.s
Description=SemWare Editor Macro compiler
Command=&SCPath&&scfn& &fn& > &output&
Output=Tee Output, Run Hidden and Don't Prompt After Shell
-Error=^{Warning}|{Note}|{Error}
Error: Options=i
Error: Extra line (default empty line)=
-FileName=^File: {.#}
FileName: Options=b
FileName: Tag=1
-Line=^{.*[0-9]# *({[0-9]#},{[0-9]#}).#}$\c
Line: Options=
Line: Tag=2
-Column=
Column: Options=
Column: Tag=3
-Message=
Message: Options=
Message: Tag=1
User Macro=
------------------------------------------------------------------------------
Extension=.grp
Description=Turbo Grep
Command=tGrep -o -n &GrepOptions& &GrepString& &GrepFiles& > &output&
Output=Tee Output and Don't Prompt After Shell
-Error=^{.+} #{[0-9]#} #{.*}$
Error: Options=
Error: Extra line (default empty line)=
-FileName=
FileName: Options=
FileName: Tag=1
-Line=
Line: Options=
Line: Tag=2
-Column=
Column: Options=
Column: Tag=
-Message=
Message: Options=
Message: Tag=3
User Macro=
------------------------------------------------------------------------------
The TSE program (all 1-liners)
---
// library: block: change: convert: compile: option: to: compile: dat: current: buffer
// <description></description> <version control></version control>
// <version>1.0.0.0.15</version> <version control></version control>
// (filenamemacro=chanbldb.s) [<Program>] [<Research>] [kn, ri, we, 25-01-2023 11:16:53]
INTEGER PROC FNBlockChangeConvertCompileOptionToCompileDatCurrentBufferB( INTEGER bufferI )
STRING recordSeparatorS[255] = Chr( 30 )
STRING s[255] = ""
STRING s1[255] = "" // extension
STRING s2[255] = "" // description
STRING s3[255] = "" // command
STRING s4[255] = "" // output
INTEGER I = 0
INTEGER B = FALSE
IF ( NOT ( IsBlockInCurrFile() ) ) Warn( "Please mark a block" ) B = FALSE RETURN( B ) ENDIF // return from the current procedure if no block is marked
B = TRUE
IF LFind( "^Extension={.*}$", "cgx" )
s1 = GetFoundText( 1 )
s1 = Trim( s1 )
ELSE
Warn( "No 'Extension=' found in the current line. Please check." )
B = FALSE
RETURN( B )
ENDIF
IF NOT Down()
Warn( "Could not go to the next line. Please check." )
B = FALSE
RETURN( B )
ENDIF
IF LFind( "^Description={.*}$", "cgx" )
s2 = GetFoundText( 1 )
s2 = Trim( s2 )
ELSE
Warn( "No 'Description=' found in the current line. Please check." )
B = FALSE
RETURN( B )
ENDIF
IF NOT Down()
Warn( "Could not go to the next line. Please check" )
B = FALSE
RETURN( B )
ENDIF
IF LFind( "^Command={.*}$", "cgx" )
s3 = GetFoundText( 1 )
s3 = Trim( s3 )
ELSE
Warn( "No 'Command=' found in the current line. Please check." )
B = FALSE
RETURN( B )
ENDIF
IF NOT Down()
Warn( "Could not go to the next line. Please check" )
B = FALSE
RETURN( B )
ENDIF
IF LFind( "^Output={.*}$", "cgx" )
s4 = GetFoundText( 1 )
s4 = Trim( s4 )
CASE s4
WHEN "Clear Screen and Prompt After Shell"
I = 1
WHEN "Clear Screen but Dont't Prompt After Shell"
I = 2
WHEN "Don't Clear Screen or Prompt After Shell"
I = 3
WHEN "Tee Output and Don't Prompt After Shell"
I = 4
WHEN "Tee Output, Run Hidden and Don't Prompt After Shell"
I = 5
OTHERWISE
Warn( "FNBlockChangeConvertCompileOptionToCompileDatCurrentBufferB(", " ", "case", " ", ":", " ", s4, ": not known. Please check this further and add this option." )
B = FALSE
ENDCASE
ELSE
Warn( "No 'Output=' found in the current line. Please check." )
B = FALSE
RETURN( B )
ENDIF
IF NOT Down()
Warn( "Could not go to the next line. Please check" )
B = FALSE
RETURN( B )
ENDIF
AddLine( Format( recordSeparatorS, s1 ), bufferI ) // first the extension
AddLine( s2, bufferI ) // then the description
AddLine( Format( Chr( 0 ), Chr( I ) ), bufferI ) // then the output case
AddLine( s3, bufferI ) // then the command
IF LFind( "^[ ]*-Error={.*}$", "cgx" )
s = GetFoundText( 1 )
s = Trim( s )
AddLine( s, bufferI )
ELSE
Warn( "No '-Error=' found in the current line. Please check." )
B = FALSE
RETURN( B )
ENDIF
IF NOT Down()
Warn( "Could not go to the next line. Please check" )
B = FALSE
RETURN( B )
ENDIF
IF LFind( "^[ ]*Error: Options={.*}$", "cgx" )
s = GetFoundText( 1 )
s = Trim( s )
AddLine( s, bufferI )
ELSE
Warn( "No 'Error: Options=' found in the current line. Please check." )
B = FALSE
RETURN( B )
ENDIF
IF NOT Down()
Warn( "Could not go to the next line. Please check" )
B = FALSE
RETURN( B )
ENDIF
IF LFind( "^[ ]*Error: Extra line (default empty line)={.*}$", "cgx" )
s = GetFoundText( 1 )
s = Trim( s )
AddLine( s, bufferI )
ELSE
Warn( "No 'Error: Extra line (default empty line)' found in the current line. Please check." )
B = FALSE
RETURN( B )
ENDIF
IF NOT Down()
Warn( "Could not go to the next line. Please check" )
B = FALSE
RETURN( B )
ENDIF
IF LFind( "^[ ]*-FileName={.*}$", "cgx" )
s = GetFoundText( 1 )
s = Trim( s )
AddLine( s, bufferI )
ELSE
Warn( "No '-FileName=' found in the current line. Please check." )
B = FALSE
RETURN( B )
ENDIF
IF NOT Down()
Warn( "Could not go to the next line. Please check" )
B = FALSE
RETURN( B )
ENDIF
IF LFind( "^[ ]*FileName: Options={.*}$", "cgx" )
s = GetFoundText( 1 )
s = Trim( s )
AddLine( s, bufferI )
ELSE
Warn( "No 'FileName: Options=' found in the current line. Please check." )
B = FALSE
RETURN( B )
ENDIF
IF NOT Down()
Warn( "Could not go to the next line. Please check" )
B = FALSE
RETURN( B )
ENDIF
IF LFind( "^[ ]*FileName: Tag={.*}$", "cgx" )
s = GetFoundText( 1 )
s = Trim( s )
AddLine( s, bufferI )
ELSE
Warn( "No 'FileName: Tag' found in the current line. Please check." )
B = FALSE
RETURN( B )
ENDIF
IF NOT Down()
Warn( "Could not go to the next line. Please check" )
B = FALSE
RETURN( B )
ENDIF
IF LFind( "^[ ]*-Line={.*}$", "cgx" )
s = GetFoundText( 1 )
s = Trim( s )
AddLine( s, bufferI )
ELSE
Warn( "No '-Line=' found in the current line. Please check." )
B = FALSE
RETURN( B )
ENDIF
IF NOT Down()
Warn( "Could not go to the next line. Please check" )
B = FALSE
RETURN( B )
ENDIF
IF LFind( "^[ ]*Line: Options={.*}$", "cgx" )
s = GetFoundText( 1 )
s = Trim( s )
AddLine( s, bufferI )
ELSE
Warn( "No 'Line: Options=' found in the current line. Please check." )
B = FALSE
RETURN( B )
ENDIF
IF NOT Down()
Warn( "Could not go to the next line. Please check" )
B = FALSE
RETURN( B )
ENDIF
IF LFind( "^[ ]*Line: Tag={.*}$", "cgx" )
s = GetFoundText( 1 )
s = Trim( s )
AddLine( s, bufferI )
ELSE
Warn( "No 'Line: Tag' found in the current line. Please check." )
B = FALSE
RETURN( B )
ENDIF
IF NOT Down()
Warn( "Could not go to the next line. Please check" )
B = FALSE
RETURN( B )
ENDIF
IF LFind( "^[ ]*-Column={.*}$", "cgx" )
s = GetFoundText( 1 )
s = Trim( s )
AddLine( s, bufferI )
ELSE
Warn( "No '-Column=' found in the current line. Please check." )
B = FALSE
RETURN( B )
ENDIF
IF NOT Down()
Warn( "Could not go to the next line. Please check" )
B = FALSE
RETURN( B )
ENDIF
IF LFind( "^[ ]*Column: Options={.*}$", "cgx" )
s = GetFoundText( 1 )
s = Trim( s )
AddLine( s, bufferI )
ELSE
Warn( "No 'Column: Options=' found in the current line. Please check." )
B = FALSE
RETURN( B )
ENDIF
IF NOT Down()
Warn( "Could not go to the next line. Please check" )
B = FALSE
RETURN( B )
ENDIF
IF LFind( "^[ ]*Column: Tag={.*}$", "cgx" )
s = GetFoundText( 1 )
s = Trim( s )
AddLine( s, bufferI )
ELSE
Warn( "No 'Column: Tag' found in the current line. Please check." )
B = FALSE
RETURN( B )
ENDIF
IF NOT Down()
Warn( "Could not go to the next line. Please check" )
B = FALSE
RETURN( B )
ENDIF
IF LFind( "^[ ]*-Message={.*}$", "cgx" )
s = GetFoundText( 1 )
s = Trim( s )
AddLine( s, bufferI )
ELSE
Warn( "No '-Message=' found in the current line. Please check." )
B = FALSE
RETURN( B )
ENDIF
IF NOT Down()
Warn( "Could not go to the next line. Please check" )
B = FALSE
RETURN( B )
ENDIF
IF LFind( "^[ ]*Message: Options={.*}$", "cgx" )
s = GetFoundText( 1 )
s = Trim( s )
AddLine( s, bufferI )
ELSE
Warn( "No 'Message: Options=' found in the current line. Please check." )
B = FALSE
RETURN( B )
ENDIF
IF NOT Down()
Warn( "Could not go to the next line. Please check" )
B = FALSE
RETURN( B )
ENDIF
IF LFind( "^[ ]*Message: Tag={.*}$", "cgx" )
s = GetFoundText( 1 )
s = Trim( s )
AddLine( s, bufferI )
ELSE
Warn( "No 'Message: Tag' found in the current line. Please check." )
B = FALSE
RETURN( B )
ENDIF
IF NOT Down()
Warn( "Could not go to the next line. Please check" )
B = FALSE
RETURN( B )
ENDIF
IF LFind( "^User Macro={.*}$", "cgx" )
s = GetFoundText( 1 )
s = Trim( s )
AddLine( s, bufferI )
ELSE
Warn( "No 'User Macro' found in the current line. Please check." )
B = FALSE
RETURN( B )
ENDIF
IF NOT Down()
Warn( "Could not go to the next line. Please check" )
B = FALSE
RETURN( B )
ENDIF
AddLine( "", bufferI )
RETURN( B )
END
//
// library: block: change: convert: compile: option: to: compile: dat: all: buffer <description></description>
// <version control></version control> <version>1.0.0.0.17</version> <version control></version control>
// (filenamemacro=chanblab.s) [<Program>] [<Research>] [kn, ri, we, 25-01-2023 12:19:17]
INTEGER PROC FNBlockChangeConvertCompileOptionToCompileDatAllBufferB( INTEGER bufferI )
STRING identifierMainS[255] = "Semware compile macro data file"
STRING identifierS[255] = "DO NOT MODIFY THIS FILE"
INTEGER B = FALSE
IF ( NOT ( IsBlockInCurrFile() ) ) Warn( "Please mark a block" ) B = FALSE RETURN( B ) ENDIF // return from the current procedure if no block is marked
PushPosition()
PushBlock()
AddLine( identifierMainS, bufferI )
AddLine( "", bufferI )
AddLine( identifierS, bufferI )
AddLine( "", bufferI )
B = TRUE
GotoBlockBegin()
WHILE ( ( B ) AND ( LFind( "^Extension={.*}$", "cgx" ) ) )
B = FNBlockChangeConvertCompileOptionToCompileDatCurrentBufferB( bufferI )
IF LFind( "------------------------------------------------------------------------------", "cg" )
B = Down()
ENDIF
ENDWHILE
PopBlock()
PopPosition()
RETURN( B )
END
//
PROC Main()
INTEGER bufferI = 0
PushPosition()
bufferI = CreateTempBuffer()
PopPosition()
Message( FNBlockChangeConvertCompileOptionToCompileDatAllBufferB( bufferI ) ) // gives e.g. TRUE
GotoBufferId( bufferI )
END