const double*v2=_v2;
if(!v1 || !v2)
return v1==v2;
- return *v1==*v2;
+
+ if(*v1==*v2) return 1;
+ if(*v1!=*v1 && *v2!=*v2) return 1; //both values are NaN
+ return 0;
}
type_t float_type = {
U8 type = ns->access;
access = access2str(type);
char*s = escape_string(ns->name);
- char*string = (char*)malloc(strlen(access)+strlen(s)+3);
+ char*string = (char*)malloc(strlen(access)+strlen(s)+7);
if(!s)
sprintf(string, "[%s]NULL", access, s);
else if(!*s)
char* access2str(int type)
{
- if(type==0x08) return "access08";
+ if(type==0x08) return "namespace";
else if(type==0x16) return "public";
else if(type==0x17) return "packageinternal";
else if(type==0x18) return "protected";
char* constant_tostring(constant_t*c)
{
if(!c)
- return 0;
+ return strdup("NULL");
char buf[32];
if(NS_TYPE(c->type)) {
return namespace_tostring(c->ns);
}
}
+void pool_dump(pool_t*pool, FILE*fo, char flags)
+{
+ int t;
+ fprintf(fo, "%d integers:\n", pool->x_ints->num);
+ for(t=1;t<pool->x_ints->num;t++) {
+ S32 val = *(int*)array_getkey(pool->x_ints, t);
+ if(flags&1) fprintf(fo, "%d) %d\n", t, val);
+ }
+ fprintf(fo, "%d unsigned integers:\n", pool->x_uints->num);
+ for(t=1;t<pool->x_uints->num;t++) {
+ U32 val = *(unsigned int*)array_getkey(pool->x_uints, t);
+ if(flags&1) fprintf(fo, "%d) %d\n", t, val);
+ }
+ fprintf(fo, "%d floats:\n", pool->x_floats->num);
+ for(t=1;t<pool->x_floats->num;t++) {
+ double d = pool_lookup_float(pool, t);
+ if(flags&2) fprintf(fo, "%d) %f\n", t, d);
+ }
+ fprintf(fo, "%d strings:\n", pool->x_strings->num);
+ for(t=1;t<pool->x_strings->num;t++) {
+ string_t str = pool_lookup_string2(pool, t);
+ if(flags&1) fprintf(fo, "%d) ", t);
+ if(flags&1) fwrite(str.str, str.len, 1, fo);
+ if(flags&1) fprintf(fo, "\n", t);
+ }
+ fprintf(fo, "%d namespaces:\n", pool->x_namespaces->num);
+ for(t=1;t<pool->x_namespaces->num;t++) {
+ namespace_t*ns= (namespace_t*)array_getkey(pool->x_namespaces, t);
+ char*s = namespace_tostring(ns);
+ if(flags&1) fprintf(fo, "%d) %s\n", t, s);
+ free(s);
+ }
+ fprintf(fo, "%d namespace sets:\n", pool->x_namespace_sets->num);
+ for(t=1;t<pool->x_namespace_sets->num;t++) {
+ namespace_set_t*set = (namespace_set_t*)array_getkey(pool->x_namespace_sets, t);
+ char*s = namespace_set_tostring(set);
+ if(flags&1) fprintf(fo, "%d) %s\n", t, s);
+ free(s);
+ }
+
+ fprintf(fo, "%d multinames:\n", pool->x_multinames->num);
+ for(t=1;t<pool->x_multinames->num;t++) {
+ multiname_t*m = (multiname_t*)array_getkey(pool->x_multinames, t);
+ char*s = multiname_tostring(m);
+ if(flags&1) fprintf(fo, "%d) %s\n", t, s);
+ free(s);
+ }
+}
+
void pool_write(pool_t*pool, TAG*tag)
{
int t;