#include <signal.h>#include <stdio.h>#include <string.h>#include "machine.h"#include "stack-c.h"#include "version.h"Include dependency graph for realmain.h:

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.
Functions | |
| void | realmain (int nowin, int no_startup_flag, char *initial_script, int initial_script_type, int memory) |
| int | Get_no_startup_flag (void) |
| void | Set_no_startup_flag (int start) |
| char ** | create_argv (int *argc) |
| char** create_argv | ( | int * | argc | ) |
Definition at line 176 of file realmain.c.
Referenced by realmain().
00177 { 00178 int i; 00179 char **argv; 00180 *argc = C2F(sciiargc)() + 1; 00181 if ( ( argv = malloc((*argc)*sizeof(char *))) == NULL) return NULL; 00182 for ( i=0 ; i < *argc ; i++) 00183 { 00184 char buf[BSIZE]; 00185 C2F(scigetarg)(&i,buf,BSIZE); 00186 buf[BSIZE-1]='\0'; 00187 strip_blank(buf); 00188 argv[i] = malloc((strlen(buf)+1)*sizeof(char)); 00189 if ( argv[i] == NULL) return NULL; 00190 strcpy(argv[i],buf); 00191 } 00192 return argv; 00193 }
Here is the caller graph for this function:

| int Get_no_startup_flag | ( | void | ) |
Definition at line 170 of file realmain.c.
References no_startup_flag.
Referenced by TerminateCorePart1().
00171 { 00172 return no_startup_flag; 00173 }
Here is the caller graph for this function:

| void realmain | ( | int | nowin, | |
| int | no_startup_flag, | |||
| char * | initial_script, | |||
| int | initial_script_type, | |||
| int | memory | |||
| ) |
Definition at line 39 of file realmain.c.
Referenced by sci_windows_main().
00040 { 00041 static int ini=-1; 00042 int ierr=0; 00043 char *startup=(char*)MALLOC(sizeof(char)*PATH_MAX+1); 00044 //[256]; 00045 00046 Set_no_startup_flag(no_startup_flag_l); 00047 00048 /* create temp directory */ 00049 C2F(settmpdir)(); 00050 /* signals */ 00051 #ifdef ENABLESIG 00052 signal(SIGINT,sci_clear_and_exit); 00053 #ifdef SIGBUS 00054 signal(SIGBUS,sci_clear_and_exit); 00055 #endif 00056 signal(SIGSEGV,sci_clear_and_exit); 00057 #if SIGQUIT 00058 signal(SIGQUIT,sci_clear_and_exit); 00059 #endif 00060 #ifdef SIGHUP 00061 signal(SIGHUP,sci_clear_and_exit); 00062 #endif 00063 #ifdef SIGUSR1 00064 signal(SIGUSR1,sci_usr1_signal); 00065 #endif 00066 00067 #ifdef _MSC_VER 00068 signal(SIGILL,sci_clear_and_exit); 00069 signal(SIGFPE,sci_clear_and_exit); 00070 signal(SIGTERM,sci_clear_and_exit); 00071 signal(SIGBREAK,sci_clear_and_exit); 00072 signal(SIGABRT,sci_clear_and_exit); 00073 #endif 00074 #endif 00075 00076 /* prepare startup script */ 00077 00078 if ( no_startup_flag_l == 0) 00079 { 00080 /* execute a startup */ 00081 if ( initial_script != NULL ) switch ( initial_script_type ) 00082 { 00083 case 0 : 00084 sprintf(startup,"%s;exec('%s',-1)",get_sci_data_strings(1),initial_script); 00085 break; 00086 case 1 : 00087 sprintf(startup,"%s;%s;",get_sci_data_strings(1),initial_script); 00088 break; 00089 } 00090 else sprintf(startup,"%s;",get_sci_data_strings(1)); 00091 } 00092 else 00093 { 00094 /* No startup but maybe an initial script */ 00095 if ( initial_script != NULL ) switch ( initial_script_type ) 00096 { 00097 case 0 : 00098 sprintf(startup,"exec('%s',-1)",initial_script); break; 00099 case 1 : 00100 sprintf(startup,"%s;",initial_script); break; 00101 } 00102 else sprintf(startup," "); 00103 } 00104 00105 #ifndef _MSC_VER 00106 if ( nowin == 0 ) 00107 { 00108 int argc=0; 00109 char **argv=NULL; 00110 00111 argv = create_argv(&argc); 00112 00113 /* we are in window mode */ 00114 SetXsciOn(); 00115 main_sci(argc,argv,startup,strlen(startup),memory); 00116 } 00117 else 00118 { 00119 if (! IsNoInteractiveWindow() ) 00120 { 00121 InitXsession(); 00122 } 00123 /* initialize scilab interp */ 00124 C2F(inisci)(&ini, &memory, &ierr); 00125 if (ierr > 0) sci_exit(1) ; 00126 /* execute the initial script and enter scilab */ 00127 C2F(scirun)(startup,strlen(startup)); 00128 } 00129 #else 00130 /* initialize scilab interp */ 00131 C2F(inisci)(&ini, &memory, &ierr); 00132 if (ierr > 0) sci_exit(1) ; 00133 00134 /* execute the initial script and enter scilab */ 00135 #ifndef _DEBUG 00136 _try 00137 { 00138 C2F(scirun)(startup,strlen(startup)); 00139 } 00140 _except (EXCEPTION_EXECUTE_HANDLER) 00141 { 00142 Rerun: 00143 { 00144 ExceptionMessage(GetExceptionCode(),NULL); 00145 } 00146 _try 00147 { 00148 C2F(scirun)("",strlen("")); 00149 } 00150 _except (EXCEPTION_EXECUTE_HANDLER) 00151 { 00152 goto Rerun; 00153 } 00154 00155 } 00156 #else 00157 C2F(scirun)(startup,strlen(startup)); 00158 #endif 00159 #endif 00160 FREE(startup); 00161 /* cleaning */ 00162 C2F(sciquit)(); 00163 }
Here is the caller graph for this function:

| void Set_no_startup_flag | ( | int | start | ) |
Definition at line 165 of file realmain.c.
References no_startup_flag.
Referenced by realmain().
00166 { 00167 no_startup_flag=start; 00168 }
Here is the caller graph for this function:

1.5.1