Glossary structure
Version 7 of the Sage X3 engine introduced structures. A structure has properties and methods and it is defined in files with an 'STC' extension.
The STC files do not have to be modified manually because they are generated from class class and representation dictionaries with "C_CLASS_CODE" and "R_REPRESENTATION_CODE" names. Rather than structure, we can call them classes or representation classes.
To support structures, the language includes the following features:
- Instance: Used to declare a pointer on a structure instance.
- NewInstance: Used to instantiate a structure (class or representation) in memory.
- Freeinstance: Used to free the memory associated with an instance of a class or representation.
- FreeGroup: Used to free the memory associated with an instance and all the instances in the same allocation group.
- The syntax
MYINSTANCE.PROPERTY
gives access to a property of an instance. - The syntax
RETURN_VALUE = fmet MYINSTANCE.METHOD(parameters)
is used to execute a class method. - Methods also exist on properties, but they are predefined.
- A structure can include pointers to other structures as well as arrays. A syntax such as
RETURN_VALUE = fmet MYORDER.LINES(3).DISCOUNT(2).CONTROL()
is possible ("CONTROL" method on "DISCOUNT(2)" property).