• Main Page
  • Related Pages
  • Namespaces
  • Classes
  • Files
  • Examples
  • File List
  • File Members

ming_utils.h

Go to the documentation of this file.
00001 /* 
00002  *   Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
00003  * 
00004  * This program is free software; you can redistribute it and/or modify
00005  * it under the terms of the GNU General Public License as published by
00006  * the Free Software Foundation; either version 3 of the License, or
00007  * (at your option) any later version.
00008  * 
00009  * This program is distributed in the hope that it will be useful,
00010  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00011  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00012  * GNU General Public License for more details.
00013 * 
00014 * You should have received a copy of the GNU General Public License
00015  * along with this program; if not, write to the Free Software
00016  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
00017  *
00018  */ 
00019 
00020 #ifndef GNASH_MING_UTILS_H
00021 #define GNASH_MING_UTILS_H
00022 
00023 #include <ming.h>
00024 
00025 #if MING_VERSION_CODE >= 00040004
00026 # define MING_SUPPORTS_INIT_ACTIONS
00027 #endif
00028 
00029 /*
00030  * Add symbol from ming src/movie.h as that header file is missing
00031  * from the ming -dev package.
00032  */
00033 void SWFMovie_writeExports(SWFMovie movie);
00034 
00035 /*
00036  * This is to avoid the annoying warnings
00037  * coming from Ming when using the deprecated
00038  * compileSWFActionCode interface.
00039  * A cleaner approach is likely switch to
00040  * using newSWFAction always and change the
00041  * macro to make it output compileSWFActionCode
00042  * when MING_VERSION_CODE < 000040004
00043  */
00044 #if MING_VERSION_CODE >= 00040004
00045 # define compileSWFActionCode newSWFAction
00046 #else
00047 # define newSWFAction compileSWFActionCode
00048 #endif
00049 
00050 /*
00051  * 'callFrame' was drop as a keyword since Ming-0.4.0.beta5
00052  * and replaced by 'call'. Before that version 'call' would
00053  * never be recognized as a "callframe" action
00054  */
00055 #if MING_VERSION_CODE >= 00040006
00056 # define CALLFRAME "call"
00057 #else
00058 # define CALLFRAME "callFrame"
00059 #endif
00060 
00061 
00062 /* Missing define to allow using older Ming releases */
00063 
00064 #ifndef SWFACTION_INIT
00065 # define SWFACTION_INIT       (1<<9)
00066 #endif
00067 
00068 #ifndef SWFACTION_PRESS
00069 # define SWFACTION_PRESS              (1<<10)
00070 #endif
00071 
00072 #ifndef SWFACTION_RELEASE
00073 # define SWFACTION_RELEASE     (1<<11)
00074 #endif
00075 
00076 #ifndef SWFACTION_RELEASEOUTSIDE
00077 # define SWFACTION_RELEASEOUTSIDE (1<<12)
00078 #endif
00079 
00080 #ifndef SWFACTION_ROLLOVER
00081 # define SWFACTION_ROLLOVER    (1<<13)
00082 #endif
00083 
00084 #ifndef SWFACTION_ROLLOUT
00085 # define SWFACTION_ROLLOUT     (1<<14)
00086 #endif
00087 
00088 #ifndef SWFACTION_DRAGOVER
00089 # define SWFACTION_DRAGOVER    (1<<15)
00090 #endif
00091 
00092 #ifndef SWFACTION_DRAGOUT
00093 # define SWFACTION_DRAGOUT     (1<<16)
00094 #endif
00095 
00096 #ifndef SWFACTION_KEYPRESS
00097 # define SWFACTION_KEYPRESS    (1<<17)
00098 #endif
00099 
00100 #ifndef SWFACTION_CONSTRUCT
00101 # define SWFACTION_CONSTRUCT   (1<<18)
00102 #endif
00103 
00104 
00112 SWFFont get_default_font(const char* mediadir);
00113 
00124 void add_dejagnu_functions(SWFMovie mo, SWFBlock font, int depth, int x, int y, int width, int height);
00125 
00149 SWFMovieClip get_dejagnu_clip(SWFBlock font, int depth, int x, int y, int width, int height);
00150 
00161 #define check(m, expr)  \
00162         SWFMovie_add(m, (SWFBlock)compile_actions("\
00163                 if ( %s ) pass( \"%s [%s:%d]\"); \
00164                 else fail( \"%s [%s:%d] \"); \
00165                 ", expr, expr, __FILE__, __LINE__, expr, __FILE__, __LINE__));
00166 
00178 #define xcheck(m, expr)  \
00179         SWFMovie_add(m, (SWFBlock)compile_actions("\
00180                 if ( %s ) xpass( \"%s [%s:%d]\"); \
00181                 else xfail( \"%s [%s:%d] \"); \
00182                 ", expr, expr, __FILE__, __LINE__, expr, __FILE__, __LINE__));
00183 
00184 
00200 #define check_equals(m, obt, exp)  \
00201         SWFMovie_add(m, (SWFBlock)compile_actions("\
00202                 if ( %s == %s ) pass( \"%s  ==  %s [%s:%d]\"); \
00203                 else fail( \"expected: %s obtained: \" + %s + \" [%s:%d] \"); \
00204                 ", obt, exp, obt, exp, __FILE__, __LINE__, exp, obt, __FILE__, __LINE__));
00205 
00221 #define xcheck_equals(m, obt, exp)  \
00222         SWFMovie_add(m, (SWFBlock)compile_actions("\
00223                 if ( %s == %s ) xpass( \"%s  ==  %s [%s:%d]\"); \
00224                 else xfail( \"expected: %s obtained: \" + %s + \" [%s:%d] \"); \
00225                 ", obt, exp, obt, exp, __FILE__, __LINE__, exp, obt, __FILE__, __LINE__));
00226 
00227 
00228 
00236 void print_tests_summary(SWFMovie mo);
00237 
00241 SWFAction compile_actions(const char* fmt, ...);
00242 
00252 void add_actions(SWFMovie mo, const char* code);
00253 
00263 void add_clip_actions(SWFMovieClip mc, const char* code);
00264 
00265 
00266 #ifdef MING_SUPPORTS_INIT_ACTIONS
00267 
00276 void add_clip_init_actions(SWFMovieClip mo, const char* code);
00277 #endif // MING_SUPPORTS_INIT_ACTIONS
00278 
00282 SWFShape make_square(int x, int y, int width, int height, byte r, byte g, byte b);
00283 
00287 SWFShape make_fill_square(int x, int y, int width, int height, byte outline_r, byte outline_g, byte outline_b, byte fill_r, byte fill_g, byte fill_b);
00288 
00289 #endif // GNASH_MING_UTILS_H

Generated on Fri Mar 16 2012 15:46:11 for Gnash by  doxygen 1.7.1