changeset 6904:1758d3d3d266

[project @ 2007-09-14 20:08:56 by jwe]
author jwe
date Fri, 14 Sep 2007 20:08:57 +0000
parents a56ab599ac4c
children aee959a21c4b
files src/ChangeLog src/genprops.awk
diffstat 2 files changed, 36 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/src/ChangeLog	Fri Sep 14 19:47:12 2007 +0000
+++ b/src/ChangeLog	Fri Sep 14 20:08:57 2007 +0000
@@ -1,3 +1,7 @@
+2007-09-14  Shai Ayal  <shaiay@users.sourceforge.net>
+
+	* genprop.awk: Handle "a" modifier.
+
 2007-09-14  Kai Habel  <kai.habel@gmx.de>
 
 	* graphics.h.in (radio_values::contains): New function.
--- a/src/genprops.awk	Fri Sep 14 19:47:12 2007 +0000
+++ b/src/genprops.awk	Fri Sep 14 20:08:57 2007 +0000
@@ -53,6 +53,29 @@
 ##   O:  There is a custom extern definition for the octave_value version
 ##       of the set function, so we emit only the declaration.
 ##
+##   a:  The octave_value version of the set function will use assignment:
+##
+##         void
+##         set_NAME (const octave_value& val)
+##         {
+##           TYPE tmp (NAME);
+##           tmp = val;
+##           set_NAME (tmp);
+##         }
+##
+##       This is useful for things like the radio_value classes which
+##       use an overloaded assignment operator of the form
+##
+##         radio_property& operator = (const octave_value& val);
+##
+##       that preserves the list of possible values, which is different
+##       from what would happen if we simply used the
+##
+##         TYPE (const octave_value&)
+##
+##       constructor, which creates a new radio_property and so cannot
+##       preserve the old list of possible values.
+##
 ##   m:  Add the line
 ##
 ##         set_NAMEmode ("manual");
@@ -113,6 +136,11 @@
 
 	  if (emit_ov_set[i] == "defn")
 	      printf (" { set_%s (%s (val)); }\n\n", name[i], type[i]);
+          else if (emit_ov_set[i] == "asign")
+          {
+              printf ("\n  {\n    %s tmp (%s);\n    tmp = val;\n    set_%s (tmp);\n  };\n\n",
+		      type[i], name[i], name[i], name[i]);
+         }
 	  else
 	      printf (";\n");
       }
@@ -194,6 +222,10 @@
 	    if (index (quals, "S"))
 		emit_set[idx] = "decl";
 
+            ## emmit an asignment set function
+            if (index (quals, "a"))
+                emit_ov_set[idx] = "asign";
+
 	    if (type[idx] != "octave_value")
 	    {
 		## The 'o' and 'O' qualifiers are only useful when the