whoops, checked wrong type here
[swfdec.git] / swfdec / swfdec_as_internal.h
blob3a2d9219b347fd384ec84b4f867aa78a176281be
1 /* Swfdec
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 #ifndef _SWFDEC_AS_INTERNAL_H_
21 #define _SWFDEC_AS_INTERNAL_H_
23 #include <swfdec/swfdec_as_gcable.h>
24 #include <swfdec/swfdec_as_object.h>
25 #include <swfdec/swfdec_as_types.h>
27 G_BEGIN_DECLS
29 /* This header contains all the non-exported symbols that can't go into
30 * exported headers
32 #define SWFDEC_AS_NATIVE(x, y, func) void func (SwfdecAsContext *cx, \
33 SwfdecAsObject *object, guint argc, SwfdecAsValue *argv, SwfdecAsValue *ret);
35 #define SWFDEC_AS_OBJECT_PROTOTYPE_RECURSION_LIMIT 256
37 /* swfdec_as_types.h */
38 #define SWFDEC_AS_VALUE_IS_MOVIE(val) (SWFDEC_AS_VALUE_GET_TYPE (val) == SWFDEC_AS_TYPE_MOVIE)
39 #define SWFDEC_AS_VALUE_GET_MOVIE(val) (swfdec_movie_resolve (SWFDEC_MOVIE ((val)->value.object)))
40 #define SWFDEC_AS_VALUE_SET_MOVIE(val,m) G_STMT_START { \
41 SwfdecAsValue *__val = (val); \
42 SwfdecMovie *__m = (m); \
43 g_assert (SWFDEC_IS_MOVIE (__m)); \
44 (__val)->type = SWFDEC_AS_TYPE_MOVIE; \
45 (__val)->value.object = (SwfdecAsObject *) __m; \
46 } G_STMT_END
48 /* swfdec_as_context.c */
49 gboolean swfdec_as_context_check_continue (SwfdecAsContext * context);
50 void swfdec_as_context_run (SwfdecAsContext * context);
51 void swfdec_as_context_run_init_script (SwfdecAsContext * context,
52 const guint8 * data,
53 gsize length,
54 guint version);
55 void swfdec_as_context_gc_alloc (SwfdecAsContext * context,
56 gsize size);
57 #define swfdec_as_context_gc_new(context,type) ((type *)swfdec_as_context_gc_alloc ((context), sizeof (type)))
59 /* swfdec_as_object.c */
60 typedef SwfdecAsVariableForeach SwfdecAsVariableForeachRemove;
61 typedef const char *(* SwfdecAsVariableForeachRename) (SwfdecAsObject *object,
62 const char *variable, SwfdecAsValue *value, guint flags, gpointer data);
64 SwfdecAsValue * swfdec_as_object_peek_variable (SwfdecAsObject * object,
65 const char * name);
66 guint swfdec_as_object_foreach_remove (SwfdecAsObject * object,
67 SwfdecAsVariableForeach func,
68 gpointer data);
69 void swfdec_as_object_foreach_rename (SwfdecAsObject * object,
70 SwfdecAsVariableForeachRename func,
71 gpointer data);
73 void swfdec_as_object_init_context (SwfdecAsContext * context);
74 void swfdec_as_object_decode (SwfdecAsObject * obj,
75 const char * str);
76 SwfdecAsObject * swfdec_as_object_get_prototype (SwfdecAsObject * object);
77 void swfdec_as_object_add_native_variable (SwfdecAsObject * object,
78 const char * variable,
79 SwfdecAsNative get,
80 SwfdecAsNative set);
82 /* swfdec_as_native_function.h */
83 SwfdecAsFunction *
84 swfdec_as_native_function_new_bare
85 (SwfdecAsContext * context,
86 const char * name,
87 SwfdecAsNative native,
88 SwfdecAsObject * prototype);
89 /* swfdec_as_array.h */
90 void swfdec_as_array_remove_range (SwfdecAsObject * object,
91 gint32 start_index,
92 gint32 num);
95 G_END_DECLS
96 #endif