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
|
/*
* Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
* Copyright (C) 2006 - INRIA - Jean-Baptiste Silvy
*
* 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.1-en.txt
*
*/
/*------------------------------------------------------------------------*/
/* file: getPropertyAssignedValue.h */
/* desc : a set of functions used to get the values which will be */
/* assigned to handles properties from the stack */
/*------------------------------------------------------------------------*/
#ifndef _GET_PROPERTY_ASSIGNEMENT_VALUE_H_
#define _GET_PROPERTY_ASSIGNEMENT_VALUE_H_
#include <stdlib.h> /* for size_t */
#include "dynlib_graphics.h"
#include "sci_types.h"
#include "stack-c.h"
#include "BOOL.h"
/*------------------------------------------------------------------------------*/
/* Basic type parameters */
/**
* copy a double vector from the scilab stack to an int array
* with int cast for each parameter.
*/
GRAPHICS_IMPEXP void copyDoubleVectorToIntFromStack(void* _pvData, int dest[], int nbElement);
/**
* create a copy of a stringMatrix which is in the stack
*/
GRAPHICS_IMPEXP char ** createCopyStringMatrixFromStack(void* _pvData, int nbElement);
/**
* @return TRUE if the given parameter is 'on', %T, 'T', 1, ...
* FALSE if the given parameter is 'off', %F, 'F', 0, ...
* NOT_A_BOOLEAN_VALUE otherwise
*/
GRAPHICS_IMPEXP int tryGetBooleanValueFromStack(void* _pvData, int valueType, int nbRow, int nbCol, char* propertyName);
// with that we are sure to be nether equal to TRUE nor FALSE
#define NOT_A_BOOLEAN_VALUE (2*FALSE) - TRUE
/*------------------------------------------------------------------------------*/
/* Tlist */
typedef struct
{
int iNbItem; /**< number of elements in the tlist */
int iCurItem; /**< currently read element */
int iRhs; /**< rank of the tlist within the Rhs parameters */
int* piList ; /**< pointer of the tlist in the stack */
} AssignedList;
/**
* get the number of element of a tlist stored in the rhs
* @param paramNum rank of the list within the Rhs parameters
*/
GRAPHICS_IMPEXP int getStackListNbElement(void* _pvCtx, int _iRhs);
/**
* create a new instance of an object used to retrieve fields of a tlist
* stored on the stack
* @param paramNum rank of the list within the Rhs parameters
* @param nbElement number of element in the list
*/
GRAPHICS_IMPEXP AssignedList * createAssignedList(void* _pvCtx, int _iRhs, int _iNbItem);
/**
* destroy the object used to glance through a tlist
*/
GRAPHICS_IMPEXP void destroyAssignedList(AssignedList * list);
/**
* return the number of element of a tlist
*/
GRAPHICS_IMPEXP int getAssignedListNbElement(AssignedList * list);
/**
* set the current element to the first
*/
GRAPHICS_IMPEXP void rewindAssignedList(AssignedList * list);
/**
* Return whether the current element of the list is a double matrix or not.
*/
GRAPHICS_IMPEXP BOOL isListCurrentElementDoubleMatrix(void* _pvCtx, AssignedList* _pList);
/**
* Return whether the current element of the list is a string matrix or not.
*/
GRAPHICS_IMPEXP BOOL isListCurrentElementStringMatrix(void* _pvCtx, AssignedList* _pList);
/**
* Return whether the current element of the list is an empty matrix or not.
*/
GRAPHICS_IMPEXP BOOL isListCurrentElementEmptyMatrix(void* _pvCtx, AssignedList* _pList);
/**
* retrieve a field of a tlist
* @param[in] list object used to retrieve elements
* @param rank position of the element in the list (first, second, ...)
* Note that is it not possible to get the properties names with this function
* @param[out] nbRow number of row of the returned matrix
* @param[out] nbCol number of column of the returned matrix
*/
GRAPHICS_IMPEXP double* getDoubleMatrixFromList(void* _pvCtx, AssignedList* _pList, int _iItem, int* _piRows, int* _piCols);
/**
* retrieve a field of a tlist
* @param[in] list object used to retrieve elements
* @param rank position of the element in the list (first, second, ...)
* Note that is it not possible to get the properties names with this function
* @param[out] nbRow number of row of the returned matrix
* @param[out] nbCol number of column of the returned matrix
*/
GRAPHICS_IMPEXP char ** getStringMatrixFromList(void* _pvCtx, AssignedList* _pList, int _iItem, int* _piRows, int* _piCols);
/**
* retrieve the current property of a tlist and move to the next
* @param[in/out] list object used to retrieve elements
* @param[out] nbRow number of row of the returned matrix
* @param[out] nbCol number of column of the returned matrix
*/
GRAPHICS_IMPEXP double* getCurrentDoubleMatrixFromList(void* _pvCtx, AssignedList* _pList, int* _piRows, int* _piCols);
/**
* retrieve the current property of a tlist and move to the next
* @param[in/out] list object used to retrieve elements
* @param[out] nbRow number of row of the returned matrix
* @param[out] nbCol number of column of the returned matrix
*/
GRAPHICS_IMPEXP char ** getCurrentStringMatrixFromList(void* _pvCtx, AssignedList* _pList, int* _piRows, int* _piCols);
/**
* create a copy of the current matrix in the tlist
* @param[in/out] list object used to retrieve elements
* @param[out] nbRow number of row of the returned matrix or -1 if an error occurred
* @param[out] nbCol number of column of the returned matrix or -1 if an error occurred
* @return the created array or NULL if the matrix is empty or an error occurred
*/
GRAPHICS_IMPEXP double* createCopyDoubleMatrixFromList(void* _pvCtx, AssignedList* _pList, int* _piRows, int* _piCols);
/*------------------------------------------------------------------------------*/
#endif /* _GET_PROPERTY_ASSIGNEMENT_VALUE_H_ */
|