# HG changeset patch # User Frank Benoit # Date 1193596538 -3600 # Node ID 963d271f7c25efb7b7c9264d6ae83058fc3b6b7e # Parent 7c2c75740370d2674bb363494aea0e1edac2a41c disabled event stuff, to have working example diff -r 7c2c75740370 -r 963d271f7c25 dbus-d-javatests/README.txt --- a/dbus-d-javatests/README.txt Sun Oct 21 19:22:41 2007 +0200 +++ b/dbus-d-javatests/README.txt Sun Oct 28 19:35:38 2007 +0100 @@ -6,14 +6,16 @@ 1. Build the "createinterface" tool. in the dbus-d directory: - $ cd dbus-d - $ dsss build org/freedesktop/dbus/tools/CreateInterface.d + $ cd dbus-d/dsrc + $ dsss build org/freedesktop/dbus/tool/CreateInterface.d + + On success, this creates the CreateInterface tool in ../.. 2. Goto the directory of your applications source code ,call the CreateInterface tool and pipe the output to a file matching your module name. $ cd ../dbus-d-javatests/dsrc - $ ../../dbus-d/CreateInterface ../dbustest.xml DBusTestingGen > DBusTestingGen.d + $ ../../CreateInterface ../dbustest.xml DBusTestingGen > DBusTestingGen.d 3. Implement interfaces in D. If the introspection.xml has an interface called "a.b.C" you need to implement the interface "DBusInterface.a.b.C" which is part of the generated diff -r 7c2c75740370 -r 963d271f7c25 dbus-d-javatests/dbustest.xml --- a/dbus-d-javatests/dbustest.xml Sun Oct 21 19:22:41 2007 +0200 +++ b/dbus-d-javatests/dbustest.xml Sun Oct 28 19:35:38 2007 +0100 @@ -71,14 +71,14 @@ - + diff -r 7c2c75740370 -r 963d271f7c25 dbus-d-javatests/dsrc/DBusTesting.d --- a/dbus-d-javatests/dsrc/DBusTesting.d Sun Oct 21 19:22:41 2007 +0200 +++ b/dbus-d-javatests/dsrc/DBusTesting.d Sun Oct 28 19:35:38 2007 +0100 @@ -63,14 +63,14 @@ o_double = i_double; o_string = i_string.reverse; } - +/+ public void triggerSignal( in int count ){ checkCall( "triggerSignal" ); for( int i = 0; i < count; i++ ){ testSigI.opCall( i ); } } - ++/ } //mixin( createJavaImplementation( "MyClass", ["DBusInterface.dbustest.DImpl" ] )); diff -r 7c2c75740370 -r 963d271f7c25 dbus-d-javatests/dsrc/DBusTestingGen.d --- a/dbus-d-javatests/dsrc/DBusTestingGen.d Sun Oct 21 19:22:41 2007 +0200 +++ b/dbus-d-javatests/dsrc/DBusTestingGen.d Sun Oct 28 19:35:38 2007 +0100 @@ -29,34 +29,16 @@ public interface Peer { public void Ping(); public char[] GetMachineId(); - template _StdJavaImpl(){ - } - template _StdDImpl(){ - void _init(){ - } - } } // org.freedesktop.DBus.Introspectable public interface Introspectable { public char[] Introspect(); - template _StdJavaImpl(){ - } - template _StdDImpl(){ - void _init(){ - } - } } // org.freedesktop.DBus.Properties public interface Properties { public DBusVariant Get( in char[] intf_name, in char[] prop_name ); public void Set( in char[] intf_name, in char[] prop_name, in DBusVariant prop ); public DBusVariant[ char[] ] GetAll( in char[] intf_name ); - template _StdJavaImpl(){ - } - template _StdDImpl(){ - void _init(){ - } - } } } } @@ -66,62 +48,26 @@ // dbustest.OtherInterface public interface OtherInterface { public void dummy( in char[] arg1 ); - template _StdJavaImpl(){ - } - template _StdDImpl(){ - void _init(){ - } - } } // dbustest.TestControl public interface TestControl { public char[][] getCalledTests(); public void activateExceptions( in bool enable ); - template _StdJavaImpl(){ - } - template _StdDImpl(){ - void _init(){ - } - } } // dbustest.TestListener public interface TestListener { public char[] getName(); - template _StdJavaImpl(){ - } - template _StdDImpl(){ - void _init(){ - } - } } // dbustest.JavaImpl public interface JavaImpl { public void testV_V(); public int testI_I( in int arg1 ); - template _StdJavaImpl(){ - } - template _StdDImpl(){ - void _init(){ - } - } } // dbustest.DImpl public interface DImpl { public void testV_V(); public int testI_I( in int arg1 ); public void testParamAllSimpleTyes( in bool i_bool, out bool o_bool, in byte i_byte, out byte o_byte, in short i_short, out short o_short, in ushort i_ushort, out ushort o_ushort, in int i_int, out int o_int, in uint i_uint, out uint o_uint, in long i_long, out long o_long, in ulong i_ulong, out ulong o_ulong, in double i_double, out double o_double, in char[] i_string, out char[] o_string ); - public void triggerSignal( in int count ); - public tango.core.Signal.Signal!( int )* testSigI(); - template _StdJavaImpl(){ - } - template _StdDImpl(){ - void _init(){ - } - protected tango.core.Signal.Signal!( int ) _testSigI; - public tango.core.Signal.Signal!( int )* testSigI(){ - return &_testSigI; - } - } } } } @@ -246,9 +192,6 @@ " \\n" " \\n" " \\n" - " \\n" - " \\n" - " \\n" "\\n"); } private DBusHandlerResult intfHandler__org_freedesktop_DBus_Peer( DBusConnection* conn, DBusMessage* message, void* user_data ){ @@ -492,19 +435,6 @@ sendReplyData!( bool, byte, short, ushort, int, uint, long, ulong, double, char[] )( conn, message, po ); } break; - case "triggerSignal|i": - { - Struct!( int ) pi = getCallValues!( int )( message ); - o.triggerSignal( pi.t[0] ); - sendReply( conn, message ); - } - break; - case "testSigI>i": - { - Struct!( int ) pi = getCallValues!( int )( message ); - o.testSigI().opCall( pi.t[0] ); - } - break; default: return DBusHandlerResult.DBUS_HANDLER_RESULT_NOT_YET_HANDLED; } diff -r 7c2c75740370 -r 963d271f7c25 dbus-d-javatests/jsrc/dbustest/DBusTester.java --- a/dbus-d-javatests/jsrc/dbustest/DBusTester.java Sun Oct 21 19:22:41 2007 +0200 +++ b/dbus-d-javatests/jsrc/dbustest/DBusTester.java Sun Oct 28 19:35:38 2007 +0100 @@ -1,16 +1,11 @@ package dbustest; -import java.util.Collections; -import java.util.List; - -import org.freedesktop.dbus.DBusSigHandler; import org.freedesktop.dbus.DirectConnection; import org.freedesktop.dbus.UInt16; import org.freedesktop.dbus.UInt32; import org.freedesktop.dbus.UInt64; import dbus_d_javahelper.DBusDLoader; -import dbustest.DImpl.testSigI; public class DBusTester { @@ -21,13 +16,14 @@ throw new RuntimeException( msg ); } } - private static void ensureEqualLists( List list1, String[] list2 ){ - Collections.sort(list1); - ensure( list1.size() == list2.length, "List sizes are not equal" ); - for( int i = 0; i < list1.size(); i++ ){ - ensure( list1.get(i).equals(list2[i]), "List content is not equal" ); - } - } + +// private static void ensureEqualLists( List list1, String[] list2 ){ +// Collections.sort(list1); +// ensure( list1.size() == list2.length, "List sizes are not equal" ); +// for( int i = 0; i < list1.size(); i++ ){ +// ensure( list1.get(i).equals(list2[i]), "List content is not equal" ); +// } +// } public static void main(String[] args) { @@ -83,16 +79,16 @@ ensure( res.i == 1.0, "double" ); ensure( res.j.equals( "cbaCBA" ), "string" ); } - - // 4. cause the test object to generate signal - DBusSigHandler handler = new DBusSigHandler(){ - public void handle(testSigI s) { - handledCounter++; - } - }; - dc.addSigHandler( DImpl.testSigI.class, handler ); - - rem.triggerSignal( 10 ); + +// // 4. cause the test object to generate signal +// DBusSigHandler handler = new DBusSigHandler(){ +// public void handle(testSigI s) { +// handledCounter++; +// } +// }; +// dc.addSigHandler( DImpl.testSigI.class, handler ); +// +// rem.triggerSignal( 10 ); Thread.sleep(100); System.out.printf( "HandledCounter: %d\n", handledCounter ); diff -r 7c2c75740370 -r 963d271f7c25 dbus-d-javatests/jsrc/dbustest/DImpl.java --- a/dbus-d-javatests/jsrc/dbustest/DImpl.java Sun Oct 21 19:22:41 2007 +0200 +++ b/dbus-d-javatests/jsrc/dbustest/DImpl.java Sun Oct 28 19:35:38 2007 +0100 @@ -1,27 +1,15 @@ package dbustest; import org.dsource.dbus.d.Returns; import org.freedesktop.dbus.DBusInterface; -import org.freedesktop.dbus.DBusSignal; import org.freedesktop.dbus.UInt16; import org.freedesktop.dbus.UInt32; import org.freedesktop.dbus.UInt64; -import org.freedesktop.dbus.exceptions.DBusException; public interface DImpl extends DBusInterface { - public static class testSigI extends DBusSignal - { - public final int arg1; - public testSigI(String path, int arg1) throws DBusException - { - super(path, arg1); - this.arg1 = arg1; - } - } public void testV_V(); @Returns("res") public int testI_I(int arg1); public NTuple10 testParamAllSimpleTyes(boolean i_bool, byte i_byte, short i_short, UInt16 i_ushort, int i_int, UInt32 i_uint, long i_long, UInt64 i_ulong, double i_double, String i_string); - public void triggerSignal(int count); } diff -r 7c2c75740370 -r 963d271f7c25 dbus-d/dsrc/dsss.conf --- a/dbus-d/dsrc/dsss.conf Sun Oct 21 19:22:41 2007 +0200 +++ b/dbus-d/dsrc/dsss.conf Sun Oct 28 19:35:38 2007 +0100 @@ -1,18 +1,10 @@ [test/client/DClient.d] -version(linux){ buildflags+=-I~/tango buildflags+=-L-ldbus-1 -} -version(Windows){ - buildflags+=-S..\libs - buildflags+=-ll"libdbus-1" - buildflags+=-L/SUBSYSTEM:console:5 -} target=DClient.exe [org/freedesktop/dbus/tool/CreateInterface.d] -target=../CreateInterface -buildflags+=$LIB_PREFIX/libSDD-tango-*.a +target=../../CreateInterface diff -r 7c2c75740370 -r 963d271f7c25 dbus-d/dsrc/org/freedesktop/dbus/DBus.d --- a/dbus-d/dsrc/org/freedesktop/dbus/DBus.d Sun Oct 21 19:22:41 2007 +0200 +++ b/dbus-d/dsrc/org/freedesktop/dbus/DBus.d Sun Oct 28 19:35:38 2007 +0100 @@ -1151,6 +1151,7 @@ res ~= intf; } res ~= " {\n"; + /+ foreach( intf; interfaces ){ res ~= " mixin "~intf~"._StdDImpl!() _StdDImpl_"~ctfeReplace( intf, '.', '_' )~";\n"; } @@ -1159,6 +1160,7 @@ res ~= " _StdDImpl_"~ ctfeReplace( intf, '.', '_' ) ~"._init();\n"; } res ~= " }\n"; + +/ res ~= "}\n"; return res; } diff -r 7c2c75740370 -r 963d271f7c25 dbus-d/dsrc/org/freedesktop/dbus/tool/CreateInterface.d --- a/dbus-d/dsrc/org/freedesktop/dbus/tool/CreateInterface.d Sun Oct 21 19:22:41 2007 +0200 +++ b/dbus-d/dsrc/org/freedesktop/dbus/tool/CreateInterface.d Sun Oct 28 19:35:38 2007 +0100 @@ -676,6 +676,7 @@ foreach( sign; intf.mSignals ){ writeInterfaceSignal( p, sign, indent+1 ); } + /+ p.formatln( "{}template _StdJavaImpl(){{", getIndent(indent+1) ); p.formatln( "{}}", getIndent(indent+1) ); p.formatln( "{}template _StdDImpl(){{", getIndent(indent+1) ); @@ -685,6 +686,7 @@ writeInterfaceSignalDImpl( p, sign, indent+2 ); } p.formatln( "{}}", getIndent(indent+1) ); + +/ } foreach( child; intfTree.getChildNames( name ) ){ writeInterface( p, child, indent +1 );