2007-12-30 17:41:49 +01:00
|
|
|
/***************************************************************************
|
|
|
|
|
2009-08-17 12:41:51 +02:00
|
|
|
gbx_c_array.h
|
2007-12-30 17:41:49 +01:00
|
|
|
|
2009-08-17 12:41:51 +02:00
|
|
|
(c) 2000-2009 Benoît Minisini <gambas@users.sourceforge.net>
|
2007-12-30 17:41:49 +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
|
2009-08-17 12:41:51 +02:00
|
|
|
the Free Software Foundation; either version 2, or (at your option)
|
2007-12-30 17:41:49 +01:00
|
|
|
any later version.
|
|
|
|
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
GNU General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
along with this program; if not, write to the Free Software
|
|
|
|
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
|
|
|
|
|
|
|
***************************************************************************/
|
|
|
|
|
|
|
|
#ifndef __GBX_C_ARRAY_H
|
|
|
|
#define __GBX_C_ARRAY_H
|
|
|
|
|
2008-09-09 13:03:47 +02:00
|
|
|
#ifndef GBX_INFO
|
|
|
|
|
2007-12-30 17:41:49 +01:00
|
|
|
#include "gambas.h"
|
|
|
|
|
|
|
|
#include "gbx_variant.h"
|
|
|
|
#include "gbx_object.h"
|
2008-03-19 15:32:30 +01:00
|
|
|
#include "gbx_type.h"
|
2007-12-30 17:41:49 +01:00
|
|
|
|
|
|
|
typedef
|
|
|
|
struct {
|
|
|
|
OBJECT object;
|
|
|
|
TYPE type;
|
|
|
|
void *data;
|
|
|
|
int *dim;
|
|
|
|
}
|
|
|
|
CARRAY;
|
|
|
|
|
|
|
|
#ifndef __GBX_C_ARRAY_C
|
|
|
|
extern GB_DESC NATIVE_ArrayBounds[];
|
|
|
|
extern GB_DESC NATIVE_Array[];
|
|
|
|
extern GB_DESC NATIVE_BooleanArray[];
|
|
|
|
extern GB_DESC NATIVE_ByteArray[];
|
|
|
|
extern GB_DESC NATIVE_ShortArray[];
|
|
|
|
extern GB_DESC NATIVE_IntegerArray[];
|
|
|
|
extern GB_DESC NATIVE_LongArray[];
|
2008-01-23 20:56:18 +01:00
|
|
|
extern GB_DESC NATIVE_PointerArray[];
|
2007-12-30 17:41:49 +01:00
|
|
|
extern GB_DESC NATIVE_SingleArray[];
|
|
|
|
extern GB_DESC NATIVE_FloatArray[];
|
|
|
|
extern GB_DESC NATIVE_StringArray[];
|
|
|
|
extern GB_DESC NATIVE_DateArray[];
|
|
|
|
extern GB_DESC NATIVE_VariantArray[];
|
|
|
|
extern GB_DESC NATIVE_ObjectArray[];
|
|
|
|
extern GB_DESC NATIVE_TemplateArray[];
|
|
|
|
#else
|
|
|
|
|
|
|
|
#define THIS ((CARRAY *)_object)
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
2009-09-10 21:30:41 +02:00
|
|
|
void CARRAY_split(CARRAY *_object, const char *str, int lstr, const char *sep, const char *esc, bool no_void, bool keep_esc);
|
2008-01-17 22:39:26 +01:00
|
|
|
void CARRAY_reverse(void *_object, void *_param);
|
|
|
|
void CARRAY_get_value(CARRAY *_object, int index, VALUE *value);
|
2007-12-30 17:41:49 +01:00
|
|
|
#define CARRAY_invert(_array) CARRAY_reverse(_array, NULL)
|
2008-01-24 11:42:42 +01:00
|
|
|
void *CARRAY_get_data_multi(CARRAY *_object, GB_INTEGER *arg, int nparam);
|
2008-03-19 15:32:30 +01:00
|
|
|
void *CARRAY_out_of_bound();
|
|
|
|
|
|
|
|
#define CARRAY_get_data(_array, _index) \
|
|
|
|
({ \
|
|
|
|
int __index = (_index); \
|
|
|
|
CARRAY *__array = (CARRAY *)(_array); \
|
|
|
|
void *__data; \
|
|
|
|
if ((__index < 0) || (__index >= ARRAY_count(__array->data))) \
|
|
|
|
__data = CARRAY_out_of_bound(); \
|
|
|
|
else \
|
|
|
|
__data = (void *)((char *)(__array->data) + __index * TYPE_sizeof_memory(__array->type)); \
|
|
|
|
__data; \
|
|
|
|
})
|
|
|
|
|
2007-12-30 17:41:49 +01:00
|
|
|
|
2008-09-09 13:03:47 +02:00
|
|
|
#endif // #ifndef __GBX_CLASS_INFO_C
|
|
|
|
|
|
|
|
#define ARRAY_TEMPLATE_NDESC 18
|
|
|
|
|
|
|
|
#endif
|