# under the terms of the license (GNU LGPL) which comes with this package.
use strict;
-use warnings;
-
+eval qq{
+ use warnings;
+}; # warnings not defined in 5.00503/sun4-solaris
sub usage {
my ($msg)=@_;
#include <msg.h>
#include <gras.h>
+char *gras_log=NULL;
+
EOF
;
foreach (keys %process) { print OUT "int $_(int argc,char *argv[]);\n"; }
foreach (keys %process) {
print OUT<<EOF
-int launch_$_(int argc, char *argv[]) {
- if (gras_process_init()) exit(1);
+int launch_$_(int argc, char **argv) {
+ char **myargv=argv;
+ int i;
+
+ if (gras_log) {
+ myargv=malloc((argc+1) * sizeof(char**));
+ for (i=0; i<argc; i++)
+ myargv[i] = argv[i];
+ myargv[argc++] = gras_log;
+ }
$_(argc,argv);
- if (gras_process_exit()) exit(1);
-
+ if (myargv != argv)
+ free(myargv);
return 0;
}
print OUT <<EOF
int main (int argc,char *argv[]) {
+ int i,j;
+
+ /** Save the gras-log argument */
+ for (i=1; i<argc; i++) {
+ if (!strncmp(argv[i],"--gras-log=",strlen("--gras-log="))) {
+ gras_log = argv[i];
+ for (j=i+1; j<argc; j++) {
+ argv[j-1] = argv[j];
+ }
+ argv[j-1] = NULL;
+ argc--;
+ i--; /* compensate effect of next loop incrementation */
+ }
+ }
if (argc != 3) {
- fprintf(stderr, "Usage: %s platform_file application_description.txt\\n",argv[0]);
+ fprintf(stderr, "Usage: %s platform_file application_description.txt [--gras-log=...]\\n",argv[0]);
exit(1);
}
- /* Simulation setting */
+ /* Simulation setup */
MSG_global_init();
MSG_set_verbosity(MSG_SILENT);
MSG_set_channel_number(GRAS_MAX_CHANNEL);
int main(int argc, char *argv[]){
int errcode;
- gras_init(&argc,argv);
- gras_process_init();
errcode=$pname(argc,argv);
- gras_process_exit();
- gras_exit();
return errcode;
}