Skip to content

@X39 X39 released this Mar 28, 2019 · 253 commits to master since this release

Changelog
- CLI: Added `--command-dummy-nular name` to add dummy commands.
- CLI: Added `--command-dummy-unary name` to add dummy commands.
- CLI: Added `--command-dummy-binary 4|name` to add dummy commands.
- CLI: Added `--no-assembly-creation` which allows to disable the creation of executable assembly (useful for `--parse-only` as it will enhance the speed)
- VM: Error messages of preproc now contain line, col and file info
- VM: SQF-Parsing performance improvement
- VM: File System Overhauled
- VM: Changed library load failed message
- VM: All filepaths printed now are absolute.
- VM: Added warning on data after `#include`
- VM: Added `assembly__ CODE` unary operator
- VM: Added `createMarker [STRING, OBJECT]`
- VM: Added `__LINE__` and `__FILE__` support for PreProcessor
- VM: Fixed crash when not providing enough params in preproc
- VM: Fixed `--parse-only` returning `-1` as exit code
- VM: Fixed parser not detecting eg. `.5`
- VM: Fixed numbers with tailing `-` operator, are parsed invalidly
- VM: Fixed `/*/` getting parsed as open & close block comment
- VM: Fixed `###R` not producing `#R`
- VM: Fixed macro with args blocking same text without args
- VM: Fixed commas in strings invalidly getting parsed as separator for macros
- VM: Fixed local path not properly working with #include
- VM: Fixed #file macro getting `]\t` attached
- VM: Fixed Number Exponent parsing bug
- VM: Fixed `ceil` being recognized as `cei`
- VM: Fixed immediate \ after macro name not getting read proper
- VM: Fixed `#ifdef` etc. still allowing strings when false
- VM: Fixed `in` always returning true
- VM: Fixed `isNil CODE` causing an endless loop
- VM: Fixed CODE type getting constructed wrong, causing the work stack to never be emptied
- VM: Fixed calling code wiped current variable stack.
- VM: Fixed missing l on null for null objects
- VM: Fixed passing nil would sometimes still execute an unary or binary operator
- VM: Fixed getvariable returning wrong value type if nil
- VM: Fixed `callExtension` required file extension on linux
- VM: Fixed `ARRAY select SCALAR` erroring on index == size
- VM: Fixed crash when numbers exceeded valid range (`std::out_of_range` now gets catched and a `NaN` type is created. Warning gets emitted)
- VM: Fixed `createMarker ARRAY` is returning first value of position instead of string
Help output
.\sqfvm.exe --help

USAGE:

   D:\Git\SQFvm\RELEASE-FOLDER\SQF-VM\x86\sqfvm.exe  [-h] [--version] [--]
                                        [--cli-file <PATH>] [-i <PATH>] ...
                                        [--input-sqf <PATH>] ...
                                        [--input-config <PATH>] ...
                                        [--input-pbo <PATH>] ...  [--sqf
                                        <CODE>] ...  [--config <CODE>] ...
                                        [--pretty-print <PATH>] ...  [-E
                                        <PATH>] ...  [--command-dummy-nular
                                        <NAME>] ...  [--command-dummy-unary
                                        <NAME>] ...
                                        [--command-dummy-binary <PRECEDENCE
                                        |NAME>] ...  [-a] [-d <PORT>] [-m
                                        <NUMBER>] [-c] [-l <PATH>] ...  [-v
                                        <PATH|VIRTUAL>] ...  [--verbose]
                                        [--parse-only] [--no-work-print]
                                        [--no-execute-print]
                                        [--no-load-execdir]
                                        [--no-assembly-creation]


Where:

   -h,  --help
     Displays usage information and exits.

   --version
     Displays version information and exits.

   --,  --ignore_rest
     Ignores the rest of the labeled arguments following this flag.

   --cli-file <PATH>
     Allows to provide a file from which to load arguments from. If passed,
     all other arguments will be ignored! Each argument needs to be
     separated by line-feed. Supports absolut and relative pathing using
     '.\path\to\file' or 'C:\path\to\file'.

   -i <PATH>,  --input <PATH>  (accepted multiple times)
     Loads provided file from disk. File-Type is determined using default
     file extensions (sqf, cpp, hpp, pbo). Supports absolut and relative
     pathing using '.\path\to\file' or 'C:\path\to\file'.!BE AWARE! This is
     case-sensitive!

   --input-sqf <PATH>  (accepted multiple times)
     Loads provided SQF file from disk. Will be executed before files,
     added using '--input'. Supports absolut and relative pathing using
     '.\path\to\file' or 'C:\path\to\file'.!BE AWARE! This is
     case-sensitive!

   --input-config <PATH>  (accepted multiple times)
     Loads provided config file from disk. Will be parsed before files,
     added using '--input'. Supports absolut and relative pathing using
     '.\path\to\file' or 'C:\path\to\file'.!BE AWARE! This is
     case-sensitive!

   --input-pbo <PATH>  (accepted multiple times)
     Loads provided PBO file from disk. Will be parsed before files, added
     using '--input'. Supports absolut and relative pathing using
     '.\path\to\file' or 'C:\path\to\file'.!BE AWARE! This is
     case-sensitive!

   --sqf <CODE>  (accepted multiple times)
     Loads provided sqf-code directly into the VM. Input is not getting
     preprocessed!

   --config <CODE>  (accepted multiple times)
     Loads provided config-code directly into the VM. Input is not getting
     preprocessed!

   --pretty-print <PATH>  (accepted multiple times)
     Loads provided file from disk and pretty-prints it onto console.!BE
     AWARE! This is case-sensitive!

   -E <PATH>,  --preprocess-file <PATH>  (accepted multiple times)
     Runs the preprocessor on provided file and prints it to stdout.
     Supports absolut and relative pathing using '.\path\to\file' or
     'C:\path\to\file'.!BE AWARE! This is case-sensitive!

   --command-dummy-nular <NAME>  (accepted multiple times)
     Adds the provided command as dummy.

   --command-dummy-unary <NAME>  (accepted multiple times)
     Adds the provided command as dummy.

   --command-dummy-binary <PRECEDENCE|NAME>  (accepted multiple times)
     Adds the provided command as dummy. Note that you need to also provide
     a precedence. Example: 4|commandname

   -a,  --automated
     Disables all possible prompts.

   -d <PORT>,  --debugger <PORT>
     Causes the sqf-vm to start a network server that allows to attach a
     single debugger to it.

   -m <NUMBER>,  --max-instructions <NUMBER>
     Sets the maximum ammount of instructions to execute before a hard exit
     may occur. Setting this to 0 will disable the limit.

   -c,  --check-classnames
     Enables the config checking for eg. createVehicle.

   -l <PATH>,  --load <PATH>  (accepted multiple times)
     Adds provided path to the allowed locations list. Supports absolut and
     relative pathing using '.\path\to\file' or 'C:\path\to\file'.

     An allowed location, is a location SQF-VM will be allowed to load
     files from.If you try to load a file from a given directory that is
     not in the allowed list,the file loading WILL fail.Only the root path
     of a given folder needs to be added, sub-folders are accessible
     automatically.!BE AWARE! This is case-sensitive!

   -v <PATH|VIRTUAL>,  --virtual <PATH|VIRTUAL>  (accepted multiple times)
     Creates a mapping for a virtual and a physical path.Mapping is
     separated by a '|', with the left side being the physical, and the
     right argument the virtual path. Supports absolut and relative pathing
     using '.\path\to\file' or 'C:\path\to\file'.

   --verbose
     Enables additional output.

   --parse-only
     Disables all code execution entirely and performs only the parsing &
     assembly generation tasks. Note that this also will prevent the
     debugger to start. To disable assembly generation too, refer to
     --no-assembly-creation.

   --no-work-print
     Disables the printing of all values which are on the work stack.

   --no-execute-print
     Disables the `Executing...` and two horizontal lines hint printing.

   --no-load-execdir
     Prevents automatically adding the workspace to the path of allowed
     locations.

   --no-assembly-creation
     Will force to use only the SQF parser. Execution of SQF-code will not
     work with this. Useful, if one only wants to perform syntax checks.


   Emulates the ArmA-Series SQF environment.
Supported Commands
[
    ["n","parsingnamespace"],
    ["n","pi"],
    ["n","sidelogic"],
    ["n","nil"],
    ["n","east"],
    ["n","missionnamespace"],
    ["n","uinamespace"],
    ["n","profilenamespace"],
    ["n","resistance"],
    ["n","player"],
    ["n","productversion"],
    ["n","allunits"],
    ["n","diag_ticktime"],
    ["n","exit__"],
    ["n","cansuspend"],
    ["n","halt"],
    ["n","cmds__"],
    ["n","cmdsimplemented__"],
    ["n","allobjects__"],
    ["n","vm__"],
    ["n","respawn__"],
    ["n","true"],
    ["n","false"],
    ["n","confignull"],
    ["n","configfile"],
    ["n","blufor"],
    ["n","allmapmarkers"],
    ["n","west"],
    ["n","opfor"],
    ["n","independent"],
    ["n","civilian"],
    ["n","sideempty"],
    ["n","sideenemy"],
    ["n","sidefriendly"],
    ["n","sideunknown"],
    ["n","grpnull"],
    ["n","objnull"],
    ["u","abs","SCALAR"],
    ["u","sqrt","SCALAR"],
    ["u","preprocessfilelinenumbers","STRING"],
    ["u","deg","SCALAR"],
    ["u","acos","SCALAR"],
    ["u","assembly__","CODE"],
    ["u","switch","ANY"],
    ["u","selectmax","ARRAY"],
    ["u","log","SCALAR"],
    ["u","sin","SCALAR"],
    ["u","-","SCALAR"],
    ["u","tan","SCALAR"],
    ["u","rad","SCALAR"],
    ["u","sleep","SCALAR"],
    ["u","exp","SCALAR"],
    ["u","random","SCALAR"],
    ["u","systemchat","STRING"],
    ["u","+","SCALAR"],
    ["u","+","NaN"],
    ["u","+","ARRAY"],
    ["u","!","BOOL"],
    ["u","atg","SCALAR"],
    ["u","floor","SCALAR"],
    ["u","count","ARRAY"],
    ["u","count","STRING"],
    ["u","count","CONFIG"],
    ["u","cei","SCALAR"],
    ["u","asin","SCALAR"],
    ["u","if","BOOL"],
    ["u","selectmin","ARRAY"],
    ["u","ln","SCALAR"],
    ["u","nearestobjects","ARRAY"],
    ["u","atan","SCALAR"],
    ["u","cos","SCALAR"],
    ["u","assert","BOOL"],
    ["u","deletemarkerlocal","STRING"],
    ["u","round","SCALAR"],
    ["u","private","STRING"],
    ["u","private","ARRAY"],
    ["u","vectormagnitude","ARRAY"],
    ["u","velocity","OBJECT"],
    ["u","param","ARRAY"],
    ["u","vectormagnitudesqr","ARRAY"],
    ["u","vectornormalized","ARRAY"],
    ["u","default","CODE"],
    ["u","side","GROUP"],
    ["u","side","OBJECT"],
    ["u","comment","STRING"],
    ["u","tofixed","SCALAR"],
    ["u","allvariables","NAMESPACE"],
    ["u","allvariables","OBJECT"],
    ["u","allvariables","GROUP"],
    ["u","call","CODE"],
    ["u","with","NAMESPACE"],
    ["u","compile","STRING"],
    ["u","typename","ANY"],
    ["u","while","CODE"],
    ["u","gettext","CONFIG"],
    ["u","prettyprintsqf__","STRING"],
    ["u","str","ANY"],
    ["u","for","STRING"],
    ["u","selectrandom","ARRAY"],
    ["u","reverse","ARRAY"],
    ["u","isnil","STRING"],
    ["u","isnil","CODE"],
    ["u","toupper","STRING"],
    ["u","hint","STRING"],
    ["u","hint","TEXT"],
    ["u","tolower","STRING"],
    ["u","scriptname","STRING"],
    ["u","case","ANY"],
    ["u","format","ARRAY"],
    ["u","scriptdone","SCRIPT"],
    ["u","tree__","STRING"],
    ["u","params","ARRAY"],
    ["u","createmarker","ARRAY"],
    ["u","preprocessfile","STRING"],
    ["u","preprocessfile","STRING"],
    ["u","diag_log","ANY"],
    ["u","deletemarker","STRING"],
    ["u","configparse__","STRING"],
    ["u","damage","OBJECT"],
    ["u","help__","STRING"],
    ["u","preprocess__","STRING"],
    ["u","toarray","STRING"],
    ["u","commander","OBJECT"],
    ["u","tostring","ARRAY"],
    ["u","configname","CONFIG"],
    ["u","confighierarchy","CONFIG"],
    ["u","inheritsfrom","CONFIG"],
    ["u","isnumber","CONFIG"],
    ["u","istext","CONFIG"],
    ["u","isclass","CONFIG"],
    ["u","vehicle","OBJECT"],
    ["u","markerdir","STRING"],
    ["u","isarray","CONFIG"],
    ["u","getnumber","CONFIG"],
    ["u","getarray","CONFIG"],
    ["u","isnull","CONFIG"],
    ["u","isnull","GROUP"],
    ["u","isnull","OBJECT"],
    ["u","configproperties","ARRAY"],
    ["u","creategroup","SIDE"],
    ["u","groupid","GROUP"],
    ["u","units","GROUP"],
    ["u","units","OBJECT"],
    ["u","deletegroup","GROUP"],
    ["u","typeof","OBJECT"],
    ["u","createvehicle","ARRAY"],
    ["u","alive","OBJECT"],
    ["u","deletevehicle","OBJECT"],
    ["u","position","OBJECT"],
    ["u","getpos","OBJECT"],
    ["u","getdammage","OBJECT"],
    ["u","crew","OBJECT"],
    ["u","objectparent","OBJECT"],
    ["u","driver","OBJECT"],
    ["u","gunner","OBJECT"],
    ["u","getmarkertype","STRING"],
    ["u","markertype","STRING"],
    ["u","getmarkersize","STRING"],
    ["u","markersize","STRING"],
    ["u","getmarkercolor","STRING"],
    ["u","markercolor","STRING"],
    ["u","getmarkerpos","STRING"],
    ["u","markerpos","STRING"],
    ["u","markerbrush","STRING"],
    ["u","markertext","STRING"],
    ["u","markershape","STRING"],
    ["u","markeralpha","STRING"],
    ["u","createmarkerlocal","ARRAY"],
    ["b","SCALAR","atan2","SCALAR"],
    ["b","SCALAR","min","SCALAR"],
    ["b","OBJECT","domove","ARRAY"],
    ["b","ARRAY","domove","ARRAY"],
    ["b","ARRAY","vectorcrossproduct","ARRAY"],
    ["b","SCALAR","^","SCALAR"],
    ["b","CODE","foreach","ARRAY"],
    ["b","ARRAY","vectordiff","ARRAY"],
    ["b","SCALAR","max","SCALAR"],
    ["b","ARRAY","vectoradd","ARRAY"],
    ["b","ARRAY","set","ARRAY"],
    ["b","SCALAR","mod","SCALAR"],
    ["b","ANY","spawn","CODE"],
    ["b","SCALAR","-","SCALAR"],
    ["b","ARRAY","-","ARRAY"],
    ["b","SCALAR","%","SCALAR"],
    ["b","SCALAR","+","SCALAR"],
    ["b","ARRAY","+","ARRAY"],
    ["b","STRING","+","STRING"],
    ["b","ARRAY","findif","CODE"],
    ["b","SCALAR","*","SCALAR"],
    ["b","ANY","in","ARRAY"],
    ["b","OBJECT","in","OBJECT"],
    ["b","SCALAR","tofixed","SCALAR"],
    ["b","SCALAR","/","SCALAR"],
    ["b","CONFIG","/","STRING"],
    ["b","BOOL","||","BOOL"],
    ["b","BOOL","||","CODE"],
    ["b","ARRAY","vectorcos","ARRAY"],
    ["b","IF","exitwith","CODE"],
    ["b","ANY","call","CODE"],
    ["b","ARRAY","vectordistance","ARRAY"],
    ["b","CONFIG",">>","STRING"],
    ["b","SWITCH",":","CODE"],
    ["b","ARRAY","vectordistancesqr","ARRAY"],
    ["b","ARRAY","vectordotproduct","ARRAY"],
    ["b","SCALAR","<=","SCALAR"],
    ["b","ARRAY","#","SCALAR"],
    ["b","ARRAY","vectormultiply","SCALAR"],
    ["b","SCALAR",">=","SCALAR"],
    ["b","WITH","do","CODE"],
    ["b","WHILE","do","CODE"],
    ["b","FOR","do","CODE"],
    ["b","SWITCH","do","CODE"],
    ["b","NAMESPACE","getvariable","STRING"],
    ["b","NAMESPACE","getvariable","ARRAY"],
    ["b","OBJECT","getvariable","STRING"],
    ["b","OBJECT","getvariable","ARRAY"],
    ["b","GROUP","getvariable","STRING"],
    ["b","GROUP","getvariable","ARRAY"],
    ["b","SCALAR","==","SCALAR"],
    ["b","SIDE","==","SIDE"],
    ["b","STRING","==","STRING"],
    ["b","OBJECT","==","OBJECT"],
    ["b","GROUP","==","GROUP"],
    ["b","TEXT","==","TEXT"],
    ["b","CONFIG","==","CONFIG"],
    ["b","DISPLAY","==","DISPLAY"],
    ["b","CONTROL","==","CONTROL"],
    ["b","LOCATION","==","LOCATION"],
    ["b","NAMESPACE","setvariable","ARRAY"],
    ["b","OBJECT","setvariable","ARRAY"],
    ["b","GROUP","setvariable","ARRAY"],
    ["b","ARRAY","joinstring","STRING"],
    ["b","CODE","count","ARRAY"],
    ["b","STRING","callextension","STRING"],
    ["b","STRING","callextension","ARRAY"],
    ["b","IF","then","ARRAY"],
    ["b","IF","then","CODE"],
    ["b","STRING","setmarkerdir","SCALAR"],
    ["b","CODE","else","CODE"],
    ["b","CONFIG","merge__","CONFIG"],
    ["b","ARRAY","pushbackunique","ANY"],
    ["b","FOR","from","SCALAR"],
    ["b","BOOL","or","BOOL"],
    ["b","BOOL","or","CODE"],
    ["b","FOR","to","SCALAR"],
    ["b","FOR","step","SCALAR"],
    ["b","STRING","setmarkercolorlocal","STRING"],
    ["b","BOOL","&&","BOOL"],
    ["b","BOOL","&&","CODE"],
    ["b","ARRAY","select","SCALAR"],
    ["b","ARRAY","select","BOOL"],
    ["b","ARRAY","select","ARRAY"],
    ["b","ARRAY","select","CODE"],
    ["b","STRING","select","ARRAY"],
    ["b","CONFIG","select","SCALAR"],
    ["b","SCALAR",">","SCALAR"],
    ["b","ARRAY","append","ARRAY"],
    ["b","ARRAY","resize","SCALAR"],
    ["b","ARRAY","pushback","ANY"],
    ["b","SCALAR","<","SCALAR"],
    ["b","ARRAY","apply","CODE"],
    ["b","ARRAY","deleteat","SCALAR"],
    ["b","ARRAY","arrayintersect","ARRAY"],
    ["b","ARRAY","find","ANY"],
    ["b","STRING","find","STRING"],
    ["b","ARRAY","params","ARRAY"],
    ["b","ANY","param","ARRAY"],
    ["b","STRING","setmarkershape","STRING"],
    ["b","CODE","except__","CODE"],
    ["b","BOOL","and","BOOL"],
    ["b","BOOL","and","CODE"],
    ["b","ANY","!=","ANY"],
    ["b","SIDE","!=","SIDE"],
    ["b","STRING","!=","STRING"],
    ["b","OBJECT","!=","OBJECT"],
    ["b","GROUP","!=","GROUP"],
    ["b","TEXT","!=","TEXT"],
    ["b","CONFIG","!=","CONFIG"],
    ["b","DISPLAY","!=","DISPLAY"],
    ["b","CONTROL","!=","CONTROL"],
    ["b","LOCATION","!=","LOCATION"],
    ["b","ANY","isequalto","ANY"],
    ["b","ANY","isequaltype","ANY"],
    ["b","STRING","configclasses","CONFIG"],
    ["b","STRING","createvehicle","ARRAY"],
    ["b","STRING","setmarkeralpha","SCALAR"],
    ["b","ANY","createvehiclelocal","ANY"],
    ["b","STRING","setmarkeralphalocal","SCALAR"],
    ["b","OBJECT","setpos","ARRAY"],
    ["b","OBJECT","setvelocity","ARRAY"],
    ["b","GROUP","createunit","ARRAY"],
    ["b","STRING","createunit","ARRAY"],
    ["b","ARRAY","distance","ARRAY"],
    ["b","OBJECT","distance","ARRAY"],
    ["b","ARRAY","distance","OBJECT"],
    ["b","OBJECT","distance","OBJECT"],
    ["b","OBJECT","iskindof","STRING"],
    ["b","STRING","iskindof","STRING"],
    ["b","STRING","iskindof","ARRAY"],
    ["b","OBJECT","setdamage","SCALAR"],
    ["b","STRING","setmarkertext","STRING"],
    ["b","STRING","setmarkershapelocal","STRING"],
    ["b","STRING","setmarkerbrush","STRING"],
    ["b","STRING","setmarkerbrushlocal","STRING"],
    ["b","STRING","setmarkerpos","ARRAY"],
    ["b","STRING","setmarkerposlocal","ARRAY"],
    ["b","STRING","setmarkertype","STRING"],
    ["b","STRING","setmarkertypelocal","STRING"],
    ["b","STRING","setmarkertextlocal","STRING"],
    ["b","STRING","setmarkerdirlocal","SCALAR"],
    ["b","STRING","setmarkercolor","STRING"],
    ["b","STRING","setmarkersize","ARRAY"],
    ["b","STRING","setmarkersizelocal","ARRAY"]
]
Assets 3
You can’t perform that action at this time.