u4 MemoryDataArray::arraylength(u4 ref) { MemoryData *array = (MemoryData *)ref; u4 length = 0; if(array->type != TYPE_ARRAY) { printf("Error not array type %c: mem_data_array.arraylength\n", array->type); exit(0); } length = array->data_count; if(array->array_type == TYPE_ARRAY) { length *= arraylength(array->data[ array->data_index[0] ]); } return length; }
std::string TypeSpec::string () const { std::string str; if (is_closure() || is_closure_array()) { str += "closure color"; if (is_unsized_array()) str += "[]"; else if (arraylength() > 0) str += Strutil::format ("[%d]", arraylength()); } else if (structure() > 0) { str += Strutil::format ("struct %d", structure()); if (is_unsized_array()) str += "[]"; else if (arraylength() > 0) str += Strutil::format ("[%d]", arraylength()); } else { str += simpletype().c_str(); } return str; }