- the heap
- additional support functions
- $Id: tables.c 1240 2004-06-30 20:07:25Z twisti $
+ $Id: tables.c 1482 2004-11-11 14:39:13Z twisti $
*/
#include <sys/types.h>
#include <sys/mman.h>
#include <unistd.h>
+#include "builtin.h"
+#include "exceptions.h"
#include "types.h"
+#include "native.h"
#include "options.h"
#include "tables.h"
#include "loader.h"
write utf symbol to stdout (debugging purposes)
-******************************************************************************/
+*******************************************************************************/
void utf_display(utf *u)
{
- char *endpos = utf_end(u); /* points behind utf string */
- char *utf_ptr = u->text; /* current position in utf text */
+ char *endpos; /* points behind utf string */
+ char *utf_ptr; /* current position in utf text */
- if (!u)
+ if (!u) {
+ printf("NULL");
+ fflush(stdout);
return;
+ }
+
+ endpos = utf_end(u);
+ utf_ptr = u->text;
while (utf_ptr < endpos) {
/* read next unicode character */
}
-/********************* function: utf_display *********************************
+/* utf_display_classname *******************************************************
- write utf symbol to stdout (debugging purposes)
+ write utf symbol to stdout (debugging purposes)
-******************************************************************************/
+*******************************************************************************/
void utf_display_classname(utf *u)
{
- char *endpos = utf_end(u); /* points behind utf string */
- char *utf_ptr = u->text; /* current position in utf text */
+ char *endpos; /* points behind utf string */
+ char *utf_ptr; /* current position in utf text */
- if (!u)
+ if (!u) {
+ printf("NULL");
+ fflush(stdout);
return;
+ }
+
+ endpos = utf_end(u);
+ utf_ptr = u->text;
while (utf_ptr < endpos) {
/* read next unicode character */
}
-/************************ function: utf_sprint *******************************
+/* utf_sprint ******************************************************************
- write utf symbol into c-string (debugging purposes)
+ write utf symbol into c-string (debugging purposes)
-******************************************************************************/
+*******************************************************************************/
void utf_sprint(char *buffer, utf *u)
{
- char *endpos = utf_end(u); /* points behind utf string */
- char *utf_ptr = u->text; /* current position in utf text */
- u2 pos = 0; /* position in c-string */
+ char *endpos; /* points behind utf string */
+ char *utf_ptr; /* current position in utf text */
+ u2 pos = 0; /* position in c-string */
+
+ if (!u) {
+ memcpy(buffer, "NULL", 5); /* 4 chars + terminating \0 */
+ return;
+ }
+
+ endpos = utf_end(u);
+ utf_ptr = u->text;
while (utf_ptr < endpos)
/* copy next unicode character */
}
-/************************ function: utf_sprint_classname *********************
+/* utf_sprint_classname ********************************************************
- write utf symbol into c-string (debugging purposes)
+ write utf symbol into c-string (debugging purposes)
-******************************************************************************/
+*******************************************************************************/
void utf_sprint_classname(char *buffer, utf *u)
{
- char *endpos = utf_end(u); /* points behind utf string */
- char *utf_ptr = u->text; /* current position in utf text */
- u2 pos = 0; /* position in c-string */
+ char *endpos; /* points behind utf string */
+ char *utf_ptr; /* current position in utf text */
+ u2 pos = 0; /* position in c-string */
+
+ if (!u) {
+ memcpy(buffer, "NULL", 5); /* 4 chars + terminating \0 */
+ return;
+ }
+
+ endpos = utf_end(u);
+ utf_ptr = u->text;
while (utf_ptr < endpos) {
/* copy next unicode character */
}
}
}
+#if defined(USE_THREADS) && defined(NATIVE_THREADS)
+ initObjectLock(&c->header);
+#endif
return c;
}
u4 utf_strlen(utf *u)
{
- char *endpos = utf_end(u); /* points behind utf string */
- char *utf_ptr = u->text; /* current position in utf text */
- u4 len = 0; /* number of unicode characters */
+ char *endpos; /* points behind utf string */
+ char *utf_ptr; /* current position in utf text */
+ u4 len = 0; /* number of unicode characters */
+
+ if (!u) {
+ *exceptionptr = new_nullpointerexception();
+ return 0;
+ }
+
+ endpos = utf_end(u);
+ utf_ptr = u->text;
while (utf_ptr < endpos) {
len++;