// library: file: get: compile: option: all: to: buffer <description></description> <version control></version control> <version>1.0.0.0.13</version>
// <version control></version control> (filenamemacro=getfitbv.s) [<Program>] [<Research>] [kn, ri, su, 22-01-2023 19:32:33]
//
INTEGER PROC FNFileGetCompileOptionAllToBufferB( STRING fileNameCompileS, INTEGER bufferI )
//
// See also Carlo Hogeveen help about TSE compiler options:
//
// Use case = You want to read all the currently defined compile options for all compilers defined in TSE
//
// Usage =
//
// 1. -Always backup your original compile.dat file.
// 2. -Then run the program,
// 3. -Supply the full path to your compile.dat file
// 4. -That will output all defined compile options in a buffer
//
// ===
//
// Method = Search linearly through the given compile.dat file extracting the lines one after the other.
// The record structure for each computer langauge is fixed and constant.
//
STRING identifierS[255] = "DO NOT MODIFY THIS FILE"
STRING recordSeparatorS[255] = Chr( 30 )
STRING s[255] = ""
STRING s1[255] = ""
INTEGER B = FALSE
PushPosition()
PushBlock()
// erase / refresh / clean up
PushPosition()
PushBlock()
IF EditFile( fileNameCompileS )
AbandonFile()
ENDIF
PopPosition()
PopBlock()
EditFile( fileNameCompileS )
IF NOT Find( identifierS, "gix" )
Warn( identifierS, ":", " ", "not found. Please check." )
PopBlock()
PopPosition()
B = FALSE
RETURN( B )
ENDIF
B = TRUE
BegFile()
WHILE LFind( Format( "^", recordSeparatorS ), "x" )
// get the file extension
s = GetText( 1 + 1, 255 )
s = Trim( s )
AddLine( Format( "Extension", "=", s ), bufferI )
// get the description
IF Down()
s = GetText( 1, 255 )
s = Trim( s )
AddLine( Format( "Description", "=", s ), bufferI )
ENDIF
IF Down()
s = GetText( 1 + 1, 1 )
CASE s
WHEN Chr( 01 )
s1 = "Clear Screen and Prompt After Shell"
WHEN Chr( 02 )
s1 = "Clear Screen but Dont't Prompt After Shell"
WHEN Chr( 03 )
s1 = "Don't Clear Screen or Prompt After Shell"
WHEN Chr( 04 )
s1 = "Tee Output and Don't Prompt After Shell"
WHEN Chr( 05 )
s1 = "Tee Output, Run Hidden and Don't Prompt After Shell"
OTHERWISE
Warn( "FNFileGetCompileOptionAllToBufferB(", " ", "case", " ", ":", " ", s, ": not known. Please check this further and add this option." )
B = FALSE
ENDCASE
IF Down()
s = GetText( 1, 255 )
s = Trim( s )
AddLine( Format( "Command", "=", s ), bufferI )
ENDIF
AddLine( Format( "Output", "=", s1 ), bufferI )
AddLine( Format( "Rules", bufferI ) )
IF Down()
s = GetText( 1, 255 )
s = Trim( s )
AddLine( Format( " ", "-Error", "=", s ), bufferI )
ENDIF
IF Down()
s = GetText( 1, 255 )
s = Trim( s )
AddLine( Format( " ", " ", "Error: Options", "=", s ), bufferI )
ENDIF
IF Down()
s = GetText( 1, 255 )
s = Trim( s )
AddLine( Format( " ", " ", "Error: Extra line (default empty line)", "=", s ), bufferI )
ENDIF
IF Down()
s = GetText( 1, 255 )
s = Trim( s )
AddLine( Format( " ", "-FileName", "=", s ), bufferI )
ENDIF
IF Down()
s = GetText( 1, 255 )
s = Trim( s )
AddLine( Format( " ", " ", "FileName: Options", "=", s ), bufferI )
ENDIF
IF Down()
s = GetText( 1, 255 )
s = Trim( s )
AddLine( Format( " ", " ", "FileName: Tag", "=", s ), bufferI )
ENDIF
IF Down()
s = GetText( 1, 255 )
s = Trim( s )
AddLine( Format( " ", "-Line", "=", s ), bufferI )
ENDIF
IF Down()
s = GetText( 1, 255 )
s = Trim( s )
AddLine( Format( " ", " ", "Line: Options", "=", s ), bufferI )
ENDIF
IF Down()
s = GetText( 1, 255 )
s = Trim( s )
AddLine( Format( " ", " ", "Line: Tag", "=", s ), bufferI )
ENDIF
IF Down()
s = GetText( 1, 255 )
s = Trim( s )
AddLine( Format( " ", "-Column", "=", s ), bufferI )
ENDIF
IF Down()
s = GetText( 1, 255 )
s = Trim( s )
AddLine( Format( " ", " ", "Column: Options", "=", s ), bufferI )
ENDIF
IF Down()
s = GetText( 1, 255 )
s = Trim( s )
AddLine( Format( " ", " ", "Column: Tag", "=", s ), bufferI )
ENDIF
IF Down()
s = GetText( 1, 255 )
s = Trim( s )
AddLine( Format( " ", "-Message", "=", s ), bufferI )
ENDIF
IF Down()
s = GetText( 1, 255 )
s = Trim( s )
AddLine( Format( " ", " ", "Message: Options", "=", s ), bufferI )
ENDIF
IF Down()
s = GetText( 1, 255 )
s = Trim( s )
AddLine( Format( " ", " ", "Message: Tag", "=", s ), bufferI )
ENDIF
IF Down()
s = GetText( 1, 255 )
s = Trim( s )
AddLine( Format( "User Macro", "=", s ), bufferI )
ENDIF
ENDIF
AddLine( "------------------------------------------------------------------------------", bufferI )
NextChar() // make sure not to get stuck on same last search position
ENDWHILE
IF EditFile( fileNameCompileS )
AbandonFile()
ENDIF
PopBlock()
PopPosition()
RETURN( B )
END
//
PROC Main()
STRING s1[255] = "f:\wordproc\tse32_v44200\compile.dat" // change this
INTEGER bufferI = 0
PushPosition()
bufferI = CreateTempBuffer()
PopPosition()
IF ( NOT ( Ask( "file: get: template: file: extension: keyword: all: to: buffer: fileNameCompileS = ", s1, _EDIT_HISTORY_ ) ) AND ( Length( s1 ) > 0 ) ) RETURN() ENDIF
Message( FNFileGetCompileOptionAllToBufferB( s1, bufferI ) ) // gives e.g. TRUE
GotoBufferId( bufferI )
END