lilypond-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

TODO #1


From: David Brandon
Subject: TODO #1
Date: Mon, 26 Apr 2004 21:38:59 -0400

As a way of learning my way around the code, I thought I'd work on some of the things marked TODO. Here's the first one, a relatively trivial patch inlining some functions.

By the way, is there a documentation tool in use for the C++ code? I thought I might document some things as a way of learning about them.

Thanks,
David

Index: flower/axis.cc
===================================================================
RCS file: /cvsroot/lilypond/lilypond/flower/axis.cc,v
retrieving revision 1.12
diff -u -r1.12 axis.cc
--- flower/axis.cc      5 Feb 2004 14:55:16 -0000       1.12
+++ flower/axis.cc      26 Apr 2004 21:48:51 -0000
@@ -6,7 +6,6 @@
   (c) 1997--2004 Han-Wen Nienhuys <address@hidden>
 */

-#include <assert.h>
 #include "axes.hh"
 #include "string.hh"

@@ -22,24 +21,3 @@
 {
   return a ==  Y_AXIS ? X_AXIS : Y_AXIS;
 }
-
-/*
-  TODO inline these.
- */
-Axis
-post_incr (Axis &a)
-{
-  assert (a < NO_AXES);
-  Axis b= a;
-  a = Axis (int (a) + 1);
-  return b;
-}
-
-Axis
-incr (Axis &a)
-{
-  assert (a < NO_AXES);
-  a = Axis (int (a) + 1);
-  return a;
-}
-
Index: flower/include/axes.hh
===================================================================
RCS file: /cvsroot/lilypond/lilypond/flower/include/axes.hh,v
retrieving revision 1.12
diff -u -r1.12 axes.hh
--- flower/include/axes.hh      5 Feb 2004 14:55:17 -0000       1.12
+++ flower/include/axes.hh      26 Apr 2004 21:48:51 -0000
@@ -10,6 +10,8 @@
 #ifndef AXES_HH
 #define AXES_HH

+#include <assert.h>
+
 enum Axis {
     X_AXIS =0,
     Y_AXIS =1,
@@ -26,10 +28,25 @@
   the operator ++ for Axis.
  */
 Axis other_axis (Axis);
-Axis post_incr (Axis &);
-Axis incr (Axis &);
-//Axis operator++ (Axis);
-

+static inline
+Axis
+post_incr (Axis &a)
+{
+  assert (a < NO_AXES);
+  Axis b= a;
+  a = Axis (int (a) + 1);
+  return b;
+}
+
+static inline
+Axis
+incr (Axis &a)
+{
+  assert (a < NO_AXES);
+  a = Axis (int (a) + 1);
+  return a;
+}
+//Axis operator++ (Axis);

 #endif // AXES_HH



--
David Brandon/address@hidden
Ask your doctor if David Brandon is right for you.





reply via email to

[Prev in Thread] Current Thread [Next in Thread]