@@ -40,7 +40,7 @@ import core.stdc.wchar_ : wcslen;
40
40
import core.stdc.wctype :towlower;
41
41
import std.format ;
42
42
43
-
43
+ /+
44
44
45
45
/**
46
46
Syntax of the Register Command:
@@ -124,7 +124,7 @@ struct xllCategory(string _name)
124
124
xllFunctionHelp!"returns the hash of arguments",xllArgumentHelp!"number 1,2..29 are 1 to 29 arguments to process",
125
125
xllThreadSafe!false,xllMacro!false, xllAllowAbort!false,xllVolatile!false,xllDisableFunctionWizard!false,
126
126
xlldisableReplaceCalc!false)
127
-
127
+ +/
128
128
129
129
/**
130
130
To do:
@@ -145,6 +145,7 @@ struct ExcelResult(T)
145
145
enum ExcelReturnStatus
146
146
{
147
147
success,
148
+ missing,
148
149
wrongType,
149
150
wrongShape,
150
151
excelError,
@@ -159,23 +160,23 @@ if (is(T==Variant[][]) || (is(T==double[][])) || is(T==double[]))
159
160
ExcelResult! T ret;
160
161
long i; // Row and column counters for arrays
161
162
LPXLOPER12 px; // Pointer into array
162
- ret.suucess =true ;
163
+ ret.success =true ;
163
164
ret.status=ExcelReturnStatus.success;
164
165
165
166
switch (pxArg.xltype)
166
167
{
167
168
case xltypeMissing:
168
- break ;
169
+ return ExcelResult ( false ,ExcelReturnStatus.missing) ;
169
170
170
171
case xltypeNum:
171
- static if is (T== double [])
172
- ret= [pxArg.val.num];
172
+ static if ( is (T== double []) )
173
+ return ExcelResult ( true ,ExcelReturnStatus.success, [pxArg.val.num]) ;
173
174
else
174
- ret= [[pxArg.val.num]];
175
+ return ExcelResult ( true ,ExcelReturnStatus.success, [[pxArg.val.num]]) ;
175
176
break ;
176
177
177
178
case xltypeStr:
178
- static if (is (T== (double []))
179
+ static if (is (T== (double [])))
179
180
return ExcelDoubleResultVector (false ,ExcelReturnStatus.wrongType,[double .nan]);
180
181
else static if (is (T== double [][]))
181
182
return ExcelDoubleResultMatrix (false ,ExcelReturnStatus.wrongType,[[double .nan]]);
@@ -244,13 +245,17 @@ if (is(T==Variant[][]) || (is(T==double[][])) || is(T==double[]))
244
245
// if an error store in error //
245
246
case xltypeErr::
246
247
status=ExcelReturnStatus.excelError;
247
- if (is (T== Variant [][])|| is (T== double [][])
248
+ static if ((is (T== Variant [][]))|| (is (T== double [][])))
249
+ {
248
250
ret[i][j]=px.val.err;
251
+ }
249
252
else // double[]
253
+ {
250
254
if (! flipped)
251
255
ret[i]=px.val.err;
252
256
else
253
257
ret[j]=px.val.err;
258
+ }
254
259
break ;
255
260
256
261
case xltypeNil:
@@ -295,6 +300,14 @@ if (is(T==Variant[][]) || (is(T==double[][])) || is(T==double[]))
295
300
}
296
301
297
302
303
+ LPXLOPER12 makeXLOPER12 (double arg)
304
+ {
305
+ LPXLOPER12 lpx;
306
+ lpx=cast (LPXLOPER12 ) excelCallPool.allocate(XLOPER12 .sizeof);
307
+ lpx.xltype=xltypeNum;
308
+ lpx.val.num=arg;
309
+ return lpx;
310
+ }
298
311
// need to have allocator!
299
312
LPXLOPER12 makeXLOPER12 (Flag! " autoFree" autoFree=Flag.autoFree.No)(string arg)
300
313
{
@@ -322,7 +335,7 @@ LPXLOPER12 makeXLOPER12(Flag!"autoFree" autoFree=Flag.autoFree.No)(Variant[][] a
322
335
}
323
336
auto numCols=arg[0 ].length;
324
337
foreach (row;arg[1 .. $])
325
- enforce(row.length== numCols, new Exception (" makeXLOPER12: arg must be rectangular" );
338
+ enforce(row.length== numCols, new Exception (" makeXLOPER12: arg must be rectangular" )) ;
326
339
327
340
auto xlValuesLength=numRows* numCols;
328
341
XLOPER12 * ret=allocXLOPER12! autoFree(1 );
@@ -542,10 +555,10 @@ string makeMultiArgWrap(string wrapperName, int numArgs)
542
555
" ;
543
556
return ret;
544
557
}
545
-
558
+ /+
546
559
mixin!makeMultiArgWrap("multiArgWrap30",30);
547
560
multiArgWrap30(&simpleMulti);
548
-
561
+ +/
549
562
LPXLOPER12 simpleMulti (LPXLOPER12 [] args)
550
563
{
551
564
Variant [][][] niceArgs;
0 commit comments