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

536 lines
11 KiB
C
Raw Normal View History

/***************************************************************************
gbx_value.h
(c) 2000-2011 Benoît Minisini <gambas@users.sourceforge.net>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
MA 02110-1301, USA.
***************************************************************************/
#ifndef __GBX_VALUE_H
#define __GBX_VALUE_H
#include <time.h>
#include "gbx_type.h"
#include "gbx_class.h"
#ifndef __DATE_DECLARED
#define __DATE_DECLARED
typedef
struct {
int date;
int time;
}
DATE;
#endif
typedef
struct {
TYPE type;
int value;
}
VALUE_BOOLEAN;
typedef
struct {
TYPE type;
int value;
}
VALUE_BYTE;
typedef
struct {
TYPE type;
int value;
}
VALUE_SHORT;
typedef
struct {
TYPE type;
int value;
}
VALUE_INTEGER;
typedef
struct {
TYPE type;
#ifndef OS_64BITS
int _padding;
#endif
int64_t value;
}
PACKED
VALUE_LONG;
******** 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
typedef
struct {
TYPE type;
char *value;
}
PACKED
VALUE_POINTER;
******** 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
typedef
struct {
TYPE type;
float value;
}
PACKED
VALUE_SINGLE;
typedef
struct {
TYPE type;
#ifndef OS_64BITS
int _padding;
#endif
double value;
}
PACKED
VALUE_FLOAT;
typedef
struct {
TYPE type;
int date; /* number of days */
int time; /* number of milliseconds */
}
VALUE_DATE;
typedef
struct {
TYPE type;
char *addr;
int start;
int len;
}
VALUE_STRING;
typedef
struct {
TYPE type;
CLASS *class;
void *object;
char kind;
char defined;
short index;
}
PACKED
VALUE_FUNCTION;
enum
{
FUNCTION_NULL = 0,
FUNCTION_NATIVE = 1,
FUNCTION_PRIVATE = 2,
FUNCTION_PUBLIC = 3,
FUNCTION_EVENT = 4,
FUNCTION_EXTERN = 5,
FUNCTION_UNKNOWN = 6,
FUNCTION_CALL = 7,
FUNCTION_SUBR = 8
};
typedef
struct {
TYPE type;
TYPE ptype;
intptr_t value[2];
}
VALUE_VOID;
typedef
struct {
TYPE type;
TYPE vtype;
union {
char _boolean;
unsigned char _byte;
short _short;
int _integer;
int64_t _long;
float _single;
double _float;
DATE _date;
char *_string;
void *_pointer;
void *_object;
int64_t data;
}
value;
}
VALUE_VARIANT;
typedef
struct {
CLASS *class;
void *object;
void *super;
}
VALUE_OBJECT;
typedef
struct {
TYPE type;
CLASS *class;
void *super;
}
VALUE_CLASS;
typedef
union value {
TYPE type;
VALUE_BOOLEAN _boolean;
VALUE_BYTE _byte;
VALUE_SHORT _short;
VALUE_INTEGER _integer;
VALUE_LONG _long;
VALUE_SINGLE _single;
VALUE_FLOAT _float;
VALUE_DATE _date;
VALUE_STRING _string;
VALUE_POINTER _pointer;
VALUE_FUNCTION _function;
VALUE_VARIANT _variant;
VALUE_CLASS _class;
VALUE_OBJECT _object;
VALUE_VOID _void;
}
VALUE;
typedef
void (*VALUE_CONVERT_FUNC)(VALUE *);
#define VALUE_copy(_dst, _src) \
(_dst)->_void.type = (_src)->_void.type; \
(_dst)->_void.ptype = (_src)->_void.ptype; \
(_dst)->_void.value[0] = (_src)->_void.value[0]; \
(_dst)->_void.value[1] = (_src)->_void.value[1];
#define VALUE_is_equal(_v1, _v2) (*_v1 == *v2)
#define VALUE_is_object(val) (TYPE_is_object((val)->type))
#define VALUE_is_string(val) ((val)->type == T_STRING || (val)->type == T_CSTRING)
#define VALUE_is_number(val) ((val)->type >= T_BYTE && (val)->type <= T_FLOAT)
******** 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
void VALUE_default(VALUE *value, TYPE type);
******** 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
void VALUE_convert(VALUE *value, TYPE type);
void VALUE_convert_boolean(VALUE *value);
void VALUE_convert_integer(VALUE *value);
void VALUE_convert_float(VALUE *value);
void VALUE_convert_string(VALUE *value);
void VALUE_convert_variant(VALUE *value);
void VALUE_convert_object(VALUE *value, TYPE type);
******** 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
void VALUE_read(VALUE *value, void *addr, TYPE type);
void VALUE_write(VALUE *value, void *addr, TYPE type);
void VALUE_undo_variant(VALUE *value);
******** 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
//void VALUE_put(VALUE *value, void *addr, TYPE type);
******** 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
void VALUE_free(void *addr, TYPE type);
void VALUE_to_string(VALUE *value, char **addr, int *len);
void VALUE_from_string(VALUE *value, const char *addr, int len);
void VALUE_class_read(CLASS *class, VALUE *value, char *addr, CTYPE ctype, void *ref);
******** 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
void VALUE_class_write(CLASS *class, VALUE *value, char *addr, CTYPE ctype);
void VALUE_class_constant(CLASS *class, VALUE *value, int ind);
******** 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
bool VALUE_is_null(VALUE *val);
//void VALUE_get_string(VALUE *val, char **text, int *length);
#define VALUE_get_string(_value, _ptext, _plen) \
({ \
*(_plen) = (_value)->_string.len; \
if (*(_plen)) \
*(_ptext) = (_value)->_string.start + (_value)->_string.addr; \
else \
*(_ptext) = NULL; \
})
void THROW_TYPE_INTEGER(TYPE type) NORETURN;
void THROW_TYPE_FLOAT(TYPE type) NORETURN;
void THROW_TYPE_STRING(TYPE type) NORETURN;
#define VALUE_conv(_value, _type) \
({ \
if (UNLIKELY((_value)->type != (_type))) \
VALUE_convert(_value, _type); \
})
#if 0
#define VALUE_conv_boolean(_value) \
({ \
VALUE *v = _value; \
if (UNLIKELY(v->type != T_BOOLEAN)) \
{ \
VALUE_convert_boolean(v); \
} \
})
#define VALUE_conv_integer(_value) \
({ \
VALUE *v = _value; \
if (UNLIKELY(v->type != T_INTEGER)) \
{ \
if (TYPE_is_object(v->type)) \
THROW_TYPE_INTEGER(v->type); \
VALUE_convert_integer(v); \
} \
})
#define VALUE_conv_float(_value) \
({ \
VALUE *v = _value; \
if (UNLIKELY(v->type != T_FLOAT)) \
{ \
if (TYPE_is_object(v->type)) \
THROW_TYPE_FLOAT(v->type); \
VALUE_convert_float(v); \
} \
})
#define VALUE_conv_string(_value) \
({ \
VALUE *v = _value; \
if (UNLIKELY(v->type != T_STRING && v->type != T_CSTRING)) \
{ \
if (TYPE_is_object(v->type)) \
THROW_TYPE_STRING(v->type); \
VALUE_convert_string(v); \
} \
})
#define VALUE_conv_variant(_value) \
({ \
if (UNLIKELY((_value)->type != T_VARIANT)) \
VALUE_convert_variant(_value); \
})
#define VALUE_conv_object(_value, _type) \
({ \
if (UNLIKELY((_value)->type != (_type))) \
VALUE_convert_object(_value, _type); \
})
#else
#define VALUE_conv_boolean(_value) \
({ \
if (UNLIKELY((_value)->type != T_BOOLEAN)) \
VALUE_convert_boolean(_value); \
})
#define VALUE_conv_float(_value) \
({ \
if (UNLIKELY((_value)->type != T_FLOAT)) \
VALUE_convert_float(_value); \
})
//#define VALUE_conv_boolean(_value) VALUE_conv(_value, T_BOOLEAN)
#define VALUE_conv_integer(_value) VALUE_conv(_value, T_INTEGER)
//#define VALUE_conv_float(_value) VALUE_conv(_value, T_FLOAT)
#define VALUE_conv_variant(_value) VALUE_conv(_value, T_VARIANT)
#define VALUE_conv_object(_value, _type) VALUE_conv(_value, _type)
[DEVELOPMENT ENVIRONMENT] * NEW: English and french tips were updated. A new tip was added. * NEW: Files that were opened at project close are automatically reopened   when the project is loaded again. * NEW: A warning message is displayed when the GNU translation tools are not installed. * BUG: The code editor method combo-box is correctly updated now. * BUG: Some fixes in the automatic completion. * BUG: Replace points by dash in the name of packages generated by the IDE packager. * NEW: Updated russian translation * NEW: Updated french translation [DATABASE MANAGER] * NEW: Updated russian translation [EXAMPLES] * BUG: Fixed the Gravity and the GameOfLife examples so that they do not   use public form controls anymore. [INTERPRETER] * OPT: Many optimizations in the string substitution routines, the internal datatype conversions, the INPUT and LINE INPUT instructions, the error messages generation, the object and string reference counting, and the memory allocation routines. * NEW: Opening a device file in direct mode (FOR READ/WRITE) is now automatically non blocking. * OPT: Lof() now only tries its different methods (ioctl and lseek) once. * BUG: Val() now ignores thousand separators characters at the end of the number. * NEW: A new flag for enabling the stack trace generation at each error. [GB.DEBUG] * BUG: The gb.debug component interface declaration was not 64-bits aware. [GB.EVAL] * BUG: The Highlight.Purge() method now correctly deals with non-ASCII characters. [GB.FORM] * BUG: TableView.Edit() does not raise a "read-only combo-box" error anymore. [GB.FORM.DIALOG] * BUG: Dialog buttons now are never cut. [GB.GTK] * BUG: Cached drawing areas are correctly redrawn now. * BUG: Loading big images now works correctly. There is apparently a bug in the GTK+ image loader, and I found a workaround. * BUG: Message boxes correctly display the text of their buttons now. [GB.QT] * BUG: The Open, and initial Move and Resize event of embedded forms are now always raised when you call the Show method or if you set the Visible property. Before, it was raised when the embedded form was actually shown. [GB.SETTINGS] * NEW: Settings are now stored in ~/.config/gambasX, where X is the gambas version number. * BUG: Strings are correctly quoted inside the settings file now. [GB.WEB] * NEW: Application.Protocol is a new property that allows to tell the   component that the protocol is not necessarily "http". git-svn-id: svn://localhost/gambas/trunk@1153 867c0c6c-44f3-4631-809d-bfa615b0a4ec
2008-03-11 14:29:47 +01:00
#define VALUE_conv_string(_value) \
({ \
if (UNLIKELY((_value)->type != T_STRING && (_value)->type != T_CSTRING)) \
VALUE_conv(_value, T_STRING); \
})
[DEVELOPMENT ENVIRONMENT] * NEW: English and french tips were updated. A new tip was added. * NEW: Files that were opened at project close are automatically reopened   when the project is loaded again. * NEW: A warning message is displayed when the GNU translation tools are not installed. * BUG: The code editor method combo-box is correctly updated now. * BUG: Some fixes in the automatic completion. * BUG: Replace points by dash in the name of packages generated by the IDE packager. * NEW: Updated russian translation * NEW: Updated french translation [DATABASE MANAGER] * NEW: Updated russian translation [EXAMPLES] * BUG: Fixed the Gravity and the GameOfLife examples so that they do not   use public form controls anymore. [INTERPRETER] * OPT: Many optimizations in the string substitution routines, the internal datatype conversions, the INPUT and LINE INPUT instructions, the error messages generation, the object and string reference counting, and the memory allocation routines. * NEW: Opening a device file in direct mode (FOR READ/WRITE) is now automatically non blocking. * OPT: Lof() now only tries its different methods (ioctl and lseek) once. * BUG: Val() now ignores thousand separators characters at the end of the number. * NEW: A new flag for enabling the stack trace generation at each error. [GB.DEBUG] * BUG: The gb.debug component interface declaration was not 64-bits aware. [GB.EVAL] * BUG: The Highlight.Purge() method now correctly deals with non-ASCII characters. [GB.FORM] * BUG: TableView.Edit() does not raise a "read-only combo-box" error anymore. [GB.FORM.DIALOG] * BUG: Dialog buttons now are never cut. [GB.GTK] * BUG: Cached drawing areas are correctly redrawn now. * BUG: Loading big images now works correctly. There is apparently a bug in the GTK+ image loader, and I found a workaround. * BUG: Message boxes correctly display the text of their buttons now. [GB.QT] * BUG: The Open, and initial Move and Resize event of embedded forms are now always raised when you call the Show method or if you set the Visible property. Before, it was raised when the embedded form was actually shown. [GB.SETTINGS] * NEW: Settings are now stored in ~/.config/gambasX, where X is the gambas version number. * BUG: Strings are correctly quoted inside the settings file now. [GB.WEB] * NEW: Application.Protocol is a new property that allows to tell the   component that the protocol is not necessarily "http". git-svn-id: svn://localhost/gambas/trunk@1153 867c0c6c-44f3-4631-809d-bfa615b0a4ec
2008-03-11 14:29:47 +01:00
#endif
[DEVELOPMENT ENVIRONMENT] * NEW: English and french tips were updated. A new tip was added. * NEW: Files that were opened at project close are automatically reopened   when the project is loaded again. * NEW: A warning message is displayed when the GNU translation tools are not installed. * BUG: The code editor method combo-box is correctly updated now. * BUG: Some fixes in the automatic completion. * BUG: Replace points by dash in the name of packages generated by the IDE packager. * NEW: Updated russian translation * NEW: Updated french translation [DATABASE MANAGER] * NEW: Updated russian translation [EXAMPLES] * BUG: Fixed the Gravity and the GameOfLife examples so that they do not   use public form controls anymore. [INTERPRETER] * OPT: Many optimizations in the string substitution routines, the internal datatype conversions, the INPUT and LINE INPUT instructions, the error messages generation, the object and string reference counting, and the memory allocation routines. * NEW: Opening a device file in direct mode (FOR READ/WRITE) is now automatically non blocking. * OPT: Lof() now only tries its different methods (ioctl and lseek) once. * BUG: Val() now ignores thousand separators characters at the end of the number. * NEW: A new flag for enabling the stack trace generation at each error. [GB.DEBUG] * BUG: The gb.debug component interface declaration was not 64-bits aware. [GB.EVAL] * BUG: The Highlight.Purge() method now correctly deals with non-ASCII characters. [GB.FORM] * BUG: TableView.Edit() does not raise a "read-only combo-box" error anymore. [GB.FORM.DIALOG] * BUG: Dialog buttons now are never cut. [GB.GTK] * BUG: Cached drawing areas are correctly redrawn now. * BUG: Loading big images now works correctly. There is apparently a bug in the GTK+ image loader, and I found a workaround. * BUG: Message boxes correctly display the text of their buttons now. [GB.QT] * BUG: The Open, and initial Move and Resize event of embedded forms are now always raised when you call the Show method or if you set the Visible property. Before, it was raised when the embedded form was actually shown. [GB.SETTINGS] * NEW: Settings are now stored in ~/.config/gambasX, where X is the gambas version number. * BUG: Strings are correctly quoted inside the settings file now. [GB.WEB] * NEW: Application.Protocol is a new property that allows to tell the   component that the protocol is not necessarily "http". git-svn-id: svn://localhost/gambas/trunk@1153 867c0c6c-44f3-4631-809d-bfa615b0a4ec
2008-03-11 14:29:47 +01:00
#define VALUE_is_super(_value) (EXEC_super && EXEC_super == (_value)->_object.super)
#define VALUE_class_read_inline(_class, _value, _addr, _ctype, _ref) \
({ \
static void *jump[17] = { \
&&__VOID, &&__BOOLEAN, &&__BYTE, &&__SHORT, &&__INTEGER, &&__LONG, &&__SINGLE, &&__FLOAT, &&__DATE, \
&&__STRING, &&__CSTRING, &&__POINTER, &&__VARIANT, &&__ARRAY, &&__STRUCT, &&__NULL, &&__OBJECT \
}; \
\
for(;;) \
{ \
(_value)->type = (_ctype).id; \
goto *jump[(_ctype).id]; \
\
__BOOLEAN: \
(_value)->_boolean.value = -(*((unsigned char *)(_addr)) != 0); \
break; \
\
__BYTE: \
(_value)->_byte.value = *((unsigned char *)(_addr)); \
break; \
\
__SHORT: \
(_value)->_short.value = *((short *)(_addr)); \
break; \
\
__INTEGER: \
(_value)->_integer.value = *((int *)(_addr)); \
break; \
\
__LONG: \
(_value)->_long.value = *((int64_t *)(_addr)); \
break; \
\
__SINGLE: \
(_value)->_single.value = *((float *)(_addr)); \
break; \
\
__FLOAT: \
(_value)->_float.value = *((double *)(_addr)); \
break; \
\
__DATE: \
(_value)->_date.date = ((int *)(_addr))[0]; \
(_value)->_date.time = ((int *)(_addr))[1]; \
break; \
\
__STRING: \
{ \
char *str = *((char **)(_addr)); \
\
(_value)->type = T_STRING; \
(_value)->_string.addr = str; \
(_value)->_string.start = 0; \
(_value)->_string.len = STRING_length(str); \
\
break; \
} \
\
__CSTRING: \
{ \
char *str = *((char **)(_addr)); \
\
(_value)->type = T_CSTRING; \
(_value)->_string.addr = str; \
(_value)->_string.start = 0; \
(_value)->_string.len = (str == NULL) ? 0 : strlen(str); \
\
break; \
} \
\
__OBJECT: \
(_value)->_object.object = *((void **)(_addr)); \
(_value)->type = ((_ctype).value >= 0) ? (TYPE)(_class)->load->class_ref[(_ctype).value] : T_OBJECT; \
break; \
\
__POINTER: \
(_value)->_pointer.value = *((void **)(_addr)); \
break; \
\
__VARIANT: \
(_value)->_variant.type = T_VARIANT; \
(_value)->_variant.vtype = ((VARIANT *)(_addr))->type; \
if ((_value)->_variant.vtype == T_VOID) \
(_value)->_variant.vtype = T_NULL; \
VARIANT_copy_value(&(_value)->_variant, ((VARIANT *)(_addr))); \
break; \
\
__ARRAY: \
{ \
void *object = CARRAY_create_static((_class), (_ref), (_class)->load->array[(_ctype).value], (_addr)); \
(_value)->_object.class = OBJECT_class(object); \
(_value)->_object.object = object; \
break; \
} \
\
__STRUCT: \
{ \
void *object = CSTRUCT_create_static((_ref), (_class)->load->class_ref[(_ctype).value], (_addr)); \
(_value)->_object.class = OBJECT_class(object); \
(_value)->_object.object = object; \
break; \
} \
\
__VOID: \
__NULL: \
THROW_ILLEGAL(); \
} \
})
#define VALUE_class_constant_inline(_class, _value, _ind) \
({ \
static void *jump[] = \
{ \
&&__ILLEGAL, &&__INTEGER, &&__INTEGER, &&__INTEGER, &&__INTEGER, &&__LONG, &&__FLOAT, &&__FLOAT, \
&&__ILLEGAL, &&__STRING, &&__CSTRING, &&__POINTER, &&__ILLEGAL, &&__ILLEGAL, &&__ILLEGAL, &&__ILLEGAL \
}; \
\
CLASS_CONST *cc; \
\
for(;;) \
{ \
cc = &(_class)->load->cst[_ind]; \
goto *jump[cc->type]; \
\
__INTEGER: \
\
(_value)->type = T_INTEGER; \
(_value)->_integer.value = cc->_integer.value; \
break; \
\
__LONG: \
\
(_value)->type = T_LONG; \
(_value)->_long.value = cc->_long.value; \
break; \
\
__FLOAT: \
\
(_value)->type = T_FLOAT; \
(_value)->_float.value = cc->_float.value; \
break; \
\
__STRING: \
\
(_value)->type = T_CSTRING; \
(_value)->_string.addr = (char *)cc->_string.addr; \
(_value)->_string.start = 0; \
(_value)->_string.len = cc->_string.len; \
break; \
\
__CSTRING: \
\
(_value)->type = T_CSTRING; \
(_value)->_string.addr = (char *)LOCAL_gettext(cc->_string.addr); \
(_value)->_string.start = 0; \
(_value)->_string.len = strlen((_value)->_string.addr); \
break; \
\
__POINTER: \
\
(_value)->type = T_POINTER; \
(_value)->_pointer.value = NULL; \
break; \
\
__ILLEGAL: \
\
THROW_ILLEGAL(); \
} \
})
#endif