2 Shows the structure of a swf file
\r
4 Part of the swftools package.
\r
6 Copyright (c) 2001 Matthias Kramm <kramm@quiss.org>
\r
8 This file is distributed under the GPL, see file COPYING for details */
\r
12 #include "../lib/rfxswf.h"
\r
15 char * filename = 0;
\r
17 /* idtab stores the ids which are defined in the file. This allows us
\r
18 to detect errors in the file. (i.e. ids which are defined more than
\r
22 int args_callback_option(char*name,char*val)
\r
25 int args_callback_longoption(char*name,char*val)
\r
28 void args_callback_usage(char*name)
\r
30 printf("Usage: %s file.swf\n", name);
\r
33 int args_callback_command(char*name,char*val)
\r
36 fprintf(stderr, "Only one file allowed. You supplied at least two. (%s and %s)\n",
\r
43 int main (int argc,char ** argv)
\r
50 memset(idtab,0,65536);
\r
52 processargs(argc, argv);
\r
54 f = open(filename,O_RDONLY);
\r
58 perror("Couldn't open file: ");
\r
61 if FAILED(ReadSWF(f,&swf))
\r
63 fprintf(stderr,"%s is not a valid SWF file or contains errors.\n",filename);
\r
72 printf("[%02x] %s%s", tag->id, prefix, getTagName(tag));
\r
73 if(isDefiningTag(tag)) {
\r
74 U16 id = GetDefineID(tag);
\r
75 printf(" defines id %04x", id);
\r
77 fprintf(stderr, "Error: Id %04x is defined more than once.\n", id);
\r
80 else if(tag->id == ST_PLACEOBJECT ||
\r
81 tag->id == ST_PLACEOBJECT2) {
\r
82 printf(" places id %04x at depth %04x", GetPlaceID(tag), GetDepth(tag));
\r
84 printf(" name \"%s\"",GetName(tag));
\r
86 else if(tag->id == ST_REMOVEOBJECT) {
\r
87 printf(" removes id %04x from depth %04x", GetPlaceID(tag), GetDepth(tag));
\r
89 else if(tag->id == ST_REMOVEOBJECT2) {
\r
90 printf(" removes object from depth %04x", GetDepth(tag));
\r
95 if(tag->id == ST_DEFINESPRITE)
\r
97 sprintf(prefix, " ");
\r
99 if(tag->id == ST_END)
\r
101 sprintf(prefix, "");
\r