You are viewing a plain text version of this content. The canonical link for it is here.
Posted to kato-commits@incubator.apache.org by sp...@apache.org on 2009/09/05 21:57:15 UTC

svn commit: r811719 [2/2] - in /incubator/kato/trunk/org.apache.kato.native: ./ kato.native.cjvmti/ kato.native.cjvmti/.settings/ kato.native.cjvmti/linux-x86/ kato.native.cjvmti/linux-x86/libcjvmti/ kato.native.cjvmti/linux-x86/libcjvmti/target/ kato....

Added: incubator/kato/trunk/org.apache.kato.native/kato.native.cjvmti/src/main/native/queue.c
URL: http://svn.apache.org/viewvc/incubator/kato/trunk/org.apache.kato.native/kato.native.cjvmti/src/main/native/queue.c?rev=811719&view=auto
==============================================================================
--- incubator/kato/trunk/org.apache.kato.native/kato.native.cjvmti/src/main/native/queue.c (added)
+++ incubator/kato/trunk/org.apache.kato.native/kato.native.cjvmti/src/main/native/queue.c Sat Sep  5 21:57:13 2009
@@ -0,0 +1,130 @@
+/*******************************************************************************
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ ******************************************************************************/
+#include <stdio.h>
+#include <stdlib.h>
+#include <malloc.h>
+#include <string.h>
+
+// This is really an array list.
+
+struct queueADT{
+	void * queue;
+	int readPoint;
+	int addPoint;
+	int size;
+	int sizeOfElement;
+	int qID;
+};
+
+static int id;
+int doubleSize(queueADT);
+
+struct queueADT * Q_initQueue(int qsize, int sizeofElement){
+	void * pt;
+	struct queueADT * q = calloc(1, sizeof(struct queueADT));
+	id++;
+	q->qID = id;
+	q->sizeOfElement = sizeofElement;
+	q->size = qsize;
+	q->addPoint = 0;
+	q->readPoint = 0;
+	pt = calloc (qsize, sizeofElement);
+	if (pt == NULL){
+		printf("Problem with malloc \n");
+		abort();
+	}
+	q->queue = pt;
+	return q;
+}
+
+int Q_dequeue (void * writeLoc, struct queueADT * q){
+	char * src;
+	if (q == NULL){
+		printf("null queue passed, abort \n");
+	}
+	if (q->readPoint == q->addPoint){
+		memset(writeLoc, 0, q->sizeOfElement);
+		return 0;
+	}
+	src = (char *)q->queue;
+	memcpy(writeLoc, (void *)&src[q->readPoint*q->sizeOfElement], q->sizeOfElement);
+	q->readPoint++;
+	q->readPoint = (q->readPoint)%q->size;
+	return 1;
+}
+
+int Q_enqueue(void * readLoc, struct queueADT * q){
+	char * dst;
+	if (q == NULL){
+		printf("null queue passed, abort \n");
+		abort();
+	}
+	if (((q->addPoint+1)%q->size) == q->readPoint){
+		doubleSize(q);
+	}
+	dst = q->queue;
+	memcpy((void *)&dst[q->addPoint*q->sizeOfElement], readLoc, q->sizeOfElement);
+	q->addPoint = (q->addPoint+1)%(q->size);
+	return 1;
+}
+
+int Q_size(struct queueADT *q){
+	return q->size;
+}
+
+int doubleSize(struct queueADT * q){
+	void * pt;
+	int i;
+	char * src;
+	char * dst;
+	if (q == NULL){
+		printf("null queue passed, abort \n");
+	}
+	pt = calloc(q->size*2, q->sizeOfElement);
+	if (pt == NULL){
+		printf("Problem with malloc \n");
+		abort();
+	}
+	src = q->queue;
+	dst = pt;
+	for (i = 0; i < q->size; i++){
+		if (i == 0 && q->readPoint == 0){
+			memcpy((void *)&dst[i*(q->sizeOfElement)], (void *)&src[0], q->sizeOfElement);
+		}else{
+			memcpy((void *)&dst[i*(q->sizeOfElement)], (void *)&src[(((q->readPoint)+i)%(q->size))*(q->sizeOfElement)], q->sizeOfElement);
+		}
+	}
+	if (q == q->queue){
+		printf( "? ??? \n ");
+	}
+	free(q->queue);
+	printf("%d doubled %d \n",q->qID, q->size*2);
+	if (q->addPoint >= q->readPoint){
+		q->addPoint = q->addPoint - q->readPoint;
+	}else{
+		q->addPoint = q->size - q->readPoint + q->addPoint;
+	}
+	q->readPoint = 0;
+	q->queue = pt;
+	q->size = q->size*2;
+	return 1;
+}
+
+int Q_free(struct queueADT * q){
+	id--;
+	free(q->queue);
+	free(q);
+	q = NULL;
+	return 1;
+}

Added: incubator/kato/trunk/org.apache.kato.native/kato.native.cjvmti/win32/ExeDynamic/pom.xml
URL: http://svn.apache.org/viewvc/incubator/kato/trunk/org.apache.kato.native/kato.native.cjvmti/win32/ExeDynamic/pom.xml?rev=811719&view=auto
==============================================================================
--- incubator/kato/trunk/org.apache.kato.native/kato.native.cjvmti/win32/ExeDynamic/pom.xml (added)
+++ incubator/kato/trunk/org.apache.kato.native/kato.native.cjvmti/win32/ExeDynamic/pom.xml Sat Sep  5 21:57:13 2009
@@ -0,0 +1,69 @@
+<project>
+
+  <modelVersion>4.0.0</modelVersion>
+
+  <parent>
+    <groupId>org.codehaus.mojo.natives.it.linkages.win32</groupId>
+    <artifactId>win32</artifactId>
+    <version>1.0-SNAPSHOT</version>
+  </parent>
+
+  <artifactId>ExeDynamic</artifactId>
+  
+  <name>ExeDynamic.exe</name>
+  
+  <packaging>exe</packaging>
+  
+  <dependencies>
+    <dependency>
+       <groupId>org.codehaus.mojo.natives.it.linkages.win32</groupId>
+       <artifactId>SubFuncDynamic</artifactId>
+       <type>lib</type>
+       <version>${project.version}</version>
+    </dependency>
+    <dependency>
+       <groupId>org.codehaus.mojo.natives.it.linkages.win32</groupId>
+       <artifactId>FuncDynamic</artifactId>
+       <type>lib</type>
+       <version>${project.version}</version>
+    </dependency>
+  </dependencies>
+  
+  
+  <build>
+    <plugins>
+      <plugin>
+        <groupId>org.codehaus.mojo</groupId>
+        <artifactId>native-maven-plugin</artifactId>
+        <configuration>
+          <compilerStartOptions>
+            <compilerStartOption>${commonCompilerOptions}</compilerStartOption>
+          </compilerStartOptions>
+          
+          <sources>
+            <source>
+              <directory>${native.source.dir}</directory>
+              <fileNames>
+                <fileName>hello.c</fileName>
+              </fileNames>
+            </source>  
+            <source>
+              <directory>${native.source.dir}/include</directory>
+            </source>            
+          </sources>
+            
+          <linkerStartOptions>
+            <linkerStartOption></linkerStartOption>
+          </linkerStartOptions>
+          
+          
+        </configuration>
+        
+      </plugin>
+
+    </plugins>    
+
+  </build>
+  
+
+</project>

Propchange: incubator/kato/trunk/org.apache.kato.native/kato.native.cjvmti/win32/ExeDynamic/pom.xml
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: incubator/kato/trunk/org.apache.kato.native/kato.native.cjvmti/win32/ExeStatic/pom.xml
URL: http://svn.apache.org/viewvc/incubator/kato/trunk/org.apache.kato.native/kato.native.cjvmti/win32/ExeStatic/pom.xml?rev=811719&view=auto
==============================================================================
--- incubator/kato/trunk/org.apache.kato.native/kato.native.cjvmti/win32/ExeStatic/pom.xml (added)
+++ incubator/kato/trunk/org.apache.kato.native/kato.native.cjvmti/win32/ExeStatic/pom.xml Sat Sep  5 21:57:13 2009
@@ -0,0 +1,69 @@
+<project>
+
+  <modelVersion>4.0.0</modelVersion>
+
+  <parent>
+    <groupId>org.codehaus.mojo.natives.it.linkages.win32</groupId>
+    <artifactId>win32</artifactId>
+    <version>1.0-SNAPSHOT</version>
+  </parent>
+
+  <artifactId>ExeStatic</artifactId>
+  
+  <name>ExeStatic.exe</name>
+  
+  <packaging>exe</packaging>
+  
+  <dependencies>
+    <dependency>
+       <groupId>org.codehaus.mojo.natives.it.linkages.win32</groupId>
+       <artifactId>SubFuncStatic</artifactId>
+       <type>lib</type>
+       <version>${project.version}</version>
+    </dependency>
+    <dependency>
+       <groupId>org.codehaus.mojo.natives.it.linkages.win32</groupId>
+       <artifactId>FuncStatic</artifactId>
+       <type>lib</type>
+       <version>${project.version}</version>
+    </dependency>
+  </dependencies>
+  
+  
+  <build>
+    <plugins>
+      <plugin>
+        <groupId>org.codehaus.mojo</groupId>
+        <artifactId>native-maven-plugin</artifactId>
+        <configuration>
+          <compilerStartOptions>
+            <compilerStartOption>${commonCompilerOptions}</compilerStartOption>
+          </compilerStartOptions>
+          
+          <sources>
+            <source>
+              <directory>${native.source.dir}</directory>
+              <fileNames>
+                <fileName>hello.c</fileName>
+              </fileNames>
+            </source>  
+            <source>
+              <directory>${native.source.dir}/include</directory>
+            </source>            
+          </sources>
+            
+          <linkerStartOptions>
+            <linkerStartOption></linkerStartOption>
+          </linkerStartOptions>
+          
+          
+        </configuration>
+        
+      </plugin>
+
+    </plugins>    
+
+  </build>
+  
+
+</project>

Propchange: incubator/kato/trunk/org.apache.kato.native/kato.native.cjvmti/win32/ExeStatic/pom.xml
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: incubator/kato/trunk/org.apache.kato.native/kato.native.cjvmti/win32/FuncDynamic/pom.xml
URL: http://svn.apache.org/viewvc/incubator/kato/trunk/org.apache.kato.native/kato.native.cjvmti/win32/FuncDynamic/pom.xml?rev=811719&view=auto
==============================================================================
--- incubator/kato/trunk/org.apache.kato.native/kato.native.cjvmti/win32/FuncDynamic/pom.xml (added)
+++ incubator/kato/trunk/org.apache.kato.native/kato.native.cjvmti/win32/FuncDynamic/pom.xml Sat Sep  5 21:57:13 2009
@@ -0,0 +1,66 @@
+<project>
+
+  <modelVersion>4.0.0</modelVersion>
+
+  <parent>
+    <groupId>org.codehaus.mojo.natives.it.linkages.win32</groupId>
+    <artifactId>win32</artifactId>
+    <version>1.0-SNAPSHOT</version>
+  </parent>
+
+  <artifactId>FuncDynamic</artifactId>
+  
+  <name>FuncDynamic.dll</name>
+  
+  <packaging>dll</packaging>
+  
+  
+  <dependencies>
+    <dependency>
+       <groupId>org.codehaus.mojo.natives.it.linkages.win32</groupId>
+       <artifactId>SubFuncDynamic</artifactId>
+       <type>lib</type>
+       <version>${project.version}</version>
+    </dependency>
+  </dependencies>
+  
+  
+  <build>
+    <plugins>
+      <plugin>
+        <groupId>org.codehaus.mojo</groupId>
+        <artifactId>native-maven-plugin</artifactId>
+        <configuration>
+          <compilerStartOptions>
+            <compilerStartOption>${commonCompilerOptions} /DBUILD_DLL</compilerStartOption>
+          </compilerStartOptions>
+          
+          <sources>
+            <source>
+              <directory>${native.source.dir}</directory>
+              <fileNames>
+                <fileName>helloFunc.c</fileName>
+              </fileNames>
+            </source>  
+            <source>
+              <directory>${native.source.dir}/include</directory>
+            </source>            
+          </sources>
+            
+          <linkerStartOptions>
+            <linkerStartOption>/DLL</linkerStartOption>
+          </linkerStartOptions>
+          
+          <linkerSecondaryOutputExtensions >lib</linkerSecondaryOutputExtensions >
+          
+          
+        </configuration>
+        
+      </plugin>
+
+    </plugins>    
+
+  </build>
+  
+
+</project>

Propchange: incubator/kato/trunk/org.apache.kato.native/kato.native.cjvmti/win32/FuncDynamic/pom.xml
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: incubator/kato/trunk/org.apache.kato.native/kato.native.cjvmti/win32/FuncStatic/pom.xml
URL: http://svn.apache.org/viewvc/incubator/kato/trunk/org.apache.kato.native/kato.native.cjvmti/win32/FuncStatic/pom.xml?rev=811719&view=auto
==============================================================================
--- incubator/kato/trunk/org.apache.kato.native/kato.native.cjvmti/win32/FuncStatic/pom.xml (added)
+++ incubator/kato/trunk/org.apache.kato.native/kato.native.cjvmti/win32/FuncStatic/pom.xml Sat Sep  5 21:57:13 2009
@@ -0,0 +1,54 @@
+<project>
+
+  <modelVersion>4.0.0</modelVersion>
+
+  <parent>
+    <groupId>org.codehaus.mojo.natives.it.linkages.win32</groupId>
+    <artifactId>win32</artifactId>
+    <version>1.0-SNAPSHOT</version>
+  </parent>
+
+  <artifactId>FuncStatic</artifactId>
+  
+  <name>FuncStatic.lib</name>
+  
+  <packaging>lib</packaging>
+  
+  
+  <build>
+    <plugins>
+      <plugin>
+        <groupId>org.codehaus.mojo</groupId>
+        <artifactId>native-maven-plugin</artifactId>
+        <configuration>
+          <compilerStartOptions>
+            <compilerStartOption>${commonCompilerOptions}</compilerStartOption>
+          </compilerStartOptions>
+          
+          <sources>
+            <source>
+              <directory>${native.source.dir}</directory>
+              <fileNames>
+                <fileName>helloFunc.c</fileName>
+              </fileNames>
+            </source>  
+            <source>
+              <directory>${native.source.dir}/include</directory>
+            </source>            
+          </sources>
+            
+          <linkerStartOptions>
+            <linkerStartOption>/LIB</linkerStartOption>
+          </linkerStartOptions>
+          
+          
+        </configuration>
+        
+      </plugin>
+
+    </plugins>    
+
+  </build>
+  
+
+</project>

Propchange: incubator/kato/trunk/org.apache.kato.native/kato.native.cjvmti/win32/FuncStatic/pom.xml
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: incubator/kato/trunk/org.apache.kato.native/kato.native.cjvmti/win32/SubFuncDynamic/pom.xml
URL: http://svn.apache.org/viewvc/incubator/kato/trunk/org.apache.kato.native/kato.native.cjvmti/win32/SubFuncDynamic/pom.xml?rev=811719&view=auto
==============================================================================
--- incubator/kato/trunk/org.apache.kato.native/kato.native.cjvmti/win32/SubFuncDynamic/pom.xml (added)
+++ incubator/kato/trunk/org.apache.kato.native/kato.native.cjvmti/win32/SubFuncDynamic/pom.xml Sat Sep  5 21:57:13 2009
@@ -0,0 +1,56 @@
+<project>
+
+  <modelVersion>4.0.0</modelVersion>
+
+  <parent>
+    <groupId>org.codehaus.mojo.natives.it.linkages.win32</groupId>
+    <artifactId>win32</artifactId>
+    <version>1.0-SNAPSHOT</version>
+  </parent>
+
+  <artifactId>SubFuncDynamic</artifactId>
+  
+  <name>SubFuncDynamic.dll</name>
+  
+  <packaging>dll</packaging>
+  
+  
+  <build>
+    <plugins>
+      <plugin>
+        <groupId>org.codehaus.mojo</groupId>
+        <artifactId>native-maven-plugin</artifactId>
+        <configuration>
+          <compilerStartOptions>
+            <compilerStartOption>${commonCompilerOptions} /DBUILD_DLL</compilerStartOption>
+          </compilerStartOptions>
+          
+          <sources>
+            <source>
+              <directory>${native.source.dir}</directory>
+              <fileNames>
+                <fileName>helloSubFunc.c</fileName>
+              </fileNames>
+            </source>  
+            <source>
+              <directory>${native.source.dir}/include</directory>
+            </source>            
+          </sources>
+            
+          <linkerStartOptions>
+            <linkerStartOption>/INCREMENTAL:NO /DLL /RELEASE</linkerStartOption>
+          </linkerStartOptions>
+          
+          <linkerSecondaryOutputExtensions >lib</linkerSecondaryOutputExtensions>
+          
+          
+        </configuration>
+        
+      </plugin>
+
+    </plugins>    
+
+  </build>
+  
+
+</project>

Propchange: incubator/kato/trunk/org.apache.kato.native/kato.native.cjvmti/win32/SubFuncDynamic/pom.xml
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: incubator/kato/trunk/org.apache.kato.native/kato.native.cjvmti/win32/SubFuncStatic/pom.xml
URL: http://svn.apache.org/viewvc/incubator/kato/trunk/org.apache.kato.native/kato.native.cjvmti/win32/SubFuncStatic/pom.xml?rev=811719&view=auto
==============================================================================
--- incubator/kato/trunk/org.apache.kato.native/kato.native.cjvmti/win32/SubFuncStatic/pom.xml (added)
+++ incubator/kato/trunk/org.apache.kato.native/kato.native.cjvmti/win32/SubFuncStatic/pom.xml Sat Sep  5 21:57:13 2009
@@ -0,0 +1,54 @@
+<project>
+
+  <modelVersion>4.0.0</modelVersion>
+
+  <parent>
+    <groupId>org.codehaus.mojo.natives.it.linkages.win32</groupId>
+    <artifactId>win32</artifactId>
+    <version>1.0-SNAPSHOT</version>
+  </parent>
+
+  <artifactId>SubFuncStatic</artifactId>
+  
+  <name>SubFuncStatic.lib</name>
+  
+  <packaging>lib</packaging>
+  
+  
+  <build>
+    <plugins>
+      <plugin>
+        <groupId>org.codehaus.mojo</groupId>
+        <artifactId>native-maven-plugin</artifactId>
+        <configuration>
+          <compilerStartOptions>
+            <compilerStartOption>${commonCompilerOptions}</compilerStartOption>
+          </compilerStartOptions>
+          
+          <sources>
+            <source>
+              <directory>${native.source.dir}</directory>
+              <fileNames>
+                <fileName>helloSubFunc.c</fileName>
+              </fileNames>
+            </source>  
+            <source>
+              <directory>${native.source.dir}/include</directory>
+            </source>            
+          </sources>
+            
+          <linkerStartOptions>
+            <linkerStartOption>/LIB</linkerStartOption>
+          </linkerStartOptions>
+          
+          
+        </configuration>
+        
+      </plugin>
+
+    </plugins>    
+
+  </build>
+  
+
+</project>

Propchange: incubator/kato/trunk/org.apache.kato.native/kato.native.cjvmti/win32/SubFuncStatic/pom.xml
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: incubator/kato/trunk/org.apache.kato.native/kato.native.cjvmti/win32/pom.xml
URL: http://svn.apache.org/viewvc/incubator/kato/trunk/org.apache.kato.native/kato.native.cjvmti/win32/pom.xml?rev=811719&view=auto
==============================================================================
--- incubator/kato/trunk/org.apache.kato.native/kato.native.cjvmti/win32/pom.xml (added)
+++ incubator/kato/trunk/org.apache.kato.native/kato.native.cjvmti/win32/pom.xml Sat Sep  5 21:57:13 2009
@@ -0,0 +1,48 @@
+<project>
+
+  <modelVersion>4.0.0</modelVersion>
+
+  <parent>
+    <groupId>org.codehaus.mojo.natives.it.linkages</groupId>
+    <artifactId>linkages</artifactId>
+    <version>1.0-SNAPSHOT</version>
+  </parent>
+
+  <groupId>org.codehaus.mojo.natives.it.linkages.win32</groupId>
+  <artifactId>win32</artifactId>
+  
+  <name>Win32 Root Pom</name>
+  
+  <packaging>pom</packaging>
+  
+  
+  <build>
+    
+    <plugins>
+      <!-- share configuration to all win32 artifact -->
+      <plugin>
+        <groupId>org.codehaus.mojo</groupId>
+        <artifactId>native-maven-plugin</artifactId>
+        <extensions>true</extensions>   
+        <configuration>
+          <compilerProvider>msvc</compilerProvider>
+          <envFactoryName>org.codehaus.mojo.natives.msvc.MSVC2003EnvFactory</envFactoryName>
+        </configuration>
+      </plugin>
+    </plugins>
+  </build>
+
+  <properties>
+    <commonCompilerOptions>/MD /W4 -O</commonCompilerOptions>
+  </properties>
+    
+  <modules>
+    <!-- unorder modules to demonstrate maven can handle build sequence correctly -->
+    <module>ExeStatic</module>
+    <module>ExeDynamic</module>
+    <module>FuncStatic</module>
+    <module>SubFuncStatic</module>
+    <module>SubFuncDynamic</module>
+    <module>FuncDynamic</module>
+  </modules>
+</project>

Propchange: incubator/kato/trunk/org.apache.kato.native/kato.native.cjvmti/win32/pom.xml
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: incubator/kato/trunk/org.apache.kato.native/pom.xml
URL: http://svn.apache.org/viewvc/incubator/kato/trunk/org.apache.kato.native/pom.xml?rev=811719&r1=811718&r2=811719&view=diff
==============================================================================
--- incubator/kato/trunk/org.apache.kato.native/pom.xml (original)
+++ incubator/kato/trunk/org.apache.kato.native/pom.xml Sat Sep  5 21:57:13 2009
@@ -13,5 +13,6 @@
   <description>Apache Kato native code modules	</description>
   <modules>
   	<module>kato.native.pyjvmti</module>
+  	<module>kato.native.cjvmti</module>
   </modules>
 </project>
\ No newline at end of file