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

Chris Lattner lattner at cs.uiuc.edu
Mon Oct 4 14:08:48 PDT 2004



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

broken_light.h updated: 1.1 -> 1.2
check_functions.h updated: 1.1 -> 1.2
light.h updated: 1.1 -> 1.2
main.cpp updated: 1.1 -> 1.2
roadlet.cpp updated: 1.1 -> 1.2
roadlet.h updated: 1.1 -> 1.2
vehicle.h updated: 1.1 -> 1.2
---
Log message:

A few stabs at making this compile


---
Diffs of the changes:  (+18 -21)

Index: llvm-test/MultiSource/Benchmarks/Prolangs-C++/city/broken_light.h
diff -u llvm-test/MultiSource/Benchmarks/Prolangs-C++/city/broken_light.h:1.1 llvm-test/MultiSource/Benchmarks/Prolangs-C++/city/broken_light.h:1.2
--- llvm-test/MultiSource/Benchmarks/Prolangs-C++/city/broken_light.h:1.1	Mon Oct  4 15:01:12 2004
+++ llvm-test/MultiSource/Benchmarks/Prolangs-C++/city/broken_light.h	Mon Oct  4 16:08:35 2004
@@ -5,7 +5,7 @@
 
 #include "light.h"
 #include "stream.h"
-extern "C" random();
+#include <cstdlib>
 
 #define BROKEN_LIGHT_ID 1
 
@@ -17,7 +17,7 @@
     broken_light(int t1, int t2, int t3, int t4) : light (t1,t2,t3,t4){};
 };
 
-inline virtual int broken_light::next_state()
+inline int broken_light::next_state()
 {
     cout << "next state called\n";
     if ((random() % 4) == 1)


Index: llvm-test/MultiSource/Benchmarks/Prolangs-C++/city/check_functions.h
diff -u llvm-test/MultiSource/Benchmarks/Prolangs-C++/city/check_functions.h:1.1 llvm-test/MultiSource/Benchmarks/Prolangs-C++/city/check_functions.h:1.2
--- llvm-test/MultiSource/Benchmarks/Prolangs-C++/city/check_functions.h:1.1	Mon Oct  4 15:01:13 2004
+++ llvm-test/MultiSource/Benchmarks/Prolangs-C++/city/check_functions.h	Mon Oct  4 16:08:35 2004
@@ -18,4 +18,4 @@
 extern roadlet *green_light(intersection_roadlet*, vehicle*, direction);
 extern roadlet *green_OR_plan_rightONred(intersection_roadlet*, vehicle*, direction);
 
-#endif _check_function
+#endif 


Index: llvm-test/MultiSource/Benchmarks/Prolangs-C++/city/light.h
diff -u llvm-test/MultiSource/Benchmarks/Prolangs-C++/city/light.h:1.1 llvm-test/MultiSource/Benchmarks/Prolangs-C++/city/light.h:1.2
--- llvm-test/MultiSource/Benchmarks/Prolangs-C++/city/light.h:1.1	Mon Oct  4 15:01:13 2004
+++ llvm-test/MultiSource/Benchmarks/Prolangs-C++/city/light.h	Mon Oct  4 16:08:35 2004
@@ -2,7 +2,8 @@
 
 #ifndef _light_h
 #define _light_h
-#include "ostream.h"
+#include <iostream>
+using namespace std;
 
 #define LIGHT_ID 0
 
@@ -23,12 +24,12 @@
     light(int t1, int t2, int t3, int t4) {init(t1,t2,t3,t4);};
 
     void tick();
-    redNS()	{return ((current_state == 0) || (current_state == 1));};
-    yellowNS()	{return (current_state == 3);};
-    greenNS()	{return (current_state == 2);};
-    redEW()	{return ((current_state == 2) || (current_state == 3));};
-    yellowEW()	{return (current_state == 1);};
-    greenEW()	{return (current_state == 0);};
+    int redNS()	{return ((current_state == 0) || (current_state == 1));};
+    int yellowNS()	{return (current_state == 3);};
+    int greenNS()	{return (current_state == 2);};
+    int redEW()	{return ((current_state == 2) || (current_state == 3));};
+    int yellowEW()	{return (current_state == 1);};
+    int greenEW()	{return (current_state == 0);};
     friend ostream& operator<< (ostream &, light);
 };
 typedef light light_type;


Index: llvm-test/MultiSource/Benchmarks/Prolangs-C++/city/main.cpp
diff -u llvm-test/MultiSource/Benchmarks/Prolangs-C++/city/main.cpp:1.1 llvm-test/MultiSource/Benchmarks/Prolangs-C++/city/main.cpp:1.2
--- llvm-test/MultiSource/Benchmarks/Prolangs-C++/city/main.cpp:1.1	Mon Oct  4 15:01:13 2004
+++ llvm-test/MultiSource/Benchmarks/Prolangs-C++/city/main.cpp	Mon Oct  4 16:08:35 2004
@@ -7,11 +7,7 @@
 #include "roadlet.h"
 #include "check_functions.h"
 #include "intersection.h"
-extern "C" 
-{
-    void *malloc();
-    void srandom(int);
-}
+#include <cstdlib>
 
 
 // connect r1->d1 to r2->d2


Index: llvm-test/MultiSource/Benchmarks/Prolangs-C++/city/roadlet.cpp
diff -u llvm-test/MultiSource/Benchmarks/Prolangs-C++/city/roadlet.cpp:1.1 llvm-test/MultiSource/Benchmarks/Prolangs-C++/city/roadlet.cpp:1.2
--- llvm-test/MultiSource/Benchmarks/Prolangs-C++/city/roadlet.cpp:1.1	Mon Oct  4 15:01:13 2004
+++ llvm-test/MultiSource/Benchmarks/Prolangs-C++/city/roadlet.cpp	Mon Oct  4 16:08:35 2004
@@ -1,6 +1,6 @@
 // roadlet.cc
 
-#include <stream.h>
+#include <iostream>
 #include "roadlet.h"
 
 void roadlet::init(char *n)      
@@ -11,7 +11,7 @@
 }
 
 
-ostream& operator<<(ostream& o, roadlet r)
+std::ostream& operator<<(std::ostream& o, roadlet r)
 {
     o << "roadlet " << r.name;
     return (o);


Index: llvm-test/MultiSource/Benchmarks/Prolangs-C++/city/roadlet.h
diff -u llvm-test/MultiSource/Benchmarks/Prolangs-C++/city/roadlet.h:1.1 llvm-test/MultiSource/Benchmarks/Prolangs-C++/city/roadlet.h:1.2
--- llvm-test/MultiSource/Benchmarks/Prolangs-C++/city/roadlet.h:1.1	Mon Oct  4 15:01:13 2004
+++ llvm-test/MultiSource/Benchmarks/Prolangs-C++/city/roadlet.h	Mon Oct  4 16:08:35 2004
@@ -19,12 +19,12 @@
 
 protected:
     char *name;
-    vehicle *occupant = NULL;
-    roadlet *neighbors[8] = { NULL };
+    vehicle *occupant;
+    roadlet *neighbors[8];
     move_function the_moves[8];
 
 public:
-    roadlet()                { init("unnamed");};
+    roadlet() : occupant(NULL) { neighbors[0] = neighbors[1] = neighbors[2] = neighbors[3] = neighbors[4] = neighbors[5] = neighbors[6] = neighbors[7] = 0;  init("unnamed");};
     roadlet(char *n)         { init(n);};
     int occupied()           { return(occupiedby() != NULL);};
     vehicle *occupiedby()    {return(occupant);};


Index: llvm-test/MultiSource/Benchmarks/Prolangs-C++/city/vehicle.h
diff -u llvm-test/MultiSource/Benchmarks/Prolangs-C++/city/vehicle.h:1.1 llvm-test/MultiSource/Benchmarks/Prolangs-C++/city/vehicle.h:1.2
--- llvm-test/MultiSource/Benchmarks/Prolangs-C++/city/vehicle.h:1.1	Mon Oct  4 15:01:13 2004
+++ llvm-test/MultiSource/Benchmarks/Prolangs-C++/city/vehicle.h	Mon Oct  4 16:08:35 2004
@@ -8,7 +8,7 @@
 class vehicle
 {
 private:
-    const int DEFAULT_SPEED = 100;
+    enum { DEFAULT_SPEED = 100 };
     roadlet *location;
     char *name;
     int speed;






More information about the llvm-commits mailing list