This file is indexed.

/usr/include/scilab/mex.h is in scilab-include 5.3.3-10.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
/*
 * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
 * Copyright (C) INRIA 
 * Copyright (C) ENPC
 *
 * This file must be used under the terms of the CeCILL.
 * This source file is licensed as described in the file COPYING, which
 * you should have received as part of this distribution.  The terms
 * are also available at
 * http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt
 *
 */

#ifdef __cplusplus
extern "C" {
#endif

#ifndef SCI_MEX 
#define SCI_MEX 

#ifdef WIN32
	#include <stddef.h> /*for LCC */
#endif

#include "stack-c.h"

typedef int Matrix;
typedef unsigned long int vraiptrst;
#ifndef __DEF_MXARRAY__
#define __DEF_MXARRAY__
typedef int mxArray;
typedef int Gatefunc (int nlhs,mxArray *plhs[],int nrhs,mxArray *prhs[]);
#endif

typedef int (*GatefuncH) (int nlhs,mxArray *plhs[],int nrhs, mxArray *prhs[]);

typedef int (*FGatefuncH) (int *nlhs,mxArray *plhs[],int *nrhs, mxArray *prhs[]);

typedef int (*Myinterfun) (char *, GatefuncH F);

typedef int (*GT) ();

#ifndef __DEF_TABLE_STRUCT__
#define __DEF_TABLE_STRUCT__
  typedef struct table_struct {
    Myinterfun f;    /** interface **/
    GT F;     /** function **/
    char *name;      /** its name **/
  } GenericTable;
#endif
  
#define mxLOGICAL int
#define mxLogical int
  
#define REAL    0
#define COMPLEX 1

#ifndef NULL
#define NULL 0
#endif

#define mxCreateFull mxCreateDoubleMatrix

#ifndef __cplusplus
	#ifndef bool
		#define bool int
	#endif
#endif

  /* mexGetMatrixPtr - mexGetArrayPtr : NOT IN MATLAB API - V6.4 compatible*/
#define mexGetMatrixPtr(name) mexGetArrayPtr(name, "caller")
  
  /* mexGetArray : NOT IN MATLAB API - V6.4 compatible*/
#define mexGetArrayPtr(name,type) mexGetArray(name,type) 
  
  void mexPrintf(const char *fmt,...);
  void C2F(mexprintf)(char *error_msg, int len);
  
  /* mexPutFull: NOT IN MATLAB API - V4 compatible */
  /** Put a matrix in Scilab Workspace */ 
#define mexPutFull(name,m,n,ptrM,tag)					\
  if ( ! C2F(cwritemat)(name,(c_local=m,&c_local),(c1_local=n,&c1_local),ptrM,strlen(name))) { \
      mexErrMsgTxt(_("mexPutFull failed\n"));return; }
  
  /* prototypes */
  
  /* mexInfo: NOT IN MATLAB API - SCILAB SPECIFIC ?*/
  void mexInfo (char *); 

  /* mexCheck: NOT IN MATLAB API - SCILAB SPECIFIC ?*/
  int mexCheck (char *,int ); 

  mxArray *mxCreateCharMatrixFromStrings (int m, const char **str);
  mxArray *mxCreateString (const char *string);
  mxArray *C2F(mxcreatestring)  (char *string, long int l);
  /* mxcreatefull : NOT IN MATLAB API - v4 compatible */
  mxArray *C2F(mxcreatefull)  (int *m, int *n, int *it);
  mxArray *mxCreateCharArray (int ND, const int *size);

  mxArray *mxCreateCellArray (int ND, const int *size);
  mxArray *mxCreateCellMatrix (int m, int n);

  mxArray *mxCreateStructArray (int ndim, const int *dims, int nfields, const char **field_names);
  mxArray *mxCreateStructMatrix (int m, int n, int nfields, const char **field_names);

  mxArray *mxGetCell (const mxArray *ptr, int index);

  double mxGetScalar (const mxArray *ptr);
  double C2F(mxgetscalar)  (mxArray *ptr);
  double *mxGetPi (const mxArray *ptr);
  double * C2F(mxgetpi)  (mxArray *ptr);
  double *mxGetPr (const mxArray *ptr);
  double * C2F(mxgetpr)  (mxArray *ptr);
  double mxGetInf (void);
  double mxGetNaN (void);
  double mxGetEps (void);
  bool mxIsNaN (double x);
  bool mxIsInf (double x);
  bool mxIsFinite (double x);
  int *mxGetDimensions (const mxArray *ptr);
  int mxCalcSingleSubscript (const mxArray *ptr, int nsubs, const int *subs);
  int mxGetNumberOfElements (const mxArray *ptr);
  int mxGetNumberOfDimensions(const mxArray *ptr);
  int mxGetNumberOfFields(const mxArray *ptr);
  void *mxGetData(const mxArray *ptr);
  void *mxGetImagData(const mxArray *ptr);

  void clear_mex(int nlhs, mxArray **plhs, int nrhs, mxArray **prhs);

  extern void errjump ();

  int mxGetM (const mxArray *ptr);
  int  C2F(mxgetm)  (mxArray *ptr);
  int mxGetN (const mxArray *ptr);
  int  C2F(mxgetn)  (mxArray *ptr);
  int mxGetString (const mxArray *ptr, char *str, int strl);
  int  C2F(mxgetstring)  (mxArray *ptr, char *str, int *strl);
  bool mxIsComplex (const mxArray *ptr);
  int  C2F(mxiscomplex)  (mxArray *ptr);
  /* mxisfull : NOT IN MATLAB API - v4 compatible */
  bool mxIsFull (const mxArray *ptr);
  int  C2F(mxisfull)  (mxArray *ptr);
  bool mxIsNumeric (const mxArray *ptr);
  int  C2F(mxisnumeric)  (mxArray *ptr);
  bool mxIsSparse (const mxArray *ptr);
  int  C2F(mxissparse)  (mxArray *ptr);
  /* mxisstring : NOT IN MATLAB API - v6.0 compatible */
  bool mxIsString (const mxArray *ptr);
  int  C2F(mxisstring)  (mxArray *ptr);
  int *mxGetIr (const mxArray *ptr);
  int *mxGetJc (const mxArray *ptr);

  /**
   * TODO : comment
   * @param type
   * @param m
   * @param n
   * @param it
   * @param lr
   * @param ptr
   * @param type_len
   * @return
   */
  int C2F(createptr)  (char *type, int *m, int *n, int *it, int *lr, int *ptr, long int type_len);
  
  /**
   * TODO : comment
   * @param m
   * @param ptr
   * @return
   */
  int C2F(createstkptr)  (int *m, vraiptrst *ptr);
  
  
  /**
   * TODO : comment
   * @param nlhs
   * @param plhs
   * @param nrhs
   * @param prhs
   * @return
   */
  int C2F(endmex)  (int *nlhs, mxArray **plhs, int *nrhs, mxArray **prhs);
  
  
  /**
   * TODO : comment
   * @param nlhs
   * @param plhs
   * @param nrhs
   * @param prhs
   * @return
   */
  int C2F(initmex)  (int *nlhs, mxArray **plhs, int *nrhs, mxArray **prhs);
  
  int C2F(mexcallscilab)  (int *nlhs, mxArray **plhs, int *nrhs, mxArray **prhs, char *name, int namelen);
  int C2F(mxcopyptrtoreal8)  (mxArray *ptr, double *y, int *n);
  int C2F(mxcopyreal8toptr)  (double *y, mxArray *ptr, int *n);
  int fortran_mex_gateway (char *fname, FGatefuncH F);
  int mexAtExit (mxArray *ptr);
  int mexCallSCILAB (int nlhs, mxArray **plhs, int nrhs, mxArray **prhs, const char *name);
  int mexCallMATLAB (int nlhs, mxArray **plhs, int nrhs, mxArray **prhs, const char *name);
  int mex_gateway (char *fname, GatefuncH F);
  int mxGetElementSize (const mxArray *ptr);
  int mxGetNzmax (const mxArray *ptr);
  char *mxArrayToString (const mxArray *array_ptr);
  bool mxIsDouble (const mxArray *ptr);
  bool mxIsSingle (const mxArray *ptr);
  bool mxIsLogical (const mxArray *ptr);
  bool mexIsGlobal(const mxArray *ptr);
  /* mxsetlogical: NOT IN MATLAB API - v6.5 compatible */
  void mxSetLogical (mxArray *ptr);
  /* mxclearlogical: NOT IN MATLAB API - v6.5 compatible */
  void mxClearLogical (mxArray *ptr);
  bool mxIsChar (const mxArray *ptr);
  bool mxIsEmpty (const mxArray *ptr);
  bool mxIsClass (const mxArray *ptr, const char *name);
  bool mxIsCell (const mxArray *ptr);
  bool mxIsStruct (const mxArray *ptr);

  bool mxIsInt8(const mxArray *ptr);
  bool mxIsInt16(const mxArray *ptr);
  bool mxIsInt32(const mxArray *ptr);
  bool mxIsUint8(const mxArray *ptr);
  bool mxIsUint16(const mxArray *ptr);
  bool mxIsUint32(const mxArray *ptr);
  /* mxIsUint64 missing */

  void mxSetM(mxArray *ptr, int m);
  void mxSetN(mxArray *ptr, int n);
  void mxSetJc(mxArray *array_ptr, int *jc_data);
  void mxSetIr(mxArray *array_ptr, int *ir_data);
  void mxSetNzmax(mxArray *array_ptr, int nzmax);
  void mxSetCell(mxArray *pa, int i, mxArray *value);

  /* mexGetArray: NOT IN MATLAB API - v6.5 compatible */
  mxArray *mexGetArray(char *name, char *workspace);
  mxArray *mexGetVariable(const char *workspace, const char *name);
  const mxArray *mexGetVariablePtr(const char *workspace, const char *name);

  unsigned long int C2F(mxcalloc)(unsigned int *n, unsigned int *size);
  void *mxCalloc(size_t n, size_t size);
  void *mxMalloc(size_t nsize);
  void mxFree(void *ptr);
  void mxDestroyArray(mxArray *ptr);

  /* mxCalloc_m : NOT IN MATLAB API - SCILAB SPECIFIC ?*/
  void *mxCalloc_m(unsigned int n, unsigned int size);
  /* mxMalloc_m : NOT IN MATLAB API - SCILAB SPECIFIC ?*/
  void *mxMalloc_m(unsigned int nsize);
  /* mxFree_m : NOT IN MATLAB API - SCILAB SPECIFIC ?*/
  void  mxFree_m(void *);
  /* mxfreematrix: NOT IN MATLAB API - v6.0 compatible */
  void mxFreeMatrix(mxArray *ptr);
  void C2F(mxfreematrix)(mxArray *ptr);

  void mexErrMsgTxt(const char *error_msg);
  void C2F(mexerrmsgtxt)(char *error_msg, int len);
  int  mexEvalString(const char *name);
  void mexWarnMsgTxt(const char *error_msg);
  /* mexprint: NOT IN MATLAB API - SCILAB SPECIFIC ?*/
  void mexprint(char* fmt,...);

  int mxGetFieldNumber(const mxArray *ptr, const char *string);
  mxArray *mxGetField(const mxArray *pa, int i, const char *fieldname);
  void  mxSetFieldByNumber(mxArray *array_ptr, int index, int field_number, mxArray *value);
  void mxSetField (mxArray *pa, int i, const char *fieldname, mxArray *value);

  mxArray *mxGetFieldByNumber(const mxArray *ptr, int index, int field_number);
  const char *mxGetFieldNameByNumber(const mxArray *array_ptr, int field_number);
  mxLOGICAL *mxGetLogicals (const mxArray *array_ptr);

  /**
   * TODO : comment
   * @param x
   * @return
   */
  vraiptrst C2F(locptr)(void *x);
  
  typedef enum {
    mxCELL_CLASS = 1,
    mxSTRUCT_CLASS,
    mxOBJECT_CLASS,
    mxCHAR_CLASS,
    mxSPARSE_CLASS,
    mxDOUBLE_CLASS,
    mxSINGLE_CLASS,
    mxINT8_CLASS,
    mxUINT8_CLASS,
    mxINT16_CLASS,
    mxUINT16_CLASS,
    mxINT32_CLASS,
    mxUINT32_CLASS,
    mxUNKNOWN_CLASS = 0
  } mxClassID;
  
  typedef enum { mxREAL, mxCOMPLEX } mxComplexity; 

  mxClassID mxGetClassID(const mxArray *ptr);
  /* mxGetName: NOT IN MATLAB API - v6.4 compatible */
  const char *mxGetName(const mxArray *array_ptr);
  /* mxSetName: NOT IN MATLAB API - v6.4 compatible */
  void mxSetName( mxArray    *pa,    const char *s );
  void mxSetPr(mxArray *array_ptr, double *pr);
  void mxSetPi(mxArray *array_ptr, double *pi);
  void mxSetData(mxArray *array_ptr, void *pr);
  mxArray *mxCreateNumericArray(int ndim, const int *dims, mxClassID classid, mxComplexity flag);
  mxArray *mxCreateNumericMatrix(int m, int n, mxClassID classid, int cmplx_flag);
  int mxSetDimensions(mxArray *array_ptr, const int *dims, int ndim);
  mxArray *mxCreateDoubleMatrix(int m, int n, mxComplexity it);
  mxArray *mxCreateDoubleScalar(double value);
  mxArray *mxCreateSparse(int m, int n, int nzmax, mxComplexity cmplx);
  mxArray *mxDuplicateArray(const mxArray *ptr);

  /* typedef uint16_T mxChar; */

  /* typedef short int mxChar; */
  typedef unsigned short mxChar;

#define INT8_T   char
#define UINT8_T  unsigned char
#define INT16_T  short
#define UINT16_T unsigned short
#define INT32_T  int
#define UINT32_T unsigned int
#define REAL32_T float

typedef INT8_T   int8_T;
typedef UINT8_T  uint8_T;
typedef INT16_T  int16_T;
typedef UINT16_T uint16_T;
typedef INT32_T  int32_T;
typedef UINT32_T uint32_T;
typedef REAL32_T real32_T;

typedef int       mwSize;
typedef int       mwIndex;
typedef mxArray * mwPointer;

#endif /* SCI_MEX  */

#ifdef __cplusplus
}
#endif

/* generic mexfunction name */
#ifdef __cplusplus
extern "C" {
  void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[]);
}
#endif