Hello Patrick, the [+x] syntax in scripts was added only to replicate the old field-offsetting parsing/generating modes (which in turn originate from the time when libsynthesis had no array fields at all) in the script language.
On 07.05.2014, at 20:20, Patrick Ohly <[email protected]> wrote: > <field name="TEL" array="yes" type="telephone" > compare="conflict"/> > <field name="TEL_FLAGS" array="yes" type="integer" > compare="conflict"/> <!-- offset 0 --> > <field name="TEL_LABEL" array="yes" type="string" > compare="conflict"/> <!-- offset 1 --> > <field name="TEL_ID" array="yes" type="integer" > compare="conflict"/> <!-- offset 2 --> > <field name="TEL_SLOT" array="yes" type="integer" compare="never"/> > <!-- offset 3 --> > > a = TEL[+1][3]; // same as TEL_FLAGS[3] So far, this does not work. The parser can only process a single array subscript. > I tried it briefly, but got a syntax error which implied that the first > square brackets were treated like a normal array index in TEL. > > What would it take to make this work? Looking at line 3697ff in scriptcontext.cpp, I'd say it should be possible to allow a second bracket. In the end, it boils down to calculating varidx and arridx. The way the parser works now, it either uses the subscript to offset varidx (when prefixed with the plus), or it is used directly as arridx. Should not be too difficult to allow doing both. Best Regards, Lukas
signature.asc
Description: Message signed with OpenPGP using GPGMail
_______________________________________________ os-libsynthesis mailing list [email protected] http://lists.synthesis.ch/mailman/listinfo/os-libsynthesis
