Enlightenment CVS committal

Author  : leviathan
Project : e17
Module  : proto

Dir     : e17/proto/etk-perl


Modified Files:
        Etk.xs EtkTypes.c EtkTypes.h Makefile.PL TODO typemap 


Log Message:
- follow some changes in etk
- fix a couple of mortalizations
- add object cache (disabled for now, needs more work)
- add dependency check in Makefile.PL

===================================================================
RCS file: /cvs/e/e17/proto/etk-perl/Etk.xs,v
retrieving revision 1.40
retrieving revision 1.41
diff -u -3 -r1.40 -r1.41
--- Etk.xs      6 Aug 2006 14:56:12 -0000       1.40
+++ Etk.xs      11 Aug 2006 18:36:53 -0000      1.41
@@ -450,7 +450,7 @@
        Init=1
        CODE:
        RETVAL = etk_init(NULL, NULL);
-       __etk_perl_inheritance_init();
+       __etk_perl_init();
        OUTPUT:
        RETVAL
 
@@ -458,6 +458,10 @@
 etk_shutdown()
       ALIAS:
        Shutdown=1
+       CODE:
+       etk_shutdown();
+       FreeObjectCache();
+
 
 MODULE = Etk::Alignment                PACKAGE = Etk::Alignment        PREFIX 
= etk_alignment_
 
@@ -1221,6 +1225,10 @@
        Etk_Combobox_Item *     item
       ALIAS:
        DataGet=1
+       CODE:
+       RETVAL = newSVsv((SV*)etk_combobox_item_data_get(item));
+       OUTPUT:
+       RETVAL
 
 void
 etk_combobox_item_data_set(item, data)
@@ -2651,6 +2659,18 @@
       ALIAS:
        PageTabWidgetSet=1
 
+void
+etk_notebook_tabs_visible_set(notebook, visible)
+       Etk_Notebook * notebook
+       Etk_Bool visible
+      ALIAS:
+       TabsVisibleSet=1
+
+Etk_Bool
+etk_notebook_tabs_visible_get(notebook)
+       Etk_Notebook * notebook
+      ALIAS:
+       TabsVisibleGet=1
 
 MODULE = Etk::Object   PACKAGE = Etk::Object   PREFIX = etk_object_
 
@@ -2660,6 +2680,10 @@
        char *  key
       ALIAS:
        DataGet=1
+       CODE:
+       RETVAL = newSVsv((SV*)etk_object_data_get(object, key));
+       OUTPUT:
+       RETVAL
 
 void
 etk_object_data_set(object, key, value)
@@ -2718,7 +2742,8 @@
        SignalConnect=1
        
        CODE:   
-       __etk_signal_connect_full(signal_name, object, callback, data, 
ETK_FALSE, ETK_FALSE);
+       __etk_signal_connect_full(signal_name, newSVsv(object), 
newSVsv(callback), newSVsv(data), 
+                       ETK_FALSE, ETK_FALSE);
 
 void
 signal_connect_after(object, signal_name, callback, data=NULL)
@@ -2796,6 +2821,12 @@
        else
          etk_signal_disconnect(signal_name, obj, 
ETK_CALLBACK(callback_VOID__VOID));
 
+void
+DESTROY(object)
+       Etk_Object * object
+       CODE:
+       FreeEtkObject(object);
+
 
 MODULE = Etk::Paned    PACKAGE = Etk::Paned    PREFIX = etk_paned_
        
@@ -2950,6 +2981,18 @@
       ALIAS:
        TextSet=1
 
+void
+etk_progress_bar_direction_set(progress_bar, direction)
+       Etk_Progress_Bar * progress_bar
+       Etk_Progress_Bar_Direction direction
+      ALIAS:
+       DirectionSet=1
+
+Etk_Progress_Bar_Direction
+etk_progress_bar_direction_get(progress_bar)
+       Etk_Progress_Bar * progress_bar
+      ALIAS:
+       DirectionGet=1
 
 MODULE = Etk::RadioButton      PACKAGE = Etk::RadioButton      PREFIX = 
etk_radio_button_
 
@@ -3713,6 +3756,12 @@
       ALIAS:
        AppendToRow=1
 
+Etk_Scrolled_View *
+etk_tree_scrolled_view_get(tree)
+       Etk_Tree * tree
+      ALIAS:
+       ScrolledViewGet=1
+
 void
 etk_tree_build(tree)
        Etk_Tree *      tree
@@ -4179,6 +4228,10 @@
        Etk_Tree_Row *  row
       ALIAS:
        DataGet=1
+       CODE:
+       RETVAL = newSVsv((SV*)etk_tree_row_data_get(row));
+       OUTPUT:
+       RETVAL
 
 void
 etk_tree_row_data_set(row, data)
@@ -5174,6 +5227,25 @@
 MODULE = Etk::Window   PACKAGE = Etk::Window   PREFIX = etk_window_
 
 void
+etk_window_raise(window)
+       Etk_Window * window
+      ALIAS:
+       Raise=1
+
+void
+etk_window_lower(window)
+       Etk_Window * window
+      ALIAS:
+       Lower=1
+
+void
+etk_window_modal_for_window(window_to_modal, window)
+       Etk_Window *window_to_modal
+       Etk_Window *window
+      ALIAS:
+       ModalForWindow=1
+
+void
 etk_window_center_on_window(window_to_center, window)
        Etk_Window *    window_to_center
        Etk_Window *    window
@@ -5205,6 +5277,12 @@
        Etk_Window *    window
       ALIAS:
        IconifiedGet=1
+
+Etk_Bool
+etk_window_dnd_aware_get(window)
+       Etk_Window *    window
+      ALIAS:
+       DndAwareGet=1
 
 void
 etk_window_dnd_aware_set(window, on)
===================================================================
RCS file: /cvs/e/e17/proto/etk-perl/EtkTypes.c,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -3 -r1.6 -r1.7
--- EtkTypes.c  5 Aug 2006 21:47:18 -0000       1.6
+++ EtkTypes.c  11 Aug 2006 18:36:53 -0000      1.7
@@ -2,6 +2,92 @@
 
 #include "EtkTypes.h"
 
+
+static HV * ObjectCache = NULL;
+
+static void SetEtkObject(SV * perl_object, Etk_Object * object)
+{
+       if (!object || !SvOK(perl_object))
+               return;
+       
+#ifdef DEBUG
+       printf(">> Adding object (%p) with perl object (%p)\n", object, 
perl_object);
+#endif
+
+       char * key;
+       int len = 10;
+       key = (char *)malloc(sizeof(char) * 10);
+       snprintf(key, 10, "%p", object);
+       printf("\tKEY: %s\n", key);
+
+       hv_store(ObjectCache, key, len, perl_object, 0);
+       
+}
+
+static SV * GetEtkObject(Etk_Object * object) 
+{
+
+       SV * s = NULL;
+#ifdef DEBUG
+       printf(">> Trying to find object (%p)\n", object);
+#endif
+
+       char * key;
+       int len = 10;
+       SV **sv;
+       key = (char *)malloc(sizeof(char) * 10);
+       snprintf(key, 10, "%p", object);
+       printf("\tKEY: %s\n", key);
+       
+       sv = hv_fetch(ObjectCache, key, len, 0);
+       if (sv && SvOK(*sv)) 
+               s = SvREFCNT_inc(*sv);
+
+       printf("  GOT: %p\n", s);
+
+       return s;
+}
+
+void FreeEtkObject(Etk_Object *object)
+{
+       return;
+
+       char * key;
+       int len = 10;
+#ifdef DEBUG
+       printf(">> Trying to free object (%p)\n", object);
+#endif
+       
+       key = (char *)malloc(sizeof(char) * 10);
+       snprintf(key, 10, "%p", object);
+       printf("\tKEY: %s\n", key);
+       if (hv_exists(ObjectCache, key, len)){
+               SV ** sv;
+               int ref = -1;
+               sv = hv_fetch(ObjectCache, key, len, 0);
+               if (sv) {
+                       SV * s;
+                       s = *sv;
+                       ref = SvREFCNT(s);
+                       printf(">\n");
+                       if (ref == 1)
+                               hv_delete(ObjectCache, key, len, G_DISCARD);
+                       else
+                               SvREFCNT_dec(s);
+                       printf(">\n");
+               }
+               printf("  DELETE ref(%i) (%p)\n", ref, *sv);
+                       
+       }
+
+}
+
+void FreeObjectCache()
+{
+       hv_undef(ObjectCache);
+       ObjectCache = NULL;
+}
+
 void * SvObj(SV *o, char * classname)
 {
 #ifdef DEBUG
@@ -27,13 +113,17 @@
 #ifdef DEBUG
        printf(">> Creating new object from (%p) of class (%s)\n", object, 
classname);
 #endif
-       HV * previous;
+       SV * previous;
        SV * result;
 
        if (!object)
                return newSVsv(&PL_sv_undef);
 
-       // do previous thingy
+       //if (newref) *newref = 0;
+
+       //previous = GetEtkObject((Etk_Object *)object);
+       //if (previous)
+       //      return previous;
        
        HV * h = newHV();
        hv_store(h, "ETK", 3, newSViv((long)object), 0);
@@ -41,13 +131,19 @@
        sv_bless(result, gv_stashpv(classname, FALSE));
        SvREFCNT_dec(h);
 
+       //SetEtkObject(result, object);
+
+       //if (newref) *newref = 1;
+       
+       //printf("\t(%p)\n", result);
        return result;
 
 }
 
 
-void __etk_perl_inheritance_init() {
+void __etk_perl_init() {
 
+       ObjectCache = newHV();
 
 #define __(A, B)\
        av_push(get_av("Etk::"A"::ISA", TRUE), newSVpv("Etk::"B, 
strlen("Etk::"B)));
@@ -470,6 +566,7 @@
        S_STORE("string", ev->string)
        I_STORE("timestamp", newSVuv(ev->timestamp))
 
+       printf("New Event (%p)\n", hv);
        return newRV((SV*)hv);
 }
 
===================================================================
RCS file: /cvs/e/e17/proto/etk-perl/EtkTypes.h,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -3 -r1.5 -r1.6
--- EtkTypes.h  5 Aug 2006 21:47:18 -0000       1.5
+++ EtkTypes.h  11 Aug 2006 18:36:53 -0000      1.6
@@ -13,7 +13,9 @@
 
 #include <Etk.h>
 
-void __etk_perl_inheritance_init();
+void __etk_perl_init();
+void FreeEtkObject(Etk_Object *object);
+void FreeObjectCache();
 
 
 SV *                   newSVColor(Etk_Color col);
===================================================================
RCS file: /cvs/e/e17/proto/etk-perl/Makefile.PL,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -3 -r1.6 -r1.7
--- Makefile.PL 6 Aug 2006 14:56:13 -0000       1.6
+++ Makefile.PL 11 Aug 2006 18:36:53 -0000      1.7
@@ -1,7 +1,10 @@
 use 5.008004;
 use ExtUtils::MakeMaker;
-# See lib/ExtUtils/MakeMaker.pm for details of how to influence
-# the contents of the Makefile that is written.
+
+# dependency check
+my $etklib = `etk-config --version`;
+die "I can't run etk-config, make sure that etk is installed, and that 
etk-config is in your path" unless $etklib;
+
 WriteMakefile(
     DISTNAME          => 'Etk-Perl',
     NAME              => 'Etk',
@@ -9,9 +12,9 @@
     PREREQ_PM         => {}, 
     ($] >= 5.005 ?     
       (ABSTRACT       => 'Perl bindings for the Enlightened ToolKit (Etk)',
-       AUTHOR         => 'Hisham Mardam Bey <[EMAIL PROTECTED]>') : ()),
+       AUTHOR         => q|Chady 'Leviathan' Kassouf <[EMAIL PROTECTED]>|) : 
()),
     LIBS              => [`etk-config --libs`], 
-    DEFINE            => '', # '-DDEBUG', 
+    DEFINE            => '', #'-DDEBUG', 
     INC               => "-g -I. `etk-config --cflags`", 
     XSPROTOARG        => '-noprototypes',
     test              => {TESTS=>'t/Etk/*.t'},
===================================================================
RCS file: /cvs/e/e17/proto/etk-perl/TODO,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -3 -r1.13 -r1.14
--- TODO        6 Aug 2006 14:56:13 -0000       1.13
+++ TODO        11 Aug 2006 18:36:53 -0000      1.14
@@ -5,7 +5,6 @@
        - complete Tests
        - Check for memory usage (I'm not sure if we're leaking or not,
          need to do some tests for that)
-       - Add cache for perl objects which will help keep track of the C objects
        - Fix Combobox append functions (waiting for some functionality in etk)
 
 BUGS:
@@ -13,10 +12,7 @@
          fails to load the library, for now you can run:
          $ perl -MExtUtils::Command::MM -e "test_harness(0, 'blib/lib', 
'blib/arch')" t/Etk/*.t
 
-       - some methods return Etk::Widget, there's no way to know
-         what the original type of the object was, and the object
-         is unusable most of the time unless you bless it into its
-         original package. (The cache in the TODO above will help solve this)
+       - Cache is still all over the place
 
 Pending:
        -etk_canvas.h
===================================================================
RCS file: /cvs/e/e17/proto/etk-perl/typemap,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -3 -r1.11 -r1.12
--- typemap     6 Aug 2006 14:56:13 -0000       1.11
+++ typemap     11 Aug 2006 18:36:53 -0000      1.12
@@ -53,6 +53,7 @@
 Etk_Pointer_Type                               T_OPAQUE_STRUCT
 Etk_Popup_Window *                             T_PTROBJ_ETK
 Etk_Progress_Bar *                             T_PTROBJ_ETK
+Etk_Progress_Bar_Direction                     T_IV
 Etk_Property *                                 T_PTROBJ
 Etk_Property **                                        T_PTROBJ
 Etk_Property_Flags                             T_PTROBJ



-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
enlightenment-cvs mailing list
enlightenment-cvs@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs

Reply via email to