From: Ian Jackson Date: Tue, 1 Jan 2008 20:32:00 +0000 (+0000) Subject: ports to new c++ in lenny X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ian/git?p=moebius2.git;a=commitdiff_plain;h=5d7d80c871a0e44729c520e76063369482316636 ports to new c++ in lenny --- diff --git a/.bzrignore b/.bzrignore index 8935d75..e8f4874 100644 --- a/.bzrignore +++ b/.bzrignore @@ -4,3 +4,5 @@ initial view best *.d +*.tmp +*.new diff --git a/Makefile b/Makefile index c40fb32..12f1eee 100644 --- a/Makefile +++ b/Makefile @@ -2,7 +2,7 @@ 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) diff --git a/bgl.cpp b/bgl.cpp index 325617e..cbe45b5 100644 --- a/bgl.cpp +++ b/bgl.cpp @@ -47,8 +47,6 @@ extern "C" { #define VMASK (YMASK|XMASK) #define ESHIFT (YBITS+XBITS) -class Graph { }; // this is a dummy as our graph has no actual representation - using namespace boost; /* @@ -105,6 +103,8 @@ class OutEdgeIterator : typedef counting_iterator 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 has lots of stuff. @@ -115,6 +115,7 @@ namespace boost { public virtual vertex_list_graph_tag, public virtual edge_list_graph_tag { }; + template<> struct graph_traits { // Concept Graph: typedef int vertex_descriptor; /* vertex number, -1 => none */ @@ -152,7 +153,8 @@ namespace boost { } // Concept VertexListGraph: - inline std::pair vertices(const Graph&) { + inline + std::pair vertices(const Graph&) { 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 cfa3975..742db80 100644 --- 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; - 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]; @@ -148,7 +148,7 @@ static void drawtriangle(const Triangle *t) { 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];