OSDN Git Service

print メソッドを読んだときに、データの階層構造にあわせてインデントをつけるよう改造。
authoryoya <yoya@7c90b180-03d5-4157-b861-58a559ae9d1e>
Mon, 25 May 2009 16:36:50 +0000 (16:36 +0000)
committeryoya <yoya@7c90b180-03d5-4157-b861-58a559ae9d1e>
Mon, 25 May 2009 16:36:50 +0000 (16:36 +0000)
git-svn-id: svn+ssh://svn.sourceforge.jp/svnroot/swfed/trunk@131 7c90b180-03d5-4157-b861-58a559ae9d1e

47 files changed:
src/swf_action.c
src/swf_action.h
src/swf_argb.c
src/swf_argb.h
src/swf_define.h
src/swf_fill_style.h
src/swf_fill_style_array.h
src/swf_fill_style_bitmap.h
src/swf_fill_style_gradient.h
src/swf_fill_style_solid.h
src/swf_gradient.h
src/swf_gradient_record.h
src/swf_header.c
src/swf_line_style.h
src/swf_line_style_array.h
src/swf_matrix.h
src/swf_morph_shape_with_style.h
src/swf_object.c
src/swf_rect.c
src/swf_rect.h
src/swf_rgb.c
src/swf_rgb.h
src/swf_rgba.c
src/swf_rgba.h
src/swf_shape_record.h
src/swf_shape_record_edge.h
src/swf_shape_record_end.h
src/swf_shape_record_setup.h
src/swf_shape_with_style.h
src/swf_styles.h
src/swf_styles_count.h
src/swf_tag.c
src/swf_tag.h
src/swf_tag_action.c
src/swf_tag_action.h
src/swf_tag_edit.c
src/swf_tag_edit.h
src/swf_tag_jpeg.c
src/swf_tag_jpeg.h
src/swf_tag_lossless.c
src/swf_tag_lossless.h
src/swf_tag_shape.c
src/swf_tag_shape.h
src/swf_tag_sound.c
src/swf_tag_sound.h
src/swf_tag_sprite.c
src/swf_tag_sprite.h

index 6ff85dd..ba6da41 100644 (file)
@@ -172,11 +172,13 @@ swf_action_build(bitstream_t *bs, swf_action_t *act) {
 }
 
 int
-swf_action_print(swf_action_t *act) {
+swf_action_print(swf_action_t *act, int indent_depth) {
     swf_action_info_t *act_info = get_swf_action_info(act->action_id);
     if (act_info && act_info->name) {
+        print_indent(indent_depth);
         printf("%s", act_info->name);
     } else {
+        print_indent(indent_depth);
         printf("0x%02x", act->action_id);
     }
     if (act->action_has_length) {
@@ -192,6 +194,7 @@ swf_action_print(swf_action_t *act) {
             d = act->action_data;
             n = GetUShortLE(act->action_data);  d += 2;
             printf(":\n");
+            print_indent(indent_depth);
             for (i=0 ; i < n ; i++) {
                 printf("\t\t[%d]'", i);
                 d += printf("%s", d) + 1;
@@ -269,13 +272,14 @@ swf_action_list_destroy(swf_action_list_t *action_list) {
 }
 
 void
-swf_action_list_print(swf_action_list_t *action_list) {
+swf_action_list_print(swf_action_list_t *action_list, int indent_depth) {
     
     if (action_list) {
         swf_action_t *action = action_list->head;
+        print_indent(indent_depth);
+        printf("action list:\n");
         while(action) {
-            printf("\t");
-            swf_action_print(action);
+            swf_action_print(action, indent_depth);
             action = action->next;
         }
     }
index 2c262da..6c16275 100644 (file)
@@ -28,13 +28,14 @@ extern swf_action_info_t *get_swf_action_info(int action_id);
 
 extern int swf_action_parse(bitstream_t *bs, swf_action_t *act);
 extern int swf_action_build(bitstream_t *bs, swf_action_t *act);
-extern int swf_action_print(swf_action_t *act);
+extern int swf_action_print(swf_action_t *act, int indent_depth);
 
 extern swf_action_list_t *swf_action_list_create(bitstream_t *bs);
 extern unsigned char *swf_action_list_output(swf_action_list_t *list,
                                              unsigned long *length);
 extern void swf_action_list_destroy(swf_action_list_t *act_list);
-extern void swf_action_list_print(swf_action_list_t *act_list);
+extern void swf_action_list_print(swf_action_list_t *act_list,
+                                  int indent_depth);
 
 extern int swf_action_data_print(unsigned char *action_data,
                                  unsigned short action_data_len);
index 13e7efa..109dfdd 100644 (file)
@@ -21,7 +21,8 @@ swf_argb_build(bitstream_t *bs, swf_argb_t *color) {
 }
 
 int
-swf_argb_print(swf_argb_t *color) {
+swf_argb_print(swf_argb_t *color, int indent_depth) {
+    print_indent(indent_depth);
     printf("alpha=0x%02x  red=0x%02x  green=0x%02X  blue=0x%02x\n",
            color->alpha, color->red, color->green, color->blue);
     return 0;
index 5d3c9dd..c831d58 100644 (file)
@@ -16,6 +16,6 @@ typedef struct swf_argb_ {
 
 extern int swf_argb_parse(bitstream_t *bs, swf_argb_t *color);
 extern int swf_argb_build(bitstream_t *bs, swf_argb_t *color);
-extern int swf_argb_print(swf_argb_t *color);
+extern int swf_argb_print(swf_argb_t *color, int indent_depth);
 
 #endif /* __SWF_ARGB_H__ */
index 2b391f0..b86b364 100644 (file)
 #define SWF_FILE_LENGTH_SIZE 4
 #define SWF_HEADER_SIZE 8
 
+#define INDENT_UNIT 4
+
+#define print_indent(depth) printf("%*s", INDENT_UNIT*depth, " ")
+
+
 extern int swf_debug;
 
 extern void malloc_debug_start(void);
@@ -41,7 +46,6 @@ extern void print_hexbin(unsigned char *data, int data_len);
 
 #define NumOfTable(t) (sizeof(t) / sizeof(*t))
 
-
 #define GV2B(a,b) ((a << 8) + b)
 #define GV4B(a,b,c,d) GV2B(GV2B(GV2B(a,b),c),d)
 #define GV8B(a,b,c,d,e,f,g,h) GV2B(GV2B(GV2B(GV2B(GV2B(GV2B(GV2B(a,b),c),d),e),f),g),h)
@@ -52,4 +56,3 @@ extern void print_hexbin(unsigned char *data, int data_len);
 #define GetDoubleIEEE(data) ((double) GV8B(data[4], data[5], data[6], data[7], data[0], data[1], data[2], data[3]))
 
 #endif /* __SWF_DEFINE__H__ */
-
index 10118a7..8abb1cc 100644 (file)
@@ -20,6 +20,6 @@ typedef union swf_fill_style_ {
 
 extern int swf_fill_style_parse(bitstream_t *bs, swf_fill_style_t *color);
 extern int swf_fill_style_build(bitstream_t *bs, swf_fill_style_t *color);
-extern int swf_fill_style_print(swf_fill_style_t *color);
+extern int swf_fill_style_print(swf_fill_style_t *color, int indent_depth);
 
 #endif /* __SWF_FILL_STYLE_H__ */
index 600db47..0625166 100644 (file)
@@ -16,6 +16,6 @@ typedef struct swf_fill_style_array_ {
 
 extern int swf_fill_style_array_parse(bitstream_t *bs, swf_fill_style_array_t *color);
 extern int swf_fill_style_array_build(bitstream_t *bs, swf_fill_style_array_t *color);
-extern int swf_fill_style_array_print(swf_fill_style_array_t *color);
+extern int swf_fill_style_array_print(swf_fill_style_array_t *color, int indent_depth);
 
 #endif /* __SWF_FILL_STYLE_ARRAY_H__ */
index 67d5274..10f82dc 100644 (file)
@@ -18,6 +18,6 @@ typedef struct swf_fill_style_bitmap_ {
 
 extern int swf_fill_style_bitmap_parse(bitstream_t *bs, swf_fill_style_bitmap_t *color);
 extern int swf_fill_style_bitmap_build(bitstream_t *bs, swf_fill_style_bitmap_t *color);
-extern int swf_fill_style_bitmap_print(swf_fill_style_bitmap_t *color);
+extern int swf_fill_style_bitmap_print(swf_fill_style_bitmap_t *color, int indent_depth);
 
 #endif /* __SWF_FILL_STYLE_BITMAP_H__ */
index e4b9703..7bc9d80 100644 (file)
@@ -19,6 +19,6 @@ typedef union swf_fill_style_gradient_ {
 
 extern int swf_fill_style_gradient_parse(bitstream_t *bs, swf_fill_style_gradient_t *color);
 extern int swf_fill_style_gradient_build(bitstream_t *bs, swf_fill_style_gradient_t *color);
-extern int swf_fill_style_gradient_print(swf_fill_style_gradient_t *color);
+extern int swf_fill_style_gradient_print(swf_fill_style_gradient_t *color, int indent_depth);
 
 #endif /* __SWF_FILL_STYLE_GRADIENT_H__ */
index fd155c1..57f0f4d 100644 (file)
@@ -19,6 +19,6 @@ typedef union swf_fill_style_solid_ {
 
 extern int swf_fill_style_solid_parse(bitstream_t *bs, swf_fill_style_solid_t *color);
 extern int swf_fill_style_solid_build(bitstream_t *bs, swf_fill_style_solid_t *color);
-extern int swf_fill_style_solid_print(swf_fill_style_solid_t *color);
+extern int swf_fill_style_solid_print(swf_fill_style_solid_t *color, int indent_depth);
 
 #endif /* __SWF_FILL_STYLE_SOLID_H__ */
index 9c1cc4a..fd41750 100644 (file)
@@ -21,6 +21,6 @@ typedef union swf_gradient_ {
 
 extern int swf_gradient_parse(bitstream_t *bs, swf_gradient_t *color);
 extern int swf_gradient_build(bitstream_t *bs, swf_gradient_t *color);
-extern int swf_gradient_print(swf_gradient_t *color);
+extern int swf_gradient_print(swf_gradient_t *color, int indent_depth);
 
 #endif /* __SWF_GRADIENT_H__ */
index 6965374..335340d 100644 (file)
@@ -20,6 +20,6 @@ typedef union swf_gradient_record_ {
 
 extern int swf_gradient_record_parse(bitstream_t *bs, swf_gradient_record_t *color);
 extern int swf_gradient_record_build(bitstream_t *bs, swf_gradient_record_t *color);
-extern int swf_gradient_record_print(swf_gradient_record_t *color);
+extern int swf_gradient_record_print(swf_gradient_record_t *color, int indent_depth);
 
 #endif /* __SWF_GRADIENT_RECORD_H__ */
index 4e37c1d..2914300 100644 (file)
@@ -56,7 +56,7 @@ int swf_header_print(swf_header_t *header) {
 }
 
 int swf_header_movie_print(swf_header_movie_t *header_movie) {
-    swf_rect_print(&header_movie->frame_size);
+    swf_rect_print(&header_movie->frame_size, 0);
     printf("frame_rate=%d.%d  frame_count=%d\n",
            header_movie->frame_rate_integral,
            header_movie->frame_rate_decimal,
index aa579c4..dec5317 100644 (file)
@@ -34,6 +34,6 @@ typedef union swf_line_style_ {
 
 extern int swf_line_style_parse(bitstream_t *bs, swf_line_style_t *color);
 extern int swf_line_style_build(bitstream_t *bs, swf_line_style_t *color);
-extern int swf_line_style_print(swf_line_style_t *color);
+extern int swf_line_style_print(swf_line_style_t *color, int indent_depth);
 
 #endif /* __SWF_LINE_STYLE_H__ */
index 846adbd..fac222d 100644 (file)
@@ -16,6 +16,6 @@ typedef struct swf_line_style_array_ {
 
 extern int swf_line_style_array_parse(bitstream_t *bs, swf_line_style_array_t *color);
 extern int swf_line_style_array_build(bitstream_t *bs, swf_line_style_array_t *color);
-extern int swf_line_style_array_print(swf_line_style_array_t *color);
+extern int swf_line_style_array_print(swf_line_style_array_t *color, int indent_depth);
 
 #endif /* __SWF_LINE_STYLE_ARRAY_H__ */
index 4cbd104..3977306 100644 (file)
@@ -27,6 +27,6 @@ typedef struct swf_matrix_ {
 
 extern int swf_matrix_parse(bitstream_t *bs, swf_matrix_t *color);
 extern int swf_matrix_build(bitstream_t *bs, swf_matrix_t *color);
-extern int swf_matrix_print(swf_matrix_t *color);
+extern int swf_matrix_print(swf_matrix_t *color, int indent_depth);
 
 #endif /* __SWF_MATRIX_H__ */
index e2465e5..88b2842 100644 (file)
@@ -22,6 +22,6 @@ typedef struct swf_morph_shape_with_style_ {
 
 extern int swf_morph_shape_with_style_parse(bitstream_t *bs, swf_morph_shape_with_style_t *color);
 extern int swf_morph_shape_with_style_build(bitstream_t *bs, swf_morph_shape_with_style_t *color);
-extern int swf_morph_shape_with_style_print(swf_morph_shape_with_style_t *color);
+extern int swf_morph_shape_with_style_print(swf_morph_shape_with_style_t *color, int indent_depth);
 
 #endif /* __SWF_MORPH_SHAPE_WITH_STYLE_H__ */
index b340d54..310ab77 100644 (file)
@@ -169,7 +169,7 @@ swf_object_print(swf_object_t *swf) {
     tag = swf->tag;
     for (i=0 ; tag ; i++) {
         printf("[%d] ", i);
-        swf_tag_print(tag, swf);
+        swf_tag_print(tag, swf, 0);
         if (tag->tag == 0) { // END Tag
             break;
         }
index 34bd673..1ae7833 100644 (file)
@@ -56,7 +56,8 @@ swf_rect_build(bitstream_t *bs, swf_rect_t *rect) {
 }
 
 int
-swf_rect_print(swf_rect_t *rect) {
+swf_rect_print(swf_rect_t *rect, int indent_depth) {
+    print_indent(indent_depth);
     printf("rect=(%d, %d)-(%d, %d) (f_size=%d)\n",
            rect->x_min / SWF_TWIPS,
            rect->y_min / SWF_TWIPS,
index debb522..3828d39 100644 (file)
@@ -17,6 +17,6 @@ typedef struct swf_rect_ {
 
 extern int swf_rect_parse(bitstream_t *bs, swf_rect_t *rect);
 extern int swf_rect_build(bitstream_t *bs, swf_rect_t *rect);
-extern int swf_rect_print(swf_rect_t *rect);
+extern int swf_rect_print(swf_rect_t *rect, int indent_depth);
 
 #endif /* __SWF_RECT_H__ */
index 314fc93..a6a8160 100644 (file)
@@ -19,7 +19,8 @@ swf_rgb_build(bitstream_t *bs, swf_rgb_t *color) {
 }
 
 int
-swf_rgb_print(swf_rgb_t *color) {
+swf_rgb_print(swf_rgb_t *color, int indent_depth) {
+    print_indent(indent_depth);
     printf("red=0x%02x  green=0x%02X  blue=0x%02x\n",
            color->red, color->green, color->blue);
     return 0;
index 201c656..4add1f8 100644 (file)
@@ -16,6 +16,6 @@ typedef struct swf_rgb_ {
 
 extern int swf_rgb_parse(bitstream_t *bs, swf_rgb_t *color);
 extern int swf_rgb_build(bitstream_t *bs, swf_rgb_t *color);
-extern int swf_rgb_print(swf_rgb_t *color);
+extern int swf_rgb_print(swf_rgb_t *color, int indent_depth);
 
 #endif /* __SWF_RGB_H__ */
index a7632a9..4832e04 100644 (file)
@@ -21,7 +21,8 @@ swf_rgba_build(bitstream_t *bs, swf_rgba_t *color) {
 }
 
 int
-swf_rgba_print(swf_rgba_t *color) {
+swf_rgba_print(swf_rgba_t *color, int indent_depth) {
+    print_indent(indent_depth);
     printf("red=0x%02x  green=0x%02X  blue=0x%02x  alpha=0x%02x\n",
            color->red, color->green, color->blue, color->alpha);
     return 0;
index 72c7018..36c0352 100644 (file)
@@ -16,6 +16,6 @@ typedef struct swf_rgba_ {
 
 extern int swf_rgba_parse(bitstream_t *bs, swf_rgba_t *color);
 extern int swf_rgba_build(bitstream_t *bs, swf_rgba_t *color);
-extern int swf_rgba_print(swf_rgba_t *color);
+extern int swf_rgba_print(swf_rgba_t *color, int indent_depth);
 
 #endif /* __SWF_RGBA_H__ */
index 681fce9..22d4685 100644 (file)
@@ -19,6 +19,6 @@ typedef union swf_shape_record_ {
 
 extern int swf_shape_record_parse(bitstream_t *bs, swf_shape_record_t *color);
 extern int swf_shape_record_build(bitstream_t *bs, swf_shape_record_t *color);
-extern int swf_shape_record_print(swf_shape_record_t *color);
+extern int swf_shape_record_print(swf_shape_record_t *color, int indent_depth);
 
 #endif /* __SWF_SHAPE_RECORD_H__ */
index a819048..cc5a5ed 100644 (file)
@@ -26,6 +26,6 @@ typedef union swf_shape_record_edge_ {
 
 extern int swf_shape_record_edge_parse(bitstream_t *bs, swf_shape_record_edge_t *color);
 extern int swf_shape_record_edge_build(bitstream_t *bs, swf_shape_record_edge_t *color);
-extern int swf_shape_record_edge_print(swf_shape_record_edge_t *color);
+extern int swf_shape_record_edge_print(swf_shape_record_edge_t *color, int indent_depth);
 
 #endif /* __SWF_SHAPE_RECORD_EDGE_H__ */
index 07296ff..6a48c32 100644 (file)
@@ -14,6 +14,6 @@ typedef union swf_shape_record_end_ {
 
 extern int swf_shape_record_end_parse(bitstream_t *bs, swf_shape_record_end_t *color);
 extern int swf_shape_record_end_build(bitstream_t *bs, swf_shape_record_end_t *color);
-extern int swf_shape_record_end_print(swf_shape_record_end_t *color);
+extern int swf_shape_record_end_print(swf_shape_record_end_t *color, int indent_deptha);
 
 #endif /* __SWF_SHAPE_RECORD_END_H__ */
index e96e027..2530df8 100644 (file)
@@ -28,6 +28,6 @@ typedef union swf_shape_record_setup_ {
 
 extern int swf_shape_record_setup_parse(bitstream_t *bs, swf_shape_record_setup_t *color);
 extern int swf_shape_record_setup_build(bitstream_t *bs, swf_shape_record_setup_t *color);
-extern int swf_shape_record_setup_print(swf_shape_record_setup_t *color);
+extern int swf_shape_record_setup_print(swf_shape_record_setup_t *color, int indent_depth);
 
 #endif /* __SWF_SHAPE_RECORD_SETUP_H__ */
index c44d05c..f6b772c 100644 (file)
@@ -17,6 +17,6 @@ typedef struct swf_shape_with_style_ {
 
 extern int swf_shape_with_style_parse(bitstream_t *bs, swf_shape_with_style_t *color);
 extern int swf_shape_with_style_build(bitstream_t *bs, swf_shape_with_style_t *color);
-extern int swf_shape_with_style_print(swf_shape_with_style_t *color);
+extern int swf_shape_with_style_print(swf_shape_with_style_t *color, int indent_depth);
 
 #endif /* __SWF_SHAPE_WITH_STYLE_H__ */
index 44e042d..56354d0 100644 (file)
@@ -19,6 +19,6 @@ typedef struct swf_styles_ {
 
 extern int swf_styles_parse(bitstream_t *bs, swf_styles_t *color);
 extern int swf_styles_build(bitstream_t *bs, swf_styles_t *color);
-extern int swf_styles_print(swf_styles_t *color);
+extern int swf_styles_print(swf_styles_t *color, int indent_depth);
 
 #endif /* __SWF_STYLES_H__ */
index f8279f9..ef73a9c 100644 (file)
@@ -14,6 +14,6 @@ typedef struct swf_styles_count_ {
 
 extern int swf_styles_count_parse(bitstream_t *bs, swf_styles_count_t *color);
 extern int swf_styles_count_build(bitstream_t *bs, swf_styles_count_t *color);
-extern int swf_styles_count_print(swf_styles_count_t *color);
+extern int swf_styles_count_print(swf_styles_count_t *color, int indent_depth);
 
 #endif /* __SWF_STYLES_COUNT_H__ */
index 935c4b1..e15e7d0 100644 (file)
@@ -202,7 +202,7 @@ extern int swf_tag_build(bitstream_t *bs, swf_tag_t *tag, struct swf_object_ *sw
 }
 
 void
-swf_tag_print(swf_tag_t *tag, struct swf_object_ *swf) {
+swf_tag_print(swf_tag_t *tag, struct swf_object_ *swf, int indent_depth) {
     swf_tag_info_t *tag_info;
     const char *tag_name;
     if (tag == NULL) {
@@ -211,6 +211,7 @@ swf_tag_print(swf_tag_t *tag, struct swf_object_ *swf) {
     }
     tag_info = get_swf_tag_info(tag->tag);
     tag_name = (tag_info)?tag_info->name:"Unknown";
+//  print_indent(indent_depth);
     printf("tag=%s(%d)", tag_name, tag->tag);
     if (tag->length > 0) {
         printf("  length=%lu",  tag->length);
@@ -222,7 +223,7 @@ swf_tag_print(swf_tag_t *tag, struct swf_object_ *swf) {
         }
         swf_tag_detail_handler_t * detail_handler = tag_info->detail_handler();
         if (detail_handler->print) {
-            detail_handler->print(tag, swf);
+            detail_handler->print(tag, swf, indent_depth + 1);
         }
     }
 }
index f77366d..c5fce36 100644 (file)
@@ -27,7 +27,8 @@ typedef struct swf_tag_detail_handler_ {
     int             (*identity) (swf_tag_t *tag, int id);
     unsigned char * (*output)   (swf_tag_t *tag, unsigned long *length,
                                  struct swf_object_ *swf);
-    void            (*print)    (swf_tag_t *tag, struct swf_object_ *swf);
+    void            (*print)    (swf_tag_t *tag, struct swf_object_ *swf,
+                                 int indent_depth);
     void            (*destroy)  (swf_tag_t *tag);
 } swf_tag_detail_handler_t;
 
@@ -42,7 +43,7 @@ extern swf_tag_info_t *get_swf_tag_info(int tag_id);
 extern swf_tag_t *swf_tag_create(bitstream_t *bs);
 extern void swf_tag_destroy(swf_tag_t *tag);
 extern int swf_tag_build(bitstream_t *bs, swf_tag_t *tag, struct swf_object_ *swf);
-extern void swf_tag_print(swf_tag_t *tag, struct swf_object_ *swf);
+extern void swf_tag_print(swf_tag_t *tag, struct swf_object_ *swf, int indent_depth);
 
 /* image */
 
index f6139de..f9c4ee5 100644 (file)
@@ -96,11 +96,12 @@ swf_tag_action_output_detail(swf_tag_t *tag, unsigned long *length,
 
 void
 swf_tag_action_print_detail(swf_tag_t *tag,
-                            struct swf_object_ *swf) {
+                            struct swf_object_ *swf, int indent_depth) {
     bitstream_t *bs;
     swf_action_list_t *action_list;
     swf_tag_action_detail_t *swf_tag_action = (swf_tag_action_detail_t *) tag->detail;
     (void) swf;
+    print_indent(indent_depth);
     if (tag->tag == 59) { // DoInitAction
         printf("action_sprite=%d  ", swf_tag_action->action_sprite);
     }
@@ -110,7 +111,7 @@ swf_tag_action_print_detail(swf_tag_t *tag,
                     swf_tag_action->action_record_len);
     action_list = swf_action_list_create(bs);
     bitstream_close(bs);
-    swf_action_list_print(action_list);
+    swf_action_list_print(action_list, indent_depth + 1);
     swf_action_list_destroy(action_list);
     return ;
 }
index ec2e0ed..881ebc6 100644 (file)
@@ -26,7 +26,8 @@ extern unsigned char *swf_tag_action_output_detail(swf_tag_t *tag,
                                                    unsigned long *length,
                                                    struct swf_object_ *swf);
 extern void swf_tag_action_print_detail(swf_tag_t *tag,
-                                        struct swf_object_ *swf);
+                                        struct swf_object_ *swf,
+                                        int indent_depth);
 extern void swf_tag_action_destroy_detail(swf_tag_t *tag);
 
 #endif /* __SWF_TAG_ACTION__H__ */
index 4fe3369..2bcf5d8 100644 (file)
@@ -186,13 +186,14 @@ swf_tag_edit_output_detail(swf_tag_t *tag, unsigned long *length,
 
 void
 swf_tag_edit_print_detail(swf_tag_t *tag,
-                          struct swf_object_ *swf) {
+                          struct swf_object_ *swf, int indent_depth) {
     swf_tag_edit_detail_t *swf_tag_edit = (swf_tag_edit_detail_t *) tag->detail;
     (void) tag;
-    printf("\tedit_id=%d\n", swf_tag_edit->edit_id);
-    printf("\t");
-    swf_rect_print(&swf_tag_edit->rect);
-    printf("\ttext=%d wwrap=%d multi=%d pass=%d ro=%d col=%d maxlen=%d font=%d\n",
+    print_indent(indent_depth);
+    printf("edit_id=%d\n", swf_tag_edit->edit_id);
+    swf_rect_print(&swf_tag_edit->rect, indent_depth + 1);
+    print_indent(indent_depth);
+    printf("text=%d wwrap=%d multi=%d pass=%d ro=%d col=%d maxlen=%d font=%d\n",
            swf_tag_edit->edit_has_text?1:0,
            swf_tag_edit->edit_word_wrap?1:0,
            swf_tag_edit->edit_multiline?1:0,
@@ -202,27 +203,31 @@ swf_tag_edit_print_detail(swf_tag_t *tag,
            swf_tag_edit->edit_has_max_length?1:0,
            swf_tag_edit->edit_has_font?1:0);
     if (swf->header.version >= 6) {
-        printf("\tauto_size=%d\n", swf_tag_edit->edit_auto_size);
+            print_indent(indent_depth);
+            printf("auto_size=%d\n", swf_tag_edit->edit_auto_size);
     }
-    printf("\tlayout=%d no_sel=%d border=%d\n",
+    print_indent(indent_depth);
+    printf("layout=%d no_sel=%d border=%d\n",
            swf_tag_edit->edit_has_layout?1:0,
            swf_tag_edit->edit_no_select?1:0,
            swf_tag_edit->edit_border?1:0);
     if (swf_tag_edit->edit_has_font) {
-        printf("\tfont_id=%d font_height=%d\n",
+        print_indent(indent_depth);
+        printf("font_id=%d font_height=%d\n",
                swf_tag_edit->edit_font_id_ref,
                swf_tag_edit->edit_font_height / SWF_TWIPS);
     }
     if (swf_tag_edit->edit_has_color) {
-        printf("\t");
-        swf_rgba_print(&swf_tag_edit->edit_color);
+        swf_rgba_print(&swf_tag_edit->edit_color, indent_depth + 1);
     }
     if (swf_tag_edit->edit_has_max_length) {
-        printf("\tmax_length=%d\n",
+        print_indent(indent_depth);
+        printf("max_length=%d\n",
                swf_tag_edit->edit_max_length);
     }
     if (swf_tag_edit->edit_has_layout) {
-        printf("\talign=%d (left,right)_margine=(%d,%d) indent=%d leading=%d\n",
+        print_indent(indent_depth);
+        printf("align=%d (left,right)_margine=(%d,%d) indent=%d leading=%d\n",
                swf_tag_edit->edit_align,
                swf_tag_edit->edit_left_margine,
                swf_tag_edit->edit_right_margine,
@@ -230,11 +235,13 @@ swf_tag_edit_print_detail(swf_tag_t *tag,
                swf_tag_edit->edit_leading);
     }
     if (swf_tag_edit->edit_variable_name) {
-        printf("\tvariable_name=%s\n",
+        print_indent(indent_depth);
+        printf("variable_name=%s\n",
                swf_tag_edit->edit_variable_name);
     }
     if (swf_tag_edit->edit_initial_text) {
-        printf("\tinitial_text=%s\n",
+        print_indent(indent_depth);
+        printf("initial_text=%s\n",
                swf_tag_edit->edit_initial_text);
     }
     return ;
index 67d2ecd..4a38448 100644 (file)
@@ -56,7 +56,8 @@ extern unsigned char *swf_tag_edit_output_detail(swf_tag_t *tag,
                                                  unsigned long *length,
                                                  struct swf_object_ *swf);
 extern void swf_tag_edit_print_detail(swf_tag_t *tag,
-                                      struct swf_object_ *swf);
+                                      struct swf_object_ *swf,
+                                      int indent_depth);
 extern void swf_tag_edit_destroy_detail(swf_tag_t *tag);
 
 extern char *swf_tag_edit_get_string(void *detail,
index d88c0b7..3caf531 100644 (file)
@@ -212,7 +212,7 @@ swf_tag_jpeg3_output_detail(swf_tag_t *tag, unsigned long *length,
 
 void
 swf_tag_jpeg_print_detail(swf_tag_t *tag,
-                          struct swf_object_ *swf) {
+                          struct swf_object_ *swf, int indent_depth) {
     swf_tag_jpeg_detail_t *swf_tag_jpeg = (swf_tag_jpeg_detail_t *) tag->detail;
     jpeg_segment_t *jpeg_seg;
     jpeg_segment_node_t *node;
@@ -221,22 +221,26 @@ swf_tag_jpeg_print_detail(swf_tag_t *tag,
         fprintf(stderr, "swf_tag_jpeg_print_detail: swf_tag_jpeg == NULL\n");
         return ;
     }
-    printf("\timage_id=%d  jpeg_data_size=%lu\n",
+    print_indent(indent_depth);
+    printf("image_id=%d  jpeg_data_size=%lu\n",
            swf_tag_jpeg->image_id, swf_tag_jpeg->jpeg_data_len);
     jpeg_seg = jpeg_segment_parse(swf_tag_jpeg->jpeg_data,
                                   swf_tag_jpeg->jpeg_data_len);
     if (jpeg_seg) {
         for (node=jpeg_seg->head ; node ; node=node->next) {
             char *name = jpeg_segment_get_marker_name(node->marker);
-            printf("\t\t%s(0x%02X): len=%lu\n", name?name:"Unknwon",
+            print_indent(indent_depth + 1);
+            printf("%s(0x%02X): len=%lu\n", name?name:"Unknwon",
                    node->marker, node->data_len);
         }
         jpeg_segment_destroy(jpeg_seg);
     } else {
-        printf("\t\t(invalid jpeg data)\n");
+        print_indent(indent_depth + 1);
+        printf("(invalid jpeg data)\n");
     }
     if (swf_tag_jpeg->alpha_data) {
-        printf("  alpha_data_size=%lu\n",
+        print_indent(indent_depth);
+        printf("alpha_data_size=%lu\n",
                swf_tag_jpeg->alpha_data_len);
     }
 }
index af284e6..bfc2668 100644 (file)
@@ -33,7 +33,8 @@ extern unsigned char *swf_tag_jpeg3_output_detail(swf_tag_t *tag,
                                                   unsigned long *length,
                                                   struct swf_object_ *swf);
 extern void swf_tag_jpeg_print_detail(swf_tag_t *tag,
-                                      struct swf_object_ *swf);
+                                      struct swf_object_ *swf,
+                                      int indent_depth);
 extern void swf_tag_jpeg_destroy_detail(swf_tag_t *tag);
 
 extern unsigned char *swf_tag_jpeg_get_jpeg_data(void *detail,
index 8bf0854..da66f00 100644 (file)
@@ -298,19 +298,21 @@ swf_tag_lossless_output_detail(swf_tag_t *tag, unsigned long *length,
 
 void
 swf_tag_lossless_print_detail(swf_tag_t *tag,
-                              struct swf_object_ *swf) {
+                              struct swf_object_ *swf, int indent_depth) {
     swf_tag_lossless_detail_t *swf_tag_lossless = (swf_tag_lossless_detail_t *) tag->detail;
     (void) swf;
     if (swf_tag_lossless == NULL) {
         fprintf(stderr, "swf_tag_lossless_print_detail: swf_tag_lossless == NULL\n");
         return ;
     }
-    printf("\timage_id=%d  format=%d  width=%u  height=%u\n",
+    print_indent(indent_depth);
+    printf("image_id=%d  format=%d  width=%u  height=%u\n",
            swf_tag_lossless->image_id, swf_tag_lossless->format,
            swf_tag_lossless->width, swf_tag_lossless->height);
     if (swf_tag_lossless->colormap ||
         swf_tag_lossless->colormap2) {
-        printf("\tcolormap_count=%d",
+        print_indent(indent_depth);
+        printf("colormap_count=%d",
                swf_tag_lossless->colormap_count);
         if (swf_tag_lossless->colormap) {
             printf("  rgb colormap exists");
@@ -323,10 +325,12 @@ swf_tag_lossless_print_detail(swf_tag_t *tag,
         printf("\n");
     }
     if (swf_tag_lossless->bitmap) {
-        printf("\txrgb bitmap exists\n");
+        print_indent(indent_depth);
+        printf("xrgb bitmap exists\n");
     }
     if (swf_tag_lossless->bitmap2) {
-        printf("\targb bitmap exists\n");
+        print_indent(indent_depth);
+        printf("argb bitmap exists\n");
     }
 }
 
index 593b36c..5c37fbd 100644 (file)
@@ -37,7 +37,8 @@ extern unsigned char *swf_tag_lossless_output_detail(swf_tag_t *tag,
                                                      unsigned long *length,
                                                      struct swf_object_ *swf);
 extern void swf_tag_lossless_print_detail(swf_tag_t *tag,
-                                          struct swf_object_ *swf);
+                                          struct swf_object_ *swf,
+                                          int indent_depth);
 extern void swf_tag_lossless2_print_detail(swf_tag_t *tag,
                                            struct swf_object_ *swf);
 extern void swf_tag_lossless_destroy_detail(swf_tag_t *tag);
index 7c0155d..c5c4d51 100644 (file)
@@ -90,10 +90,11 @@ swf_tag_shape_output_detail(swf_tag_t *tag, unsigned long *length,
 
 void
 swf_tag_shape_print_detail(swf_tag_t *tag,
-                          struct swf_object_ *swf) {
+                           struct swf_object_ *swf, int indent_depth) {
     swf_tag_shape_detail_t *swf_tag_shape = (swf_tag_shape_detail_t *) tag->detail;
     int i;
     swf_tag_t *_tag;
+    print_indent(indent_depth);
     printf("\tshape_id=%d\n", swf_tag_shape->shape_id);
     return ;
 }
index 20bd24a..76d04bd 100644 (file)
@@ -44,7 +44,8 @@ extern unsigned char *swf_tag_shape_output_detail(swf_tag_t *tag,
                                                    unsigned long *length,
                                                    struct swf_object_ *swf);
 extern void swf_tag_shape_print_detail(swf_tag_t *tag,
-                                        struct swf_object_ *swf);
+                                       struct swf_object_ *swf,
+                                       int indent_depth);
 extern void swf_tag_shape_destroy_detail(swf_tag_t *tag);
 
 #endif /* __SWF_TAG_SHAPE__H__ */
index 91b0a6c..4706fe8 100644 (file)
@@ -118,7 +118,7 @@ swf_tag_sound_output_detail(swf_tag_t *tag, unsigned long *length,
 
 void
 swf_tag_sound_print_detail(swf_tag_t *tag,
-                           struct swf_object_ *swf) {
+                           struct swf_object_ *swf, int indent_depth) {
     swf_tag_sound_detail_t *swf_tag_sound = (swf_tag_sound_detail_t *) tag->detail;
     char *format_name = "Unknown";
     (void) swf;
@@ -140,15 +140,17 @@ swf_tag_sound_print_detail(swf_tag_t *tag,
         break;
         
     }
-    printf("\tsound_id=%d\n", swf_tag_sound->sound_id);
-    
-    printf("\tformat=%u(%s) rate=%u is_16bits=%u is_stereo=%u samples_count=%lu\n",
+    print_indent(indent_depth);
+    printf("sound_id=%d\n", swf_tag_sound->sound_id);
+    print_indent(indent_depth);    
+    printf("format=%u(%s) rate=%u is_16bits=%u is_stereo=%u samples_count=%lu\n",
            swf_tag_sound->sound_format & 0x0f, format_name,
            swf_tag_sound->sound_rate  & 0x03,
            swf_tag_sound->sound_is_16bits?1:0,
            swf_tag_sound->sound_is_stereo?1:0,
            swf_tag_sound->sound_samples_count);
-    printf("\tsound_data(length=%lu)\n",
+    print_indent(indent_depth);    
+    printf("sound_data(length=%lu)\n",
            swf_tag_sound->sound_data_len);
     return ;
 }
index 9647de5..503e390 100644 (file)
@@ -29,7 +29,8 @@ extern unsigned char *swf_tag_sound_output_detail(swf_tag_t *tag,
                                                   unsigned long *length,
                                                   struct swf_object_ *swf);
 extern void swf_tag_sound_print_detail(swf_tag_t *tag,
-                                       struct swf_object_ *swf);
+                                       struct swf_object_ *swf,
+                                       int indent_depth);
 extern void swf_tag_sound_destroy_detail(swf_tag_t *tag);
 
 extern unsigned char *swf_tag_sound_get_sound_data(void *detail, unsigned long *length,
index 64b3d48..b5b49af 100644 (file)
@@ -109,23 +109,25 @@ swf_tag_sprite_output_detail(swf_tag_t *tag, unsigned long *length,
 
 void
 swf_tag_sprite_print_detail(swf_tag_t *tag,
-                          struct swf_object_ *swf) {
+                            struct swf_object_ *swf,
+                            int indent_depth) {
     swf_tag_sprite_detail_t *swf_tag_sprite = (swf_tag_sprite_detail_t *) tag->detail;
     int i;
     swf_tag_t *_tag;
-    printf("\tsprite_id=%d\n", swf_tag_sprite->sprite_id);
-    printf("\tframe_count=%d\n", swf_tag_sprite->frame_count);
+    print_indent(indent_depth);
+    printf("sprite_id=%d\n", swf_tag_sprite->sprite_id);
+    print_indent(indent_depth);
+    printf("frame_count=%d\n", swf_tag_sprite->frame_count);
     _tag = swf_tag_sprite->tag;
-    printf("---- start sprite_id=%d ----\n", swf_tag_sprite->sprite_id);
     for (i=0 ; _tag ; i++) {
+        print_indent(indent_depth);
         printf("  [%d] ", i);
-        swf_tag_print(_tag, swf);
+        swf_tag_print(_tag, swf, indent_depth + 1);
         if (_tag->tag == 0) { // END Tag
             break;
         }
         _tag = _tag->next;
     }
-    printf("---- end sprite_id=%d ----\n", swf_tag_sprite->sprite_id);
     return ;
 }
 
index 8fdc6d7..4fe1119 100644 (file)
@@ -24,7 +24,8 @@ extern unsigned char *swf_tag_sprite_output_detail(swf_tag_t *tag,
                                                    unsigned long *length,
                                                    struct swf_object_ *swf);
 extern void swf_tag_sprite_print_detail(swf_tag_t *tag,
-                                        struct swf_object_ *swf);
+                                        struct swf_object_ *swf,
+                                        int indent_depth);
 extern void swf_tag_sprite_destroy_detail(swf_tag_t *tag);
 
 #endif /* __SWF_TAG_SPRITE__H__ */