changeset 82:d419660ad71d

tweak generate_stub.pl
author anatofuz
date Fri, 11 Oct 2019 19:32:16 +0900
parents d41e0a5f7e2f
children d4e22a45a575
files src/CMakeLists.txt src/SingleLinkedStack.cbc src/gearsTools/generate_stub.pl
diffstat 3 files changed, 5 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/src/CMakeLists.txt	Wed Oct 09 20:43:04 2019 +0900
+++ b/src/CMakeLists.txt	Fri Oct 11 19:32:16 2019 +0900
@@ -35,6 +35,7 @@
 
 set(CMAKE_BEFORE_PROJECT_PATH "${CMAKE_CURRENT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}")
 include_directories(".")
+include_directories(${CMAKE_SOURCE_DIR})
 configure_file("${CMAKE_SOURCE_DIR}/kernel-cmake.ld" "${CMAKE_CURRENT_BINARY_DIR}/kernel-cmake.ld" COPYONLY)
 
 macro( GearsCommand )
--- a/src/SingleLinkedStack.cbc	Wed Oct 09 20:43:04 2019 +0900
+++ b/src/SingleLinkedStack.cbc	Fri Oct 11 19:32:16 2019 +0900
@@ -1,11 +1,7 @@
 #include "../context.h"
 #interface "Stack.h"
 
-// typedef struct SingleLinkedStack {
-//     struct Element* top;
-// } SingleLinkedStack;
-
-Stack* createSingleLinkedStack(struct Context* context) {
+Stack* createSingleLinkedStack(struct Context* cbc_context) {
     struct Stack* stack = new Stack();
     struct SingleLinkedStack* singleLinkedStack = new SingleLinkedStack();
     stack->stack = (union Data*)singleLinkedStack;
--- a/src/gearsTools/generate_stub.pl	Wed Oct 09 20:43:04 2019 +0900
+++ b/src/gearsTools/generate_stub.pl	Fri Oct 11 19:32:16 2019 +0900
@@ -248,7 +248,7 @@
                 if ($typeName eq $var{$interface}->{$ivar}) {
                     if ($output) {
                         $dataGearName{$codeGearName} .= "\t$typeName$ptrType* O_$varName = &Gearef(cbc_context, $interface)->$varName;\n";
-                        $outputVar{$codeGearName} .= "\t$typeName$ptrType $varName = *O_$varName;\n";
+                        $outputVar{$codeGearName} .= "\t$typeName$ptrType $varName  __attribute__((unused))  = *O_$varName;\n";
                         return 1;
                     }
                     $dataGearName{$codeGearName} .= "\t$typeName$ptrType $varName = Gearef(cbc_context, $interface)->$varName;\n";
@@ -449,6 +449,7 @@
                 }
                 next;
             } elsif (! $inCode) {
+                s/new\s+(\w+)\(\)/\&ALLOCATE(cbc_context, \1)->\1/g;   # replacing new
                 print $fd $_;
                 next;
             } elsif (/^(.*)goto (\w+)\-\>(\w+)\((.*)\);/) {
@@ -458,7 +459,7 @@
                 my $next = $2;
                 my $method = $3;
                 my $tmpArgs = $4;
-                $tmpArgs =~ s/\(.*\)/\(\)/;
+                #$tmpArgs =~ s/\(.*\)/\(\)/;
                 my @args = split(/,/,$tmpArgs);
                 if (! defined $dataGearVarType{$codeGearName}) {
                    print $fd $_ ;