3 * $Id: compile.h,v 1.1 2004/05/08 17:14:20 kramm Exp $
5 * Notice: This header file contains declarations of functions and types that
6 * are just used internally. All library functions and types that are supposed
7 * to be publicly accessable are defined in ./src/ming.h.
10 #ifndef SWF_COMPILE_H_INCLUDED
11 #define SWF_COMPILE_H_INCLUDED
15 typedef struct _buffer *Buffer;
17 /* shut up bison.simple */
18 void yyerror(char *msg);
22 #define max(x,y) (((x)>(y))?(x):(y))
46 FUNCTION_DUPLICATECLIP
51 GETURL_METHOD_NOSEND = 0,
52 GETURL_METHOD_GET = 1,
53 GETURL_METHOD_POST = 2
56 #define GETURL_LOADMOVIE 0x40
57 #define GETURL_LOADVARIABLES 0x80
59 #define MAGIC_CONTINUE_NUMBER 0x7FFE
60 #define MAGIC_BREAK_NUMBER 0x7FFF
62 #define MAGIC_CONTINUE_NUMBER_LO 0xFE
63 #define MAGIC_CONTINUE_NUMBER_HI 0x7F
64 #define MAGIC_BREAK_NUMBER_LO 0xFF
65 #define MAGIC_BREAK_NUMBER_HI 0x7F
67 #define BUFFER_INCREMENT 128
78 #define BUFFER_SIZE sizeof(struct _buffer)
81 { Buffer cond, action;
82 int condlen, actlen, isbreak;
87 struct switchcase *list;
102 void addctx(enum ctx val);
103 void delctx(enum ctx val);
104 int chkctx(enum ctx val);
106 void checkByteOrder();
108 /* create/destroy buffer object */
110 void destroyBuffer(Buffer out);
111 int bufferConcat(Buffer a, Buffer b); /* destroys b. */
112 int bufferWriteBuffer(Buffer a, Buffer b); /* doesn't. */
114 /* utilities for writing */
115 void bufferGrow(Buffer out);
116 void bufferCheckSize(Buffer out, int bytes);
118 int bufferLength(Buffer out);
120 /* constant pool stuff */
121 int addConstant(const char *s);
122 int bufferWriteConstants(Buffer out);
123 #define MAXCONSTANTPOOLSIZE 65533
125 /* write data to buffer */
126 int bufferWriteOp(Buffer out, int data);
127 int bufferWritePushOp(Buffer out);
128 int bufferWriteU8(Buffer out, int data);
129 int bufferWriteS16(Buffer out, int data);
130 int bufferWriteData(Buffer out, const byte *buffer, int bytes);
131 int bufferWriteHardString(Buffer out, byte *string, int length);
132 int bufferWriteConstantString(Buffer out, byte *string, int length);
133 int bufferWriteString(Buffer out, byte *string, int length);
135 /* helper function to avoid many casts */
136 inline int bufferWriteString(Buffer out, char *string, int length) {
137 return bufferWriteString(out,(byte*) string, length); }
139 int bufferWriteInt(Buffer out, int i);
140 int bufferWriteDouble(Buffer out, double d);
141 int bufferWriteNull(Buffer out);
142 int bufferWriteBoolean(Buffer out, int val);
143 int bufferWriteRegister(Buffer out, int num);
144 int bufferWriteSetRegister(Buffer out, int num);
145 int bufferWriteGetProperty(Buffer out, char *string);
146 int bufferWriteSetProperty(Buffer out, char *string);
147 int bufferWriteWTHITProperty(Buffer out);
149 /* concat b to a, destroy b */
150 char *stringConcat(char *a, char *b);
152 /* resolve magic number standins to relative offsets */
153 void bufferResolveJumps(Buffer out);
154 void bufferResolveSwitch(Buffer buffer, struct switchcases *slp);
156 /* rather than setting globals... */
157 void swf4ParseInit(const char *string, int debug);
158 void swf5ParseInit(const char *string, int debug);
160 int swf4parse(void *b);
161 int swf5parse(void *b);
163 #endif /* SWF_COMPILE_H_INCLUDED */