next up previous contents index
Next: The "setup" Method Up: Projects Previous: How Projects Work

Creating Projects

Projects are created like all instances by sending

   GRAPE(Project, "new-instance")(name, char * setup, hidden)
char * name
char * setup
int hidden
to the class. name is the name of the project to be created, it has to be unique therefore "new-instance" will fail if a project with the same name already exists.

setup is the name of the project's setup method, it determines which classes, methods, etc. will be managed by the project. Writing a project setup method will be explained in the next section.

        If the hidden flag is TRUE the project will not be included in the manager's project list. This way projects can be hidden from the users view, nevertheless hidden projects can be added by typing in their name. There are methods "hide" and "show" which allow to hide projects or to make them visible again after they have been created, but these methods should only be used internally.

A more elegant way to declare new projects is provided by the function

void g_project_include(PRTYPE *);
which takes a NULL terminated list of projects
typedef struct {
  char *name;      /* name of the project */
  char *setup;     /* setup function name */
  void *(*func)(); /* setup function pointer */
  int hidden;      /* hidden flag */
} PRTYPE;
as parameter. The setup methods will be added automatically by the g_project_include function, if "new-instance" is used the setup methods have to be added with "add-method". In section 5.6.7 we will present a ``standard'' GRAPE main program which uses this function to add the user project list.

    Project can't be deleted, therefore Project's "free" method will display an error message when you accidentally try to delete a project.



SFB 256 Universität Bonn and IAM Universität Freiburg

Copyright © by the Sonderforschungsbereich 256 at the Institut für Angewandte Mathematik, Universität Bonn.