Merge branch 'master' of gitlab.com:gambas/gambas

This commit is contained in:
gambas 2021-03-09 01:39:44 +01:00
commit f1dd5cf6ad
17 changed files with 239 additions and 86 deletions

View file

@ -1,43 +1,97 @@
.TH "gbs3" "1" "October 2013" "Ubuntu" "User Commands"
.TH "gbs3" "1" "March 2021" "Ubuntu" "User Commands"
.SH "NAME"
gbs3 \- GAMBAS Scripter
.SH "SYNOPSIS"
.B gbs3
[options] [<script file>]
[options] [--] [<script file> | -]
.br
.B gbs3
--convert-project <source project directory> <destination script directory>
.SH "DESCRIPTION"
Gambas is a free development environment based on a Basic interpreter with object extensions, a mix of Java(tm) and Visual Basic(tm).
With Gambas, you can quickly design your program GUI, access MySQL or PostgreSQL databases, pilot KDE applications with DCOP, translate your program into many languages, and so on...
Gambas is a free development environment based on a Basic interpreter with object extensions,
.br
a mix of Java(tm) and Visual Basic(tm).
.br
With Gambas, you can quickly design your program GUI, access MySQL or PostgreSQL databases,
.br
pilot KDE applications with DCOP, translate your program into many languages, and so on...
\fBgbs3\fR is the interpreter that allows you to compile and execute a Gambas script.
.B gbs3
is the interpreter that allows you to compile and execute a Gambas script.
.br
.B gbs3
may also be used to convert a gambas project to a script
.SH "OPTIONS"
.TP
\fB\-b, --buildonly\fR
process and compile the script without executing it
.TP
\fB\-c, --nocache\fR
force the script compilation (do not check cache)
.TP
\fB\-f, --fast\fR
use just-in-time compiler
.TP
\fB\-e\fR
execute the source code provided by the command line ( ':' separator )
.TP
\fB\-f, --fast\fR
use just-in-time compiler
TP
\fB\-g, --debug\fR
add debugging information to application
.TP
\fB\-h, --help\fR
display help and exit
.TP
\fB\-L, --license\fR
display license
.TP
\fB\-u\fR
force components loading ('comp1,comp2...')
\fB\-S --strict\fR
fail if 'Public' or 'Sub' are defined without a 'main' function otherwise create main()
.TP
\fB\-t, --trace\fR
turn on tracing option during execution
.TP
\fB\-T, --terse\fR
only print a very terse error report on compile errors
.TP
\fB\-u, --use\fR
load component or libraries ('comp1,comp2,lib1...')
.TP
\fB\-v, --verbose\fR
be verbose
.TP
\fB\-V, --version\fR
display version
.TP
\fB\-w, --warnings\fR
display warnings during compilation
.TP
\fB\--convert-project\fR
convert a simple project to a script
.SH "PROJECT CONVERSION"
.B gbs3
can convert a gambas project to an executable script file using the --convert-project option.
.br
The input project directory is used to createthe script which is written to the output script directory.
.br
The script is created and named the same as the orginating project.
.B gbs3
MyProjectDirectory DestinationScriptDirectory
.SH "EXAMPLE"
#!/usr/bin/env gbs3
.br
for i as integer = 0 to 10
.br
print i;;
.br
next
.SH "AVAILABILITY"
The latest version of Gambas can always be obtained from

View file

@ -1,25 +1,46 @@
.TH "gbw3" "1" "October 2013" "Ubuntu" "User Commands"
.TH "gbs3" "1" "March 2021" "Ubuntu" "User Commands"
.SH "NAME"
gbw3 \- GAMBAS Web Page Interpeter
gbs3 \- GAMBAS Scripter
.SH "SYNOPSIS"
.B gbw3
[options] [<server page file>]
.B gbs3
[options] [--] [<script file> | -]
.br
.B gbs3
--convert-project <source project directory> <destination script directory>
.SH "DESCRIPTION"
Gambas is a free development environment based on a Basic interpreter with object extensions, a mix of Java(tm) and Visual Basic(tm).
With Gambas, you can quickly design your program GUI, access MySQL or PostgreSQL databases, pilot KDE applications with DCOP, translate your program into many languages, and so on...
Gambas is a free development environment based on a Basic interpreter with object extensions,
.br
a mix of Java(tm) and Visual Basic(tm).
.br
With Gambas, you can quickly design your program GUI, access MySQL or PostgreSQL databases,
.br
pilot KDE applications with DCOP, translate your program into many languages, and so on...
\fBgbx3\fR is the interpreter that allows you to compile and execute a Gambas server page script.
.B gbs3
is the interpreter that allows you to compile and execute a Gambas script.
.br
.B gbs3
may also be used to convert a gambas project to a script
.SH "OPTIONS"
.TP
\fB\-b, --buildonly\fR
process and compile the script without executing it
.TP
\fB\-c, --nocache\fR
force the script compilation (do not check cache)
.TP
\fB\-e\fR
execute the source code provided by the command line ( ':' separator )
.TP
\fB\-f, --fast\fR
use just-in-time compiler
TP
\fB\-g, --debug\fR
add debugging information to application
.TP
\fB\-h, --help\fR
display help and exit
@ -27,25 +48,61 @@ display help and exit
\fB\-L, --license\fR
display license
.TP
\fB\-u\fR
force components loading ('comp1,comp2...')
\fB\-S --strict\fR
fail if 'Public' or 'Sub' are defined without a 'main' function otherwise create main()
.TP
\fB\-t, --trace\fR
turn on tracing option during execution
.TP
\fB\-T, --terse\fR
only print a very terse error report on compile errors
.TP
\fB\-u, --use\fR
load component or libraries ('comp1,comp2,lib1...')
.TP
\fB\-v, --verbose\fR
be verbose
.TP
\fB\-V, --version\fR
display version
.TP
\fB\-w, --warnings\fR
display warnings during compilation
.TP
\fB\--convert-project\fR
convert a simple project to a script
.SH "PROJECT CONVERSION"
.B gbs3
can convert a gambas project to an executable script file using the --convert-project option.
.br
The input project directory is used to createthe script which is written to the output script directory.
.br
The script is created and named the same as the orginating project.
.B gbs3
MyProjectDirectory DestinationScriptDirectory
.SH "EXAMPLE"
#!/usr/bin/env gbs3
.br
for i as integer = 0 to 10
.br
print i;;
.br
next
.SH "AVAILABILITY"
The latest version of Gambas can always be obtained from
\fBgambas.sourceforge.net\fR, documentation about the language is at
\fBwww.gambasdoc.org\fR.
\fBhttp://gambaswiki.org/wiki\fR.
.SH "REPORTING BUGS"
Report bugs to \fBhttp://gambaswiki.org/bugtracker\fR
.SH "COPYRIGHT"
Copyright\(co 2002, 2013 Benoît Minisini <g4mba5@gmail.com>;
Copyright\(co Benoît Minisini <g4mba5@gmail.com>;
.PP
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

View file

@ -1,3 +1,18 @@
* Mon Mar 08 2021 benoit <benoit@localhost> 3.15.90
* Mon Mar 08 2021 benoit <benoit@localhost> 3.15.90
* Mon Mar 08 2021 benoit <benoit@localhost> 3.15.90
* Mon Mar 08 2021 benoit <benoit@localhost> 3.15.90
* Mon Mar 08 2021 benoit <benoit@localhost> 3.15.90
* Mon Mar 08 2021 benoit <benoit@localhost> 3.15.90
* Mon Mar 08 2021 benoit <benoit@localhost> 3.15.90
- Updated stdio process - bad filename
* Fri Mar 05 2021 benoit <benoit@localhost> 3.15.90
* Thu Mar 04 2021 benoit <benoit@localhost> 3.15.90

View file

@ -1,13 +1,14 @@
# Gambas Project File 3.0
Title=gbs3
Startup=MMain
UseTerminal=1
Icon=icon.png
Version=3.15.90
VersionFile=1
Component=gb.eval
Description="Gambas Script"
Authors="Fabien Bodard, Benoit Minisini, Brian G"
Arguments=[["--help"],["--use","'gb.notify,gb.web'","-e","For i as Integer = 0 To 10:Print \"Hello World\":Next"],["~/bin/who"],["-c","-T","~/bin/mytest"],["-v","TestApp"],["--verbose","TestAppWithMain"],["--verbose","TestLazyApp"],["-c","~/testerror.gbs"],["~/Scripts/TestQuoteAtEnd"],["-c","~/Scripts/AForm"],["-c","-v","-w","~/Scripts/GambasHelpSearch"],["-c","-v","-w","~/Scripts/AMain"],["-c","-v","-w","~/Scripts/gshoutput"],["~/Scripts/TestSets/testloop"],["--convert-project","~/Projects/TestPrograms/testerror"],["--convert-project","~/Projects/TestPrograms/TestParse","~/Scripts/TestSets"],["-c","-v","~/Scripts/TestSets/TestGlob.gbs"],["-l","library"],["-c","-v","-w","~/Scripts/testscripter"]]
Arguments=[["--help"],["--use","'gb.notify,gb.web'","-e","For i as Integer = 0 To 10:Print \"Hello World\":Next"],["~/bin/who"],["-c","-T","~/bin/mytest"],["-v","TestApp"],["--verbose","TestAppWithMain"],["--verbose","TestLazyApp"],["-c","~/testerror.gbs"],["~/Scripts/TestQuoteAtEnd"],["-c","~/Scripts/AForm"],["-c","-v","-w","~/Scripts/GambasHelpSearch"],["-c","-v","-w","~/Scripts/AMain"],["-c","-v","-w","~/Scripts/gshoutput"],["~/Scripts/TestSets/testloop"],["--convert-project","~/Projects/TestPrograms/testerror"],["--convert-project","~/Projects/TestPrograms/TestParse","~/Scripts/TestSets"],["-c","-v","~/Scripts/TestSets/TestGlob.gbs"],["-l","library"],["-c","-v","-w","~/Scripts/TestScripterNoMain"]]
CurrentArgumentList=["-c","-v","-w","~/Scripts/TestScripterNoMain"]
TabSize=2
Translate=1

8
app/src/gbs3/.src/Compile.module Executable file → Normal file
View file

@ -4,6 +4,7 @@
Private $sCommand As String = System.Path &/ "bin/gbc" & System.Version
Private $sBuffer As String
Public GoodCompile As Boolean = False
Public Sub _call(Parameters As String, ProjectPath As String) As String
@ -15,6 +16,13 @@ Public Sub _call(Parameters As String, ProjectPath As String) As String
Error.Raise("Compiler error:" & Error.text)
Endif
mmProc.Wait()
If mmProc.value = 0 Then
GoodCompile = True
Else
GoodCompile = False
Endif
Verbose("Compile exit code=" & mmProc.Value)
Return $sBuffer
End

View file

@ -30,7 +30,7 @@ Public $sUse As String ' List of t
Public $aIncFiles As New String[] ' files to be included
Public $bNoCache As Boolean ' turns off script compiled version caching, or ignores the cache already there
Public $bVerbose As Boolean ' Turns on the verbose, out put of the script compiler
Public $bVerbose As Boolean = False ' Turns on the verbose, out put of the script compiler
Public $bWarning As Boolean ' added to support warings to be displayed
Public $bWebPage As Boolean ' Used to indicate if we are Building a web page project

View file

@ -11,7 +11,10 @@ Public Sub _Call($oContext As Context, Path As String, sPrjPath As String)
Dim cReader As Reader
Dim cDef As ClassDef
If $oContext.$bScriptSourceStdIn And Not $oContext.$bWebPage Then
If $oContext.$bExecuteFromArgs Then
Verbose("Begin Script Process : from args or -e < ")
cReader = New Reader($oContext, "", Path)
Else If $oContext.$bScriptSourceStdIn And Not $oContext.$bWebPage Then
Verbose(("Begin Script Process : Read From StdIn"))
cReader = New Reader($oContext, "")
Else
@ -71,7 +74,7 @@ Public Sub _Call($oContext As Context, Path As String, sPrjPath As String)
CompileError(Path, 1, "Script Contains Public or Sub Definitions Without Having a 'Public Sub main()' defined")
Endif
Else
$oContext.$sFinalProgram = "'Gambas Module File\nPublic Sub main()\n" & cReader.GetProgram() & "\nEnd\n"
$oContext.$sFinalProgram = "Public Sub main()\n" & cReader.GetProgram() & "\nEnd\n"
Endif
Endif

View file

@ -4,7 +4,7 @@
' Public $cNativeTypes As Collection = ["i": "Integer", "s": "String", "f": "Float", "d": "Date", "b": "Boolean", "v": "Variant", "o": "Object", "l": "Long", "p": "Pointer"]
' Public $aVarsDecl As New Collection ' Used by preprocessor to store generated variable definitions
Public Sub _Call($oContext As Context, sLine As String)
Public Sub _Call($oContext As Context, sLine As String, sPrjPath As String)
Dim bCrochetOuvert As Boolean
Dim s As String
@ -36,7 +36,9 @@ Public Sub _Call($oContext As Context, sLine As String)
sCode &= s
Next
sCode &= "\n"
$oContext.$bExecuteFromArgs = True
GenerateFiles($oContext, sCode, sPrjPath)
' $aVarsDecl.Clear()
' If $oContext.$bPrecompiler Then
@ -55,10 +57,11 @@ Public Sub _Call($oContext As Context, sLine As String)
' Endif
'scode = "Public Sub Main()\n" & aDims.Join("\n") & "\n" & sCode
scode = "Public Sub Main()\n" & sCode & "\nEnd\n"
$oContext.$sFinalProgram &= sCode
' scode = "Public Sub Main()\n" & sCode & "\nEnd\n"
' $oContext.$sFinalProgram &= sCode
End
'Public Function PrecompileLine(sLine As String) As String

View file

@ -12,11 +12,12 @@ Public Sub _call(oContext As Context, Program As Reader) As String
aDefFunc.default = False
aSpecial.default = False
Dim DefOutput As String = "'Gambas Module 3.15.3\n"
' Dim DefOutput As String = "'Gambas Module 3.15.3\n"
Dim DefOutput As String = ""
If oContext.$bExport Then DefOutPut &= "Export\n"
If oContext.$bFast Then
DefOutPut &= "Fast" & IIf(oContext.$bUnsafe, " Unsafe\n", "\n")
Endif
' If oContext.$bFast Then
' DefOutPut &= "Fast" & IIf(oContext.$bUnsafe, " Unsafe\n", "\n")
' Endif
Dim MainOutput As String = "Public Sub Main()\n"
$iAdjustedOffset = 0
@ -47,9 +48,9 @@ Public Sub _call(oContext As Context, Program As Reader) As String
Next
MainOutPut &= Program.ProgramLines.Join("\n") & "\nEND\n"
If oContext.$bVerbose Then
Print MakeListing.GenListing(oContext, DefOutput & MainOutPut)
Endif
Verbose("Before Compile--------------------------------------------------")
Verbose(MakeListing.GenListing(oContext, DefOutput & MainOutPut))
Verbose("_____________________________________________")
Return DefOutput & MainOutPut
End

View file

@ -24,6 +24,7 @@ Public Sub Main() As Integer
Dim sCacheDir As String = File.Dir(File.Dir(Temp$())) &/ "script-cache"
Dim sRes As String
Dim bCompile As Boolean
With $oContext
' System.language = "fr_FR"
@ -32,7 +33,7 @@ Public Sub Main() As Integer
If Not .$bTestMode Then ' for testmode the test suite will set the parameters and paths
$sPath = ParseArgs($oContext)
If IsNull($sPath) Then
If ParseArgs.$bExit Then
Quit 0
Endif
@ -41,9 +42,9 @@ Public Sub Main() As Integer
sName = File.Name($sPath)
If Not $sPath Then
verbose("Reading from default Stdin")
$sPath = Read Lof(File.In) ' This is invoked when cmd line is like ' gbs -e < filename'
verbose(" Input read :\n" & $sPath)
If Not $sPath Then
Warning(("no input file specified"), True)
Return 1
@ -111,25 +112,31 @@ Public Sub Main() As Integer
Endif
$sPrjPath = MakeVirtualProject($oContext, $sPath)
If $sPath = "-" Then
$sPath = "mStdIoSource"
sName = $sPath
$oContext.$aIncFiles.push($sPath)
Endif
Dim parmstring As String = "-a"
If $oContext.$bdebug Then parmstring &= "g"
If $oContext.$bWarning Then parmstring &= "w"
If $oContext.$bVerbose Then Parmstring &= "v"
'If $oContext.$bVerbose Then Parmstring &= "v"
Verbose(System.Path &/ "bin/gbc" & System.Version & " " & parmstring & " " & $sPrjPath & " 2>&1")
'Shell (System.Path &/ "bin/gbc" & System.Version & " " & parmstring & " " & $oContext.$sPrjPath & " 2>&1") To sRes
sRes = Compile(parmstring, $sPrjPath)
Dim sResLines As String[] = Split(sRes, "\n", "", True) ' added to only check the last line from compiler, ignore all others
If sResLines[sResLines.max] <> "OK" Then
'Dim sResLines As String[] = Split(sRes, "\n", "", True) ' added to only check the last line from compiler, ignore all others
If Not Compile.GoodCompile Then
' Error sRes
If Not $oContext.$bTerseListing Then
Error sRes
Print File.Load($sPrjPath &/ ".project")
Endif
Print MakeListing($oContext, $sPrjPath, sRes)
Return 1
Endif
@ -152,15 +159,14 @@ Public Sub Main() As Integer
$aAppArgs.Insert(RunParms, 0)
Verbose($aAppArgs.Join(" "))
If $oContext.$bVerbose Then
Print "***************** Script Output Begins Bellow This Line **************************"
Endif
verbose("***************** Script Output Begins Bellow This Line **************************")
If $oContext.$bTestMode Then
Exec $aAppArgs To $oContext.$sTestModeCapture
Else
Exec $aAppArgs Wait
Endif
verbose("***************** Script Output Ends **************************")
If Process.LastState = Process.Crashed Then
Warning(("Script had Segmentation fault, Code=" & Process.LastValue), True)
Endif

View file

@ -4,15 +4,15 @@ Public Sub _call(oContext As Context, sPrjPath As String, CompileErrors As Strin
Dim aErrors As String[] = Split(CompileErrors, "\n", "", True, True)
Dim sOutput As String = ""
For Each CompileError As String In aErrors
Dim aErrorParts As String[] = Split(CompileError, ":")
Dim sSource As String
Try sSource = File.Load(sPrjPath &/ ".src" &/ aErrorParts[0])
If Error Then
Return DumpAll(oContext, sPrjPath)
Endif
Dim aFileParts As String[] = Split(aErrorParts[0], ".")
sOutPut &= Subst("# Gambas &1 file : &2:&3:&4\n", aFileParts[1], aFileparts[0], aErrorParts[1], aErrorParts[2]) &
GenListing(oContext, sSource, aErrorParts[1], aErrorParts[2], aErrorParts.extract(4, -1).Join(":"))
Dim aErrorParts As String[] = Split(CompileError, ":")
Dim sSource As String
Try sSource = File.Load(sPrjPath &/ ".src" &/ aErrorParts[0])
If Error Then
Return "Error : UnKnown Module/Class Dumping everything!:\n" & DumpAll(oContext, sPrjPath)
Endif
Dim aFileParts As String[] = Split(aErrorParts[0], ".")
sOutPut &= Subst("# Gambas &1 file : &2:&3:&4\n", aFileParts[1], aFileparts[0], aErrorParts[1], aErrorParts[2]) &
GenListing(oContext, sSource, aErrorParts[1], aErrorParts[2], aErrorParts.extract(4, -1).Join(":"))
Next
Return sOutPut
End
@ -20,14 +20,14 @@ End
Public Sub GenListing(oContext As Context, sSource As String, Optional iLine As Integer = 0, iPosition As Integer = 0, sError As String = "") As String
Dim aLines As String[] = Split(sSource, "\n", "\"\"", False, True)
Dim sOutput As String = ""
Dim sOutput As String = "\n"
For i As Integer = 0 To aLines.Max
If Not oContext.$bTerseListing Or If i + 1 = iline Then
sOutPut &= Subst("&1&2:&3\n", Format(i + 1, "####0"), IIf((i + 1) = iLine, "*", " "), aLines[i])
Endif
If i + 1 = iLine Then
sOutPut &= Space(5 + iPosition) & " ^" & sError & "\n"
Endif
If Not oContext.$bTerseListing Or If i + 1 = iline Or If oContext.$bVerbose And iLine = 0 Then
sOutPut &= Subst("&1&2:&3\n", Format(i + 1, "####0"), IIf((i + 1) = iLine, "*", " "), aLines[i])
Endif
If i + 1 = iLine Then
sOutPut &= Space(5 + iPosition) & " ^" & sError & "\n"
Endif
Next
Return sOutput
End

View file

@ -30,11 +30,12 @@ Public Sub _Call($oContext As Context, sPath As String) As String
$oContext.$sPreambleHeader = "' Gambas module file\n"
If $oContext.$bExecuteFromArgs Then
GenerateFilesFromArgs($oContext, sPath)
GenerateFilesFromArgs($oContext, sPath, $sPrjPath)
Else
GenerateFiles($oContext, sPath, $sPrjPath)
Endif
If $oContext.$bExport Then $oContext.$sCompilerOptions &= "Export\n"
If $oContext.$bFast Then
$oContext.$sCompilerOptions &= "Fast"
If $oContext.$bUnsafe Then $oContext.$sCompilerOptions &= " Unsafe"
@ -68,11 +69,11 @@ Public Sub _Call($oContext As Context, sPath As String) As String
Verbose(".project File\n" & sPrjFileContent)
File.Save($sPrjPath &/ ".project", sPrjFileContent)
Print #$hOutFile, $oContext.$sPreambleHeader
Print #$hOutFile, $oContext.$sCompilerOptions
Print #$hOutFile, $oContext.$sStructures
Print #$hOutFile, $oContext.$sProgramHeader
Print #$hOutFile, $oContext.$sFinalProgram
If $oContext.$sPreambleHeader <> "" Then Print #$hOutFile, $oContext.$sPreambleHeader
If $oContext.$sCompilerOptions <> "" Then Print #$hOutFile, $oContext.$sCompilerOptions
If $oContext.$sStructures <> "" Then Print #$hOutFile, $oContext.$sStructures
If $oContext.$sProgramHeader <> "" Then Print #$hOutFile, $oContext.$sProgramHeader
If $oContext.$sFinalProgram <> "" Then Print #$hOutFile, $oContext.$sFinalProgram
Close $hOutFile
Return $sPrjPath

View file

@ -1,7 +1,7 @@
' Gambas module file
Enum eVersion, eLicense, eHelp, eNoCache, eDebug, eVerbose, eExec, eFast, eUnsafe, eTrace, eUse, eWarnings, eBuildOnly, eList, eStdio, eLazyStrict, eTerseListing, eConvertProject
$bExit As Boolean = False
Public $bExit As Boolean = False
Public $cPossibleArgs As Collection = [
"-V": eVersion, "--version": eVersion,

View file

@ -49,7 +49,7 @@ Private aWarnings As New String[]
' Public bUnsafe As Boolean = False ' Found an unsafe compiler option
Private $oContext As Context ' all the global variables
Public Sub _New(cContext As Context, Optional SourceFile As String = "")
Public Sub _New(cContext As Context, Optional SourceFile As String = "", Sourceprogram As String = "")
Dim SourceBuffer As String
$oContext = cContext ' Access to global variables
@ -57,7 +57,9 @@ Public Sub _New(cContext As Context, Optional SourceFile As String = "")
sDefaultFilePath = File.Dir(SourceFile) ' Set the default file path to use for includes
sSourceFile = SourceFile
If SourceFile = "" Then
If SourceProgram <> "" Then ' Updated to correctly process -e thru full process for -e < filename cases
SourceBuffer = SourceProgram
Else If SourceFile = "" Then
SourceBuffer = GetStdio()
Else
$oContext.$aIncFiles.Add(SourceFile)
@ -160,8 +162,10 @@ Private Sub TokenizeFile(SourceBuffer As String)
If Highlight.Types.count > 2 Then
aWarnings.Add("Warning : Defined without main : " & Highlight.Symbols[0] & ":" & File.Name(cIncludeStack.last) & "." & CurrentLineNumber.last & " : " & sline)
bPublicOrSubDef = True
GlobalItemPosition.Add(ProgramLines.count)
Else If $oContext.$bFast = True Then ' already defined
Verbose("FAST Duplicate Definition at " & File.Name(cIncludeStack.last) & "." & CurrentLineNumber.last)
Warning("FAST Duplicate Definition at " & File.Name(cIncludeStack.last) & "." & CurrentLineNumber.last)
sLine = "' " & sLine
Else If Highlight.types.count = 1 Then
Verbose("FAST(Jit) activated for Module:" & File.name(cIncludeStack.last) & "." & CurrentLineNumber.last)
$oContext.$bFast = True
@ -395,11 +399,12 @@ Public Sub ProcessInclude(Includes As String[], atypes As Integer[], sDefaultPat
Endif
If cIncludedFiles[sFilePath] Then Continue ' we only include things once
Verbose("Including script file : " & sFilePath & " From File : " & cIncludeStack[cIncludeStack.max] & "." & CurrentLineNumber.last)
If cIncludeStack.Find(sFilePath) > 0 Then
CompileError(cIncludeStack.last, CurrentLineNumber.last, "Include \"" & sFilePath & "\" Circular Refrence")
If cIncludeStack.Find(sFilePath) > -1 Then
Warning(cIncludeStack.last & ":" & CurrentLineNumber.last & ":" & "Include \"" & sFilePath & "\" Circular Refrence")
Continue
Else
Verbose("Including script file : " & sFilePath & " From File : " & cIncludeStack[cIncludeStack.max] & "." & CurrentLineNumber.last)
cIncludeStack.Push(sFilePath)
Endif

View file

@ -86,7 +86,7 @@ Public Sub CompareStringArray(sA As String[], sB As String[]) As Boolean
Dim bFinalResult As Boolean = True
Dim sPrintLine As String
For i As Integer = 0 To IIf(sA.max > sB.max, sA.max, sB.max)
Try bResult = (sA[i] = sB[i])
Try bResult = (sA[i] == sB[i])
If Error Then
bResult = False
Error.Clear()
@ -142,7 +142,7 @@ Public Sub CompareStringContent(sA As String[], sB As String[]) As Boolean
If bFinalResult = False Then
Test.Note(Subst("Compare size a=&1, b=&2", sA.count, sB.count))
For i As Integer = 0 To IIf(sA.max > sB.max, sA.max, sB.max)
Try bResult = (sA[i] = sB[i])
Try bResult = (sA[i] == sB[i])
If Error Then
bResult = False
Error.Clear()

View file

@ -18,7 +18,7 @@ Public Sub CreateProgramFromCommandLineArgs()
MMain._ResetAll()
MMain.$oContext.$bExecuteFromArgs = True
MMain.$oContext.$sUse = "gb.eval.highlight,gb.pcre,gb.notifyt"
Dim sResult As String = TSR.ErrorMsgOut(GenerateFilesFromArgs, "_call", mMain.$oContext, "Dim I As Integer:Print I:Inc I")
Dim sResult As String = TSR.ErrorMsgOut(GenerateFilesFromArgs, "_call", mMain.$oContext, "Dim I As Integer:Print I:Inc I", "projectpath")
Dim sExpect As String = "gbs" & System.Version & ": gb.eval.highlight,gb.pcre,gb.notifyt.0: Unknown component: gb.notifyt"
Assert.Equals(sResult, sExpect, "Test For bad Component ")
If TSR.$bTestDebug Then
@ -30,8 +30,8 @@ Public Sub CreateProgramFromCommandLineArgs()
'MMain.$oContext.$bPrecompiler = True
MMain.$oContext.$bExecuteFromArgs = True
MMain.$oContext.$sUse = "gb.eval.highlight,gb.pcre,gb.web"
GenerateFilesFromArgs(mMain.$oContext, "Dim i As Integer:i=9:Print i:Inc i")
Assert.Equals(TSR.CompareStringArray(Split(Mmain.$oContext.$sFinalProgram, "\n", "", True), Split("Public Sub Main()\nDim i As Integer\ni=9\nPrint i\nInc i\n\nEnd\n", "\n", "", True)), True, "Verify program is formatted Correctly from command Line")
GenerateFilesFromArgs(mMain.$oContext, "Dim i As Integer:i=9:Print i:Inc i", "sourcepath")
Assert.Equals(TSR.CompareStringArray(Split(Mmain.$oContext.$sFinalProgram, "\n", "", True), Split("Public Sub main()\nDim i As Integer\ni=9\nPrint i\nInc i\n\nEnd\n", "\n", "", True)), True, "Verify program is formatted Correctly from command Line")
End ' Gambas test file
Public Sub ExecuteACommandLineProgram()

View file

@ -24,7 +24,6 @@ Component=gb.eval.highlight
Component=gb.pcre
}
' Gambas module file
'Gambas Module File
Public Sub main()
' #!/usr/bin/gbs3
'#SCRIPT Version="1.0.5"