summaryrefslogtreecommitdiff
path: root/sc/source/core/tool/parclass.cxx
blob: 9af15044f69acdc06ea0f611d78c69e75675647f (plain)
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
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
 *
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 *
 * Copyright 2000, 2010 Oracle and/or its affiliates.
 *
 * OpenOffice.org - a multi-platform office productivity suite
 *
 * This file is part of OpenOffice.org.
 *
 * OpenOffice.org is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Lesser General Public License version 3
 * only, as published by the Free Software Foundation.
 *
 * OpenOffice.org is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU Lesser General Public License version 3 for more details
 * (a copy is included in the LICENSE file that accompanied this code).
 *
 * You should have received a copy of the GNU Lesser General Public License
 * version 3 along with OpenOffice.org.  If not, see
 * <http://www.openoffice.org/license.html>
 * for a copy of the LGPLv3 License.
 *
 ************************************************************************/

// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_sc.hxx"


#include "parclass.hxx"
#include "token.hxx"
#include "global.hxx"
#include "callform.hxx"
#include "addincol.hxx"
#include "funcdesc.hxx"
#include <unotools/charclass.hxx>
#include <tools/debug.hxx>
#include <string.h>

#if OSL_DEBUG_LEVEL > 1
// the documentation thingy
#include <stdio.h>
#include <com/sun/star/sheet/FormulaLanguage.hpp>
#include "compiler.hxx"
#include "sc.hrc"   // VAR_ARGS
#endif


/* Following assumptions are made:
 * - OpCodes not specified at all will have at least one and only parameters of
 *   type Value, no check is done on the count of parameters => no Bounds type
 *   is returned.
 * - For OpCodes with a variable number of parameters the type of the last
 *   parameter specified determines the type of all following parameters.
 */

const ScParameterClassification::RawData ScParameterClassification::pRawData[] =
{
    // IF() and CHOOSE() are somewhat special, since the ScJumpMatrix is
    // created inside those functions and ConvertMatrixParameters() is not
    // called for them.
    { ocIf,              {{ Array, Reference, Reference                          }, false }},
    { ocChose,           {{ Array, Reference                                     }, true }},
    // Other specials.
    { ocOpen,            {{ Bounds                                               }, false }},
    { ocClose,           {{ Bounds                                               }, false }},
    { ocSep,             {{ Bounds                                               }, false }},
    { ocNoName,          {{ Bounds                                               }, false }},
    { ocErrCell,         {{ Bounds                                               }, false }},
    { ocStop,            {{ Bounds                                               }, false }},
    { ocUnion,           {{ Reference, Reference                                 }, false }},
    { ocRange,           {{ Reference, Reference                                 }, false }},
    // Functions with Value parameters only but not in resource.
    { ocBackSolver,      {{ Value, Value, Value                                  }, false }},
    { ocTableOp,         {{ Value, Value, Value, Value, Value                    }, false }},
    // Operators and functions.
    { ocAdd,             {{ Array, Array                                         }, false }},
    { ocAmpersand,       {{ Array, Array                                         }, false }},
    { ocAnd,             {{ Reference                                            }, true }},
    { ocAreas,           {{ Reference                                            }, false }},
    { ocAveDev,          {{ Reference                                            }, true }},
    { ocAverage,         {{ Reference                                            }, true }},
    { ocAverageA,        {{ Reference                                            }, true }},
    { ocCell,            {{ Value, Reference                                     }, false }},
    { ocColumn,          {{ Reference                                            }, false }},
    { ocColumns,         {{ Reference                                            }, true }},
    { ocCorrel,          {{ ForceArray, ForceArray                               }, false }},
    { ocCount,           {{ Reference                                            }, true }},
    { ocCount2,          {{ Reference                                            }, true }},
    { ocCountEmptyCells, {{ Reference                                            }, false }},
    { ocCountIf,         {{ Reference, Value                                     }, false }},
    { ocCovar,           {{ ForceArray, ForceArray                               }, false }},
    { ocDBAverage,       {{ Reference, Reference, Reference                      }, false }},
    { ocDBCount,         {{ Reference, Reference, Reference                      }, false }},
    { ocDBCount2,        {{ Reference, Reference, Reference                      }, false }},
    { ocDBGet,           {{ Reference, Reference, Reference                      }, false }},
    { ocDBMax,           {{ Reference, Reference, Reference                      }, false }},
    { ocDBMin,           {{ Reference, Reference, Reference                      }, false }},
    { ocDBProduct,       {{ Reference, Reference, Reference                      }, false }},
    { ocDBStdDev,        {{ Reference, Reference, Reference                      }, false }},
    { ocDBStdDevP,       {{ Reference, Reference, Reference                      }, false }},
    { ocDBSum,           {{ Reference, Reference, Reference                      }, false }},
    { ocDBVar,           {{ Reference, Reference, Reference                      }, false }},
    { ocDBVarP,          {{ Reference, Reference, Reference                      }, false }},
    { ocDevSq,           {{ Reference                                            }, true }},
    { ocDiv,             {{ Array, Array                                         }, false }},
    { ocEqual,           {{ Array, Array                                         }, false }},
    { ocForecast,        {{ Value, ForceArray, ForceArray                        }, false }},
    { ocFrequency,       {{ Reference, Reference                                 }, false }},
    { ocFTest,           {{ ForceArray, ForceArray                               }, false }},
    { ocGeoMean,         {{ Reference                                            }, true }},
    { ocGCD,             {{ Reference                                            }, true }},
    { ocGreater,         {{ Array, Array                                         }, false }},
    { ocGreaterEqual,    {{ Array, Array                                         }, false }},
    { ocGrowth,          {{ Reference, Reference, Reference, Value               }, false }},
    { ocHarMean,         {{ Reference                                            }, true }},
    { ocHLookup,         {{ Value, Reference, Value, Value                       }, false }},
    { ocIRR,             {{ Reference, Value                                     }, false }},
    { ocIndex,           {{ Reference, Value, Value, Value                       }, false }},
    { ocIntercept,       {{ ForceArray, ForceArray                               }, false }},
    { ocIntersect,       {{ Reference, Reference                                 }, false }},
    { ocIsRef,           {{ Reference                                            }, false }},
    { ocLCM,             {{ Reference                                            }, true }},
    { ocKurt,            {{ Reference                                            }, true }},
    { ocLarge,           {{ Reference, Value                                     }, false }},
    { ocLess,            {{ Array, Array                                         }, false }},
    { ocLessEqual,       {{ Array, Array                                         }, false }},
    { ocLookup,          {{ Value, ReferenceOrForceArray, ReferenceOrForceArray  }, false }},
    { ocMatch,           {{ Value, Reference, Reference                          }, false }},
    { ocMatDet,          {{ ForceArray                                           }, false }},
    { ocMatInv,          {{ ForceArray                                           }, false }},
    { ocMatMult,         {{ ForceArray, ForceArray                               }, false }},
    { ocMatTrans,        {{ Array                                                }, false }}, // strange, but Xcl doesn't force MatTrans array
    { ocMatValue,        {{ Reference, Value, Value                              }, false }},
    { ocMax,             {{ Reference                                            }, true }},
    { ocMaxA,            {{ Reference                                            }, true }},
    { ocMedian,          {{ Reference                                            }, true }},
    { ocMin,             {{ Reference                                            }, true }},
    { ocMinA,            {{ Reference                                            }, true }},
    { ocMIRR,            {{ Reference, Value, Value                              }, false }},
    { ocModalValue,      {{ ForceArray                                           }, true }},
    { ocMul,             {{ Array, Array                                         }, false }},
    { ocMultiArea,       {{ Reference                                            }, true }},
    { ocN,               {{ Reference                                            }, false }},
    { ocNPV,             {{ Value, Reference                                     }, true }},
    { ocNeg,             {{ Array                                                }, false }},
    { ocNegSub,          {{ Array                                                }, false }},
    { ocNot,             {{ Array                                                }, false }},
    { ocNotEqual,        {{ Array, Array                                         }, false }},
    { ocOffset,          {{ Reference, Value, Value, Value, Value                }, false }},
    { ocOr,              {{ Reference                                            }, true }},
    { ocPearson,         {{ ForceArray, ForceArray                               }, false }},
    { ocPercentile,      {{ Reference, Value                                     }, false }},
    { ocPercentrank,     {{ Reference, Value                                     }, false }},
    { ocPow,             {{ Array, Array                                         }, false }},
    { ocPower,           {{ Array, Array                                         }, false }},
    { ocProb,            {{ ForceArray, ForceArray, Value, Value                 }, false }},
    { ocProduct,         {{ Reference                                            }, true }},
    { ocQuartile,        {{ Reference, Value                                     }, false }},
    { ocRank,            {{ Value, Reference, Value                              }, false }},
    { ocRGP,             {{ Reference, Reference, Value, Value                   }, false }},
    { ocRKP,             {{ Reference, Reference, Value, Value                   }, false }},
    { ocRow,             {{ Reference                                            }, false }},
    { ocRows,            {{ Reference                                            }, true }},
    { ocRSQ,             {{ ForceArray, ForceArray                               }, false }},
    { ocSchiefe,         {{ Reference                                            }, true }},
    { ocSlope,           {{ ForceArray, ForceArray                               }, false }},
    { ocSmall,           {{ Reference, Value                                     }, false }},
    { ocStDev,           {{ Reference                                            }, true }},
    { ocStDevA,          {{ Reference                                            }, true }},
    { ocStDevP,          {{ Reference                                            }, true }},
    { ocStDevPA,         {{ Reference                                            }, true }},
    { ocSTEYX,           {{ ForceArray, ForceArray                               }, false }},
    { ocSub,             {{ Array, Array                                         }, false }},
    { ocSubTotal,        {{ Value, Reference                                     }, true }},
    { ocSum,             {{ Reference                                            }, true }},
    { ocSumIf,           {{ Reference, Value, Reference                          }, false }},
    { ocSumProduct,      {{ ForceArray                                           }, true }},
    { ocSumSQ,           {{ Reference                                            }, true }},
    { ocSumX2MY2,        {{ ForceArray, ForceArray                               }, false }},
    { ocSumX2DY2,        {{ ForceArray, ForceArray                               }, false }},
    { ocSumXMY2,         {{ ForceArray, ForceArray                               }, false }},
    { ocTable,           {{ Reference                                            }, false }},
    { ocTables,          {{ Reference                                            }, true }},
    { ocTrend,           {{ Reference, Reference, Reference, Value               }, false }},
    { ocTrimMean,        {{ Reference, Value                                     }, false }},
    { ocTTest,           {{ ForceArray, ForceArray, Value, Value                 }, false }},
    { ocVar,             {{ Reference                                            }, true }},
    { ocVarA,            {{ Reference                                            }, true }},
    { ocVarP,            {{ Reference                                            }, true }},
    { ocVarPA,           {{ Reference                                            }, true }},
    { ocVLookup,         {{ Value, Reference, Value, Value                       }, false }},
    { ocZTest,           {{ Reference, Value, Value                              }, false }},
    // Excel doubts:
    // ocT: Excel says (and handles) Reference, error? This means no position
    // dependent SingleRef if DoubleRef, and no array calculation, just the
    // upper left corner. We never did that.
    { ocT, {{ Value }, false }},
    // The stopper.
    { ocNone, {{ Bounds }, false } }
};

ScParameterClassification::RunData * ScParameterClassification::pData = NULL;


void ScParameterClassification::Init()
{
    if ( pData )
        return;
    pData = new RunData[ SC_OPCODE_LAST_OPCODE_ID + 1 ];
    memset( pData, 0, sizeof(RunData) * (SC_OPCODE_LAST_OPCODE_ID + 1));

    // init from specified static data above
    for ( size_t i=0; i < sizeof(pRawData) / sizeof(RawData); ++i )
    {
        const RawData* pRaw = &pRawData[i];
        if ( pRaw->eOp > SC_OPCODE_LAST_OPCODE_ID )
        {
            DBG_ASSERT( pRaw->eOp == ocNone, "RawData OpCode error");
        }
        else
        {
            RunData* pRun = &pData[ pRaw->eOp ];
#ifdef DBG_UTIL
            if ( pRun->aData.nParam[0] != Unknown )
            {
                DBG_ERROR1( "already assigned: %d", pRaw->eOp);
            }
#endif
            memcpy( &(pRun->aData), &(pRaw->aData), sizeof(CommonData));
            // fill 0-initialized fields with real values
            if ( pRun->aData.bRepeatLast )
            {
                Type eLast = Unknown;
                for ( size_t j=0; j < CommonData::nMaxParams; ++j )
                {
                    if ( pRun->aData.nParam[j] )
                    {
                        eLast = pRun->aData.nParam[j];
                        pRun->nMinParams = sal::static_int_cast<BYTE>( j+1 );
                    }
                    else
                        pRun->aData.nParam[j] = eLast;
                }
            }
            else
            {
                for ( size_t j=0; j < CommonData::nMaxParams; ++j )
                {
                    if ( !pRun->aData.nParam[j] )
                    {
                        if ( j == 0 || pRun->aData.nParam[j-1] != Bounds )
                            pRun->nMinParams = sal::static_int_cast<BYTE>( j );
                        pRun->aData.nParam[j] = Bounds;
                    }
                }
                if ( !pRun->nMinParams &&
                        pRun->aData.nParam[CommonData::nMaxParams-1] != Bounds)
                    pRun->nMinParams = CommonData::nMaxParams;
            }
            for ( size_t j=0; j < CommonData::nMaxParams; ++j )
            {
                if ( pRun->aData.nParam[j] == ForceArray || pRun->aData.nParam[j] == ReferenceOrForceArray )
                {
                    pRun->bHasForceArray = true;
                    break;  // for
                }
            }
        }
    }

#if OSL_DEBUG_LEVEL > 1
    GenerateDocumentation();
#endif
}


void ScParameterClassification::Exit()
{
    delete [] pData;
    pData = NULL;
}


ScParameterClassification::Type ScParameterClassification::GetParameterType(
        const formula::FormulaToken* pToken, USHORT nParameter)
{
    OpCode eOp = pToken->GetOpCode();
    switch ( eOp )
    {
        case ocExternal:
            return GetExternalParameterType( pToken, nParameter);
        //break;
        case ocMacro:
            return Reference;
        //break;
        default:
        {
            // added to avoid warnings
        }
    }
    if ( 0 <= (short)eOp && eOp <= SC_OPCODE_LAST_OPCODE_ID )
    {
        if ( nParameter < CommonData::nMaxParams )
        {
            Type eT = pData[eOp].aData.nParam[nParameter];
            return eT == Unknown ? Value : eT;
        }
        else if ( pData[eOp].aData.bRepeatLast )
            return pData[eOp].aData.nParam[CommonData::nMaxParams-1];
        else
            return Bounds;
    }
    return Unknown;
}


ScParameterClassification::Type
ScParameterClassification::GetExternalParameterType( const formula::FormulaToken* pToken,
        USHORT nParameter)
{
    Type eRet = Unknown;
    // similar to ScInterpreter::ScExternal()
    USHORT nIndex;
    String aUnoName;
    String aFuncName( ScGlobal::pCharClass->upper( pToken->GetExternal()));
    if ( ScGlobal::GetFuncCollection()->SearchFunc( aFuncName, nIndex) )
    {
        FuncData* pFuncData = (FuncData*)ScGlobal::GetFuncCollection()->At(
                nIndex);
        if ( nParameter >= pFuncData->GetParamCount() )
            eRet = Bounds;
        else
        {
            switch ( pFuncData->GetParamType( nParameter) )
            {
                case PTR_DOUBLE:
                case PTR_STRING:
                    eRet = Value;
                break;
                default:
                    eRet = Reference;
                    // also array types are created using an area reference
            }
        }
    }
    else if ( (aUnoName = ScGlobal::GetAddInCollection()->FindFunction(
                    aFuncName, FALSE)).Len() )
    {
        // the relevant parts of ScUnoAddInCall without having to create one
        const ScUnoAddInFuncData* pFuncData =
            ScGlobal::GetAddInCollection()->GetFuncData( aUnoName, true );      // need fully initialized data
        if ( pFuncData )
        {
            long nCount = pFuncData->GetArgumentCount();
            if ( nCount <= 0 )
                eRet = Bounds;
            else
            {
                const ScAddInArgDesc* pArgs = pFuncData->GetArguments();
                if ( nParameter >= nCount &&
                        pArgs[nCount-1].eType == SC_ADDINARG_VARARGS )
                    eRet = Value;
                    // last arg is sequence, optional "any"s, we simply can't
                    // determine the type
                if ( eRet == Unknown )
                {
                    if ( nParameter >= nCount )
                        eRet = Bounds;
                    else
                    {
                        switch ( pArgs[nParameter].eType )
                        {
                            case SC_ADDINARG_INTEGER:
                            case SC_ADDINARG_DOUBLE:
                            case SC_ADDINARG_STRING:
                                eRet = Value;
                            break;
                            default:
                                eRet = Reference;
                        }
                    }
                }
            }
        }
    }
    return eRet;
}

//-----------------------------------------------------------------------------

#if OSL_DEBUG_LEVEL > 1

// add remaining functions, all Value parameters
void ScParameterClassification::MergeArgumentsFromFunctionResource()
{
    ScFunctionList* pFuncList = ScGlobal::GetStarCalcFunctionList();
    for ( const ScFuncDesc* pDesc = pFuncList->First(); pDesc;
            pDesc = pFuncList->Next() )
    {
        if ( pDesc->nFIndex > SC_OPCODE_LAST_OPCODE_ID ||
                pData[pDesc->nFIndex].aData.nParam[0] != Unknown )
            continue;   // not an internal opcode or already done

        RunData* pRun = &pData[ pDesc->nFIndex ];
        USHORT nArgs = pDesc->GetSuppressedArgCount();
        if ( nArgs >= VAR_ARGS )
        {
            nArgs -= VAR_ARGS - 1;
            pRun->aData.bRepeatLast = true;
        }
        if ( nArgs > CommonData::nMaxParams )
        {
            DBG_ERROR2( "ScParameterClassification::Init: too many arguments in listed function: %s: %d",
                    ByteString( *(pDesc->pFuncName),
                        RTL_TEXTENCODING_UTF8).GetBuffer(), nArgs);
            nArgs = CommonData::nMaxParams;
            pRun->aData.bRepeatLast = true;
        }
        pRun->nMinParams = static_cast< BYTE >( nArgs );
        for ( size_t j=0; j < nArgs; ++j )
        {
            pRun->aData.nParam[j] = Value;
        }
        if ( pRun->aData.bRepeatLast )
        {
            for ( size_t j = nArgs; j < CommonData::nMaxParams; ++j )
            {
                pRun->aData.nParam[j] = Value;
            }
        }
        else
        {
            for ( size_t j = nArgs; j < CommonData::nMaxParams; ++j )
            {
                pRun->aData.nParam[j] = Bounds;
            }
        }
    }
}


void ScParameterClassification::GenerateDocumentation()
{
    static const sal_Char aEnvVarName[] = "OOO_CALC_GENPARCLASSDOC";
    if ( !getenv( aEnvVarName) )
        return;
    MergeArgumentsFromFunctionResource();
    ScAddress aAddress;
    ScCompiler aComp(NULL,aAddress);
    ScCompiler::OpCodeMapPtr xMap( aComp.GetOpCodeMap(::com::sun::star::sheet::FormulaLanguage::ENGLISH));
    if (!xMap)
        return;
    fflush( stderr);
    size_t nCount = xMap->getSymbolCount();
    for ( size_t i=0; i<nCount; ++i )
    {
        OpCode eOp = OpCode(i);
        if ( xMap->getSymbol(eOp).Len() )
        {
            fprintf( stdout, "%s: ", aEnvVarName);
            ByteString aStr( xMap->getSymbol(eOp), RTL_TEXTENCODING_UTF8);
            aStr += "(";
            formula::FormulaByteToken aToken( eOp);
            BYTE nParams = GetMinimumParameters( eOp);
            // preset parameter count according to opcode value, with some
            // special handling
            if ( eOp < SC_OPCODE_STOP_DIV )
            {
                switch ( eOp )
                {
                    case ocIf:
                        aToken.SetByte(3);
                    break;
                    case ocChose:
                        aToken.SetByte(2);
                    break;
                    case ocPercentSign:
                        aToken.SetByte(1);
                    break;
                    default:;
                }
            }
            else if ( eOp < SC_OPCODE_STOP_ERRORS )
                aToken.SetByte(0);
            else if ( eOp < SC_OPCODE_STOP_BIN_OP )
            {
                switch ( eOp )
                {
                    case ocAnd:
                    case ocOr:
                        aToken.SetByte(1);  // (r1)AND(r2) --> AND( r1, ...)
                    break;
                    default:
                        aToken.SetByte(2);
                }
            }
            else if ( eOp < SC_OPCODE_STOP_UN_OP )
                aToken.SetByte(1);
            else if ( eOp < SC_OPCODE_STOP_NO_PAR )
                aToken.SetByte(0);
            else if ( eOp < SC_OPCODE_STOP_1_PAR )
                aToken.SetByte(1);
            else
                aToken.SetByte( nParams);
            // compare (this is a mere test for opcode order Div, BinOp, UnOp,
            // NoPar, 1Par, ...) and override parameter count with
            // classification
            if ( nParams != aToken.GetByte() )
                fprintf( stdout, "(parameter count differs, token Byte: %d  classification: %d) ",
                        aToken.GetByte(), nParams);
            aToken.SetByte( nParams);
            if ( nParams != aToken.GetParamCount() )
                fprintf( stdout, "(parameter count differs, token ParamCount: %d  classification: %d) ",
                        aToken.GetParamCount(), nParams);
            for ( USHORT j=0; j < nParams; ++j )
            {
                if ( j > 0 )
                    aStr += ",";
                Type eType = GetParameterType( &aToken, j);
                switch ( eType )
                {
                    case Value :
                        aStr += " Value";
                    break;
                    case Reference :
                        aStr += " Reference";
                    break;
                    case Array :
                        aStr += " Array";
                    break;
                    case ForceArray :
                        aStr += " ForceArray";
                    break;
                    case ReferenceOrForceArray :
                        aStr += " ReferenceOrForceArray";
                    break;
                    case Bounds :
                        aStr += " (Bounds, classification error?)";
                    break;
                    default:
                        aStr += " (???, classification error?)";
                }
            }
            if ( HasRepeatParameters( eOp) )
                aStr += ", ...";
            if ( nParams )
                aStr += " ";
            aStr += ")";
            switch ( eOp )
            {
                case ocZGZ:
                    aStr += "   // RRI in English resource, but ZGZ in English-only section";
                break;
                case ocMultiArea:
                    aStr += "   // e.g. combined first parameter of INDEX() function, not a real function";
                break;
                case ocBackSolver:
                    aStr += "   // goal seek via menu, not a real function";
                break;
                case ocTableOp:
                    aStr += "   // MULTIPLE.OPERATIONS in English resource, but TABLE in English-only section";
                break;
                case ocNoName:
                    aStr += "   // error function, not a real function";
                break;
                default:;
            }
            fprintf( stdout, "%s\n", aStr.GetBuffer());
        }
    }
    fflush( stdout);
}

#endif // OSL_DEBUG_LEVEL

/* vim:set shiftwidth=4 softtabstop=4 expandtab: */