git.asbjorn.biz
/
swftools.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
fixed tests ok/namespaces1.as, ok/packagestr.as
[swftools.git]
/
lib
/
as3
/
registry.c
diff --git
a/lib/as3/registry.c
b/lib/as3/registry.c
index
316c71f
..
2789fdf
100644
(file)
--- a/
lib/as3/registry.c
+++ b/
lib/as3/registry.c
@@
-48,6
+48,12
@@
static unsigned int slotinfo_hash(slotinfo_t*c)
hash = crc32_add_string(hash, c->name);
return hash;
}
hash = crc32_add_string(hash, c->name);
return hash;
}
+static unsigned int memberinfo_hash(slotinfo_t*c)
+{
+ unsigned int hash = 0;
+ hash = crc32_add_string(hash, c->name);
+ return hash;
+}
static void* dummy_clone(void*other) {return other;}
static void dummy_destroy(slotinfo_t*c) {}
static void* dummy_clone(void*other) {return other;}
static void dummy_destroy(slotinfo_t*c) {}
@@
-58,6
+64,12
@@
type_t slotinfo_type = {
dup: (dup_func)dummy_clone, // all signatures are static
free: (free_func)dummy_destroy,
};
dup: (dup_func)dummy_clone, // all signatures are static
free: (free_func)dummy_destroy,
};
+type_t memberinfo_type = {
+ hash: (hash_func)memberinfo_hash,
+ equals: (equals_func)slotinfo_equals,
+ dup: (dup_func)dummy_clone, // all signatures are static
+ free: (free_func)dummy_destroy,
+};
// ----------------------- resolving ----------------------------------
slotinfo_t* registry_resolve(slotinfo_t*_s)
// ----------------------- resolving ----------------------------------
slotinfo_t* registry_resolve(slotinfo_t*_s)
@@
-139,7
+151,7
@@
classinfo_t* classinfo_register(int access, const char*package, const char*name,
c->package = package;
c->name = name;
dict_put(registry_classes, c, c);
c->package = package;
c->name = name;
dict_put(registry_classes, c, c);
- dict_init2(&c->members, &slotinfo_type, AVERAGE_NUMBER_OF_MEMBERS);
+ dict_init2(&c->members, &memberinfo_type, AVERAGE_NUMBER_OF_MEMBERS);
schedule_for_resolve((slotinfo_t*)c);
return c;
schedule_for_resolve((slotinfo_t*)c);
return c;
@@
-332,7
+344,7
@@
classinfo_t* slotinfo_asclass(slotinfo_t*f) {
c->name = "undefined";
}
c->name = "undefined";
}
- dict_init2(&c->members, &slotinfo_type, 1);
+ dict_init2(&c->members, &memberinfo_type, 1);
c->data = f;
dict_put(functionobjects, f, c);
return c;
c->data = f;
dict_put(functionobjects, f, c);
return c;
@@
-352,6
+364,13
@@
classinfo_t* slotinfo_gettype(slotinfo_t*f)
return registry_getanytype();
}
}
return registry_getanytype();
}
}
+
+// ----------------------- package handling ---------------------------
+char registry_ispackage(char*package)
+{
+ /* crude approximation of "the real thing", but sufficient for now */
+ return !strncmp(package, "flash", 5);
+}
// ----------------------- builtin types ------------------------------
classinfo_t* registry_getanytype() {return 0;}
// ----------------------- builtin types ------------------------------
classinfo_t* registry_getanytype() {return 0;}