From b291f85b8d0ece9312b066a84cbeca1b367fe85f Mon Sep 17 00:00:00 2001 From: "Kartik K. Agaram" Date: Thu, 19 Feb 2015 23:49:13 -0800 Subject: 798 - start of record support --- cpp/010vm | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'cpp/010vm') 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 target; // only if is_address vector > 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") -- cgit 1.4.1-2-gfad0