get rid of swfdec_as_value_to_debug()
[swfdec.git] / vivified / core / vivi_wrap_as.c
blob52decebed5e6aa193d35372a1f811fbc5ba454a2
1 /* Vivified
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 "vivi_wrap.h"
25 #include "vivi_application.h"
26 #include "vivi_function.h"
28 VIVI_FUNCTION ("wrap_toString", vivi_wrap_toString)
29 void
30 vivi_wrap_toString (SwfdecAsContext *cx, SwfdecAsObject *this,
31 guint argc, SwfdecAsValue *argv, SwfdecAsValue *retval)
33 ViviWrap *wrap;
35 if (!VIVI_IS_WRAP (this))
36 return;
38 wrap = VIVI_WRAP (this);
39 if (wrap->wrap == NULL)
40 return;
42 SWFDEC_AS_VALUE_SET_STRING (retval, swfdec_as_context_get_string (cx, "Here be debugging output"));
45 VIVI_FUNCTION ("wrap_get", vivi_wrap_get)
46 void
47 vivi_wrap_get (SwfdecAsContext *cx, SwfdecAsObject *this,
48 guint argc, SwfdecAsValue *argv, SwfdecAsValue *retval)
50 ViviApplication *app = VIVI_APPLICATION (cx);
51 ViviWrap *wrap;
52 SwfdecAsValue val;
53 const char *name;
55 if (!VIVI_IS_WRAP (this) || argc == 0)
56 return;
57 wrap = VIVI_WRAP (this);
58 if (wrap->wrap == NULL)
59 return;
61 name = swfdec_as_value_to_string (cx, &argv[0]);
62 swfdec_as_object_get_variable (wrap->wrap,
63 swfdec_as_context_get_string (SWFDEC_AS_CONTEXT (app->player), name),
64 &val);
65 vivi_wrap_value (app, retval, &val);
68 /*** FRAME specific code ***/
70 VIVI_FUNCTION ("frame_name_get", vivi_wrap_name_get)
71 void
72 vivi_wrap_name_get (SwfdecAsContext *cx, SwfdecAsObject *this,
73 guint argc, SwfdecAsValue *argv, SwfdecAsValue *retval)
75 #if 0
76 ViviWrap *wrap;
77 char *s;
79 if (!VIVI_IS_WRAP (this))
80 return;
82 wrap = VIVI_WRAP (this);
84 /* FIXME: improve */
85 s = swfdec_as_object_get_debug (wrap->wrap);
86 SWFDEC_AS_VALUE_SET_STRING (retval, swfdec_as_context_give_string (cx, s));
87 #endif
90 VIVI_FUNCTION ("frame_code_get", vivi_wrap_code_get)
91 void
92 vivi_wrap_code_get (SwfdecAsContext *cx, SwfdecAsObject *this,
93 guint argc, SwfdecAsValue *argv, SwfdecAsValue *retval)
95 #if 0
96 ViviWrap *wrap;
97 SwfdecScript *script;
99 if (!VIVI_IS_WRAP (this))
100 return;
102 wrap = VIVI_WRAP (this);
103 if (!SWFDEC_IS_AS_FRAME (wrap->wrap))
104 return;
106 script = swfdec_as_frame_get_script (SWFDEC_AS_FRAME (wrap->wrap));
107 /* FIXME: wrap scripts */
108 if (script)
109 SWFDEC_AS_VALUE_SET_BOOLEAN (retval, TRUE);
110 #endif
113 VIVI_FUNCTION ("frame_next_get", vivi_wrap_next_get)
114 void
115 vivi_wrap_next_get (SwfdecAsContext *cx, SwfdecAsObject *this,
116 guint argc, SwfdecAsValue *argv, SwfdecAsValue *retval)
118 #if 0
119 ViviWrap *wrap;
120 SwfdecAsObject *obj;
122 if (!VIVI_IS_WRAP (this))
123 return;
125 wrap = VIVI_WRAP (this);
126 if (!SWFDEC_IS_AS_FRAME (wrap->wrap))
127 return;
129 obj = SWFDEC_AS_OBJECT (swfdec_as_frame_get_next (SWFDEC_AS_FRAME (wrap->wrap)));
130 if (obj)
131 SWFDEC_AS_VALUE_SET_OBJECT (retval, vivi_wrap_object (VIVI_APPLICATION (cx), obj));
132 #endif
135 VIVI_FUNCTION ("frame_this_get", vivi_wrap_this_get)
136 void
137 vivi_wrap_this_get (SwfdecAsContext *cx, SwfdecAsObject *this,
138 guint argc, SwfdecAsValue *argv, SwfdecAsValue *retval)
140 #if 0
141 ViviWrap *wrap;
142 SwfdecAsObject *obj;
144 if (!VIVI_IS_WRAP (this))
145 return;
147 wrap = VIVI_WRAP (this);
148 if (!SWFDEC_IS_AS_FRAME (wrap->wrap))
149 return;
151 obj = SWFDEC_AS_OBJECT (swfdec_as_frame_get_this (SWFDEC_AS_FRAME (wrap->wrap)));
152 if (obj)
153 SWFDEC_AS_VALUE_SET_OBJECT (retval, vivi_wrap_object (VIVI_APPLICATION (cx), obj));
154 #endif