[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Issue 4156: Define Smob<> constructors. (issue 152370043 by address@hidd
From: |
nine . fierce . ballads |
Subject: |
Issue 4156: Define Smob<> constructors. (issue 152370043 by address@hidden) |
Date: |
Wed, 08 Oct 2014 04:25:59 +0000 |
Reviewers: ,
Description:
Define Smob<> constructors.
https://code.google.com/p/lilypond/issues/detail?id=4156
Please review this at https://codereview.appspot.com/152370043/
Affected files (+53, -26 lines):
M lily/book.cc
M lily/context.cc
M lily/context-def.cc
M lily/font-metric.cc
M lily/grob.cc
M lily/include/book.hh
M lily/include/context.hh
M lily/include/context-def.hh
M lily/include/font-metric.hh
M lily/include/grob.hh
M lily/include/lily-parser.hh
M lily/include/music-iterator.hh
M lily/include/output-def.hh
M lily/include/page-marker.hh
M lily/include/prob.hh
M lily/include/scale.hh
M lily/include/scm-hash.hh
M lily/include/score.hh
M lily/include/smobs.hh
M lily/include/translator.hh
M lily/lily-parser.cc
M lily/music-iterator.cc
M lily/output-def.cc
M lily/page-marker.cc
M lily/prob.cc
M lily/scale.cc
M lily/scm-hash.cc
M lily/score.cc
M lily/translator.cc
Index: lily/book.cc
diff --git a/lily/book.cc b/lily/book.cc
index
a6750d78cbf7ac3e43c17bb0b26c8777341de437..75f70814c600ab5c441b686a46399f404b3d6d36
100644
--- a/lily/book.cc
+++ b/lily/book.cc
@@ -47,6 +47,7 @@ Book::Book ()
}
Book::Book (Book const &s)
+ : base_type(s)
{
paper_ = 0;
header_ = SCM_EOL;
Index: lily/context-def.cc
diff --git a/lily/context-def.cc b/lily/context-def.cc
index
24803a5d9484bdf07de0cc5c79d59fdcc0ff5aec..b9bd66b5ae66899d14630d96870266e08f2e4fc7
100644
--- a/lily/context-def.cc
+++ b/lily/context-def.cc
@@ -54,6 +54,7 @@ Context_def::origin () const
}
Context_def::Context_def (Context_def const &s)
+ : base_type(s)
{
context_aliases_ = SCM_EOL;
translator_group_type_ = SCM_EOL;
Index: lily/context.cc
diff --git a/lily/context.cc b/lily/context.cc
index
3128f5955ade258df4531381b57a2237e7143052..29872610037efe9bb49f3caba1f69ac8cfbe08a0
100644
--- a/lily/context.cc
+++ b/lily/context.cc
@@ -56,11 +56,6 @@ Context::check_removal ()
}
}
-Context::Context (Context const & /* src */)
-{
- assert (false);
-}
-
Scheme_hash_table *
Context::properties_dict () const
{
Index: lily/font-metric.cc
diff --git a/lily/font-metric.cc b/lily/font-metric.cc
index
899d80f821166ad95d10f6b0b0e9e11b495c078d..e6c836c5fcdbc48de338d1a5e4bb18a73648b292
100644
--- a/lily/font-metric.cc
+++ b/lily/font-metric.cc
@@ -62,7 +62,8 @@ Font_metric::Font_metric ()
smobify_self ();
}
-Font_metric::Font_metric (Font_metric const &)
+Font_metric::Font_metric (Font_metric const &s)
+ : base_type(s)
{
}
Index: lily/grob.cc
diff --git a/lily/grob.cc b/lily/grob.cc
index
a41ac5d006bd4873fbb3d1eb887e9e0139c12132..b14becf511d1b654e48cedee1f871e6d30b20f38
100644
--- a/lily/grob.cc
+++ b/lily/grob.cc
@@ -92,6 +92,7 @@ Grob::Grob (SCM basicprops)
}
Grob::Grob (Grob const &s)
+ : base_type(s)
{
original_ = (Grob *) & s;
Index: lily/include/book.hh
diff --git a/lily/include/book.hh b/lily/include/book.hh
index
f74d1d981f76e17a54135259adbdd28e6d42b884..0fa78247cba89c4a912b23658093b613c28d1faf
100644
--- a/lily/include/book.hh
+++ b/lily/include/book.hh
@@ -28,6 +28,7 @@
class Book : public Smob<Book>
{
+ typedef Smob<Book> base_type;
public:
SCM mark_smob ();
static const char type_p_name_[];
Index: lily/include/context-def.hh
diff --git a/lily/include/context-def.hh b/lily/include/context-def.hh
index
ba1aad2f2b4cb6f58185acba78ca25d1aefd330a..532d75420c53cf869e3bc83f9bad4be21c17c0ea
100644
--- a/lily/include/context-def.hh
+++ b/lily/include/context-def.hh
@@ -31,8 +31,10 @@
The definition of an interpretation context as given in the
input. The lists are stored in order of definition.
*/
-struct Context_def : public Smob<Context_def>
+class Context_def : public Smob<Context_def>
{
+ typedef Smob<Context_def> base_type;
+public:
SCM mark_smob ();
static int print_smob (SCM, SCM, scm_print_state *);
static const char type_p_name_[];
Index: lily/include/context.hh
diff --git a/lily/include/context.hh b/lily/include/context.hh
index
150996c4e41694ca8ee073ea9a3346aa6d5a61b0..411eb4b1984f6303ca0ce0bc9fc3409e2d43c62c
100644
--- a/lily/include/context.hh
+++ b/lily/include/context.hh
@@ -30,6 +30,7 @@
class Context : public Smob<Context>
{
+ typedef Smob<Context> base_type;
public:
SCM mark_smob ();
static int print_smob (SCM, SCM, scm_print_state *);
@@ -37,7 +38,7 @@ public:
virtual ~Context ();
private:
Scheme_hash_table *properties_dict () const;
- Context (Context const &src);
+ Context (Context const &); // not defined
DECLARE_CLASSNAME (Context);
void terminate ();
Index: lily/include/font-metric.hh
diff --git a/lily/include/font-metric.hh b/lily/include/font-metric.hh
index
e5a2b236be9509ec57c3ddc80dc4c739437bc74d..d9fa25a546a7115a2d6aad1b158d75edd4c60d21
100644
--- a/lily/include/font-metric.hh
+++ b/lily/include/font-metric.hh
@@ -32,6 +32,7 @@ typedef std::map<FT_UInt, FT_ULong> Index_to_charcode_map;
class Font_metric : public Smob<Font_metric>
{
+ typedef Smob<Font_metric> base_type;
public:
static int print_smob (SCM, SCM, scm_print_state *);
SCM mark_smob ();
Index: lily/include/grob.hh
diff --git a/lily/include/grob.hh b/lily/include/grob.hh
index
10d8c794ebeb83f2496b47c11850c1d686af7ba0..2f084bbafd8c58b5df61be5c6a373649f77e8c22
100644
--- a/lily/include/grob.hh
+++ b/lily/include/grob.hh
@@ -29,6 +29,7 @@
class Grob : public Smob<Grob>
{
+ typedef Smob<Grob> base_type;
public:
static int print_smob (SCM, SCM, scm_print_state *);
SCM mark_smob ();
Index: lily/include/lily-parser.hh
diff --git a/lily/include/lily-parser.hh b/lily/include/lily-parser.hh
index
0255b46074ebc9a0d34cc55a3f1adb06c4d58609..78c4a1c4e0af4485a9352d07ed736409b4c504cc
100644
--- a/lily/include/lily-parser.hh
+++ b/lily/include/lily-parser.hh
@@ -31,6 +31,7 @@
*/
class Lily_parser : public Smob<Lily_parser>
{
+ typedef Smob<Lily_parser> base_type;
public:
static int print_smob (SCM, SCM, scm_print_state *);
SCM mark_smob ();
Index: lily/include/music-iterator.hh
diff --git a/lily/include/music-iterator.hh b/lily/include/music-iterator.hh
index
9ca076c6255c1bc0e2566b69ce8dcef7db59c6e2..4be3b6419f26684fac7a6ef2214dea7ebfae6a31
100644
--- a/lily/include/music-iterator.hh
+++ b/lily/include/music-iterator.hh
@@ -60,6 +60,7 @@
*/
class Music_iterator : public Smob<Music_iterator>
{
+ typedef Smob<Music_iterator> base_type;
public:
static int print_smob (SCM, SCM, scm_print_state *);
SCM mark_smob ();
@@ -70,7 +71,6 @@ protected:
Moment start_mom_;
DECLARE_CLASSNAME (Music_iterator);
- Music_iterator (Music_iterator const &);
public:
Moment music_get_length () const;
@@ -98,6 +98,8 @@ public:
protected:
virtual void do_quit ();
void descend_to_child (Context *);
+private:
+ Music_iterator (Music_iterator const &); // not defined
private:
Context_handle handle_;
Index: lily/include/output-def.hh
diff --git a/lily/include/output-def.hh b/lily/include/output-def.hh
index
dc15ba9d0ffc178781377657090d0e127c615446..d9bd2b34ddf5b281240c271be94f6e7c7c8104a5
100644
--- a/lily/include/output-def.hh
+++ b/lily/include/output-def.hh
@@ -48,6 +48,7 @@
*/
class Output_def : public Smob<Output_def>
{
+ typedef Smob<Output_def> base_type;
public:
static int print_smob (SCM, SCM, scm_print_state *);
SCM mark_smob ();
Index: lily/include/page-marker.hh
diff --git a/lily/include/page-marker.hh b/lily/include/page-marker.hh
index
9670b681290ff0e4da2538f08fa9bfc2c8566654..17507ac3561a9029addd2b55bd9f8ca23a28d454
100644
--- a/lily/include/page-marker.hh
+++ b/lily/include/page-marker.hh
@@ -25,6 +25,7 @@
class Page_marker : public Smob<Page_marker>
{
+ typedef Smob<Page_marker> base_type;
public:
SCM mark_smob ();
static const char type_p_name_[];
Index: lily/include/prob.hh
diff --git a/lily/include/prob.hh b/lily/include/prob.hh
index
793d390b08bbf0577d5490622c1fa03e9a4c68d0..4d334b1ec8bf193434a720792b0a4c176909ad30
100644
--- a/lily/include/prob.hh
+++ b/lily/include/prob.hh
@@ -33,6 +33,7 @@
class Prob : public Smob<Prob>
{
+ typedef Smob<Prob> base_type;
public:
static int print_smob (SCM, SCM, scm_print_state *);
SCM mark_smob ();
Index: lily/include/scale.hh
diff --git a/lily/include/scale.hh b/lily/include/scale.hh
index
d3d132810b2d45976f68da318fd469c759c7c8c9..e47b6d09ce504182fd5119ca718d71c2f57a7619
100644
--- a/lily/include/scale.hh
+++ b/lily/include/scale.hh
@@ -24,8 +24,10 @@
#include "rational.hh"
#include "std-vector.hh"
-struct Scale : public Smob<Scale>
+class Scale : public Smob<Scale>
{
+ typedef Smob<Scale> base_type;
+public:
virtual ~Scale ();
Scale (vector<Rational> const &);
Scale (Scale const &);
Index: lily/include/scm-hash.hh
diff --git a/lily/include/scm-hash.hh b/lily/include/scm-hash.hh
index
eea2d1436a21614546b8decf25eeb2357e4b957d..3fd26baad1655b48ccdc0daf752a10057fce419f
100644
--- a/lily/include/scm-hash.hh
+++ b/lily/include/scm-hash.hh
@@ -45,6 +45,7 @@
class Scheme_hash_table : public Smob<Scheme_hash_table>
{
+ typedef Smob<Scheme_hash_table> base_type;
public:
static int print_smob (SCM, SCM, scm_print_state *);
SCM mark_smob ();
Index: lily/include/score.hh
diff --git a/lily/include/score.hh b/lily/include/score.hh
index
e282a5e81be311a8b0edf0409ba943c1fdb0ff1f..b60e33d0c981192a0fce8de331094f1a539c26bc
100644
--- a/lily/include/score.hh
+++ b/lily/include/score.hh
@@ -29,6 +29,7 @@
class Score : public Smob<Score>
{
+ typedef Smob<Score> base_type;
public:
SCM mark_smob ();
static const char type_p_name_[];
Index: lily/include/smobs.hh
diff --git a/lily/include/smobs.hh b/lily/include/smobs.hh
index
f9eeed7f85545e8dc9a5b4c539129bd51a09178c..dd87f565600e80ad7dcefd25a0e9a183c2814aa8
100644
--- a/lily/include/smobs.hh
+++ b/lily/include/smobs.hh
@@ -252,12 +252,6 @@ private:
SCM self_scm_;
SCM protection_cons_;
public:
- SCM unprotected_smobify_self ()
- {
- self_scm_ = SCM_UNDEFINED;
- self_scm_ = Smob_base<Super>::register_ptr (static_cast<Super *>
(this));
- return self_scm_;
- }
void protect ()
{
protect_smob (self_scm_, &protection_cons_);
@@ -267,12 +261,27 @@ public:
unprotect_smob (self_scm_, &protection_cons_);
return self_scm_;
}
- void smobify_self () {
- protection_cons_ = SCM_EOL;
- self_scm_ = unprotected_smobify_self ();
+ SCM self_scm () const { return self_scm_; }
+
+protected:
+ Smob()
+ : self_scm_ (SCM_UNDEFINED),
+ protection_cons_ (SCM_EOL)
+ {
+ }
+ Smob(Smob const &)
+ : self_scm_ (SCM_UNDEFINED),
+ protection_cons_ (SCM_EOL)
+ {
+ }
+ void smobify_self ()
+ {
+ self_scm_ = Smob_base<Super>::register_ptr (static_cast<Super *>
(this));
protect ();
}
- SCM self_scm () const { return self_scm_; }
+
+private:
+ Smob& operator= (Smob const &); // not defined
};
extern bool parsed_objects_should_be_dead;
Index: lily/include/translator.hh
diff --git a/lily/include/translator.hh b/lily/include/translator.hh
index
f7b9677a00d8d4da989c875addfde24d676cb435..cffbf39f12a6a5641adaaa178ce5865425825945
100644
--- a/lily/include/translator.hh
+++ b/lily/include/translator.hh
@@ -119,6 +119,7 @@ enum Translator_precompute_index
*/
class Translator : public Smob<Translator>
{
+ typedef Smob<Translator> base_type;
public:
static int print_smob (SCM, SCM, scm_print_state *);
SCM mark_smob ();
Index: lily/lily-parser.cc
diff --git a/lily/lily-parser.cc b/lily/lily-parser.cc
index
fd1eb489816956d37824aabb2cc07c61d4b4029d..83bbab981dd632e29f856bcf6d11e9dc1216e219
100644
--- a/lily/lily-parser.cc
+++ b/lily/lily-parser.cc
@@ -54,6 +54,7 @@ Lily_parser::Lily_parser (Sources *sources)
}
Lily_parser::Lily_parser (Lily_parser const &src, SCM closures, SCM
location)
+ : base_type(src)
{
lexer_ = 0;
sources_ = src.sources_;
Index: lily/music-iterator.cc
diff --git a/lily/music-iterator.cc b/lily/music-iterator.cc
index
293a91ed4bdd83be22d4768e06f1d669a2440023..4d62aa5bed5dcbd7b546fb7f8a57936f91c792b4
100644
--- a/lily/music-iterator.cc
+++ b/lily/music-iterator.cc
@@ -37,11 +37,6 @@ Music_iterator::Music_iterator ()
smobify_self ();
}
-Music_iterator::Music_iterator (Music_iterator const &)
-{
- assert (false);
-}
-
Music_iterator::~Music_iterator ()
{
}
Index: lily/output-def.cc
diff --git a/lily/output-def.cc b/lily/output-def.cc
index
eeb5a7a84c0d7cf160f2adf2113e3c95ea983d64..519971d385f0767dcbf0216906d6bbd256825f5d
100644
--- a/lily/output-def.cc
+++ b/lily/output-def.cc
@@ -45,6 +45,7 @@ Output_def::Output_def ()
}
Output_def::Output_def (Output_def const &s)
+ : base_type(s)
{
scope_ = SCM_EOL;
parent_ = 0;
Index: lily/page-marker.cc
diff --git a/lily/page-marker.cc b/lily/page-marker.cc
index
78b1b2cefe59cd0113398367213458b866d126e3..c477ab01a46b75a4ce63034b2632ea4d8f6cb489
100644
--- a/lily/page-marker.cc
+++ b/lily/page-marker.cc
@@ -28,6 +28,7 @@ Page_marker::Page_marker ()
}
Page_marker::Page_marker (Page_marker const &src)
+ : base_type(src)
{
symbol_ = src.symbol_;
permission_ = src.permission_;
Index: lily/prob.cc
diff --git a/lily/prob.cc b/lily/prob.cc
index
8829529b7ae77d29893e79ac4c8331f67e58126d..748cad954d43e896274e2a0bfee7dc5605be8e56
100644
--- a/lily/prob.cc
+++ b/lily/prob.cc
@@ -89,6 +89,7 @@ Prob::~Prob ()
}
Prob::Prob (Prob const &src)
+ : base_type(src)
{
immutable_property_alist_ = src.immutable_property_alist_;
mutable_property_alist_ = SCM_EOL;
Index: lily/scale.cc
diff --git a/lily/scale.cc b/lily/scale.cc
index
8bdf02bdf002f185dbb29189dc271320101447bb..326cabbe02f258886209d2ce88a456727153ffb6
100644
--- a/lily/scale.cc
+++ b/lily/scale.cc
@@ -143,6 +143,7 @@ Scale::Scale (vector<Rational> const &tones)
}
Scale::Scale (Scale const &src)
+ : base_type(src)
{
step_tones_ = src.step_tones_;
smobify_self ();
Index: lily/scm-hash.cc
diff --git a/lily/scm-hash.cc b/lily/scm-hash.cc
index
d946f2964ad511fdf596076bab71910d73cca2d1..3111b594264508eaf083393520c769cd71cfa518
100644
--- a/lily/scm-hash.cc
+++ b/lily/scm-hash.cc
@@ -50,6 +50,7 @@ Scheme_hash_table::Scheme_hash_table ()
}
Scheme_hash_table::Scheme_hash_table (Scheme_hash_table const &src)
+ : base_type(src)
{
hash_tab_ = SCM_EOL;
smobify_self ();
Index: lily/score.cc
diff --git a/lily/score.cc b/lily/score.cc
index
6ebad7db9dc1a7e822abc53016d6d1f732d9f6a1..205338d6037c2cc856a475ec7227e6da97a74ff4
100644
--- a/lily/score.cc
+++ b/lily/score.cc
@@ -73,6 +73,7 @@ Score::mark_smob ()
}
Score::Score (Score const &s)
+ : base_type(s)
{
header_ = SCM_EOL;
music_ = SCM_EOL;
Index: lily/translator.cc
diff --git a/lily/translator.cc b/lily/translator.cc
index
4b73b7cd5425b29080abfca51163e6cbb786c4fb..90bf568e5b9352748dd4a3d0b383758a438a1071
100644
--- a/lily/translator.cc
+++ b/lily/translator.cc
@@ -55,8 +55,8 @@ Translator::Translator ()
}
Translator::Translator (Translator const &src)
+ : base_type(src)
{
- (void) src;
init ();
}
- Issue 4156: Define Smob<> constructors. (issue 152370043 by address@hidden),
nine . fierce . ballads <=
- Re: Issue 4156: Define Smob<> constructors. (issue 152370043 by address@hidden), nine . fierce . ballads, 2014/10/08
- Re: Issue 4156: Define Smob<> constructors. (issue 152370043 by address@hidden), lemzwerg, 2014/10/08
- Re: Issue 4156: Define Smob<> constructors. (issue 152370043 by address@hidden), dak, 2014/10/08
- Re: Issue 4156: Define Smob<> constructors. (issue 152370043 by address@hidden), nine . fierce . ballads, 2014/10/08
- Re: Issue 4156: Define Smob<> constructors. (issue 152370043 by address@hidden), dak, 2014/10/08
- Re: Issue 4156: Define Smob<> constructors. (issue 152370043 by address@hidden), nine . fierce . ballads, 2014/10/08
- Re: Issue 4156: Define Smob<> constructors. (issue 152370043 by address@hidden), dak, 2014/10/09
- Re: Issue 4156: Define Smob<> constructors. (issue 152370043 by address@hidden), nine . fierce . ballads, 2014/10/11
- Re: Issue 4156: Define Smob<> constructors. (issue 152370043 by address@hidden), dak, 2014/10/11
- Re: Issue 4156: Define Smob<> constructors. (issue 152370043 by address@hidden), nine . fierce . ballads, 2014/10/18