How do I convert a string e.g. “50” to an integer in Venus? I’m trying to use the SBS centrifuge in simulation mode by passing a string like “1200, 1400, 1200” for the array variables. I have a string tokenize function that can split the string by the commas but I don’t know how to convert from that to an int.
The trace output doesn’t register any errors but I can see that my integer arrays aren’t getting passed as input parameters.
The HSL Core library that is part of the HSL Extensions installer also includes a ConvertToInteger function. The HSL String library command StrIVal performs a similar function.
As far as I am aware, that type of data structure is specific to C++. HSL, while it is it’s own proprietary programming language, is most comparable to C# (though that certainly doesn’t mean they are interchangeable).
It seems that the data structure accessible through VENUS/HSL most equivalent to your query may be a dictionary, which can store an indefinite number of parameter pairs. VENUS does require that when using a dictionary, that the variant type used for the keys be conserved within the dictionary.
I use these for various purposes, via the Dictionary library of HSLExtensions (found in this link from the VENUS library downloads post).
Further discussion adjacent to this topic and VENUS data structures can be found in this post which may be of interest.
If you are referring to the HSL keyword used when declaring static variables, objects or functions, that actually doesn’t have any bearing on their memory allocation. In HSL, ‘static’ dictates that the object or function will not be exported and/or visible outside of the HSL file (library) in which it is declared and used, and is essentially kept local.
When using method editor to create SMT libraries, this is the same as designating the function visibility as ‘Exported’, so that methods and libraries which include that library can access the function for use at the various levels the library is called.