gambas-source-code/main/gbx/gbx_class_load.h

303 lines
5.8 KiB
C
Raw Normal View History

******** Merged /branches/64bits r918:1003 into /trunk [CONFIGURATION] * NEW: 64 bits port. [EXAMPLES] * BUG: Fixed the AnalogWatch example. [WIKI CGI SCRIPT] * NEW: Some little cosmetic changes. [INTERPRETER] * NEW: The extern function implementation has been redesigned and is now based on libffi, so that it works on 64 bits system. Because of a flaw in the compiler design, projects that use the Pointer datatype must be recompiled to be used on a 64 bits system. This flaw will be fixed in Gambas 3. * OPT: Put some tables into read-only memory. About 1000 bytes are saved for each running interpreter, except the first one. * BUG: Does not crash anymore if a component cannot be loaded. * NEW: Spanish translation updated. * NEW: A new interpreter API for returning a pointer. [COMPILER] * BUG: Correctly compiles LONG constants inside code. [GB.DEBUG] * BUG: Compiles and links the gb.debug components with the thread libraries. [GB.DB.SQLITE3] * BUG: Getting the primary index of a table without primary index is safe now. [GB.GTK] * BUG: Modified the GLib priority of watched descriptors, as the main loop could enter in a loop in which user interface events were not managed. * BUG: Message boxes use application title without crashing now. [GB.OPENGL] * BUG: Disable dead code. [GB.QT.EXT] * BUG: TextEdit.TextWidth and TextEdit.TextHeight were not declared as read-only properties. [GB.XML.XSLT] * BUG: XSLT class is now declared as being not creatable. git-svn-id: svn://localhost/gambas/trunk@1006 867c0c6c-44f3-4631-809d-bfa615b0a4ec
2008-01-17 22:39:26 +01:00
/***************************************************************************
gbx_class_load.h
(c) 2000-2012 Benoît Minisini <gambas@users.sourceforge.net>
******** Merged /branches/64bits r918:1003 into /trunk [CONFIGURATION] * NEW: 64 bits port. [EXAMPLES] * BUG: Fixed the AnalogWatch example. [WIKI CGI SCRIPT] * NEW: Some little cosmetic changes. [INTERPRETER] * NEW: The extern function implementation has been redesigned and is now based on libffi, so that it works on 64 bits system. Because of a flaw in the compiler design, projects that use the Pointer datatype must be recompiled to be used on a 64 bits system. This flaw will be fixed in Gambas 3. * OPT: Put some tables into read-only memory. About 1000 bytes are saved for each running interpreter, except the first one. * BUG: Does not crash anymore if a component cannot be loaded. * NEW: Spanish translation updated. * NEW: A new interpreter API for returning a pointer. [COMPILER] * BUG: Correctly compiles LONG constants inside code. [GB.DEBUG] * BUG: Compiles and links the gb.debug components with the thread libraries. [GB.DB.SQLITE3] * BUG: Getting the primary index of a table without primary index is safe now. [GB.GTK] * BUG: Modified the GLib priority of watched descriptors, as the main loop could enter in a loop in which user interface events were not managed. * BUG: Message boxes use application title without crashing now. [GB.OPENGL] * BUG: Disable dead code. [GB.QT.EXT] * BUG: TextEdit.TextWidth and TextEdit.TextHeight were not declared as read-only properties. [GB.XML.XSLT] * BUG: XSLT class is now declared as being not creatable. git-svn-id: svn://localhost/gambas/trunk@1006 867c0c6c-44f3-4631-809d-bfa615b0a4ec
2008-01-17 22:39:26 +01:00
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 2, or (at your option)
******** Merged /branches/64bits r918:1003 into /trunk [CONFIGURATION] * NEW: 64 bits port. [EXAMPLES] * BUG: Fixed the AnalogWatch example. [WIKI CGI SCRIPT] * NEW: Some little cosmetic changes. [INTERPRETER] * NEW: The extern function implementation has been redesigned and is now based on libffi, so that it works on 64 bits system. Because of a flaw in the compiler design, projects that use the Pointer datatype must be recompiled to be used on a 64 bits system. This flaw will be fixed in Gambas 3. * OPT: Put some tables into read-only memory. About 1000 bytes are saved for each running interpreter, except the first one. * BUG: Does not crash anymore if a component cannot be loaded. * NEW: Spanish translation updated. * NEW: A new interpreter API for returning a pointer. [COMPILER] * BUG: Correctly compiles LONG constants inside code. [GB.DEBUG] * BUG: Compiles and links the gb.debug components with the thread libraries. [GB.DB.SQLITE3] * BUG: Getting the primary index of a table without primary index is safe now. [GB.GTK] * BUG: Modified the GLib priority of watched descriptors, as the main loop could enter in a loop in which user interface events were not managed. * BUG: Message boxes use application title without crashing now. [GB.OPENGL] * BUG: Disable dead code. [GB.QT.EXT] * BUG: TextEdit.TextWidth and TextEdit.TextHeight were not declared as read-only properties. [GB.XML.XSLT] * BUG: XSLT class is now declared as being not creatable. git-svn-id: svn://localhost/gambas/trunk@1006 867c0c6c-44f3-4631-809d-bfa615b0a4ec
2008-01-17 22:39:26 +01:00
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., 51 Franklin Street, Fifth Floor, Boston,
MA 02110-1301, USA.
******** Merged /branches/64bits r918:1003 into /trunk [CONFIGURATION] * NEW: 64 bits port. [EXAMPLES] * BUG: Fixed the AnalogWatch example. [WIKI CGI SCRIPT] * NEW: Some little cosmetic changes. [INTERPRETER] * NEW: The extern function implementation has been redesigned and is now based on libffi, so that it works on 64 bits system. Because of a flaw in the compiler design, projects that use the Pointer datatype must be recompiled to be used on a 64 bits system. This flaw will be fixed in Gambas 3. * OPT: Put some tables into read-only memory. About 1000 bytes are saved for each running interpreter, except the first one. * BUG: Does not crash anymore if a component cannot be loaded. * NEW: Spanish translation updated. * NEW: A new interpreter API for returning a pointer. [COMPILER] * BUG: Correctly compiles LONG constants inside code. [GB.DEBUG] * BUG: Compiles and links the gb.debug components with the thread libraries. [GB.DB.SQLITE3] * BUG: Getting the primary index of a table without primary index is safe now. [GB.GTK] * BUG: Modified the GLib priority of watched descriptors, as the main loop could enter in a loop in which user interface events were not managed. * BUG: Message boxes use application title without crashing now. [GB.OPENGL] * BUG: Disable dead code. [GB.QT.EXT] * BUG: TextEdit.TextWidth and TextEdit.TextHeight were not declared as read-only properties. [GB.XML.XSLT] * BUG: XSLT class is now declared as being not creatable. git-svn-id: svn://localhost/gambas/trunk@1006 867c0c6c-44f3-4631-809d-bfa615b0a4ec
2008-01-17 22:39:26 +01:00
***************************************************************************/
#ifndef __GBX_CLASS_LOAD_H
#define __GBX_CLASS_LOAD_H
#include "gb_common.h"
#ifdef OS_64BITS
typedef
uint32_t ptr32_t;
typedef
struct {
ptr32_t name;
int len;
******** Merged /branches/64bits r918:1003 into /trunk [CONFIGURATION] * NEW: 64 bits port. [EXAMPLES] * BUG: Fixed the AnalogWatch example. [WIKI CGI SCRIPT] * NEW: Some little cosmetic changes. [INTERPRETER] * NEW: The extern function implementation has been redesigned and is now based on libffi, so that it works on 64 bits system. Because of a flaw in the compiler design, projects that use the Pointer datatype must be recompiled to be used on a 64 bits system. This flaw will be fixed in Gambas 3. * OPT: Put some tables into read-only memory. About 1000 bytes are saved for each running interpreter, except the first one. * BUG: Does not crash anymore if a component cannot be loaded. * NEW: Spanish translation updated. * NEW: A new interpreter API for returning a pointer. [COMPILER] * BUG: Correctly compiles LONG constants inside code. [GB.DEBUG] * BUG: Compiles and links the gb.debug components with the thread libraries. [GB.DB.SQLITE3] * BUG: Getting the primary index of a table without primary index is safe now. [GB.GTK] * BUG: Modified the GLib priority of watched descriptors, as the main loop could enter in a loop in which user interface events were not managed. * BUG: Message boxes use application title without crashing now. [GB.OPENGL] * BUG: Disable dead code. [GB.QT.EXT] * BUG: TextEdit.TextWidth and TextEdit.TextHeight were not declared as read-only properties. [GB.XML.XSLT] * BUG: XSLT class is now declared as being not creatable. git-svn-id: svn://localhost/gambas/trunk@1006 867c0c6c-44f3-4631-809d-bfa615b0a4ec
2008-01-17 22:39:26 +01:00
}
PACKED
SYMBOL_32;
typedef
struct {
CTYPE type;
int pos;
}
PACKED
CLASS_VAR_32;
typedef
uint32_t TYPE_32;
typedef
union {
TYPE_32 type;
struct { TYPE_32 type; double value; } PACKED _float;
struct { TYPE_32 type; float value; } PACKED _single;
******** Merged /branches/64bits r918:1003 into /trunk [CONFIGURATION] * NEW: 64 bits port. [EXAMPLES] * BUG: Fixed the AnalogWatch example. [WIKI CGI SCRIPT] * NEW: Some little cosmetic changes. [INTERPRETER] * NEW: The extern function implementation has been redesigned and is now based on libffi, so that it works on 64 bits system. Because of a flaw in the compiler design, projects that use the Pointer datatype must be recompiled to be used on a 64 bits system. This flaw will be fixed in Gambas 3. * OPT: Put some tables into read-only memory. About 1000 bytes are saved for each running interpreter, except the first one. * BUG: Does not crash anymore if a component cannot be loaded. * NEW: Spanish translation updated. * NEW: A new interpreter API for returning a pointer. [COMPILER] * BUG: Correctly compiles LONG constants inside code. [GB.DEBUG] * BUG: Compiles and links the gb.debug components with the thread libraries. [GB.DB.SQLITE3] * BUG: Getting the primary index of a table without primary index is safe now. [GB.GTK] * BUG: Modified the GLib priority of watched descriptors, as the main loop could enter in a loop in which user interface events were not managed. * BUG: Message boxes use application title without crashing now. [GB.OPENGL] * BUG: Disable dead code. [GB.QT.EXT] * BUG: TextEdit.TextWidth and TextEdit.TextHeight were not declared as read-only properties. [GB.XML.XSLT] * BUG: XSLT class is now declared as being not creatable. git-svn-id: svn://localhost/gambas/trunk@1006 867c0c6c-44f3-4631-809d-bfa615b0a4ec
2008-01-17 22:39:26 +01:00
struct { TYPE_32 type; int value; } PACKED _integer;
struct { TYPE_32 type; int64_t value; } PACKED _long;
struct { TYPE_32 type; ptr32_t addr; int len; } PACKED _string;
struct { TYPE_32 type; int val[2]; } PACKED _swap;
}
PACKED
CLASS_CONST_32;
typedef
ptr32_t CLASS_REF_32;
typedef
ptr32_t CLASS_UNKNOWN_32;
typedef
struct {
CTYPE type;
}
PACKED
CLASS_LOCAL_32;
typedef
struct {
TYPE_32 type;
}
PACKED
CLASS_PARAM_32;
typedef
struct {
SYMBOL_32 sym;
int value;
}
LOCAL_SYMBOL_32;
typedef
struct {
unsigned short line;
unsigned short nline;
unsigned short *pos;
ptr32_t name;
ptr32_t local; // LOCAL_SYMBOL_32
short n_local;
unsigned short _reserved;
}
PACKED
FUNC_DEBUG_32;
typedef
struct {
TYPE type;
char n_param;
char npmin;
char vararg;
char _reserved;
short n_local;
short n_ctrl;
short stack_usage;
short error;
ptr32_t code; // unsigned short *
ptr32_t param; // CLASS_PARAM
ptr32_t local; // CLASS_LOCAL
ptr32_t debug; // FUNC_DEBUG
}
PACKED
FUNCTION_32;
typedef
struct {
TYPE_32 type;
short n_param;
short _reserved;
ptr32_t param; // CLASS_PARAM
ptr32_t name;
}
PACKED
CLASS_EVENT_32;
typedef
struct {
TYPE_32 type;
short n_param;
unsigned loaded : 1;
unsigned _reserved : 15;
ptr32_t param; // CLASS_PARAM
ptr32_t alias;
ptr32_t library;
}
PACKED
CLASS_EXTERN_32;
typedef
struct {
TYPE_32 type;
int dim[0];
}
CLASS_ARRAY_32;
typedef
CLASS_ARRAY_32 *CLASS_ARRAY_P_32;
struct _CLASS;
typedef
struct {
SYMBOL_32 sym;
CTYPE ctype;
int value;
}
GLOBAL_SYMBOL_32;
#if 0
typedef
struct {
ptr32_t name;
TYPE_32 type;
ptr32_t read;
ptr32_t write;
char native;
char _reserved[3];
ptr32_t class;
}
PACKED
CLASS_DESC_PROPERTY_32;
typedef
struct {
ptr32_t name;
TYPE_32 type;
int offset;
int _reserved;
}
PACKED
CLASS_DESC_VARIABLE;
typedef
struct {
ptr32_t name;
TYPE_32 type;
void (*exec)(); /* m<>hode */
TYPE *signature; /* signature */
char npmin; /* nombre de param<61>res minimum */
char npmax; /* nombre de param<61>res maximum dans la signature */
char npvar; /* nombre d'arguments variables ? */
char native; /* native method */
struct _CLASS *class;
}
PACKED
CLASS_DESC_METHOD;
typedef
struct {
char *name;
TYPE type; /* type de la valeur de retour */
int *index; /* num<75>o de l'<27><>ement */
TYPE *signature; /* signature */
char npmin; /* nombre de param<61>res minimum */
char npmax; /* nombre de param<61>res maximum dans la signature */
char npvar; /* nombre d'arguments variables ? */
char _reserved;
struct _CLASS *class;
}
PACKED
CLASS_DESC_EVENT;
typedef
struct {
char *name;
TYPE type; /* type de la valeur de retour */
int exec; /* Index a ex<65>uter */
TYPE *signature; /* signature */
char npmin; /* nombre de param<61>res minimum */
char npmax; /* nombre de param<61>res maximum dans la signature */
char npvar; /* nombre d'arguments variables ? */
char _reserved;
struct _CLASS *class;
}
PACKED
CLASS_DESC_EXTERN;
typedef
struct {
char *name;
TYPE type; /* type de constante */
union {
int _integer;
double _float;
char *_string;
int64_t _long;
void *_pointer;
}
value;
}
PACKED
CLASS_DESC_CONSTANT;
typedef
struct {
char *name;
void (*func)();
}
PACKED
CLASS_DESC_HOOK;
#endif
typedef
union {
ptr32_t name;
TYPE_32 type;
ptr32_t val1;
ptr32_t val2;
ptr32_t val3;
ptr32_t val4;
}
PACKED
CLASS_DESC_GAMBAS_32;
typedef
union {
CLASS_DESC_GAMBAS_32 gambas;
}
PACKED
CLASS_DESC_32;
typedef
struct {
CLASS_DESC_32 *desc;
CLASS_CONST_32 *cst;
CLASS_VAR_32 *stat;
CLASS_VAR_32 *dyn;
FUNCTION_32 *func;
CLASS_EVENT_32 *event;
CLASS_EXTERN_32 *ext;
CLASS_ARRAY_32 **array;
struct _CLASS **class_ref;
char **unknown;
GLOBAL_SYMBOL_32 *global;
}
PACKED
CLASS_LOAD_32;
#endif
#endif