[llvm-commits] CVS: llvm-test/MultiSource/Benchmarks/Prolangs-C++/city/check_functions.cpp intersection.cpp intersection.h main.cpp roadlet.h vehicle.cpp vehicle.h

Chris Lattner lattner at cs.uiuc.edu
Mon Oct 4 14:19:41 PDT 2004



Changes in directory llvm-test/MultiSource/Benchmarks/Prolangs-C++/city:

check_functions.cpp updated: 1.1 -> 1.2
intersection.cpp updated: 1.1 -> 1.2
intersection.h updated: 1.1 -> 1.2
main.cpp updated: 1.2 -> 1.3
roadlet.h updated: 1.2 -> 1.3
vehicle.cpp updated: 1.1 -> 1.2
vehicle.h updated: 1.2 -> 1.3
---
Log message:

Stab stab stab, we now compile this


---
Diffs of the changes:  (+37 -35)

Index: llvm-test/MultiSource/Benchmarks/Prolangs-C++/city/check_functions.cpp
diff -u llvm-test/MultiSource/Benchmarks/Prolangs-C++/city/check_functions.cpp:1.1 llvm-test/MultiSource/Benchmarks/Prolangs-C++/city/check_functions.cpp:1.2
--- llvm-test/MultiSource/Benchmarks/Prolangs-C++/city/check_functions.cpp:1.1	Mon Oct  4 15:01:12 2004
+++ llvm-test/MultiSource/Benchmarks/Prolangs-C++/city/check_functions.cpp	Mon Oct  4 16:19:29 2004
@@ -27,7 +27,7 @@
 //check both left and right.  This makes sense for roads of two or fewer lanes.
 roadlet * lane_switch_ok(roadlet *r, vehicle *v, direction d)
 {
-    direction dir = v->direction();
+    direction dir = v->get_direction();
     //cout << "dir = " << dir << "\n";
     cout << "lane switch for " << *v << " at " << *r <<'\n';
 
@@ -55,7 +55,7 @@
 //f from notes
 roadlet * strait (roadlet *r, vehicle *v, direction d)
 {
-    if (!r->occupied() && (v->direction() == d))
+    if (!r->occupied() && (v->get_direction() == d))
 	return(r);
     else
 	return(NULL);
@@ -68,7 +68,7 @@
 roadlet * strait_or_left (roadlet *r, vehicle *v, direction d)
 {
     if (!r->occupied() && 
-          ((v->direction() == d) || (v->direction().left() == d)))
+          ((v->get_direction() == d) || (v->get_direction().left() == d)))
 	return(r);
     else
 	return(NULL);
@@ -79,7 +79,7 @@
 roadlet * strait_or_right (roadlet *r, vehicle *v, direction d)
 {
     if (!r->occupied() && 
-          ((v->direction() == d) || (v->direction().right() == d)))
+          ((v->get_direction() == d) || (v->get_direction().right() == d)))
 	return(r);
     else
 	return(NULL);
@@ -89,14 +89,14 @@
 {
     if ((d == N) || (d == S))
     {
-	if (!r->occupied() && (r->light()->greenNS()))
+	if (!r->occupied() && (r->get_light()->greenNS()))
 	    return(r);
         else
 	    return(NULL);
     }
     else
     {
-	if (!r->occupied() && (r->light()->greenEW()))
+	if (!r->occupied() && (r->get_light()->greenEW()))
 	    return(r);
         else
 	    return(NULL);
@@ -115,13 +115,13 @@
 
     if ((d == N) || (d == S))
     {
-        right_on_red = (r->light()->redNS()) ; // && no on coming traffic 
-	green_light = r->light()->greenNS();
+        right_on_red = (r->get_light()->redNS()) ; // && no on coming traffic 
+	green_light = r->get_light()->greenNS();
     }
     else
     {
-        right_on_red = (r->light()->redEW()) ; // && no on coming traffic 
-	green_light = r->light()->greenEW();
+        right_on_red = (r->get_light()->redEW()) ; // && no on coming traffic 
+	green_light = r->get_light()->greenEW();
     }
        
 


Index: llvm-test/MultiSource/Benchmarks/Prolangs-C++/city/intersection.cpp
diff -u llvm-test/MultiSource/Benchmarks/Prolangs-C++/city/intersection.cpp:1.1 llvm-test/MultiSource/Benchmarks/Prolangs-C++/city/intersection.cpp:1.2
--- llvm-test/MultiSource/Benchmarks/Prolangs-C++/city/intersection.cpp:1.1	Mon Oct  4 15:01:13 2004
+++ llvm-test/MultiSource/Benchmarks/Prolangs-C++/city/intersection.cpp	Mon Oct  4 16:19:30 2004
@@ -1,56 +1,56 @@
 // build_intersection.cc
 
 #include "intersection.h"
-extern "C" char *malloc();
+#include <cstdlib>
 
 
 void intersection_4x4::connectNin (roadlet *leftlane, roadlet *rightlane)
 {
-    connect(leftlane, S, roadlets[0][1], N, green_light);
-    connect(rightlane, S, roadlets[0][0], N, green_OR_plan_rightONred);
+    connect(leftlane, S, roadlets[0][1], N, (filter_fn)green_light);
+    connect(rightlane, S, roadlets[0][0], N, (filter_fn)green_OR_plan_rightONred);
 }
 
 void intersection_4x4::connectEin (roadlet *leftlane, roadlet *rightlane)
 {
-    connect(leftlane, W, roadlets[1][3], E, green_light);
-    connect(rightlane, W, roadlets[0][3], E, green_OR_plan_rightONred);
+    connect(leftlane, W, roadlets[1][3], E, (filter_fn)green_light);
+    connect(rightlane, W, roadlets[0][3], E, (filter_fn)green_OR_plan_rightONred);
 }
 
 void intersection_4x4::connectSin (roadlet *leftlane, roadlet *rightlane)
 {
-    connect(leftlane, N, roadlets[3][2], S, green_light);
-    connect(rightlane, N, roadlets[3][3], S, green_OR_plan_rightONred);
+    connect(leftlane, N, roadlets[3][2], S, (filter_fn)green_light);
+    connect(rightlane, N, roadlets[3][3], S, (filter_fn)green_OR_plan_rightONred);
 }
 
 void intersection_4x4::connectWin (roadlet *leftlane, roadlet *rightlane)
 {
-    connect(leftlane, E, roadlets[2][0], W, green_light);
-    connect(rightlane, E, roadlets[3][0], W, green_OR_plan_rightONred);
+    connect(leftlane, E, roadlets[2][0], W, (filter_fn)green_light);
+    connect(rightlane, E, roadlets[3][0], W, (filter_fn)green_OR_plan_rightONred);
 }
 
 void intersection_4x4::connectNout(roadlet *leftlane, roadlet *rightlane)
 {
-    connect(roadlets[0][2], N, leftlane, S, strait);
-    connect(roadlets[0][3], N, rightlane, S, strait_or_right);
+    connect(roadlets[0][2], N, leftlane, S,(filter_fn) strait);
+    connect(roadlets[0][3], N, rightlane, S, (filter_fn)strait_or_right);
 }
 void intersection_4x4::connectEout(roadlet *leftlane, roadlet *rightlane)
 {
-    connect(roadlets[2][3], E, leftlane, W, strait);
-    connect(roadlets[3][3], E, rightlane, W, strait_or_right);
+    connect(roadlets[2][3], E, leftlane, W, (filter_fn)strait);
+    connect(roadlets[3][3], E, rightlane, W, (filter_fn)strait_or_right);
 }
 void intersection_4x4::connectSout(roadlet *leftlane, roadlet *rightlane)
 {
-    connect(roadlets[3][1], S, leftlane, N, strait);
-    connect(roadlets[3][0], S, rightlane, N, strait_or_right);
+    connect(roadlets[3][1], S, leftlane, N, (filter_fn)strait);
+    connect(roadlets[3][0], S, rightlane, N, (filter_fn)strait_or_right);
 }
 void intersection_4x4::connectWout(roadlet *leftlane, roadlet *rightlane)
 {
-    connect(roadlets[1][0], W, leftlane, E, strait);
-    connect(roadlets[0][0], W, rightlane, E, strait_or_right);
+    connect(roadlets[1][0], W, leftlane, E, (filter_fn)strait);
+    connect(roadlets[0][0], W, rightlane, E, (filter_fn)strait_or_right);
 }
 
 
-intersection_4x4::intersection_4x4(char *name)
+intersection_4x4::intersection_4x4(char *name)
 {
     char *buff;
 
@@ -64,7 +64,7 @@
     for(i=0; i<4; i++)
 	for(j=0; j<4; j++)
 	{
-	    buff = malloc(strlen(name) + 7);
+	    buff = (char*)malloc(strlen(name) + 7);
 	    sprintf(buff, "%s %d %d", name, i, j);
 	    roadlets[i][j] = new intersection_roadlet(buff, l);
 	}


Index: llvm-test/MultiSource/Benchmarks/Prolangs-C++/city/intersection.h
diff -u llvm-test/MultiSource/Benchmarks/Prolangs-C++/city/intersection.h:1.1 llvm-test/MultiSource/Benchmarks/Prolangs-C++/city/intersection.h:1.2
--- llvm-test/MultiSource/Benchmarks/Prolangs-C++/city/intersection.h:1.1	Mon Oct  4 15:01:13 2004
+++ llvm-test/MultiSource/Benchmarks/Prolangs-C++/city/intersection.h	Mon Oct  4 16:19:30 2004
@@ -16,12 +16,14 @@
 	            roadlet *, direction, 
 	            roadlet * (*r1_to_r2_filter_function)(roadlet *, vehicle *, direction));
 
+typedef roadlet * (*filter_fn)(roadlet *, vehicle *, direction);
+
 class intersection
 {
 protected:
     light *the_light;
 public:
-    light *light() {return (the_light);};
+    light *get_light() {return (the_light);};
 };
 
 class intersection_2x2 : public intersection


Index: llvm-test/MultiSource/Benchmarks/Prolangs-C++/city/main.cpp
diff -u llvm-test/MultiSource/Benchmarks/Prolangs-C++/city/main.cpp:1.2 llvm-test/MultiSource/Benchmarks/Prolangs-C++/city/main.cpp:1.3
--- llvm-test/MultiSource/Benchmarks/Prolangs-C++/city/main.cpp:1.2	Mon Oct  4 16:08:35 2004
+++ llvm-test/MultiSource/Benchmarks/Prolangs-C++/city/main.cpp	Mon Oct  4 16:19:30 2004
@@ -79,7 +79,7 @@
 
     for(i=0; i< 100000; i++)
     {
-        i1.light()->tick();
+        i1.get_light()->tick();
     }
 
 


Index: llvm-test/MultiSource/Benchmarks/Prolangs-C++/city/roadlet.h
diff -u llvm-test/MultiSource/Benchmarks/Prolangs-C++/city/roadlet.h:1.2 llvm-test/MultiSource/Benchmarks/Prolangs-C++/city/roadlet.h:1.3
--- llvm-test/MultiSource/Benchmarks/Prolangs-C++/city/roadlet.h:1.2	Mon Oct  4 16:08:35 2004
+++ llvm-test/MultiSource/Benchmarks/Prolangs-C++/city/roadlet.h	Mon Oct  4 16:19:30 2004
@@ -49,7 +49,7 @@
 
 public:
     intersection_roadlet(char *name, light *alight) : roadlet(name) {l = alight;} ;
-    light *light() { return(l);};
+    light *get_light() { return(l);};
 };
 
 #endif


Index: llvm-test/MultiSource/Benchmarks/Prolangs-C++/city/vehicle.cpp
diff -u llvm-test/MultiSource/Benchmarks/Prolangs-C++/city/vehicle.cpp:1.1 llvm-test/MultiSource/Benchmarks/Prolangs-C++/city/vehicle.cpp:1.2
--- llvm-test/MultiSource/Benchmarks/Prolangs-C++/city/vehicle.cpp:1.1	Mon Oct  4 15:01:13 2004
+++ llvm-test/MultiSource/Benchmarks/Prolangs-C++/city/vehicle.cpp	Mon Oct  4 16:19:30 2004
@@ -13,7 +13,7 @@
 
 ostream& operator<<(ostream& o, vehicle v)
 {
-    o << v.name << " at " << *(v.location) << " going " << v.direction();
+    o << v.name << " at " << *(v.location) << " going " << v.get_direction();
     return (o);
 }
 
@@ -68,7 +68,7 @@
 
     possible_moves = location->moves();
 
-    for(used=0, dir=N; dir<=NW; dir ++)
+    for(used=0, dir=N; dir<=NW; ++dir)
     {
 	// cout << "possible_moves[" << dir << "] " << possible_moves[dir.as_int()] << '\n';
 	if (possible_moves[dir.as_int()](location->neighbor(dir), this, dir) != NULL)


Index: llvm-test/MultiSource/Benchmarks/Prolangs-C++/city/vehicle.h
diff -u llvm-test/MultiSource/Benchmarks/Prolangs-C++/city/vehicle.h:1.2 llvm-test/MultiSource/Benchmarks/Prolangs-C++/city/vehicle.h:1.3
--- llvm-test/MultiSource/Benchmarks/Prolangs-C++/city/vehicle.h:1.2	Mon Oct  4 16:08:35 2004
+++ llvm-test/MultiSource/Benchmarks/Prolangs-C++/city/vehicle.h	Mon Oct  4 16:19:30 2004
@@ -30,7 +30,7 @@
 
     int plan;
 
-    direction direction() {return (dir);};
+    direction get_direction() {return (dir);};
     void set_location(roadlet *r)  {location = r;};
 
     void tick();






More information about the llvm-commits mailing list