about summary refs log tree commit diff stats
path: root/cpp
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2015-04-05 19:18:32 -0700
committerKartik K. Agaram <vc@akkartik.com>2015-04-05 19:18:32 -0700
commitc17d559155b3f666a729d6380d9b8236f67bc481 (patch)
tree51ffe10736da978e80b117a971a4e38b5ccdfa3f /cpp
parent267ebb590b0a08d6e8bc9e3f8644b491d0d790ac (diff)
downloadmu-c17d559155b3f666a729d6380d9b8236f67bc481.tar.gz
1019 - stupid error in 'new'
Diffstat (limited to 'cpp')
-rw-r--r--cpp/013run2
-rw-r--r--cpp/029string3
-rw-r--r--cpp/030length1
-rw-r--r--cpp/string-test.mu2
4 files changed, 5 insertions, 3 deletions
diff --git a/cpp/013run b/cpp/013run
index 7296d128..e5da06f3 100644
--- a/cpp/013run
+++ b/cpp/013run
@@ -89,7 +89,7 @@ if (argc > 1) {
   }
 
   Trace_stream = new trace_stream;
-//?   Trace_stream->dump_layer = "all"; //? 1
+//?   Trace_stream->dump_layer = "all"; //? 2
   transform_all();
   recipe_number r = Recipe_number[string("main")];
   if (r) run(r);
diff --git a/cpp/029string b/cpp/029string
index 6778a3c4..9a1a094e 100644
--- a/cpp/029string
+++ b/cpp/029string
@@ -61,7 +61,8 @@ if (instructions[pc].ingredients[0].properties[0].second[0] == "literal-string")
   result.push_back(Current_routine.alloc);
   write_memory(instructions[pc].products[0], result);
   // assume that all characters fit in a single location
-  Memory[Current_routine.alloc++] = instructions[0].name.size();
+//?   cout << "new string literal: " << instructions[pc].ingredients[0].name << '\n'; //? 1
+  Memory[Current_routine.alloc++] = instructions[pc].ingredients[0].name.size();
   for (size_t i = 0; i < instructions[pc].ingredients[0].name.size(); ++i) {
     Memory[Current_routine.alloc++] = instructions[pc].ingredients[0].name[i];
   }
diff --git a/cpp/030length b/cpp/030length
index 6a297dd3..f690d543 100644
--- a/cpp/030length
+++ b/cpp/030length
@@ -19,6 +19,7 @@ Next_recipe_number++;
 case LENGTH: {
   reagent x = canonize(instructions[pc].ingredients[0]);
   vector<int> result;
+//?   cout << "length: " << x.value << '\n'; //? 1
   result.push_back(Memory[x.value]);
   write_memory(instructions[pc].products[0], result);
   break;
diff --git a/cpp/string-test.mu b/cpp/string-test.mu
index 158c59fd..5470af60 100644
--- a/cpp/string-test.mu
+++ b/cpp/string-test.mu
@@ -1,6 +1,6 @@
 recipe main [
   default-space:address:space <- new location:type, 30:literal
-  x:address:array:character <- new [abcd]
+  x:address:array:character <- new [abc]
   y:address:array:character <- new [abc]
   3:boolean/raw <- string-equal x:address:array:character, y:address:array:character
 ]