Alien-LibJIT
view release on metacpan or search on metacpan
libjit/dpas/dpas-scope.c view on Meta::CPAN
/*
* dpas-scope.c - Scope handling for Dynamic Pascal.
*
* Copyright (C) 2004 Southern Storm Software, Pty Ltd.
*
* This file is part of the libjit library.
*
* The libjit library is free software: you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public License
* as published by the Free Software Foundation, either version 2.1 of
* the License, or (at your option) any later version.
*
* The libjit library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with the libjit library. If not, see
* <http://www.gnu.org/licenses/>.
*/
#include "dpas-internal.h"
/*
* Internal structure of a scope item.
*/
struct dpas_scope_item
{
int kind;
char *name;
jit_type_t type;
void *info;
jit_meta_free_func free_info;
char *filename;
long linenum;
dpas_scope_item_t next;
};
/*
* Internal structure of a scope.
*/
struct dpas_scope
{
dpas_scope_t parent;
dpas_scope_item_t first;
dpas_scope_item_t last;
dpas_scope_item_t first_with;
dpas_scope_item_t last_with;
int level;
};
dpas_scope_t dpas_scope_create(dpas_scope_t parent)
{
dpas_scope_t scope;
scope = jit_new(struct dpas_scope);
if(!scope)
{
dpas_out_of_memory();
}
scope->parent = parent;
scope->first = 0;
scope->last = 0;
scope->first_with = 0;
scope->last_with = 0;
if(parent)
{
scope->level = parent->level + 1;
}
else
{
scope->level = 0;
}
return scope;
}
void dpas_scope_destroy(dpas_scope_t scope)
{
if(scope)
{
( run in 1.194 second using v1.01-cache-2.11-cpan-df04353d9ac )