public inbox for frysk-cvs@sourceware.org
help / color / mirror / Atom feed
From: tthomas@sourceware.org
To: frysk-cvs@sourceware.org
Subject: [SCM]  master: Support expression index[arrayName].
Date: Thu, 08 Nov 2007 20:39:00 -0000	[thread overview]
Message-ID: <20071108203932.24420.qmail@sourceware.org> (raw)

The branch, master has been updated
       via  92e9c47e02ab8b02ccd29dac7763d286d4652353 (commit)
      from  f0dd7a1f1381eb180a42ab7ddb9f56d717aa48ff (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email.

- Log -----------------------------------------------------------------
commit 92e9c47e02ab8b02ccd29dac7763d286d4652353
Author: Teresa Thomas <tthomas@redhat.com>
Date:   Thu Nov 8 15:38:17 2007 -0500

    Support expression index[arrayName].
    
    frysk-core/frysk/value/ChangeLog
    2007-11-08  Teresa Thomas  <tthomas@redhat.com>
    
    	* Type.java (index): Make operation commutative.
    	* TestArray.java (testIndexOneD): Add test for above.

-----------------------------------------------------------------------

Summary of changes:
 frysk-core/frysk/value/ChangeLog      |    5 +++++
 frysk-core/frysk/value/TestArray.java |    3 ++-
 frysk-core/frysk/value/Type.java      |    4 ++++
 3 files changed, 11 insertions(+), 1 deletions(-)

First 500 lines of diff:
diff --git a/frysk-core/frysk/value/ChangeLog b/frysk-core/frysk/value/ChangeLog
index 0906a1d..e696918 100644
--- a/frysk-core/frysk/value/ChangeLog
+++ b/frysk-core/frysk/value/ChangeLog
@@ -1,4 +1,9 @@
 2007-11-08  Teresa Thomas  <tthomas@redhat.com>
+
+	* Type.java (index): Make operation commutative.
+	* TestArray.java (testIndexOneD): Add test for above.	
+
+2007-11-08  Teresa Thomas  <tthomas@redhat.com>
 	
 	* AddressUnit.java (wordSize): New.
 	(add): Use wordSize for pointer creation.
diff --git a/frysk-core/frysk/value/TestArray.java b/frysk-core/frysk/value/TestArray.java
index 5706a02..25015c6 100644
--- a/frysk-core/frysk/value/TestArray.java
+++ b/frysk-core/frysk/value/TestArray.java
@@ -95,7 +95,8 @@ public class TestArray extends TestCase {
 	Location l = new ScratchLocation(new byte[] { 2 });
 	IntegerType t = new UnsignedType("type", ByteOrder.BIG_ENDIAN, 1);
 	Value index = new Value(t, l);
-	assertEquals("IndexOneD", 151653132, arrayType.index(arr, index, null).asLong());
+	assertEquals("Array[index]", 151653132, arrayType.index(arr, index, null).asLong());
+	assertEquals("Index[array]", 151653132, t.index(index, arr, null).asLong());	
     }
 
     /**
diff --git a/frysk-core/frysk/value/Type.java b/frysk-core/frysk/value/Type.java
index c13cb2e..7bfe22c 100644
--- a/frysk-core/frysk/value/Type.java
+++ b/frysk-core/frysk/value/Type.java
@@ -218,6 +218,10 @@ public abstract class Type {
     	throw new InvalidOperatorException(this, ".");
     } 
     public Value index(Value var1, Value var2, ByteBuffer taskMem) {
+	// In C, var1[var2] = var2[var1]
+	if (var2.getType() instanceof ArrayType || 
+	    var2.getType() instanceof PointerType)
+	    return var2.getType().index (var2, var1, taskMem);
     	throw new InvalidOperatorException(this, "[]");
     }     
    /**


hooks/post-receive
--
frysk system monitor/debugger


                 reply	other threads:[~2007-11-08 20:39 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20071108203932.24420.qmail@sourceware.org \
    --to=tthomas@sourceware.org \
    --cc=frysk-cvs@sourceware.org \
    --cc=frysk@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).