#define INT_V 1
#define STR_V 2
#define SINGLE_V 3
#define BOOL_V 4
#define TheLine Now_line(1)
#define Now_Line_ Now_line(0)
#DEFINE UV UserVariable
#define Uninitialized_V 0
#define __debug "on"
Dim Shared ScriptPath As string
Dim Shared VusVersion As const string * 5= "1.5.5"
Dim Shared UserVariable(0 To 128) As Variable
Dim Shared Line_Data() As String
Dim Shared Now_line(2) As INTEGER
Type Variable
_name As String
_type As Short
_data_string As STRING
_data_int As Long
_data_bool As BOOLEAN
_data_decimal As double
End Type
Function FF_WINMAIN(ByVal hInstance As HINSTANCE) As Long
Dim As BOOLEAN HelpMe,WindowStay
Initialization
dim i As short = 0
PC 10,"Vuscript 1.5.5 <For beta test> On win32[date:2020/3/31]"
PC 10, "Copyright (c) 2018-2020 by znkzz. All rights reserved. use ""--help"" for help."
While len(Command(i)) <>0
i = 1 + i
wend
i = i -1
If i < 2 And Command(1)<>"--help" Then
PC 12, "Too few command line arguments or Invalid command line arguments "
exit_ (-1)
ElseIf i > 4 then
PC 12, "Too many command line arguments"
exit_ (-2)
End If
i=1
While len(Command(i)) <>0
if Command(i) = "-load" Then
ScriptPath= Command(i + 1)
if len(ScriptPath) = 0 then
PC 12, "Invalid script path."
exit_( -3)
end if
ElseIf Command(i) = "-stay" then
WindowStay = true
ElseIf Command(i) = "--help" then
HelpMe = true
ElseIf Command(i-1)<>"-load" then
PC 12, "Invalid command line arguments """ + Command(i) + """"
exit_( -4)
End if
i=i+1
wend
GetLine_And_LoadLine
if HelpMe = True Then
PC 3, "Use ""--help"" To get help"
PC 3, "Use ""-stay"" to let this window couldt be close"
PC 3, "Use ""-load"" <scriptfile> to load vuscript file"
End If
if WindowStay = True Then
getchar
End If
LoadScript
Function=false
End Function
Sub FF_WINEND(ByVal hInstance As HINSTANCE)
PC 3, "Vuscript Exited"
End Sub
Sub cl(cl2 As const integer)
if cl2>=0 and cl2<=15 then
SetConsoleTextAttribute GetStdHandle(STD_OUTPUT_HANDLE), cl2
else
SetConsoleTextAttribute GetStdHandle(STD_OUTPUT_HANDLE), 7
End if
End Sub
Sub PC( cl2 As const integer, D AS const STRING)
cl cl2
pRINT D
cl 16
End Sub
Sub LoadScript()
if filelen(ScriptPath) = 0 or filelen(ScriptPath) < 0 Then
PC 12, "Script Is empty Or none!! Script: "+ScriptPath
exit_( -5)
End If
#if __debug = "on"
Printa "[代码行"+str(__LINE__)+"]已载入" +ScriptPath
#endif
if Left(Line_Data(Now_Line_), 4) =":end" then
exit_(0)
End if
End Sub
Function CheckVar( VAR_ As const Variable)As BOOLEAN
if VAR_. _type = INT_V And VAR_. _data_int = UV(0). _data_int Then
Function=false
ElseIf VAR_. _type = STR_V And VAR_. _data_string = UV(0). _data_string Then
Function = False
ElseIf VAR_. _type = SINGLE_V And VAR_. _data_decimal = UV(0). _data_decimal Then
Function = False
ElseIf VAR_. _NAME = "^Uninitialized^" Then
Function = False
Else
Function = True
End IF
End Function
sub Initialization
Randomize
dim i As Short
Dim RdChar As const string=Str((126 * Rnd) + 1) + Str((126 * Rnd) + 1) + Str((126 * Rnd) + 1)
Dim RdSingle As const Single =Rnd
Dim RdInt As const integer =(1024 * Rnd) + 1
For i = 0 To 64
UV(i). _type = Uninitialized_V
UV(i). _data_decimal = RdSingle
UV(i). _data_int = RdInt
UV(i). _data_string = RdChar
UV(i). _name = "^Uninitialized^"
Next
Now_Line_ = 1
End Sub
Function GetInBracketValue( expression As const string)As Variable
End Function
Sub GetLine_And_LoadLine
Dim f As const Integer=FreeFile
Open ScriptPath For Binary As #f
TheLine = Split(Input(LOF(1), #1), vbCrLf, Line_Data())
#if __debug = "on"
Printa "[代码行"+str(__LINE__)+"]行 "+str(TheLine)
PrintA "[代码行"+str(__LINE__)+"]行数据 "+ Line_Data(TheLine)
#endif
Close #f
End Sub
FreeBASIC aplicar intérprete de guiones: Vuscript (actualizado continuamente)
Supongo que te gusta
Origin www.cnblogs.com/obj-a/p/USE-FREE-BASIC-MAKE-SCRIPT.html
Recomendado
Clasificación