Exemplo n.º 1
0
void stmt_free(struct stmt *s) {
  if(!s) return;
  decl_free(s -> decl);
  expr_free(s -> init_expr);
  expr_free(s -> expr);
  expr_free(s -> next_expr);
  stmt_free(s -> body);
  stmt_free(s -> else_body);
  stmt_free(s -> next);
  free(s);
}
Exemplo n.º 2
0
static void
destructor(stmt_ty *that)
{
    stmt_if_ty      *this;

    trace(("if::destructor()\n{\n"));
    this = (stmt_if_ty *) that;
    blob_list_free(this->condition);
    stmt_free(this->then_clause);
    if (this->else_clause)
        stmt_free(this->else_clause);
    trace(("}\n"));
}
Exemplo n.º 3
0
Arquivo: ast.c Projeto: sdevlin/blang
void stmt_free(struct stmt **sp)
{
	if (!sp || !(*sp)) {
		return;
	}
	struct stmt *s = *sp;
	decl_free(&s->decl);
	expr_free(&s->expr);
	stmt_free(&s->body);
	stmt_free(&s->ebody);
	stmt_free(&s->next);
	free(s);
	*sp = 0;
}
Exemplo n.º 4
0
void stmt_list_free(struct stmt_list *list) {
    while (list) {
        stmt_free(list->stmt);
        struct stmt_list *next = list->next;
        free(list);
        list = next;
    }
}
Exemplo n.º 5
0
void CBlockUnit::ClrLibrary()
{
  for (int i = 0; i < m_vLibrary.size(); i++)
  {
    m_vLibrary[i].m_sName.clear();
    stmt_free(m_vLibrary[i].m_pProgram);
  }

  m_vLibrary.clear();
}
Exemplo n.º 6
0
Arquivo: ast.c Projeto: sdevlin/blang
void decl_free(struct decl **dp)
{
	if (!dp || !(*dp)) {
		return;
	}
	struct decl *d = *dp;
	free(d->name);
	type_free(&d->type);
	expr_free(&d->value);
	stmt_free(&d->code);
	decl_free(&d->next);
	free(d);
	*dp = 0;
}
Exemplo n.º 7
0
CBlockUnit::~CBlockUnit()
{
  // Free memory allocated for variables
  if (m_nType != T_SUBSYSTEM)
  {
    for (int i=0; i<m_vInput.size(); i++)
    {
      delete m_vInput[i];
    }
    for (int i=0; i<m_vOutput.size(); i++)
    {
      delete m_vOutput[i];
    }
    for (int i=0; i<m_vGlobal.size(); i++)
    {
      delete m_vGlobal[i];
    }
    for (int i=0; i<m_vStack.size(); i++)
    {
      delete m_vStack[i];
    }
  }

  // Cleanup subsystem documents
  if (m_pDocument)
  {
    delete m_pDocument;
  }

  // Cleanup existing program structures
  if (m_pProgram)
  {
    stmt_free(m_pProgram);
  }

  // Close current editor and scope window if exists
  if (m_pEditor)
  {
    m_pEditor->OnDestroy(0, 0);
  }
  if (m_pScope)
  {
    m_pScope->OnDestroy(0, 0);
  }
  if (m_pView)
  {
    m_pView->OnDestroy(0, 0);
  }
}
Exemplo n.º 8
0
static void
destructor(stmt_ty *that)
{
    stmt_compound_ty *this;
    size_t          j;

    trace(("compound::destructor()\n{\n"));
    this = (stmt_compound_ty *) that;
    for (j = 0; j < this->nlines; ++j)
        stmt_free(this->line[j]);
    if (this->line)
        mem_free(this->line);
    this->nlines = 0;
    this->nlines_max = 0;
    this->line = 0;
    trace(("}\n"));
}