File or record runtime reference¶
Since Sculptor version 6.2.0 is possible to access all the elements of a !record or !file pointed by a pointer or “received” by a function argument. As many levels of subrecords and indexes as desired can be used. The object resolution is done at runtime.
Note: When a program uses a wrong name or reference (discovered at runtime) a debug message is produced.
EXAMPLE
!record DataRec[2] {
pre,,i2
txt,,a8
!record SubRec[2] {
num,,i4[2]
txt,,a8
}
num,,i4[2]
!record SubRec2 = DataRec.SubRec
post,,i2
}
!temp gblPtr,,p
gblPtr =& DataRec[2].SubRec2
gblPtr[1].num[1] = 2111
gblPtr[2].num[2] = 2122
gblPtr[2].txt = "2ubRec2"
fTestDataRec(DataRec)
exit
!function fTestDataRec(arg1) {
dim(arg1.SubRec.num, 1)
dim(arg1.SubRec, 1)
dim(arg1, 1)
arg1[1].pre = 1234
arg1[1].SubRec[1].num[1] = 1111
}
RELATED TOPICS |