def visitArray(self, array, arg, name, func): eleSerialType = stdapi.getSerializationType(array.type) print(' pValueTM->mType = Array_Type;') if stdapi.isString(array.type): print(' pValueTM->mEleType = String_Type;') print(' Array<const char*> %s; // string array' % (name)) print(' _src = ReadStringArray(_src, %s);' % (name)) else: print(' pValueTM->mEleType = %s;' % literalToType[eleSerialType.__str__()]) print(' Array<%s> %s; // array' % (eleSerialType, name)) print(' _src = Read1DArray(_src, %s);' % (name)) print(' pValueTM->mArrayLen = %s.cnt;' % name) print(' if (pValueTM->mArrayLen) {') print(' pValueTM->mArray = new ValueTM[pValueTM->mArrayLen];') print( ' for (unsigned int i = 0; i < pValueTM->mArrayLen; i++) {') if stdapi.isString(array.type): print(' pValueTM->mArray[i].mType = String_Type;') print(' pValueTM->mArray[i].mStr = %s.v[i];' % name) else: print(' pValueTM->mArray[i].mType = %s;' % literalToType[eleSerialType.__str__()]) print(' pValueTM->mArray[i].%s = %s.v[i];' % (literalToMember[eleSerialType.__str__()], name)) print(' }') print(' } else {') print(' pValueTM->mArray = NULL;') print(' }')
def visitArray(self, array, name, func): eleSerialType = stdapi.getSerializationType(array.type) if stdapi.isString(array.type): print ' dest = WriteStringArray(dest, %s, %s); // string array' % (array.length, name) elif func.name == "glGetSynciv": print ' if (%s) {' % array.length print ' dest = Write1DArray<%s>(dest, *%s, (%s*)%s); // array' % (eleSerialType, array.length, eleSerialType, name) print ' } else {' print ' dest = Write1DArray<%s>(dest, 0, (%s*)%s); // array size is 0' % (eleSerialType, eleSerialType, name) print ' }' else: print ' dest = Write1DArray<%s>(dest, %s, (%s*)%s); // array' % (eleSerialType, array.length, eleSerialType, name)