gambas-source-code/main/lib/eval/CSystem.c
Benoît Minisini 23db05d0f2 [DEVELOPMENT ENVIRONMENT]
* BUG: Some fixes in help on project symbols.
* BUG: F2 (Find definition) now uses the help browser to display help on 
  classes and symbols.
* NEW: A new button in the help browser to modify the current 
  documentation page, by opening an external web browser for that.

[GB.EVAL]
* NEW: System.Datatypes is a new property that return a list of all native 
  datatypes.

[GB.WEB]
* NEW: Start implementing some HTTP cache management in the Response class.


git-svn-id: svn://localhost/gambas/trunk@2483 867c0c6c-44f3-4631-809d-bfa615b0a4ec
2009-12-12 02:58:12 +00:00

109 lines
2.4 KiB
C

/***************************************************************************
CSystem.c
(c) 2000-2009 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., 675 Mass Ave, Cambridge, MA 02139, USA.
***************************************************************************/
#define __CSYSTEM_C
#include "gambas.h"
#include "gb_common.h"
#include "gb_reserved.h"
#include "CSystem.h"
static GB_ARRAY _keywords = 0;
static GB_ARRAY _datatypes = 0;
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')
{
GB.NewString(&str, info->name, 0);
*((char **)GB.Array.Add(_keywords)) = str;
}
}
for (subr = &COMP_subr_info[0]; subr->name; subr++)
{
GB.NewString(&str, subr->name, 0);
*((char **)GB.Array.Add(_keywords)) = str;
}
GB.Ref(_keywords);
}
GB.ReturnObject(_keywords);
END_PROPERTY
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)
{
GB.NewString(&str, info->name, 0);
*((char **)GB.Array.Add(_datatypes)) = str;
}
}
GB.Ref(_datatypes);
}
GB.ReturnObject(_datatypes);
END_PROPERTY
BEGIN_METHOD_VOID(CSYSTEM_exit)
GB.Unref((void **)&_keywords);
GB.Unref((void **)&_datatypes);
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),
GB_STATIC_PROPERTY_READ("Datatypes", "String[]", CSYSTEM_datatypes),
GB_END_DECLARE
};