@@ -43,6 +43,9 @@ static int g_functionCount = 0;
43
43
// The mapping of function index to server index
44
44
static int g_functionServer[MAX_FUNCTIONS];
45
45
46
+ // The maximum number of arguments we allow in a function call
47
+ #define MAX_ARGUMENTS 30
48
+
46
49
// Our standard error message
47
50
static XLOPER g_errorMessage;
48
51
@@ -196,18 +199,18 @@ void RegisterFunctions(LPXLOPER xDLL, int index)
196
199
argHelp[argHelpCount++] = " " ;
197
200
}
198
201
int size = 10 + argHelpCount;
199
- static LPXLOPER input[20 ];
202
+ static LPXLOPER input[10 + MAX_ARGUMENTS ];
200
203
input[0 ] = (LPXLOPER FAR) xDLL;
201
204
input[1 ] = (LPXLOPER FAR) XLUtil::MakeExcelString2 (tmp);
202
- input[2 ] = (LPXLOPER FAR) XLUtil::MakeExcelString2 (isVolatile ? " RPPPPPPPPPPPPPPPPPPPP !" : " RPPPPPPPPPPPPPPPPPPPP " );
205
+ input[2 ] = (LPXLOPER FAR) XLUtil::MakeExcelString2 (isVolatile ? " RPPPPPPPPPPPPPPPPPPPPPPPPPPPPPP !" : " RPPPPPPPPPPPPPPPPPPPPPPPPPPPPPP " );
203
206
input[3 ] = (LPXLOPER FAR) XLUtil::MakeExcelString3 (functionText == NULL ? functionName : functionText);
204
207
input[4 ] = (LPXLOPER FAR) XLUtil::MakeExcelString3 (argumentText);
205
208
input[5 ] = (LPXLOPER FAR) XLUtil::MakeExcelString2 (" 1" );
206
209
input[6 ] = (LPXLOPER FAR) XLUtil::MakeExcelString3 (category);
207
210
input[7 ] = (LPXLOPER FAR) XLUtil::MakeExcelString3 (shortcutText);
208
211
input[8 ] = (LPXLOPER FAR) XLUtil::MakeExcelString3 (helpTopic);
209
212
input[9 ] = (LPXLOPER FAR) XLUtil::MakeExcelString3 (functionHelp);
210
- for (int j = 0 ; j < argHelpCount && j < 20 ; j++) {
213
+ for (int j = 0 ; j < argHelpCount && j < MAX_ARGUMENTS ; j++) {
211
214
input[10 + j] = (LPXLOPER FAR) XLUtil::MakeExcelString3 (argHelp[j]);
212
215
}
213
216
int res = Excel4v (xlfRegister, 0 , size, (LPXLOPER FAR*) input);
@@ -228,7 +231,7 @@ void RegisterFunctions(LPXLOPER xDLL, int index)
228
231
Log::Debug (" Registered function (%d) %s" , g_functionCount, tmp);
229
232
}
230
233
}
231
- }
234
+ }
232
235
}
233
236
234
237
XLUtil::FreeContents (farr);
@@ -252,15 +255,15 @@ void RegisterServer(LPXLOPER xDLL, int index)
252
255
if (includeGeneric) {
253
256
char fsExecuteFn[MAX_PATH];
254
257
sprintf (fsExecuteFn, " FSExecute%d" , index );
255
- XLUtil::RegisterFunction (xDLL, fsExecuteFn, " RCPPPPPPPPPPPPPPPPPPPP " ,
258
+ XLUtil::RegisterFunction (xDLL, fsExecuteFn, " RCPPPPPPPPPPPPPPPPPPPPPPPPPPPPPP " ,
256
259
function, NULL , " 1" , category, NULL , NULL , NULL , NULL );
257
260
}
258
261
259
262
// Register execute function - volatile version (if requested)
260
263
if (includeVolatile) {
261
264
char fsExecuteVolFn[MAX_PATH];
262
265
sprintf (fsExecuteVolFn, " FSExecuteVolatile%d" , index );
263
- XLUtil::RegisterFunction (xDLL, fsExecuteVolFn, " RCPPPPPPPPPPPPPPPPPPPP !" ,
266
+ XLUtil::RegisterFunction (xDLL, fsExecuteVolFn, " RCPPPPPPPPPPPPPPPPPPPPPPPPPPPPPP !" ,
264
267
volatileFunction, NULL , " 1" , category, NULL , NULL , NULL , NULL );
265
268
}
266
269
@@ -296,8 +299,8 @@ void ParseProviders(char* providers)
296
299
}
297
300
298
301
#ifdef __cplusplus
299
- extern " C" {
300
- #endif
302
+ extern " C" {
303
+ #endif
301
304
302
305
__declspec (dllexport) int WINAPI xlAutoOpen(void )
303
306
{
@@ -352,7 +355,7 @@ __declspec(dllexport) LPXLOPER WINAPI xlAutoRegister(LPXLOPER pxName)
352
355
static XLOPER xDLL, xRegId;
353
356
xRegId.xltype = xltypeErr;
354
357
xRegId.val .err = xlerrValue;
355
-
358
+
356
359
return (LPXLOPER) &xRegId;
357
360
}
358
361
@@ -402,23 +405,25 @@ __declspec(dllexport) LPXLOPER WINAPI xlAddInManagerInfo(LPXLOPER xAction)
402
405
}
403
406
x->val .str = addinName;
404
407
return x;
405
- }
408
+ }
406
409
407
410
return (LPXLOPER) &xInfo;
408
411
}
409
412
410
- LPXLOPER WINAPI FSExecute (int index, const char * name, LPXLOPER v0, LPXLOPER v1, LPXLOPER v2, LPXLOPER v3, LPXLOPER v4,
413
+ LPXLOPER WINAPI FSExecute (int index, const char * name, LPXLOPER v0, LPXLOPER v1, LPXLOPER v2, LPXLOPER v3, LPXLOPER v4,
411
414
LPXLOPER v5, LPXLOPER v6, LPXLOPER v7, LPXLOPER v8, LPXLOPER v9, LPXLOPER v10,
412
415
LPXLOPER v11, LPXLOPER v12, LPXLOPER v13, LPXLOPER v14, LPXLOPER v15, LPXLOPER v16,
413
- LPXLOPER v17, LPXLOPER v18, LPXLOPER v19)
416
+ LPXLOPER v17, LPXLOPER v18, LPXLOPER v19, LPXLOPER v20, LPXLOPER v21, LPXLOPER v22,
417
+ LPXLOPER v23, LPXLOPER v24, LPXLOPER v25, LPXLOPER v26, LPXLOPER v27, LPXLOPER v28,
418
+ LPXLOPER v29)
414
419
{
415
420
// Attempt connection
416
421
if (!InitProtocol (index )) {
417
422
return g_protocol[index ]->getLastError ();
418
423
}
419
424
420
425
// Exec function
421
- LPXLOPER xres = g_protocol[index ]->execute (name, g_sendCallerInfo, 20 , v0, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19);
426
+ LPXLOPER xres = g_protocol[index ]->execute (name, g_sendCallerInfo, MAX_ARGUMENTS , v0, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29 );
422
427
423
428
// Check for error
424
429
if (!g_protocol[index ]->isConnected ()) {
@@ -431,7 +436,7 @@ LPXLOPER WINAPI FSExecute(int index, const char* name, LPXLOPER v0, LPXLOPER v1,
431
436
432
437
// Log function call
433
438
if (g_debugLogging) {
434
- XLUtil::LogFunctionCall (g_serverSections[index ], name, xres, 20 , v0, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19);
439
+ XLUtil::LogFunctionCall (g_serverSections[index ], name, xres, MAX_ARGUMENTS , v0, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29 );
435
440
}
436
441
437
442
return xres;
@@ -441,10 +446,11 @@ LPXLOPER WINAPI FSExecute(int index, const char* name, LPXLOPER v0, LPXLOPER v1,
441
446
__declspec (dllexport) LPXLOPER WINAPI FSExecute##number (const char * name, LPXLOPER v0, LPXLOPER v1, LPXLOPER v2 \
442
447
,LPXLOPER v3, LPXLOPER v4, LPXLOPER v5, LPXLOPER v6, LPXLOPER v7, LPXLOPER v8 \
443
448
,LPXLOPER v9, LPXLOPER v10, LPXLOPER v11, LPXLOPER v12, LPXLOPER v13, LPXLOPER v14, LPXLOPER v15, LPXLOPER v16 \
444
- ,LPXLOPER v17, LPXLOPER v18, LPXLOPER v19) \
449
+ ,LPXLOPER v17, LPXLOPER v18, LPXLOPER v19, LPXLOPER v20, LPXLOPER v21, LPXLOPER v22, LPXLOPER v23, LPXLOPER v24 \
450
+ ,LPXLOPER v25, LPXLOPER v26, LPXLOPER v27, LPXLOPER v28, LPXLOPER v29) \
445
451
{ \
446
- return FSExecute (number, name, v0, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19); \
447
- }
452
+ return FSExecute (number, name, v0, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29 ); \
453
+ }
448
454
449
455
DECLARE_GENERAL_FUNCTION (0 )
450
456
DECLARE_GENERAL_FUNCTION(1 )
@@ -467,23 +473,26 @@ DECLARE_GENERAL_FUNCTION(17)
467
473
DECLARE_GENERAL_FUNCTION(18 )
468
474
DECLARE_GENERAL_FUNCTION(19 )
469
475
470
- __declspec(dllexport) LPXLOPER WINAPI FSExecuteVolatile(int index, const char * name, LPXLOPER v0, LPXLOPER v1, LPXLOPER v2, LPXLOPER v3, LPXLOPER v4,
476
+ __declspec(dllexport) LPXLOPER WINAPI FSExecuteVolatile(int index, const char * name, LPXLOPER v0, LPXLOPER v1, LPXLOPER v2, LPXLOPER v3, LPXLOPER v4,
471
477
LPXLOPER v5, LPXLOPER v6, LPXLOPER v7, LPXLOPER v8, LPXLOPER v9, LPXLOPER v10,
472
478
LPXLOPER v11, LPXLOPER v12, LPXLOPER v13, LPXLOPER v14, LPXLOPER v15, LPXLOPER v16,
473
- LPXLOPER v17, LPXLOPER v18, LPXLOPER v19)
479
+ LPXLOPER v17, LPXLOPER v18, LPXLOPER v19, LPXLOPER v20, LPXLOPER v21, LPXLOPER v22,
480
+ LPXLOPER v23, LPXLOPER v24, LPXLOPER v25, LPXLOPER v26, LPXLOPER v27, LPXLOPER v28,
481
+ LPXLOPER v29)
474
482
{
475
483
// Just call off to main function (as this should have the same behaviour only volatile)
476
- return FSExecute (index , name, v0, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19);
484
+ return FSExecute (index , name, v0, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29 );
477
485
}
478
486
479
487
#define DECLARE_VOLATILE_FUNCTION (number ) \
480
488
__declspec (dllexport) LPXLOPER WINAPI FSExecuteVolatile##number (const char * name, LPXLOPER v0, LPXLOPER v1, LPXLOPER v2 \
481
489
,LPXLOPER v3, LPXLOPER v4, LPXLOPER v5, LPXLOPER v6, LPXLOPER v7, LPXLOPER v8 \
482
490
,LPXLOPER v9, LPXLOPER v10, LPXLOPER v11, LPXLOPER v12, LPXLOPER v13, LPXLOPER v14, LPXLOPER v15, LPXLOPER v16 \
483
- ,LPXLOPER v17, LPXLOPER v18, LPXLOPER v19) \
491
+ ,LPXLOPER v17, LPXLOPER v18, LPXLOPER v19, LPXLOPER v20, LPXLOPER v21, LPXLOPER v22, LPXLOPER v23, LPXLOPER v24 \
492
+ ,LPXLOPER v25, LPXLOPER v26, LPXLOPER v27, LPXLOPER v28, LPXLOPER v29) \
484
493
{ \
485
- return FSExecuteVolatile (number, name, v0, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19); \
486
- }
494
+ return FSExecuteVolatile (number, name, v0, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29 ); \
495
+ }
487
496
488
497
DECLARE_VOLATILE_FUNCTION (0 )
489
498
DECLARE_VOLATILE_FUNCTION(1 )
@@ -506,24 +515,27 @@ DECLARE_VOLATILE_FUNCTION(17)
506
515
DECLARE_VOLATILE_FUNCTION(18 )
507
516
DECLARE_VOLATILE_FUNCTION(19 )
508
517
509
- LPXLOPER WINAPI FSExecuteNumber(int number, LPXLOPER v0, LPXLOPER v1, LPXLOPER v2, LPXLOPER v3, LPXLOPER v4,
518
+ LPXLOPER WINAPI FSExecuteNumber(int number, LPXLOPER v0, LPXLOPER v1, LPXLOPER v2, LPXLOPER v3, LPXLOPER v4,
510
519
LPXLOPER v5, LPXLOPER v6, LPXLOPER v7, LPXLOPER v8, LPXLOPER v9, LPXLOPER v10,
511
520
LPXLOPER v11, LPXLOPER v12, LPXLOPER v13, LPXLOPER v14, LPXLOPER v15, LPXLOPER v16,
512
- LPXLOPER v17, LPXLOPER v18, LPXLOPER v19)
521
+ LPXLOPER v17, LPXLOPER v18, LPXLOPER v19, LPXLOPER v20, LPXLOPER v21, LPXLOPER v22,
522
+ LPXLOPER v23, LPXLOPER v24, LPXLOPER v25, LPXLOPER v26, LPXLOPER v27, LPXLOPER v28,
523
+ LPXLOPER v29)
513
524
{
514
525
if (g_functionCount < number) {
515
526
return &g_errorMessage;
516
527
}
517
- return FSExecute (g_functionServer[number], g_functionNames[number], v0, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19);
528
+ return FSExecute (g_functionServer[number], g_functionNames[number], v0, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29 );
518
529
}
519
530
520
531
#define DECLARE_EXCEL_FUNCTION (number ) \
521
532
__declspec (dllexport) LPXLOPER WINAPI FS##number (LPXLOPER v0, LPXLOPER v1, LPXLOPER v2 \
522
533
,LPXLOPER v3, LPXLOPER v4, LPXLOPER v5, LPXLOPER v6, LPXLOPER v7, LPXLOPER v8 \
523
534
,LPXLOPER v9, LPXLOPER v10, LPXLOPER v11, LPXLOPER v12, LPXLOPER v13, LPXLOPER v14, LPXLOPER v15, LPXLOPER v16 \
524
- ,LPXLOPER v17, LPXLOPER v18, LPXLOPER v19) \
535
+ ,LPXLOPER v17, LPXLOPER v18, LPXLOPER v19, LPXLOPER v20, LPXLOPER v21, LPXLOPER v22, LPXLOPER v23, LPXLOPER v24 \
536
+ ,LPXLOPER v25, LPXLOPER v26, LPXLOPER v27, LPXLOPER v28, LPXLOPER v29) \
525
537
{ \
526
- return FSExecuteNumber (number, v0, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19); \
538
+ return FSExecuteNumber (number, v0, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29 ); \
527
539
}
528
540
529
541
DECLARE_EXCEL_FUNCTION (0 )
0 commit comments