2007-12-30 17:41:49 +01:00
|
|
|
/***************************************************************************
|
|
|
|
|
2011-12-31 03:39:20 +01:00
|
|
|
gbx_class_desc.h
|
2007-12-30 17:41:49 +01:00
|
|
|
|
2013-08-03 17:38:01 +02:00
|
|
|
(c) 2000-2013 Benoît Minisini <gambas@users.sourceforge.net>
|
2007-12-30 17:41:49 +01:00
|
|
|
|
2011-12-31 03:39:20 +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)
|
|
|
|
any later version.
|
2007-12-30 17:41:49 +01:00
|
|
|
|
2011-12-31 03:39:20 +01: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
|
|
|
|
2011-12-31 03:39:20 +01:00
|
|
|
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.
|
2007-12-30 17:41:49 +01:00
|
|
|
|
|
|
|
***************************************************************************/
|
|
|
|
|
|
|
|
#ifndef __GBX_CLASS_DESC_H
|
|
|
|
#define __GBX_CLASS_DESC_H
|
|
|
|
|
|
|
|
#include "gb_class_desc_common.h"
|
2016-03-24 00:31:42 +01:00
|
|
|
#include "gb_table.h"
|
2007-12-30 17:41:49 +01:00
|
|
|
|
|
|
|
#define CD_PROPERTY 'p'
|
|
|
|
#define CD_PROPERTY_READ 'r'
|
|
|
|
#define CD_METHOD 'm'
|
|
|
|
#define CD_CONSTANT 'C'
|
|
|
|
#define CD_EVENT ':'
|
|
|
|
#define CD_STATIC_PROPERTY 'P'
|
|
|
|
#define CD_STATIC_PROPERTY_READ 'R'
|
|
|
|
#define CD_STATIC_METHOD 'M'
|
|
|
|
#define CD_VARIABLE 'v'
|
2010-05-25 13:19:00 +02:00
|
|
|
#define CD_STRUCT_FIELD 'f'
|
2007-12-30 17:41:49 +01:00
|
|
|
#define CD_STATIC_VARIABLE 'V'
|
|
|
|
#define CD_EXTERN 'X'
|
|
|
|
|
|
|
|
#define CD_STATIC_LIST "PRMVX"
|
|
|
|
#define CD_CALL_SOMETHING_LIST "prmPRM"
|
|
|
|
|
|
|
|
|
|
|
|
typedef
|
2011-08-02 01:36:41 +02:00
|
|
|
struct {
|
|
|
|
char *name;
|
|
|
|
TYPE type; // property datatype
|
|
|
|
void (*read)(); // read property function
|
|
|
|
void (*write)(); // write property function
|
2011-09-08 18:01:36 +02:00
|
|
|
unsigned native : 1; // if the property is native
|
|
|
|
unsigned _reserved : 7;
|
|
|
|
char _reserved2[3];
|
2009-06-17 16:13:50 +02:00
|
|
|
#ifdef OS_64BITS
|
2011-09-08 18:01:36 +02:00
|
|
|
int _reserved3;
|
2009-06-17 16:13:50 +02:00
|
|
|
#endif
|
2011-08-02 01:36:41 +02:00
|
|
|
struct _CLASS *class;
|
|
|
|
}
|
|
|
|
CLASS_DESC_PROPERTY;
|
2007-12-30 17:41:49 +01:00
|
|
|
|
|
|
|
typedef
|
2011-08-02 01:36:41 +02:00
|
|
|
struct {
|
|
|
|
char *name;
|
|
|
|
TYPE type; // variable datatype
|
|
|
|
int offset; // variable offset in object memory
|
2010-05-21 01:23:39 +02:00
|
|
|
CTYPE ctype; // variable compilation datatype
|
|
|
|
intptr_t _reserved;
|
2009-06-17 16:13:50 +02:00
|
|
|
#ifdef OS_64BITS
|
2010-05-21 01:23:39 +02:00
|
|
|
intptr_t _reserved2;
|
2009-06-17 16:13:50 +02:00
|
|
|
#endif
|
2011-08-02 01:36:41 +02:00
|
|
|
struct _CLASS *class;
|
|
|
|
}
|
|
|
|
CLASS_DESC_VARIABLE;
|
2007-12-30 17:41:49 +01:00
|
|
|
|
|
|
|
typedef
|
2011-08-02 01:36:41 +02:00
|
|
|
struct {
|
|
|
|
char *name;
|
|
|
|
TYPE type; // return value datatype
|
|
|
|
void (*exec)(); // method
|
|
|
|
TYPE *signature; // signature
|
|
|
|
char npmin; // minimum number of arguments
|
|
|
|
char npmax; // maximum number of arguments
|
|
|
|
char npvar; // if there is a variable number of arguments
|
2011-09-08 18:01:36 +02:00
|
|
|
unsigned native : 1; // if the method is native
|
|
|
|
unsigned subr : 1; // static method called like a subr
|
|
|
|
unsigned _reserved : 6;
|
2009-06-17 16:13:50 +02:00
|
|
|
#ifdef OS_64BITS
|
2011-09-08 18:01:36 +02:00
|
|
|
int _reserved2;
|
2009-06-17 16:13:50 +02:00
|
|
|
#endif
|
2011-08-02 01:36:41 +02:00
|
|
|
struct _CLASS *class;
|
|
|
|
}
|
|
|
|
CLASS_DESC_METHOD;
|
2007-12-30 17:41:49 +01:00
|
|
|
|
|
|
|
typedef
|
2011-08-02 01:36:41 +02:00
|
|
|
struct {
|
|
|
|
char *name;
|
|
|
|
TYPE type; // return value datatype - N/A
|
2012-08-20 20:05:25 +02:00
|
|
|
intptr_t index; // event index
|
2011-08-02 01:36:41 +02:00
|
|
|
TYPE *signature; // event signature
|
|
|
|
char npmin; // minimum number of arguments
|
|
|
|
char npmax; // maximum number of arguments
|
|
|
|
char npvar; // if there is a variable number of arguments
|
|
|
|
char _reserved;
|
2009-06-17 16:13:50 +02:00
|
|
|
#ifdef OS_64BITS
|
2009-06-19 01:47:56 +02:00
|
|
|
int _reserved2;
|
2009-06-17 16:13:50 +02:00
|
|
|
#endif
|
2011-08-02 01:36:41 +02:00
|
|
|
struct _CLASS *class;
|
|
|
|
}
|
|
|
|
CLASS_DESC_EVENT;
|
2007-12-30 17:41:49 +01:00
|
|
|
|
|
|
|
typedef
|
2011-08-02 01:36:41 +02:00
|
|
|
struct {
|
|
|
|
char *name;
|
|
|
|
TYPE type; // return value datatype
|
|
|
|
int exec; // extern function index
|
|
|
|
TYPE *signature; // signature
|
|
|
|
char npmin; // minimum number of arguments
|
|
|
|
char npmax; // maximum number of arguments
|
|
|
|
char npvar; // if there is a variable number of arguments
|
|
|
|
char _reserved;
|
2009-06-17 16:13:50 +02:00
|
|
|
#ifdef OS_64BITS
|
2009-06-19 01:47:56 +02:00
|
|
|
int _reserved2;
|
2009-06-17 16:13:50 +02:00
|
|
|
#endif
|
2011-08-02 01:36:41 +02:00
|
|
|
struct _CLASS *class;
|
|
|
|
}
|
|
|
|
CLASS_DESC_EXTERN;
|
2007-12-30 17:41:49 +01:00
|
|
|
|
|
|
|
typedef
|
2011-08-02 01:36:41 +02:00
|
|
|
struct {
|
|
|
|
char *name;
|
|
|
|
TYPE type; // constant datatype
|
|
|
|
union {
|
|
|
|
int _integer;
|
|
|
|
double _float;
|
2011-12-30 21:49:54 +01:00
|
|
|
float _single;
|
2011-08-02 01:36:41 +02:00
|
|
|
char *_string;
|
|
|
|
int64_t _long;
|
|
|
|
void *_pointer;
|
|
|
|
}
|
|
|
|
value;
|
|
|
|
unsigned translate : 1;
|
|
|
|
unsigned _reserved : 31;
|
|
|
|
#ifdef OS_64BITS
|
|
|
|
int _reserved2;
|
|
|
|
#endif
|
|
|
|
struct _CLASS *class;
|
|
|
|
}
|
|
|
|
CLASS_DESC_CONSTANT;
|
2007-12-30 17:41:49 +01:00
|
|
|
|
|
|
|
typedef
|
2011-08-02 01:36:41 +02:00
|
|
|
struct {
|
|
|
|
char *name;
|
|
|
|
void (*func)();
|
|
|
|
}
|
|
|
|
CLASS_DESC_HOOK;
|
2007-12-30 17:41:49 +01:00
|
|
|
|
|
|
|
typedef
|
2011-08-02 01:36:41 +02:00
|
|
|
struct {
|
|
|
|
char *name;
|
|
|
|
intptr_t type;
|
|
|
|
intptr_t val1;
|
|
|
|
intptr_t val2;
|
2012-07-17 21:36:11 +02:00
|
|
|
union {
|
|
|
|
double _double;
|
|
|
|
intptr_t _int[2];
|
|
|
|
} val3;
|
2011-08-02 01:36:41 +02:00
|
|
|
}
|
|
|
|
CLASS_DESC_GAMBAS;
|
2007-12-30 17:41:49 +01:00
|
|
|
|
|
|
|
|
|
|
|
typedef
|
2011-08-02 01:36:41 +02:00
|
|
|
union {
|
|
|
|
CLASS_DESC_PROPERTY property;
|
|
|
|
CLASS_DESC_VARIABLE variable;
|
|
|
|
CLASS_DESC_METHOD method;
|
|
|
|
CLASS_DESC_CONSTANT constant;
|
|
|
|
CLASS_DESC_EVENT event;
|
|
|
|
CLASS_DESC_HOOK hook;
|
|
|
|
CLASS_DESC_GAMBAS gambas;
|
|
|
|
CLASS_DESC_EXTERN ext;
|
|
|
|
}
|
|
|
|
CLASS_DESC;
|
2007-12-30 17:41:49 +01:00
|
|
|
|
|
|
|
typedef
|
2011-08-02 01:36:41 +02:00
|
|
|
struct {
|
|
|
|
char *name;
|
|
|
|
int len;
|
2016-03-24 00:31:42 +01:00
|
|
|
#if TABLE_USE_KEY
|
2016-03-20 19:29:12 +01:00
|
|
|
uint key;
|
2016-03-24 00:31:42 +01:00
|
|
|
#endif
|
2011-08-02 01:36:41 +02:00
|
|
|
CLASS_DESC *desc;
|
|
|
|
}
|
|
|
|
PACKED
|
|
|
|
CLASS_DESC_SYMBOL;
|
2007-12-30 17:41:49 +01:00
|
|
|
|
|
|
|
|
|
|
|
#define CLASS_DESC_get_type(d) (*(d)->gambas.name)
|
2012-07-14 17:18:22 +02:00
|
|
|
#define CLASS_DESC_is_static_method(d) (CLASS_DESC_get_type((CLASS_DESC *)d) == 'M')
|
2007-12-30 17:41:49 +01:00
|
|
|
#define CLASS_DESC_SELF (-1)
|
|
|
|
|
2010-07-19 14:33:57 +02:00
|
|
|
char *CLASS_DESC_get_signature(CLASS_DESC *cd);
|
2011-08-20 02:33:36 +02:00
|
|
|
const char *CLASS_DESC_get_type_name(const CLASS_DESC *desc);
|
2007-12-30 17:41:49 +01:00
|
|
|
|
2012-07-14 17:18:22 +02:00
|
|
|
|
2007-12-30 17:41:49 +01:00
|
|
|
#endif
|