Esempio n. 1
0
 environment(const cells & parms, const cells & args, environment * outer)
 : outer_(outer)
 {
     cellit a = args.begin();
     for (cellit p = parms.begin(); p != parms.end(); ++p)
         env_[p->val] = *a++;
 }
Esempio n. 2
0
cell proc_less_equal(const cells & c)
{
    long n(atol(c[0].val.c_str()));
    for (cellit i = c.begin()+1; i != c.end(); ++i)
        if (n > atol(i->val.c_str()))
            return false_sym;
    return true_sym;
}
Esempio n. 3
0
void print_change_index(cells &prev){
  int cnt = 0;
  cerr << "-----前回停止時から値が変わった番地-----\n";
  for(int i = SPR_INIT; i >= 0; i--){
    if(cnt > 50){
      cerr << "\n前回停止時から値が変わったメモリの番地が多すぎたので全ては表示してません\n.";
      break;
    }
    if(ram[i] != 0){
      if(prev.find(i) == prev.end() || prev[i] != ram[i]) {
	cerr << "(ram[" << i - SPR_INIT<< "]:" << prev[i] << " ->" << (int)ram[i] << "), ";
	cnt++;
      }
    } else {
      if(prev.find(i) != prev.end()) {
	cerr << "(ram[" << i - SPR_INIT<< "]:" << prev[i] << " ->" << (int)ram[i] << "), ";
	cnt++;
      }
    }
  }
  cerr << endl << endl;
}
Esempio n. 4
0
cell proc_sub(const cells & c)
{
    long n(atol(c[0].val.c_str()));
    for (cellit i = c.begin()+1; i != c.end(); ++i) n -= atol(i->val.c_str());
    return cell(Number, str(n));
}
Esempio n. 5
0
cell proc_mul(const cells & c)
{
    long n(1);
    for (cellit i = c.begin(); i != c.end(); ++i) n *= atol(i->val.c_str());
    return cell(Number, str(n));
}