about summary refs log tree commit diff stats
path: root/cpp/010vm
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2015-02-19 23:49:13 -0800
committerKartik K. Agaram <vc@akkartik.com>2015-02-19 23:49:13 -0800
commitb291f85b8d0ece9312b066a84cbeca1b367fe85f (patch)
treee3e443337918a47ac2f3707b1b77957c34a6131d /cpp/010vm
parent9dc2948276388d2ca6556f4a8d13d55406775ac7 (diff)
downloadmu-b291f85b8d0ece9312b066a84cbeca1b367fe85f.tar.gz
798 - start of record support
Diffstat (limited to 'cpp/010vm')
-rw-r--r--cpp/010vm11
1 files changed, 9 insertions, 2 deletions
diff --git a/cpp/010vm b/cpp/010vm
index b864179e..342eeb9a 100644
--- a/cpp/010vm
+++ b/cpp/010vm
@@ -77,6 +77,8 @@ void setup_types() {
   int integer = Type_number["integer"] = 1;
   Type[integer].size = 1;
   Next_type_number++;
+  int boolean = Type_number["boolean"] = Next_type_number++;
+  Type[boolean].size = 1;
   // End Mu Types.
 }
 :(before "End Setup")
@@ -86,14 +88,19 @@ void setup_types() {
 // You can construct arbitrary new types. Types are either 'records', containing
 // 'fields' of other types, 'array's of a single type repeated over and over,
 // or 'addresses' pointing at a location elsewhere in memory.
+//
+// For example:
+//  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.
+// You'll see examples using addresses later.
 struct type_info {
-  int size;
+  size_t size;
   bool is_address;
   bool is_record;
   bool is_array;
   vector<type_number> target;  // only if is_address
   vector<vector<type_number> > elements;  // only if is_record or is_array
-  type_info() :size(0) {}
+  type_info() :size(0), is_address(false), is_record(false), is_array(false) {}
 };
 
 :(before "End Globals")