tempname function added (it will be used to fix bug 9614)
[scilab.git] / scilab / modules / fileio / sci_gateway / c / gw_fileio.c
1 /*
2  * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
3  * Copyright (C) 2006 - INRIA - Allan CORNET
4  * Copyright (C) 2010 - DIGITEO - Allan CORNET
5  * 
6  * This file must be used under the terms of the CeCILL.
7  * This source file is licensed as described in the file COPYING, which
8  * you should have received as part of this distribution.  The terms
9  * are also available at    
10  * http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt
11  *
12  */
13 /*--------------------------------------------------------------------------*/
14 #include "gw_fileio.h"
15 #include "callFunctionFromGateway.h"
16 #include "MALLOC.h"
17 #include "stack-c.h"
18 /*--------------------------------------------------------------------------*/ 
19 /*  interface function */
20 /*--------------------------------------------------------------------------*/ 
21 static gw_generic_table Tab[]={
22     {sci_mopen, "mopen"},
23     {sci_mputstr, "mputstr"},
24     {sci_mclose, "mclose"},
25     {sci_mput, "mput"},
26     {sci_mget, "mget"},
27     {sci_mgetstr, "mgetstr"},
28     {sci_meof, "meof"},
29     {sci_mseek, "mseek"},
30     {sci_mtell, "mtell"},
31     {sci_mclearerr, "mclearerr"},
32     {sci_mfprintf,"mfprintf"},
33     {sci_scanf,"mscanf"},
34     {sci_fscanf,"mfscanf"},
35     {sci_sscanf,"msscanf"},
36     {sci_fscanfMat,"fscanfMat"},
37     {sci_fprintfMat,"fprintfMat"},
38     {sci_merror, "merror"},
39     {sci_findfiles,"findfiles"},
40     {sci_maxfiles,"maxfiles"},
41     {sci_getdrives,"getdrives"},
42     {sci_fullpath,"fullpath"},
43     {sci_deletefile,"deletefile"},
44     {sci_pathsep,"pathsep"},
45     {sci_filesep,"filesep"},
46     {sci_getlongpathname,"getlongpathname"},
47     {sci_getshortpathname,"getshortpathname"},
48     {sci_fileext,"fileext"},
49     {sci_isdir,"isdir"},
50     {sci_removedir,"removedir"},
51     {sci_createdir,"createdir"},
52     {sci_pwd,"pwd"},
53     {sci_chdir,"chdir"},
54     {sci_fileinfo,"fileinfo"},
55     {sci_newest,"newest"},
56     {sci_getrelativefilename,"getrelativefilename"},
57     {sci_get_absolute_file_path,"get_absolute_file_path"},
58     {sci_copyfile,"copyfile"},
59     {sci_isfile,"isfile"},
60     {sci_fileparts,"fileparts"},
61     {sci_movefile,"movefile"},
62     {sci_basename,"basename"},
63     {sci_pathconvert,"pathconvert"},
64     {sci_chdir,"cd"},
65     {sci_mgetl,"mgetl"},
66     {sci_mputl,"mputl"},
67     {sci_tempname,"tempname"}
68 };
69 /*--------------------------------------------------------------------------*/ 
70 int gw_fileio(void)
71 {
72     Rhs = Max(0,Rhs);
73
74     if(pvApiCtx == NULL)
75     {
76         pvApiCtx = (StrCtx*)MALLOC(sizeof(StrCtx));
77     }
78
79     pvApiCtx->pstName = (char*)Tab[Fin-1].name;
80     callFunctionFromGateway(Tab, SIZE_CURRENT_GENERIC_TABLE(Tab));
81     return 0;
82 }
83 /*--------------------------------------------------------------------------*/ 
84