about summary refs log tree commit diff stats
path: root/cpp/010vm
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2015-03-20 21:12:51 -0700
committerKartik K. Agaram <vc@akkartik.com>2015-03-20 21:16:12 -0700
commita3d9828c190c86d9984a8e788f16dc10dfb95afa (patch)
tree3632b7319a88da648a99d595b38078ffd8d529b4 /cpp/010vm
parentad68bbce689969c4b0483a148c2a5260e9256fa7 (diff)
downloadmu-a3d9828c190c86d9984a8e788f16dc10dfb95afa.tar.gz
961 - done converting names?
I'm making two changes to how I compute field offsets:
  a) I just replace offset names up front, before I even manage field
  names. I don't bother disallowing x:integer and x:offset in the same
  function. Let's see if that leads us astray. Certainly saves code.

  b) I don't bother canonizing the first arg of a get since we know it
  has to have a type that is some number of 'address' followed by a
  record. Just assume that we have the right number of 'deref's.
Diffstat (limited to 'cpp/010vm')
-rw-r--r--cpp/010vm5
1 files changed, 5 insertions, 0 deletions
diff --git a/cpp/010vm b/cpp/010vm
index 45b4c3e5..d37dd83a 100644
--- a/cpp/010vm
+++ b/cpp/010vm
@@ -82,10 +82,13 @@ void setup_types() {
   // Mu Types Initialization.
   int integer = Type_number["integer"] = Next_type_number++;
   Type[integer].size = 1;
+  Type[integer].name = "integer";
   int address = Type_number["address"] = Next_type_number++;
   Type[address].size = 1;
+  Type[address].name = "address";
   int boolean = Type_number["boolean"] = Next_type_number++;
   Type[boolean].size = 1;
+  Type[boolean].name = "boolean";
   // End Mu Types Initialization.
 }
 :(before "End Setup")
@@ -99,10 +102,12 @@ void setup_types() {
 //  storing bank balance next to a person's name might require a record, and
 //  high scores in a game might need an array of numbers.
 struct type_info {
+  string name;
   size_t size;
   bool is_record;
   bool is_array;
   vector<vector<type_number> > elements;  // only if is_record
+  vector<string> element_names;  // only if is_record
   vector<type_number> element;  // only if is_array
   // End type_info Fields.
   type_info() :size(0), is_record(false), is_array(false) {}