public inbox for frysk-cvs@sourceware.org
help / color / mirror / Atom feed
* [SCM]  master: Allow for struct/class accessibility defaults.
@ 2008-02-20  2:22 scox
  0 siblings, 0 replies; only message in thread
From: scox @ 2008-02-20  2:22 UTC (permalink / raw)
  To: frysk-cvs

The branch, master has been updated
       via  312f766777c680ddc21a09ef364283882e1cfdac (commit)
      from  2f1786f6895999c01fd41be95f3e902a1d760acc (commit)

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

- Log -----------------------------------------------------------------
commit 312f766777c680ddc21a09ef364283882e1cfdac
Author: Stan Cox <scox@redhat.com>
Date:   Tue Feb 19 21:10:57 2008 -0500

    Allow for struct/class accessibility defaults.
    
    * funit-type-class.cxx (class_accessibility): New.
    * CompositeType.java (toPrint): Allow for struct/class access defaults.

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

Summary of changes:
 frysk-core/frysk/pkglibdir/ChangeLog            |    4 ++
 frysk-core/frysk/pkglibdir/funit-type-class.cxx |   56 ++++++++++++++++-------
 frysk-core/frysk/value/ChangeLog                |    4 ++
 frysk-core/frysk/value/CompositeType.java       |   23 ++++++---
 4 files changed, 63 insertions(+), 24 deletions(-)

First 500 lines of diff:
diff --git a/frysk-core/frysk/pkglibdir/ChangeLog b/frysk-core/frysk/pkglibdir/ChangeLog
index ec56b56..0960eaa 100644
--- a/frysk-core/frysk/pkglibdir/ChangeLog
+++ b/frysk-core/frysk/pkglibdir/ChangeLog
@@ -1,3 +1,7 @@
+2008-02-19  Stan Cox  <scox@redhat.com>
+
+	* funit-type-class.cxx (class_accessibility): New.
+
 2008-02-08  Stan Cox  <scox@redhat.com>
 
 	* funit-quicksort.c (main): Add bubblesort for cross frame/file testing.
diff --git a/frysk-core/frysk/pkglibdir/funit-type-class.cxx b/frysk-core/frysk/pkglibdir/funit-type-class.cxx
index df008de..25b1154 100644
--- a/frysk-core/frysk/pkglibdir/funit-type-class.cxx
+++ b/frysk-core/frysk/pkglibdir/funit-type-class.cxx
@@ -1,6 +1,6 @@
 // This file is part of the program FRYSK.
 //
-// Copyright 2007, Red Hat Inc.
+// Copyright 2007, 2008, Red Hat Inc.
 //
 // FRYSK is free software; you can redistribute it and/or modify it
 // under the terms of the GNU General Public License as published by
@@ -45,6 +45,32 @@ static void crash (){
   a[0] = 0;
 }
 
+class class_accessibility {
+ private:
+  long int long_var;
+  int int_var;
+ public:
+  short int short_var;
+ protected:
+  float float_var;
+ public:
+  void set_int_var (int int_var);
+} class_accessibility;
+
+// Test: Class
+// Name: class_accessibility
+// Type: class class_accessibility {
+// Type:  private:
+// Type:   long int long_var;
+// Type:   int int_var;
+// Type:  public:
+// Type:   short int short_var;
+// Type:  protected:
+// Type:   float float_var;
+// Type:  public:
+// Type:   void set_int_var (int);
+// Type: }
+
 class Base1
 {
 public:
@@ -108,10 +134,8 @@ private:
   }
 };
 
-// Test: Class
-// Name: mb
+// Name: class_inherited
 // Type: class Type {
-// Type:  public:
 // Type:   struct Base1 {
 // Type:     const char *msg;
 // Type:     void Base1 (const char *);
@@ -124,15 +148,15 @@ private:
 // Type:   } ;
 // Type:  private:
 // Type:   const char *note;
+// Type:  public:
 // Type:   void Type (const char *,const char *,const char *);
 // Type:   void ~Type ();
 // Type: }
 
-Type mb("static", "main", "mb");
+Type class_inherited("static", "main", "mb");
 
-// Name: new_base
+// Name: class_inherited_new
 // Type: class Type {
-// Type:  public:
 // Type:   struct Base1 {
 // Type:     const char *msg;
 // Type:     void Base1 (const char *);
@@ -145,15 +169,15 @@ Type mb("static", "main", "mb");
 // Type:   } ;
 // Type:  private:
 // Type:   const char *note;
+// Type:  public:
 // Type:   void Type (const char *,const char *,const char *);
 // Type:   void ~Type ();
 // Type: }
 
-Type new_base = Type ("new base", "main", "new_base");
+Type class_inherited_new = Type ("new base", "main", "new_base");
 
-// Name: xyz
+// Name: class_template
 // Type: class Derived {
-// Type:  public:
 // Type:   struct Base3 {
 // Type:     int (**_vptr.Base3) ();
 // Type:     void Base3 (void * const &);
@@ -178,17 +202,17 @@ Type new_base = Type ("new base", "main", "new_base");
 // Type:   float do_this_impl<float> (float);
 // Type: }
 
-Derived xyz;
+Derived class_template;
 
 static void func () __attribute__ ((noinline));
 void
 func ()
 {
-  xyz.do_this ((char)'1');
-  xyz.do_this ((short)2);
-  xyz.do_this ((int)3);
-  xyz.do_this ((float) 4.1);
-  xyz.do_this ((int)1);
+  class_template.do_this ((char)'1');
+  class_template.do_this ((short)2);
+  class_template.do_this ((int)3);
+  class_template.do_this ((float) 4.1);
+  class_template.do_this ((int)1);
   crash();
 }
 
diff --git a/frysk-core/frysk/value/ChangeLog b/frysk-core/frysk/value/ChangeLog
index d4f5f86..7159a99 100644
--- a/frysk-core/frysk/value/ChangeLog
+++ b/frysk-core/frysk/value/ChangeLog
@@ -1,3 +1,7 @@
+2008-02-19  Stan Cox  <scox@redhat.com>
+
+	* CompositeType.java (toPrint): Allow for struct/class access defaults.
+	
 2008-02-19  Nurdin Premji  <npremji@redhat.com>
 
 	* TestInterface.java: New.
diff --git a/frysk-core/frysk/value/CompositeType.java b/frysk-core/frysk/value/CompositeType.java
index f0c7722..fd6f325 100644
--- a/frysk-core/frysk/value/CompositeType.java
+++ b/frysk-core/frysk/value/CompositeType.java
@@ -353,18 +353,25 @@ public abstract class CompositeType
 	    member = null;
 	}
 	// { content ... }
-	Access previousAccess = null;
+	Access previousAccess;
+	Access currentAccess;
+	Access defaultAccess;
+	if (this instanceof ClassType)
+	    defaultAccess = Access.PRIVATE;
+	else 
+	    defaultAccess = Access.PUBLIC;
+	previousAccess = defaultAccess;
+	   
 	stringBuilder.append(" {\n");
 
 	StringBuilder memberStringBuilder = new StringBuilder();
 	while (member != null) {
-	    if (member.access != previousAccess) {
-		previousAccess = member.access;
-		if (member.access != null) {
-		    stringBuilder.append(" ");
-		    stringBuilder.append(member.access.toPrint());
-		    stringBuilder.append(":\n");
-		}
+	    currentAccess = (member.access != null) ? member.access : defaultAccess;
+	    if (currentAccess != previousAccess) {
+		previousAccess = currentAccess;
+		stringBuilder.append(" ");
+		stringBuilder.append(currentAccess.toPrint());
+		stringBuilder.append(":\n");
 	    }
 	    memberStringBuilder.delete(0, memberStringBuilder.length());
 	    memberStringBuilder.append(" " + member.name);


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


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2008-02-20  2:22 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-02-20  2:22 [SCM] master: Allow for struct/class accessibility defaults scox

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).