chiark / gitweb /
ports to new c++ in lenny
authorIan Jackson <ian@davenant.greenend.org.uk>
Tue, 1 Jan 2008 20:32:00 +0000 (20:32 +0000)
committerIan Jackson <ian@davenant.greenend.org.uk>
Tue, 1 Jan 2008 20:32:00 +0000 (20:32 +0000)
.bzrignore
Makefile
bgl.cpp
view.c

index 8935d75ca60423bc26fac55f8a4b7b2bc25fdd1a..e8f48742a36146c9f79c1d91c4f60b8815a2255b 100644 (file)
@@ -4,3 +4,5 @@ initial
 view
 best
 *.d
 view
 best
 *.d
+*.tmp
+*.new
index c40fb3285be394a1b0c70a874699bbdb4d4d2254..12f1eee73edbf688c5a3ca3c1f86e273813191d4 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -2,7 +2,7 @@
 TARGETS= minimise primer initial view
 
 CWARNS=        -Wall -Wwrite-strings -Wpointer-arith -Werror -Wshadow
 TARGETS= minimise primer initial view
 
 CWARNS=        -Wall -Wwrite-strings -Wpointer-arith -Werror -Wshadow
-CXXWARNS= $(CWARNS) -Wno-shadow
+CXXWARNS= $(CWARNS) -Wno-shadow -Wno-error
 
 OPTIMISE=      -O2
 CFLAGS=                -MMD $(OPTIMISE) -g $(CWARNS)
 
 OPTIMISE=      -O2
 CFLAGS=                -MMD $(OPTIMISE) -g $(CWARNS)
diff --git a/bgl.cpp b/bgl.cpp
index 325617eca59b114fff476833f347eeb3cc718e90..cbe45b52d798865b2ad1ce0b7ad09218cd689ed7 100644 (file)
--- a/bgl.cpp
+++ b/bgl.cpp
@@ -47,8 +47,6 @@ extern "C" {
 #define VMASK (YMASK|XMASK)
 #define ESHIFT (YBITS+XBITS)
 
 #define VMASK (YMASK|XMASK)
 #define ESHIFT (YBITS+XBITS)
 
-class Graph { }; // this is a dummy as our graph has no actual representation
-
 using namespace boost;
 
 /*
 using namespace boost;
 
 /*
@@ -105,6 +103,8 @@ class OutEdgeIterator :
 typedef counting_iterator<int> VertexIterator;
 
 namespace boost {
 typedef counting_iterator<int> VertexIterator;
 
 namespace boost {
+  class Graph { }; // this is a dummy as our graph has no actual representation
+
   // We make Graph a model of various BGL Graph concepts.
   // This mainly means that graph_traits<Graph> has lots of stuff.
 
   // We make Graph a model of various BGL Graph concepts.
   // This mainly means that graph_traits<Graph> has lots of stuff.
 
@@ -115,6 +115,7 @@ namespace boost {
     public virtual vertex_list_graph_tag,
     public virtual edge_list_graph_tag { };
 
     public virtual vertex_list_graph_tag,
     public virtual edge_list_graph_tag { };
 
+  template<>
   struct graph_traits<Graph> {
     // Concept Graph:
     typedef int vertex_descriptor; /* vertex number, -1 => none */
   struct graph_traits<Graph> {
     // Concept Graph:
     typedef int vertex_descriptor; /* vertex number, -1 => none */
@@ -152,7 +153,8 @@ namespace boost {
   }
 
   // Concept VertexListGraph:
   }
 
   // Concept VertexListGraph:
-  inline std::pair<VertexIterator,VertexIterator> vertices(const Graph&) {
+  inline
+  std::pair<VertexIterator,VertexIterator> vertices(const Graph&) {
     return std::make_pair(VertexIterator(0), VertexIterator(N));
   }
   inline unsigned num_vertices(const Graph&) { return N; }
     return std::make_pair(VertexIterator(0), VertexIterator(N));
   }
   inline unsigned num_vertices(const Graph&) { return N; }
diff --git a/view.c b/view.c
index cfa39753f1e89d29329ce115d1328c98c9914f57..742db8075e6d3e9df854397fd4441079673d5d79 100644 (file)
--- a/view.c
+++ b/view.c
@@ -107,7 +107,7 @@ static void generate_display_list(void) {
 static int dl_compare(const void *tav, const void *tbv) {
   int i;
   const Triangle *const *tap= tav, *ta= *tap;
 static int dl_compare(const void *tav, const void *tbv) {
   int i;
   const Triangle *const *tap= tav, *ta= *tap;
-  const Triangle *const *tbp= tbp, *tb= *tbp;
+  const Triangle *const *tbp= tbv, *tb= *tbp;
   double za=0, zb=0;
   for (i=0; i<3; i++) {
     za += ta->vertex[i][2];
   double za=0, zb=0;
   for (i=0; i<3; i++) {
     za += ta->vertex[i][2];
@@ -148,7 +148,7 @@ static void drawtriangle(const Triangle *t) {
   int i;
 
   for (i=0; i<3; i++) {
   int i;
 
   for (i=0; i<3; i++) {
-    double *v= t->vertex[i];
+    const double *v= t->vertex[i];
     double x= v[0];
     double y= v[1];
     double z= v[2];
     double x= v[0];
     double y= v[1];
     double z= v[2];