1 /*
2     Ming, an SWF output library
3     Copyright (C) 2001  Opaque Industries - http://www.opaque.net/
4 
5     This library is free software; you can redistribute it and/or
6     modify it under the terms of the GNU Lesser General Public
7     License as published by the Free Software Foundation; either
8     version 2.1 of the License, or (at your option) any later version.
9 
10     This library is distributed in the hope that it will be useful,
11     but WITHOUT ANY WARRANTY; without even the implied warranty of
12     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13     Lesser General Public License for more details.
14 
15     You should have received a copy of the GNU Lesser General Public
16     License along with this library; if not, write to the Free Software
17     Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
18 */
19 
20 /* blocktypes.h
21  *
22  * $Id$
23  *
24  * Notice: This header file contains declarations of functions and types that
25  * are just used internally. All library functions and types that are supposed
26  * to be publicly accessable are defined in ./src/ming.h.
27  */
inplace_all_to_all(ProcessGroup pg,const std::vector<std::vector<T>> & outgoing,std::vector<std::vector<T>> & incoming)28 
29 #ifndef SWF_BLOCKTYPES_H_INCLUDED
30 #define SWF_BLOCKTYPES_H_INCLUDED
31 
32 #include "ming.h"
33 #include "error.h"
34 
35 typedef enum
36 {
37   SWF_UNUSEDBLOCK               = -1, /* tell ming to skip this */
38 
39   SWF_DEFINEBITS                =  6,
40   SWF_DEFINEBITSJPEG2           = 21,
41   SWF_DEFINEBITSJPEG3           = 35,
42   SWF_DEFINEBUTTON              =  7,
43   SWF_DEFINEBUTTON2             = 34,
44   SWF_DEFINEBUTTONCXFORM        = 23,
45   SWF_DEFINEBUTTONSOUND         = 17,
46   SWF_DEFINEEDITTEXT		= 37,
47   SWF_DEFINEFONT                = 10,
48   SWF_DEFINEFONT2               = 48,
49   SWF_DEFINEFONT3		= 75,  /* SWF_version  >= 8 */
50   SWF_DEFINEFONTALIGNZONES	= 73,  /* SWF_version  >= 8 */
51   SWF_CSMTEXTSETTINGS		= 74,  /* SWF_version  >= 8 */
52   SWF_DEFINEFONTINFO            = 13,
53   SWF_DEFINEFONTINFO2		= 62,  /* SWF_version  >= 6 */
54   SWF_DEFINELOSSLESS            = 20,
55   SWF_DEFINELOSSLESS2           = 36,
56   SWF_DEFINEMORPHSHAPE          = 46,
57   SWF_DEFINEMORPHSHAPE2		= 84,  /* SWF_version  >= 8 */
58   SWF_DEFINESHAPE               =  2,
59   SWF_DEFINESHAPE2              = 22,
60   SWF_DEFINESHAPE3              = 32,
61   SWF_DEFINESHAPE4		= 83,  /* SWF_version  >= 8 */
62   SWF_DEFINESOUND               = 14,
63   SWF_DEFINESPRITE              = 39,
64   SWF_DEFINETEXT                = 11,
65   SWF_DEFINETEXT2               = 33,
66   SWF_DEFINESCALINGGRID		= 78,  /* SWF_version  >= 8 */
67   SWF_DOACTION                  = 12,
68   SWF_ENABLEDEBUGGER		= 58,  /* SWF_version  <  6 */
69   SWF_ENABLEDEBUGGER2		= 64,  /* SWF_version  >= 6 */
70   SWF_SCRIPTLIMITS		= 65,  /* SWF_version  >= 7 */
71   SWF_SETTABINDEX		= 66,  /* SWF_version  >= 7 */
72   SWF_END                       =  0,
73   SWF_EXPORTASSETS              = 56,
74   SWF_FRAMELABEL                = 43,
75   SWF_IMPORTASSETS              = 57,  /* SWF_version  < 8 only */
76   SWF_IMPORTASSETS2		= 71,  /* SWF_version  >= 8 */
77   SWF_JPEGTABLES                =  8,
78   SWF_PLACEOBJECT               =  4,
79   SWF_PLACEOBJECT2              = 26,
80   SWF_PLACEOBJECT3		= 70,  /* SWF_version >= 8 */
81   SWF_PROTECT                   = 24,
82   SWF_REMOVEOBJECT              =  5,
83   SWF_REMOVEOBJECT2             = 28,
84   SWF_SETBACKGROUNDCOLOR        =  9,
85   SWF_SHOWFRAME                 =  1,
86   SWF_SOUNDSTREAMBLOCK          = 19,
87   SWF_SOUNDSTREAMHEAD           = 18,
88   SWF_SOUNDSTREAMHEAD2          = 45,
89   SWF_STARTSOUND                = 15,
90   SWF_INITACTION		= 59,
91   SWF_DEFINEVIDEOSTREAM		= 60,
92   SWF_VIDEOFRAME		= 61,
93   SWF_SERIALNUMBER		= 41,
94   SWF_DEBUGID			= 63,
95 
96   /* SWF8 tags */
97   SWF_FILEATTRIBUTES            = 69,
98   SWF_METADATA                  = 77,
99 
100   /* SWF9 tags */
101   SWF_SYMBOLCLASS               = 76,
102   SWF_DOABC                     = 82,
103   SWF_DEFINEBINARYDATA		= 87,
104   SWF_DEFINESCENEANDFRAMEDATA   = 86,
105   SWF_STARTSOUND2		= 89,
106   SWF_DEFINEFONTNAME		= 88,
107 
108   /* Unconfirmed tags */
109   SWF_REFLEX			= 777,
110 
111   /*obsolete and/or undocumented tags */
112   SWF_DEFINECOMMANDOBJ		= 50,
113   SWF_DEFINETEXTFORMAT		= 42,
114   SWF_DEFINEVIDEO		= 38,
115   SWF_FRAMETAG			= 47,
116   SWF_FREEALL			= 31,
117   SWF_FREECHARACTER		=  3,
118   SWF_GENCOMMAND		= 49,
119   SWF_FONTREF			= 52,
120   SWF_NAMECHARACTER		= 40,
121   SWF_PATHSAREPOSTSCRIPT	= 25,
122   SWF_SYNCFRAME			= 29,
123   SWF_CHARACTERSET		= 51,
124   SWF_DEFINEBITSPTR		= 1023,
125 
126 /* these are pseudo definitions that do not correspond to actual swf file tags */
127   SWF_MINGFONT = 252,
128   SWF_BROWSERFONT = 253,
129   SWF_PREBUILTCLIP = 254,
130   SWF_PREBUILT = 255
131 } SWFBlocktype;
132 
133 
134 static inline int SWFBlocktype_swfVersion(int type)
135 {
136 	switch(type)
137 	{
138 		case SWF_END:
139 		case SWF_SHOWFRAME:
140 		case SWF_DEFINESHAPE:
141 		case SWF_PLACEOBJECT:
142 		case SWF_REMOVEOBJECT:
143 		case SWF_DEFINEBITS:
144 		case SWF_DEFINEBUTTON:
145 		case SWF_JPEGTABLES:
146 		case SWF_SETBACKGROUNDCOLOR:
147 		case SWF_DEFINEFONT:
148 		case SWF_DEFINETEXT:
149 		case SWF_DOACTION:
150 		case SWF_DEFINEFONTINFO:
151 		case SWF_PREBUILTCLIP:
152 		case SWF_PREBUILT:
153 			return 1;
154 
155 		case SWF_DEFINESOUND:
156 		case SWF_STARTSOUND:
157 		case SWF_DEFINEBUTTONSOUND:
158 		case SWF_SOUNDSTREAMHEAD:
159 		case SWF_SOUNDSTREAMBLOCK:
160 		case SWF_DEFINELOSSLESS:
161 		case SWF_DEFINEBITSJPEG2:
162 		case SWF_DEFINESHAPE2:
163 		case SWF_DEFINEBUTTONCXFORM:
164 		case SWF_PROTECT:
165 			return 2;
166 
167 		case SWF_PLACEOBJECT2:
168 		case SWF_REMOVEOBJECT2:
169 		case SWF_DEFINESHAPE3:
170 		case SWF_DEFINETEXT2:
171 		case SWF_DEFINEBUTTON2:
172 		case SWF_DEFINEBITSJPEG3:
173 		case SWF_DEFINELOSSLESS2:
174 		case SWF_DEFINESPRITE:
175 		case SWF_FRAMELABEL:
176 		case SWF_SOUNDSTREAMHEAD2:
177 		case SWF_DEFINEMORPHSHAPE:
178 		case SWF_DEFINEFONT2:
179 		case SWF_GENCOMMAND:
180 			return 3;
181 
182 		case SWF_DEFINEEDITTEXT:
183 			return 4;
184 
185 		case SWF_EXPORTASSETS:
186 		case SWF_IMPORTASSETS:
187 		case SWF_ENABLEDEBUGGER:
188 			return 5;
189 
190 		case SWF_INITACTION:
191 		case SWF_DEFINEVIDEOSTREAM:
192 		case SWF_VIDEOFRAME:
193 		case SWF_DEFINEFONTINFO2:
194 		case SWF_ENABLEDEBUGGER2:
195 			return 6;
196 
197 		case SWF_SCRIPTLIMITS:
198 		case SWF_SETTABINDEX:
199 			return 7;
200 
201 		case SWF_FILEATTRIBUTES:
202 		case SWF_PLACEOBJECT3:
203 		case SWF_IMPORTASSETS2:
204 		case SWF_DEFINEFONTALIGNZONES:
205 		case SWF_CSMTEXTSETTINGS:
206 		case SWF_DEFINEFONT3:
207 		case SWF_METADATA:
208 		case SWF_DEFINESHAPE4:
209 		case SWF_DEFINESCALINGGRID:
210 		case SWF_DEFINEMORPHSHAPE2:
211 			return 8;
212 		default:
213 			SWF_warn("unknown tag type %i\n", type);
214 			return -1;
215 	}
216 }
217 
218 #endif /* SWF_BLOCKTYPES_H_INCLUDED */
219