/* swfaction.c - SWFAction class * $Id: swfaction.c,v 1.3 2004/11/07 17:34:22 ikegami Exp $ * * Copyright (C) 2004 IKEGAMI Daisuke * All rights reserved. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public * License as published by the Free Software Foundation; either * version 2 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this library; if not, write to the * Free Software Foundation, Inc., 59 Temple Place - Suite 330, * Boston, MA 02111-1307, USA. * */ #include #include "ruby.h" #include "mingc.h" VALUE rb_cSWFAction; /* SWFAction compileSWFActionCode(const char *script); */ void rb_free_SWFAction(p) struct RSWFAction *p; { /* destroySWFAction(p->this); */ return; } static VALUE rb_SWFAction_s_new(self, s) VALUE self, s; { char *script = STR2CSTR(s); struct RSWFAction *a = ALLOC(struct RSWFAction); VALUE obj; a->this = compileSWFActionCode(script); if (a->this == NULL) rb_raise(rb_eMingError, "Could not compile actionscripts - %s", script); a->table = ALLOC(struct References); init_references(a->table); obj = Data_Wrap_Struct(rb_cSWFAction, 0, rb_free_SWFAction, a); return obj; } void Init_swfaction() { rb_cSWFAction = rb_define_class_under(rb_mMing, "SWFAction", rb_cObject); rb_define_singleton_method(rb_cSWFAction, "new", rb_SWFAction_s_new, 1); return; }