X-Git-Url: http://git.asbjorn.biz/?a=blobdiff_plain;f=lib%2Fpython%2Ftag.c;h=23cf8f9b3133fb8460eec3a751b9f26b00820b31;hb=c5a01b369d8e9318a980defffe7d805b682f66b3;hp=a0139f66d5ef49528ba39e3dcdf6fef761eda295;hpb=726d172d02228a2e9b084efba8d3173994343c2b;p=swftools.git diff --git a/lib/python/tag.c b/lib/python/tag.c index a0139f6..23cf8f9 100644 --- a/lib/python/tag.c +++ b/lib/python/tag.c @@ -136,15 +136,29 @@ PyObject* tag_new() tag->tagmap = tagmap_new(); return (PyObject*)tag; } -PyObject* tag_new2(TAG*_tag) +PyObject* tag_new2(TAG*t, PyObject* tagmap) { TagObject*tag = PyObject_New(TagObject, &TagClass); - mylog("+%08x(%d) tag_new\n", (int)tag, tag->ob_refcnt); + mylog("+%08x(%d) tag_new tag=%08x\n", (int)tag, tag->ob_refcnt, t); tag->font = 0; tag->character = 0; tag->placeobject = 0; - tag->tag = _tag; + tag->tag = t; tag->tagmap = tagmap_new(); + + int num = swf_GetNumUsedIDs(t); + int * positions = malloc(num*sizeof(int)); + swf_GetUsedIDs(t, positions); + int i; + for(i=0;idata[positions[i]]); + PyObject*obj = tagmap_id2obj(tagmap, id); + if(obj==NULL) { + PyErr_SetString(PyExc_Exception, setError("TagID %d not defined", id)); + return NULL; + } + tagmap_addMapping(tag->tagmap, id, obj); + } return (PyObject*)tag; } @@ -320,9 +334,9 @@ TAG* tag_getRAWTAG(PyObject*self) /* serialize */ TAG* tag_getTAG(PyObject*self, TAG*prevTag, PyObject*tagmap) { - mylog(" %08x(%d) tag_getTAG tagmap=%08x \n", (int)self, self->ob_refcnt, tagmap); TagObject*tag = (TagObject*)self; TAG* t = tag_getRAWTAG(self); + mylog(" %08x(%d) tag_getTAG tagmap=%08x tag=%08x\n", (int)self, self->ob_refcnt, tagmap, t); t->next = 0; t->prev = prevTag; if(prevTag)