1 /*
2  * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
3  * Copyright (C) 2007 - INRIA - Allan CORNET
4  *
5  * Copyright (C) 2012 - 2016 - Scilab Enterprises
6  *
7  * This file is hereby licensed under the terms of the GNU GPL v2.0,
8  * pursuant to article 5.3.4 of the CeCILL v.2.1.
9  * This file was originally licensed under the terms of the CeCILL v2.1,
10  * and continues to be available under such terms.
11  * For more information, see the COPYING file which you should have received
12  * along with this program.
13  *
14  */
15 /* Completion.i */
16 /**
17  * Windows: swig -java -package org.scilab.modules.completion -outdir ../java/org/scilab/modules/completion/ Completion.i
18  * Other: Use the option --enable-build-swig to the configure
19 */
20 %module Completion
21 
22 %{
23 #include "../c/completion_wrap_java.h"
24 #include "../c/completeLine_wrap_java.h"
25 #include "getCommonPart.h"
26 #include "getPartLine.h"
27 #include "sci_malloc.h"
28 %}
29 
30 %include "../../../jvm/src/jni/scilab_typemaps.i"
31 
32 /* JavaDoc for CompletioJNI class */
33 %pragma(java) jniclassclassmodifiers=%{
34 /* It is generated code. Disable checkstyle */
35 //CHECKSTYLE:OFF
36  /**
37    * @author Allan CORNET
38    * @copyright INRIA 2007
39    */
40 public class%}
41 
42 /* Constructor for CompletionJNI class */
43 %pragma(java) jniclasscode="
44   /**
45     * Constructor
46     */
47   protected CompletionJNI() {
48     throw new UnsupportedOperationException();
49   }";
50 
51 /* static load of library */
52 %pragma(java) jniclasscode=%{
53   static {
54     try {
55         System.loadLibrary("scicompletion");
catch(SecurityException e)56     } catch (SecurityException e) {
57         System.err.println("A security manager exists and does not allow the loading of the specified dynamic library.");
58         System.err.println(e.getLocalizedMessage());
59         e.printStackTrace(System.err);
60     } catch (UnsatisfiedLinkError e)    {
61         System.err.println("The native library scicompletion does not exist or cannot be found.");
62         System.err.println(e.getLocalizedMessage());
63         e.printStackTrace(System.err);
64     }
65   }
66 %}
67 
68 /* JavaDoc for Completion class */
69 %pragma(java) moduleclassmodifiers="
70  /**
71    * @author Allan CORNET
72    * @copyright INRIA 2007
73    */
74 public class";
75 
76 /* Constructor for Completion class */
77 %pragma(java) modulecode="
78  /**
79    * Constructor
80    */
81  protected Completion() {
82     throw new UnsupportedOperationException();
83  }";
84 
85 /* JavaDoc */
86 %javamethodmodifiers searchAllDictionaries(char *somechars) "
87 /**
88 * completion function on all types for scilab
89 * @param[in] somechars first characters of a word
90 * @return an array of chars
91 */
92 public";
93 char **searchAllDictionaries(char *somechars);
94 
95 /* JavaDoc */
96 %javamethodmodifiers searchFunctionsDictionary(char *somechars) "
97 /**
98 * completion function on Functions for scilab
99 * @param[in] somechars first characters of a word
100 * @return an array of chars
101 */
102 public";
103 char **searchFunctionsDictionary(char *somechars);
104 
105 /* JavaDoc */
106 %javamethodmodifiers searchCommandsDictionary(char *somechars) "
107 /**
108 * completion function on command words for scilab
109 * @param[in] somechars first characters of a word
110 * @return an array of chars
111 */
112 public";
113 char **searchCommandsDictionary(char *somechars);
114 
115 /* JavaDoc */
116 %javamethodmodifiers searchMacrosDictionary(char *somechars) "
117 /**
118 * completion function on Macros in libraries for scilab
119 * @param[in] somechars first characters of a word
120 * @return an array of chars
121 */
122 public";
123 char **searchMacrosDictionary(char *somechars);
124 
125 /* JavaDoc */
126 %javamethodmodifiers searchVariablesDictionary(char *somechars) "
127 /**
128 * completion function on Variables for scilab
129 * @param[in] somechars first characters of a word
130 * @return an array of chars
131 */
132 public";
133 char **searchVariablesDictionary(char *somechars);
134 
135 /* JavaDoc */
136 %javamethodmodifiers searchFilesDictionary(char *somechars) "
137 /**
138 * completion function on files for scilab
139 * @param[in] somechars first characters of a word
140 * @return an array of chars
141 */
142 public";
143 char **searchFilesDictionary(char *somechars);
144 
145 /* JavaDoc */
146 %javamethodmodifiers searchFieldsDictionary(char *lineBeforeCaret, char *pattern) "
147 /**
148 * completion function on files for scilab
149 * @param[in] the line before the caret
150 * @param[in] the part
151 * @return an array of chars
152 */
153 public";
154 char **searchFieldsDictionary(char *lineBeforeCaret, char *pattern);
155 
156 /* JavaDoc */
157 %javamethodmodifiers searchHandleGraphicsPropertiesDictionary(char *somechars) "
158 /**
159 * completion handle graphics properties for scilab
160 * @param[in] somechars first characters of a word
161 * @return an array of chars
162 */
163 public";
164 char **searchHandleGraphicsPropertiesDictionary(char *somechars);
165 
166 /* JavaDoc */
167 %javamethodmodifiers getPartLevel(char *line) "
168 /**
169 * pre parsing current line to search with completion
170 * @param[in] current line
171 * @return word to find with completion
172 */
173 public";
174 char *getPartLevel(char *line);
175 
176 /* JavaDoc */
177 %javamethodmodifiers getFilePartLevel(char *line) "
178 /**
179 * pre parsing current line to search with completion (file)
180 * @param[in] current line
181 * @return word to find with completion
182 */
183 public";
184 char *getFilePartLevel(char *line);
185 
186 /* JavaDoc */
187 %javamethodmodifiers getCommonPart(char **dictionary, int sizeDictionary) "
188 /**
189 * Get common part to a array
190 * @param[in] string array
191 * @param[in] size of string array
192 * @return common part
193 */
194 public";
195 char *getCommonPart(char **dictionary, int sizeDictionary);
196 
197 /* JavaDoc */
198 %javamethodmodifiers completelineforjava(char *currentLine, char *stringToAdd, BOOL isFile, char *postCaretLine) "
199 /**
200 * complete line
201 * @param[in] current line (before caret)
202 * @param[in] line to add
203 * @param[in] type of line to add
204 * @param[in] line after caret
205 * @return modified line
206 */
207 public";
208 char *completelineforjava(char *currentLine,char *stringToAdd,BOOL isFile, char *postCaretLine);
209