1 #ifndef __SWF_DEFINE__H__
2 #define __SWF_DEFINE__H__
11 #define SWF_MAGIC_SIZE 4
12 #define SWF_FILE_LENGTH_SIZE 4
13 #define SWF_HEADER_SIZE 8
17 #define print_indent(depth) printf("%*s", INDENT_UNIT*(depth), " ")
22 #ifdef MALLOC_DEBUG /* malloc debug */
24 extern void malloc_debug_start(void);
25 extern void malloc_debug_end(void);
27 extern void *calloc_debug(size_t nmemb, size_t size, char *filename, int linenum);
28 extern void *malloc_debug(size_t size, char *filename, int linenum);
29 extern void free_debug(void *ptr, char *filename, int linenum);
30 extern void *realloc_debug(void *ptr, size_t size, char *filename, int linenum);
32 #define calloc(n,s) calloc_debug(n,s,__FILE__,__LINE__)
33 #define malloc(s) malloc_debug(s,__FILE__,__LINE__)
34 #define free(p) free_debug(p,__FILE__,__LINE__)
35 #define realloc(p,s) realloc_debug(p,s,__FILE__,__LINE__)
37 extern void print_hexbin(unsigned char *data, int data_len);
41 // MALLOC_DEBUG 指定しない時は無効化
42 #define malloc_debug_start()
43 #define malloc_debug_end()
47 #if 0 /* PHP Extension */
48 #define calloc(n,s) ecalloc(n,s)
49 #define malloc(s) emalloc(s)
50 #define free(p) efree(p)
51 #define realloc(p,s) erealloc(p,s)
54 #define NumOfTable(t) (sizeof(t) / sizeof(*t))
56 #define GV2B(a,b) ((a << 8) + b)
57 #define GV4B(a,b,c,d) GV2B(GV2B(GV2B(a,b),c),d)
58 #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)
60 #define GetUShortLE(data) ((unsigned short) GV2B(data[1], data[0]))
62 #define GetULongLE(data) ((unsigned long) GV4B(data[3], data[2], data[1], data[0]))
63 #define GetFloatIEEE(data) ((double) GV4B(data[0], data[1], data[2], data[3]))
64 #define GetDoubleIEEE(data) ((double) GV8B(data[4], data[5], data[6], data[7], data[0], data[1], data[2], data[3]))
66 #define PutUShortLE(data, value) ((data[0] = (value & 0xff)), (data[1] = (value >> 8)))
70 // DefineBitsJPEG1,2,3
71 #define isBitsJPEGTag(tag) (((tag) == 6) || ((tag) == 21) || ((tag) == 35))
73 #define isBitsLosslessTag(tag) (((tag) == 20) || ((tag) == 36))
74 #define isBitmapTag(tag) (isBitsJPEGTag(tag) || isBitsLosslessTag(tag))
75 // DefineShape1,2,3, DefineMorphShape1
76 #define isShapeTag(tag) (((tag) == 2) || ((tag) == 22) || ((tag) == 32) || ((tag) == 46))
78 #define isPlaceTag(tag) (((tag) == 4) || ((tag) == 26))
79 #define isSpriteTag(tag) ((tag) == 39)
80 // DoAction,DoInitAction
81 #define isActionTag(tag) (((tag) == 12) || ((tag) == 59))
83 #endif /* __SWF_DEFINE__H__ */