about summary refs log tree commit diff stats
path: root/.travis.yml
Commit message (Expand)AuthorAgeFilesLines
* travis: added m4 dir for libstropheJames Booth2014-09-301-0/+1
* Revert "Fix travis build by adding m4 dir"James Booth2014-09-301-1/+0
* Fix travis build by adding m4 dirJames Booth2014-09-301-0/+1
* Added prefix to travis libstrophe configureJames Booth2014-09-171-1/+1
* Revert "Added --prefix=/usr to libstrophe build in travis config"James Booth2014-09-071-1/+1
* Added --prefix=/usr to libstrophe build in travis configJames Booth2014-09-061-1/+1
* Use public domain SHA1 code, remove libgcrypt dependencyJames Booth2014-06-011-1/+1
* Fixed tests to work with cmocka 0.4.1James Booth2014-05-261-4/+4
* Added libgcrypt dependencies to travis buildJames Booth2014-05-211-1/+1
* Removed redundant bootstrap call for travis buildJames Booth2014-02-231-1/+0
* Added cmocka to travis buildJames Booth2014-02-231-0/+10
* Added custom script to travis buildJames Booth2014-02-231-0/+1
* Changed travis libotr dependencyJames Booth2014-02-231-1/+1
* Added dependencies to travis buildJames Booth2014-02-231-1/+13
* Added bootstrap.sh to travis buildJames Booth2014-02-231-0/+1
* Added travis configJames Booth2014-02-231-0/+1
} /* Literal.String.Doc */ .highlight .s2 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Double */ .highlight .se { color: #0044dd; background-color: #fff0f0 } /* Literal.String.Escape */ .highlight .sh { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Heredoc */ .highlight .si { color: #3333bb; background-color: #fff0f0 } /* Literal.String.Interpol */ .highlight .sx { color: #22bb22; background-color: #f0fff0 } /* Literal.String.Other */ .highlight .sr { color: #008800; background-color: #fff0ff } /* Literal.String.Regex */ .highlight .s1 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Single */ .highlight .ss { color: #aa6600; background-color: #fff0f0 } /* Literal.String.Symbol */ .highlight .bp { color: #003388 } /* Name.Builtin.Pseudo */ .highlight .fm { color: #0066bb; font-weight: bold } /* Name.Function.Magic */ .highlight .vc { color: #336699 } /* Name.Variable.Class */ .highlight .vg { color: #dd7700 } /* Name.Variable.Global */ .highlight .vi { color: #3333bb } /* Name.Variable.Instance */ .highlight .vm { color: #336699 } /* Name.Variable.Magic */ .highlight .il { color: #0000DD; font-weight: bold } /* Literal.Number.Integer.Long */
//: So far you can have global variables by not setting default-space, and
//: local variables by setting default-space. You can isolate variables
//: between those extremes by creating 'surrounding' spaces.
//:
//: (Surrounding spaces are like lexical scopes in other languages.)

:(scenario surrounding_space)
# location 1 in space 1 refers to the space surrounding the default space, here 20.
recipe main [
  10:number <- copy 5:literal  # pretend array
  20:number <- copy 5:literal  # pretend array
  default-space:address:array:location <- copy 10:literal
  0:address:array:location/names:dummy <- copy 20:literal  # later layers will explain the /names: property
  1:number <- copy 32:literal
  1:number/space:1 <- copy 33:literal
]
# chain space
+mem: storing 20 in location 11
# store to default-space
+mem: storing 32 in location 12
# store to chained space
+mem: storing 33 in location 22

//: If you think of a space as a collection of variables with a common
//: lifetime, surrounding allows managing shorter lifetimes inside a longer
//: one.

:(replace{} "long long int space_base(const reagent& x)")
long long int space_base(const reagent& x) {
  return space_base(x, space_index(x), Current_routine->calls.front().default_space);
}

long long int space_base(const reagent& x, long long int space_index, long long int base) {
  if (space_index == 0) {
    return base;
  }
  long long int result = space_base(x, space_index-1, Memory[base+1]);
  return result;
}

long long int space_index(const reagent& x) {
  for (long long int i = /*skip name:type*/1; i < SIZE(x.properties); ++i) {
    if (x.properties.at(i).first == "space") {
      assert(SIZE(x.properties.at(i).second) == 1);
      return to_integer(x.properties.at(i).second.at(0));
    }
  }
  return 0;
}

:(scenario permit_space_as_variable_name)
recipe main [
  space:number <- copy 0:literal
]