XDCspec: how to use '[string]' map type? Is it only for meta? [message #1549954] |
Tue, 06 January 2015 20:58  |
Alexei Colin Messages: 8 Registered: October 2013 |
Junior Member |
|
|
This documentation page on XDCspec mentioned the '[string]' map type:
Quote:the keyword string in conjunction with the [] operator, signifying the type map-into(t) that effectively overlays direct access via string-valued keys on an underlying vector-of(t).
It's fairly self-explanatory in meta domain, and there's some examples spread around XDCtools package repo. All usages appear to be in metaonly code. Does this type apply to target domain at all? If so, how would the data be accessed from target code? If not, then what's the rationale, since there are object dictionaries in meta-land anyway?
Since it's an array, I thought maybe there would be macros generated for the string keys that would identify numeric indices into the array, but doesn't look like that's the case. In fact, it looks like the generated code does not compile (XDCTools v3.30.04.52), because there's no initializer value generated at all (full source, incl. generated code ,attached, just in case):
module TestModule {
config UInt32 aMap[string] = [["answer", 42], ["notanswer", 43]];
}
cl86U package/cfg/xdctest_p86U.c ...
package/cfg/xdctest_p86U.c:3452:72: error: expected expression before ';' token
__FAR__ const CT__xdctest_TestModule_aMap xdctest_TestModule_aMap__C = ;
If it's only for meta, maybe an error could be thrown at translation time if the user omits the metaonly specifier on a config value of type map in a module not marked metaonly?
|
|
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.02073 seconds