Mercurial > hg > octave-nkf
changeset 17735:dc4124992f0c classdef
maint: periodic merge of default to classdef
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Mon, 14 Oct 2013 17:16:36 -0400 |
parents | df266c923b83 (current diff) 0c5f50706ba3 (diff) |
children | 93b3d03b05e7 |
files | libinterp/parse-tree/oct-parse.in.yy |
diffstat | 5 files changed, 87 insertions(+), 57 deletions(-) [+] |
line wrap: on
line diff
--- a/libgui/src/m-editor/octave-qscintilla.cc +++ b/libgui/src/m-editor/octave-qscintilla.cc @@ -76,7 +76,7 @@ void octave_qscintilla::context_edit () { - if (hasSelectedText ()) + if (get_actual_word ()) contextmenu_edit (true); }
--- a/libinterp/corefcn/gl-render.cc +++ b/libinterp/corefcn/gl-render.cc @@ -44,12 +44,6 @@ #define CALLBACK #endif -static octave_idx_type -xmin (octave_idx_type x, octave_idx_type y) -{ - return x < y ? x : y; -} - class opengl_texture { @@ -63,9 +57,9 @@ { } texture_rep (GLuint id_arg, int w_arg, int h_arg, int tw_arg, int th_arg) - : id (id_arg), w (w_arg), h (h_arg), tw (tw_arg), th (th_arg), - tx (double(w)/tw), ty (double(h)/th), valid (true), - count (1) { } + : id (id_arg), w (w_arg), h (h_arg), tw (tw_arg), th (th_arg), + tx (double(w)/tw), ty (double(h)/th), valid (true), + count (1) { } ~texture_rep (void) { @@ -96,7 +90,7 @@ opengl_texture (void) : rep (new texture_rep ()) { } opengl_texture (const opengl_texture& tx) - : rep (tx.rep) + : rep (tx.rep) { rep->count++; } @@ -151,8 +145,8 @@ // Expect RGB data if (dv.length () == 3 && dv(2) == 3) { - // FIXME -- dim_vectors hold octave_idx_type values. Should we - // check for dimensions larger than intmax? + // FIXME: dim_vectors hold octave_idx_type values. + // Should we check for dimensions larger than intmax? int h = dv(0), w = dv(1), tw, th; GLuint id; bool ok = true; @@ -179,8 +173,7 @@ } } - glTexImage2D (GL_TEXTURE_2D, 0, 3, tw, th, 0, - GL_RGB, GL_FLOAT, a); + glTexImage2D (GL_TEXTURE_2D, 0, 3, tw, th, 0, GL_RGB, GL_FLOAT, a); } else if (data.is_uint8_type ()) { @@ -266,10 +259,10 @@ virtual void end (void) { } - virtual void vertex (void */*data*/) { } - - virtual void combine (GLdouble /*c*/[3], void */*data*/[4], - GLfloat /*w*/[4], void **/*out_data*/) { } + virtual void vertex (void * /*data*/) { } + + virtual void combine (GLdouble [3] /*c*/, void * [4] /*data*/, + GLfloat [4] /*w*/, void ** /*out_data*/) { } virtual void edge_flag (GLboolean /*flag*/) { } @@ -353,9 +346,9 @@ vertex_data_rep (const Matrix& c, const Matrix& col, const Matrix& n, double a, float as, float ds, float ss, float se) - : coords (c), color (col), normal (n), alpha (a), - ambient (as), diffuse (ds), specular (ss), specular_exp (se), - count (1) { } + : coords (c), color (col), normal (n), alpha (a), + ambient (as), diffuse (ds), specular (ss), specular_exp (se), + count (1) { } }; private: @@ -377,11 +370,11 @@ vertex_data (const Matrix& c, const Matrix& col, const Matrix& n, double a, float as, float ds, float ss, float se) - : rep (new vertex_data_rep (c, col, n, a, as, ds, ss, se)) + : rep (new vertex_data_rep (c, col, n, a, as, ds, ss, se)) { } vertex_data (vertex_data_rep *new_rep) - : rep (new_rep) { } + : rep (new_rep) { } ~vertex_data (void) { @@ -408,9 +401,9 @@ { public: patch_tesselator (opengl_renderer *r, int cmode, int lmode, int idx = 0) - : opengl_tesselator (), renderer (r), - color_mode (cmode), light_mode (lmode), index (idx), - first (true), tmp_vdata () + : opengl_tesselator (), renderer (r), + color_mode (cmode), light_mode (lmode), index (idx), + first (true), tmp_vdata () { } protected: @@ -1434,7 +1427,7 @@ Matrix z = xform.zscale (props.get_zdata ().matrix_value ()); bool has_z = (z.numel () > 0); - int n = static_cast<int> (::xmin (::xmin (x.numel (), y.numel ()), (has_z ? z.numel () : std::numeric_limits<int>::max ()))); + int n = static_cast<int> (std::min (std::min (x.numel (), y.numel ()), (has_z ? z.numel () : std::numeric_limits<int>::max ()))); octave_uint8 clip_mask = (props.is_clipping () ? 0x7F : 0x40), clip_ok (0x40); std::vector<octave_uint8> clip (n);
--- a/libinterp/corefcn/graphics.cc +++ b/libinterp/corefcn/graphics.cc @@ -8022,13 +8022,13 @@ public: callback_event (const graphics_handle& h, const std::string& name, const octave_value& data = Matrix ()) - : base_graphics_event (), handle (h), callback_name (name), - callback (), callback_data (data) { } + : base_graphics_event (), handle (h), callback_name (name), + callback (), callback_data (data) { } callback_event (const graphics_handle& h, const octave_value& cb, const octave_value& data = Matrix ()) - : base_graphics_event (), handle (h), callback_name (), - callback (cb), callback_data (data) { } + : base_graphics_event (), handle (h), callback_name (), + callback (cb), callback_data (data) { } void execute (void) { @@ -8040,8 +8040,7 @@ private: callback_event (void) - : base_graphics_event (), handle (), - callback_name (), callback_data () + : base_graphics_event (), handle (), callback_name (), callback_data () { } private: @@ -8056,8 +8055,8 @@ { public: function_event (graphics_event::event_fcn fcn, void* data = 0) - : base_graphics_event (), function (fcn), - function_data (data) { } + : base_graphics_event (), function (fcn), function_data (data) + { } void execute (void) { @@ -8086,8 +8085,8 @@ public: set_event (const graphics_handle& h, const std::string& name, const octave_value& value, bool do_notify_toolkit = true) - : base_graphics_event (), handle (h), property_name (name), - property_value (value), notify_toolkit (do_notify_toolkit) { } + : base_graphics_event (), handle (h), property_name (name), + property_value (value), notify_toolkit (do_notify_toolkit) { } void execute (void) {
--- a/libinterp/corefcn/graphics.in.h +++ b/libinterp/corefcn/graphics.in.h @@ -1234,23 +1234,23 @@ { public: double_radio_property (double d, const radio_values& v) - : base_property ("", graphics_handle ()), - current_type (double_t), dval (d), radio_val (v), - current_val (v.default_value ()) + : base_property ("", graphics_handle ()), + current_type (double_t), dval (d), radio_val (v), + current_val (v.default_value ()) { } double_radio_property (const std::string& nm, const graphics_handle& h, const std::string& v) - : base_property (nm, h), - current_type (radio_t), dval (0), radio_val (v), - current_val (radio_val.default_value ()) + : base_property (nm, h), + current_type (radio_t), dval (0), radio_val (v), + current_val (radio_val.default_value ()) { } double_radio_property (const std::string& nm, const graphics_handle& h, const double_radio_property& v) - : base_property (nm, h), - current_type (v.current_type), dval (v.dval), - radio_val (v.radio_val), current_val (v.current_val) + : base_property (nm, h), + current_type (v.current_type), dval (v.dval), + radio_val (v.radio_val), current_val (v.current_val) { } double_radio_property (const double_radio_property& p) @@ -2040,7 +2040,7 @@ public: base_graphics_toolkit (const std::string& nm) - : name (nm), count (0) { } + : name (nm), count (0) { } virtual ~base_graphics_toolkit (void) { } @@ -2118,19 +2118,19 @@ { public: graphics_toolkit (void) - : rep (new base_graphics_toolkit ("unknown")) + : rep (new base_graphics_toolkit ("unknown")) { rep->count++; } graphics_toolkit (base_graphics_toolkit* b) - : rep (b) + : rep (b) { rep->count++; } graphics_toolkit (const graphics_toolkit& b) - : rep (b.rep) + : rep (b.rep) { rep->count++; } @@ -3468,11 +3468,11 @@ graphics_xform (const Matrix& xm, const Matrix& xim, const scaler& x, const scaler& y, const scaler& z, const Matrix& zl) - : xform (xm), xform_inv (xim), sx (x), sy (y), sz (z), zlim (zl) { } + : xform (xm), xform_inv (xim), sx (x), sy (y), sz (z), zlim (zl) { } graphics_xform (const graphics_xform& g) - : xform (g.xform), xform_inv (g.xform_inv), sx (g.sx), - sy (g.sy), sz (g.sz), zlim (g.zlim) { } + : xform (g.xform), xform_inv (g.xform_inv), sx (g.sx), + sy (g.sy), sz (g.sz), zlim (g.zlim) { } ~graphics_xform (void) { }
--- a/libinterp/parse-tree/oct-parse.in.yy +++ b/libinterp/parse-tree/oct-parse.in.yy @@ -323,9 +323,47 @@ // How to clean up if there is a parse error. We handle deleting tokens // and comments seperately and separators are just characters. The // remaining items are dynamically allocated parse tree objects that -// must be deleted. -%destructor { } <sep_type> <tok_val> <comment_type> <dummy_type> <> -%destructor { delete $$; } <*> +// must be deleted. Use the wildcard case (<*>) to detect unhandled +// cases (for example, a new semantic type is added but not handled +// here). + +%destructor { } <sep_type> +%destructor { } <tok_val> +%destructor { } <comment_type> +%destructor { } <dummy_type> +%destructor { } <> + +%destructor { delete $$; } <tree_type> +%destructor { delete $$; } <tree_matrix_type> +%destructor { delete $$; } <tree_cell_type> +%destructor { delete $$; } <tree_expression_type> +%destructor { delete $$; } <tree_constant_type> +%destructor { delete $$; } <tree_fcn_handle_type> +%destructor { delete $$; } <tree_anon_fcn_handle_type> +%destructor { delete $$; } <tree_identifier_type> +%destructor { delete $$; } <tree_index_expression_type> +%destructor { delete $$; } <tree_colon_expression_type> +%destructor { delete $$; } <tree_argument_list_type> +%destructor { delete $$; } <tree_parameter_list_type> +%destructor { delete $$; } <tree_command_type> +%destructor { delete $$; } <tree_if_command_type> +%destructor { delete $$; } <tree_if_clause_type> +%destructor { delete $$; } <tree_if_command_list_type> +%destructor { delete $$; } <tree_switch_command_type> +%destructor { delete $$; } <tree_switch_case_type> +%destructor { delete $$; } <tree_switch_case_list_type> +%destructor { delete $$; } <tree_decl_elt_type> +%destructor { delete $$; } <tree_decl_init_list_type> +%destructor { delete $$; } <tree_decl_command_type> +%destructor { delete $$; } <tree_statement_type> +%destructor { delete $$; } <tree_statement_list_type> +%destructor { delete $$; } <octave_user_function_type> + +%destructor { + warning_with_id + ("Octave:parser-destructor", + "possible memory leak in cleanup following parse error"); + } <*> // Where to start. %start input