Revision 70b1f8de
Von admin vor etwa 6 Jahren hinzugefügt
tools/typemaker2/types/c/int_array.tm2 | ||
---|---|---|
|
||
<codedef id="toDb">
|
||
<code>
|
||
{
|
||
int i=0;
|
||
int result=0;
|
||
|
||
for (i=0; i < $(maxlen); i++) {
|
||
result=GWEN_DB_SetIntValue($(db), GWEN_DB_FLAGS_OVERWRITE_VARS, "$(name)", $(src)[i]);
|
||
}
|
||
|
||
$(retval)=result;
|
||
}
|
||
</code>
|
||
</codedef>
|
||
|
||
... | ... | |
|
||
<codedef id="fromDb">
|
||
<code>
|
||
{
|
||
int i;
|
||
|
||
memset($(dst), 0, ($(maxlen))*sizeof(int));
|
||
for (i=0; i < $(maxlen); i++) {
|
||
int v;
|
||
|
||
v=GWEN_DB_GetIntValue($(db), "$(name)", 0, 0);
|
||
if (v==0)
|
||
break;
|
||
$(dst)[i]=v;
|
||
}
|
||
}
|
||
</code>
|
||
</codedef>
|
||
|
tools/typemaker2/types/c/uint8_t_array.tm2 | ||
---|---|---|
|
||
<codedef id="toDb">
|
||
<code>
|
||
{
|
||
int i=0;
|
||
int result=0;
|
||
|
||
for (i=0; i < $(maxlen); i++) {
|
||
result=GWEN_DB_SetIntValue($(db), GWEN_DB_FLAGS_OVERWRITE_VARS, "$(name)", $(src)[i]);
|
||
}
|
||
|
||
$(retval)=result;
|
||
}
|
||
</code>
|
||
</codedef>
|
||
|
||
... | ... | |
|
||
<codedef id="fromDb">
|
||
<code>
|
||
{
|
||
int i;
|
||
|
||
memset($(dst), 0, ($(maxlen))*sizeof(uint8_t));
|
||
for (i=0; i < $(maxlen); i++) {
|
||
int v;
|
||
|
||
v=GWEN_DB_GetIntValue($(db), "$(name)", 0, 0);
|
||
if (v==0)
|
||
break;
|
||
$(dst)[i]=v;
|
||
}
|
||
}
|
||
</code>
|
||
</codedef>
|
||
|
Auch abrufbar als: Unified diff
typemaker2: Implemented toDb functions for int_array and uint32_t_array.