SQFvm / runtime

Custom implementation of the Arma script language SQF
GNU Lesser General Public License v3.0
98 stars 29 forks source link

[Feature] Support CfgFunctions natively #195

Open DarkWanderer opened 2 years ago

DarkWanderer commented 2 years ago

Is your feature request related to a problem? Please describe. I would like to run tests in a project which has CBA-like structure - multiple subdirectories and cross-addin function calls. To do that, I need to be able to load functions from multiple projects simultaneously - using CfgFunctions which is already defined in each project

See also: #186 #196

Describe the solution you'd like Have a flag which allows sqfvm to parse CfgFunctions config section and load referenced SQF files from virtual filesystem, using PBO or explicit mapping via cmd arg e.g. sqfvm --input-pbo my.pbo --parse-cfgfunctions

Describe alternatives you've considered I have considered loading files manually - however, it is tedious and may lead to inconsistencies

X39 commented 1 year ago

Implemented in https://github.com/SQFvm/runtime/commit/73d30d49e254e25a4422a7f88e7a91869d63c3e2

To load CfgFunctions functions in SQF-VM, add --use-cfg-functions to the command line

Please reopen if not as desired in latest development release

DarkWanderer commented 1 year ago

Version built from development branch does not seem to read CfgFunctions correctly

sqfvm.exe --use-cfg-functions --suppress-welcome --input-pbo dynops_civilians.pbo
1:      [] call dynops_civilians_fnc_onCivilianKilled
2:

Executing...
------------------------------------------------------------------------------------------------------------------------------------------
[WRN] [L1|C8|__commandlinefeed.sqf]     A variable with the name 'dynops_civilians_fnc_onCivilianKilled' could not be found.
[WRN] [L1|C3|__commandlinefeed.sqf]     Nil value provided for right-handed argument.
[WRN] [L1|C35|__service]        No config entry with the name 'CfgFunctions' could be located at path config/bin.
[ERR] [L5|C20|__service]        Provided value is null.

[FAT] [L5|C20|__service]        Stacktrace:<  1 of 1> [L5|C20|__service]        [missionNamespace] [SCOPENAME-EMPTY]

dynops_civilians.zip

X39 commented 1 year ago

Possibly related to pbo input