move disp in output_stream
[scilab.git] / scilab / modules / io / sci_gateway / c / gw_io.c
1 /*
2  * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
3  * Copyright (C) 2006 - INRIA - Allan CORNET
4  * 
5  * This file must be used under the terms of the CeCILL.
6  * This source file is licensed as described in the file COPYING, which
7  * you should have received as part of this distribution.  The terms
8  * are also available at    
9  * http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt
10  *
11  */
12
13 #include "gw_io.h"
14 #include "gw_output_stream.h" /* sci_disp */
15 #include "stack-c.h"
16 #include "callFunctionFromGateway.h"
17 /*--------------------------------------------------------------------------*/
18 static gw_generic_table Tab[]=
19 {
20 {C2F(sci_oldload),"oldload"},
21 {C2F(sci_read),"read"},
22 {C2F(sci_getf),"getf"},
23 {C2F(sci_exec),"exec"},
24 {C2F(sci_lib),"lib"},
25 {C2F(sci_diary),"diary"},
26 {C2F(sci_oldsave),"oldsave"},
27 {C2F(sci_write),"write"},
28 {C2F(sci_rat),"rat"},
29 {C2F(sci_deff),"deff"},
30 {C2F(sci_file),"file"},
31 {C2F(sci_host),"host"},
32 {C2F(sci_unix),"unix"},
33 {C2F(sci_readb),"readb"},
34 {C2F(sci_writb),"writb"},
35 {C2F(sci_execstr),"execstr"},
36 {C2F(sci_getpid),"getpid"},
37 {C2F(sci_getenv),"getenv"},
38 {C2F(sci_read4b),"read4b"},
39 {C2F(sci_write4b),"write4b"},
40 {C2F(sci_save),"save"},
41 {C2F(sci_load),"load"},
42 {C2F(sci_mgetl),"mgetl"},
43 {C2F(sci_getio),"getio"},
44 {C2F(sci_setenv),"setenv"},
45 {sci_export_to_hdf5,"export_to_hdf5"}
46 };
47 /*--------------------------------------------------------------------------*/
48 int gw_io(void)
49 {  
50          /* Recursion */
51          if (C2F(recu).rstk[C2F(recu).pt-1] / 100 == 9)
52          {
53                 switch ((int)(C2F(recu).rstk[C2F(recu).pt-1] - 901))
54                 {
55                         case 1: 
56                         {
57                                 C2F(intexec)("exec",(unsigned long)strlen("exec"));
58                                 return 0;
59                         }
60                         case 2: 
61                         {
62                                 C2F(intexecstr)("execstr",(unsigned long)strlen("execstr"));
63                                 return 0;
64                         }
65                         case 3: 
66                         {
67                                 C2F(intgetf)(); 
68                                 return 0;
69                         }
70                         case 4:  
71                         {
72                                 C2F(intsave)(); 
73                                 return 0;
74                         }
75                         case 5:
76                         {
77                                 C2F(sci_load)("load",(unsigned long)strlen("load"));
78                         }
79                         case 6: 
80                         {
81                                 return 0;
82                         }
83                         case 7:
84                         {
85                                 #define disp_fname "disp"
86                                 sci_disp(disp_fname,strlen(disp_fname));
87                                 return 0;
88                         }
89                         case 8: 
90                         {
91                                 C2F(intexec)("exec",(unsigned long)strlen("exec"));
92                                 return 0;
93                         }
94                         default:
95                                 return 0;
96                 }
97         }
98          else
99          {
100                 Rhs = Max(0, Rhs);
101                 callFunctionFromGateway(Tab);
102          }
103         return 0;
104 }
105 /*--------------------------------------------------------------------------*/