#include <stdio.h>#include <setjmp.h>#include <signal.h>#include <string.h>#include <stdlib.h>#include <conio.h>#include "wresource.h"#include "wcommon.h"#include "stack-c.h"#include "Os_specific.h"#include "Messages.h"#include "Warnings.h"#include "Errors.h"Include dependency graph for wtloop.c:

Go to the source code of this file.
Functions | |
| int C2F() | sciquit (void) |
| static void | interrupt_setup () |
| void | realmain (int nowin, int no_startup_flag, char *initial_script, int initial_script_type, int memory) |
| void | SignalCtrC (void) |
| void | inter (int an_int) |
| void | sci_windows_main (int nowin, int *nos, char *path, int pathtype, int *lpath, int memory) |
| void | sci_clear_and_exit (int n) |
| void | sci_usr1_signal (int n) |
| void | sci_sig_tstp (int n) |
Variables | |
| jmp_buf | env |
| void inter | ( | int | an_int | ) |
Definition at line 74 of file wtloop.c.
References env, sciprint(), TRUE, and void().
Referenced by interrupt_setup(), paksazi(), and test_interupt().
00075 { 00076 (void) signal (SIGINT, inter); 00077 (void) signal (SIGFPE, SIG_DFL); /* turn off FPE trapping */ 00078 (void) fflush (stdout); 00079 sciprint ("\n"); 00080 longjmp (env, TRUE); /* return to prompt */ 00081 }
Here is the call graph for this function:

Here is the caller graph for this function:

| static void interrupt_setup | ( | ) | [static] |
| 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.
References C2F, create_argv(), ExceptionMessage(), FREE, get_sci_data_strings(), ierr, inisci(), InitXsession(), IsNoInteractiveWindow(), main_sci(), MALLOC, NULL, PATH_MAX, sci_clear_and_exit(), sci_exit(), sci_usr1_signal(), sciquit(), scirun(), Set_no_startup_flag(), settmpdir(), SetXsciOn(), SIGHUP, and SIGQUIT.
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 call graph for this function:

| void sci_clear_and_exit | ( | int | n | ) |
Definition at line 108 of file wtloop.c.
References C2F, Message(), MSG_ERROR20, MSG_ERROR59, MSG_ERROR60, MSG_ERROR61, MSG_ERROR62, MSG_ERROR63, MSG_ERROR64, MSG_ERROR65, MSG_ERROR66, NULL, and sciquit().
00109 { 00110 #ifdef _DEBUG 00111 char Message[256]; 00112 switch (n) 00113 { 00114 case SIGINT: 00115 wsprintf(Message,MSG_ERROR59); 00116 break; 00117 case SIGILL: 00118 wsprintf(Message,MSG_ERROR60); 00119 break; 00120 case SIGFPE: 00121 wsprintf(Message,MSG_ERROR61); 00122 break; 00123 case SIGSEGV: 00124 wsprintf(Message,MSG_ERROR62); 00125 break; 00126 case SIGTERM: 00127 wsprintf(Message,MSG_ERROR63); 00128 break; 00129 case SIGBREAK: 00130 wsprintf(Message,MSG_ERROR64); 00131 break; 00132 case SIGABRT: 00133 wsprintf(Message,MSG_ERROR65); 00134 break; 00135 default: 00136 wsprintf(Message,MSG_ERROR66); 00137 break; 00138 } 00139 MessageBox(NULL,Message,MSG_ERROR20,MB_ICONWARNING); 00140 #else 00141 /*MessageBox(NULL,MSG_WARNING30,MSG_WARNING22,MB_ICONWARNING);*/ 00142 #endif 00143 C2F(sciquit)(); 00144 }
Here is the call graph for this function:

| void sci_sig_tstp | ( | int | n | ) |
Ctrl-Z : stops the current computation or the current interface call
Definition at line 159 of file wtloop.c.
References MSG_ERROR67.
00160 { 00161 Scierror(999,MSG_ERROR67); 00162 }
| void sci_usr1_signal | ( | int | n | ) |
usr1 signal : used to transmit a Control C to scilab
Definition at line 150 of file wtloop.c.
References controlC_handler().
00151 { 00152 controlC_handler(n); 00153 }
Here is the call graph for this function:

Definition at line 89 of file wtloop.c.
References env, interrupt_setup(), NULL, and realmain().
Referenced by Console_Main(), and Windows_Main().
00090 { 00091 setbuf (stderr, (char *) NULL); 00092 if (!setjmp (env)) 00093 { 00094 /* first time */ 00095 interrupt_setup (); 00096 } 00097 else 00098 { 00099 /* come back here from int_error() */ 00100 if (nowin != 1) 00101 SetCursor (LoadCursor ((HINSTANCE) NULL, IDC_ARROW)); 00102 } 00103 /* take commands from stdin */ 00104 realmain(nowin,*nos,path,pathtype,memory); 00105 00106 }
Here is the call graph for this function:

Here is the caller graph for this function:

| int C2F() sciquit | ( | void | ) |
TODO : comment
Definition at line 47 of file sciquit.c.
References ExitScilab(), and sci_exit().
00048 { 00049 int status = 0; 00050 ExitScilab(); 00051 sci_exit(status) ; 00052 return 0; 00053 }
Here is the call graph for this function:

| void SignalCtrC | ( | void | ) |
Definition at line 66 of file wtloop.c.
References C2F, j, and sigbas().
Referenced by CtrlCHit(), msdos_getch(), SendMacro(), and Windows_getch().
Here is the call graph for this function:

Here is the caller graph for this function:

1.5.1