OSDN Git Service

delete png_set_gAMA
[swfed/swfed.git] / src / swf_define.h
1 #ifndef __SWF_DEFINE__H__
2 #define __SWF_DEFINE__H__
3
4 #include <stdlib.h>
5
6 #ifdef HAVE_CONFIG_H
7 #include "config.h"
8 #endif
9
10 #define SWF_TWIPS 20
11 #define SWF_MAGIC_SIZE 4
12 #define SWF_FILE_LENGTH_SIZE 4
13 #define SWF_HEADER_SIZE 8
14
15 #define INDENT_UNIT 4
16
17 #define print_indent(depth) printf("%*s", INDENT_UNIT*(depth), " ")
18
19
20 extern int swf_debug;
21
22 #ifdef MALLOC_DEBUG /*  malloc debug */
23
24 extern void malloc_debug_start(void);
25 extern void malloc_debug_end(void);
26
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);
31
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__)
36
37 extern void print_hexbin(unsigned char *data, int data_len);
38
39 #else
40
41 // MALLOC_DEBUG 指定しない時は無効化
42 #define malloc_debug_start() 
43 #define malloc_debug_end()
44
45 #endif
46
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)
52 #endif
53
54 #define NumOfTable(t) (sizeof(t) / sizeof(*t))
55
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)
59
60 #define GetUShortLE(data) ((unsigned short) GV2B(data[1], data[0]))
61
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]))
65
66 #define PutUShortLE(data, value) ((data[0] = (value & 0xff)), (data[1] = (value >> 8)))
67
68 // tag
69
70 // DefineBitsJPEG1,2,3
71 #define isBitsJPEGTag(tag) (((tag) == 6) || ((tag) == 21) || ((tag) == 35))
72 // DefineLossless1,2
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))
77 // PlaceObject1,2
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))
82
83 #endif /* __SWF_DEFINE__H__ */