gnash-commit
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Gnash-commit] gnash/extensions/lirc Makefile.am lirc.cpp lirc.h


From: Rob Savoye
Subject: [Gnash-commit] gnash/extensions/lirc Makefile.am lirc.cpp lirc.h
Date: Wed, 12 Sep 2007 04:16:31 +0000

CVSROOT:        /sources/gnash
Module name:    gnash
Changes by:     Rob Savoye <rsavoye>    07/09/12 04:16:31

Added files:
        extensions/lirc: Makefile.am lirc.cpp lirc.h 

Log message:
        Initial shot at a lirc extension for remotes.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/gnash/extensions/lirc/Makefile.am?cvsroot=gnash&rev=1.1
http://cvs.savannah.gnu.org/viewcvs/gnash/extensions/lirc/lirc.cpp?cvsroot=gnash&rev=1.1
http://cvs.savannah.gnu.org/viewcvs/gnash/extensions/lirc/lirc.h?cvsroot=gnash&rev=1.1

Patches:
Index: Makefile.am
===================================================================
RCS file: Makefile.am
diff -N Makefile.am
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ Makefile.am 12 Sep 2007 04:16:30 -0000      1.1
@@ -0,0 +1,50 @@
+## Process this file with automake to generate Makefile.in
+# 
+#   Copyright (C) 2005, 2006 Free Software Foundation, Inc.
+# 
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+# 
+# This program 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 General Public License for more details.
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+
+AUTOMAKE_OPTIONS = 
+
+# this is where Gnash plugins get installed
+pluginsdir = $(libdir)/gnash/plugins
+
+plugins_LTLIBRARIES = lirc.la
+
+INCLUDES = -I$(srcdir)  \
+            -I$(top_srcdir)/libbase \
+            -I$(top_srcdir)/server \
+            -I$(top_srcdir)/server/vm \
+           -I$(top_srcdir)/asobjs \
+           $(INCLTDL)
+
+AM_LDFLAGS =  \
+       $(top_builddir)/libbase/libgnashbase.la \
+       $(top_builddir)/backend/libgnashbackend.la \
+       $(top_builddir)/server/libgnashserver.la \
+       $(PTHREAD_LIBS) \
+       $(NULL)
+
+lirc_la_SOURCES = lirc.cpp lirc.h
+lirc_la_LDFLAGS = -module -avoid-version -no-undefined
+lirc_la_LIBDADD = $(LIBADD_DL) $(LIBLTDL) $(AM_LDFLAGS)
+
+check_PROGRAMS = # SharedTest
+CLEANFILES = \
+      gnash-dbg.log
+
+install-pluginsLTLIBRARIES: $(plugins_LTLIBRARIES)
+       test -d "$(DESTDIR)$(pluginsdir)" || $(mkinstalldirs) 
"$(DESTDIR)$(pluginsdir)"
+       $(LIBTOOL) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) 
$(plugins_LTLIBRARIES) "$(DESTDIR)$(pluginsdir)/$(plugins_LTLIBRARIES)"
+       $(RM) $(DESTDIR)$(pluginsdir)/*.a 

Index: lirc.cpp
===================================================================
RCS file: lirc.cpp
diff -N lirc.cpp
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ lirc.cpp    12 Sep 2007 04:16:30 -0000      1.1
@@ -0,0 +1,257 @@
+// 
+//   Copyright (C) 2005, 2006, 2007 Free Software Foundation, Inc.
+// 
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 3 of the License, or
+// (at your option) any later version.
+// 
+// This program 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 General Public License for more details.
+// 
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+//
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <map>
+#include <iostream>
+#include <string>
+#include "log.h"
+#include "lirc.h"
+#include "fn_call.h"
+#include "as_object.h"
+#include "builtin_function.h" // need builtin_function
+
+using namespace std;
+
+namespace gnash
+{
+
+as_value lirc_ext_init(const fn_call& fn);
+as_value lirc_ext_deinit(const fn_call& fn);
+as_value lirc_ext_readconfig(const fn_call& fn);
+as_value lirc_ext_freeconfig(const fn_call& fn);
+as_value lirc_ext_nextcode(const fn_call& fn);
+as_value lirc_ext_code2char(const fn_call& fn);
+as_value lirc_ext_readconfig_only(const fn_call& fn);
+as_value lirc_ext_code2charprog(const fn_call& fn);
+as_value lirc_ext_getsocketname(const fn_call& fn);
+as_value lirc_ext_getmode(const fn_call& fn);
+as_value lirc_ext_setmode(const fn_call& fn);
+
+LogFile& dbglogfile = LogFile::getDefaultInstance();
+
+class lirc_as_object : public as_object
+{
+public:
+    Lirc obj;
+};
+
+static void
+attachInterface(as_object *obj)
+{
+//    GNASH_REPORT_FUNCTION;
+    obj->init_member("lirc_init", new builtin_function(lirc_ext_init));
+    obj->init_member("lirc_deinit", new builtin_function(lirc_ext_deinit));
+    obj->init_member("lirc_readconfig", new 
builtin_function(lirc_ext_readconfig));
+    obj->init_member("lirc_freeconfig", new 
builtin_function(lirc_ext_freeconfig));
+    obj->init_member("lirc_nextcode", new builtin_function(lirc_ext_nextcode));
+    obj->init_member("lirc_code2char", new 
builtin_function(lirc_ext_code2char));
+    obj->init_member("lirc_readconfig_only", new 
builtin_function(lirc_ext_readconfig_only));
+    obj->init_member("lirc_code2charprog", new 
builtin_function(lirc_ext_code2charprog));
+    obj->init_member("lirc_getsocketname", new 
builtin_function(lirc_ext_getsocketname));
+    obj->init_member("lirc_getmode", new builtin_function(lirc_ext_getmode));
+    obj->init_member("lirc_setmode", new builtin_function(lirc_ext_setmode));
+}
+
+static as_object*
+getInterface()
+{
+//    GNASH_REPORT_FUNCTION;
+    static boost::intrusive_ptr<as_object> o;
+    if (o == NULL) {
+       o = new as_object();
+    }
+    return o.get();
+}
+
+static as_value
+lirc_ctor(const fn_call& /* fn */)
+{
+//    GNASH_REPORT_FUNCTION;
+    lirc_as_object* obj = new lirc_as_object();
+
+    attachInterface(obj);
+    return as_value(obj); // will keep alive
+//    printf ("Hello World from %s !!!\n", __PRETTY_FUNCTION__);
+}
+
+
+Lirc::Lirc() 
+{
+//    GNASH_REPORT_FUNCTION;
+}
+
+Lirc::~Lirc()
+{
+//    GNASH_REPORT_FUNCTION;
+}
+
+as_value
+lirc_ext_deinit(const fn_call& fn)
+{
+    GNASH_REPORT_FUNCTION;
+    boost::intrusive_ptr<lirc_as_object> ptr = 
ensureType<lirc_as_object>(fn.this_ptr);
+    
+    if (fn.nargs > 0) {
+       string text = fn.arg(0).to_string();
+//     return as_value(ptr->obj.deinit(text.c_str()));
+    }
+}
+
+as_value
+lirc_ext_init(const fn_call& fn)
+{
+    GNASH_REPORT_FUNCTION;
+    boost::intrusive_ptr<lirc_as_object> ptr = 
ensureType<lirc_as_object>(fn.this_ptr);
+    
+    if (fn.nargs > 0) {
+       string text = fn.arg(0).to_string();
+//     return as_value(ptr->obj.init(text.c_str()));
+    }
+}
+
+as_value
+lirc_ext_readconfig(const fn_call& fn)
+{
+    GNASH_REPORT_FUNCTION;
+    boost::intrusive_ptr<lirc_as_object> ptr = 
ensureType<lirc_as_object>(fn.this_ptr);
+    
+    if (fn.nargs > 0) {
+       string text = fn.arg(0).to_string();
+    }
+}
+
+as_value lirc_ext_freeconfig(const fn_call& fn)
+{
+    GNASH_REPORT_FUNCTION;
+    boost::intrusive_ptr<lirc_as_object> ptr = 
ensureType<lirc_as_object>(fn.this_ptr);
+    
+    if (fn.nargs > 0) {
+       string text = fn.arg(0).to_string();
+    }
+}
+
+as_value lirc_ext_nextcode(const fn_call& fn)
+{
+    GNASH_REPORT_FUNCTION;
+    boost::intrusive_ptr<lirc_as_object> ptr = 
ensureType<lirc_as_object>(fn.this_ptr);
+    
+    if (fn.nargs > 0) {
+       string text = fn.arg(0).to_string();
+    }
+}
+
+as_value lirc_ext_code2char(const fn_call& fn)
+{
+    GNASH_REPORT_FUNCTION;
+    boost::intrusive_ptr<lirc_as_object> ptr = 
ensureType<lirc_as_object>(fn.this_ptr);
+    
+    if (fn.nargs > 0) {
+       string text = fn.arg(0).to_string();
+    }
+}
+
+as_value
+lirc_ext_readconfig_only(const fn_call& fn)
+{
+    GNASH_REPORT_FUNCTION;
+    boost::intrusive_ptr<lirc_as_object> ptr = 
ensureType<lirc_as_object>(fn.this_ptr);
+    
+    if (fn.nargs > 0) {
+       string text = fn.arg(0).to_string();
+    }
+}
+
+as_value
+lirc_ext_code2charprog(const fn_call& fn)
+{
+    GNASH_REPORT_FUNCTION;
+    boost::intrusive_ptr<lirc_as_object> ptr = 
ensureType<lirc_as_object>(fn.this_ptr);
+    
+    if (fn.nargs > 0) {
+       string text = fn.arg(0).to_string();
+    }
+}
+
+as_value
+lirc_ext_getsocketname(const fn_call& fn)
+{
+    GNASH_REPORT_FUNCTION;
+    boost::intrusive_ptr<lirc_as_object> ptr = 
ensureType<lirc_as_object>(fn.this_ptr);
+    
+    if (fn.nargs > 0) {
+       string text = fn.arg(0).to_string();
+    }
+}
+
+as_value
+lirc_ext_getmode(const fn_call& fn)
+{
+    GNASH_REPORT_FUNCTION;
+    boost::intrusive_ptr<lirc_as_object> ptr = 
ensureType<lirc_as_object>(fn.this_ptr);
+    
+    if (fn.nargs > 0) {
+       string text = fn.arg(0).to_string();
+    }
+}
+
+as_value
+lirc_ext_setmode(const fn_call& fn)
+{
+    GNASH_REPORT_FUNCTION;
+    boost::intrusive_ptr<lirc_as_object> ptr = 
ensureType<lirc_as_object>(fn.this_ptr);
+    
+    if (fn.nargs > 0) {
+       string text = fn.arg(0).to_string();
+    }
+}
+
+std::auto_ptr<as_object>
+init_lirc_instance()
+{
+    return std::auto_ptr<as_object>(new lirc_as_object());
+}
+
+extern "C" {
+    void
+    lirc_class_init(as_object &obj)
+    {
+//     GNASH_REPORT_FUNCTION;
+       // This is going to be the global "class"/"function"
+       static boost::intrusive_ptr<builtin_function> cl;
+       if (cl == NULL) {
+           cl = new builtin_function(&lirc_ctor, getInterface());
+//         // replicate all interface to class, to be able to access
+//         // all methods as static functions
+           attachInterface(cl.get());
+       }
+       
+       obj.init_member("Lirc", cl.get());
+    }
+} // end of extern C
+
+
+} // end of gnash namespace
+
+// Local Variables:
+// mode: C++
+// indent-tabs-mode: t
+// End:

Index: lirc.h
===================================================================
RCS file: lirc.h
diff -N lirc.h
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ lirc.h      12 Sep 2007 04:16:31 -0000      1.1
@@ -0,0 +1,53 @@
+// 
+//   Copyright (C) 2005, 2006, 2007 Free Software Foundation, Inc.
+// 
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 3 of the License, or
+// (at your option) any later version.
+// 
+// This program 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 General Public License for more details.
+// 
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+
+#ifndef __LIRC_PLUGIN_H__
+#define __LIRC_PLUGIN_H__
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <memory> // for auto_ptr
+#include "as_object.h"
+
+namespace gnash
+{
+
+class Lirc {
+public:
+    Lirc();
+    ~Lirc();
+private:
+};
+
+extern "C" {
+    void lirc_class_init(as_object &obj);  
+    /// Return an  instance
+}
+
+std::auto_ptr<as_object> init_lirc_instance();
+
+} // end of gnash namespace
+
+// __LIRC_PLUGIN_H__
+#endif
+
+// Local Variables:
+// mode: C++
+// indent-tabs-mode: t
+// End:




reply via email to

[Prev in Thread] Current Thread [Next in Thread]