Re: intern stuff checked in on a branch

Date view Thread view Subject view Author view

From: Godmar Back (gback@cs.utah.edu)
Date: Sun Dec 20 1998 - 23:18:02 EST


About names:

How about instead of this:

---------------------------------------------------------------------------
i)
Hjava_lang_String* stringC2Java(const char*);
Hjava_lang_String* stringCharArray2Java(const jchar*, int);
Hjava_lang_String* stringCharArray2JavaInterned(const jchar *, int);
Hjava_lang_String* stringUtf82Java(const Utf8Const*);
Hjava_lang_String* stringUtf82JavaReplace(const Utf8Const *,...);
ii)
char* stringJava2C(const Hjava_lang_String*);
char* stringJava2CBuf(const Hjava_lang_String*, char*, int);
Hjava_lang_String* stringInternString(Hjava_lang_String*);
void stringUninternString(Hjava_lang_String*);
iii)
HArrayOfChar* stringC2CharArray(const char*);
iv)
Utf8Const* utf8ConstNew(const char*, int);
Utf8Const* utf8ConstNewFixed(const char*, int);
v)
jint utf8ConstHashValue(Utf8Const*);
void utf8ConstDestroy(const Utf8Const*);
int utf8ConstUniLength(const Utf8Const*);
void utf8ConstDecode(const Utf8Const*, jchar*);
int utf8ConstEqualJavaString(const Utf8Const*,

---------------------------------------------------------------------------
This instead:
i)
Hjava_lang_String* createJavaStringFromC(const char*);
Hjava_lang_String* createJavaStringFromCharArray(const jchar*, int);
Hjava_lang_String* createJavaStringFromCharArrayInterned(const jchar *, int);
Hjava_lang_String* createJavaStringFromUtf8(const Utf8Const*);
Hjava_lang_String* createJavaStringFromUtf8Replace(const Utf8Const *,...);
ii)
char* javaString2C(const Hjava_lang_String*);
char* javaString2CBuf(const Hjava_lang_String*, char*, int);
Hjava_lang_String* javaStringIntern(Hjava_lang_String*);
void javaStringUnintern(Hjava_lang_String*);
iii)
HArrayOfChar* createCharArrayFromC(const char*);
iv)
Utf8Const* createUtf8ConstFromC(const char*, int);
Utf8Const* createUtf8ConstFromCFixed(const char*, int);
v)
jint utf8ConstHashValue(Utf8Const*);
void utf8ConstDestroy(const Utf8Const*);
int utf8ConstUniLength(const Utf8Const*);
void utf8ConstDecode(const Utf8Const*, jchar*);
int utf8ConstEqualJavaString(const Utf8Const*, ...)
---------------------------------------------------------------------------

Where the functions are subdivided in five groups:
i) functions that create a Hjava_lang_String: signature is
        Hjava_lang_String* createXXX(...)

ii) function that operate on strings.
        ... javaStringXXX(Hjava_lang_String* this, ...)

iii) This method does not belong to javaString. Maybe move it to support?

iv) functions that create a Utf8Const, signature is
        Utf8Const* createUtf8ConstXXX(...)

v) functions that operate on Utf8Const's, signature is
        ... utf8ConstXXX(Utf8Const*, ...)

Of course, you could replace "javaString/JavaString" with "string/String"
if you wanted to. Although there's a danger that the strings are mistaken
for C string.

So, can you describe in one paragraph or less what the purpose of
these fake utf8Const is?
Also, we should probably add some diagnostics to see just how much
memory we save.

        - Godmar


Date view Thread view Subject view Author view

This archive was generated by hypermail 2b29 : Sat Sep 23 2000 - 19:57:26 EDT