From 3ae46e02f3f8acc1e4fd279d9194f1f032452e75 Mon Sep 17 00:00:00 2001 From: rtrimana Date: Fri, 9 Dec 2016 16:35:46 -0800 Subject: [PATCH] Cleaning up --- common.mk | 1 + iotjava/Makefile | 9 ++- iotjava/iotpolicy/IoTCompiler.java | 78 ------------------- .../basics/TestClassInterface_Skeleton.cpp | 8 +- 4 files changed, 10 insertions(+), 86 deletions(-) diff --git a/common.mk b/common.mk index 0b14291..fdf6b88 100644 --- a/common.mk +++ b/common.mk @@ -1,4 +1,5 @@ G++ := g++ +ARM_G++ := arm-linux-gnueabihf-g++ JAVA := java JAR := jar JAVADOC := javadoc diff --git a/iotjava/Makefile b/iotjava/Makefile index 00fac5b..1a4d49c 100644 --- a/iotjava/Makefile +++ b/iotjava/Makefile @@ -36,10 +36,11 @@ compile: cp ./iotrmi/C++/basics/* $(BIN_DIR)/iotpolicy/output_files/Cplus cd $(BIN_DIR)/iotpolicy/output_files; cp *.java ./Java cd $(BIN_DIR)/iotpolicy/output_files; cp *.hpp ./Cplus - cd $(BIN_DIR)/iotpolicy/output_files/Java; $(JAVAC) -cp .:..:../../../$(BIN_DIR) TestClass_Skeleton.java - cd $(BIN_DIR)/iotpolicy/output_files/Java; $(JAVAC) -cp .:..:../../../$(BIN_DIR) TestClassAdvanced_Stub.java - cd $(BIN_DIR)/iotpolicy/output_files/Cplus; $(G++) ./TestClass_Skeleton.cpp -o ./TestClass_Skeleton.out --std=c++11 -pthread -pg -I../../../../iotjava/iotrmi/C++/ - cd $(BIN_DIR)/iotpolicy/output_files/Cplus; $(G++) ./TestClassAdvanced_Stub.cpp -o ./TestClassAdvanced_Stub.out --std=c++11 -pthread -pg -I../../../../iotjava/iotrmi/C++/ +# cd $(BIN_DIR)/iotpolicy/output_files/Java; $(JAVAC) -cp .:..:../../../$(BIN_DIR) TestClass_Skeleton.java +# cd $(BIN_DIR)/iotpolicy/output_files/Java; $(JAVAC) -cp .:..:../../../$(BIN_DIR) TestClassAdvanced_Stub.java +# cd $(BIN_DIR)/iotpolicy/output_files/Cplus; $(G++) ./TestClass_Skeleton.cpp -o ./TestClass_Skeleton.out --std=c++11 -pthread -pg -I../../../../iotjava/iotrmi/C++/ +# cd $(BIN_DIR)/iotpolicy/output_files/Cplus; $(G++) ./TestClassAdvanced_Stub.cpp -o ./TestClassAdvanced_Stub.out --std=c++11 -pthread -pg -I../../../../iotjava/iotrmi/C++/ + cd $(BIN_DIR)/iotpolicy/output_files/Cplus; $(ARM_G++) ./TestClassInterface_Skeleton.cpp -o ./TestClassInterface_Skeleton.out --std=c++11 -pthread -pg -I../../../../iotjava/iotrmi/C++/ PHONY += run-java-skeleton run-java-skeleton: diff --git a/iotjava/iotpolicy/IoTCompiler.java b/iotjava/iotpolicy/IoTCompiler.java index c0e932a..a5a6781 100644 --- a/iotjava/iotpolicy/IoTCompiler.java +++ b/iotjava/iotpolicy/IoTCompiler.java @@ -999,84 +999,6 @@ public class IoTCompiler { } -/* private void writeCallbackMethodBodyJavaStub(InterfaceDecl intDecl, List methParams, - List methPrmTypes, String method, String callbackType) { - - println("try {"); - // Check if this is single object, array, or list of objects - for (int i = 0; i < methParams.size(); i++) { - String paramType = methPrmTypes.get(i); - if (checkCallbackType(paramType, callbackType)) { // Check if this has callback object - String param = methParams.get(i); - if (isArrayOrList(paramType, param)) { // Generate loop - println("for (" + getGenericType(paramType) + " cb : " + getSimpleIdentifier(param) + ") {"); - println(callbackType + "_CallbackSkeleton skel" + i + " = new " + callbackType + "_CallbackSkeleton(cb, objIdCnt++);"); - } else - println(callbackType + "_CallbackSkeleton skel" + i + " = new " + callbackType + "_CallbackSkeleton(" + - getSimpleIdentifier(param) + ", objIdCnt++);"); - println("listCallbackObj.add(skel" + i + ");"); - if (isArrayOrList(paramType, param)) - println("}"); - } - } - print("}"); - println(" catch (Exception ex) {"); - println("ex.printStackTrace();"); - println("throw new Error(\"Exception when generating skeleton objects!\");"); - println("}\n"); - println("int methodId = " + intDecl.getMethodNumId(method) + ";"); - String retType = intDecl.getMethodType(method); - println("Class retType = " + getSimpleType(getEnumType(retType)) + ".class;"); - // Generate array of parameter types - print("Class[] paramCls = new Class[] { "); - for (int i = 0; i < methParams.size(); i++) { - String paramType = methPrmTypes.get(i); - if (checkCallbackType(paramType, callbackType)) { // Check if this has callback object - print("int.class"); - } else { // Generate normal classes if it's not a callback object - String prmType = checkAndGetArray(methPrmTypes.get(i), methParams.get(i)); - print(getSimpleType(prmType) + ".class"); - } - if (i != methParams.size() - 1) // Check if this is the last element - print(", "); - } - println(" };"); - // Generate array of parameter objects - print("Object[] paramObj = new Object[] { "); - for (int i = 0; i < methParams.size(); i++) { - String paramType = methPrmTypes.get(i); - if (checkCallbackType(paramType, callbackType)) { // Check if this has callback object - //if (isArray(methPrmTypes.get(i), methParams.get(i))) - if (isArray(methParams.get(i))) - print(getSimpleIdentifier(methParams.get(i)) + ".length"); - else if (isList(methPrmTypes.get(i))) - print(getSimpleIdentifier(methParams.get(i)) + ".size()"); - else - print("new Integer(1)"); - } else - print(getSimpleIdentifier(methParams.get(i))); - if (i != methParams.size() - 1) - print(", "); - } - println(" };"); - // Check if this is "void" - if (retType.equals("void")) { - println("rmiCall.remoteCall(objectId, methodId, retType, null, paramCls, paramObj);"); - } else { // We do have a return value - // Check if the return value NONPRIMITIVES - if (getParamCategory(retType) == ParamCategory.NONPRIMITIVES) { - String[] retGenValType = getTypeOfGeneric(retType); - println("Class retGenValType = " + retGenValType[0] + ".class;"); - println("Object retObj = rmiCall.remoteCall(objectId, methodId, retType, retGenValType, paramCls, paramObj);"); - println("return (" + retType + ")retObj;"); - } else { - println("Object retObj = rmiCall.remoteCall(objectId, methodId, retType, null, paramCls, paramObj);"); - println("return (" + retType + ")retObj;"); - } - } - }*/ - - /** * HELPER: writeMethodJavaStub() writes the methods of the stub class */ diff --git a/iotjava/iotrmi/C++/basics/TestClassInterface_Skeleton.cpp b/iotjava/iotrmi/C++/basics/TestClassInterface_Skeleton.cpp index c393c19..60ad5fd 100644 --- a/iotjava/iotrmi/C++/basics/TestClassInterface_Skeleton.cpp +++ b/iotjava/iotrmi/C++/basics/TestClassInterface_Skeleton.cpp @@ -18,10 +18,10 @@ int main(int argc, char *argv[]) cout << argv3 << endl; cout << argv4 << endl; - TestClassInterface *tc = new TestClass(argv2, argv3, argv4); - TestClassInterface_Skeleton *tcSkel = new TestClassInterface_Skeleton(tc, port); + //TestClassInterface *tc = new TestClass(argv2, argv3, argv4); + //TestClassInterface_Skeleton *tcSkel = new TestClassInterface_Skeleton(tc, port); - delete tc; - delete tcSkel; + //delete tc; + //delete tcSkel; return 0; } -- 2.34.1