2007-12-30 17:41:49 +01:00
|
|
|
/***************************************************************************
|
|
|
|
|
2009-08-17 12:41:51 +02:00
|
|
|
gambas.h
|
2007-12-30 17:41:49 +01:00
|
|
|
|
2018-02-12 02:53:46 +01:00
|
|
|
(c) 2000-2017 Benoît Minisini <g4mba5@gmail.com>
|
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,
|
2011-12-31 03:39:20 +01:00
|
|
|
MA 02110-1301, USA.
|
2007-12-30 17:41:49 +01:00
|
|
|
|
|
|
|
***************************************************************************/
|
|
|
|
|
|
|
|
#ifndef __GAMBAS_H
|
|
|
|
#define __GAMBAS_H
|
|
|
|
|
2014-08-28 15:50:09 +02:00
|
|
|
#ifdef __CYGWIN__
|
|
|
|
#include <strings.h>
|
|
|
|
#endif
|
|
|
|
|
2018-05-28 03:18:44 +02:00
|
|
|
#ifndef NO_CONFIG_H
|
2020-11-24 21:43:10 +01:00
|
|
|
#ifdef PACKAGE_NAME
|
|
|
|
#undef PACKAGE_NAME
|
|
|
|
#undef PACKAGE_BUGREPORT
|
|
|
|
#undef PACKAGE_STRING
|
|
|
|
#undef PACKAGE_TARNAME
|
|
|
|
#undef PACKAGE_VERSION
|
|
|
|
#undef PACKAGE_URL
|
|
|
|
#endif
|
2007-12-30 17:41:49 +01:00
|
|
|
#include "config.h"
|
2018-05-28 03:18:44 +02:00
|
|
|
#endif
|
2020-11-24 21:43:10 +01:00
|
|
|
|
2008-01-05 15:07:21 +01:00
|
|
|
#include <stdint.h>
|
2008-08-14 21:42:27 +02:00
|
|
|
#include <stddef.h>
|
2010-04-05 03:44:43 +02:00
|
|
|
#include <sys/types.h>
|
2020-06-20 04:56:22 +02:00
|
|
|
#include <sys/time.h>
|
2007-12-30 17:41:49 +01:00
|
|
|
|
|
|
|
/* Gambas API Version */
|
|
|
|
|
|
|
|
#define GB_VERSION 1
|
|
|
|
|
|
|
|
|
|
|
|
/* Useful macros */
|
|
|
|
|
|
|
|
#ifndef CLEAR
|
|
|
|
#define CLEAR(s) (memset(s, 0, sizeof(*s)))
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifndef offsetof
|
|
|
|
#define offsetof(_type, _arg) ((size_t)&(((_type *)0)->_arg))
|
|
|
|
#endif
|
|
|
|
|
|
|
|
/* The following symbols must be declared with EXPORT in a component:
|
|
|
|
- GB
|
|
|
|
- GB_INIT()
|
|
|
|
- GB_EXIT()
|
|
|
|
- GB_CLASSES
|
|
|
|
- The component interface if present
|
|
|
|
*/
|
|
|
|
|
2011-07-29 23:13:08 +02:00
|
|
|
#ifdef EXPORT
|
|
|
|
#undef EXPORT
|
|
|
|
#endif
|
2007-12-30 17:41:49 +01:00
|
|
|
#ifdef HAVE_GCC_VISIBILITY
|
|
|
|
#define EXPORT __attribute__((visibility("default")))
|
|
|
|
#else
|
|
|
|
#define EXPORT
|
|
|
|
#endif
|
|
|
|
|
2018-06-13 18:26:06 +02:00
|
|
|
#if !defined(__cplusplus)
|
2011-05-16 04:16:22 +02:00
|
|
|
#ifdef bool
|
|
|
|
#undef bool
|
|
|
|
#endif
|
|
|
|
#define bool char
|
2008-01-17 22:39:26 +01:00
|
|
|
#endif
|
2007-12-30 17:41:49 +01:00
|
|
|
|
2008-03-21 16:39:46 +01:00
|
|
|
#ifndef PACKED
|
|
|
|
#define PACKED __attribute__((packed))
|
|
|
|
#endif
|
|
|
|
|
2007-12-30 17:41:49 +01:00
|
|
|
/* Gambas datatypes identifiers */
|
|
|
|
|
|
|
|
#define GB_T_VOID 0
|
|
|
|
#define GB_T_BOOLEAN 1
|
|
|
|
#define GB_T_BYTE 2
|
|
|
|
#define GB_T_SHORT 3
|
|
|
|
#define GB_T_INTEGER 4
|
|
|
|
#define GB_T_LONG 5
|
|
|
|
#define GB_T_SINGLE 6
|
|
|
|
#define GB_T_FLOAT 7
|
|
|
|
#define GB_T_DATE 8
|
|
|
|
#define GB_T_STRING 9
|
|
|
|
#define GB_T_CSTRING 10
|
2010-05-19 14:43:57 +02:00
|
|
|
#define GB_T_POINTER 11
|
|
|
|
#define GB_T_VARIANT 12
|
2018-05-29 23:25:57 +02:00
|
|
|
#define GB_T_FUNCTION 13
|
|
|
|
#define GB_T_CLASS 14
|
2007-12-30 17:41:49 +01:00
|
|
|
#define GB_T_NULL 15
|
|
|
|
#define GB_T_OBJECT 16
|
|
|
|
|
|
|
|
|
|
|
|
/* This type represents a Gambas datatype identifier */
|
|
|
|
|
|
|
|
typedef
|
2009-08-03 00:48:08 +02:00
|
|
|
uintptr_t GB_TYPE;
|
2007-12-30 17:41:49 +01:00
|
|
|
|
|
|
|
|
|
|
|
/* This opaque type represents a Gambas class identifier */
|
|
|
|
|
|
|
|
typedef
|
2009-08-03 00:48:08 +02:00
|
|
|
GB_TYPE GB_CLASS;
|
2007-12-30 17:41:49 +01:00
|
|
|
|
|
|
|
|
|
|
|
/* This structure represents the base of every Gambas object.
|
|
|
|
It must be placed in the beginning of all object structure defined
|
|
|
|
in a component.
|
|
|
|
*/
|
|
|
|
|
|
|
|
typedef
|
2008-11-10 01:18:00 +01:00
|
|
|
struct {
|
|
|
|
GB_CLASS klass;
|
|
|
|
intptr_t ref;
|
|
|
|
}
|
|
|
|
GB_BASE;
|
2007-12-30 17:41:49 +01:00
|
|
|
|
|
|
|
|
|
|
|
/* Gambas STRING datatype definition */
|
|
|
|
|
|
|
|
typedef
|
2009-12-24 03:02:05 +01:00
|
|
|
struct {
|
|
|
|
GB_TYPE type;
|
|
|
|
struct {
|
|
|
|
char *addr;
|
|
|
|
int start;
|
|
|
|
int len;
|
|
|
|
} value;
|
|
|
|
#if __WORDSIZE == 64
|
2008-01-17 22:39:26 +01:00
|
|
|
intptr_t _reserved;
|
|
|
|
#endif
|
2009-12-24 03:02:05 +01:00
|
|
|
}
|
|
|
|
GB_STRING;
|
2007-12-30 17:41:49 +01:00
|
|
|
|
|
|
|
|
|
|
|
/* Gambas INTEGER datatype definition */
|
|
|
|
|
|
|
|
typedef
|
2009-12-24 03:02:05 +01:00
|
|
|
struct {
|
|
|
|
GB_TYPE type;
|
|
|
|
int value;
|
|
|
|
#if __WORDSIZE == 64
|
|
|
|
int _pad;
|
|
|
|
#endif
|
2008-01-17 22:39:26 +01:00
|
|
|
intptr_t _reserved[2];
|
2009-12-24 03:02:05 +01:00
|
|
|
}
|
|
|
|
GB_INTEGER;
|
2007-12-30 17:41:49 +01:00
|
|
|
|
|
|
|
|
2009-12-24 03:02:05 +01:00
|
|
|
/* Gambas LONG datatype definition */
|
2007-12-30 17:41:49 +01:00
|
|
|
|
|
|
|
typedef
|
2009-12-24 03:02:05 +01:00
|
|
|
struct {
|
|
|
|
GB_TYPE type;
|
|
|
|
#if __WORDSIZE == 32
|
|
|
|
int _pad;
|
2008-11-10 01:18:00 +01:00
|
|
|
#endif
|
2009-12-24 03:02:05 +01:00
|
|
|
int64_t value;
|
|
|
|
#if __WORDSIZE == 64
|
|
|
|
intptr_t _reserved[2];
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
GB_LONG;
|
2007-12-30 17:41:49 +01:00
|
|
|
|
2010-05-19 14:43:57 +02:00
|
|
|
|
2008-01-23 20:56:18 +01:00
|
|
|
/* Gambas POINTER datatype definition */
|
|
|
|
|
|
|
|
typedef
|
2009-12-24 03:02:05 +01:00
|
|
|
struct {
|
|
|
|
GB_TYPE type;
|
|
|
|
intptr_t value;
|
|
|
|
intptr_t _reserved[2];
|
|
|
|
}
|
|
|
|
GB_POINTER;
|
2008-01-23 20:56:18 +01:00
|
|
|
|
|
|
|
|
2007-12-30 17:41:49 +01:00
|
|
|
/* Gambas BOOLEAN datatype definition */
|
|
|
|
|
|
|
|
typedef
|
2009-12-24 03:02:05 +01:00
|
|
|
struct {
|
|
|
|
GB_TYPE type;
|
|
|
|
int value;
|
|
|
|
#if __WORDSIZE == 64
|
|
|
|
int _pad;
|
|
|
|
#endif
|
2008-01-17 22:39:26 +01:00
|
|
|
intptr_t _reserved[2];
|
2009-12-24 03:02:05 +01:00
|
|
|
}
|
|
|
|
GB_BOOLEAN;
|
2007-12-30 17:41:49 +01:00
|
|
|
|
|
|
|
|
2010-11-16 02:49:18 +01:00
|
|
|
/* Gambas SINGLE datatype definition */
|
|
|
|
|
|
|
|
typedef
|
|
|
|
struct {
|
|
|
|
GB_TYPE type;
|
|
|
|
float value;
|
|
|
|
#if __WORDSIZE == 64
|
|
|
|
float _pad;
|
|
|
|
#endif
|
|
|
|
intptr_t _reserved[2];
|
|
|
|
}
|
|
|
|
GB_SINGLE;
|
|
|
|
|
|
|
|
|
2007-12-30 17:41:49 +01:00
|
|
|
/* Gambas FLOAT datatype definition */
|
|
|
|
|
|
|
|
typedef
|
2009-12-24 03:02:05 +01:00
|
|
|
struct {
|
|
|
|
GB_TYPE type;
|
|
|
|
#if __WORDSIZE == 32
|
2008-11-10 01:18:00 +01:00
|
|
|
int _pad;
|
|
|
|
#endif
|
2009-12-24 03:02:05 +01:00
|
|
|
double value;
|
|
|
|
#if __WORDSIZE == 64
|
|
|
|
intptr_t _reserved[2];
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
GB_FLOAT;
|
2007-12-30 17:41:49 +01:00
|
|
|
|
|
|
|
|
|
|
|
/* Gambas DATE datatype definition */
|
|
|
|
|
|
|
|
typedef
|
2009-12-24 03:02:05 +01:00
|
|
|
struct {
|
|
|
|
int date;
|
|
|
|
int time;
|
|
|
|
}
|
|
|
|
GB_DATE_VALUE;
|
2007-12-30 17:41:49 +01:00
|
|
|
|
|
|
|
typedef
|
2009-12-24 03:02:05 +01:00
|
|
|
struct {
|
|
|
|
GB_TYPE type;
|
2008-11-10 01:18:00 +01:00
|
|
|
GB_DATE_VALUE value;
|
2009-12-24 03:02:05 +01:00
|
|
|
#if __WORDSIZE == 64
|
|
|
|
intptr_t _reserved[2];
|
|
|
|
#else
|
|
|
|
int _reserved;
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
GB_DATE;
|
2007-12-30 17:41:49 +01:00
|
|
|
|
|
|
|
|
|
|
|
/* Gambas OBJECT datatype definition */
|
|
|
|
|
|
|
|
typedef
|
2009-12-24 03:02:05 +01:00
|
|
|
struct {
|
|
|
|
GB_TYPE type;
|
|
|
|
void *value;
|
|
|
|
intptr_t _reserved[2];
|
|
|
|
}
|
|
|
|
GB_OBJECT;
|
|
|
|
|
|
|
|
|
|
|
|
/* Gambas VARIANT datatype definition */
|
|
|
|
|
|
|
|
typedef
|
|
|
|
struct {
|
|
|
|
GB_TYPE type;
|
|
|
|
union {
|
|
|
|
char _boolean;
|
|
|
|
unsigned char _byte;
|
|
|
|
short _short;
|
|
|
|
int _integer;
|
|
|
|
int64_t _long;
|
|
|
|
float _single;
|
|
|
|
double _float;
|
|
|
|
GB_DATE_VALUE _date;
|
|
|
|
char *_string;
|
2010-05-19 14:43:57 +02:00
|
|
|
intptr_t _pointer;
|
2009-12-24 03:02:05 +01:00
|
|
|
void *_object;
|
|
|
|
int64_t data;
|
|
|
|
}
|
|
|
|
value;
|
2008-11-10 01:18:00 +01:00
|
|
|
}
|
2013-10-08 23:58:37 +02:00
|
|
|
PACKED
|
2009-12-24 03:02:05 +01:00
|
|
|
GB_VARIANT_VALUE;
|
|
|
|
|
|
|
|
typedef
|
|
|
|
struct {
|
|
|
|
GB_TYPE type;
|
|
|
|
GB_VARIANT_VALUE value;
|
|
|
|
#if __WORDSIZE == 64
|
|
|
|
int64_t _pad;
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
GB_VARIANT;
|
2007-12-30 17:41:49 +01:00
|
|
|
|
|
|
|
|
|
|
|
/* Gambas common value definition */
|
|
|
|
|
|
|
|
typedef
|
2008-11-10 01:18:00 +01:00
|
|
|
union {
|
|
|
|
GB_TYPE type;
|
|
|
|
GB_BOOLEAN _boolean;
|
|
|
|
GB_INTEGER _integer;
|
|
|
|
GB_LONG _long;
|
2012-07-08 16:35:58 +02:00
|
|
|
GB_SINGLE _single;
|
2008-11-10 01:18:00 +01:00
|
|
|
GB_FLOAT _float;
|
|
|
|
GB_DATE _date;
|
|
|
|
GB_STRING _string;
|
2010-05-19 14:43:57 +02:00
|
|
|
GB_POINTER _pointer;
|
2008-11-10 01:18:00 +01:00
|
|
|
GB_OBJECT _object;
|
|
|
|
GB_VARIANT _variant;
|
|
|
|
}
|
|
|
|
GB_VALUE;
|
2007-12-30 17:41:49 +01:00
|
|
|
|
|
|
|
|
|
|
|
/* Predefined errors constants */
|
|
|
|
|
2011-08-07 21:48:08 +02:00
|
|
|
#define GB_ERR_TYPE ((char *)6)
|
2013-09-01 22:40:05 +02:00
|
|
|
#define GB_ERR_OVERFLOW ((char *)7)
|
2011-08-07 21:48:08 +02:00
|
|
|
#define GB_ERR_NSYMBOL ((char *)11)
|
2018-06-01 03:50:42 +02:00
|
|
|
#define GB_ERR_NOBJECT ((char *)12)
|
2015-05-10 12:42:24 +02:00
|
|
|
#define GB_ERR_NWRITE ((char *)16)
|
2011-08-07 21:48:08 +02:00
|
|
|
#define GB_ERR_NPROPERTY ((char *)17)
|
|
|
|
#define GB_ERR_ARG ((char *)20)
|
|
|
|
#define GB_ERR_BOUND ((char *)21)
|
2012-07-08 16:35:58 +02:00
|
|
|
#define GB_ERR_ZERO ((char *)26)
|
2007-12-30 17:41:49 +01:00
|
|
|
|
|
|
|
|
|
|
|
/* Gambas description start macro */
|
|
|
|
|
|
|
|
#define GB_DECLARE(name, size) \
|
2008-11-10 01:18:00 +01:00
|
|
|
{ name, (intptr_t)GB_VERSION, (intptr_t)size }
|
2007-12-30 17:41:49 +01:00
|
|
|
|
|
|
|
|
|
|
|
/* Gambas description end macro */
|
|
|
|
|
|
|
|
#define GB_END_DECLARE { (char *)0 }
|
|
|
|
|
|
|
|
|
|
|
|
/* Special description identifiers */
|
|
|
|
|
|
|
|
#define GB_VIRTUAL_CLASS_ID ((char *)1)
|
|
|
|
#define GB_HOOK_CHECK_ID ((char *)2)
|
|
|
|
#define GB_NOT_CREATABLE_ID ((char *)3)
|
|
|
|
#define GB_AUTO_CREATABLE_ID ((char *)4)
|
|
|
|
#define GB_INHERITS_ID ((char *)5)
|
|
|
|
|
|
|
|
|
|
|
|
/* Description hook macros */
|
|
|
|
|
|
|
|
//#define GB_HOOK_NEW(hook) { GB_HOOK_NEW_ID, (int)hook }
|
|
|
|
//#define GB_HOOK_FREE(hook) { GB_HOOK_FREE_ID, (int)hook }
|
2008-01-05 15:07:21 +01:00
|
|
|
#define GB_HOOK_CHECK(hook) { GB_HOOK_CHECK_ID, (intptr_t)hook }
|
2007-12-30 17:41:49 +01:00
|
|
|
|
|
|
|
|
|
|
|
/* Virtual class description macro */
|
|
|
|
|
|
|
|
#define GB_VIRTUAL_CLASS() { GB_VIRTUAL_CLASS_ID }, { GB_NOT_CREATABLE_ID }
|
|
|
|
|
2012-07-21 22:43:10 +02:00
|
|
|
#define GB_DECLARE_VIRTUAL(name) \
|
|
|
|
{ name, (intptr_t)GB_VERSION, (intptr_t)0 }, GB_VIRTUAL_CLASS()
|
|
|
|
|
2007-12-30 17:41:49 +01:00
|
|
|
|
|
|
|
/* Not creatable class macro */
|
|
|
|
|
|
|
|
#define GB_NOT_CREATABLE() { GB_NOT_CREATABLE_ID }
|
|
|
|
|
2014-09-07 23:21:14 +02:00
|
|
|
#define GB_DECLARE_STATIC(name) \
|
|
|
|
{ name, (intptr_t)GB_VERSION, (intptr_t)0 }, GB_NOT_CREATABLE()
|
|
|
|
|
2007-12-30 17:41:49 +01:00
|
|
|
|
|
|
|
/* Auto creatable class macro */
|
|
|
|
|
|
|
|
#define GB_AUTO_CREATABLE() { GB_AUTO_CREATABLE_ID }
|
|
|
|
|
|
|
|
|
|
|
|
/* Symbol description prefixes */
|
|
|
|
|
|
|
|
#define GB_PROPERTY_ID 'p'
|
|
|
|
#define GB_METHOD_ID 'm'
|
|
|
|
#define GB_CONSTANT_ID 'C'
|
|
|
|
#define GB_EVENT_ID ':'
|
|
|
|
#define GB_ENUM_ID '#'
|
|
|
|
#define GB_STATIC_PROPERTY_ID 'P'
|
|
|
|
#define GB_STATIC_METHOD_ID 'M'
|
|
|
|
|
|
|
|
|
|
|
|
/* Symbol description macros */
|
|
|
|
|
|
|
|
#define GB_CONSTANT(symbol, type, value) \
|
2008-11-10 01:18:00 +01:00
|
|
|
{ "C" symbol, (intptr_t)type, (intptr_t)value }
|
2007-12-30 17:41:49 +01:00
|
|
|
|
2012-07-16 18:30:55 +02:00
|
|
|
#define GB_FLOAT_CONSTANT(symbol, value) \
|
|
|
|
{ "C" symbol, (intptr_t)"f", (intptr_t)0, (intptr_t)0, (double)value }
|
|
|
|
|
2007-12-30 17:41:49 +01:00
|
|
|
#define GB_PROPERTY(symbol, type, proc) \
|
2008-11-10 01:18:00 +01:00
|
|
|
{ "p" symbol, (intptr_t)type, (intptr_t)proc }
|
2007-12-30 17:41:49 +01:00
|
|
|
|
|
|
|
#define GB_PROPERTY_READ(symbol, type, proc) \
|
2008-11-10 01:18:00 +01:00
|
|
|
{ "r" symbol, (intptr_t)type, (intptr_t)proc }
|
2007-12-30 17:41:49 +01:00
|
|
|
|
|
|
|
#define GB_PROPERTY_SELF(symbol, type) \
|
2008-11-10 01:18:00 +01:00
|
|
|
{ "r" symbol, (intptr_t)type, (intptr_t)(-1) }
|
2007-12-30 17:41:49 +01:00
|
|
|
|
|
|
|
#define GB_METHOD(symbol, type, exec, signature) \
|
2008-11-10 01:18:00 +01:00
|
|
|
{ "m" symbol, (intptr_t)type, (intptr_t)exec, (intptr_t)signature }
|
2007-12-30 17:41:49 +01:00
|
|
|
|
|
|
|
#define GB_EVENT(symbol, type, signature, id) \
|
2008-11-10 01:18:00 +01:00
|
|
|
{ "::" symbol, (intptr_t)type, (intptr_t)id, (intptr_t)signature }
|
2007-12-30 17:41:49 +01:00
|
|
|
|
|
|
|
#define GB_STATIC_PROPERTY(symbol, type, proc) \
|
2008-11-10 01:18:00 +01:00
|
|
|
{ "P" symbol, (intptr_t)type, (intptr_t)proc }
|
2007-12-30 17:41:49 +01:00
|
|
|
|
|
|
|
#define GB_STATIC_PROPERTY_READ(symbol, type, proc) \
|
2008-11-10 01:18:00 +01:00
|
|
|
{ "R" symbol, (intptr_t)type, (intptr_t)proc }
|
2007-12-30 17:41:49 +01:00
|
|
|
|
|
|
|
#define GB_STATIC_PROPERTY_SELF(symbol, type) \
|
2008-11-10 01:18:00 +01:00
|
|
|
{ "R" symbol, (intptr_t)type, (-1) }
|
2007-12-30 17:41:49 +01:00
|
|
|
|
|
|
|
#define GB_STATIC_METHOD(symbol, type, exec, signature) \
|
2008-11-10 01:18:00 +01:00
|
|
|
{ "M" symbol, (intptr_t)type, (intptr_t)exec, (intptr_t)signature }
|
2011-09-08 18:01:36 +02:00
|
|
|
|
|
|
|
#define GB_STATIC_FAST_METHOD(symbol, type, exec, signature) \
|
|
|
|
{ "M!" symbol, (intptr_t)type, (intptr_t)exec, (intptr_t)signature }
|
2007-12-30 17:41:49 +01:00
|
|
|
|
|
|
|
#define GB_INHERITS(symbol) \
|
2008-11-10 01:18:00 +01:00
|
|
|
{ GB_INHERITS_ID, (intptr_t)symbol }
|
|
|
|
|
2007-12-30 17:41:49 +01:00
|
|
|
#define GB_INTERFACE(symbol, pointer) \
|
2008-11-10 01:18:00 +01:00
|
|
|
{ "C_@" symbol, (intptr_t)"p", (intptr_t)pointer }
|
2007-12-30 17:41:49 +01:00
|
|
|
|
|
|
|
|
|
|
|
/* Method implementation begin macro */
|
|
|
|
|
|
|
|
#define BEGIN_METHOD(_name, par) \
|
|
|
|
typedef \
|
2008-11-10 01:18:00 +01:00
|
|
|
struct { \
|
|
|
|
par; \
|
|
|
|
} \
|
|
|
|
_##_name; \
|
2007-12-30 17:41:49 +01:00
|
|
|
\
|
|
|
|
void _name(void *_object, void *_param) \
|
|
|
|
{ \
|
2008-11-10 01:18:00 +01:00
|
|
|
_##_name *_p = (_##_name *)_param;
|
2007-12-30 17:41:49 +01:00
|
|
|
|
|
|
|
|
|
|
|
/* Parameter-less Method implementation begin macro */
|
|
|
|
|
|
|
|
#define BEGIN_METHOD_VOID(_name) \
|
|
|
|
void _name(void *_object, void *_param) { \
|
|
|
|
|
|
|
|
|
|
|
|
/* Parameter access macro */
|
|
|
|
|
|
|
|
#define ARG(_name) (&(_p)->_name)
|
|
|
|
|
|
|
|
|
|
|
|
/* Testing if a argument is missing */
|
|
|
|
|
|
|
|
#define MISSING(_name) ((_p)->_name.type == GB_T_VOID)
|
|
|
|
|
|
|
|
|
|
|
|
/* Method implementation end macro */
|
|
|
|
|
|
|
|
#define END_METHOD }
|
|
|
|
|
|
|
|
|
|
|
|
/* Macro used for calling a parameter-less implementation method */
|
|
|
|
|
|
|
|
#define CALL_METHOD_VOID(_name) _name(_object, NULL)
|
|
|
|
|
|
|
|
|
|
|
|
/* Property implementation begin macro */
|
|
|
|
|
|
|
|
#define BEGIN_PROPERTY(_name) \
|
|
|
|
void _name(void *_object, void *_param) {
|
|
|
|
|
|
|
|
|
|
|
|
/* Macro indicating if the property implementation is called for reading or writing */
|
|
|
|
|
|
|
|
#define READ_PROPERTY (_param == NULL)
|
|
|
|
|
|
|
|
|
|
|
|
/* Macro to get the value written to a property */
|
|
|
|
|
|
|
|
#define PROP(_type) ((_type *)_param)
|
|
|
|
|
|
|
|
|
|
|
|
/* Property implementation end macro */
|
|
|
|
|
|
|
|
#define END_PROPERTY }
|
|
|
|
|
|
|
|
|
|
|
|
/* Macros to get the value of an argument or a property */
|
|
|
|
|
|
|
|
#define VALUE(_arg) ((_arg)->value)
|
|
|
|
#define VARG(_p) VALUE(ARG(_p))
|
|
|
|
#define VPROP(_p) VALUE(PROP(_p))
|
|
|
|
|
|
|
|
|
|
|
|
/* Macros to get a string argument */
|
|
|
|
|
|
|
|
#define STRING(_arg) (VARG(_arg).addr + VARG(_arg).start)
|
|
|
|
#define LENGTH(_arg) (VARG(_arg).len)
|
|
|
|
|
|
|
|
|
|
|
|
/* Macros to get a string property */
|
|
|
|
|
|
|
|
#define PSTRING() (VPROP(GB_STRING).addr + VPROP(GB_STRING).start)
|
|
|
|
#define PLENGTH() (VPROP(GB_STRING).len)
|
|
|
|
|
|
|
|
|
|
|
|
/* Macro to get an optional argument */
|
|
|
|
|
|
|
|
#define VARGOPT(_arg, _default) (MISSING(_arg) ? (_default) : VARG(_arg))
|
|
|
|
|
|
|
|
|
|
|
|
/* Casting macro. Usable only in an implementation function */
|
|
|
|
|
|
|
|
#define OBJECT(type) ((type *)_object)
|
|
|
|
|
|
|
|
|
|
|
|
/* Macro for returning itself. Usable only in an implementation function */
|
|
|
|
|
2008-02-21 15:13:47 +01:00
|
|
|
#define RETURN_SELF() GB.ReturnSelf(_object)
|
2007-12-30 17:41:49 +01:00
|
|
|
|
|
|
|
|
|
|
|
/* Macro for declaring a variable used for storing an event identifier */
|
|
|
|
|
|
|
|
#define DECLARE_EVENT(_event) static int _event
|
|
|
|
|
|
|
|
|
|
|
|
/* Macro to help accessing enumeration index. Use only in an enumeration method implementation */
|
|
|
|
|
|
|
|
#define ENUM(_type) (*((_type *)GB.GetEnum()))
|
|
|
|
|
|
|
|
|
|
|
|
/* Structure used for describing a class */
|
|
|
|
|
|
|
|
typedef
|
2008-11-10 01:18:00 +01:00
|
|
|
struct {
|
|
|
|
const char *name;
|
|
|
|
intptr_t val1;
|
|
|
|
intptr_t val2;
|
|
|
|
intptr_t val3;
|
2012-07-16 18:30:55 +02:00
|
|
|
#if __WORDSIZE == 64
|
|
|
|
double val4;
|
2008-11-10 01:18:00 +01:00
|
|
|
intptr_t val5;
|
2012-07-16 18:30:55 +02:00
|
|
|
#else
|
|
|
|
double val4;
|
|
|
|
#endif
|
2008-11-10 01:18:00 +01:00
|
|
|
}
|
|
|
|
GB_DESC;
|
2007-12-30 17:41:49 +01:00
|
|
|
|
|
|
|
|
|
|
|
/* Type of a method implementation function */
|
|
|
|
|
|
|
|
typedef
|
2008-11-10 01:18:00 +01:00
|
|
|
void GB_METHOD_FUNC(void *, void *);
|
2007-12-30 17:41:49 +01:00
|
|
|
|
|
|
|
|
|
|
|
/* Type of a property implementation function */
|
|
|
|
|
|
|
|
typedef
|
2008-11-10 01:18:00 +01:00
|
|
|
void GB_PROPERTY_FUNC(void *, void *);
|
2007-12-30 17:41:49 +01:00
|
|
|
|
|
|
|
|
|
|
|
/* Macro for declaring a method implementation function */
|
|
|
|
|
|
|
|
#define DECLARE_METHOD(_method) GB_METHOD_FUNC _method
|
|
|
|
|
|
|
|
|
|
|
|
/* Macro for declaring a property implementation function */
|
|
|
|
|
|
|
|
#define DECLARE_PROPERTY(_property) GB_PROPERTY_FUNC _property
|
|
|
|
|
|
|
|
|
|
|
|
/* Constants used with the GB.Hook() API function */
|
|
|
|
|
2010-08-27 23:09:34 +02:00
|
|
|
#define GB_HOOK_MAX 10
|
|
|
|
|
2007-12-30 17:41:49 +01:00
|
|
|
#define GB_HOOK_MAIN 1
|
|
|
|
#define GB_HOOK_LOOP 2
|
|
|
|
#define GB_HOOK_WAIT 3
|
|
|
|
#define GB_HOOK_TIMER 4
|
|
|
|
#define GB_HOOK_LANG 5
|
|
|
|
#define GB_HOOK_WATCH 6
|
|
|
|
#define GB_HOOK_POST 7
|
|
|
|
#define GB_HOOK_QUIT 8
|
|
|
|
#define GB_HOOK_ERROR 9
|
2010-08-27 23:09:34 +02:00
|
|
|
#define GB_HOOK_TIMEOUT 10
|
2007-12-30 17:41:49 +01:00
|
|
|
|
2012-04-30 02:04:51 +02:00
|
|
|
/* Macro for calling the previous hook */
|
|
|
|
|
|
|
|
#define CALL_HOOK_MAIN(_hook, _pargc, _pargv) do { if (_hook) { ((void (*)(int *, char ***))(_hook))((_pargc), (_pargv)); } } while (0);
|
|
|
|
|
2018-10-14 21:52:07 +02:00
|
|
|
/* Constants that represent interpreter signals caught by GB_SIGNAL function */
|
2007-12-30 17:41:49 +01:00
|
|
|
|
|
|
|
#define GB_SIGNAL_DEBUG_BREAK 1
|
|
|
|
#define GB_SIGNAL_DEBUG_CONTINUE 2
|
|
|
|
#define GB_SIGNAL_DEBUG_FORWARD 3
|
|
|
|
|
|
|
|
|
|
|
|
/* Constants used with the GB.Watch() API function */
|
|
|
|
|
|
|
|
#define GB_WATCH_NONE 0
|
|
|
|
#define GB_WATCH_READ 1
|
|
|
|
#define GB_WATCH_WRITE 2
|
|
|
|
|
|
|
|
|
2011-01-02 18:09:54 +01:00
|
|
|
/* Type of a generic callback */
|
|
|
|
|
|
|
|
typedef
|
|
|
|
void (*GB_CALLBACK)();
|
|
|
|
|
|
|
|
|
2007-12-30 17:41:49 +01:00
|
|
|
/* Type of a watch callback function */
|
|
|
|
|
|
|
|
typedef
|
2008-11-10 01:18:00 +01:00
|
|
|
void (*GB_WATCH_CALLBACK)(int, int, intptr_t);
|
2007-12-30 17:41:49 +01:00
|
|
|
|
|
|
|
|
|
|
|
/* Type of the GB.SubstString() callback */
|
|
|
|
|
|
|
|
typedef
|
2008-11-10 01:18:00 +01:00
|
|
|
void (*GB_SUBST_CALLBACK)(int, char **, int *);
|
2007-12-30 17:41:49 +01:00
|
|
|
|
|
|
|
|
2008-03-26 17:28:18 +01:00
|
|
|
/* Type of the GB.SubstStringAdd() callback */
|
|
|
|
|
|
|
|
typedef
|
2008-11-10 01:18:00 +01:00
|
|
|
void (*GB_SUBST_ADD_CALLBACK)(int);
|
2008-03-26 17:28:18 +01:00
|
|
|
|
|
|
|
|
2010-04-05 03:44:43 +02:00
|
|
|
/* Type of the GB.BrowseProject() callback */
|
|
|
|
|
|
|
|
typedef
|
2014-09-03 16:33:18 +02:00
|
|
|
void (*GB_BROWSE_PROJECT_CALLBACK)(const char *, int64_t);
|
|
|
|
|
|
|
|
|
|
|
|
/* Type of the GB.BrowseDirectory() callback */
|
|
|
|
|
|
|
|
typedef
|
|
|
|
void (*GB_BROWSE_CALLBACK)(const char *);
|
2010-04-05 03:44:43 +02:00
|
|
|
|
|
|
|
|
2011-01-02 18:09:54 +01:00
|
|
|
/* Type of a timer callback */
|
|
|
|
|
|
|
|
typedef
|
2011-01-02 19:24:50 +01:00
|
|
|
int (*GB_TIMER_CALLBACK)(intptr_t);
|
2011-01-02 18:09:54 +01:00
|
|
|
|
|
|
|
|
2012-05-08 17:32:33 +02:00
|
|
|
/* Type of a signal callback */
|
|
|
|
|
|
|
|
typedef
|
|
|
|
void (*GB_SIGNAL_CALLBACK)(int, intptr_t);
|
|
|
|
|
|
|
|
|
2007-12-30 17:41:49 +01:00
|
|
|
/* A structure for the components of a date */
|
|
|
|
|
|
|
|
typedef
|
2008-11-10 01:18:00 +01:00
|
|
|
struct {
|
2013-10-12 09:11:39 +02:00
|
|
|
int year;
|
|
|
|
int month;
|
|
|
|
int day;
|
|
|
|
int hour;
|
|
|
|
int min;
|
|
|
|
int sec;
|
|
|
|
int weekday;
|
|
|
|
int msec;
|
2008-11-10 01:18:00 +01:00
|
|
|
}
|
|
|
|
GB_DATE_SERIAL;
|
2007-12-30 17:41:49 +01:00
|
|
|
|
|
|
|
|
|
|
|
/* Opaque type of a Gambas interpreted or native function */
|
|
|
|
|
|
|
|
typedef
|
2008-11-10 01:18:00 +01:00
|
|
|
struct {
|
|
|
|
void *object;
|
2021-03-07 23:51:12 +01:00
|
|
|
ushort index;
|
2008-11-10 01:18:00 +01:00
|
|
|
}
|
|
|
|
GB_FUNCTION;
|
2007-12-30 17:41:49 +01:00
|
|
|
|
2021-03-07 23:51:12 +01:00
|
|
|
#define GB_FUNCTION_IS_VALID(_func) ((_func)->index != 0)
|
2008-04-02 03:15:31 +02:00
|
|
|
|
2007-12-30 17:41:49 +01:00
|
|
|
|
|
|
|
/* Opaque type of a Gambas Array */
|
|
|
|
|
|
|
|
typedef
|
2008-11-10 01:18:00 +01:00
|
|
|
void *GB_ARRAY;
|
2007-12-30 17:41:49 +01:00
|
|
|
|
2012-07-09 19:10:21 +02:00
|
|
|
typedef
|
|
|
|
struct {
|
2021-02-08 21:45:29 +01:00
|
|
|
unsigned size : 24;
|
|
|
|
unsigned read_only : 1;
|
|
|
|
unsigned n_dim : 3;
|
2012-07-09 19:10:21 +02:00
|
|
|
int count;
|
|
|
|
GB_TYPE type;
|
|
|
|
void *data;
|
|
|
|
int *dim;
|
|
|
|
void *ref;
|
2021-02-08 21:45:29 +01:00
|
|
|
|
2012-07-09 19:10:21 +02:00
|
|
|
}
|
|
|
|
GB_ARRAY_BASE;
|
|
|
|
|
2007-12-30 17:41:49 +01:00
|
|
|
|
|
|
|
/* Opaque type of a Gambas Collection */
|
|
|
|
|
|
|
|
typedef
|
2008-11-10 01:18:00 +01:00
|
|
|
void *GB_COLLECTION;
|
2007-12-30 17:41:49 +01:00
|
|
|
|
|
|
|
|
2010-10-06 14:03:27 +02:00
|
|
|
/* Opaque type of a Gambas Collection iterator */
|
|
|
|
|
|
|
|
typedef
|
|
|
|
struct {
|
|
|
|
void *iter1;
|
|
|
|
void *iter2;
|
|
|
|
}
|
|
|
|
GB_COLLECTION_ITER;
|
|
|
|
|
|
|
|
|
2007-12-30 17:41:49 +01:00
|
|
|
/* opaque type of an hash table */
|
|
|
|
|
|
|
|
typedef
|
2008-11-10 01:18:00 +01:00
|
|
|
void *GB_HASHTABLE;
|
2007-12-30 17:41:49 +01:00
|
|
|
|
|
|
|
|
|
|
|
/* hash table enumeration function */
|
|
|
|
|
|
|
|
typedef
|
2008-11-10 01:18:00 +01:00
|
|
|
void (*GB_HASHTABLE_ENUM_FUNC)(void *);
|
2007-12-30 17:41:49 +01:00
|
|
|
|
|
|
|
|
2015-02-04 00:45:41 +01:00
|
|
|
/* Constants for end-of-line format */
|
|
|
|
|
|
|
|
#define GB_EOL_UNIX 0
|
|
|
|
#define GB_EOL_WINDOWS 1
|
|
|
|
#define GB_EOL_MAC 2
|
|
|
|
|
|
|
|
|
2007-12-30 17:41:49 +01:00
|
|
|
/* opaque type for a Stream object */
|
|
|
|
|
|
|
|
struct GB_STREAM;
|
|
|
|
|
|
|
|
typedef
|
2008-11-10 01:18:00 +01:00
|
|
|
struct {
|
|
|
|
int (*open)(struct GB_STREAM *stream, const char *path, int mode, void *data);
|
|
|
|
int (*close)(struct GB_STREAM *stream);
|
|
|
|
int (*read)(struct GB_STREAM *stream, char *buffer, int len);
|
|
|
|
int (*write)(struct GB_STREAM *stream, char *buffer, int len);
|
|
|
|
int (*seek)(struct GB_STREAM *stream, int64_t pos, int whence);
|
|
|
|
int (*tell)(struct GB_STREAM *stream, int64_t *pos);
|
|
|
|
int (*flush)(struct GB_STREAM *stream);
|
|
|
|
int (*eof)(struct GB_STREAM *stream);
|
|
|
|
int (*lof)(struct GB_STREAM *stream, int64_t *len);
|
|
|
|
int (*handle)(struct GB_STREAM *stream);
|
|
|
|
}
|
|
|
|
GB_STREAM_DESC;
|
2007-12-30 17:41:49 +01:00
|
|
|
|
2008-10-04 14:31:49 +02:00
|
|
|
typedef
|
2008-11-10 01:18:00 +01:00
|
|
|
struct {
|
|
|
|
GB_STREAM_DESC *desc;
|
2020-02-11 01:45:10 +01:00
|
|
|
int _reserved;
|
|
|
|
#if __WORDSIZE == 64
|
|
|
|
int _reserved1;
|
|
|
|
#endif
|
2011-04-04 02:40:32 +02:00
|
|
|
intptr_t _reserved2;
|
2012-12-14 02:47:32 +01:00
|
|
|
void *tag;
|
2008-11-10 01:18:00 +01:00
|
|
|
}
|
|
|
|
GB_STREAM_BASE;
|
2008-10-04 14:31:49 +02:00
|
|
|
|
2007-12-30 17:41:49 +01:00
|
|
|
typedef
|
2008-11-10 01:18:00 +01:00
|
|
|
struct GB_STREAM {
|
|
|
|
GB_STREAM_DESC *desc;
|
2020-02-11 01:45:10 +01:00
|
|
|
int _reserved;
|
|
|
|
#if __WORDSIZE == 64
|
|
|
|
int _reserved1;
|
|
|
|
#endif
|
2011-04-04 02:40:32 +02:00
|
|
|
intptr_t _reserved2;
|
2008-11-10 01:18:00 +01:00
|
|
|
void *tag;
|
|
|
|
#if __WORDSIZE == 64
|
|
|
|
int _free[4];
|
|
|
|
#else
|
|
|
|
int _free[5];
|
|
|
|
#endif
|
2020-02-11 01:45:10 +01:00
|
|
|
GB_VARIANT_VALUE _reserved3;
|
2008-11-10 01:18:00 +01:00
|
|
|
}
|
|
|
|
GB_STREAM;
|
2007-12-30 17:41:49 +01:00
|
|
|
|
|
|
|
|
2020-11-09 17:38:28 +01:00
|
|
|
/* File constants */
|
|
|
|
|
|
|
|
#define GB_ST_READ 1
|
|
|
|
#define GB_ST_WRITE 2
|
|
|
|
#define GB_ST_READ_WRITE 3
|
|
|
|
#define GB_ST_MODE 3
|
|
|
|
#define GB_ST_EXEC 4
|
|
|
|
#define GB_ST_APPEND 4
|
|
|
|
#define GB_ST_CREATE 8
|
|
|
|
#define GB_ST_ACCESS 15
|
|
|
|
#define GB_ST_BUFFERED 16
|
|
|
|
#define GB_ST_LOCK 32
|
|
|
|
#define GB_ST_WATCH 64
|
|
|
|
#define GB_ST_PIPE 128
|
|
|
|
#define GB_ST_MEMORY 256
|
|
|
|
#define GB_ST_STRING 512
|
|
|
|
#define GB_ST_NULL 1024
|
|
|
|
|
|
|
|
|
2007-12-30 17:41:49 +01:00
|
|
|
/* Constants used by the GB.NumberFromString() API function */
|
|
|
|
|
|
|
|
#define GB_NB_READ_INTEGER 1
|
|
|
|
#define GB_NB_READ_LONG 2
|
|
|
|
#define GB_NB_READ_INT_LONG 3
|
|
|
|
#define GB_NB_READ_FLOAT 4
|
|
|
|
#define GB_NB_READ_ALL 7
|
|
|
|
#define GB_NB_READ_HEX_BIN 8
|
|
|
|
#define GB_NB_LOCAL 16
|
|
|
|
|
|
|
|
|
|
|
|
/* Constants used by the GB.Collection.New() and GB.HashTable.New() API function */
|
|
|
|
|
|
|
|
#define GB_COMP_BINARY 0
|
2010-02-08 00:10:41 +01:00
|
|
|
#define GB_COMP_NOCASE 1
|
|
|
|
|
|
|
|
|
2020-11-09 17:38:28 +01:00
|
|
|
/* Constant used by GB.ConvString to convert to 32 bits Unicode (it needs some special processing) */
|
2010-02-08 00:10:41 +01:00
|
|
|
|
|
|
|
#define GB_SC_UNICODE ((char *)-1)
|
2007-12-30 17:41:49 +01:00
|
|
|
|
|
|
|
|
|
|
|
/* Timer object */
|
|
|
|
|
|
|
|
typedef
|
2008-11-10 01:18:00 +01:00
|
|
|
struct {
|
|
|
|
GB_BASE object;
|
|
|
|
intptr_t id;
|
2021-03-01 20:21:42 +01:00
|
|
|
unsigned delay : 30;
|
2012-11-24 19:52:11 +01:00
|
|
|
unsigned triggered : 1;
|
2021-03-01 20:21:42 +01:00
|
|
|
unsigned task : 1;
|
2012-04-30 02:04:51 +02:00
|
|
|
#if __WORDSIZE == 64
|
|
|
|
int _pad;
|
|
|
|
#endif
|
2021-03-01 20:21:42 +01:00
|
|
|
void *ext;
|
2008-11-10 01:18:00 +01:00
|
|
|
}
|
|
|
|
GB_TIMER;
|
2007-12-30 17:41:49 +01:00
|
|
|
|
2013-07-11 00:17:27 +02:00
|
|
|
/* Structure for GB.OnErrorBegin() handler */
|
|
|
|
|
|
|
|
typedef
|
|
|
|
struct {
|
|
|
|
void *prev;
|
|
|
|
void *context;
|
|
|
|
GB_CALLBACK handler;
|
|
|
|
intptr_t arg1;
|
|
|
|
intptr_t arg2;
|
|
|
|
}
|
|
|
|
GB_ERROR_HANDLER;
|
|
|
|
|
|
|
|
/* Structure for GB.RaiseBegin handler */
|
2012-02-25 02:35:55 +01:00
|
|
|
|
|
|
|
typedef
|
|
|
|
struct {
|
|
|
|
void (*callback)(intptr_t);
|
|
|
|
intptr_t data;
|
|
|
|
void *old;
|
2012-08-24 04:32:23 +02:00
|
|
|
int level;
|
2012-02-25 02:35:55 +01:00
|
|
|
}
|
|
|
|
GB_RAISE_HANDLER;
|
2007-12-30 17:41:49 +01:00
|
|
|
|
|
|
|
/* A macro for preventing gcc from warning about breaks in the
|
|
|
|
strict aliasing rules */
|
2008-11-10 01:18:00 +01:00
|
|
|
|
2007-12-30 17:41:49 +01:00
|
|
|
#define POINTER(_pointer) (void **)(void *)_pointer
|
|
|
|
|
2012-07-08 16:35:58 +02:00
|
|
|
/* For classes that implements arithmetic operators (e.g. complex numbers...) */
|
|
|
|
|
|
|
|
typedef
|
|
|
|
struct {
|
2012-07-14 04:49:57 +02:00
|
|
|
int (*equal)(void *, void *, bool);
|
2012-07-08 16:35:58 +02:00
|
|
|
int (*equalf)(void *, double);
|
2012-07-14 04:49:57 +02:00
|
|
|
int (*equalo)(void *, void *, bool);
|
2013-09-03 23:11:55 +02:00
|
|
|
int (*comp)(void *, void *, bool);
|
|
|
|
int (*compf)(void *, double);
|
|
|
|
int (*compo)(void *, void *, bool);
|
2012-07-14 04:49:57 +02:00
|
|
|
void *(*add)(void *, void *, bool);
|
|
|
|
void *(*addf)(void *, double, bool);
|
|
|
|
void *(*addo)(void *, void *, bool);
|
|
|
|
void *(*sub)(void *, void *, bool);
|
|
|
|
void *(*subf)(void *, double, bool);
|
|
|
|
void *(*subo)(void *, void *, bool);
|
|
|
|
void *(*mul)(void *, void *, bool);
|
|
|
|
void *(*mulf)(void *, double, bool);
|
|
|
|
void *(*mulo)(void *, void *, bool);
|
|
|
|
void *(*div)(void *, void *, bool);
|
|
|
|
void *(*divf)(void *, double, bool);
|
|
|
|
void *(*divo)(void *, void *, bool);
|
|
|
|
void *(*pow)(void *, void *, bool);
|
|
|
|
void *(*powf)(void *, double, bool);
|
|
|
|
void *(*powo)(void *, void *, bool);
|
2012-07-08 16:35:58 +02:00
|
|
|
void *(*neg)(void *);
|
2013-09-01 22:40:05 +02:00
|
|
|
void *(*abs)(void *);
|
2013-09-08 01:09:01 +02:00
|
|
|
double (*fabs)(void *);
|
2013-09-03 23:11:55 +02:00
|
|
|
int (*sgn)(void *);
|
2012-07-14 04:49:57 +02:00
|
|
|
intptr_t _reserved;
|
2012-07-08 16:35:58 +02:00
|
|
|
}
|
|
|
|
GB_OPERATOR_DESC;
|
|
|
|
|
2012-08-25 00:29:53 +02:00
|
|
|
/* Double-linked list API */
|
|
|
|
|
|
|
|
typedef
|
|
|
|
struct {
|
|
|
|
void *next;
|
|
|
|
void *prev;
|
|
|
|
}
|
|
|
|
GB_LIST;
|
2012-07-08 16:35:58 +02:00
|
|
|
|
2012-10-02 10:01:25 +02:00
|
|
|
/* Information about a file */
|
|
|
|
|
|
|
|
typedef
|
|
|
|
struct {
|
|
|
|
short type;
|
|
|
|
short mode;
|
|
|
|
int atime;
|
|
|
|
int mtime;
|
|
|
|
int ctime;
|
2013-09-29 18:56:12 +02:00
|
|
|
int64_t size;
|
2012-10-02 10:01:25 +02:00
|
|
|
uid_t uid;
|
|
|
|
gid_t gid;
|
2020-12-19 17:37:31 +01:00
|
|
|
dev_t device;
|
|
|
|
unsigned hidden : 1;
|
|
|
|
unsigned blkdev : 1;
|
|
|
|
unsigned chrdev : 1;
|
2012-10-02 10:01:25 +02:00
|
|
|
}
|
|
|
|
GB_FILE_STAT;
|
2012-10-07 23:12:53 +02:00
|
|
|
|
|
|
|
/* Constants for the GB_FILE_STAT structure */
|
2012-10-02 10:01:25 +02:00
|
|
|
|
2012-10-07 23:12:53 +02:00
|
|
|
#define GB_STAT_FILE 1
|
|
|
|
#define GB_STAT_DIRECTORY 2
|
|
|
|
#define GB_STAT_DEVICE 3
|
|
|
|
#define GB_STAT_PIPE 4
|
|
|
|
#define GB_STAT_SOCKET 5
|
|
|
|
#define GB_STAT_LINK 6
|
2012-10-02 10:01:25 +02:00
|
|
|
|
2007-12-30 17:41:49 +01:00
|
|
|
/* Gambas Application Programming Interface */
|
|
|
|
|
|
|
|
typedef
|
2008-11-10 01:18:00 +01:00
|
|
|
struct {
|
|
|
|
intptr_t version;
|
2007-12-30 17:41:49 +01:00
|
|
|
|
2011-05-16 04:16:22 +02:00
|
|
|
bool (*GetInterface)(const char *, int, void *);
|
2007-12-30 17:41:49 +01:00
|
|
|
|
2008-11-10 01:18:00 +01:00
|
|
|
void *(*Hook)(int, void *);
|
2007-12-30 17:41:49 +01:00
|
|
|
|
2012-05-08 17:32:33 +02:00
|
|
|
struct {
|
|
|
|
bool (*Load)(const char *);
|
2019-01-05 03:57:08 +01:00
|
|
|
bool (*CanLoadLibrary)(const char *);
|
2012-05-08 17:32:33 +02:00
|
|
|
bool (*Exist)(const char *);
|
2015-05-27 03:00:39 +02:00
|
|
|
bool (*IsLoaded)(const char *);
|
2012-05-08 17:32:33 +02:00
|
|
|
char *(*Current)(void);
|
|
|
|
bool (*GetInfo)(const char *, void **);
|
|
|
|
void (*Signal)(int, void *);
|
[INTERPRETER]
* NEW: Add a new GB.Component.Declare() API, that allows a component to
dynamically register a class description.
[INFORMER]
* NEW: A component now can declare classes through a GB_OPTIONAL_CLASSES
public symbol. Theses classes are included into the information file,
but are not automatically loaded as the ones defined through the
GB_CLASSES symbol.
[GB.FORM.STATUSICON]
* NEW: This component has been removed and replaced by gb.dbus.trayicon.
* NEW: This component now provide TrayIcon and TrayIcons classes that have
exactly the same interface as the old ones.
[GB.DBUS]
* NEW: Remove the now useless DBusConnection.Raise(). The DBusConnection
Register() and Unregister() are kept for backward-compatibility reason.
* NEW: Add DBus.Raise() and DBus[].Raise() to raise signals. At the moment,
there is no difference between the two methods, as there no mean to
indicate the sender raising a signal. I don't know yet how DBus decides
which service sends a signal!
[GB.DBUS.TRAYICON]
* NEW: This component implements the tray icon DBus protocol. It is
automatically loaded by the GUI components.
[GB.GTK]
* NEW: Load the 'gb.dbus' and 'gb.dbus.trayicon' components if the current
desktop is KDE >= 4. Otherwise, use the old TrayIcon implementation.
* BUG: Fix the old TrayIcon implementation, so that it matches the QT one.
[GB.GTK3]
* NEW: Load the 'gb.dbus' and 'gb.dbus.trayicon' components if the current
desktop is KDE >= 4. Otherwise, use the old TrayIcon implementation.
* BUG: Fix the component name in deprecation warning messages.
* BUG: Fix the old TrayIcon implementation, so that it matches the QT one.
[GB.QT4]
* NEW: Load the 'gb.dbus' and 'gb.dbus.trayicon' components if the current
desktop is KDE >= 4. Otherwise, use the old TrayIcon implementation.
[GB.QT5]
* NEW: Load the 'gb.dbus' and 'gb.dbus.trayicon' components if the current
desktop is KDE >= 4. Otherwise, use the old TrayIcon implementation.
git-svn-id: svn://localhost/gambas/trunk@7154 867c0c6c-44f3-4631-809d-bfa615b0a4ec
2015-06-29 03:46:51 +02:00
|
|
|
void (*Declare)(GB_DESC *);
|
2012-05-08 17:32:33 +02:00
|
|
|
}
|
|
|
|
Component;
|
2007-12-30 17:41:49 +01:00
|
|
|
|
2008-11-10 01:18:00 +01:00
|
|
|
void (*Push)(int, ...);
|
2011-05-16 04:16:22 +02:00
|
|
|
bool (*GetFunction)(GB_FUNCTION *, void *, const char *, const char *, const char *);
|
2008-11-10 01:18:00 +01:00
|
|
|
GB_VALUE *(*Call)(GB_FUNCTION *, int, int);
|
|
|
|
void *(*GetClassInterface)(GB_CLASS, const char *);
|
2015-06-27 23:26:32 +02:00
|
|
|
void *(*GetProperty)(void *, const char *);
|
2014-06-08 13:54:07 +02:00
|
|
|
bool (*SetProperty)(void *, const char *, GB_VALUE *value);
|
2012-08-26 03:54:57 +02:00
|
|
|
bool (*Serialize)(const char *path, GB_VALUE *value);
|
|
|
|
bool (*UnSerialize)(const char *path, GB_VALUE *value);
|
2007-12-30 17:41:49 +01:00
|
|
|
|
2011-05-16 04:16:22 +02:00
|
|
|
bool (*Loop)(int);
|
2012-08-25 00:29:53 +02:00
|
|
|
void (*Wait)(int);
|
2011-01-02 18:09:54 +01:00
|
|
|
void (*Post)(GB_CALLBACK, intptr_t);
|
|
|
|
void (*Post2)(GB_CALLBACK, intptr_t, intptr_t);
|
2011-01-02 19:24:50 +01:00
|
|
|
GB_TIMER *(*Every)(int, GB_TIMER_CALLBACK, intptr_t);
|
2011-05-16 04:16:22 +02:00
|
|
|
bool (*Raise)(void *, int, int, ...);
|
2012-02-25 02:35:55 +01:00
|
|
|
void (*RaiseBegin)(GB_RAISE_HANDLER *handler);
|
|
|
|
void (*RaiseEnd)(GB_RAISE_HANDLER *handler);
|
2008-11-10 01:18:00 +01:00
|
|
|
void (*RaiseLater)(void *, int);
|
|
|
|
void (*CheckPost)(void);
|
2011-05-16 04:16:22 +02:00
|
|
|
bool (*CanRaise)(void *, int);
|
2008-11-10 01:18:00 +01:00
|
|
|
int (*GetEvent)(GB_CLASS, const char *);
|
2015-07-04 00:18:58 +02:00
|
|
|
char *(*GetLastEventName)(void);
|
2008-11-10 01:18:00 +01:00
|
|
|
void (*RaiseTimer)(void *);
|
2011-05-16 04:16:22 +02:00
|
|
|
bool (*Stopped)(void);
|
2020-11-14 03:33:12 +01:00
|
|
|
bool (*IsRaiseLocked)(void *);
|
2008-11-10 01:18:00 +01:00
|
|
|
|
|
|
|
int (*NParam)(void);
|
2011-05-16 04:16:22 +02:00
|
|
|
bool (*Conv)(GB_VALUE *, GB_TYPE);
|
2008-11-10 01:18:00 +01:00
|
|
|
char *(*GetUnknown)(void);
|
2011-05-02 02:46:00 +02:00
|
|
|
|
2008-11-10 01:18:00 +01:00
|
|
|
void (*Error)(const char *, ...);
|
|
|
|
void (*Propagate)(void);
|
2012-08-15 19:02:22 +02:00
|
|
|
void (*Deprecated)(const char *, const char *, const char *);
|
2013-07-11 00:17:27 +02:00
|
|
|
void (*OnErrorBegin)(GB_ERROR_HANDLER *);
|
|
|
|
void (*OnErrorEnd)(GB_ERROR_HANDLER *);
|
2008-11-10 01:18:00 +01:00
|
|
|
|
|
|
|
GB_CLASS (*GetClass)(void *);
|
|
|
|
char *(*GetClassName)(void *);
|
2011-05-16 04:16:22 +02:00
|
|
|
bool (*ExistClass)(const char *);
|
2008-11-10 01:18:00 +01:00
|
|
|
GB_CLASS (*FindClass)(const char *);
|
2011-05-16 04:16:22 +02:00
|
|
|
bool (*ExistClassLocal)(const char *);
|
2008-11-10 01:18:00 +01:00
|
|
|
GB_CLASS (*FindClassLocal)(const char *);
|
2016-04-15 23:11:19 +02:00
|
|
|
GB_TYPE (*GetArrayType)(GB_CLASS);
|
2017-08-07 15:51:33 +02:00
|
|
|
GB_CLASS (*GetArrayClass)(GB_CLASS);
|
2018-06-09 22:42:35 +02:00
|
|
|
GB_CLASS (*LoadClassFrom)(const char *, const char*);
|
2011-05-16 04:16:22 +02:00
|
|
|
bool (*Is)(void *, GB_CLASS);
|
2008-11-10 01:18:00 +01:00
|
|
|
void (*Ref)(void *);
|
|
|
|
void (*Unref)(void **);
|
2014-11-24 13:43:57 +01:00
|
|
|
//void (*UnrefKeep)(void **, int);
|
2008-11-10 01:18:00 +01:00
|
|
|
void (*Detach)(void *);
|
|
|
|
void (*Attach)(void *, void *, const char *);
|
|
|
|
void *(*Parent)(void *);
|
2012-07-13 01:34:14 +02:00
|
|
|
void *(*Create)(GB_CLASS, char *, void *);
|
2011-05-16 04:16:22 +02:00
|
|
|
void *(*New)(GB_CLASS, char *, void *);
|
2008-11-10 01:18:00 +01:00
|
|
|
void *(*AutoCreate)(GB_CLASS, int);
|
2011-05-16 04:16:22 +02:00
|
|
|
bool (*CheckObject)(void *);
|
2020-11-14 03:33:12 +01:00
|
|
|
bool (*IsLocked)(void *);
|
2008-11-10 01:18:00 +01:00
|
|
|
|
2015-07-04 00:18:58 +02:00
|
|
|
void *(*GetEnum)(void);
|
|
|
|
void (*StopEnum)(void);
|
2012-09-06 18:20:54 +02:00
|
|
|
void *(*BeginEnum)(void *);
|
|
|
|
void (*EndEnum)(void *);
|
2015-07-04 00:18:58 +02:00
|
|
|
bool (*NextEnum)(void);
|
2008-11-10 01:18:00 +01:00
|
|
|
void (*StopAllEnum)(void *);
|
2021-02-27 22:31:31 +01:00
|
|
|
void (*OnFreeEnum)(GB_CALLBACK);
|
2008-11-10 01:18:00 +01:00
|
|
|
|
2015-07-04 00:18:58 +02:00
|
|
|
GB_VALUE *(*GetReturnValue)(void);
|
2008-11-10 01:18:00 +01:00
|
|
|
void (*Return)(GB_TYPE, ...);
|
|
|
|
void (*ReturnInteger)(int);
|
|
|
|
void (*ReturnLong)(int64_t);
|
|
|
|
void (*ReturnPointer)(void *);
|
|
|
|
void (*ReturnBoolean)(int);
|
|
|
|
void (*ReturnDate)(GB_DATE *);
|
|
|
|
void (*ReturnObject)(void *);
|
|
|
|
void (*ReturnNull)(void);
|
2013-07-21 18:19:26 +02:00
|
|
|
void (*ReturnSingle)(float);
|
2008-11-10 01:18:00 +01:00
|
|
|
void (*ReturnFloat)(double);
|
2011-11-14 00:18:04 +01:00
|
|
|
void (*ReturnVariant)(GB_VARIANT_VALUE *);
|
2015-07-04 00:18:58 +02:00
|
|
|
void (*ReturnConvVariant)(void);
|
|
|
|
void (*ReturnBorrow)(void);
|
|
|
|
void (*ReturnRelease)(void);
|
2008-11-10 01:18:00 +01:00
|
|
|
void (*ReturnPtr)(GB_TYPE, void *);
|
|
|
|
void (*ReturnSelf)(void *);
|
|
|
|
|
|
|
|
void (*ReturnString)(char *);
|
2011-10-24 21:33:41 +02:00
|
|
|
void (*ReturnVoidString)(void);
|
2008-11-10 01:18:00 +01:00
|
|
|
void (*ReturnConstString)(const char *, int);
|
|
|
|
void (*ReturnConstZeroString)(const char *);
|
|
|
|
void (*ReturnNewString)(const char *, int);
|
|
|
|
void (*ReturnNewZeroString)(const char *);
|
|
|
|
|
2010-06-05 01:48:53 +02:00
|
|
|
char *(*NewString)(const char *, int);
|
|
|
|
char *(*NewZeroString)(const char *);
|
|
|
|
char *(*TempString)(const char *, int);
|
2018-03-07 22:06:02 +01:00
|
|
|
char *(*RefString)(char *);
|
2008-11-10 01:18:00 +01:00
|
|
|
void (*FreeString)(char **);
|
2012-07-15 15:07:57 +02:00
|
|
|
char *(*FreeStringLater)(char *);
|
2011-09-07 21:43:11 +02:00
|
|
|
char *(*ExtendString)(char *, int);
|
|
|
|
char *(*AddString)(char *, const char *, int);
|
|
|
|
char *(*AddChar)(char *, char);
|
2008-11-10 01:18:00 +01:00
|
|
|
int (*StringLength)(char *);
|
|
|
|
char *(*ToZeroString)(GB_STRING *);
|
2011-05-16 04:16:22 +02:00
|
|
|
bool (*MatchString)(const char *, int, const char *, int);
|
|
|
|
bool (*NumberFromString)(int, const char *, int, GB_VALUE *);
|
|
|
|
bool (*NumberToString)(int, double, const char *, char **, int *);
|
2008-11-10 01:18:00 +01:00
|
|
|
char *(*Translate)(const char *);
|
|
|
|
|
|
|
|
char *(*SubstString)(const char *, int, GB_SUBST_CALLBACK);
|
|
|
|
char *(*SubstStringAdd)(const char *, int, GB_SUBST_ADD_CALLBACK);
|
|
|
|
void (*SubstAddCallback)(const char *, int);
|
2011-05-16 04:16:22 +02:00
|
|
|
bool (*ConvString)(char **, const char *, int, const char *, const char *);
|
2008-11-10 01:18:00 +01:00
|
|
|
char *(*FileName)(char *, int);
|
|
|
|
char *(*RealFileName)(char *, int);
|
|
|
|
|
2011-05-16 04:16:22 +02:00
|
|
|
bool (*LoadFile)(const char *, int, char **, int *);
|
2008-12-28 23:41:55 +01:00
|
|
|
void (*ReleaseFile)(char *, int);
|
2010-01-01 19:45:35 +01:00
|
|
|
char *(*TempDir)(void);
|
|
|
|
char *(*TempFile)(const char *);
|
2011-05-16 04:16:22 +02:00
|
|
|
bool (*CopyFile)(const char *, const char *);
|
2014-09-03 16:33:18 +02:00
|
|
|
void (*BrowseProject)(GB_BROWSE_PROJECT_CALLBACK);
|
|
|
|
void (*BrowseDirectory)(const char *, GB_BROWSE_CALLBACK, GB_BROWSE_CALLBACK);
|
2012-10-02 10:01:25 +02:00
|
|
|
bool (*StatFile)(const char *, GB_FILE_STAT *, bool);
|
2008-11-10 01:18:00 +01:00
|
|
|
|
|
|
|
void (*Store)(GB_TYPE, GB_VALUE *, void *);
|
|
|
|
void (*StoreString)(GB_STRING *, char **);
|
|
|
|
void (*StoreObject)(GB_OBJECT *, void **);
|
|
|
|
void (*StoreVariant)(GB_VARIANT *, void *);
|
2009-08-03 00:48:08 +02:00
|
|
|
void (*ReadValue)(GB_VALUE *, void *, GB_TYPE);
|
2010-07-19 14:33:57 +02:00
|
|
|
void (*BorrowValue)(GB_VALUE *);
|
|
|
|
void (*ReleaseValue)(GB_VALUE *);
|
2012-08-29 23:02:09 +02:00
|
|
|
int (*CompVariant)(GB_VARIANT_VALUE *, GB_VARIANT_VALUE *);
|
2008-11-10 01:18:00 +01:00
|
|
|
|
|
|
|
GB_DATE_SERIAL *(*SplitDate)(GB_DATE *);
|
2011-05-16 04:16:22 +02:00
|
|
|
bool (*MakeDate)(GB_DATE_SERIAL *, GB_DATE *);
|
2020-06-20 04:56:22 +02:00
|
|
|
void (*MakeDateFromTime)(time_t, int, GB_DATE *);
|
2011-05-16 04:16:22 +02:00
|
|
|
bool (*GetTime)(double *, int);
|
2008-11-10 01:18:00 +01:00
|
|
|
|
|
|
|
void (*Watch)(int, int, void *, intptr_t);
|
|
|
|
|
|
|
|
GB_VALUE *(*Eval)(void *, void *);
|
|
|
|
|
|
|
|
void (*Alloc)(void **, int);
|
2014-11-16 22:40:47 +01:00
|
|
|
void (*AllocZero)(void **, int);
|
2008-11-10 01:18:00 +01:00
|
|
|
void (*Free)(void **);
|
|
|
|
void (*Realloc)(void **, int);
|
|
|
|
|
|
|
|
void (*NewArray)(void *, int, int);
|
|
|
|
void (*FreeArray)(void *);
|
|
|
|
int (*Count)(void *);
|
|
|
|
void *(*Add)(void *);
|
|
|
|
void *(*Insert)(void *, int, int);
|
|
|
|
void (*Remove)(void *, int, int);
|
|
|
|
|
|
|
|
int (*ToLower)(int);
|
|
|
|
int (*ToUpper)(int);
|
|
|
|
int (*StrCaseCmp)(const char *, const char *);
|
|
|
|
int (*StrNCaseCmp)(const char *, const char *, int);
|
|
|
|
|
|
|
|
struct {
|
|
|
|
char *(*Name)(void);
|
|
|
|
char *(*Title)(void);
|
|
|
|
char *(*Version)(void);
|
|
|
|
char *(*Path)(void);
|
2010-10-15 02:23:11 +02:00
|
|
|
GB_CLASS (*StartupClass)(void);
|
2008-11-10 01:18:00 +01:00
|
|
|
}
|
|
|
|
Application;
|
|
|
|
|
|
|
|
struct {
|
|
|
|
char *(*Charset)(void);
|
|
|
|
char *(*Language)(void);
|
2019-01-11 15:23:50 +01:00
|
|
|
void (*SetLanguage)(const char *);
|
2008-11-10 01:18:00 +01:00
|
|
|
char *(*DomainName)(void);
|
2011-05-16 04:16:22 +02:00
|
|
|
bool (*IsRightToLeft)(void);
|
2011-03-24 03:15:32 +01:00
|
|
|
char *(*Path)(void);
|
2012-08-25 00:29:53 +02:00
|
|
|
void (*HasForked)(void);
|
2013-07-27 19:23:04 +02:00
|
|
|
bool (*Debug)(void);
|
2014-09-03 16:33:18 +02:00
|
|
|
char *(*Home)(void);
|
2017-07-24 20:53:33 +02:00
|
|
|
int (*TimeZone)(void);
|
2008-11-10 01:18:00 +01:00
|
|
|
}
|
|
|
|
System;
|
|
|
|
|
|
|
|
struct {
|
|
|
|
void (*New)(GB_ARRAY *, GB_TYPE, int);
|
|
|
|
int (*Count)(GB_ARRAY);
|
|
|
|
void *(*Add)(GB_ARRAY);
|
|
|
|
void *(*Get)(GB_ARRAY, int);
|
|
|
|
GB_TYPE (*Type)(GB_ARRAY);
|
2021-03-05 17:09:45 +01:00
|
|
|
void (*SetReadOnly)(GB_ARRAY);
|
2008-11-10 01:18:00 +01:00
|
|
|
}
|
|
|
|
Array;
|
|
|
|
|
|
|
|
struct {
|
|
|
|
void (*New)(GB_COLLECTION *, int);
|
|
|
|
int (*Count)(GB_COLLECTION);
|
2011-05-16 04:16:22 +02:00
|
|
|
bool (*Set)(GB_COLLECTION, const char *, int, GB_VARIANT *);
|
|
|
|
bool (*Get)(GB_COLLECTION, const char *, int, GB_VARIANT *);
|
|
|
|
bool (*Enum)(GB_COLLECTION, GB_COLLECTION_ITER *, GB_VARIANT *, char **key, int *len);
|
2008-11-10 01:18:00 +01:00
|
|
|
}
|
|
|
|
Collection;
|
|
|
|
|
|
|
|
struct {
|
|
|
|
void (*New)(GB_HASHTABLE *, int);
|
|
|
|
void (*Free)(GB_HASHTABLE *);
|
|
|
|
int (*Count)(GB_HASHTABLE);
|
|
|
|
void (*Add)(GB_HASHTABLE, const char *, int, void *);
|
|
|
|
void (*Remove)(GB_HASHTABLE, const char *, int);
|
2011-05-16 04:16:22 +02:00
|
|
|
bool (*Get)(GB_HASHTABLE, const char *, int, void **);
|
2008-11-10 01:18:00 +01:00
|
|
|
void (*Enum)(GB_HASHTABLE, GB_HASHTABLE_ENUM_FUNC);
|
2017-09-21 18:15:37 +02:00
|
|
|
bool (*First)(GB_HASHTABLE, void **);
|
2008-11-10 01:18:00 +01:00
|
|
|
}
|
|
|
|
HashTable;
|
|
|
|
|
|
|
|
struct {
|
2010-04-05 19:02:16 +02:00
|
|
|
GB_STREAM *(*Get)(void *object);
|
2008-11-10 01:18:00 +01:00
|
|
|
void (*SetSwapping)(GB_STREAM *stream, int swap);
|
2013-02-17 01:44:48 +01:00
|
|
|
void (*SetAvailableNow)(GB_STREAM *stream, int available_now);
|
2011-05-16 04:16:22 +02:00
|
|
|
bool (*Block)(GB_STREAM *stream, int block);
|
2010-04-05 19:02:16 +02:00
|
|
|
int (*Read)(GB_STREAM *stream, void *addr, int len);
|
|
|
|
int (*Write)(GB_STREAM *stream, void *addr, int len);
|
2012-08-25 17:13:39 +02:00
|
|
|
int (*GetReadable)(GB_STREAM *stream, int *len);
|
2013-02-17 12:05:34 +01:00
|
|
|
bool (*Eof)(GB_STREAM *stream);
|
2017-01-07 01:58:20 +01:00
|
|
|
int (*Handle)(GB_STREAM *stream);
|
2008-11-10 01:18:00 +01:00
|
|
|
}
|
|
|
|
Stream;
|
2007-12-30 17:41:49 +01:00
|
|
|
|
2008-11-10 01:18:00 +01:00
|
|
|
struct {
|
|
|
|
void (*Start)(int length);
|
2015-07-04 00:18:58 +02:00
|
|
|
char *(*End)(void);
|
2008-11-10 01:18:00 +01:00
|
|
|
void (*Add)(const char *src, int len);
|
2021-01-21 02:32:06 +01:00
|
|
|
GB_ARRAY (*Split)(const char *str, int lstr, const char *sep, int lsep, const char *esc, int lesc, bool no_void, bool keep_esc);
|
2008-11-10 01:18:00 +01:00
|
|
|
}
|
|
|
|
String;
|
2010-02-21 19:15:16 +01:00
|
|
|
|
|
|
|
struct {
|
2015-07-04 00:18:58 +02:00
|
|
|
char *(*GetCurrentPosition)(void);
|
|
|
|
void (*EnterEventLoop)(void);
|
|
|
|
void (*LeaveEventLoop)(void);
|
2010-02-21 19:15:16 +01:00
|
|
|
}
|
|
|
|
Debug;
|
|
|
|
|
2012-05-08 17:32:33 +02:00
|
|
|
struct {
|
|
|
|
GB_SIGNAL_CALLBACK *(*Register)(int signum, void (*func)(int, intptr_t), intptr_t data);
|
|
|
|
void (*Unregister)(int signum, GB_SIGNAL_CALLBACK *cb);
|
2021-01-21 01:49:38 +01:00
|
|
|
void (*MustCheck)(int signum);
|
2012-05-08 17:32:33 +02:00
|
|
|
}
|
|
|
|
Signal;
|
|
|
|
|
2012-08-25 00:29:53 +02:00
|
|
|
struct {
|
|
|
|
void (*Add)(void *p_first, void *node, GB_LIST *list);
|
|
|
|
void (*Remove)(void *p_first, void *node, GB_LIST *list);
|
2008-11-10 01:18:00 +01:00
|
|
|
}
|
2012-08-25 00:29:53 +02:00
|
|
|
List;
|
|
|
|
|
|
|
|
}
|
2008-11-10 01:18:00 +01:00
|
|
|
GB_INTERFACE;
|
2007-12-30 17:41:49 +01:00
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
|
|
|
Special methods that can be declared in a class
|
2013-07-21 18:19:26 +02:00
|
|
|
-----------------------------------------------
|
2007-12-30 17:41:49 +01:00
|
|
|
|
2008-11-10 01:18:00 +01:00
|
|
|
_get array reading operator
|
|
|
|
_put array writing operator
|
|
|
|
_new constructor
|
|
|
|
_free destructor
|
|
|
|
_next next iteration of an enumeration
|
|
|
|
_call called when the object or the class is used as a function
|
|
|
|
_unknown called when the name of the property or method is unknown
|
2007-12-30 17:41:49 +01:00
|
|
|
|
|
|
|
|
|
|
|
Syntax of a method or event signature
|
2013-07-21 18:19:26 +02:00
|
|
|
-------------------------------------
|
2007-12-30 17:41:49 +01:00
|
|
|
|
2008-11-10 01:18:00 +01:00
|
|
|
Gambas datatype String representation
|
2007-12-30 17:41:49 +01:00
|
|
|
|
2013-07-21 18:19:26 +02:00
|
|
|
Boolean b
|
|
|
|
Byte c
|
|
|
|
Short h
|
|
|
|
Integer i
|
|
|
|
Long l
|
|
|
|
Single g
|
|
|
|
Float f
|
|
|
|
Date d
|
|
|
|
String s
|
|
|
|
Variant v
|
|
|
|
Object o
|
|
|
|
Pointer p
|
2008-11-10 01:18:00 +01:00
|
|
|
Any class ClassName;
|
2007-12-30 17:41:49 +01:00
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef NO_GAMBAS_CASE_REPLACEMENT
|
|
|
|
|
|
|
|
/* Replacements for case unsensitive comparisons.
|
2008-11-10 01:18:00 +01:00
|
|
|
They ensure that case comparison does not use current locale,
|
|
|
|
otherwise Turkish speakers will have problems!
|
2007-12-30 17:41:49 +01:00
|
|
|
*/
|
|
|
|
|
|
|
|
#include <string.h>
|
|
|
|
#include <ctype.h>
|
|
|
|
|
|
|
|
#ifdef tolower
|
|
|
|
#undef tolower
|
|
|
|
#endif
|
|
|
|
#ifdef toupper
|
|
|
|
#undef toupper
|
|
|
|
#endif
|
|
|
|
#ifdef strcasecmp
|
|
|
|
#undef strcasecmp
|
|
|
|
#endif
|
|
|
|
#ifdef strncasecmp
|
|
|
|
#undef strncasecmp
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#define strcasecmp GB.StrCaseCmp
|
|
|
|
#define strncasecmp GB.StrNCaseCmp
|
|
|
|
#define toupper GB.ToUpper
|
|
|
|
#define tolower GB.ToLower
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#endif
|