~ubuntu-branches/ubuntu/quantal/simgrid/quantal

« back to all changes in this revision

Viewing changes to examples/gras/pmm/_pmm_simulator.c

  • Committer: Package Import Robot
  • Author(s): Lucas Nussbaum, Martin Quinson, Lucas Nussbaum
  • Date: 2012-06-09 16:24:44 UTC
  • mfrom: (10.1.4 sid)
  • Revision ID: package-import@ubuntu.com-20120609162444-xook34f3d6qy5ixj
Tags: 3.7.1-1
[ Martin Quinson ]
* debian/copyright: update FSF address (thanks lintian for noticing)

[ Lucas Nussbaum ]
* New upstream release.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/***********
2
 
 * DO NOT EDIT! THIS FILE HAS BEEN AUTOMATICALLY GENERATED FROM /home/mquinson/Code/simgrid/examples/gras/pmm/pmm.xml BY gras_stub_generator
3
 
 ***********/
4
 
 
5
 
/* specific to Borland Compiler */
6
 
#ifdef __BORLANDC__
7
 
#pragma hdrstop
8
 
#endif
9
 
 
10
 
#include <stdlib.h>
11
 
#include <stdio.h>
12
 
#include "msg/msg.h"
13
 
#include <gras.h>
14
 
 
15
 
char *gras_log=NULL;
16
 
int master(int argc,char *argv[]);
17
 
int slave(int argc,char *argv[]);
18
 
 
19
 
int launch_master(int argc,char *argv[]);
20
 
int launch_slave(int argc,char *argv[]);
21
 
 
22
 
/***********
23
 
 * DO NOT EDIT! THIS FILE HAS BEEN AUTOMATICALLY GENERATED FROM /home/mquinson/Code/simgrid/examples/gras/pmm/pmm.xml BY gras_stub_generator
24
 
 ***********/
25
 
 
26
 
int launch_master(int argc, char **argv) {
27
 
  char **myargv=argv;
28
 
  int myargc=argc;
29
 
  int i;
30
 
  int retcode;
31
 
    
32
 
  if (gras_log) {
33
 
    myargv=malloc((argc+1) * sizeof(char**));
34
 
    for (i=0; i<argc; i++)
35
 
      myargv[i] = argv[i];
36
 
    myargv[myargc++] = gras_log;
37
 
  }
38
 
  retcode = master(myargc,myargv);
39
 
  if (myargv != argv)
40
 
    free(myargv);
41
 
  return retcode;
42
 
}
43
 
int launch_slave(int argc, char **argv) {
44
 
  char **myargv=argv;
45
 
  int myargc=argc;
46
 
  int i;
47
 
  int retcode;
48
 
    
49
 
  if (gras_log) {
50
 
    myargv=malloc((argc+1) * sizeof(char**));
51
 
    for (i=0; i<argc; i++)
52
 
      myargv[i] = argv[i];
53
 
    myargv[myargc++] = gras_log;
54
 
  }
55
 
  retcode = slave(myargc,myargv);
56
 
  if (myargv != argv)
57
 
    free(myargv);
58
 
  return retcode;
59
 
}
60
 
 
61
 
/***********
62
 
 * DO NOT EDIT! THIS FILE HAS BEEN AUTOMATICALLY GENERATED FROM /home/mquinson/Code/simgrid/examples/gras/pmm/pmm.xml BY gras_stub_generator
63
 
 ***********/
64
 
 
65
 
/* specific to Borland Compiler */
66
 
#ifdef __BORLANDDC__
67
 
#pragma argsused
68
 
#endif
69
 
 
70
 
int main (int argc,char *argv[]) {
71
 
 
72
 
  /*  Simulation setup */
73
 
  gras_global_init(&argc,argv);
74
 
  if (argc != 3) {
75
 
    fprintf(stderr, "Usage: %s platform.xml deployment.xml [--log=...]\n",argv[0]);
76
 
    exit(1);
77
 
  }
78
 
 
79
 
  gras_create_environment(argv[1]);
80
 
 
81
 
  /*  Application deployment */
82
 
  gras_function_register("master", launch_master);
83
 
  gras_function_register("slave", launch_slave);
84
 
 
85
 
 
86
 
  gras_launch_application(argv[2]);
87
 
 
88
 
  /*  Run the simulation */
89
 
  gras_main();
90
 
 
91
 
  /* cleanup the place */
92
 
  gras_clean();
93
 
  if (gras_log)
94
 
    free(gras_log);
95
 
  return 0;
96
 
}