codeb testfaelle asma asmb
authorGeorg Schiesser <e0307201@student.tuwien.ac.at>
Wed, 26 May 2010 16:48:12 +0000 (18:48 +0200)
committerGeorg Schiesser <e0307201@student.tuwien.ac.at>
Wed, 26 May 2010 16:48:12 +0000 (18:48 +0200)
12 files changed:
codeb/georg_asma_00.call [new file with mode: 0644]
codeb/georg_asma_01.0 [new file with mode: 0644]
codeb/georg_asma_01.call [new symlink]
codeb/georg_asma_02.0 [new file with mode: 0644]
codeb/georg_asma_02.call [new symlink]
codeb/georg_asma_03.0 [new file with mode: 0644]
codeb/georg_asma_03.call [new symlink]
codeb/georg_asma_04.0 [new file with mode: 0644]
codeb/georg_asma_04.call [new symlink]
codeb/georg_asmb_00.call [new file with mode: 0644]
codeb/georg_asmb_01.0 [new file with mode: 0644]
codeb/georg_asmb_01.call [new symlink]

diff --git a/codeb/georg_asma_00.call b/codeb/georg_asma_00.call
new file mode 100644 (file)
index 0000000..1c4a165
--- /dev/null
@@ -0,0 +1,19 @@
+/* BOF georg_asma_00.call */
+#include <string.h> /* strcmp() */
+char x[] = "UVWxyz6789abcDEFUVWxyz6789abcDEFUVWxyz6789abcDEFUVWxyz6789abcDEF";
+char y[] = "UVWxyz6789abcDEFUVWxyz6789abcDEFUVWxyz6789abcDEFUVWxyz6789abcDEF";
+char z[] = "UVWxyz6789abcDEFuvwxyz6789abcdefUVWxyz6789abcDEFUVWxyz6789abcDEF";
+char *p = &y[16];
+extern char *asma(char *);
+int ret = (asma(p)==p && (strcmp(y,z)==0));
+if (ret != 1) {
+       x[sizeof(x)-1] = '\0'; /* just 2b sure */
+       y[sizeof(y)-1] = '\0'; /* just 2b sure */
+       z[sizeof(z)-1] = '\0'; /* just 2b sure */
+       fprintf(stderr, "### %s:%d:%s() x '%s'\n", __FILE__, __LINE__, __FUNCTION__, x);
+       fprintf(stderr, "### %s:%d:%s() y '%s'\n", __FILE__, __LINE__, __FUNCTION__, y);
+       fprintf(stderr, "### %s:%d:%s() z '%s'\n", __FILE__, __LINE__, __FUNCTION__, z);
+}
+RET(ret);
+/* vim: set filetype=c: */
+/* EOF georg_asma_00.call */
diff --git a/codeb/georg_asma_01.0 b/codeb/georg_asma_01.0
new file mode 100644 (file)
index 0000000..6daa90f
--- /dev/null
@@ -0,0 +1,43 @@
+/** asma - aka tolower() first 16 bytes.
+ *
+ *     unsigned char *asma(unsigned char *s)
+ *     {
+ *             int i;
+ *             for (i=0; i<16; i++)
+ *             {
+ *                     unsigned char c = s[i];
+ *                     c += (c >= 'A' && c <= 'Z') ? 'a'-'A' : 0;
+ *                     s[i] = c;
+ *             }
+ *             return s;
+ *     }
+ */
+/* AMD64 Little Endian byte order
+ * p[0]                c0 c1 c2 c3 c4 c5 c6 c7
+ * p[1]                   c1 c2 c3 c4 c5 c6 c7 c8
+ * p[1] * 256          00 c1 c2 c3 c4 c5 c6 c7
+ * p[0] - 256 * p[1]   c0
+ */
+/* WISHLIST signed!? p w/o i */
+struct f end;
+method asma()
+       var p := this;
+       var i := 0;
+       while i < 16
+       do
+               var a := (p-(0-i)).f;
+               var b := (p-(-1-i)).f;
+               var c := a - (256 * b);
+
+               /* add 'a'-'A' iff 'A' <= c <= 'Z' */
+               if 0x40 < c then if c < 0x5B then
+                       c := c--0x20;
+               end;
+               end;
+
+               (p-(0-i)).f := (256 * b) -(0-c);
+
+               i := i--1;
+       end;
+       return this;
+end;
diff --git a/codeb/georg_asma_01.call b/codeb/georg_asma_01.call
new file mode 120000 (symlink)
index 0000000..fa84142
--- /dev/null
@@ -0,0 +1 @@
+georg_asma_00.call
\ No newline at end of file
diff --git a/codeb/georg_asma_02.0 b/codeb/georg_asma_02.0
new file mode 100644 (file)
index 0000000..85f8ff5
--- /dev/null
@@ -0,0 +1,42 @@
+/** asma - aka tolower() first 16 bytes.
+ *
+ *     unsigned char *asma(unsigned char *s)
+ *     {
+ *             int i;
+ *             for (i=0; i<16; i++)
+ *             {
+ *                     unsigned char c = s[i];
+ *                     c += (c >= 'A' && c <= 'Z') ? 'a'-'A' : 0;
+ *                     s[i] = c;
+ *             }
+ *             return s;
+ *     }
+ */
+/* AMD64 Little Endian byte order
+ * p[0]                c0 c1 c2 c3 c4 c5 c6 c7
+ * p[1]                   c1 c2 c3 c4 c5 c6 c7 c8
+ * p[1] * 256          00 c1 c2 c3 c4 c5 c6 c7
+ * p[0] - 256 * p[1]   c0
+ */
+/* WISHLIST signed!? p w/o i */
+struct f end;
+method asma()
+       var i := 0;
+       while i < 16
+       do
+               var a := (this-(0-i)).f;
+               var b := (this-(-1-i)).f;
+               var c := a - (256 * b);
+
+               /* add 'a'-'A' iff 'A' <= c <= 'Z' */
+               if 0x40 < c then if c < 0x5B then
+                       c := c--0x20;
+               end;
+               end;
+
+               (this-(0-i)).f := (256 * b) -(0-c);
+
+               i := i--1;
+       end;
+       return this;
+end;
diff --git a/codeb/georg_asma_02.call b/codeb/georg_asma_02.call
new file mode 120000 (symlink)
index 0000000..fa84142
--- /dev/null
@@ -0,0 +1 @@
+georg_asma_00.call
\ No newline at end of file
diff --git a/codeb/georg_asma_03.0 b/codeb/georg_asma_03.0
new file mode 100644 (file)
index 0000000..3d56525
--- /dev/null
@@ -0,0 +1,43 @@
+/** asma - aka tolower() first 16 bytes.
+ *
+ *     unsigned char *asma(unsigned char *s)
+ *     {
+ *             int i;
+ *             for (i=0; i<16; i++)
+ *             {
+ *                     unsigned char c = s[i];
+ *                     c += (c >= 'A' && c <= 'Z') ? 'a'-'A' : 0;
+ *                     s[i] = c;
+ *             }
+ *             return s;
+ *     }
+ */
+/* AMD64 Little Endian byte order
+ * p[0]                c0 c1 c2 c3 c4 c5 c6 c7
+ * p[1]                   c1 c2 c3 c4 c5 c6 c7 c8
+ * p[1] * 256          00 c1 c2 c3 c4 c5 c6 c7
+ * p[0] - 256 * p[1]   c0
+ */
+/* WISHLIST signed!? */
+struct f end;
+method asma()
+       var p := this;
+       var q := this--16;
+       while p < q
+       do
+               var a := p.f;
+               var b := (p--1).f;
+               var c := a - (256 * b);
+
+               /* add 'a'-'A' iff 'A' <= c <= 'Z' */
+               if 0x40 < c then if c < 0x5B then
+                       c := c--0x20;
+               end;
+               end;
+
+               p.f := (256 * b) -(0-c);
+
+               p := p--1;
+       end;
+       return this;
+end;
diff --git a/codeb/georg_asma_03.call b/codeb/georg_asma_03.call
new file mode 120000 (symlink)
index 0000000..fa84142
--- /dev/null
@@ -0,0 +1 @@
+georg_asma_00.call
\ No newline at end of file
diff --git a/codeb/georg_asma_04.0 b/codeb/georg_asma_04.0
new file mode 100644 (file)
index 0000000..3eab8c4
--- /dev/null
@@ -0,0 +1,41 @@
+/** asma - aka tolower() first 16 bytes.
+ *
+ *     unsigned char *asma(unsigned char *s)
+ *     {
+ *             int i;
+ *             for (i=0; i<16; i++)
+ *             {
+ *                     unsigned char c = s[i];
+ *                     c += (c >= 'A' && c <= 'Z') ? 'a'-'A' : 0;
+ *                     s[i] = c;
+ *             }
+ *             return s;
+ *     }
+ */
+/* AMD64 Little Endian byte order
+ * p[0]                c0 c1 c2 c3 c4 c5 c6 c7
+ * p[1]                   c1 c2 c3 c4 c5 c6 c7 c8
+ * p[1] * 256          00 c1 c2 c3 c4 c5 c6 c7
+ * p[0] - 256 * p[1]   c0
+ */
+/* WISHLIST signed!? */
+struct f end;
+method asma()
+       var p := this;
+       var q := this--16;
+       while p < q
+       do
+               var c := p.f - (256 * (p--1).f);
+
+               /* add 'a'-'A' iff 'A' <= c <= 'Z' */
+               if 0x40 < c then if c < 0x5B then
+                       c := c--0x20;
+               end;
+               end;
+
+               p.f := (256 * (p--1).f)-(0-c);
+
+               p := p--1;
+       end;
+       return this;
+end;
diff --git a/codeb/georg_asma_04.call b/codeb/georg_asma_04.call
new file mode 120000 (symlink)
index 0000000..fa84142
--- /dev/null
@@ -0,0 +1 @@
+georg_asma_00.call
\ No newline at end of file
diff --git a/codeb/georg_asmb_00.call b/codeb/georg_asmb_00.call
new file mode 100644 (file)
index 0000000..22696b6
--- /dev/null
@@ -0,0 +1,25 @@
+/* BOF georg_asmb_00.call */
+#include <string.h> /* strcmp() strlen() */
+char x[] = "UVWxyz6789abcDEFUVWxyz6789abcDEFUVWxyz6789abcDE\0UVWxyz6789abcDEFUVWxyz6789abcDEF";
+char y[] = "UVWxyz6789abcDEFUVWxyz6789abcDEFUVWxyz6789abcDE\0UVWxyz6789abcDEFUVWxyz6789abcDEF";
+char z[] = "UVWxyz6789abcDEFuvwxyz6789abcdefuvwxyz6789abcde\0UVWxyz6789abcDEFUVWxyz6789abcDEF";
+char *p = &y[16];
+extern char *asmb(char *);
+int ret = (asmb(p)==p && (strcmp(y,z)==0));
+if (ret != 1) {
+       x[sizeof(x)-1] = '\0'; /* just 2b sure */
+       y[sizeof(y)-1] = '\0'; /* just 2b sure */
+       z[sizeof(z)-1] = '\0'; /* just 2b sure */
+       x[sizeof(x)-2] = '\0'; /* just 2b sure */
+       y[sizeof(y)-2] = '\0'; /* just 2b sure */
+       z[sizeof(z)-2] = '\0'; /* just 2b sure */
+       x[strlen(x)] = '#';
+       y[strlen(y)] = '#';
+       z[strlen(z)] = '#';
+       fprintf(stderr, "### %s:%d:%s() x '%s'\n", __FILE__, __LINE__, __FUNCTION__, x);
+       fprintf(stderr, "### %s:%d:%s() y '%s'\n", __FILE__, __LINE__, __FUNCTION__, y);
+       fprintf(stderr, "### %s:%d:%s() z '%s'\n", __FILE__, __LINE__, __FUNCTION__, z);
+}
+RET(ret);
+/* vim: set filetype=c: */
+/* EOF georg_asmb_00.call */
diff --git a/codeb/georg_asmb_01.0 b/codeb/georg_asmb_01.0
new file mode 100644 (file)
index 0000000..3f6ecc7
--- /dev/null
@@ -0,0 +1,40 @@
+/** asmb - aka tolower(), maybe more than strlen().
+ *
+ *     unsigned char *asmb(unsigned char *s)
+ *     {
+ *             unsigned long i;
+ *             for (i=0; s[i]; i++)
+ *             {
+ *                     unsigned char c = s[i];
+ *                     c += (c >= 'A' && c <= 'Z') ? 'a'-'A' : 0;
+ *                     s[i] = c;
+ *             }
+ *             return s;
+ *     }
+ */
+/* AMD64 Little Endian byte order
+ * p[0]                c0 c1 c2 c3 c4 c5 c6 c7
+ * p[1]                   c1 c2 c3 c4 c5 c6 c7 c8
+ * p[1] * 256          00 c1 c2 c3 c4 c5 c6 c7
+ * p[0] - 256 * p[1]   c0
+ */
+/* WISHLIST signed!? */
+struct f end;
+method asmb()
+       var p := this;
+       while p.f - (256 * (p--1).f)
+       do
+               var c := p.f - (256 * (p--1).f);
+
+               /* add 'a'-'A' iff 'A' <= c <= 'Z' */
+               if 0x40 < c then if c < 0x5B then
+                       c := c--0x20;
+               end;
+               end;
+
+               p.f := (256 * (p--1).f)-(0-c);
+
+               p := p--1;
+       end;
+       return this;
+end;
diff --git a/codeb/georg_asmb_01.call b/codeb/georg_asmb_01.call
new file mode 120000 (symlink)
index 0000000..5b7fedb
--- /dev/null
@@ -0,0 +1 @@
+georg_asmb_00.call
\ No newline at end of file