AdjustCode

(Engine-Level Function)

Description: Adjusts the offsets and sizes of items stored in the .RUN file within the document file.
Warning: This function should be used only by advanced programmers.
Returns: Nothing
Usage: Script Only.
Related to: GetModuleText | GetOneParmText | GetParmText | GetStateText | GetTransitText | GetVariableText | SetModuleText | SetOneParmText | SetParmText | SetStateText | SetTransitText | SetVariableText | TextOffset | TextSize
Function Groups: Compilation and Online Modifications,  Advanced Module
Format: AdjustCode(Value, Type, Offset, Size)
Parameters:  
Value
Required. The value must be a code value or a Variable. This identifies the module, state, statement, or variable to adjust.
Type
Required. Any numeric expression that explicitly specifies the VTScada Value Types.
Offset
Required. Any numeric expression that specifies the starting point for the code adjustment.
Size
Required. Any numeric expression giving the number of bytes by which to shift all offset values following this entry in the .RUN file.
Comments:

Seldom (if ever) used when adding features to modern VTScada applications.

This statement enables you to adjust a .RUN file while VTScada is running. If a change is to be made to the .SRC file while the application is running, this code change must also be written into the .RUN file, so that the .RUN and .SRC files will remain synchronized. AdjustCode essentially creates a space into which the applicable information may be inserted. Offset is the point for the insertion, and Size is the size of the inserted block. All code offsets that follow the inserted block are increased by Size to allow for the new location of the old code, and all items that contain the newly inserted block have their size increased by Size. For example, if the newly inserted block was going to have a variable definition written to it, and it was contained inside of a module, the module's size would increase by Size.
Note that this function does not actually write any changes into the file. Rather, it makes room for the changes to be written by another function.