[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r2930 - in freeway/src/org/gnu/freeway/cwrappers: . util
From: |
grothoff |
Subject: |
[GNUnet-SVN] r2930 - in freeway/src/org/gnu/freeway/cwrappers: . util |
Date: |
Sun, 28 May 2006 13:38:50 -0700 (PDT) |
Author: grothoff
Date: 2006-05-28 13:38:49 -0700 (Sun, 28 May 2006)
New Revision: 2930
Added:
freeway/src/org/gnu/freeway/cwrappers/util/SwitchTableGenerator.java
Removed:
freeway/src/org/gnu/freeway/cwrappers/CLibraryHandle.java
Log:
adddel
Deleted: freeway/src/org/gnu/freeway/cwrappers/CLibraryHandle.java
===================================================================
--- freeway/src/org/gnu/freeway/cwrappers/CLibraryHandle.java 2006-05-28
20:33:32 UTC (rev 2929)
+++ freeway/src/org/gnu/freeway/cwrappers/CLibraryHandle.java 2006-05-28
20:38:49 UTC (rev 2930)
@@ -1,32 +0,0 @@
- /*
- This file is part of Freeway
-
- Freeway 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 2, or (at your
- option) any later version.
-
- Freeway 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 Freeway; see the file COPYING. If not, write to the
- Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- Boston, MA 02111-1307, USA.
- */
-
-package org.gnu.freeway.cwrappers;
-
-/**
- * @file CLibraryHandle.java
- * @brief
- * @author mdonoughe
- */
-public class CLibraryHandle {
- public final long _;
- public CLibraryHandle(long value) {
- _ = value;
- }
-}
Added: freeway/src/org/gnu/freeway/cwrappers/util/SwitchTableGenerator.java
===================================================================
--- freeway/src/org/gnu/freeway/cwrappers/util/SwitchTableGenerator.java
2006-05-28 20:33:32 UTC (rev 2929)
+++ freeway/src/org/gnu/freeway/cwrappers/util/SwitchTableGenerator.java
2006-05-28 20:38:49 UTC (rev 2930)
@@ -0,0 +1,74 @@
+ /*
+ This file is part of Freeway
+
+ Freeway 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 2, or (at your
+ option) any later version.
+
+ Freeway 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 Freeway; see the file COPYING. If not, write to the
+ Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA.
+ */
+
+package org.gnu.freeway.cwrappers.util;
+
+import java.lang.reflect.Field;
+import java.lang.reflect.Method;
+
+/**
+ * @file SwitchTableGenerator.java
+ * @brief This class should generate the switch-table.c, switch-table.h and
+ * service.impl.* classes by reflecting over the various service
interfaces
+ * and generating the appropriate code
+ * @author Christina Grothoff
+ */
+public class SwitchTableGenerator {
+
+
+
+ /**
+ *
+ */
+ public SwitchTableGenerator() {
+ super();
+ }
+
+ /**
+ *
+ * @param args
+ */
+ public static void main(String[] args) {
+
+ }
+
+ public static int getFunctionType(Method m) {
+ Class[] args = m.getParameterTypes();
+ int ret = 0;
+ for (int i=0;i<args.length;i++)
+ ret = ret * CWrapper.MAX_KIND +
getArgumentType(args[i]);
+ return ret * (CWrapper.MAX_KIND + 1) +
getArgumentType(m.getReturnType());
+ }
+
+ public static int getArgumentType(Class c) {
+ if (c == Void.class)
+ return CWrapper.VOID_KIND;
+ try {
+ Field f = c.getField("KIND");
+ f.setAccessible(true);
+ Integer i = (Integer) f.get(null);
+ int ret = i.intValue();
+ assert (ret >= 0) && (ret < CWrapper.MAX_KIND);
+ return ret;
+ } catch (Throwable t) {
+ throw new Error(t);
+ }
+ }
+
+}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r2930 - in freeway/src/org/gnu/freeway/cwrappers: . util,
grothoff <=