Esempio n. 1
0
globle void EnvListDeftemplates(
  void *theEnv,
  char *logicalName,
  void *theModule)
  {   
   ListConstruct(theEnv,DeftemplateData(theEnv)->DeftemplateConstruct,logicalName,(struct defmodule *) theModule); 
  }
Esempio n. 2
0
/***************************************************
  NAME         : EnvListDeffunctions
  DESCRIPTION  : Displays all deffunction names
  INPUTS       : 1) The logical name of the output
                 2) The module
  RETURNS      : Nothing useful
  SIDE EFFECTS : Deffunction name sprinted
  NOTES        : C Interface
 ***************************************************/
globle void EnvListDeffunctions(
  void *theEnv,
  char *logicalName,
  struct defmodule *theModule)
  {
   ListConstruct(theEnv,DeffunctionData(theEnv)->DeffunctionConstruct,logicalName,theModule);
  }
Esempio n. 3
0
void EnvListDefrules(
  void *theEnv,
  const char *logicalName,
  void *theModule)
  {
   ListConstruct(theEnv,DefruleData(theEnv)->DefruleConstruct,logicalName,(struct defmodule *) theModule); 
  }
Esempio n. 4
0
/***************************************************
  NAME         : EnvListDefclasses
  DESCRIPTION  : Displays all defclass names
  INPUTS       : 1) The logical name of the output
                 2) The module
  RETURNS      : Nothing useful
  SIDE EFFECTS : Defclass names printed
  NOTES        : C Interface
 ***************************************************/
globle void EnvListDefclasses(
  void *theEnv,
  const char *logicalName,
  struct defmodule *theModule)
  {
   ListConstruct(theEnv,DefclassData(theEnv)->DefclassConstruct,logicalName,theModule);
  }
Esempio n. 5
0
globle void ListDefglobals(
  char *logicalName,
  void *vTheModule)
  {
   struct defmodule *theModule = (struct defmodule *) vTheModule;

   ListConstruct(DefglobalConstruct,logicalName,theModule);
  }
Esempio n. 6
0
globle void EnvListDefrules(
  void *theEnv,
  EXEC_STATUS,
  char *logicalName,
  void *theModule)
  {
   ListConstruct(theEnv,execStatus,DefruleData(theEnv,execStatus)->DefruleConstruct,logicalName,(struct defmodule *) theModule); 
  }
Esempio n. 7
0
/***************************************************
  NAME         : EnvListDefclasses
  DESCRIPTION  : Displays all defclass names
  INPUTS       : 1) The logical name of the output
                 2) The module
  RETURNS      : Nothing useful
  SIDE EFFECTS : Defclass names printed
  NOTES        : C Interface
 ***************************************************/
globle void EnvListDefclasses(
  void *theEnv,
  EXEC_STATUS,
  char *logicalName,
  struct defmodule *theModule)
  {
   ListConstruct(theEnv,execStatus,DefclassData(theEnv,execStatus)->DefclassConstruct,logicalName,theModule);
  }
Esempio n. 8
0
globle void EnvListDefglobals(
  void *theEnv,
  const char *logicalName,
  void *vTheModule)
  {
   struct defmodule *theModule = (struct defmodule *) vTheModule;

   ListConstruct(theEnv,DefglobalData(theEnv)->DefglobalConstruct,logicalName,theModule);
  }
Esempio n. 9
0
File: main.c Progetto: msantl/PARPRO
int main(int argc, char **argv) {
    int myid, n_workers, status, n_thread, i;

    if (argc == 2) {
        sscanf(argv[1], "%d", &g_max_depth);
    } else {
        g_max_depth = MAX_DEPTH;
    }

    if (MPI_Init_thread(&argc, &argv, MPI_THREAD_MULTIPLE, &status) != MPI_SUCCESS) {
        errx(1, "MPI_Init_thread failed!");
    }

    if (status != MPI_THREAD_MULTIPLE) {
        errx(1, "MPI_Init_thread failed to provide thread support!");
    }

    thread_functions[0] = worker;
    thread_functions[1] = master;
    thread_functions[2] = user_input;

    pthread_mutex_init(&m_board, NULL);
    pthread_cond_init(&u_human, NULL);
    pthread_cond_init(&u_computer, NULL);

    sigset(SIGINT, Exit);

    MPI_Comm_size(MPI_COMM_WORLD, &n_workers);
    MPI_Comm_rank(MPI_COMM_WORLD, &myid);

    /* init processes */
    if (myid == 0) {
        ListConstruct(&q_worker_ready);

        for (i = 0; i < n_workers; ++i) {
            ListInsert(&q_worker_ready, i);
        }

        BoardInit(&board);
        BoardPrint(&board);

        n_thread = 3;
    } else {
        n_thread = 1;
    }

    /* start the game */
    RUNNING = 1;
    CURRENT_PLAYER = HUMAN;

    for (i = 0; i < n_thread; ++i) {
        if (pthread_create(&threads[i], NULL, thread_functions[i], NULL) != 0) {
            errx(1, "pthread_create(): failed to create a new thread!");
        }
    }

    /* end the game */
    for (i = 0; i < n_thread; ++i) {
        pthread_join(threads[i], NULL);
    }

    Exit(0);
    return 0;
}
Esempio n. 10
0
globle void ListDeftemplates(
  char *logicalName,
  void *theModule)
  { ListConstruct(DeftemplateConstruct,logicalName,(struct defmodule *) theModule); }