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

« back to all changes in this revision

Viewing changes to examples/gras/rpc/_rpc_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/rpc/rpc.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 client(int argc,char *argv[]);
17
 
int server(int argc,char *argv[]);
18
 
int forwarder(int argc,char *argv[]);
19
 
 
20
 
int launch_client(int argc,char *argv[]);
21
 
int launch_server(int argc,char *argv[]);
22
 
int launch_forwarder(int argc,char *argv[]);
23
 
 
24
 
/***********
25
 
 * DO NOT EDIT! THIS FILE HAS BEEN AUTOMATICALLY GENERATED FROM /home/mquinson/Code/simgrid/examples/gras/rpc/rpc.xml BY gras_stub_generator
26
 
 ***********/
27
 
 
28
 
int launch_client(int argc, char **argv) {
29
 
  char **myargv=argv;
30
 
  int myargc=argc;
31
 
  int i;
32
 
  int retcode;
33
 
    
34
 
  if (gras_log) {
35
 
    myargv=malloc((argc+1) * sizeof(char**));
36
 
    for (i=0; i<argc; i++)
37
 
      myargv[i] = argv[i];
38
 
    myargv[myargc++] = gras_log;
39
 
  }
40
 
  retcode = client(myargc,myargv);
41
 
  if (myargv != argv)
42
 
    free(myargv);
43
 
  return retcode;
44
 
}
45
 
int launch_server(int argc, char **argv) {
46
 
  char **myargv=argv;
47
 
  int myargc=argc;
48
 
  int i;
49
 
  int retcode;
50
 
    
51
 
  if (gras_log) {
52
 
    myargv=malloc((argc+1) * sizeof(char**));
53
 
    for (i=0; i<argc; i++)
54
 
      myargv[i] = argv[i];
55
 
    myargv[myargc++] = gras_log;
56
 
  }
57
 
  retcode = server(myargc,myargv);
58
 
  if (myargv != argv)
59
 
    free(myargv);
60
 
  return retcode;
61
 
}
62
 
int launch_forwarder(int argc, char **argv) {
63
 
  char **myargv=argv;
64
 
  int myargc=argc;
65
 
  int i;
66
 
  int retcode;
67
 
    
68
 
  if (gras_log) {
69
 
    myargv=malloc((argc+1) * sizeof(char**));
70
 
    for (i=0; i<argc; i++)
71
 
      myargv[i] = argv[i];
72
 
    myargv[myargc++] = gras_log;
73
 
  }
74
 
  retcode = forwarder(myargc,myargv);
75
 
  if (myargv != argv)
76
 
    free(myargv);
77
 
  return retcode;
78
 
}
79
 
 
80
 
/***********
81
 
 * DO NOT EDIT! THIS FILE HAS BEEN AUTOMATICALLY GENERATED FROM /home/mquinson/Code/simgrid/examples/gras/rpc/rpc.xml BY gras_stub_generator
82
 
 ***********/
83
 
 
84
 
/* specific to Borland Compiler */
85
 
#ifdef __BORLANDDC__
86
 
#pragma argsused
87
 
#endif
88
 
 
89
 
int main (int argc,char *argv[]) {
90
 
 
91
 
  /*  Simulation setup */
92
 
  gras_global_init(&argc,argv);
93
 
  if (argc != 3) {
94
 
    fprintf(stderr, "Usage: %s platform.xml deployment.xml [--log=...]\n",argv[0]);
95
 
    exit(1);
96
 
  }
97
 
 
98
 
  gras_create_environment(argv[1]);
99
 
 
100
 
  /*  Application deployment */
101
 
  gras_function_register("client", launch_client);
102
 
  gras_function_register("server", launch_server);
103
 
  gras_function_register("forwarder", launch_forwarder);
104
 
 
105
 
 
106
 
  gras_launch_application(argv[2]);
107
 
 
108
 
  /*  Run the simulation */
109
 
  gras_main();
110
 
 
111
 
  /* cleanup the place */
112
 
  gras_clean();
113
 
  if (gras_log)
114
 
    free(gras_log);
115
 
  return 0;
116
 
}