[kaffe] CVS kaffe (riccardo): added missing includes
Kaffe CVS
cvs-commits at kaffe.org
Thu Aug 18 17:44:07 PDT 2005
PatchSet 6842
Date: 2005/08/19 00:38:28
Author: riccardo
Branch: HEAD
Tag: (none)
Log:
added missing includes
Members:
ChangeLog:1.4365->1.4366
kaffe/kaffevm/access.c:1.11->1.12
kaffe/kaffevm/file.c:INITIAL->1.3
kaffe/kaffevm/jni/jni-arrays.c:1.10->1.11
kaffe/kaffevm/systems/unix-pthreads/thread-impl.c:1.87->1.88
kaffe/kaffevm/verifier/verify-block.c:1.24->1.25
kaffe/kaffevm/verifier/verify.c:1.14->1.15
kaffe/kaffevm/verifier/verify2.c:1.5->1.6
kaffe/kaffevm/verifier/verify3a.c:1.3->1.4
libraries/clib/native/String.c:1.17->1.18
Index: kaffe/ChangeLog
diff -u kaffe/ChangeLog:1.4365 kaffe/ChangeLog:1.4366
--- kaffe/ChangeLog:1.4365 Thu Aug 18 22:49:18 2005
+++ kaffe/ChangeLog Fri Aug 19 00:38:28 2005
@@ -1,4 +1,17 @@
2005-08-18 Riccardo Mottola <riccardo at kaffe.org>
+ Added missing includes to:
+ kaffe/kaffevm/access.c
+ kaffe/kaffevm/file.c
+ kaffe/kaffevm/jni/jni-arrays.c
+ kaffe/kaffevm/systems/unix-pthreads/thread-impl.c
+ kaffe/kaffevm/verifier/verify-block.c
+ kaffe/kaffevm/verifier/verify.c
+ kaffe/kaffevm/verifier/verify2.c
+ kaffe/kaffevm/verifier/verify3a.c
+ libraries/clib/native/String.c
+
+
+2005-08-18 Riccardo Mottola <riccardo at kaffe.org>
Rationalized includes by decentralizing them to the .c files
config/config-std.h
Index: kaffe/kaffe/kaffevm/access.c
diff -u kaffe/kaffe/kaffevm/access.c:1.11 kaffe/kaffe/kaffevm/access.c:1.12
--- kaffe/kaffe/kaffevm/access.c:1.11 Thu Aug 18 15:07:03 2005
+++ kaffe/kaffe/kaffevm/access.c Fri Aug 19 00:38:31 2005
@@ -33,6 +33,10 @@
#include <sys/resource.h>
#endif
+#ifdef HAVE_STRING_H
+#include <string.h>
+#endif
+
#include "gtypes.h"
#include "exception.h"
#include "errors.h"
===================================================================
Checking out kaffe/kaffe/kaffevm/file.c
RCS: /home/cvs/kaffe/kaffe/kaffe/kaffevm/file.c,v
VERS: 1.3
***************
--- /dev/null Sun Aug 4 19:57:58 2002
+++ kaffe/kaffe/kaffevm/file.c Fri Aug 19 00:44:07 2005
@@ -0,0 +1,139 @@
+/*
+ * file.c
+ * File support routines.
+ *
+ * Copyright (c) 1996, 1997
+ * Transvirtual Technologies, Inc. All rights reserved.
+ *
+ * Copyright (c) 2004, 2005
+ * Kaffe.org contributors. See ChangeLog for details. All rights reserved.
+ *
+ * See the file "license.terms" for information on usage and redistribution
+ * of this file.
+ */
+
+/*
+ * Used in kaffeh and kaffevm
+ *
+ * XXX rename to classFileHandle.h ?
+ */
+#include "config.h"
+#include "config-std.h"
+
+#ifdef HAVE_STRING_H
+#include <string.h>
+#endif
+
+#include "gtypes.h"
+#include "errors.h"
+#include "file.h"
+
+/*
+ * Init a a classFile struct to point to the given buffer.
+ */
+void
+classFileInit(classFile* cf,
+ unsigned char* mem,
+ const unsigned char* buf,
+ size_t len,
+ ClassFileType cft)
+{
+ assert (((buf == NULL) && (len == 0))
+ || ((buf != NULL) && (len != 0)));
+
+ cf->mem = mem;
+ cf->base = cf->cur = buf;
+ cf->size = len;
+ cf->type = cft;
+}
+
+/*
+ * Check that the needed number of bytes are available. If
+ * not a ClassFormatError is posted in einfo.
+ */
+bool
+checkBufSize(classFile* cf, u4 need, const char* cfname, errorInfo* einfo)
+{
+ assert(cf != NULL);
+ assert(cf->type != CP_INVALID);
+
+ if ((unsigned)(cf->base + cf->size - cf->cur) < need)
+ {
+ if (cfname != NULL)
+ postExceptionMessage(einfo,
+ JAVA_LANG(ClassFormatError),
+ "%s class file truncated",
+ cfname);
+ else
+ postExceptionMessage(einfo,
+ JAVA_LANG(ClassFormatError),
+ "Truncated class file");
+
+ return false;
+ }
+
+ return true;
+}
+
+/* Read a single unsigned byte from cf */
+void
+readu1(u1* c, classFile* cf)
+{
+ assert(c != NULL);
+ assert(cf != NULL);
+ assert(cf->type != CP_INVALID);
+
+ *c = cf->cur[0];
+ cf->cur += 1;
+}
+
+/* Read a pair of unsigned bytes from cf */
+void
+readu2(u2* c, classFile* cf)
+{
+ assert(c != NULL);
+ assert(cf != NULL);
+ assert(cf->type != CP_INVALID);
+
+ *c = (((u2) cf->cur[0]) << 8) | ((u2) cf->cur[1]);
+ cf->cur += 2;
+}
+
+/* Read a four-byte unsigned word of unsigned bytes from cf */
+void
+readu4(u4* c, classFile* cf)
+{
+ assert(c != NULL);
+ assert(cf != NULL);
+ assert(cf->type != CP_INVALID);
+
+ *c = (((u4) cf->cur[0]) << 24)
+ | (((u4) cf->cur[1]) << 16)
+ | (((u4) cf->cur[2]) << 8)
+ | ((u4) cf->cur[3]);
+ cf->cur += 4;
+}
+
+/**
+ * Read len*size bytes out of the classfile, and into dest.
+ */
+void
+readm(void* dest, size_t len, size_t size, classFile* cf)
+{
+ assert(dest != NULL);
+ assert(cf != NULL);
+ assert(cf->type != CP_INVALID);
+
+ memcpy(dest, cf->cur, len*size);
+ cf->cur += len*size;
+}
+
+/* Skip over an arbitrary chunk of cf */
+void
+seekm(classFile* cf, size_t len)
+{
+ assert(cf != NULL);
+ assert(cf->type != CP_INVALID);
+
+ cf->cur += len;
+}
Index: kaffe/kaffe/kaffevm/jni/jni-arrays.c
diff -u kaffe/kaffe/kaffevm/jni/jni-arrays.c:1.10 kaffe/kaffe/kaffevm/jni/jni-arrays.c:1.11
--- kaffe/kaffe/kaffevm/jni/jni-arrays.c:1.10 Thu Aug 18 22:31:31 2005
+++ kaffe/kaffe/kaffevm/jni/jni-arrays.c Fri Aug 19 00:38:31 2005
@@ -5,7 +5,7 @@
* Copyright (c) 1996, 1997
* Transvirtual Technologies, Inc. All rights reserved.
*
- * Copyright (c) 2004
+ * Copyright (c) 2004, 2005
* The Kaffe.org's developers. See ChangeLog for details.
*
* See the file "license.terms" for information on usage and redistribution
@@ -13,6 +13,11 @@
*/
#include "config.h"
+
+#ifdef HAVE_STRING_H
+#include <string.h>
+#endif
+
#include "jni_i.h"
#include "jni.h"
#include "jni_funcs.h"
Index: kaffe/kaffe/kaffevm/systems/unix-pthreads/thread-impl.c
diff -u kaffe/kaffe/kaffevm/systems/unix-pthreads/thread-impl.c:1.87 kaffe/kaffe/kaffevm/systems/unix-pthreads/thread-impl.c:1.88
--- kaffe/kaffe/kaffevm/systems/unix-pthreads/thread-impl.c:1.87 Sat Aug 13 23:37:22 2005
+++ kaffe/kaffe/kaffevm/systems/unix-pthreads/thread-impl.c Fri Aug 19 00:38:32 2005
@@ -21,6 +21,22 @@
#include "config-setjmp.h"
#include "config-io.h"
+#ifdef HAVE_STRING_H
+#include <string.h>
+#endif
+
+#ifdef HAVE_SYS_TYPES_H
+#include <sys/types.h>
+#endif
+
+#ifdef HAVE_SYS_TIME_H
+#include <sys/time.h>
+#endif
+
+#ifdef HAVE_SYS_RESOURCE_H
+#include <sys/resource.h>
+#endif
+
#include "locks.h"
#include "thread-impl.h"
#include "debug.h"
Index: kaffe/kaffe/kaffevm/verifier/verify-block.c
diff -u kaffe/kaffe/kaffevm/verifier/verify-block.c:1.24 kaffe/kaffe/kaffevm/verifier/verify-block.c:1.25
--- kaffe/kaffe/kaffevm/verifier/verify-block.c:1.24 Mon May 30 09:24:02 2005
+++ kaffe/kaffe/kaffevm/verifier/verify-block.c Fri Aug 19 00:38:34 2005
@@ -1,7 +1,8 @@
+
/*
* verify-block.c
*
- * Copyright 2004
+ * Copyright 2004, 2005
* Kaffe.org contributors. See ChangeLog for details. All rights reserved.
*
* See the file "license.terms" for information on usage and redistribution
@@ -9,6 +10,12 @@
*
* Code for handing of blocks in the verifier.
*/
+
+#include "config.h"
+
+#ifdef HAVE_STRING_H
+#include <string.h>
+#endif
#include "bytecode.h"
#include "baseClasses.h"
Index: kaffe/kaffe/kaffevm/verifier/verify.c
diff -u kaffe/kaffe/kaffevm/verifier/verify.c:1.14 kaffe/kaffe/kaffevm/verifier/verify.c:1.15
--- kaffe/kaffe/kaffevm/verifier/verify.c:1.14 Sun Mar 13 17:20:03 2005
+++ kaffe/kaffe/kaffevm/verifier/verify.c Fri Aug 19 00:38:34 2005
@@ -1,7 +1,7 @@
/*
* verify.c
*
- * Copyright 2004
+ * Copyright 2004, 2005
* Kaffe.org contributors. See ChangeLog for details. All rights reserved.
*
* See the file "license.terms" for information on usage and redistribution
@@ -20,11 +20,16 @@
* verify3().
*/
+#include "config.h"
+#include "config-std.h"
+
+#ifdef HAVE_STRING_H
+#include <string.h>
+#endif
+
#include "baseClasses.h"
#include "bytecode.h"
#include "code.h"
-#include "config.h"
-#include "config-std.h"
#include "constants.h"
#include "classMethod.h"
#include "debug.h"
Index: kaffe/kaffe/kaffevm/verifier/verify2.c
diff -u kaffe/kaffe/kaffevm/verifier/verify2.c:1.5 kaffe/kaffe/kaffevm/verifier/verify2.c:1.6
--- kaffe/kaffe/kaffevm/verifier/verify2.c:1.5 Thu Mar 31 10:39:29 2005
+++ kaffe/kaffe/kaffevm/verifier/verify2.c Fri Aug 19 00:38:34 2005
@@ -1,7 +1,7 @@
/*
* verify2.c
*
- * Copyright 2004
+ * Copyright 2004, 2005
* Kaffe.org contributors. See ChangeLog for details. All rights reserved.
*
* See the file "license.terms" for information on usage and redistribution
@@ -14,6 +14,12 @@
* so questions regarding pass 2 should be sent to:
* Rob Gonzalez <rob at kaffe.org>
*/
+
+#include "config.h"
+
+#ifdef HAVE_STRING_H
+#include <string.h>
+#endif
#include "access.h"
#include "baseClasses.h"
Index: kaffe/kaffe/kaffevm/verifier/verify3a.c
diff -u kaffe/kaffe/kaffevm/verifier/verify3a.c:1.3 kaffe/kaffe/kaffevm/verifier/verify3a.c:1.4
--- kaffe/kaffe/kaffevm/verifier/verify3a.c:1.3 Fri Oct 22 23:18:03 2004
+++ kaffe/kaffe/kaffevm/verifier/verify3a.c Fri Aug 19 00:38:34 2005
@@ -12,6 +12,12 @@
* verification of static constaints.
*/
+#include "config.h"
+
+#ifdef HAVE_STRING_H
+#include <string.h>
+#endif
+
#include "baseClasses.h"
#include "bytecode.h"
#include "classMethod.h"
Index: kaffe/libraries/clib/native/String.c
diff -u kaffe/libraries/clib/native/String.c:1.17 kaffe/libraries/clib/native/String.c:1.18
--- kaffe/libraries/clib/native/String.c:1.17 Sat May 28 13:41:53 2005
+++ kaffe/libraries/clib/native/String.c Fri Aug 19 00:38:34 2005
@@ -4,13 +4,21 @@
* Copyright (c) 1996, 1997
* Transvirtual Technologies, Inc. All rights reserved.
*
+ * Copyright (c) 2005
+ * Kaffe.org contributors. See ChangeLog for details.
+ * All rights reserved.
+ 8
* See the file "license.terms" for information on usage and redistribution
* of this file.
*/
#include "config.h"
#include "config-std.h"
-#include "config-std.h"
+
+#ifdef HAVE_STRING_H
+#include <string.h>
+#endif
+
#include "stringSupport.h"
#include "java_lang_String.h"
More information about the kaffe
mailing list