📄 gbx_class.c
字号:
/*************************************************************************** class.c Class loader (c) 2000-2004 Beno顃 Minisini <gambas@users.sourceforge.net> This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 1, or (at your option) any later version. This program 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 General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.***************************************************************************/#define __GBX_CLASS_C#include "gb_common.h"#include "gb_common_buffer.h"#include "gb_alloc.h"#include "gb_error.h"#include "gb_limit.h"#include <ctype.h>#include "gb_buffer.h"#include "gb_file.h"#include "gbx_type.h"#include "gbx_exec.h"#include "gbx_debug.h"#include "gb_magic.h"#include "gbx_stream.h"#include "gbx_trace.h"#include "gbx_string.h"#include "gbx_object.h"#include "gbx_variant.h"#include "gbx_number.h"#include "gambas.h"#include "gbx_class.h"PRIVATE TABLE ClassTable; /* Table des symboles contenant les classes */PUBLIC CLASS *First = NULL;#ifdef DEBUGPRIVATE CLASS *Class;#endifPUBLIC void CLASS_init(void){ if (sizeof(CLASS) > 128) printf("sizeof(CLASS) = %d !\n", sizeof(CLASS)); TABLE_create_static(&ClassTable, sizeof(CLASS_SYMBOL), TF_IGNORE_CASE); CLASS_init_native();}PUBLIC TABLE *CLASS_get_table(void){ return &ClassTable;}PRIVATE void CLASS_unload(CLASS *class){ CLASS_DESC *desc; /*if (!class->ready && !CLASS_is_virtual(class)) printf("WARNING: class %s was never loaded.\n", class->name);*/ #if DEBUG_LOAD printf("Unloading class %s...\n", class->name); #endif if (CLASS_is_native(class)) { desc = CLASS_get_symbol_desc_kind(class, "_exit", CD_STATIC_METHOD, 0); if (desc) { EXEC.desc = &desc->method; EXEC.native = TRUE; EXEC.class = class; EXEC.object = NULL; EXEC.nparam = 0; EXEC.drop = TRUE; EXEC.use_stack = FALSE; EXEC_native(); } } if (class->free_name) FREE(&class->name, "CLASS_unload"); if (!CLASS_is_native(class)) { /*OBJECT_release(class, NULL);*/ FREE(&class->load, "CLASS_unload"); FREE(&class->data, "CLASS_unload"); } else { if (class->signature) FREE(&class->signature, "CLASS_unload"); } if (class->free_event) FREE(&class->event, "CLASS_unload"); if (class->stat) FREE(&class->stat, "CLASS_unload"); if (class->table) FREE(&class->table, "CLASS_unload");}PUBLIC void CLASS_exit(void){ int i, n, nc, nb; CLASS_SYMBOL *csym; CLASS *class; #if TRACE_MEMORY printf("\n------------------- CLASS_exit (variables statiques) -------------------\n\n"); #endif /* On compte le nombre de classes
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -