2007-12-30 17:41:49 +01:00
|
|
|
/***************************************************************************
|
|
|
|
|
2009-08-17 12:41:51 +02:00
|
|
|
gbx_class.h
|
2007-12-30 17:41:49 +01:00
|
|
|
|
2011-03-21 01:04:10 +01:00
|
|
|
(c) 2000-2011 Benoît Minisini <gambas@users.sourceforge.net>
|
2007-12-30 17:41:49 +01:00
|
|
|
|
2009-08-17 12:41:51 +02: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)
|
|
|
|
any later version.
|
2007-12-30 17:41:49 +01:00
|
|
|
|
2009-08-17 12:41:51 +02:00
|
|
|
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.
|
2007-12-30 17:41:49 +01:00
|
|
|
|
2009-08-17 12:41:51 +02:00
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
along with this program; if not, write to the Free Software
|
2011-06-03 02:51:09 +02:00
|
|
|
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
|
|
|
MA 02110-1301, USA.
|
2007-12-30 17:41:49 +01:00
|
|
|
|
|
|
|
***************************************************************************/
|
|
|
|
|
|
|
|
#ifndef __GBX_CLASS_H
|
|
|
|
#define __GBX_CLASS_H
|
|
|
|
|
|
|
|
#include "gb_error.h"
|
|
|
|
#include "gb_alloc.h"
|
|
|
|
#include "gbx_type.h"
|
|
|
|
#include "gb_table.h"
|
|
|
|
#include "gbx_class_desc.h"
|
|
|
|
#include "gbx_component.h"
|
|
|
|
|
|
|
|
|
|
|
|
typedef
|
2009-01-05 12:38:03 +01:00
|
|
|
int CLASS_ID;
|
2007-12-30 17:41:49 +01:00
|
|
|
|
|
|
|
/*
|
|
|
|
typedef
|
2009-01-05 12:38:03 +01:00
|
|
|
struct {
|
|
|
|
unsigned char flag;
|
|
|
|
unsigned char id;
|
|
|
|
short value;
|
|
|
|
}
|
|
|
|
PACKED
|
|
|
|
CLASS_TYPE;
|
2007-12-30 17:41:49 +01:00
|
|
|
*/
|
|
|
|
|
|
|
|
typedef
|
2009-01-05 12:38:03 +01:00
|
|
|
struct {
|
|
|
|
CTYPE type;
|
|
|
|
int pos;
|
|
|
|
}
|
|
|
|
PACKED
|
|
|
|
CLASS_VAR;
|
2007-12-30 17:41:49 +01:00
|
|
|
|
|
|
|
typedef
|
2009-01-05 12:38:03 +01:00
|
|
|
struct _CLASS *CLASS_REF;
|
2008-01-17 22:39:26 +01:00
|
|
|
|
|
|
|
typedef
|
|
|
|
char *CLASS_UNKNOWN;
|
2007-12-30 17:41:49 +01:00
|
|
|
|
|
|
|
typedef
|
2009-01-05 12:38:03 +01:00
|
|
|
union {
|
|
|
|
int type;
|
|
|
|
struct { int type; double value; } PACKED _float;
|
2011-12-30 21:49:54 +01:00
|
|
|
struct { int type; float value; } PACKED _single;
|
2009-01-05 12:38:03 +01:00
|
|
|
struct { int type; int value; } PACKED _integer;
|
|
|
|
struct { int type; int64_t value; } PACKED _long;
|
|
|
|
struct { int type; char *addr; int len; } PACKED _string;
|
|
|
|
struct { int type; int val[2]; } PACKED _swap;
|
|
|
|
}
|
|
|
|
PACKED
|
|
|
|
CLASS_CONST;
|
2007-12-30 17:41:49 +01:00
|
|
|
|
|
|
|
typedef
|
2009-01-05 12:38:03 +01:00
|
|
|
struct {
|
|
|
|
CTYPE type;
|
|
|
|
}
|
|
|
|
PACKED
|
|
|
|
CLASS_LOCAL;
|
2007-12-30 17:41:49 +01:00
|
|
|
|
|
|
|
typedef
|
2009-01-05 12:38:03 +01:00
|
|
|
struct {
|
|
|
|
TYPE type;
|
|
|
|
}
|
|
|
|
PACKED
|
|
|
|
CLASS_PARAM;
|
2007-12-30 17:41:49 +01:00
|
|
|
|
|
|
|
typedef
|
2009-01-05 12:38:03 +01:00
|
|
|
struct {
|
|
|
|
SYMBOL sym;
|
|
|
|
int value;
|
|
|
|
}
|
|
|
|
LOCAL_SYMBOL;
|
2007-12-30 17:41:49 +01:00
|
|
|
|
|
|
|
typedef
|
2009-01-05 12:38:03 +01:00
|
|
|
struct {
|
|
|
|
unsigned short line;
|
|
|
|
unsigned short nline;
|
|
|
|
unsigned short *pos;
|
|
|
|
char *name;
|
|
|
|
LOCAL_SYMBOL *local;
|
|
|
|
short n_local;
|
|
|
|
unsigned short _reserved;
|
|
|
|
}
|
|
|
|
PACKED
|
|
|
|
FUNC_DEBUG;
|
2007-12-30 17:41:49 +01:00
|
|
|
|
|
|
|
typedef
|
2009-01-05 12:38:03 +01:00
|
|
|
struct {
|
|
|
|
TYPE type;
|
|
|
|
char n_param;
|
|
|
|
char npmin;
|
|
|
|
char vararg;
|
2011-07-25 02:50:11 +02:00
|
|
|
char _reserved;
|
2009-01-05 12:38:03 +01:00
|
|
|
short n_local;
|
|
|
|
short n_ctrl;
|
|
|
|
short stack_usage;
|
|
|
|
short error;
|
|
|
|
unsigned short *code;
|
|
|
|
CLASS_PARAM *param;
|
|
|
|
CLASS_LOCAL *local;
|
|
|
|
FUNC_DEBUG *debug;
|
|
|
|
}
|
|
|
|
PACKED
|
|
|
|
FUNCTION;
|
2007-12-30 17:41:49 +01:00
|
|
|
|
|
|
|
typedef
|
2009-01-05 12:38:03 +01:00
|
|
|
struct {
|
|
|
|
TYPE type;
|
|
|
|
short n_param;
|
|
|
|
short _reserved;
|
|
|
|
CLASS_PARAM *param;
|
|
|
|
char *name;
|
|
|
|
}
|
|
|
|
PACKED
|
|
|
|
CLASS_EVENT;
|
2007-12-30 17:41:49 +01:00
|
|
|
|
|
|
|
typedef
|
2009-01-05 12:38:03 +01:00
|
|
|
struct {
|
|
|
|
TYPE type;
|
|
|
|
short n_param;
|
|
|
|
unsigned loaded : 1;
|
|
|
|
unsigned _reserved : 15;
|
|
|
|
CLASS_PARAM *param;
|
|
|
|
char *alias;
|
|
|
|
char *library;
|
|
|
|
}
|
|
|
|
PACKED
|
|
|
|
CLASS_EXTERN;
|
2007-12-30 17:41:49 +01:00
|
|
|
|
|
|
|
typedef
|
2009-01-05 12:38:03 +01:00
|
|
|
struct {
|
|
|
|
uint magic;
|
|
|
|
uint version;
|
|
|
|
uint endian;
|
|
|
|
uint flag;
|
|
|
|
}
|
|
|
|
PACKED
|
|
|
|
CLASS_HEADER;
|
2007-12-30 17:41:49 +01:00
|
|
|
|
|
|
|
typedef
|
2009-01-05 12:38:03 +01:00
|
|
|
struct {
|
|
|
|
short parent;
|
|
|
|
short flag;
|
|
|
|
int s_static;
|
|
|
|
int s_dynamic;
|
2010-05-21 01:23:39 +02:00
|
|
|
short nstruct;
|
|
|
|
short _reserved;
|
2009-01-05 12:38:03 +01:00
|
|
|
}
|
|
|
|
PACKED
|
|
|
|
CLASS_INFO;
|
2007-12-30 17:41:49 +01:00
|
|
|
|
|
|
|
typedef
|
2009-01-05 12:38:03 +01:00
|
|
|
struct {
|
2010-07-08 00:06:05 +02:00
|
|
|
CTYPE ctype;
|
2009-01-05 12:38:03 +01:00
|
|
|
int dim[0];
|
|
|
|
}
|
|
|
|
CLASS_ARRAY;
|
2010-05-21 01:23:39 +02:00
|
|
|
|
2008-01-17 22:39:26 +01:00
|
|
|
typedef
|
|
|
|
CLASS_ARRAY *CLASS_ARRAY_P;
|
2007-12-30 17:41:49 +01:00
|
|
|
|
|
|
|
struct _CLASS;
|
|
|
|
|
|
|
|
typedef
|
2009-01-05 12:38:03 +01:00
|
|
|
struct {
|
|
|
|
SYMBOL sym;
|
|
|
|
CTYPE ctype;
|
|
|
|
int value;
|
|
|
|
}
|
|
|
|
GLOBAL_SYMBOL;
|
2010-05-23 13:07:14 +02:00
|
|
|
|
|
|
|
typedef
|
|
|
|
struct {
|
|
|
|
int nfield;
|
|
|
|
int *desc;
|
|
|
|
}
|
|
|
|
CLASS_STRUCT;
|
2007-12-30 17:41:49 +01:00
|
|
|
|
|
|
|
typedef
|
2009-01-05 12:38:03 +01:00
|
|
|
struct {
|
|
|
|
short n_cst;
|
|
|
|
short n_stat;
|
|
|
|
short n_dyn;
|
|
|
|
short n_func;
|
|
|
|
|
|
|
|
CLASS_CONST *cst;
|
|
|
|
CLASS_VAR *stat;
|
|
|
|
CLASS_VAR *dyn;
|
|
|
|
FUNCTION *func;
|
|
|
|
CLASS_EVENT *event;
|
|
|
|
CLASS_EXTERN *ext;
|
|
|
|
CLASS_ARRAY **array;
|
|
|
|
|
|
|
|
CLASS_REF *class_ref;
|
|
|
|
char **unknown;
|
|
|
|
|
|
|
|
GLOBAL_SYMBOL *global;
|
2010-05-27 15:51:09 +02:00
|
|
|
ushort *sort;
|
2009-01-05 12:38:03 +01:00
|
|
|
short n_global;
|
|
|
|
short n_ext;
|
|
|
|
#ifdef OS_64BITS
|
2008-01-17 22:39:26 +01:00
|
|
|
CLASS_DESC *desc;
|
|
|
|
CLASS_PARAM *local;
|
|
|
|
FUNC_DEBUG *debug;
|
2009-01-05 12:38:03 +01:00
|
|
|
#endif
|
|
|
|
}
|
|
|
|
PACKED
|
|
|
|
CLASS_LOAD;
|
2007-12-30 17:41:49 +01:00
|
|
|
|
|
|
|
enum
|
|
|
|
{
|
2009-01-05 12:38:03 +01:00
|
|
|
CS_NULL = 0,
|
|
|
|
CS_LOADED = 1,
|
|
|
|
CS_READY = 2
|
2007-12-30 17:41:49 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
typedef
|
2009-01-05 12:38:03 +01:00
|
|
|
struct _CLASS { // 32b 64b
|
|
|
|
struct _CLASS *class; // 4 8 Points at the 'Class' class !
|
|
|
|
int ref; // 8 12 Reference count
|
|
|
|
int count; // 12 16 Number of instanciated objects
|
|
|
|
struct _CLASS *parent; // 16 24 Inherited class
|
|
|
|
char *name; // 20 32 Class name
|
|
|
|
|
|
|
|
unsigned state : 2; // Initialization state
|
2010-06-05 01:48:53 +02:00
|
|
|
unsigned ready : 1; // Class is ready (<=> state == CS_READY)
|
2009-01-05 12:38:03 +01:00
|
|
|
unsigned debug : 1; // Debugging information ?
|
|
|
|
unsigned free_name : 1; // Must free the class name
|
|
|
|
unsigned free_event : 1; // Must free class->event
|
|
|
|
unsigned in_load : 1; // Class being loaded
|
|
|
|
unsigned exit : 1; // Marker used by CLASS_exit
|
|
|
|
unsigned auto_create : 1; // Automatically instanciated
|
|
|
|
unsigned no_create : 1; // Cannot instanciate this class
|
|
|
|
unsigned is_virtual : 1; // Virtual class (name beginning with a dot)
|
|
|
|
unsigned mmapped : 1; // mmap() was used to load the class
|
|
|
|
unsigned swap : 1; // class endianness was swapped
|
|
|
|
unsigned enum_static : 1; // if class enumeration is static
|
|
|
|
unsigned quick_array : 2; // array accessor optimization type
|
|
|
|
unsigned is_stream : 1; // If the class inherits stream
|
|
|
|
unsigned global : 1; // If the class is in the global table
|
|
|
|
unsigned is_native : 1; // If the class is native (i.e. written in C/C++)
|
|
|
|
unsigned error : 1; // Loading or registering the class has failed
|
2009-02-17 02:51:25 +01:00
|
|
|
unsigned is_observer : 1; // This is the Observer class
|
2010-05-23 13:07:14 +02:00
|
|
|
unsigned is_struct : 1; // This class is a structure
|
2010-07-09 13:16:49 +02:00
|
|
|
unsigned is_array : 1; // This class is an array
|
2010-11-26 21:30:58 +01:00
|
|
|
unsigned is_array_of_struct : 1; // This class is an array of struct
|
2010-05-23 13:07:14 +02:00
|
|
|
unsigned init_dynamic : 1; // If there is a special function to call at instanciation
|
2010-06-05 01:48:53 +02:00
|
|
|
unsigned must_check : 1; // The class has a check function
|
2010-11-26 21:30:58 +01:00
|
|
|
unsigned _reserved : 6; // 24 36
|
2009-01-05 12:38:03 +01:00
|
|
|
|
|
|
|
short n_desc; // 26 38 number of descriptions
|
|
|
|
short n_event; // 28 40 number of events
|
|
|
|
|
|
|
|
CLASS_DESC_SYMBOL *table; // 32 48 class description
|
2010-05-27 15:51:09 +02:00
|
|
|
ushort *sort; // 36 56 table sort
|
2009-01-05 12:38:03 +01:00
|
|
|
|
2010-05-27 15:51:09 +02:00
|
|
|
CLASS_EVENT *event; // 40 64 event description
|
2009-01-05 12:38:03 +01:00
|
|
|
|
2010-05-27 15:51:09 +02:00
|
|
|
int (*check)(); // 44 72 method for checking that an object is valid
|
2009-01-05 12:38:03 +01:00
|
|
|
|
2010-05-27 15:51:09 +02:00
|
|
|
char *data; // 48 80 class file data for loaded class
|
2010-05-23 13:07:14 +02:00
|
|
|
// or generated description for native class
|
|
|
|
// or generated description for structures
|
|
|
|
|
2010-05-27 15:51:09 +02:00
|
|
|
CLASS_LOAD *load; // 52 88 information about loaded class
|
2009-01-05 12:38:03 +01:00
|
|
|
|
2010-05-27 15:51:09 +02:00
|
|
|
char *stat; // 56 96 static class data
|
|
|
|
TYPE *signature; // 60 104 signatures address
|
|
|
|
char *string; // 64 112 strings address
|
2009-01-05 12:38:03 +01:00
|
|
|
|
2010-05-27 15:51:09 +02:00
|
|
|
uint size_stat; // 68 116 static class size
|
|
|
|
uint size; // 72 120 dynamic class size
|
|
|
|
uint off_event; // 76 124 offset of OBJECT_EVENT structure in the object
|
|
|
|
#ifdef OS_64BITS
|
2010-05-27 23:27:42 +02:00
|
|
|
uint _reserved2; // 128
|
2010-05-27 15:51:09 +02:00
|
|
|
#endif
|
2009-01-05 12:38:03 +01:00
|
|
|
|
2010-05-27 15:51:09 +02:00
|
|
|
short special[12]; // 100 152 special functions index (_new, _free, ...)
|
2009-01-05 12:38:03 +01:00
|
|
|
|
2010-05-27 15:51:09 +02:00
|
|
|
TYPE array_type; // 104 160 datatype of the contents if this class is an array class of objects
|
2010-07-08 00:06:05 +02:00
|
|
|
struct _CLASS *array_class; // 108 168 array of class
|
|
|
|
struct _CLASS *astruct_class; // 112 176 array of struct class
|
2009-01-05 12:38:03 +01:00
|
|
|
|
2010-07-08 00:06:05 +02:00
|
|
|
void *instance; // 116 184 automatically created instance
|
2009-01-05 12:38:03 +01:00
|
|
|
|
2010-05-27 15:51:09 +02:00
|
|
|
COMPONENT *component; // 120 192 The component the class belongs to
|
2009-01-05 12:38:03 +01:00
|
|
|
|
2010-05-27 15:51:09 +02:00
|
|
|
struct _CLASS *override; // 124 200 The overridden class
|
2010-04-26 11:36:47 +02:00
|
|
|
|
2010-05-27 15:51:09 +02:00
|
|
|
struct _CLASS *next; // 128 208 next class
|
2009-01-05 12:38:03 +01:00
|
|
|
}
|
|
|
|
CLASS;
|
2007-12-30 17:41:49 +01:00
|
|
|
|
|
|
|
typedef
|
2009-01-05 12:38:03 +01:00
|
|
|
struct {
|
|
|
|
SYMBOL sym;
|
|
|
|
CLASS *class;
|
|
|
|
}
|
|
|
|
PACKED
|
|
|
|
CLASS_SYMBOL;
|
2007-12-30 17:41:49 +01:00
|
|
|
|
|
|
|
typedef
|
2009-01-05 12:38:03 +01:00
|
|
|
enum {
|
|
|
|
SPEC_NEW,
|
|
|
|
SPEC_FREE,
|
|
|
|
SPEC_GET,
|
|
|
|
SPEC_PUT,
|
|
|
|
SPEC_FIRST,
|
|
|
|
SPEC_NEXT,
|
|
|
|
SPEC_CALL,
|
|
|
|
SPEC_UNKNOWN,
|
2011-07-03 04:46:15 +02:00
|
|
|
SPEC_PROPERTY,
|
2009-01-05 12:38:03 +01:00
|
|
|
SPEC_COMPARE,
|
2009-07-12 23:49:13 +02:00
|
|
|
SPEC_ATTACH,
|
2010-11-27 02:27:23 +01:00
|
|
|
SPEC_CONVERT,
|
2010-05-23 13:07:14 +02:00
|
|
|
MAX_SPEC = 12
|
2009-01-05 12:38:03 +01:00
|
|
|
}
|
|
|
|
CLASS_SPECIAL;
|
2007-12-30 17:41:49 +01:00
|
|
|
|
2008-01-24 11:42:42 +01:00
|
|
|
typedef
|
|
|
|
enum {
|
|
|
|
CQA_NONE = 0,
|
|
|
|
CQA_ARRAY = 1,
|
|
|
|
CQA_COLLECTION = 2
|
|
|
|
}
|
|
|
|
CLASS_QUICK_ARRAY;
|
|
|
|
|
2007-12-30 17:41:49 +01:00
|
|
|
typedef
|
2009-01-05 12:38:03 +01:00
|
|
|
enum
|
|
|
|
{
|
|
|
|
CF_DEBUG = 1
|
|
|
|
}
|
|
|
|
CLASS_FLAG;
|
2007-12-30 17:41:49 +01:00
|
|
|
|
|
|
|
typedef
|
2009-01-05 12:38:03 +01:00
|
|
|
enum
|
|
|
|
{
|
|
|
|
CI_EXPORTED = 1,
|
|
|
|
CI_AUTOCREATE = 2,
|
|
|
|
CI_OPTIONAL = 4,
|
|
|
|
CI_NOCREATE = 8
|
|
|
|
}
|
|
|
|
CLASS_INFO_FLAG;
|
2007-12-30 17:41:49 +01:00
|
|
|
|
|
|
|
#ifndef __GBX_CLASS_INIT_C
|
|
|
|
EXTERN CLASS *CLASS_Class;
|
|
|
|
EXTERN CLASS *CLASS_Enum;
|
|
|
|
EXTERN CLASS *CLASS_Symbol;
|
|
|
|
|
|
|
|
EXTERN CLASS *CLASS_Array;
|
|
|
|
EXTERN CLASS *CLASS_Collection;
|
|
|
|
EXTERN CLASS *CLASS_Stream;
|
|
|
|
EXTERN CLASS *CLASS_File;
|
|
|
|
EXTERN CLASS *CLASS_Stat;
|
|
|
|
EXTERN CLASS *CLASS_AppArgs;
|
|
|
|
EXTERN CLASS *CLASS_AppEnv;
|
|
|
|
EXTERN CLASS *CLASS_Application;
|
|
|
|
EXTERN CLASS *CLASS_Process;
|
|
|
|
EXTERN CLASS *CLASS_Component;
|
2008-02-14 12:59:36 +01:00
|
|
|
EXTERN CLASS *CLASS_Observer;
|
2011-01-02 18:09:54 +01:00
|
|
|
EXTERN CLASS *CLASS_Timer;
|
2007-12-30 17:41:49 +01:00
|
|
|
|
|
|
|
EXTERN CLASS *CLASS_BooleanArray;
|
|
|
|
EXTERN CLASS *CLASS_ByteArray;
|
|
|
|
EXTERN CLASS *CLASS_ShortArray;
|
|
|
|
EXTERN CLASS *CLASS_IntegerArray;
|
|
|
|
EXTERN CLASS *CLASS_SingleArray;
|
|
|
|
EXTERN CLASS *CLASS_FloatArray;
|
|
|
|
EXTERN CLASS *CLASS_DateArray;
|
|
|
|
EXTERN CLASS *CLASS_StringArray;
|
|
|
|
EXTERN CLASS *CLASS_ObjectArray;
|
|
|
|
EXTERN CLASS *CLASS_VariantArray;
|
|
|
|
EXTERN CLASS *CLASS_LongArray;
|
2008-01-23 20:56:18 +01:00
|
|
|
EXTERN CLASS *CLASS_PointerArray;
|
2007-12-30 17:41:49 +01:00
|
|
|
|
|
|
|
EXTERN CLASS *CLASS_SubCollection;
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
#define DO_ERROR ((void (*)()) -1)
|
|
|
|
|
2009-01-01 14:42:17 +01:00
|
|
|
#define CLASS_is_native(_class) ((_class)->is_native)
|
2010-05-25 13:19:00 +02:00
|
|
|
#define CLASS_is_struct(_class) ((_class)->is_struct)
|
2010-07-09 13:16:49 +02:00
|
|
|
#define CLASS_is_array(_class) ((_class)->is_array)
|
2007-12-30 17:41:49 +01:00
|
|
|
|
2009-01-01 14:42:17 +01:00
|
|
|
#define FUNCTION_is_static(func) ((func)->type & TF_STATIC)
|
2011-09-08 18:01:36 +02:00
|
|
|
//#define FUNCTION_is_native(_desc) (((uintptr_t)(_desc)->exec >> 16) != 0)
|
|
|
|
#define FUNCTION_is_native(_desc) ((_desc)->native)
|
2007-12-30 17:41:49 +01:00
|
|
|
|
|
|
|
#define FUNC_INIT_STATIC 0
|
|
|
|
#define FUNC_INIT_DYNAMIC 1
|
|
|
|
|
|
|
|
|
|
|
|
/* class.c */
|
|
|
|
|
2008-01-17 22:39:26 +01:00
|
|
|
void CLASS_init(void);
|
2008-07-16 12:12:13 +02:00
|
|
|
void CLASS_clean_up(bool silent);
|
|
|
|
void CLASS_exit(void);
|
2007-12-30 17:41:49 +01:00
|
|
|
|
2008-01-17 22:39:26 +01:00
|
|
|
CLASS *CLASS_get(const char *name);
|
|
|
|
int CLASS_count(void);
|
2007-12-30 17:41:49 +01:00
|
|
|
|
2008-01-17 22:39:26 +01:00
|
|
|
CLASS_DESC_SYMBOL *CLASS_get_symbol(CLASS *class, const char *name);
|
|
|
|
CLASS_DESC *CLASS_get_symbol_desc(CLASS *class, const char *name);
|
2007-12-30 17:41:49 +01:00
|
|
|
|
2008-01-17 22:39:26 +01:00
|
|
|
short CLASS_get_symbol_index_kind(CLASS *class, const char *name, int kind, int kind2);
|
|
|
|
CLASS_DESC *CLASS_get_symbol_desc_kind(CLASS *class, const char *name, int kind, int kind2);
|
|
|
|
CLASS_DESC_METHOD *CLASS_get_special_desc(CLASS *class, int spec);
|
2007-12-30 17:41:49 +01:00
|
|
|
|
|
|
|
#define CLASS_get_desc(_class, _index) (((_class)->table[_index].desc))
|
|
|
|
|
2008-01-17 22:39:26 +01:00
|
|
|
CLASS_DESC_EVENT *CLASS_get_event_desc(CLASS *class, const char *name);
|
2007-12-30 17:41:49 +01:00
|
|
|
|
2010-06-05 01:48:53 +02:00
|
|
|
#define CLASS_find_symbol(_class, _name) \
|
|
|
|
SYMBOL_find((_class)->table, (_class)->sort, (_class)->n_desc, sizeof(CLASS_DESC_SYMBOL), TF_IGNORE_CASE, (_name), strlen((_name)), NULL)
|
|
|
|
|
2008-01-17 22:39:26 +01:00
|
|
|
int CLASS_find_symbol_with_prefix(CLASS *class, const char *name, const char *prefix);
|
2007-12-30 17:41:49 +01:00
|
|
|
|
2008-01-17 22:39:26 +01:00
|
|
|
CLASS *CLASS_look(const char *name, int len);
|
|
|
|
CLASS *CLASS_find(const char *name);
|
2007-12-30 17:41:49 +01:00
|
|
|
|
2008-01-17 22:39:26 +01:00
|
|
|
TABLE *CLASS_get_table(void);
|
2007-12-30 17:41:49 +01:00
|
|
|
|
2009-07-08 21:57:50 +02:00
|
|
|
bool CLASS_inherits(CLASS *class, CLASS *parent);
|
2007-12-30 17:41:49 +01:00
|
|
|
|
2008-01-17 22:39:26 +01:00
|
|
|
CLASS *CLASS_replace_global(const char *name);
|
|
|
|
CLASS *CLASS_look_global(const char *name, int len);
|
|
|
|
CLASS *CLASS_find_global(const char *name);
|
|
|
|
CLASS *CLASS_check_global(char *name);
|
2007-12-30 17:41:49 +01:00
|
|
|
|
2008-01-17 22:39:26 +01:00
|
|
|
void CLASS_ref(void *object);
|
2009-07-08 21:57:50 +02:00
|
|
|
bool CLASS_unref(void *object, bool can_free);
|
2008-08-14 21:42:27 +02:00
|
|
|
void CLASS_free(void *object);
|
2008-01-17 22:39:26 +01:00
|
|
|
void CLASS_release(CLASS *class, char *data);
|
2007-12-30 17:41:49 +01:00
|
|
|
|
2008-01-17 22:39:26 +01:00
|
|
|
int CLASS_get_inheritance(CLASS *class, CLASS **her);
|
2007-12-30 17:41:49 +01:00
|
|
|
|
2008-01-17 22:39:26 +01:00
|
|
|
void CLASS_do_nothing();
|
|
|
|
int CLASS_return_zero();
|
2007-12-30 17:41:49 +01:00
|
|
|
|
2008-01-17 22:39:26 +01:00
|
|
|
void CLASS_sort(CLASS *class);
|
2007-12-30 17:41:49 +01:00
|
|
|
|
2008-01-17 22:39:26 +01:00
|
|
|
void CLASS_inheritance(CLASS *class, CLASS *parent);
|
2011-08-20 02:33:36 +02:00
|
|
|
void CLASS_make_description(CLASS *class, const CLASS_DESC *desc, int n_desc, int *first);
|
2008-01-17 22:39:26 +01:00
|
|
|
void CLASS_make_event(CLASS *class, int *first);
|
2009-07-08 21:57:50 +02:00
|
|
|
void CLASS_calc_info(CLASS *class, int n_event, int size_dynamic, bool all, int size_static);
|
2007-12-30 17:41:49 +01:00
|
|
|
|
2008-01-17 22:39:26 +01:00
|
|
|
void *CLASS_auto_create(CLASS *class, int nparam);
|
2007-12-30 17:41:49 +01:00
|
|
|
|
2008-01-17 22:39:26 +01:00
|
|
|
void CLASS_search_special(CLASS *class);
|
2007-12-30 17:41:49 +01:00
|
|
|
|
2008-01-17 22:39:26 +01:00
|
|
|
CLASS_DESC_SYMBOL *CLASS_get_next_sorted_symbol(CLASS *class, int *index);
|
2007-12-30 17:41:49 +01:00
|
|
|
|
|
|
|
int CLASS_can_be_used_like_an_array(CLASS *class);
|
|
|
|
|
2008-08-31 02:32:21 +02:00
|
|
|
void CLASS_create_array_class(CLASS *class);
|
2009-01-05 12:38:03 +01:00
|
|
|
CLASS *CLASS_get_array_class(CLASS *class);
|
2007-12-30 17:41:49 +01:00
|
|
|
|
2010-07-08 00:06:05 +02:00
|
|
|
void CLASS_create_array_of_struct_class(CLASS *class);
|
|
|
|
CLASS *CLASS_get_array_of_struct_class(CLASS *class);
|
|
|
|
|
2010-05-27 00:01:28 +02:00
|
|
|
int CLASS_sizeof(CLASS *class);
|
|
|
|
|
2007-12-30 17:41:49 +01:00
|
|
|
/* class_init.c */
|
|
|
|
|
2008-01-17 22:39:26 +01:00
|
|
|
void CLASS_init_native(void);
|
2007-12-30 17:41:49 +01:00
|
|
|
|
|
|
|
/* class_load.c */
|
|
|
|
|
2008-01-17 22:39:26 +01:00
|
|
|
TYPE CLASS_ctype_to_type(CLASS *class, CTYPE ctype);
|
2010-07-08 00:06:05 +02:00
|
|
|
int CLASS_sizeof_ctype(CLASS *class, CTYPE ctype);
|
|
|
|
|
2008-01-17 22:39:26 +01:00
|
|
|
void CLASS_load_without_init(CLASS *class);
|
|
|
|
void CLASS_load_real(CLASS *class);
|
2007-12-30 17:41:49 +01:00
|
|
|
#define CLASS_load(_class) \
|
2010-06-05 01:48:53 +02:00
|
|
|
({ \
|
|
|
|
if (!((_class)->ready)) \
|
2009-01-05 12:38:03 +01:00
|
|
|
CLASS_load_real(_class); \
|
2010-06-05 01:48:53 +02:00
|
|
|
})
|
2007-12-30 17:41:49 +01:00
|
|
|
|
|
|
|
/* class_native.c */
|
|
|
|
|
2008-01-17 22:39:26 +01:00
|
|
|
CLASS *CLASS_register_class(GB_DESC *desc, CLASS *class);
|
|
|
|
CLASS *CLASS_register(GB_DESC *desc);
|
2007-12-30 17:41:49 +01:00
|
|
|
|
|
|
|
#define SET_IF_NULL(ptr, val) if ((ptr) == NULL) (ptr) = (val)
|
|
|
|
/*
|
|
|
|
#define DO_NOTHING(ptr) if ((ptr) == NULL) (ptr) = CLASS_do_nothing
|
|
|
|
#define RETURN_ZERO(ptr) if ((ptr) == NULL) (ptr) = CLASS_return_zero
|
|
|
|
*/
|
|
|
|
|
|
|
|
#define CLASS_is_virtual(class) (class->is_virtual)
|
|
|
|
|
|
|
|
#endif /* _CLASS_H */
|