Exemple #1
0
void destroyFrame(Environment *env){
  assert(env!=NULL);
  Value *subEnvCounter = lookup(env->bindings->tableValue, "#envID");
  assert(subEnvCounter!=NULL);
  assert(subEnvCounter->type==integerType);
  int i;
  ConsCell *entry;
  char *id;

  for (i = subEnvCounter->intValue;i>=0;i--){
    id = intToString(i);
  
    assert(env->bindings->tableValue!=NULL);
    entry = lookupEntry(env->bindings->tableValue, id);
    
    if (entry){

      destroyFrame(entry->cdr->envValue);

      free(entry->cdr);
      entry->cdr = NULL;
    }
    free(id);
  }
  destroyEnvironment(env);
}
Exemple #2
0
// can free top frame and also destory itself.
void destroyTopFrame(Environment *env){
  assert(env!=NULL);
  Environment *top = env;
  while (top->parent){
    top = top->parent;
  }  // make sure it is the top level environment.
  Value *subEnvCounter = lookup(top->bindings->tableValue, "#envID");
  assert(subEnvCounter!=NULL);
  assert(subEnvCounter->type==integerType);
  int i;
  ConsCell *entry;
  char *id;

  for (i = subEnvCounter->intValue ;i>=0;i--){
    id = intToString(i);
  
    assert(top->bindings->tableValue!=NULL);
    entry = lookupEntry(top->bindings->tableValue, id);
    if (entry){
      destroyFrame(entry->cdr->envValue);
    
      free(entry->cdr);
      entry->cdr = NULL;
    }
    free(id);
  }
  destroyEnvironment(env);
}
void LedCube::lightFrames(cubeFrame* frames[], unsigned int length)
{
    for(byte f=0; f<length; f++)
    {
        lightSequence(frames[f]->sequence, frames[f]->size, frames[f]->delay);
        // reclaim memory allocated in createFrame to prevent a leak
        destroyFrame(frames[f]);
    }
}
Exemple #4
0
void ClientWindow::msg_destroyed()
 {
  enableFrameReact();

  switch( msg_frame.getButtonId() )
    {
     case Button_Yes :
      {
       editor.save();
      }
     break;

     case Button_Cancel :
      {
       cont=ContinueNone;
      }
     return;
    }

  switch( Replace(cont,ContinueNone) )
    {
     case ContinueNew :
      {
       editor.blank();
      }
     break;

     case ContinueStartOpen :
      {
       startOpen(file_point);
      }
     break;

     case ContinueExit :
      {
       destroyFrame();
      }
     break;
    }
 }