utf: module scinotes
[scilab.git] / scilab / modules / scinotes / src / cpp / callscinotes.cpp
1 /*
2  * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
3  * Copyright (C) 2009 - DIGITEO - 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.1-en.txt
10  *
11  */
12
13 #include "SciNotes.hxx"
14
15 extern "C"
16 {
17 #include "callscinotes.h"
18 #include "charEncoding.h"
19 #include "getScilabJavaVM.h"
20 #include "charEncoding.h"
21 #include "sci_malloc.h"
22 #include "freeArrayOfString.h"
23 #include "getFullFilename.h"
24 }
25 /*--------------------------------------------------------------------------*/
26 using namespace org_scilab_modules_scinotes;
27 /*--------------------------------------------------------------------------*/
28 int callSciNotesW(char** _filenames, int _nbfiles)
29 {
30     if ( (_filenames) && (_nbfiles > 0) )
31     {
32         int i = 0;
33         for (i = 0; i < _nbfiles; i++)
34         {
35             if (_filenames[i])
36             {
37                 char *cFullFilename = getFullFilename(_filenames[i]);
38                 if (cFullFilename)
39                 {
40                     SciNotes::scinotes(getScilabJavaVM(), cFullFilename);
41                     FREE(cFullFilename);
42                     cFullFilename = NULL;
43                 }
44             }
45         }
46     }
47     else
48     {
49         SciNotes::scinotes(getScilabJavaVM());
50     }
51     return 0;
52 }
53
54 int callSciNotesWWithLineNumberAndFunction(char** _filenames, double* pdblLineNumber, char *functionName, int _nbfiles)
55 {
56     if ( (_filenames) && (_nbfiles > 0) )
57     {
58         int i = 0;
59         for (i = 0; i < _nbfiles; i++)
60         {
61             if (_filenames[i])
62             {
63                 char *cFullFilename = getFullFilename(_filenames[i]);
64                 if (cFullFilename)
65                 {
66                     SciNotes::scinotes(getScilabJavaVM(), cFullFilename, (int)pdblLineNumber[i], functionName);
67                     FREE(cFullFilename);
68                     cFullFilename = NULL;
69                 }
70             }
71         }
72     }
73     else
74     {
75         SciNotes::scinotes(getScilabJavaVM());
76     }
77     return 0;
78 }
79
80 int callSciNotesWWithOption(char** _filenames, char** option, int _nboptions, int _nbfiles)
81 {
82     if ( (_filenames) && (_nbfiles > 0) )
83     {
84         int i = 0;
85         for (i = 0; i < _nbfiles; i++)
86         {
87             if (_filenames[i])
88             {
89                 char *cFullFilename = getFullFilename(_filenames[i]);
90                 if (cFullFilename)
91                 {
92                     SciNotes::scinotes(getScilabJavaVM(), cFullFilename, option, _nboptions);
93                     FREE(cFullFilename);
94                     cFullFilename = NULL;
95                 }
96             }
97         }
98     }
99     else
100     {
101         SciNotes::scinotes(getScilabJavaVM());
102     }
103     return 0;
104 }
105 /*--------------------------------------------------------------------------*/