2007-12-30 17:41:49 +01:00
|
|
|
/***************************************************************************
|
|
|
|
|
2009-08-17 12:41:51 +02:00
|
|
|
gbx_class_init.c
|
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
|
|
|
|
|
|
|
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
|
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
|
|
|
|
|
|
|
***************************************************************************/
|
|
|
|
|
|
|
|
#define __GBX_CLASS_INIT_C
|
|
|
|
|
|
|
|
#include "gb_common.h"
|
|
|
|
#include "gb_alloc.h"
|
|
|
|
#include "gb_error.h"
|
|
|
|
#include "gb_limit.h"
|
|
|
|
|
|
|
|
#include "gbx_component.h"
|
|
|
|
|
|
|
|
#include "gbx_c_gambas.h"
|
2010-12-21 15:05:42 +01:00
|
|
|
#include "gbx_c_observer.h"
|
2007-12-30 17:41:49 +01:00
|
|
|
#include "gbx_c_class.h"
|
|
|
|
#include "gbx_c_error.h"
|
|
|
|
#include "gbx_c_collection.h"
|
|
|
|
#include "gbx_c_file.h"
|
2011-09-18 17:21:11 +02:00
|
|
|
#include "gbx_c_system.h"
|
2007-12-30 17:41:49 +01:00
|
|
|
#include "gbx_c_application.h"
|
|
|
|
#include "gbx_c_array.h"
|
|
|
|
#include "gbx_c_process.h"
|
|
|
|
#include "gbx_c_string.h"
|
|
|
|
#include "gbx_c_enum.h"
|
|
|
|
#include "gbx_c_timer.h"
|
2012-08-26 18:26:53 +02:00
|
|
|
#include "gbx_c_task.h"
|
2007-12-30 17:41:49 +01:00
|
|
|
|
|
|
|
#include "gbx_class.h"
|
|
|
|
|
2008-01-17 22:39:26 +01:00
|
|
|
CLASS *CLASS_Class = NULL;
|
|
|
|
CLASS *CLASS_Collection = NULL;
|
|
|
|
CLASS *CLASS_Symbol = NULL;
|
|
|
|
CLASS *CLASS_File = NULL;
|
|
|
|
CLASS *CLASS_Stat = NULL;
|
|
|
|
CLASS *CLASS_Stream = NULL;
|
|
|
|
CLASS *CLASS_Application = NULL;
|
|
|
|
CLASS *CLASS_AppArgs = NULL;
|
|
|
|
CLASS *CLASS_AppEnv = NULL;
|
|
|
|
CLASS *CLASS_Process = NULL;
|
|
|
|
CLASS *CLASS_Component = NULL;
|
2008-02-14 12:59:36 +01:00
|
|
|
CLASS *CLASS_Observer = NULL;
|
2011-01-02 18:09:54 +01:00
|
|
|
CLASS *CLASS_Timer = NULL;
|
2008-01-17 22:39:26 +01:00
|
|
|
|
|
|
|
CLASS *CLASS_Array = NULL;
|
|
|
|
CLASS *CLASS_BooleanArray = NULL;
|
|
|
|
CLASS *CLASS_ByteArray = NULL;
|
|
|
|
CLASS *CLASS_ShortArray = NULL;
|
|
|
|
CLASS *CLASS_IntegerArray = NULL;
|
|
|
|
CLASS *CLASS_SingleArray = NULL;
|
|
|
|
CLASS *CLASS_FloatArray = NULL;
|
|
|
|
CLASS *CLASS_DateArray = NULL;
|
|
|
|
CLASS *CLASS_StringArray = NULL;
|
|
|
|
CLASS *CLASS_ObjectArray = NULL;
|
|
|
|
CLASS *CLASS_VariantArray = NULL;
|
|
|
|
CLASS *CLASS_LongArray = NULL;
|
2008-01-23 20:56:18 +01:00
|
|
|
CLASS *CLASS_PointerArray = NULL;
|
2008-01-17 22:39:26 +01:00
|
|
|
|
|
|
|
CLASS *CLASS_String = NULL;
|
|
|
|
CLASS *CLASS_Enum = NULL;
|
2007-12-30 17:41:49 +01:00
|
|
|
|
|
|
|
typedef
|
|
|
|
struct {
|
|
|
|
GB_DESC *desc;
|
|
|
|
CLASS **class;
|
2008-01-24 11:42:42 +01:00
|
|
|
int array;
|
2010-05-19 14:43:57 +02:00
|
|
|
TYPE array_type;
|
2007-12-30 17:41:49 +01:00
|
|
|
}
|
|
|
|
CLASS_INIT;
|
|
|
|
|
2010-05-19 14:43:57 +02:00
|
|
|
static const CLASS_INIT init_list[] =
|
2007-12-30 17:41:49 +01:00
|
|
|
{
|
|
|
|
{ NATIVE_Gambas, NULL },
|
|
|
|
{ NATIVE_Param, NULL },
|
|
|
|
{ NATIVE_Enum, &CLASS_Enum },
|
|
|
|
{ NATIVE_Symbol, NULL },
|
|
|
|
{ NATIVE_Class, NULL },
|
|
|
|
{ NATIVE_Classes, NULL },
|
|
|
|
{ NATIVE_Component, NULL },
|
|
|
|
{ NATIVE_Components, NULL },
|
|
|
|
{ NATIVE_Object, NULL },
|
2008-01-24 11:42:42 +01:00
|
|
|
{ NATIVE_Collection, &CLASS_Collection, CQA_COLLECTION },
|
2007-12-30 17:41:49 +01:00
|
|
|
{ NATIVE_Error, NULL },
|
2016-04-10 15:10:25 +02:00
|
|
|
{ StreamLinesDesc, NULL },
|
|
|
|
{ StreamTermDesc, NULL },
|
|
|
|
{ StreamDesc, &CLASS_Stream },
|
|
|
|
{ StatPermDesc, NULL },
|
|
|
|
{ StatDesc, &CLASS_Stat },
|
|
|
|
{ FileDesc, &CLASS_File },
|
2007-12-30 17:41:49 +01:00
|
|
|
{ NATIVE_AppEnv, &CLASS_AppEnv },
|
|
|
|
{ NATIVE_AppArgs, &CLASS_AppArgs },
|
|
|
|
{ NATIVE_App, &CLASS_Application },
|
|
|
|
{ NATIVE_Process, &CLASS_Process },
|
|
|
|
{ NATIVE_System, NULL },
|
|
|
|
{ NATIVE_User, NULL },
|
|
|
|
{ NATIVE_String, NULL },
|
2012-08-26 18:26:53 +02:00
|
|
|
{ TaskDesc, NULL },
|
2011-01-02 18:09:54 +01:00
|
|
|
{ NATIVE_Timer, &CLASS_Timer },
|
2008-02-14 12:59:36 +01:00
|
|
|
{ NATIVE_Observer, &CLASS_Observer },
|
2010-12-21 15:05:42 +01:00
|
|
|
//{ NATIVE_Proxy, &CLASS_Proxy },
|
2007-12-30 17:41:49 +01:00
|
|
|
|
|
|
|
{ NATIVE_ArrayBounds, NULL },
|
|
|
|
{ NATIVE_Array, &CLASS_Array },
|
2010-05-19 14:43:57 +02:00
|
|
|
{ NATIVE_BooleanArray, &CLASS_BooleanArray, CQA_ARRAY, T_BOOLEAN },
|
|
|
|
{ NATIVE_ByteArray, &CLASS_ByteArray, CQA_ARRAY, T_BYTE },
|
|
|
|
{ NATIVE_ShortArray, &CLASS_ShortArray, CQA_ARRAY, T_SHORT },
|
|
|
|
{ NATIVE_IntegerArray, &CLASS_IntegerArray, CQA_ARRAY, T_INTEGER },
|
|
|
|
{ NATIVE_FloatArray, &CLASS_FloatArray, CQA_ARRAY, T_FLOAT },
|
|
|
|
{ NATIVE_SingleArray, &CLASS_SingleArray, CQA_ARRAY, T_SINGLE },
|
|
|
|
{ NATIVE_DateArray, &CLASS_DateArray, CQA_ARRAY, T_DATE },
|
|
|
|
{ NATIVE_StringArray, &CLASS_StringArray, CQA_ARRAY, T_STRING },
|
|
|
|
{ NATIVE_ObjectArray, &CLASS_ObjectArray, CQA_ARRAY, T_OBJECT },
|
|
|
|
{ NATIVE_VariantArray, &CLASS_VariantArray, CQA_ARRAY, T_VARIANT },
|
|
|
|
{ NATIVE_LongArray, &CLASS_LongArray, CQA_ARRAY, T_LONG },
|
|
|
|
{ NATIVE_PointerArray, &CLASS_PointerArray, CQA_ARRAY, T_POINTER },
|
2007-12-30 17:41:49 +01:00
|
|
|
|
|
|
|
{ NULL }
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2008-01-17 22:39:26 +01:00
|
|
|
void CLASS_init_native(void)
|
2007-12-30 17:41:49 +01:00
|
|
|
{
|
2010-05-19 14:43:57 +02:00
|
|
|
const CLASS_INIT *init;
|
2007-12-30 17:41:49 +01:00
|
|
|
CLASS *class;
|
|
|
|
|
|
|
|
/* NOTE: The 'Class' class must be first in the global class table */
|
|
|
|
CLASS_Class = CLASS_find("Class");
|
|
|
|
CLASS_Symbol = CLASS_find("Symbol");
|
|
|
|
CLASS_Component = CLASS_find("Component");
|
2008-03-11 14:29:47 +01:00
|
|
|
CLASS_Stream = CLASS_find("Stream");
|
2007-12-30 17:41:49 +01:00
|
|
|
|
|
|
|
//LIBRARY_Current = LIBRARY_create(NULL);
|
|
|
|
|
|
|
|
for (init = init_list; init->desc; init++)
|
|
|
|
{
|
|
|
|
class = CLASS_register(init->desc);
|
|
|
|
if (init->class != NULL)
|
|
|
|
*init->class = class;
|
2010-07-09 13:16:49 +02:00
|
|
|
if (init->array)
|
|
|
|
{
|
|
|
|
class->quick_array = init->array;
|
|
|
|
class->array_type = init->array_type;
|
2013-01-24 23:29:27 +01:00
|
|
|
class->is_array = init->array == CQA_ARRAY;
|
2010-07-09 13:16:49 +02:00
|
|
|
}
|
2007-12-30 17:41:49 +01:00
|
|
|
}
|
2009-02-17 02:51:25 +01:00
|
|
|
|
|
|
|
CLASS_Observer->is_observer = TRUE;
|
2010-05-27 00:01:28 +02:00
|
|
|
CLASS_Observer->size += sizeof(OBJECT_EVENT);
|
2010-12-21 15:05:42 +01:00
|
|
|
//CLASS_Proxy->is_observer = TRUE;
|
|
|
|
//CLASS_Proxy->size += sizeof(OBJECT_EVENT);
|
2007-12-30 17:41:49 +01:00
|
|
|
}
|