[ctypes-commit] ctypes-java/src/java/ctypes/java CType.java,1.5,1.6 CException.java,1.1,1.2 CBuffer.
Brought to you by:
theller
From: Bradley L S. <bs...@us...> - 2004-08-29 01:25:41
|
Update of /cvsroot/ctypes/ctypes-java/src/java/ctypes/java In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18970/src/java/ctypes/java Modified Files: CType.java CException.java CBuffer.java CCallbackFunction.java CFunction.java CStruct.java Log Message: Index: CException.java =================================================================== RCS file: /cvsroot/ctypes/ctypes-java/src/java/ctypes/java/CException.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** CException.java 5 Aug 2003 22:54:59 -0000 1.1 --- CException.java 29 Aug 2004 01:25:28 -0000 1.2 *************** *** 45,47 **** --- 45,62 ---- } + /** + * @param arg0 + * @param arg1 + */ + public CException(String arg0, Throwable arg1) { + super(arg0, arg1); + // TODO Auto-generated constructor stub + } + /** + * @param arg0 + */ + public CException(Throwable arg0) { + super(arg0); + // TODO Auto-generated constructor stub + } } Index: CBuffer.java =================================================================== RCS file: /cvsroot/ctypes/ctypes-java/src/java/ctypes/java/CBuffer.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** CBuffer.java 22 Mar 2004 05:55:36 -0000 1.3 --- CBuffer.java 29 Aug 2004 01:25:28 -0000 1.4 *************** *** 82,86 **** super.dump(buf, level); for (int j = 0; j < level + 1; j++) { ! buf.append("\t"); } byte[] dt = getData(); --- 82,86 ---- super.dump(buf, level); for (int j = 0; j < level + 1; j++) { ! buf.append("\n"); } byte[] dt = getData(); Index: CCallbackFunction.java =================================================================== RCS file: /cvsroot/ctypes/ctypes-java/src/java/ctypes/java/CCallbackFunction.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** CCallbackFunction.java 21 Mar 2004 23:44:58 -0000 1.4 --- CCallbackFunction.java 29 Aug 2004 01:25:28 -0000 1.5 *************** *** 11,18 **** public abstract Class[] getConverters(); public abstract Class getResultType(); ! abstract public CReturnable call(CType[] args); public CCallbackFunction() { Class[] converters = getConverters(); int numBytes = 0; --- 11,19 ---- public abstract Class[] getConverters(); public abstract Class getResultType(); ! long thunk; abstract public CReturnable call(CType[] args); public CCallbackFunction() { + super(4); Class[] converters = getConverters(); int numBytes = 0; *************** *** 22,28 **** } } ! this.address = init(getResultType(), getConverters(), numBytes, CFunction.FUNCFLAG_CDECL ); ! this.memoryBacked = true; ! this.isAtomic = true; } --- 23,29 ---- } } ! this.thunk = init(getResultType(), getConverters(), numBytes, CFunction.FUNCFLAG_CDECL ); ! //this.memoryBacked = true; ! //this.isAtomic = true; } *************** *** 36,40 **** public void destroy() throws Throwable { synchronized (this) { ! fini(this.address); this.address = 0; this.memoryBacked = false; --- 37,41 ---- public void destroy() throws Throwable { synchronized (this) { ! fini(this.thunk); this.address = 0; this.memoryBacked = false; *************** *** 47,50 **** --- 48,52 ---- } + /** * Allocate a trampoline that calls this object back on the call() method. *************** *** 61,65 **** * @param address A pointer to the trampoline. */ ! protected native void fini(long address ); } --- 63,82 ---- * @param address A pointer to the trampoline. */ ! protected native void fini(long thunk ); ! ! public void setAddress(long i, int syncDirection) throws CException { ! super.setAddress(i, syncDirection); ! if (isMemoryBacked()) { ! ! if (syncDirection == SYNCDIR_TOC) { ! pokeThunk(thunk); ! } else if (syncDirection == SYNCDIR_TOJAVA) { ! thunk = peekThunk(); ! } ! } ! } ! ! protected native void pokeThunk(long i); ! protected native long peekThunk(); } Index: CStruct.java =================================================================== RCS file: /cvsroot/ctypes/ctypes-java/src/java/ctypes/java/CStruct.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** CStruct.java 22 Mar 2004 05:55:36 -0000 1.4 --- CStruct.java 29 Aug 2004 01:25:28 -0000 1.5 *************** *** 161,165 **** if (Modifier.isPublic(modifiers) && ! Modifier.isStatic(modifiers)) { try { ! fields.add(f[i].get(this)); } catch (IllegalAccessException e) { e.printStackTrace(); --- 161,174 ---- if (Modifier.isPublic(modifiers) && ! Modifier.isStatic(modifiers)) { try { ! Object val = f[i].get(this); ! if (val == null) { ! try { ! val = f[i].getType().newInstance(); ! } catch (InstantiationException e) { ! e.printStackTrace(); ! } ! } ! fields.add(val); ! } catch (IllegalAccessException e) { e.printStackTrace(); Index: CFunction.java =================================================================== RCS file: /cvsroot/ctypes/ctypes-java/src/java/ctypes/java/CFunction.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** CFunction.java 23 Mar 2004 06:37:33 -0000 1.3 --- CFunction.java 29 Aug 2004 01:25:28 -0000 1.4 *************** *** 45,49 **** this.handle = load(dll.getHandle(), symbol); } ! public static CFunction loadNativeFunction(CDLL dll, String symbol) throws CSymbolNotFoundException { --- 45,54 ---- this.handle = load(dll.getHandle(), symbol); } ! ! public CFunction(String dll, String symbol)throws CSymbolNotFoundException { ! this.symbol = symbol; ! this.dll = CDLL.LoadLibrary(dll); ! this.handle = load(this.dll.getHandle(), symbol); ! } public static CFunction loadNativeFunction(CDLL dll, String symbol) throws CSymbolNotFoundException { *************** *** 80,84 **** if (args != null) { for (int i = 0; i < args.length; i++) { ! if (!(args[i] instanceof CType)) { throw new IllegalArgumentException("No types other than CTypes can be passed to this function."); } --- 85,89 ---- if (args != null) { for (int i = 0; i < args.length; i++) { ! if (!(args[i] instanceof CType) && (args[i] != null)) { throw new IllegalArgumentException("No types other than CTypes can be passed to this function."); } *************** *** 104,107 **** --- 109,113 ---- args = new Object[0]; } + return callInternal(handle, restype, args, flags); } Index: CType.java =================================================================== RCS file: /cvsroot/ctypes/ctypes-java/src/java/ctypes/java/CType.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** CType.java 30 Mar 2004 21:56:57 -0000 1.5 --- CType.java 29 Aug 2004 01:25:28 -0000 1.6 *************** *** 23,27 **** package ctypes.java; - import java.util.Properties; /** --- 23,26 ---- |