[llvm-commits] CVS: llvm-test/MultiSource/Benchmarks/Prolangs-C++/fsm/fsm.cpp

Chris Lattner lattner at cs.uiuc.edu
Mon Oct 4 18:06:31 PDT 2004



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

fsm.cpp updated: 1.1 -> 1.2
---
Log message:

Make this sorta work


---
Diffs of the changes:  (+5 -5)

Index: llvm-test/MultiSource/Benchmarks/Prolangs-C++/fsm/fsm.cpp
diff -u llvm-test/MultiSource/Benchmarks/Prolangs-C++/fsm/fsm.cpp:1.1 llvm-test/MultiSource/Benchmarks/Prolangs-C++/fsm/fsm.cpp:1.2
--- llvm-test/MultiSource/Benchmarks/Prolangs-C++/fsm/fsm.cpp:1.1	Mon Oct  4 15:01:14 2004
+++ llvm-test/MultiSource/Benchmarks/Prolangs-C++/fsm/fsm.cpp	Mon Oct  4 20:06:18 2004
@@ -44,8 +44,8 @@
       max_node = e->to;
   }
   graph = new state[max_node+1]; // was new state[max_node+1]
-  for (e=p; e->from; ++e)
-    graph[e->from].transition[e->input] = &graph[e->to];
+  for (triple *e=p; e->from; ++e)
+    graph[e->from].transition[(int)e->input] = &graph[e->to];
   current = 0;
 }
 
@@ -59,7 +59,7 @@
 
 void fsm::advance(char x) {
   if (current)
-    current = current->transition[x];
+    current = current->transition[(int)x];
 }
 
 int fsm::end_state() {
@@ -76,14 +76,14 @@
   sample();
 };
 
-triple sample::edges[] = {{1,'A',2}, {1, 'B', 3}};
+triple sample::edges[3] = {{1,2,'A'}, {1, 3, 'B'}};
 
 sample::sample() : fsm(edges) {
 }
 
 #include <stdio.h>
 
-main() {
+int main() {
   char input_string[80];
   printf("Enter input expression: ");
   scanf("%s", input_string);






More information about the llvm-commits mailing list