00001
00014 #include <stdlib.h>
00015 #include <string.h>
00016
00017 #include "environment.h"
00018 #include "exec.h"
00019 #include "save.h"
00020 #include "matlab.h"
00021
00024 STATUS environment_start(int argc,
00025 char *argv[])
00026 {
00027 if (strcmp(global_environment,"batch")==0)
00028 {
00029
00030 if (exec_start()==FAILED)
00031 {
00032 output_fatal("shutdown after simulation stopped prematurely");
00033 if (global_dumpfile[0]!='\0')
00034 {
00035 if (!saveall(global_dumpfile))
00036 output_error("dump to '%s' failed", global_dumpfile);
00037 else
00038 output_message("dump to '%s' complete", global_dumpfile);
00039 }
00040 exit(5);
00041 }
00042 return SUCCESS;
00043 }
00044 else if (strcmp(global_environment,"matlab")==0)
00045 {
00046 output_verbose("starting Matlab");
00047 return matlab_startup(argc,argv);
00048 }
00049 else
00050 {
00051 output_fatal("%s environment not recognized or supported",global_environment);
00052 return FAILED;
00053 }
00054 }
00055