Repository navigation
Expand file tree
/
Copy pathcommon.c
More file actions
335 lines (204 loc) · 7.74 KB
/
Copy pathcommon.c
File metadata and controls
335 lines (204 loc) · 7.74 KB
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
#include "Windows.h"
#include <utility.h>
#include <userint.h>
#include <ansi_c.h>
#include <common.h>
#include "GlobalDefines.h"
#include "toolbox.h"
//==============================================================================
//==============================================================================
// DLL main entry-point functions
#ifndef _CVI_EXE_
int __stdcall DllMain (HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
{
switch (fdwReason) {
case DLL_PROCESS_ATTACH:
if (InitCVIRTE (hinstDLL, 0, 0) == 0)
return 0; /* out of memory */
break;
case DLL_PROCESS_DETACH:
break;
}
return 1;
}
int __stdcall DllEntryPoint (HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
{
/* Included for compatibility with Borland */
return DllMain (hinstDLL, fdwReason, lpvReserved);
}
#endif
TSTE_TEST ( STD_EMPTY_TEST ) { return 0; }
TSTE_TEST ( STD_DELAY_TEST )
{
STD_ERROR StdError = {0};
int iTestError = 0;
double lfDB_Delay = 0.0;
LOG(CLB_LINE_HEADER_TEST, "Delay.");
lfDB_Delay = GetVarDouble( clb, VARTYPE_TEST , "Delay" );
WAIT("",lfDB_Delay);
CATCH
UPDATE_ERROR(StdError);
if ( StdError.pszErrorDescription )
{
LOG_END(CLB_LINE_WARNING, (char*)StdError.pszErrorDescription );
}
iTestError = -1;
FINALLY
LOG_END(CLB_LINE_NORMAL, "Finalizing Test." );
return iTestError;
}
//==============================================================================
//==============================================================================
int GetVarInt( sClb* clb, int vartype, char *name , ... )
{
va_list arguments = {0};
int iValue = 0;
va_start( arguments , name );
iValue = clb->GetVarInt( clb->handle , vartype, name , arguments );
va_end( arguments );
return iValue;
}
int GetVarIntArray( sClb* clb, int vartype, char *name,int** result , ... )
{
va_list arguments = {0};
int iValue = 0;
va_start( arguments , result );
iValue = clb->GetVarIntArray( clb->handle, vartype, name, result , arguments );
va_end( arguments );
return iValue;
}
double GetVarDouble( sClb* clb, int vartype, char *name , ... )
{
va_list arguments = {0};
double lfValue = 0;
va_start( arguments , name );
lfValue = clb->GetVarDouble( clb->handle, vartype, name , arguments );
va_end( arguments );
return lfValue;
}
int GetVarDoubleArray( sClb* clb, int vartype, char *name,double** result , ... )
{
va_list arguments = {0};
int iValue = 0;
va_start( arguments , result );
iValue = clb->GetVarDoubleArray( clb->handle, vartype, name, result , arguments );
va_end( arguments );
return iValue;
}
char* GetVarString( sClb* clb, int vartype, char *name , ... )
{
va_list arguments = {0};
char *pValue = NULL;
va_start( arguments , name );
pValue = clb->GetVarString( clb->handle, vartype, name , arguments );
va_end( arguments );
return pValue;
}
char** GetVarStringArray( sClb* clb, int vartype, char *name , int *pNumberOfItems , ... )
{
va_list arguments = {0};
char **pValue = NULL;
va_start( arguments , pNumberOfItems );
pValue = clb->GetVarStringArray( clb->handle , vartype, name , pNumberOfItems , arguments );
va_end( arguments );
return pValue;
}
int SetVarString( sClb* clb, int vartype, char *name , char *string , ... )
{
va_list arguments = {0};
int iValue = 0;
va_start( arguments , string );
iValue = clb->SetVarString( clb->handle, vartype, name , string , arguments );
va_end( arguments );
return iValue;
}
int SetVarStringArray( sClb* clb, int vartype, char *name , char **string , int iNumberOfItems , ... )
{
va_list arguments = {0};
int iValue = 0;
va_start( arguments , iNumberOfItems );
iValue = clb->SetVarStringArray( clb->handle, vartype, name , string , iNumberOfItems , arguments );
va_end( arguments );
return iValue;
}
int SetVarInt( sClb* clb, int vartype, char *name, int value , ... )
{
va_list arguments = {0};
int iValue = 0;
va_start( arguments , value );
iValue = clb->SetVarInt( clb->handle , vartype, name, value , arguments );
va_end( arguments );
return iValue;
}
int SetVarIntArray( sClb* clb, int vartype, char *name, int *pArrayValues , int Count , ... )
{
va_list arguments = {0};
int iValue = 0;
va_start( arguments , Count );
iValue = clb->SetVarIntArray( clb->handle, vartype, name, pArrayValues , Count , arguments );
va_end( arguments );
return iValue;
}
int SetVarDouble( sClb* clb , int vartype, char *name , double value , ... )
{
va_list arguments = {0};
int iValue = 0;
va_start( arguments , value );
iValue = clb->SetVarDouble( clb->handle , vartype, name , value , arguments );
va_end( arguments );
return iValue;
}
int SetVarDoubleArray( sClb* clb, int vartype, char *name, double *pArrayValues , int Count , ... )
{
va_list arguments = {0};
int iValue = 0;
va_start( arguments , Count );
iValue = clb->SetVarDoubleArray( clb->handle , vartype, name, pArrayValues , Count , arguments );
va_end( arguments );
return iValue;
}
int SetVarCalibration( sClb* clb, int vartype, int iRange , int bCleanBefore , char *name , double *frequency , double *factor , int iNumOfPoints , ... )
{
va_list arguments = {0};
int iValue = 0;
va_start( arguments , iNumOfPoints );
iValue = clb->SetVarCalibration( clb->handle , vartype, iRange , bCleanBefore , name , frequency , factor , iNumOfPoints , arguments );
va_end( arguments );
return iValue;
}
int GetVarCalibration( sClb* clb, int vartype, int iRange , char *name , double **frequency , double **factor , int *piNumOfPoints , double *plfCalibrationDate , ... )
{
va_list arguments = {0};
int iValue = 0;
va_start( arguments , plfCalibrationDate );
iValue = clb->GetVarCalibration( clb->handle , vartype, iRange , name , frequency , factor , piNumOfPoints , plfCalibrationDate , arguments );
va_end( arguments );
return iValue;
}
int SetVarCurrentCalibration( sClb* clb, int iRange , int bCleanBefore , double *frequency , double *factor , int iNumOfPoints , ... )
{
va_list arguments = {0};
int iValue = 0;
va_start( arguments , iNumOfPoints );
iValue = clb->SetVarCurrentCalibration( clb->handle, iRange , bCleanBefore , frequency , factor , iNumOfPoints , arguments );
va_end( arguments );
return iValue;
}
int GetVarCurrentCalibration( sClb* clb, int iRange , double **frequency , double **factor , int *piNumOfPoints , double *plfCalibrationDate , ... )
{
va_list arguments = {0};
int iValue = 0;
va_start( arguments , plfCalibrationDate );
iValue = clb->GetVarCurrentCalibration( clb->handle , iRange , frequency , factor , piNumOfPoints , plfCalibrationDate , arguments );
va_end( arguments );
return iValue;
}
int GetVarCalibrationByName( sClb* clb, char *pszName , int iRange , double **frequency , double **factor , int *piNumOfPoints , double *plfCalibrationDate , ... )
{
va_list arguments = {0};
int iValue = 0;
va_start( arguments , plfCalibrationDate );
iValue = clb->GetVarCalibrationByName( clb->handle , pszName , iRange , frequency , factor , piNumOfPoints , plfCalibrationDate , arguments );
va_end( arguments );
return iValue;
}