2007-12-30 17:41:49 +01:00
|
|
|
/***************************************************************************
|
|
|
|
|
2018-08-31 15:58:53 +02:00
|
|
|
c_system.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
|
|
|
|
|
|
|
***************************************************************************/
|
|
|
|
|
2018-08-31 15:58:53 +02:00
|
|
|
#define __C_SYSTEM_C
|
2007-12-30 17:41:49 +01:00
|
|
|
|
|
|
|
#include "gambas.h"
|
|
|
|
#include "gb_common.h"
|
|
|
|
#include "gb_reserved.h"
|
2018-08-31 15:58:53 +02:00
|
|
|
#include "c_system.h"
|
2007-12-30 17:41:49 +01:00
|
|
|
|
|
|
|
static GB_ARRAY _keywords = 0;
|
2009-12-12 03:58:12 +01:00
|
|
|
static GB_ARRAY _datatypes = 0;
|
2007-12-30 17:41:49 +01:00
|
|
|
|
|
|
|
BEGIN_PROPERTY(CSYSTEM_keywords)
|
|
|
|
|
|
|
|
COMP_INFO *info;
|
|
|
|
SUBR_INFO *subr;
|
|
|
|
char *str;
|
|
|
|
|
|
|
|
if (!_keywords)
|
|
|
|
{
|
|
|
|
GB.Array.New(&_keywords, GB_T_STRING, 0);
|
|
|
|
|
|
|
|
for (info = &COMP_res_info[1]; info->name; info++)
|
|
|
|
{
|
|
|
|
if (*info->name >= 'A' && *info->name <= 'Z')
|
|
|
|
{
|
2010-06-05 01:48:53 +02:00
|
|
|
str = GB.NewZeroString(info->name);
|
2007-12-30 17:41:49 +01:00
|
|
|
*((char **)GB.Array.Add(_keywords)) = str;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
for (subr = &COMP_subr_info[0]; subr->name; subr++)
|
|
|
|
{
|
2010-06-05 01:48:53 +02:00
|
|
|
str = GB.NewZeroString(subr->name);
|
2007-12-30 17:41:49 +01:00
|
|
|
*((char **)GB.Array.Add(_keywords)) = str;
|
|
|
|
}
|
|
|
|
|
|
|
|
GB.Ref(_keywords);
|
|
|
|
}
|
|
|
|
|
|
|
|
GB.ReturnObject(_keywords);
|
|
|
|
|
|
|
|
END_PROPERTY
|
|
|
|
|
2009-12-12 03:58:12 +01:00
|
|
|
BEGIN_PROPERTY(CSYSTEM_datatypes)
|
|
|
|
|
|
|
|
COMP_INFO *info;
|
|
|
|
char *str;
|
|
|
|
|
|
|
|
if (!_datatypes)
|
|
|
|
{
|
|
|
|
GB.Array.New(&_datatypes, GB_T_STRING, 0);
|
|
|
|
|
|
|
|
for (info = &COMP_res_info[1]; info->name; info++)
|
|
|
|
{
|
|
|
|
if (info->flag & RSF_TYPE)
|
|
|
|
{
|
2010-06-05 01:48:53 +02:00
|
|
|
str = GB.NewZeroString(info->name);
|
2009-12-12 03:58:12 +01:00
|
|
|
*((char **)GB.Array.Add(_datatypes)) = str;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
GB.Ref(_datatypes);
|
|
|
|
}
|
|
|
|
|
|
|
|
GB.ReturnObject(_datatypes);
|
|
|
|
|
|
|
|
END_PROPERTY
|
|
|
|
|
2007-12-30 17:41:49 +01:00
|
|
|
BEGIN_METHOD_VOID(CSYSTEM_exit)
|
|
|
|
|
|
|
|
GB.Unref((void **)&_keywords);
|
2009-12-12 03:58:12 +01:00
|
|
|
GB.Unref((void **)&_datatypes);
|
2007-12-30 17:41:49 +01:00
|
|
|
|
|
|
|
END_METHOD
|
|
|
|
|
|
|
|
|
|
|
|
GB_DESC CSystemDesc[] =
|
|
|
|
{
|
|
|
|
GB_DECLARE("System", 0),
|
|
|
|
|
|
|
|
GB_STATIC_METHOD("_exit", NULL, CSYSTEM_exit, NULL),
|
|
|
|
|
|
|
|
GB_STATIC_PROPERTY_READ("Keywords", "String[]", CSYSTEM_keywords),
|
2009-12-12 03:58:12 +01:00
|
|
|
GB_STATIC_PROPERTY_READ("Datatypes", "String[]", CSYSTEM_datatypes),
|
2007-12-30 17:41:49 +01:00
|
|
|
|
|
|
|
GB_END_DECLARE
|
|
|
|
};
|
|
|
|
|