int IDL_ns_scope_levels_from_here (IDL_ns ns, IDL_tree ident, IDL_tree parent) { IDL_tree p, scope_here, scope_ident; int levels; g_return_val_if_fail (ns != NULL, 1); g_return_val_if_fail (ident != NULL, 1); while (parent && !IDL_NODE_IS_SCOPED (parent)) parent = IDL_NODE_UP (parent); if (parent == NULL) return 1; if ((scope_here = IDL_tree_get_scope (parent)) == NULL || (scope_ident = IDL_tree_get_scope (ident)) == NULL) return 1; assert (IDL_NODE_TYPE (scope_here) == IDLN_GENTREE); assert (IDL_NODE_TYPE (scope_ident) == IDLN_GENTREE); for (levels = 1; scope_ident; ++levels, scope_ident = IDL_NODE_UP (scope_ident)) { p = IDL_ns_resolve_this_scope_ident ( ns, scope_here, IDL_GENTREE (scope_ident).data); if (p == scope_ident) return levels; } return 1; }
static gboolean module_declaration(TreeState *state) { /* do not use modules yet */ #if 0 IDL_tree scope = IDL_tree_get_scope(state->tree); char *module_name = IDL_IDENT(IDL_MODULE(state->tree).ident).str; printf("\n\n I've go a module declared!!! \n name: %s \n\n", module_name); fprintf(FILENAME(state), "package %s;\n", module_name); state->tree = IDL_MODULE(state->tree).definition_list; type = IDL_NODE_TYPE(state->tree); printf("\n type: %d\n\n", type); return process_list(state); #endif return TRUE; }