update warning flags for gcc 4.4
[swfdec.git] / test / swfdec_test_function.c
blob8f79529bfd2c6457ac92097ccc75a3a752908729
1 /* SwfdecTestfied
2 * Copyright (C) 2007 Benjamin Otte <otte@gnome.org>
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
8 *
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin Street, Fifth Floor,
17 * Boston, MA 02110-1301 USA
20 #ifdef HAVE_CONFIG_H
21 #include "config.h"
22 #endif
24 #include "swfdec_test_function.h"
25 #include "swfdec_test_function_list.h"
27 /* needed by the function list */
28 #include "swfdec_test_buffer.h"
29 #include "swfdec_test_image.h"
30 #include "swfdec_test_socket.h"
31 #include "swfdec_test_test.h"
34 /* include swfdec_test_function_list with special macro definition, so we get a nice
35 * way to initialize it */
36 #undef SWFDEC_TEST_FUNCTION
37 #define SWFDEC_TEST_FUNCTION(name, fun) \
38 { name, fun },
39 static const struct {
40 const char * name;
41 SwfdecAsNative fun;
42 } functions[] = {
43 #include "swfdec_test_function_list.h"
44 { NULL, NULL }
46 #undef SWFDEC_TEST_FUNCTION
48 void
49 swfdec_test_function_init_context (SwfdecAsContext *cx)
51 SwfdecAsObject *obj;
52 SwfdecAsValue val;
53 guint i;
55 obj = swfdec_as_object_new (cx, NULL);
56 if (obj == NULL)
57 return;
58 SWFDEC_AS_VALUE_SET_OBJECT (&val, obj);
59 swfdec_as_object_set_variable (cx->global,
60 swfdec_as_context_get_string (cx, "Native"), &val);
62 for (i = 0; functions[i].name; i++) {
63 swfdec_as_object_add_function (obj,
64 swfdec_as_context_get_string (cx, functions[i].name),
65 functions[i].fun);