[INTERPRETER]

* NEW: Application.Startup is a new property that returns the name of the 
  startup class.
* NEW: Class.AutoCreate is a new method that creates the automatic instance 
  of a class, and returns it. It returns NULL if the class is not 
  auto-creatable.


git-svn-id: svn://localhost/gambas/trunk@2820 867c0c6c-44f3-4631-809d-bfa615b0a4ec
This commit is contained in:
Benoît Minisini 2010-03-25 11:16:33 +00:00
parent 029e4b5b18
commit a6e879db91
2 changed files with 21 additions and 5 deletions

View file

@ -291,6 +291,12 @@ BEGIN_PROPERTY(CAPPLICATION_daemon)
END_PROPERTY
BEGIN_PROPERTY(Application_Startup)
GB_ReturnString(PROJECT_startup);
END_PROPERTY
BEGIN_PROPERTY(System_Language)
@ -408,6 +414,7 @@ GB_DESC NATIVE_App[] =
GB_STATIC_PROPERTY_READ("Dir", "i", CAPPLICATION_dir),
GB_STATIC_PROPERTY("Return", "i", CAPPLICATION_return),
GB_STATIC_PROPERTY("Daemon", "b", CAPPLICATION_daemon),
GB_STATIC_PROPERTY_READ("Startup", "s", Application_Startup),
GB_END_DECLARE
};

View file

@ -291,6 +291,17 @@ BEGIN_PROPERTY(Class_Instance)
END_PROPERTY
BEGIN_METHOD_VOID(Class_AutoCreate)
CLASS *class = OBJECT(CLASS);
if (!class->auto_create)
GB_ReturnNull();
else
GB_ReturnObject(CLASS_auto_create(class, 0));
END_METHOD
/**** Symbol ***************************************************************/
@ -701,16 +712,13 @@ BEGIN_METHOD(Object_Call, GB_OBJECT object; GB_STRING method; GB_OBJECT params)
void *object = VARG(object);
GB_FUNCTION func;
GB_ARRAY params = VARGOPT(params, NULL);
CLASS *class;
if (GB_CheckObject(object))
return;
class = OBJECT_class(object);
if (GB_GetFunction(&func, object, name, NULL, NULL))
{
GB_Error((char *)E_NSYMBOL, name, class->name);
GB_Error((char *)E_NSYMBOL, name, OBJECT_class(object)->name);
return;
}
@ -896,6 +904,7 @@ GB_DESC NATIVE_Class[] =
GB_PROPERTY_READ("Count", "i", Class_Count),
GB_PROPERTY_READ("Instance", "o", Class_Instance),
GB_PROPERTY_READ("Symbols", "String[]", Class_Symbols),
GB_METHOD("AutoCreate", "o", Class_AutoCreate, NULL),
GB_CONSTANT("Variable", "i", 1),
GB_CONSTANT("Property", "i", 2),