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++;
 }
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;
}
Exemple #3
0
void get_writed_index(cells &writed){
  writed.clear();
  for(int i = 0; i< RAM_SIZE; i++)
    if(ram[i] != 0){
      writed.insert( cells::value_type( i, ram[i]));
    }
  return ;
}
Exemple #4
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;
}
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));
}
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));
}