gzz-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Gzz-commits] gzz metacode/pegboard.py gfx/jni/GzzGL-jni.cxx ...


From: Asko Soukka
Subject: [Gzz-commits] gzz metacode/pegboard.py gfx/jni/GzzGL-jni.cxx ...
Date: Wed, 13 Nov 2002 06:21:57 -0500

CVSROOT:        /cvsroot/gzz
Module name:    gzz
Changes by:     Asko Soukka <address@hidden>    02/11/13 06:21:53

Modified files:
        metacode       : pegboard.py 
        gfx/jni        : GzzGL-jni.cxx 
        test/gzz/gfx/jni: jnistrconv.test 
        .              : TODO 

Log message:
        Pegboard: topic link fix, other: forgotten test for jni string 
conversion, if it does not fail with Benja's JVM, the non-null-string bug is 
propably still open.

CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/metacode/pegboard.py.diff?tr1=1.16&tr2=1.17&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gfx/jni/GzzGL-jni.cxx.diff?tr1=1.61&tr2=1.62&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/test/gzz/gfx/jni/jnistrconv.test.diff?tr1=1.7&tr2=1.8&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/TODO.diff?tr1=1.391&tr2=1.392&r1=text&r2=text

Patches:
Index: gzz/TODO
diff -u gzz/TODO:1.391 gzz/TODO:1.392
--- gzz/TODO:1.391      Tue Nov 12 11:58:17 2002
+++ gzz/TODO    Wed Nov 13 06:21:53 2002
@@ -201,9 +201,6 @@
        + port Mind* views from 0.6
            - make LollipopCellVobFactory use fixed dimensions for ball
        + new PEG for bubbleview, with some sketches
-       + failing test to detect utf8 string non-null end bug found by Benja
-           - std::basic_string <unsigned short> is somehow not valid
-              anymore (type unknown to std::char_traits) needs a new approach
        + better algorithm for CullingCoordSys. Uses now parallel
           bounding boxes. Fast, but not very efficient.
        + implement Paper TexGenEmboss::setUp_explicit
Index: gzz/gfx/jni/GzzGL-jni.cxx
diff -u gzz/gfx/jni/GzzGL-jni.cxx:1.61 gzz/gfx/jni/GzzGL-jni.cxx:1.62
--- gzz/gfx/jni/GzzGL-jni.cxx:1.61      Tue Nov 12 11:53:03 2002
+++ gzz/gfx/jni/GzzGL-jni.cxx   Wed Nov 13 06:21:53 2002
@@ -1,4 +1,5 @@
 
+#include <cstring>
 #include <vector>
 #include "gzz_gfx_gl_GL.h"
 
@@ -103,17 +104,89 @@
 jstring stdstr2jstr(JNIEnv *env, std::string stdstr) {
   return env->NewStringUTF(stdstr.c_str());
 }
+
 /** Converts jstring to unistring _without_ asking
  * string length from JNIEnv. This could have been
- * the non-null-string bug, Benja founded. Although, 
- * std::basic_string <unsigned short> doesn't seem
- * to be valid anymore: "undefined symbol:
- * std::char_traits<unsigned short>::length(unsigned short const*)"
+ * the non-null-string bug, Benja founded.
  *
  * Anyway, these can be dropped, when cleaning Gzz-Gl-jni
  * and this is considered to be irrelevant.
  */
-/*
+/** And this specialization of char_traits propably does
+    not belong to here, but it exists only for this
+    non-null-string bug test. */
+namespace std {
+  template<>
+  struct char_traits<unsigned short>
+  {
+    typedef unsigned short      char_type;
+    typedef int           int_type;
+    typedef streampos     pos_type;
+    typedef streamoff     off_type;
+    typedef mbstate_t     state_type;
+ 
+    static void 
+    assign(char_type& __c1, const char_type& __c2)
+    { __c1 = __c2; }
+ 
+    static bool 
+    eq(const char_type& __c1, const char_type& __c2)
+    { return __c1 == __c2; }
+ 
+    static bool 
+    lt(const char_type& __c1, const char_type& __c2)
+    { return __c1 < __c2; }
+ 
+    static int 
+    compare(const char_type* __s1, const char_type* __s2, size_t __n)
+    { return memcmp(__s1, __s2, __n*2); }
+ 
+    static size_t
+    length(const char_type* __s) {
+      size_t count = 0;
+      while (__s[count] != '\0') count++;
+      return count;
+    }
+ 
+    static const char_type* 
+    find(const char_type* __s, size_t __n, const char_type& __a)
+    { return static_cast<const char_type*>(memchr(__s, __a, __n*2)); }
+ 
+    static char_type* 
+    move(char_type* __s1, const char_type* __s2, size_t __n)
+    { return static_cast<char_type*>(memmove(__s1, __s2, __n*2)); }
+ 
+    static char_type* 
+    copy(char_type* __s1, const char_type* __s2, size_t __n)
+    {  return static_cast<char_type*>(memcpy(__s1, __s2, __n*2)); }
+ 
+    static char_type* 
+    assign(char_type* __s, size_t __n, char_type __a)
+    { return static_cast<char_type*>(memset(__s, __a, __n*2)); }
+ 
+    static char_type 
+    to_char_type(const int_type& __c)
+    { return static_cast<char_type>(__c); }
+ 
+    // To keep both the byte 0xff and the eof symbol 0xffffffff
+    // from ending up as 0xffffffff.
+    static int_type 
+    to_int_type(const char_type& __c)
+    { return static_cast<int_type>(static_cast<unsigned char>(__c)); }
+ 
+    static bool 
+    eq_int_type(const int_type& __c1, const int_type& __c2)
+    { return __c1 == __c2; }
+ 
+    static int_type 
+    eof() { return static_cast<int_type>(EOF); }
+ 
+    static int_type 
+    not_eof(const int_type& __c)
+    { return (__c == eof()) ? 0 : __c; }
+  };
+}
+
 typedef std::basic_string<unsigned short> unistring;
 unistring jstr2unistr_failing(JNIEnv *env, jstring jstr) {
   const jchar *strptr = env->GetStringChars(jstr, 0);
@@ -121,11 +194,11 @@
   env->ReleaseStringChars(jstr, strptr);
   return unistr;
 }
-/*
 jstring unistr2jstr_failing(JNIEnv *env, unistring unistr) {
   return env->NewString(&(unistr[0]), unistr.size());
 }
-*/
+/**  **/
+
 
 Os::Window *getWindowByWID(int wid) {
     return  (wid<0 ? defaultWindow : windows.get(wid));
@@ -265,12 +338,16 @@
   return (jdouble) atof(jstr2stdstr(env, jstr).c_str());
 }
 
-/*
+
+/** Tests convert jstring to unistring _without_ asking
+ * string length from JNIEnv.
+ */
 JNIEXPORT jstring JNICALL Java_gzz_gfx_gl_GL_1Testing_loopUnistrConvFailing
 (JNIEnv *env, jobject obj, jstring jstr) {
   return unistr2jstr_failing(env, jstr2unistr_failing(env, jstr));
 }
-*/
+/** **/
+
 
 JNIEXPORT jint JNICALL Java_gzz_gfx_gl_GL_init
   (JNIEnv *env, jclass, jint) {
Index: gzz/metacode/pegboard.py
diff -u gzz/metacode/pegboard.py:1.16 gzz/metacode/pegboard.py:1.17
--- gzz/metacode/pegboard.py:1.16       Tue Nov 12 11:53:03 2002
+++ gzz/metacode/pegboard.py    Wed Nov 13 06:21:53 2002
@@ -137,7 +137,7 @@
 #converts all rsts' in pegdirs and parses pegs' meta information
 #from pegs' main files
 for pegdir in pegdirs:
-    print 'Process PEG %s' % (pegdir)
+    print 'Processing PEG %s' % (pegdir)
 
     peg = {'authors': '', 'status': undefined, 'topic': pegdir, 
'stakeholders': '', 
            'date': '', 'dir': pegdir, 'files': '', 'html': '', 'rst': '',
@@ -175,11 +175,11 @@
             pub.apply_transforms(document)
             output = pub.writer.write(document, pub.destination)
             peg['cvsignore'].append(rstfile[0:len(rstfile)-4]+'.html')
-            peg['html'] = rstfile[0:len(rstfile)-4]+'.html'
 
             #conversion have succeeded so far, parsing peg's metadata
             #from its document tree
             if rstfile == peg['rst']:
+               peg['html'] = rstfile[0:len(rstfile)-4]+'.html'
                 peg['topic'] = getTagValue(document, 'title', always_raw=1)
                 peg['topic'] = peg['topic']
                 #mark literates in topic
Index: gzz/test/gzz/gfx/jni/jnistrconv.test
diff -u gzz/test/gzz/gfx/jni/jnistrconv.test:1.7 
gzz/test/gzz/gfx/jni/jnistrconv.test:1.8
--- gzz/test/gzz/gfx/jni/jnistrconv.test:1.7    Tue Nov 12 11:53:03 2002
+++ gzz/test/gzz/gfx/jni/jnistrconv.test        Wed Nov 13 06:21:53 2002
@@ -3,48 +3,62 @@
 from gzz.gfx.gl import GL_Testing
 import java.lang.String
 
-#def testUniScandJavaSubstr_failing():
-#    str = java.lang.String("Viime yönä Åke jutteli Äreälle Örisijälle 
åskardeista.")
-#    failIf(str.substring(5,20) != 
GL_Testing.loopUnistrConvFailing(str.substring(5,20)),
-#      "Non-null-string bug detected.")
+def testUniScandJavaSubstr_without_stringlength():
+    str = java.lang.String("Viime yönä Åke jutteli Äreälle Örisijälle 
åskardeista.")
+    failIf(str.substring(5,20) != 
GL_Testing.loopUnistrConvFailing(str.substring(5,20)),
+       "["+str.substring(5,20)+"] != \
+["+GL_Testing.loopUnistrConvFailing(str.substring(5,20))+"]\n\
+Substring of phrase using scandinavian chraracters corrupted \
+during unistring conversion. The non-null-string bug propably detected. \
+If the other conversion tests are ok, this is fixed.")
 
 def testUniAZ():
     str = "AaBbCcDdEeFfGgHhIiJjKkLlMmNnOoPpQqRrSsTtUuVvWwXxYyZz"
     failIf(str != GL_Testing.loopUnistrConv(str), 
-       "Characters corrupted during unistring conversion.")
+       "["+str+"] != \
+["+GL_Testing.loopUnistrConv(str)+"]\n\
+Characters corrupted during unistring conversion.")
 
 def testUniAZPhrase():
     str = "A little green fox jumped over my backyards fence."
     failIf(str != GL_Testing.loopUnistrConv(str),
-       "Phrase corrupted during unistring conversion.")
+       "["+str+"] != \
+["+GL_Testing.loopUnistrConv(str)+"]\n\
+Phrase corrupted during unistring conversion.")
 
 def testUniScand():
     str = "ÅåÄäÖö"
     failIf(str != GL_Testing.loopUnistrConv(str),
-       "Scandinavian characters corrupted during unistring conversion.")
+       "["+str+"] != \
+["+GL_Testing.loopUnistrConv(str)+"]\n\
+Scandinavian characters corrupted during unistring conversion.")
 
 def testUniScandPhrase():
     str = "Viime yönä Åke jutteli Äreälle Örisijälle åskardeista."
     failIf(str != GL_Testing.loopUnistrConv(str),
-       "Phrase using scandinavian characters correupted during \
+       "["+str+"] != \
+["+GL_Testing.loopUnistrConv(str)+"]\n\
+Phrase using scandinavian characters correupted during \
 unistring conversion.")
 
 def testUniScandJavaSubstr():
     str = java.lang.String("Viime yönä Åke jutteli Äreälle Örisijälle 
åskardeista.")
     failIf(str.substring(5,20) != 
GL_Testing.loopUnistrConv(str.substring(5,20)),
-       "Substring of phrase using scandinavian chraracters corrupted \
+       "["+str.substring(5,20)+"] != \
+["+GL_Testing.loopUnistrConv(str.substring(5,20))+"]\n\
+Substring of phrase using scandinavian chraracters corrupted \
 during unistring conversion.")
 
 def testStdAZ():
     str = "AaBbCcDdEeFfGgHhIiJjKkLlMmNnOoPpQqRrSsTtUuVvWwXxYyZz"
     failIf(str != GL_Testing.loopStdstrConv(str),
-       "Characters corrupted during std::string conversion.")
+       "["+str+"] != \
+["+GL_Testing.loopStdstrConv(str)+"]\n\
+Characters corrupted during std::string conversion.")
 
 def testStdAZPhrase():
     str = "A little green fox jumped over my backyards fence."
     failIf(str != GL_Testing.loopStdstrConv(str),
-       "Phrase corrupted during std::string conversion.")
-
-
-
-
+       "["+str+"] != \
+["+GL_Testing.loopStdstrConv(str)+"]\n\
+Phrase corrupted during std::string conversion.")
\ No newline at end of file




reply via email to

[Prev in Thread] Current Thread [Next in Thread]