You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@etch.apache.org by gr...@apache.org on 2010/11/05 14:10:50 UTC

svn commit: r1031550 - in /incubator/etch/trunk/binding-c: compiler/src/main/java/org/apache/etch/bindings/c/compiler/ compiler/src/main/resources/org/apache/etch/bindings/c/compiler/ runtime/c/src/main/bindings/msg/

Author: grandyho
Date: Fri Nov  5 13:10:50 2010
New Revision: 1031550

URL: http://svn.apache.org/viewvc?rev=1031550&view=rev
Log:
ETCH-109: Fixes for mixins in C Binding. At the moment only mixed in data structures work. Function calls of mixed in services are not yet possible.

Modified:
    incubator/etch/trunk/binding-c/compiler/src/main/java/org/apache/etch/bindings/c/compiler/Compiler.java
    incubator/etch/trunk/binding-c/compiler/src/main/resources/org/apache/etch/bindings/c/compiler/base_c.vm
    incubator/etch/trunk/binding-c/compiler/src/main/resources/org/apache/etch/bindings/c/compiler/impl_c.vm
    incubator/etch/trunk/binding-c/compiler/src/main/resources/org/apache/etch/bindings/c/compiler/intf_c.vm
    incubator/etch/trunk/binding-c/compiler/src/main/resources/org/apache/etch/bindings/c/compiler/intf_h.vm
    incubator/etch/trunk/binding-c/compiler/src/main/resources/org/apache/etch/bindings/c/compiler/vf_c.vm
    incubator/etch/trunk/binding-c/runtime/c/src/main/bindings/msg/etch_default_value_factory.c

Modified: incubator/etch/trunk/binding-c/compiler/src/main/java/org/apache/etch/bindings/c/compiler/Compiler.java
URL: http://svn.apache.org/viewvc/incubator/etch/trunk/binding-c/compiler/src/main/java/org/apache/etch/bindings/c/compiler/Compiler.java?rev=1031550&r1=1031549&r2=1031550&view=diff
==============================================================================
--- incubator/etch/trunk/binding-c/compiler/src/main/java/org/apache/etch/bindings/c/compiler/Compiler.java (original)
+++ incubator/etch/trunk/binding-c/compiler/src/main/java/org/apache/etch/bindings/c/compiler/Compiler.java Fri Nov  5 13:10:50 2010
@@ -1561,12 +1561,6 @@ public class Compiler extends Backend {
 	}
 
 	public String getValidator(Service service, Named<?> named) {
-		
-//		(objmask*) etchvtor_custom_get(ETCHTYPEB_USER, 
-//		 get_dynamic_classid_unique(&CLASSID_TESTER_SIMPLESTRUCT),
-//		 tester_valufact_get_static()->_mt_tester_simpleStruct,
-//        1))
-		
 		if (named instanceof Parameter) {
 			Parameter param = (Parameter) named;
 			TypeRef type = param.type();
@@ -1596,7 +1590,7 @@ public class Compiler extends Backend {
 			if (n.isStruct() || n.isExcept() || n.isEnumx())
 				return String.format(
 						"(etch_object*)etchvtor_custom_get(ETCHTYPEB_USER, get_dynamic_classid_unique(&CLASSID_%s), %s_valufact_get_static()->_mt_%s, %d)", 
-								 n.efqname(this).toUpperCase(), service.name().toString().toLowerCase(), n.efqname(this), type.dim());
+								 n.efqname(this).toUpperCase(), getDefiningServiceNameOf(type), n.efqname(this), type.dim());
 
 			if (n.isExtern())
 			{

Modified: incubator/etch/trunk/binding-c/compiler/src/main/resources/org/apache/etch/bindings/c/compiler/base_c.vm
URL: http://svn.apache.org/viewvc/incubator/etch/trunk/binding-c/compiler/src/main/resources/org/apache/etch/bindings/c/compiler/base_c.vm?rev=1031550&r1=1031549&r2=1031550&view=diff
==============================================================================
--- incubator/etch/trunk/binding-c/compiler/src/main/resources/org/apache/etch/bindings/c/compiler/base_c.vm (original)
+++ incubator/etch/trunk/binding-c/compiler/src/main/resources/org/apache/etch/bindings/c/compiler/base_c.vm Fri Nov  5 13:10:50 2010
@@ -26,12 +26,11 @@
 \#include "etch_objecttypes.h"
 \#include "etch_general.h"
 \#include "etch_url.h"  
-
-unsigned short CLASSID_$helper.getBaseName( $intf, $suffix ).toUpperCase()_BASE;
-	
 #foreach($serviceName in $helper.getUsedServiceNames($intf))	
-\#include "${serviceName.toLowerCase()}.h"
+\#include "${serviceName.toLowerCase()}_interface.h"
 #end
+
+unsigned short CLASSID_$helper.getBaseName( $intf, $suffix ).toUpperCase()_BASE;
 	
 #if ($helper.isServer($mc))
 int destroy_$helper.getBaseName($intf, $suffix)_via_base(void*);

Modified: incubator/etch/trunk/binding-c/compiler/src/main/resources/org/apache/etch/bindings/c/compiler/impl_c.vm
URL: http://svn.apache.org/viewvc/incubator/etch/trunk/binding-c/compiler/src/main/resources/org/apache/etch/bindings/c/compiler/impl_c.vm?rev=1031550&r1=1031549&r2=1031550&view=diff
==============================================================================
--- incubator/etch/trunk/binding-c/compiler/src/main/resources/org/apache/etch/bindings/c/compiler/impl_c.vm (original)
+++ incubator/etch/trunk/binding-c/compiler/src/main/resources/org/apache/etch/bindings/c/compiler/impl_c.vm Fri Nov  5 13:10:50 2010
@@ -29,14 +29,13 @@
 \#include "etch_exception.h"
 \#include "etch_general.h"
 \#include "etch_log.h"
-
 \#include <stdio.h>
+#foreach($serviceName in $helper.getUsedServiceNames($intf))	
+\#include "${serviceName.toLowerCase()}_interface.h"
+#end	
 
 unsigned short CLASSID_$helper.getImplName($intf, $suffix).toUpperCase();	
 	
-#foreach($serviceName in $helper.getUsedServiceNames($intf))	
-\#include "${serviceName.toLowerCase()}.h"
-#end	
 	
 #if($helper.isServer($mc))
 char* $helper.getServiceName($intf).toUpperCase()_ETCHSIMP = "SIMP";

Modified: incubator/etch/trunk/binding-c/compiler/src/main/resources/org/apache/etch/bindings/c/compiler/intf_c.vm
URL: http://svn.apache.org/viewvc/incubator/etch/trunk/binding-c/compiler/src/main/resources/org/apache/etch/bindings/c/compiler/intf_c.vm?rev=1031550&r1=1031549&r2=1031550&view=diff
==============================================================================
--- incubator/etch/trunk/binding-c/compiler/src/main/resources/org/apache/etch/bindings/c/compiler/intf_c.vm (original)
+++ incubator/etch/trunk/binding-c/compiler/src/main/resources/org/apache/etch/bindings/c/compiler/intf_c.vm Fri Nov  5 13:10:50 2010
@@ -30,7 +30,7 @@
 
 #foreach( $n in $intf.iterator() )
 #if ($n.isConstant())
-$helper.getNativeTypeNameForConstants( $n.type() ) $n.name() = $helper.getTypeValue( $n.type(), $n.value() );
+$helper.getNativeTypeNameForConstants( $n.type() ) $helper.getIntfName( $intf )_$n.name() = $helper.getTypeValue( $n.type(), $n.value() );
 #end
 #end
 

Modified: incubator/etch/trunk/binding-c/compiler/src/main/resources/org/apache/etch/bindings/c/compiler/intf_h.vm
URL: http://svn.apache.org/viewvc/incubator/etch/trunk/binding-c/compiler/src/main/resources/org/apache/etch/bindings/c/compiler/intf_h.vm?rev=1031550&r1=1031549&r2=1031550&view=diff
==============================================================================
--- incubator/etch/trunk/binding-c/compiler/src/main/resources/org/apache/etch/bindings/c/compiler/intf_h.vm (original)
+++ incubator/etch/trunk/binding-c/compiler/src/main/resources/org/apache/etch/bindings/c/compiler/intf_h.vm Fri Nov  5 13:10:50 2010
@@ -27,11 +27,15 @@
 
 \#include "etch_object.h"
 \#include "etch_mailbox.h"
+#foreach($serviceName in $helper.getUsedServiceNames($intf))	
+\#include "${serviceName.toLowerCase()}_interface.h"
+#end
 
 #ifdef __cplusplus
 extern "C" {
 #endif
 
+
 ## generate CLASSIDs
 extern unsigned short CLASSID_$helper.getIntfName( $intf ).toUpperCase()_SERVICE_INTERFACE;
 #foreach( $n in $intf.iterator() )
@@ -45,22 +49,9 @@ extern unsigned short CLASSID_$n.efqname
 #end
 #end
 
-## generate typedefs
-#foreach( $n in $intf.iterator() )
-#if ($n.isStruct())
-#if (!$hasBaseClass)
-//typedef struct $n.efqname($helper) $n.efqname($helper);
-#end
-#end
-#end
-
-#foreach($serviceName in $helper.getUsedServiceNames($intf))	
-\#include "${serviceName.toLowerCase()}.h"
-#end
-
 #foreach( $n in $intf.iterator() )
 #if ($n.isConstant())
-extern $helper.getNativeTypeNameForConstants( $n.type() ) $n.name();
+extern $helper.getNativeTypeNameForConstants( $n.type() ) $helper.getIntfName( $intf )_$n.name();
 #end
 #end
 

Modified: incubator/etch/trunk/binding-c/compiler/src/main/resources/org/apache/etch/bindings/c/compiler/vf_c.vm
URL: http://svn.apache.org/viewvc/incubator/etch/trunk/binding-c/compiler/src/main/resources/org/apache/etch/bindings/c/compiler/vf_c.vm?rev=1031550&r1=1031549&r2=1031550&view=diff
==============================================================================
--- incubator/etch/trunk/binding-c/compiler/src/main/resources/org/apache/etch/bindings/c/compiler/vf_c.vm (original)
+++ incubator/etch/trunk/binding-c/compiler/src/main/resources/org/apache/etch/bindings/c/compiler/vf_c.vm Fri Nov  5 13:10:50 2010
@@ -36,7 +36,7 @@
 \#include "etch_map.h"
 \#include "etch_runtime.h"
 #foreach($serviceName in $helper.getUsedServiceNames($intf))	
-\#include "${serviceName.toLowerCase()}.h"
+\#include "${serviceName.toLowerCase()}_interface.h"
 #end	
 #foreach($serviceName in $helper.getUsedServiceNames($intf))	
 \#include "${serviceName.toLowerCase()}_valufact.h"
@@ -319,10 +319,7 @@ static int $helper.getVfName($intf)_init
 #end
 #end	
 #end
-	
 
-//OLD
-//structs	
 	return 0;
 }
 
@@ -418,7 +415,7 @@ $helper.getVfName($intf)* new_$helper.ge
 #if ($n.isMixin())
 #set( $m = $n.getModule() )
 #set( $s = $m.iterator().next() )
-		defvf_add_mixin(pvf, new_$s.name().toString().toLowerCase()_valufact());
+	defvf_add_mixin(pvf, (etch_value_factory*)new_$s.name().toString().toLowerCase()_valufact());
 #end
 #end
     return pvf; 

Modified: incubator/etch/trunk/binding-c/runtime/c/src/main/bindings/msg/etch_default_value_factory.c
URL: http://svn.apache.org/viewvc/incubator/etch/trunk/binding-c/runtime/c/src/main/bindings/msg/etch_default_value_factory.c?rev=1031550&r1=1031549&r2=1031550&view=diff
==============================================================================
--- incubator/etch/trunk/binding-c/runtime/c/src/main/bindings/msg/etch_default_value_factory.c (original)
+++ incubator/etch/trunk/binding-c/runtime/c/src/main/bindings/msg/etch_default_value_factory.c Fri Nov  5 13:10:50 2010
@@ -889,7 +889,7 @@ etch_arraylist* new_vf_mixin_collection(
     //TODO: eheck if arraylist have to be synchronized
     etch_arraylist* list = new_etch_arraylist(ETCH_DEVVF_MIXINS_DEFINITSIZE, 0);
     list->content_type = ETCHARRAYLIST_CONTENT_OBJECT;
-    list->is_readonly  = TRUE; /* list dtor will not destroy list content */
+    list->is_readonly  = FALSE; /* list dtor will destroy list content */
     list->content_obj_type = ((etch_object*)vf)->obj_type;
     list->content_class_id = ((etch_object*)vf)->class_id;
     return list;