[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
freqz and 2.9.17+
From: |
John W. Eaton |
Subject: |
freqz and 2.9.17+ |
Date: |
Wed, 14 Nov 2007 15:41:54 -0500 |
On 14-Nov-2007, Fredrik Lingvall wrote:
| I get this output from freqz:
|
| octave:5> freqz(randn(200,1))
| warning: get: invalid property `tag'
| warning: get: invalid property `tag'
| warning: get: invalid property `tag'
| warning: get: invalid property `tag'
| warning: get: invalid property `tag'
| warning: get: invalid property `tag'
Please try the following patch.
Thanks,
jwe
src/ChangeLog:
2007-11-14 John W. Eaton <address@hidden>
* graphics.h.in (base_properties::tag): New property.
(base_properties::get_tag, base_properties::set_tag): New functions.
(root_figure::set, root_figure::get, figure::set, figure::get,
axes::set, axes::get, line::set, line::get, text::set, text::get,
patch::set, patch::get, surface::set, surface::get): Handle tag.
Index: src/graphics.cc
===================================================================
RCS file: /cvs/octave/src/graphics.cc,v
retrieving revision 1.50
diff -u -u -r1.50 graphics.cc
--- src/graphics.cc 13 Nov 2007 15:16:52 -0000 1.50
+++ src/graphics.cc 14 Nov 2007 20:40:33 -0000
@@ -705,6 +705,17 @@
}
void
+base_properties::set_tag (const octave_value& val)
+{
+ std::string tmp = val.string_value ();
+
+ if (! error_state)
+ tag = tmp;
+ else
+ error ("set: expecting tag to be a character string");
+}
+
+void
base_properties::set_parent (const octave_value& val)
{
double tmp = val.double_value ();
@@ -776,7 +787,9 @@
root_figure::properties::set (const property_name& name,
const octave_value& val)
{
- if (name.compare ("currentfigure"))
+ if (name.compare ("tag"))
+ set_tag (val);
+ else if (name.compare ("currentfigure"))
set_currentfigure (val);
else if (name.compare ("children"))
children = maybe_set_children (children, val);
@@ -790,6 +803,7 @@
{
Octave_map m;
+ m.assign ("tag", tag);
m.assign ("type", type);
m.assign ("currentfigure", currentfigure.as_octave_value ());
m.assign ("children", children);
@@ -803,7 +817,9 @@
{
octave_value retval;
- if (name.compare ("type"))
+ if (name.compare ("tag"))
+ retval = type;
+ else if (name.compare ("tag"))
retval = type;
else if (name.compare ("currentfigure"))
retval = currentfigure.as_octave_value ();
@@ -867,7 +883,9 @@
{
bool modified = true;
- if (name.compare ("children"))
+ if (name.compare ("tag"))
+ set_tag (val);
+ else if (name.compare ("children"))
children = maybe_set_children (children, val);
else if (name.compare ("__modified__"))
{
@@ -903,6 +921,7 @@
{
Octave_map m;
+ m.assign ("tag", tag);
m.assign ("type", type);
m.assign ("parent", parent.as_octave_value ());
m.assign ("children", children);
@@ -923,7 +942,9 @@
{
octave_value retval;
- if (name.compare ("type"))
+ if (name.compare ("tag"))
+ retval = tag;
+ else if (name.compare ("type"))
retval = type;
else if (name.compare ("parent"))
retval = parent.as_octave_value ();
@@ -1175,7 +1196,9 @@
{
bool modified = true;
- if (name.compare ("parent"))
+ if (name.compare ("tag"))
+ set_tag (val);
+ else if (name.compare ("parent"))
set_parent (val);
else if (name.compare ("children"))
children = maybe_set_children (children, val);
@@ -1418,6 +1441,7 @@
{
Octave_map m;
+ m.assign ("tag", tag);
m.assign ("type", type);
m.assign ("parent", parent.as_octave_value ());
m.assign ("children", children);
@@ -1481,7 +1505,9 @@
{
octave_value retval;
- if (name.compare ("type"))
+ if (name.compare ("tag"))
+ retval = tag;
+ else if (name.compare ("type"))
retval = type;
else if (name.compare ("parent"))
retval = parent.value ();
@@ -1755,7 +1781,9 @@
{
bool modified = true;
- if (name.compare ("parent"))
+ if (name.compare ("tag"))
+ set_tag (val);
+ else if (name.compare ("parent"))
set_parent (val);
else if (name.compare ("children"))
children = maybe_set_children (children, val);
@@ -1809,6 +1837,7 @@
{
Octave_map m;
+ m.assign ("tag", tag);
m.assign ("type", type);
m.assign ("parent", parent.as_octave_value ());
m.assign ("children", children);
@@ -1837,7 +1866,9 @@
{
octave_value retval;
- if (name.compare ("type"))
+ if (name.compare ("tag"))
+ retval = tag;
+ else if (name.compare ("type"))
retval = type;
else if (name.compare ("parent"))
retval = parent.as_octave_value ();
@@ -1929,7 +1960,9 @@
{
bool modified = true;
- if (name.compare ("parent"))
+ if (name.compare ("tag"))
+ set_tag (val);
+ else if (name.compare ("parent"))
set_parent (val);
else if (name.compare ("children"))
children = maybe_set_children (children, val);
@@ -1973,6 +2006,7 @@
{
Octave_map m;
+ m.assign ("tag", tag);
m.assign ("type", type);
m.assign ("parent", parent.as_octave_value ());
m.assign ("children", children);
@@ -1996,7 +2030,9 @@
{
octave_value retval;
- if (name.compare ("type"))
+ if (name.compare ("tag"))
+ retval = tag;
+ else if (name.compare ("type"))
retval = type;
else if (name.compare ("parent"))
retval = parent.as_octave_value ();
@@ -2069,7 +2105,9 @@
{
bool modified = true;
- if (name.compare ("parent"))
+ if (name.compare ("tag"))
+ set_tag (val);
+ else if (name.compare ("parent"))
set_parent (val);
else if (name.compare ("children"))
children = maybe_set_children (children, val);
@@ -2099,6 +2137,7 @@
{
Octave_map m;
+ m.assign ("tag", tag);
m.assign ("type", type);
m.assign ("parent", parent.as_octave_value ());
m.assign ("children", children);
@@ -2115,7 +2154,9 @@
{
octave_value retval;
- if (name.compare ("type"))
+ if (name.compare ("tag"))
+ retval = tag;
+ else if (name.compare ("type"))
retval = type;
else if (name.compare ("parent"))
retval = parent.as_octave_value ();
@@ -2178,7 +2219,9 @@
{
bool modified = true;
- if (name.compare ("parent"))
+ if (name.compare ("tag"))
+ set_tag (val);
+ else if (name.compare ("parent"))
set_parent (val);
else if (name.compare ("children"))
children = maybe_set_children (children, val);
@@ -2234,6 +2277,7 @@
{
Octave_map m;
+ m.assign ("tag", tag);
m.assign ("type", type);
m.assign ("parent", parent.as_octave_value ());
m.assign ("children", children);
@@ -2263,7 +2307,9 @@
{
octave_value retval;
- if (name.compare ("type"))
+ if (name.compare ("tag"))
+ retval = tag;
+ else if (name.compare ("type"))
retval = type;
else if (name.compare ("parent"))
retval = parent.as_octave_value ();
@@ -2363,7 +2409,9 @@
{
bool modified = true;
- if (name.compare ("parent"))
+ if (name.compare ("tag"))
+ set_tag (val);
+ else if (name.compare ("parent"))
set_parent (val);
else if (name.compare ("children"))
children = maybe_set_children (children, val);
@@ -2415,6 +2463,7 @@
{
Octave_map m;
+ m.assign ("tag", tag);
m.assign ("type", type);
m.assign ("parent", parent.as_octave_value ());
m.assign ("children", children);
@@ -2442,7 +2491,9 @@
{
octave_value retval;
- if (name.compare ("type"))
+ if (name.compare ("tag"))
+ retval = tag;
+ else if (name.compare ("type"))
retval = type;
else if (name.compare ("parent"))
retval = parent.as_octave_value ();
Index: src/graphics.h.in
===================================================================
RCS file: /cvs/octave/src/graphics.h.in,v
retrieving revision 1.15
diff -u -u -r1.15 graphics.h.in
--- src/graphics.h.in 13 Nov 2007 15:16:52 -0000 1.15
+++ src/graphics.h.in 14 Nov 2007 20:40:33 -0000
@@ -649,11 +649,11 @@
class base_properties
{
public:
- base_properties (const std::string& t = "unknown",
+ base_properties (const std::string& ty = "unknown",
const graphics_handle& mh = graphics_handle (),
const graphics_handle& p = graphics_handle ())
- : type (t), __modified__ (true), __myhandle__ (mh), parent (p),
- children () { }
+ : tag (), type (ty), __modified__ (true), __myhandle__ (mh),
+ parent (p), children () { }
virtual ~base_properties (void) { }
@@ -670,6 +670,8 @@
virtual void set (const property_name&, const octave_value&) { }
+ std::string get_tag (void) const { return tag; }
+
graphics_handle get_parent (void) const { return parent; }
void remove_child (const graphics_handle& h);
@@ -681,6 +683,8 @@
children(n) = h.value ();
}
+ void set_tag (const octave_value& val);
+
void set_parent (const octave_value& val);
void reparent (const graphics_handle& new_parent) { parent = new_parent; }
@@ -688,6 +692,7 @@
virtual void delete_children (void);
protected:
+ std::string tag;
std::string type;
bool __modified__;
graphics_handle __myhandle__;