Orb/Doxygen/src/pre.l
author Jonathan Harrington <jonathan.harrington@nokia.com>
Wed, 11 Aug 2010 14:49:30 +0100
changeset 4 468f4c8d3d5b
parent 3 d8fccb2cd802
permissions -rw-r--r--
Orb version 0.2.0
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
3
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
     1
/******************************************************************************
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
     2
 *
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
     3
 * 
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
     4
 *
4
468f4c8d3d5b Orb version 0.2.0
Jonathan Harrington <jonathan.harrington@nokia.com>
parents: 3
diff changeset
     5
 * Copyright (C) 1997-2010 by Dimitri van Heesch.
3
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
     6
 *
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
     7
 * Permission to use, copy, modify, and distribute this software and its
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
     8
 * documentation under the terms of the GNU General Public License is hereby 
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
     9
 * granted. No representations are made about the suitability of this software 
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
    10
 * for any purpose. It is provided "as is" without express or implied warranty.
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
    11
 * See the GNU General Public License for more details.
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
    12
 *
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
    13
 * Documents produced by Doxygen are derivative works derived from the
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
    14
 * input used in their production; they are not affected by this license.
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
    15
 *
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
    16
 */
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
    17
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
    18
%{
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
    19
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
    20
/*
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
    21
 *	includes
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
    22
 */
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
    23
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
    24
#include <stdio.h>
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
    25
#include <assert.h>
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
    26
#include <ctype.h>
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
    27
#include <errno.h>
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
    28
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
    29
#include "qtbc.h"
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
    30
#include <qarray.h>
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
    31
#include <qstack.h>
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
    32
#include <qfile.h>
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
    33
#include <qstrlist.h>
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
    34
#include <qdict.h>
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
    35
#include <qregexp.h>
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
    36
#include <qfileinfo.h>
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
    37
#include <qdir.h>
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
    38
#include <qmap.h>
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
    39
  
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
    40
#include "pre.h"
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
    41
#include "constexp.h"
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
    42
#include "define.h"
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
    43
#include "doxygen.h"
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
    44
#include "message.h"
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
    45
#include "util.h"
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
    46
#include "defargs.h"
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
    47
#include "debug.h"
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
    48
#include "bufstr.h"
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
    49
#include "portable.h"
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
    50
#include "bufstr.h"
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
    51
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
    52
#define YY_NEVER_INTERACTIVE 1
4
468f4c8d3d5b Orb version 0.2.0
Jonathan Harrington <jonathan.harrington@nokia.com>
parents: 3
diff changeset
    53
  
3
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
    54
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
    55
struct FileState
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
    56
{
4
468f4c8d3d5b Orb version 0.2.0
Jonathan Harrington <jonathan.harrington@nokia.com>
parents: 3
diff changeset
    57
  FileState(int size) : fileBuf(size), 
468f4c8d3d5b Orb version 0.2.0
Jonathan Harrington <jonathan.harrington@nokia.com>
parents: 3
diff changeset
    58
                        oldFileBuf(0), oldFileBufPos(0) {}
3
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
    59
  int lineNr;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
    60
  //FILE *filePtr;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
    61
  BufStr fileBuf;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
    62
  //FILE *oldYYin;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
    63
  BufStr *oldFileBuf;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
    64
  int oldFileBufPos;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
    65
  //bool isPlainFile;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
    66
  YY_BUFFER_STATE bufState;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
    67
  QCString fileName;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
    68
};  
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
    69
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
    70
/* -----------------------------------------------------------------
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
    71
 *
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
    72
 *	scanner's state
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
    73
 */
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
    74
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
    75
static int                g_yyLineNr   = 1;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
    76
static QCString           g_yyFileName;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
    77
static FileDef           *g_yyFileDef;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
    78
static FileDef           *g_inputFileDef;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
    79
static int                g_ifcount    = 0;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
    80
static QStrList          *g_pathList = 0;  
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
    81
static QStack<FileState>  g_includeStack;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
    82
static QDict<int>        *g_argDict;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
    83
static int                g_defArgs = -1;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
    84
static QCString           g_defName;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
    85
static QCString           g_defText;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
    86
static QCString           g_defLitText;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
    87
static QCString           g_defArgsStr;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
    88
static bool               g_defVarArgs;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
    89
static int                g_level;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
    90
static int                g_lastCContext;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
    91
static int                g_lastCPPContext;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
    92
static QArray<int>        g_levelGuard;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
    93
static BufStr            *g_inputBuf;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
    94
static int                g_inputBufPos;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
    95
static BufStr            *g_outputBuf;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
    96
static int                g_roundCount;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
    97
static bool               g_quoteArg;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
    98
static DefineDict        *g_fileDefineDict = new DefineDict(10009);
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
    99
static DefineDict        *g_expandedDict;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   100
static int                g_findDefArgContext;
4
468f4c8d3d5b Orb version 0.2.0
Jonathan Harrington <jonathan.harrington@nokia.com>
parents: 3
diff changeset
   101
static bool               g_expectGuard;
3
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   102
static QCString           g_lastGuardName;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   103
static QCString           g_incName;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   104
static QCString           g_guardExpr;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   105
static int                g_curlyCount;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   106
static bool               g_nospaces; // add extra spaces during macro expansion
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   107
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   108
static bool               g_macroExpansion; // from the configuration
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   109
static bool               g_expandOnlyPredef; // from the configuration
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   110
static int                g_commentCount;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   111
static bool               g_insideComment;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   112
static bool               g_isImported;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   113
static QCString           g_blockName;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   114
static int                g_condCtx;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   115
static bool               g_skip;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   116
static QStack<bool>       g_condStack;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   117
static bool               g_insideCS; // C# has simpler preprocessor
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   118
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   119
static bool               g_lexInit = FALSE;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   120
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   121
DefineDict* getFileDefineDict() 
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   122
{
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   123
  return g_fileDefineDict;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   124
}
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   125
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   126
static void setFileName(const char *name)
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   127
{
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   128
  bool ambig;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   129
  QFileInfo fi(name);
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   130
  g_yyFileName=convertToQCString(fi.absFilePath());
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   131
  g_yyFileDef=findFileDef(Doxygen::inputNameDict,g_yyFileName,ambig);
4
468f4c8d3d5b Orb version 0.2.0
Jonathan Harrington <jonathan.harrington@nokia.com>
parents: 3
diff changeset
   132
  //printf("setFileName(%s) g_yyFileName=%s g_yyFileDef=%p\n",
468f4c8d3d5b Orb version 0.2.0
Jonathan Harrington <jonathan.harrington@nokia.com>
parents: 3
diff changeset
   133
  //    name,g_yyFileName.data(),g_yyFileDef);
3
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   134
  if (g_yyFileDef == 0 && Config_getBool("PREPROCESS_INCLUDES")) {
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   135
		// Search again using Doxygen::includeNameDict
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   136
	    // First insert the include file in the Doxygen::includeNameDict if
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   137
	    // it is not there already. This can happen if the Doxygen::includeNameDict
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   138
	    // has scanned .../inc but the #include "usr/usr.h"
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   139
	    // The Doxygen::includeNameDict will not have usr.h in it so we poke it in.
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   140
		if (!Doxygen::includeNameDict->find(g_yyFileName.data())) {
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   141
			//Debug::print(Debug::IncludeGraph, 0, "pre.l setFileName() inserting in Doxygen::includeNameDict: %s\n", name);
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   142
			FileDef  *fd=new FileDef(fi.dirPath()+"/", fi.fileName());
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   143
            FileName *fn=0;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   144
            if (!fi.absFilePath().isEmpty() && (fn=(*Doxygen::includeNameDict)[name])) {
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   145
				fn->append(fd);
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   146
            } else {
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   147
				fn = new FileName(fi.absFilePath(), name);
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   148
				fn->append(fd);
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   149
				Doxygen::includeNameDict->insert(name, fn);
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   150
            }
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   151
			g_yyFileDef = fd;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   152
		} else {
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   153
			// Search the dictionary
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   154
			FileName *fn = Doxygen::includeNameDict->find(g_yyFileName.data());
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   155
			FileNameIterator fni(*fn);
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   156
			FileDef *fd = 0;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   157
			for (fni.toFirst(); (fd=fni.current()); ++fni) {
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   158
				if (fd && fd->absFilePath() == g_yyFileName) {
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   159
					break;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   160
				}
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   161
				fd = 0;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   162
			}
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   163
			g_yyFileDef = fd;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   164
		}
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   165
		//printf("pre.l setFileName() searching Doxygen::includeNameDict for %s, result=%p\n", name, g_yyFileDef);
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   166
		//Debug::print(Debug::IncludeGraph, 0, "pre.l setFileName() searching Doxygen::includeNameDict for %s, result=%p\n", name, g_yyFileDef);
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   167
  }
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   168
  if (g_yyFileDef && g_yyFileDef->isReference()) g_yyFileDef=0;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   169
  g_insideCS = g_yyFileName.right(3)==".cs";
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   170
}
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   171
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   172
static void incrLevel()
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   173
{
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   174
  g_level++;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   175
  g_levelGuard.resize(g_level);
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   176
  g_levelGuard[g_level-1]=FALSE;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   177
  //printf("%s line %d: incrLevel %d\n",g_yyFileName.data(),g_yyLineNr,g_level);
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   178
}
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   179
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   180
static void decrLevel()
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   181
{
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   182
  //printf("%s line %d: decrLevel %d\n",g_yyFileName.data(),g_yyLineNr,g_level);
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   183
  if (g_level > 0)
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   184
  {
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   185
    g_level--;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   186
    g_levelGuard.resize(g_level);
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   187
  }
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   188
  else
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   189
  {
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   190
    err("%s:%d: Error: More #endif's than #if's found.\n",
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   191
	g_yyFileName.data(),g_yyLineNr);
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   192
  }
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   193
}
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   194
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   195
static bool otherCaseDone()
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   196
{
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   197
  if (g_level==0)
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   198
  {
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   199
    err("%s:%d: Error: Found an #else without a preceding #if.\n",
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   200
	g_yyFileName.data(),g_yyLineNr);
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   201
    return TRUE;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   202
  }
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   203
  else
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   204
  {
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   205
    return g_levelGuard[g_level-1];
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   206
  }
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   207
}
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   208
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   209
static void setCaseDone(bool value)
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   210
{
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   211
  g_levelGuard[g_level-1]=value;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   212
}
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   213
4
468f4c8d3d5b Orb version 0.2.0
Jonathan Harrington <jonathan.harrington@nokia.com>
parents: 3
diff changeset
   214
static bool macroIsAccessible(Define *def)
468f4c8d3d5b Orb version 0.2.0
Jonathan Harrington <jonathan.harrington@nokia.com>
parents: 3
diff changeset
   215
{
468f4c8d3d5b Orb version 0.2.0
Jonathan Harrington <jonathan.harrington@nokia.com>
parents: 3
diff changeset
   216
  //printf("macroIsAccessible(%s) input=%s def=%s\n",
468f4c8d3d5b Orb version 0.2.0
Jonathan Harrington <jonathan.harrington@nokia.com>
parents: 3
diff changeset
   217
  //    def->name.data(),g_inputFileDef?g_inputFileDef->name().data():"<none>",
468f4c8d3d5b Orb version 0.2.0
Jonathan Harrington <jonathan.harrington@nokia.com>
parents: 3
diff changeset
   218
  //    def->fileDef ? def->fileDef->name().data() : "<none>");
468f4c8d3d5b Orb version 0.2.0
Jonathan Harrington <jonathan.harrington@nokia.com>
parents: 3
diff changeset
   219
  if (def && def->isPredefined) // predefined macro -> globally accessible
468f4c8d3d5b Orb version 0.2.0
Jonathan Harrington <jonathan.harrington@nokia.com>
parents: 3
diff changeset
   220
  {
468f4c8d3d5b Orb version 0.2.0
Jonathan Harrington <jonathan.harrington@nokia.com>
parents: 3
diff changeset
   221
    //printf("%s: predefined macro %s\n",g_inputFileDef->name().data(),def->name.data());
468f4c8d3d5b Orb version 0.2.0
Jonathan Harrington <jonathan.harrington@nokia.com>
parents: 3
diff changeset
   222
    return TRUE;
468f4c8d3d5b Orb version 0.2.0
Jonathan Harrington <jonathan.harrington@nokia.com>
parents: 3
diff changeset
   223
  }
468f4c8d3d5b Orb version 0.2.0
Jonathan Harrington <jonathan.harrington@nokia.com>
parents: 3
diff changeset
   224
  if (def && def->fileDef==g_inputFileDef)
468f4c8d3d5b Orb version 0.2.0
Jonathan Harrington <jonathan.harrington@nokia.com>
parents: 3
diff changeset
   225
  {
468f4c8d3d5b Orb version 0.2.0
Jonathan Harrington <jonathan.harrington@nokia.com>
parents: 3
diff changeset
   226
    //printf("%s: macro %s defined in this file at line %d now at %d\n",
468f4c8d3d5b Orb version 0.2.0
Jonathan Harrington <jonathan.harrington@nokia.com>
parents: 3
diff changeset
   227
    //	g_inputFileDef->name().data(),def->name.data(),def->lineNr,g_yyLineNr);
468f4c8d3d5b Orb version 0.2.0
Jonathan Harrington <jonathan.harrington@nokia.com>
parents: 3
diff changeset
   228
    return def->lineNr<=g_yyLineNr;
468f4c8d3d5b Orb version 0.2.0
Jonathan Harrington <jonathan.harrington@nokia.com>
parents: 3
diff changeset
   229
  }
468f4c8d3d5b Orb version 0.2.0
Jonathan Harrington <jonathan.harrington@nokia.com>
parents: 3
diff changeset
   230
  if (g_inputFileDef && def && def->fileDef) // check if g_inputFileDef actually includes def->fileDef
468f4c8d3d5b Orb version 0.2.0
Jonathan Harrington <jonathan.harrington@nokia.com>
parents: 3
diff changeset
   231
  {
468f4c8d3d5b Orb version 0.2.0
Jonathan Harrington <jonathan.harrington@nokia.com>
parents: 3
diff changeset
   232
    QDict<FileDef> includedFiles(257);
468f4c8d3d5b Orb version 0.2.0
Jonathan Harrington <jonathan.harrington@nokia.com>
parents: 3
diff changeset
   233
    bool b = g_inputFileDef->includes(def->fileDef,&includedFiles);
468f4c8d3d5b Orb version 0.2.0
Jonathan Harrington <jonathan.harrington@nokia.com>
parents: 3
diff changeset
   234
    //printf("%s: Checking for accessibility of define '%s' (defined in %s): result=%d\n",
468f4c8d3d5b Orb version 0.2.0
Jonathan Harrington <jonathan.harrington@nokia.com>
parents: 3
diff changeset
   235
    //       g_inputFileDef->name().data(),def->name.data(),def->fileDef->name().data(),b);
468f4c8d3d5b Orb version 0.2.0
Jonathan Harrington <jonathan.harrington@nokia.com>
parents: 3
diff changeset
   236
    return b;
468f4c8d3d5b Orb version 0.2.0
Jonathan Harrington <jonathan.harrington@nokia.com>
parents: 3
diff changeset
   237
  }
468f4c8d3d5b Orb version 0.2.0
Jonathan Harrington <jonathan.harrington@nokia.com>
parents: 3
diff changeset
   238
  //printf("not accessible!\n");
468f4c8d3d5b Orb version 0.2.0
Jonathan Harrington <jonathan.harrington@nokia.com>
parents: 3
diff changeset
   239
  return FALSE;
468f4c8d3d5b Orb version 0.2.0
Jonathan Harrington <jonathan.harrington@nokia.com>
parents: 3
diff changeset
   240
}
468f4c8d3d5b Orb version 0.2.0
Jonathan Harrington <jonathan.harrington@nokia.com>
parents: 3
diff changeset
   241
3
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   242
static Define *isDefined(const char *name)
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   243
{
4
468f4c8d3d5b Orb version 0.2.0
Jonathan Harrington <jonathan.harrington@nokia.com>
parents: 3
diff changeset
   244
  Define *def=0;
3
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   245
  if (name)
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   246
  {
4
468f4c8d3d5b Orb version 0.2.0
Jonathan Harrington <jonathan.harrington@nokia.com>
parents: 3
diff changeset
   247
    def=g_fileDefineDict->find(name);
3
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   248
    //if ((def=fileDefineCache->findDefine(g_yyFileName,name)) && !def->undef) 
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   249
    //	return def;
4
468f4c8d3d5b Orb version 0.2.0
Jonathan Harrington <jonathan.harrington@nokia.com>
parents: 3
diff changeset
   250
    if (def && def->undef) def=0;
468f4c8d3d5b Orb version 0.2.0
Jonathan Harrington <jonathan.harrington@nokia.com>
parents: 3
diff changeset
   251
    if (def && !macroIsAccessible(def)) def=0;
3
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   252
  }
4
468f4c8d3d5b Orb version 0.2.0
Jonathan Harrington <jonathan.harrington@nokia.com>
parents: 3
diff changeset
   253
  return def;
3
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   254
}
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   255
4
468f4c8d3d5b Orb version 0.2.0
Jonathan Harrington <jonathan.harrington@nokia.com>
parents: 3
diff changeset
   256
3
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   257
static QDict<void> g_allIncludes(10009);
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   258
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   259
static FileState *checkAndOpenFile(const QCString &fileName,bool &alreadyIncluded)
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   260
{
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   261
  alreadyIncluded = FALSE;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   262
  FileState *fs = 0;
4
468f4c8d3d5b Orb version 0.2.0
Jonathan Harrington <jonathan.harrington@nokia.com>
parents: 3
diff changeset
   263
  //printf("checkAndOpenFile(%s)\n",fileName.data());
3
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   264
  QFileInfo fi(fileName);
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   265
  if (fi.exists() && fi.isFile())
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   266
  {
4
468f4c8d3d5b Orb version 0.2.0
Jonathan Harrington <jonathan.harrington@nokia.com>
parents: 3
diff changeset
   267
    static QStrList &exclPatterns = Config_getList("EXCLUDE_PATTERNS");
468f4c8d3d5b Orb version 0.2.0
Jonathan Harrington <jonathan.harrington@nokia.com>
parents: 3
diff changeset
   268
    if (patternMatch(fi,&exclPatterns)) return 0;
468f4c8d3d5b Orb version 0.2.0
Jonathan Harrington <jonathan.harrington@nokia.com>
parents: 3
diff changeset
   269
3
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   270
    QCString absName = convertToQCString(fi.absFilePath());
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   271
	//msg("checkAndOpenFile() found: %s\n", absName.data());
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   272
    // global guard
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   273
    if (g_curlyCount==0) // not #include inside { ... }
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   274
    {
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   275
      if (g_allIncludes.find(absName)!=0)
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   276
      {
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   277
        alreadyIncluded = TRUE;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   278
        //printf("  already included 1\n");
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   279
        if (!Config_getBool("PREPROCCESS_FULL_TU")) {
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   280
			return 0; // already done
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   281
		}
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   282
      } else {
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   283
		g_allIncludes.insert(absName,(void *)0x8);
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   284
	  }
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   285
    }
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   286
    // check include stack for absName
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   287
	// This is equivelent to walking the stack and setting alreadyIncluded to
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   288
	// TRUE if absName matches any filename
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   289
    QStack<FileState> tmpStack;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   290
    g_includeStack.setAutoDelete(FALSE);
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   291
    while ((fs=g_includeStack.pop()))
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   292
    {
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   293
      if (fs->fileName==absName) alreadyIncluded=TRUE;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   294
      tmpStack.push(fs);
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   295
    }
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   296
    while ((fs=tmpStack.pop()))
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   297
    {
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   298
      g_includeStack.push(fs);
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   299
    }
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   300
    g_includeStack.setAutoDelete(TRUE);
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   301
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   302
    if (alreadyIncluded)
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   303
    {
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   304
      //printf("  already included 2\n");
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   305
      return 0;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   306
    }
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   307
    //printf("#include %s\n",absName.data());
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   308
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   309
    fs = new FileState(fi.size()+4096);
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   310
    alreadyIncluded = FALSE;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   311
    if (!readInputFile(absName,fs->fileBuf))
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   312
    { // error
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   313
      //printf("  error reading\n");
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   314
      delete fs;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   315
      fs=0;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   316
    }
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   317
    else
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   318
    {
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   319
      fs->oldFileBuf    = g_inputBuf;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   320
      fs->oldFileBufPos = g_inputBufPos;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   321
    }
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   322
  }
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   323
  return fs;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   324
}
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   325
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   326
static FileState *findFile(const char *fileName,bool localInclude,bool &alreadyIncluded)
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   327
{
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   328
  //msg("** findFile(%s,%d) g_yyFileName=%s\n",fileName,localInclude,g_yyFileName.data());
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   329
  if (localInclude && !g_yyFileName.isEmpty())
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   330
  {
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   331
    QFileInfo fi(g_yyFileName);
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   332
    if (fi.exists())
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   333
    {
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   334
      QCString absName = QCString(fi.dirPath(TRUE).data())+"/"+fileName;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   335
      FileState *fs = checkAndOpenFile(absName,alreadyIncluded);
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   336
      if (fs)
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   337
      {
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   338
	setFileName(absName);
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   339
	g_yyLineNr=1;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   340
	return fs;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   341
      }
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   342
      else if (alreadyIncluded)
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   343
      {
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   344
	return 0;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   345
      }
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   346
    }
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   347
  }
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   348
  if (g_pathList==0) 
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   349
  {
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   350
    return 0;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   351
  }
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   352
  char *s=g_pathList->first();
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   353
  while (s)
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   354
  {
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   355
    QCString absName = (QCString)s+"/"+fileName;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   356
    FileState *fs = checkAndOpenFile(absName,alreadyIncluded);
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   357
    if (fs)
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   358
    {
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   359
      setFileName(absName);
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   360
      g_yyLineNr=1;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   361
      return fs;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   362
    }
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   363
    else if (alreadyIncluded)
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   364
    {
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   365
      return 0;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   366
    }
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   367
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   368
    s=g_pathList->next();
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   369
  } 
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   370
  return 0;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   371
}
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   372
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   373
static QCString extractTrailingComment(const char *s)
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   374
{
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   375
  if (s==0) return "";
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   376
  int i=strlen(s)-1;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   377
  while (i>=0)
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   378
  {
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   379
    char c=s[i];
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   380
    switch (c)
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   381
    {
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   382
      case '/':
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   383
	{
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   384
	  i--;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   385
	  if (i>=0 && s[i]=='*') // end of a comment block
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   386
	  {
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   387
	    i--;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   388
	    while (i>0 && !(s[i-1]=='/' && s[i]=='*')) i--;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   389
	    if (i==0) return s; else return &s[i-1];
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   390
	  }
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   391
	  else
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   392
	  {
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   393
	    return "";
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   394
	  }
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   395
	} 
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   396
	break;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   397
	// whitespace or line-continuation
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   398
      case ' ':
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   399
      case '\t': 
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   400
      case '\r':
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   401
      case '\n':
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   402
      case '\\':
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   403
	break;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   404
      default:
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   405
	return "";
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   406
    }
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   407
    i--;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   408
  }
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   409
  return "";
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   410
}
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   411
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   412
static int getNextChar(const QCString &expr,QCString *rest,uint &pos);
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   413
static int getCurrentChar(const QCString &expr,QCString *rest,uint pos);
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   414
static void unputChar(const QCString &expr,QCString *rest,uint &pos,char c);
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   415
static void expandExpression(QCString &expr,QCString *rest,int pos);
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   416
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   417
static QCString stringize(const QCString &s)
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   418
{
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   419
  QCString result;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   420
  uint i=0;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   421
  bool inString=FALSE;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   422
  bool inChar=FALSE;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   423
  char c,pc;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   424
  while (i<s.length())
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   425
  {
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   426
    if (!inString && !inChar)
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   427
    {
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   428
      while (i<s.length() && !inString && !inChar)
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   429
      {
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   430
	c=s.at(i++);
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   431
	if (c=='"')
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   432
	{
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   433
	  result+="\\\"";
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   434
	  inString=TRUE;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   435
	}
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   436
	else if (c=='\'')
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   437
	{
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   438
	  result+=c;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   439
	  inChar=TRUE;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   440
	}
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   441
	else
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   442
	{
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   443
	  result+=c;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   444
	}
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   445
      }
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   446
    }
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   447
    else if (inChar)
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   448
    {
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   449
      while (i<s.length() && inChar)
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   450
      {
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   451
	c=s.at(i++);
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   452
	if (c=='\'')
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   453
	{
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   454
	  result+='\'';
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   455
	  inChar=FALSE;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   456
	}
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   457
	else if (c=='\\')
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   458
	{
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   459
	  result+="\\\\";
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   460
	}
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   461
	else
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   462
	{
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   463
	  result+=c;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   464
	}
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   465
      }
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   466
    }
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   467
    else
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   468
    {
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   469
      pc=0;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   470
      while (i<s.length() && inString)
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   471
      {
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   472
	char c=s.at(i++);
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   473
	if (c=='"') 
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   474
	{
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   475
	  result+="\\\"";
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   476
	  inString= pc=='\\';
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   477
	}
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   478
	else if (c=='\\')
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   479
	  result+="\\\\";
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   480
	else
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   481
	  result+=c;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   482
	pc=c;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   483
      }
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   484
    }
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   485
  }
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   486
  //printf("stringize `%s'->`%s'\n",s.data(),result.data());
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   487
  return result;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   488
}
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   489
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   490
/*! Execute all ## operators in expr. 
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   491
 * If the macro name before or after the operator contains a no-rescan 
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   492
 * marker (@-) then this is removed (before the concatenated macro name
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   493
 * may be expanded again.
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   494
 */
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   495
static void processConcatOperators(QCString &expr)
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   496
{
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   497
  //printf("processConcatOperators: in=`%s'\n",expr.data());
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   498
  QRegExp r("[ \\t\\n]*##[ \\t\\n]*"); 
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   499
  int l,n,i=0;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   500
  if (expr.isEmpty()) return;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   501
  while ((n=r.match(expr,i,&l))!=-1)
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   502
  {
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   503
    //printf("Match: `%s'\n",expr.data()+i);
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   504
    if (n+l+1<(int)expr.length() && expr.at(n+l)=='@' && expr.at(n+l+1)=='-')
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   505
    {
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   506
      // remove no-rescan marker after ID
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   507
      l+=2;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   508
    }
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   509
    //printf("found `%s'\n",expr.mid(n,l).data());
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   510
    // remove the ## operator and the surrounding whitespace
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   511
    expr=expr.left(n)+expr.right(expr.length()-n-l);
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   512
    int k=n-1;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   513
    while (k>=0 && isId(expr.at(k))) k--; 
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   514
    if (k>0 && expr.at(k)=='-' && expr.at(k-1)=='@')
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   515
    {
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   516
      // remove no-rescan marker before ID
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   517
      expr=expr.left(k-1)+expr.right(expr.length()-k-1);
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   518
      n-=2;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   519
    }
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   520
    i=n;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   521
  }
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   522
  //printf("processConcatOperators: out=`%s'\n",expr.data());
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   523
}
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   524
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   525
static void yyunput (int c,char *buf_ptr  );
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   526
static void returnCharToStream(char c)
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   527
{
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   528
  unput(c);
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   529
}
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   530
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   531
static inline void addTillEndOfString(const QCString &expr,QCString *rest,
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   532
                                       uint &pos,char term,QCString &arg)
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   533
{
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   534
  int cc;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   535
  while ((cc=getNextChar(expr,rest,pos))!=EOF)
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   536
  {
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   537
    if (cc=='\\') arg+=(char)cc,cc=getNextChar(expr,rest,pos);
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   538
    else if (cc==term) return;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   539
    arg+=(char)cc;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   540
  }
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   541
}
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   542
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   543
/*! replaces the function macro \a def whose argument list starts at
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   544
 * \a pos in expression \a expr. 
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   545
 * Notice that this routine may scan beyond the \a expr string if needed.
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   546
 * In that case the characters will be read from the input file.
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   547
 * The replacement string will be returned in \a result and the 
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   548
 * length of the (unexpanded) argument list is stored in \a len.
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   549
 */ 
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   550
static bool replaceFunctionMacro(const QCString &expr,QCString *rest,int pos,int &len,const Define *def,QCString &result)
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   551
{
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   552
  //printf("replaceFunctionMacro(expr=%s,rest=%s,pos=%d,def=%s) level=%d\n",expr.data(),rest ? rest->data() : 0,pos,def->name.data(),g_level);
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   553
  uint j=pos;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   554
  len=0;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   555
  result.resize(0);
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   556
  int cc;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   557
  while ((cc=getCurrentChar(expr,rest,j))!=EOF && isspace(cc)) 
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   558
  { 
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   559
    len++; 
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   560
    getNextChar(expr,rest,j); 
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   561
  }
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   562
  if (cc!='(') 
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   563
  { 
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   564
    unputChar(expr,rest,j,' '); 
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   565
    return FALSE; 
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   566
  }
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   567
  getNextChar(expr,rest,j); // eat the `(' character
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   568
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   569
  QDict<QCString> argTable;  // list of arguments
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   570
  argTable.setAutoDelete(TRUE);
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   571
  QCString arg;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   572
  int argCount=0;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   573
  bool done=FALSE;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   574
  
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   575
  // PHASE 1: read the macro arguments
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   576
  if (def->nargs==0)
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   577
  {
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   578
    while ((cc=getNextChar(expr,rest,j))!=EOF)
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   579
    {
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   580
      char c = (char)cc;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   581
      if (c==')') break;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   582
    }
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   583
  }
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   584
  else
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   585
  {
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   586
    while (!done && (argCount<def->nargs || def->varArgs) && 
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   587
	((cc=getNextChar(expr,rest,j))!=EOF)
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   588
	  )
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   589
    {
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   590
      char c=(char)cc;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   591
      if (c=='(') // argument is a function => search for matching )
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   592
      {
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   593
	int level=1;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   594
	arg+=c;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   595
	//char term='\0';
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   596
	while ((cc=getNextChar(expr,rest,j))!=EOF)
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   597
	{
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   598
	  char c=(char)cc;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   599
	  //printf("processing %c: term=%c (%d)\n",c,term,term);
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   600
	  if (c=='\'' || c=='\"') // skip ('s and )'s inside strings
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   601
	  {
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   602
	    arg+=c;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   603
	    addTillEndOfString(expr,rest,j,c,arg);
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   604
	  }
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   605
	  if (c==')')
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   606
	  {
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   607
	    level--;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   608
	    arg+=c;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   609
	    if (level==0) break;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   610
	  }
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   611
	  else if (c=='(')
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   612
	  {
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   613
	    level++;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   614
	    arg+=c;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   615
	  }
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   616
	  else
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   617
	    arg+=c;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   618
	}
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   619
      }
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   620
      else if (c==')' || c==',') // last or next argument found
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   621
      {
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   622
	if (c==',' && argCount==def->nargs-1 && def->varArgs)
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   623
	{
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   624
	  arg=arg.stripWhiteSpace();
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   625
	  arg+=',';
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   626
	}
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   627
	else
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   628
	{
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   629
	  QCString argKey;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   630
	  argKey.sprintf("@%d",argCount++); // key name
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   631
	  arg=arg.stripWhiteSpace();
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   632
	  // add argument to the lookup table
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   633
	  argTable.insert(argKey, new QCString(arg));
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   634
	  arg.resize(0);
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   635
	  if (c==')') // end of the argument list
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   636
	  {
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   637
	    done=TRUE;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   638
	  }
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   639
	}
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   640
      } 
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   641
      else if (c=='\"') // append literal strings
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   642
      {
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   643
	arg+=c; 
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   644
	bool found=FALSE;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   645
	while (!found && (cc=getNextChar(expr,rest,j))!=EOF)
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   646
	{
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   647
	  found = cc=='"';
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   648
	  if (cc=='\\')
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   649
	  {
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   650
	    c=(char)cc;	  
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   651
	    arg+=c;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   652
	    if ((cc=getNextChar(expr,rest,j))==EOF) break;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   653
	  }
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   654
	  c=(char)cc;	  
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   655
	  arg+=c;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   656
	}
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   657
      }
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   658
      else if (c=='\'') // append literal characters
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   659
      {
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   660
	arg+=c;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   661
	bool found=FALSE;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   662
	while (!found && (cc=getNextChar(expr,rest,j))!=EOF)
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   663
	{
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   664
	  found = cc=='\'';
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   665
	  if (cc=='\\')
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   666
	  {
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   667
	    c=(char)cc;	  
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   668
	    arg+=c;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   669
	    if ((cc=getNextChar(expr,rest,j))==EOF) break;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   670
	  }
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   671
	  c=(char)cc;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   672
	  arg+=c;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   673
	}
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   674
      }	    
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   675
      else // append other characters
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   676
      {
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   677
	arg+=c;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   678
      }
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   679
    }
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   680
  }
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   681
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   682
  // PHASE 2: apply the macro function
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   683
  if (argCount==def->nargs || 
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   684
      (argCount>def->nargs && def->varArgs)) // matching parameters lists
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   685
  {
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   686
    uint k=0;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   687
    // substitution of all formal arguments
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   688
    QCString resExpr;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   689
    const QCString d=def->definition.stripWhiteSpace();
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   690
    //printf("Macro definition: %s\n",d.data());
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   691
    bool inString=FALSE;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   692
    while (k<d.length())
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   693
    {
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   694
      if (d.at(k)=='@') // maybe a marker, otherwise an escaped @
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   695
      {
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   696
	if (d.at(k+1)=='@') // escaped @ => copy it (is unescaped later)
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   697
	{
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   698
	  k+=2;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   699
	  resExpr+="@@"; // we unescape these later
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   700
	}
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   701
	else if (d.at(k+1)=='-') // no-rescan marker
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   702
	{
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   703
	  k+=2;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   704
	  resExpr+="@-";
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   705
	}
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   706
	else // argument marker => read the argument number
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   707
	{
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   708
	  QCString key="@";
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   709
	  QCString *subst=0;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   710
	  bool hash=FALSE;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   711
	  int l=k-1;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   712
	  // search for ## backward
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   713
	  if (l>=0 && d.at(l)=='"') l--;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   714
	  while (l>=0 && d.at(l)==' ') l--;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   715
	  if (l>0 && d.at(l)=='#' && d.at(l-1)=='#') hash=TRUE;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   716
	  k++;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   717
	  // scan the number
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   718
	  while (k<d.length() && d.at(k)>='0' && d.at(k)<='9') key+=d.at(k++);
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   719
	  if (!hash) 
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   720
	  {
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   721
	    // search for ## forward
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   722
	    l=k;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   723
	    if (l<(int)d.length() && d.at(l)=='"') l++;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   724
	    while (l<(int)d.length() && d.at(l)==' ') l++;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   725
	    if (l<(int)d.length()-1 && d.at(l)=='#' && d.at(l+1)=='#') hash=TRUE;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   726
	  }
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   727
	  //printf("request key %s result %s\n",key.data(),argTable[key]->data());
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   728
	  if (key.length()>1 && (subst=argTable[key])) 
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   729
	  {
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   730
	    QCString substArg=*subst;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   731
	    //printf("substArg=`%s'\n",substArg.data());
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   732
	    // only if no ## operator is before or after the argument
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   733
	    // marker we do macro expansion.
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   734
	    if (!hash) expandExpression(substArg,0,0);
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   735
	    if (inString)
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   736
	    {
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   737
	      //printf("`%s'=stringize(`%s')\n",stringize(*subst).data(),subst->data());
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   738
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   739
	      // if the marker is inside a string (because a # was put 
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   740
	      // before the macro name) we must escape " and \ characters
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   741
	      resExpr+=stringize(substArg);
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   742
	    }
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   743
	    else
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   744
	    {
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   745
	      if (hash && substArg.isEmpty())
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   746
	      {
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   747
		resExpr+="@E"; // empty argument will be remove later on
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   748
	      }
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   749
	      else if (g_nospaces)
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   750
	      {
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   751
	        resExpr+=substArg;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   752
	      }
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   753
	      else
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   754
	      {
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   755
	        resExpr+=" "+substArg+" ";
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   756
	      }
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   757
	    }
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   758
	  }
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   759
	}
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   760
      }
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   761
      else // no marker, just copy
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   762
      {
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   763
	if (!inString && d.at(k)=='\"') 
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   764
	{
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   765
	  inString=TRUE; // entering a literal string
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   766
	}
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   767
	else if (inString && d.at(k)=='\"' && (d.at(k-1)!='\\' || d.at(k-2)=='\\'))
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   768
	{
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   769
	  inString=FALSE; // leaving a literal string
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   770
	}
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   771
	resExpr+=d.at(k++);
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   772
      }
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   773
    }
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   774
    len=j-pos;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   775
    result=resExpr;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   776
    //printf("result after substitution `%s' expr=`%s'\n",
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   777
    //       result.data(),expr.mid(pos,len).data());
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   778
    return TRUE;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   779
  }
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   780
  return FALSE;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   781
}
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   782
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   783
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   784
/*! returns the next identifier in string \a expr by starting at position \a p.
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   785
 * The position of the identifier is returned (or -1 if nothing is found)
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   786
 * and \a l is its length. Any quoted strings are skipping during the search.
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   787
 */
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   788
static int getNextId(const QCString &expr,int p,int *l)
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   789
{
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   790
  int n;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   791
  while (p<(int)expr.length())
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   792
  {
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   793
    char c=expr.at(p++);
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   794
    if (isdigit(c)) // skip number
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   795
    {
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   796
      while (p<(int)expr.length() && isId(expr.at(p))) p++;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   797
    }
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   798
    else if (isalpha(c) || c=='_') // read id
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   799
    {
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   800
      n=p-1;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   801
      while (p<(int)expr.length() && isId(expr.at(p))) p++;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   802
      *l=p-n;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   803
      return n; 
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   804
    }
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   805
    else if (c=='"') // skip string
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   806
    {
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   807
      char ppc=0,pc=c;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   808
      if (p<(int)expr.length()) c=expr.at(p);
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   809
      while (p<(int)expr.length() && (c!='"' || (pc=='\\' && ppc!='\\'))) 
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   810
	// continue as long as no " is found, but ignoring \", but not \\"
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   811
      {
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   812
	ppc=pc;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   813
	pc=c;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   814
	c=expr.at(p);
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   815
	p++;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   816
      }
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   817
      if (p<(int)expr.length()) ++p; // skip closing quote
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   818
    }
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   819
    else if (c=='/') // skip C Comment
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   820
    {
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   821
      char pc=c;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   822
      if (p<(int)expr.length()) 
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   823
      {
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   824
	c=expr.at(++p);
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   825
        if (c=='*')  // Start of C comment
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   826
        { 
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   827
  	  while (p<(int)expr.length() && !(pc=='*' && c=='/'))
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   828
	  {
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   829
	    pc=c;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   830
	    c=expr.at(++p);
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   831
	  }
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   832
	  p++;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   833
        }
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   834
      }
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   835
    }
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   836
  }
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   837
  return -1;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   838
}
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   839
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   840
/*! preforms recursive macro expansion on the string \a expr
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   841
 *  starting at position \a pos.
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   842
 *  May read additional characters from the input while re-scanning!
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   843
 *  If \a expandAll is \c TRUE then all macros in the expression are
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   844
 *  expanded, otherwise only the first is expanded.
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   845
 */
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   846
static void expandExpression(QCString &expr,QCString *rest,int pos)
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   847
{
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   848
  //printf("expandExpression(%s,%s)\n",expr.data(),rest ? rest->data() : 0);
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   849
  QCString macroName;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   850
  QCString expMacro;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   851
  bool definedTest=FALSE;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   852
  int i=pos,l,p,len;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   853
  while ((p=getNextId(expr,i,&l))!=-1) // search for an macro name
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   854
  {
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   855
    bool replaced=FALSE;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   856
    macroName=expr.mid(p,l);
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   857
    if (p<2 || !(expr.at(p-2)=='@' && expr.at(p-1)=='-')) // no-rescan marker?
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   858
    {
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   859
      if (g_expandedDict->find(macroName)==0) // expand macro
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   860
      {
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   861
	Define *def=isDefined(macroName);
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   862
	if (definedTest) // macro name was found after defined 
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   863
	{
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   864
	  if (def) expMacro = " 1 "; else expMacro = " 0 ";
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   865
	  replaced=TRUE;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   866
	  len=l;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   867
	  definedTest=FALSE;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   868
	}
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   869
	else if (def && def->nargs==-1) // simple macro
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   870
	{
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   871
	  // substitute the definition of the macro
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   872
	  //printf("macro `%s'->`%s'\n",macroName.data(),def->definition.data());
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   873
	  if (g_nospaces)
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   874
	  {
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   875
	    expMacro=def->definition.stripWhiteSpace();
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   876
	  }
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   877
	  else
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   878
	  {
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   879
	    expMacro=" "+def->definition.stripWhiteSpace()+" ";
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   880
	  }
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   881
	  //expMacro=def->definition.stripWhiteSpace();
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   882
	  replaced=TRUE;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   883
	  len=l;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   884
	  //printf("simple macro expansion=`%s'->`%s'\n",macroName.data(),expMacro.data());
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   885
	}
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   886
	else if (def && def->nargs>=0) // function macro
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   887
	{
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   888
	  replaced=replaceFunctionMacro(expr,rest,p+l,len,def,expMacro);
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   889
	  len+=l;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   890
	}
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   891
        else if (macroName=="defined")
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   892
        {
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   893
  	  //printf("found defined inside macro definition '%s'\n",expr.right(expr.length()-p).data());
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   894
	  definedTest=TRUE;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   895
        }
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   896
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   897
	if (replaced) // expand the macro and rescan the expression
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   898
	{
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   899
	    
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   900
	  //printf("replacing `%s'->`%s'\n",expr.mid(p,len).data(),expMacro.data());
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   901
	  QCString resultExpr=expMacro;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   902
	  QCString restExpr=expr.right(expr.length()-len-p);
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   903
	  processConcatOperators(resultExpr);
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   904
	  if (def && !def->nonRecursive)
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   905
	  {
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   906
	    g_expandedDict->insert(macroName,def);
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   907
	    expandExpression(resultExpr,&restExpr,0);
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   908
	    g_expandedDict->remove(macroName);
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   909
	  }
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   910
	  expr=expr.left(p)+resultExpr+restExpr;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   911
	  i=p;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   912
	  //printf("new expression: %s\n",expr.data());
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   913
	}
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   914
	else // move to the next macro name
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   915
	{
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   916
	  //printf("moving to the next macro old=%d new=%d\n",i,p+l);
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   917
	  i=p+l;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   918
	}
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   919
      }
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   920
      else // move to the next macro name
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   921
      {
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   922
	expr=expr.left(p)+"@-"+expr.right(expr.length()-p);
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   923
	//printf("macro already expanded, moving to the next macro expr=%s\n",expr.data());
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   924
	i=p+l+2;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   925
	//i=p+l;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   926
      }
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   927
    }
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   928
    else // no re-scan marker found, skip the macro name
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   929
    {
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   930
      //printf("skipping marked macro\n");
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   931
      i=p+l;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   932
    }
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   933
  }
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   934
}
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   935
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   936
/*! replaces all occurrences of @@@@ in \a s by @@
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   937
 *  and removes all occurrences of @@E.
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   938
 *  All identifiers found are replaced by 0L
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   939
 */
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   940
QCString removeIdsAndMarkers(const char *s)
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   941
{
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   942
  //printf("removeIdsAndMarkers(%s)\n",s);
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   943
  const char *p=s;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   944
  char c;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   945
  bool inNum=FALSE;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   946
  QCString result;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   947
  if (p)
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   948
  {
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   949
    while ((c=*p))
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   950
    {
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   951
      if (c=='@') // replace @@ with @ and remove @E
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   952
      {
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   953
	if (*(p+1)=='@')
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   954
	{
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   955
	  result+=c; 
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   956
	}
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   957
	else if (*(p+1)=='E')
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   958
	{
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   959
	  // skip
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   960
	}
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   961
	p+=2;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   962
      }
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   963
      else if (isdigit(c)) // number
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   964
      {
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   965
	result+=c;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   966
	p++;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   967
        inNum=TRUE;	
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   968
      }
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   969
      else if (c=='d' && !inNum) // identifier starting with a `d'
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   970
      {
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   971
	if (strncmp(p,"defined ",8)==0 || strncmp(p,"defined(",8)==0) 
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   972
	           // defined keyword
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   973
	{
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   974
	  p+=7; // skip defined
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   975
	}
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   976
	else
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   977
	{
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   978
	  result+="0L";
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   979
	  p++;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   980
	  while ((c=*p) && isId(c)) p++;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   981
	}
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   982
      }
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   983
      else if ((isalpha(c) || c=='_') && !inNum) // replace identifier with 0L
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   984
      {
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   985
	result+="0L";
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   986
	p++;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   987
	while ((c=*p) && isId(c)) p++;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   988
      }
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   989
      else if (c=='/') // skip C comments
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   990
      {
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   991
	char pc=c;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   992
	c=*++p;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   993
	if (c=='*') // start of C comment
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   994
	{ 
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   995
	  while (*p && !(pc=='*' && c=='/')) // search end of comment
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   996
	  {
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   997
	    pc=c;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   998
	    c=*++p;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   999
	  }
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1000
	  p++;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1001
	}
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1002
	else // oops, not comment but division
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1003
	{
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1004
	  result+=pc;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1005
	  goto nextChar;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1006
	}
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1007
      }
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1008
      else 
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1009
      {
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1010
nextChar:
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1011
	result+=c;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1012
	char lc=tolower(c);
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1013
	if (!isId(lc) && lc!='.' && lc!='-' && lc!='+') inNum=FALSE;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1014
	p++;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1015
      }
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1016
    }
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1017
  }
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1018
  //printf("removeIdsAndMarkers(%s)=%s\n",s,result.data());
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1019
  return result;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1020
}
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1021
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1022
/*! replaces all occurrences of @@ in \a s by @
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1023
 *  \par assumption: 
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1024
 *   \a s only contains pairs of @@'s
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1025
 */
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1026
QCString removeMarkers(const char *s)
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1027
{
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1028
  const char *p=s;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1029
  char c;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1030
  QCString result;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1031
  if (p)
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1032
  {
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1033
    while ((c=*p))
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1034
    {
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1035
      switch(c)
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1036
      {
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1037
	case '@': // replace @@ with @
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1038
	  {
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1039
	    if (*(p+1)=='@')
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1040
	    {
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1041
	      result+=c; 
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1042
	    }
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1043
	    p+=2;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1044
	  }
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1045
	  break;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1046
	case '/': // skip C comments
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1047
	  {
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1048
	    result+=c;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1049
	    char pc=c;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1050
	    c=*++p;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1051
	    if (c=='*') // start of C comment
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1052
	    { 
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1053
	      while (*p && !(pc=='*' && c=='/')) // search end of comment
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1054
	      {
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1055
		if (*p=='@' && *(p+1)=='@') 
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1056
		  result+=c,p++;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1057
		else 
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1058
		  result+=c;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1059
		pc=c;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1060
		c=*++p;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1061
	      }
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1062
	      if (*p)
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1063
	      {
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1064
	        result+=c;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1065
	        p++;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1066
	      }
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1067
	    }
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1068
	  }
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1069
	  break;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1070
	case '"': // skip string literals
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1071
	  {
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1072
	    result+=c;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1073
	    char pc=c;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1074
	    c=*++p;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1075
	    while (*p && (c!='"' || pc=='\\')) // no end quote
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1076
	    {
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1077
	      result+=c;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1078
	      c=*++p;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1079
	    }
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1080
	  }
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1081
	  break;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1082
	case '\'': // skip char literals
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1083
	  {
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1084
	    result+=c;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1085
	    char pc=c;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1086
	    c=*++p;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1087
	    while (*p && (c!='\'' || pc=='\\')) // no end quote
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1088
	    {
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1089
	      result+=c;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1090
	      c=*++p;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1091
	    }
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1092
	  }
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1093
	  break;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1094
	default:
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1095
	  {
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1096
	    result+=c;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1097
	    p++;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1098
	  }
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1099
	  break;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1100
      }
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1101
    }
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1102
  }
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1103
  //printf("RemoveMarkers(%s)=%s\n",s,result.data());
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1104
  return result;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1105
}
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1106
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1107
/*! compute the value of the expression in string \a expr.
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1108
 *  If needed the function may read additional characters from the input.
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1109
 */
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1110
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1111
bool computeExpression(const QCString &expr)
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1112
{
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1113
  QCString e=expr;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1114
  expandExpression(e,0,0);
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1115
  //printf("after expansion `%s'\n",e.data());
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1116
  e = removeIdsAndMarkers(e);
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1117
  if (e.isEmpty()) return FALSE;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1118
  //printf("parsing `%s'\n",e.data());
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1119
  return parseCppExpression(g_yyFileName,g_yyLineNr,e);
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1120
}
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1121
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1122
/*! expands the macro definition in \a name
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1123
 *  If needed the function may read additional characters from the input
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1124
 */
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1125
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1126
QCString expandMacro(const QCString &name)
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1127
{
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1128
  QCString n=name;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1129
  expandExpression(n,0,0);
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1130
  n=removeMarkers(n);
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1131
  //printf("expandMacro `%s'->`%s'\n",name.data(),n.data());
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1132
  return n;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1133
}
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1134
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1135
Define *newDefine()
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1136
{
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1137
  Define *def=new Define;
4
468f4c8d3d5b Orb version 0.2.0
Jonathan Harrington <jonathan.harrington@nokia.com>
parents: 3
diff changeset
  1138
  def->name       = g_defName;
3
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1139
  def->definition = g_defText.stripWhiteSpace();
4
468f4c8d3d5b Orb version 0.2.0
Jonathan Harrington <jonathan.harrington@nokia.com>
parents: 3
diff changeset
  1140
  def->nargs      = g_defArgs;
468f4c8d3d5b Orb version 0.2.0
Jonathan Harrington <jonathan.harrington@nokia.com>
parents: 3
diff changeset
  1141
  def->fileName   = g_yyFileName; 
468f4c8d3d5b Orb version 0.2.0
Jonathan Harrington <jonathan.harrington@nokia.com>
parents: 3
diff changeset
  1142
  def->fileDef    = g_yyFileDef;
468f4c8d3d5b Orb version 0.2.0
Jonathan Harrington <jonathan.harrington@nokia.com>
parents: 3
diff changeset
  1143
  def->lineNr     = g_yyLineNr;
468f4c8d3d5b Orb version 0.2.0
Jonathan Harrington <jonathan.harrington@nokia.com>
parents: 3
diff changeset
  1144
  def->varArgs    = g_defVarArgs;
468f4c8d3d5b Orb version 0.2.0
Jonathan Harrington <jonathan.harrington@nokia.com>
parents: 3
diff changeset
  1145
  //printf("newDefine: %s->%s\n",def->name.data(),
468f4c8d3d5b Orb version 0.2.0
Jonathan Harrington <jonathan.harrington@nokia.com>
parents: 3
diff changeset
  1146
  //    def->fileDef ? def->fileDef->name().data() : "<none>");
3
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1147
  //printf("newDefine: `%s'->`%s'\n",def->name.data(),def->definition.data());
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1148
  if (!def->name.isEmpty() && Doxygen::expandAsDefinedDict[def->name])
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1149
  {
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1150
    def->isPredefined=TRUE;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1151
  }
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1152
  return def;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1153
}
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1154
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1155
void addDefine()
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1156
{
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1157
  if (g_skip) return; // do not add this define as it is inside a 
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1158
                      // conditional section (cond command) that is disabled.
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1159
  if (!Doxygen::gatherDefines) return;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1160
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1161
  //printf("addDefine %s %s\n",g_defName.data(),g_defArgsStr.data());
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1162
  //ArgumentList *al = new ArgumentList;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1163
  //stringToArgumentList(g_defArgsStr,al);
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1164
  MemberDef *md=new MemberDef(
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1165
      g_yyFileName,g_yyLineNr,
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1166
      "#define",g_defName,g_defArgsStr,0,
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1167
      Public,Normal,FALSE,Member,MemberDef::Define,0,0);
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1168
  if (!g_defArgsStr.isEmpty())
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1169
  {
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1170
    ArgumentList *argList = new ArgumentList;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1171
    //printf("addDefine() g_defName=`%s' g_defArgsStr=`%s'\n",g_defName.data(),g_defArgsStr.data());
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1172
    stringToArgumentList(g_defArgsStr,argList);
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1173
    md->setArgumentList(argList);
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1174
  }
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1175
  //printf("Setting initializer for `%s' to `%s'\n",g_defName.data(),g_defText.data());
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1176
  int l=g_defLitText.find('\n');
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1177
  if (l>0 && g_defLitText.left(l).stripWhiteSpace()=="\\")
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1178
  {
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1179
    // strip first line if it only contains a slash
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1180
    g_defLitText = g_defLitText.right(g_defLitText.length()-l-1);
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1181
  }
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1182
  else if (l>0)
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1183
  {
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1184
    // align the items on the first line with the items on the second line
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1185
    int k=l+1;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1186
    const char *p=g_defLitText.data()+k;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1187
    char c;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1188
    while ((c=*p++) && (c==' ' || c=='\t')) k++;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1189
    g_defLitText=g_defLitText.mid(l+1,k-l-1)+g_defLitText.stripWhiteSpace();
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1190
  }
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1191
  md->setInitializer(g_defLitText.stripWhiteSpace());
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1192
4
468f4c8d3d5b Orb version 0.2.0
Jonathan Harrington <jonathan.harrington@nokia.com>
parents: 3
diff changeset
  1193
  //printf("pre.l: md->setFileDef(%p)\n",g_inputFileDef);
3
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1194
  md->setFileDef(g_inputFileDef);
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1195
  md->setDefinition("#define "+g_defName);
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1196
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1197
  MemberName *mn=Doxygen::functionNameSDict->find(g_defName);
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1198
  if (mn==0)
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1199
  {
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1200
    mn = new MemberName(g_defName);
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1201
    Doxygen::functionNameSDict->append(g_defName,mn);
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1202
  }
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1203
  mn->append(md);
4
468f4c8d3d5b Orb version 0.2.0
Jonathan Harrington <jonathan.harrington@nokia.com>
parents: 3
diff changeset
  1204
  if (g_yyFileDef) 
468f4c8d3d5b Orb version 0.2.0
Jonathan Harrington <jonathan.harrington@nokia.com>
parents: 3
diff changeset
  1205
  {
468f4c8d3d5b Orb version 0.2.0
Jonathan Harrington <jonathan.harrington@nokia.com>
parents: 3
diff changeset
  1206
    g_yyFileDef->insertMember(md);
468f4c8d3d5b Orb version 0.2.0
Jonathan Harrington <jonathan.harrington@nokia.com>
parents: 3
diff changeset
  1207
  }
3
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1208
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1209
  //Define *d;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1210
  //if ((d=defineDict[g_defName])==0) defineDict.insert(g_defName,newDefine()); 
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1211
}
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1212
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1213
static inline void outputChar(char c)
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1214
{
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1215
	if (Config_getBool("PREPROCESS_INCLUDES")) {
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1216
		g_outputBuf->addChar(c);
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1217
	} else {
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1218
		// Only output if the initial translation unit
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1219
		if (g_includeStack.isEmpty() || g_curlyCount>0) {
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1220
			g_outputBuf->addChar(c);
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1221
		}
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1222
	}
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1223
}
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1224
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1225
static inline void outputArray(const char *a,int len)
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1226
{
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1227
	if (Config_getBool("PREPROCESS_INCLUDES")) {
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1228
		g_outputBuf->addArray(a,len);
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1229
	} else {
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1230
		// Only output if the initial translation unit
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1231
		if (g_includeStack.isEmpty() || g_curlyCount>0) {
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1232
			g_outputBuf->addArray(a,len);
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1233
		}
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1234
	}
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1235
}
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1236
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1237
static void readIncludeFile(const QCString &inc)
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1238
{
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1239
  if (!Config_getBool("SEARCH_INCLUDES")) return; // do not read include files
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1240
  uint i=0;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1241
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1242
  // find the start of the include file name
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1243
  while (i<inc.length() &&
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1244
         (inc.at(i)==' ' || inc.at(i)=='"' || inc.at(i)=='<')
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1245
        ) i++;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1246
  uint s=i;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1247
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1248
  // was it a local include?
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1249
  bool localInclude = s>0 && inc.at(s-1)=='"';
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1250
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1251
  // find the end of the include file name
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1252
  while (i<inc.length() && inc.at(i)!='"' && inc.at(i)!='>') i++;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1253
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1254
  if (s<inc.length() && i>s) // valid include file name found
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1255
  {
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1256
    // extract include path+name
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1257
    QCString incFileName=inc.mid(s,i-s).stripWhiteSpace();
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1258
4
468f4c8d3d5b Orb version 0.2.0
Jonathan Harrington <jonathan.harrington@nokia.com>
parents: 3
diff changeset
  1259
    QCString oldFileName = g_yyFileName;
3
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1260
    FileDef *oldFileDef  = g_yyFileDef;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1261
    int oldLineNr        = g_yyLineNr;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1262
    //printf("Searching for `%s'\n",incFileName.data());
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1263
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1264
    // findFile will overwrite g_yyFileDef if found
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1265
    FileState *fs;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1266
    bool alreadyIncluded = FALSE;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1267
    //printf("calling findFile(%s)\n",incFileName.data());
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1268
    if ((fs=findFile(incFileName,localInclude,alreadyIncluded))) // see if the include file can be found
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1269
    {
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1270
      //printf("Found include file!\n");
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1271
      if (Debug::isFlagSet(Debug::Preprocessor))
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1272
      {
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1273
        for (i=0;i<g_includeStack.count();i++) msg("  ");
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1274
        msg("#include %s: parsing...\n",incFileName.data());
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1275
      }
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1276
      if (oldFileDef)
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1277
      {
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1278
        // add include dependency to the file in which the #include was found
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1279
	    //Debug::print(Debug::IncludeGraph, 0, "pre.l readIncludeFile() adding dependency \"%s\" to \"%s\"\n", incFileName, oldFileDef->absFilePath().data());
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1280
        oldFileDef->addIncludeDependency(g_yyFileDef,incFileName,localInclude,g_isImported);
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1281
        // add included by dependency
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1282
        if (g_yyFileDef)
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1283
        {
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1284
          //printf("Adding include dependency %s->%s\n",oldFileDef->name().data(),incFileName.data());
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1285
          g_yyFileDef->addIncludedByDependency(oldFileDef,oldFileDef->docName(),localInclude,g_isImported);
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1286
        }
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1287
      }
4
468f4c8d3d5b Orb version 0.2.0
Jonathan Harrington <jonathan.harrington@nokia.com>
parents: 3
diff changeset
  1288
      fs->bufState = YY_CURRENT_BUFFER;
468f4c8d3d5b Orb version 0.2.0
Jonathan Harrington <jonathan.harrington@nokia.com>
parents: 3
diff changeset
  1289
      fs->lineNr   = oldLineNr;
468f4c8d3d5b Orb version 0.2.0
Jonathan Harrington <jonathan.harrington@nokia.com>
parents: 3
diff changeset
  1290
      fs->fileName = oldFileName;
3
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1291
      // push the state on the stack
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1292
      g_includeStack.push(fs);
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1293
      // set the scanner to the include file
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1294
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1295
      // Deal with file changes due to 
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1296
      // #include's within { .. } blocks
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1297
      QCString lineStr(g_yyFileName.length()+20);
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1298
      lineStr.sprintf("# 1 \"%s\" 1\n",g_yyFileName.data());
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1299
      outputArray(lineStr.data(),lineStr.length());
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1300
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1301
      //fprintf(stderr,"Switching to include file %s\n",incFileName.data());
4
468f4c8d3d5b Orb version 0.2.0
Jonathan Harrington <jonathan.harrington@nokia.com>
parents: 3
diff changeset
  1302
      g_expectGuard=TRUE;
468f4c8d3d5b Orb version 0.2.0
Jonathan Harrington <jonathan.harrington@nokia.com>
parents: 3
diff changeset
  1303
      g_inputBuf   = &fs->fileBuf;
3
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1304
      g_inputBufPos=0;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1305
      yy_switch_to_buffer(yy_create_buffer(0, YY_BUF_SIZE));
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1306
    }
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1307
    else
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1308
    {
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1309
      //printf("  calling findFile(%s) alreadyInc=%d\n",incFileName.data(),alreadyIncluded);
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1310
      if (oldFileDef)
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1311
      {
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1312
	bool ambig;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1313
	FileDef *fd = findFileDef(Doxygen::inputNameDict,incFileName,ambig);
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1314
	//printf("findFileDef(%s)=%p\n",incFileName.data(),fd);
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1315
	// add include dependency to the file in which the #include was found
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1316
	oldFileDef->addIncludeDependency(fd,incFileName,localInclude,g_isImported);
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1317
	// add included by dependency
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1318
        if (fd)
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1319
        {
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1320
          //printf("Adding include dependency (2) %s->%s ambig=%d\n",oldFileDef->name().data(),fd->name().data(),ambig);
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1321
          fd->addIncludedByDependency(oldFileDef,oldFileDef->docName(),localInclude,g_isImported);
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1322
        }
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1323
      }
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1324
      if (Debug::isFlagSet(Debug::Preprocessor))
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1325
      {
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1326
        msg("#include %s: not found or already included! skipping...\n",incFileName.data());
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1327
        //printf("Error: include file %s not found\n",yytext);
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1328
      }
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1329
      if (g_curlyCount>0 && !alreadyIncluded) // failed to find #include inside { ... }
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1330
      {
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1331
	warn(g_yyFileName,g_yyLineNr,"Warning: include file %s not found, perhaps you forgot to add its directory to INCLUDE_PATH?",incFileName.data());
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1332
      }
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1333
    }
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1334
  }
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1335
}
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1336
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1337
/* ----------------------------------------------------------------- */
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1338
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1339
static void startCondSection(const char *sectId)
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1340
{
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1341
  g_condStack.push(new bool(g_skip));
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1342
  if (Config_getList("ENABLED_SECTIONS").find(sectId)==-1)
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1343
  {
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1344
    g_skip=TRUE;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1345
  }
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1346
}
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1347
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1348
static void endCondSection()
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1349
{
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1350
  if (g_condStack.isEmpty())
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1351
  {
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1352
    g_skip=FALSE;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1353
  }
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1354
  else
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1355
  {
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1356
    bool *ctx = g_condStack.pop();
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1357
    g_skip=*ctx;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1358
  }
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1359
}
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1360
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1361
static QCString escapeAt(const char *text)
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1362
{
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1363
  QCString result;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1364
  if (text)
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1365
  {
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1366
    char c;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1367
    const char *p=text;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1368
    while ((c=*p++))
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1369
    {
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1370
      if (c=='@') result+="@@"; else result+=c;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1371
    }
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1372
  }
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1373
  return result;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1374
}
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1375
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1376
static char resolveTrigraph(char c)
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1377
{
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1378
  switch (c)
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1379
  {
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1380
    case '=': return '#';
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1381
    case '/': return '\\';
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1382
    case '\'': return '^';
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1383
    case '(': return '[';
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1384
    case ')': return ']';
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1385
    case '!': return '|';
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1386
    case '<': return '{';
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1387
    case '>': return '}';
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1388
    case '-': return '~';
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1389
  }
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1390
  return '?';
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1391
}
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1392
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1393
/* ----------------------------------------------------------------- */
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1394
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1395
#undef  YY_INPUT
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1396
#define YY_INPUT(buf,result,max_size) result=yyread(buf,max_size);
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1397
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1398
static int yyread(char *buf,int max_size)
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1399
{
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1400
  int bytesInBuf = g_inputBuf->curPos()-g_inputBufPos;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1401
  int bytesToCopy = QMIN(max_size,bytesInBuf);
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1402
  memcpy(buf,g_inputBuf->data()+g_inputBufPos,bytesToCopy);
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1403
  g_inputBufPos+=bytesToCopy;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1404
  return bytesToCopy;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1405
}
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1406
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1407
/* ----------------------------------------------------------------- */
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1408
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1409
%}
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1410
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1411
ID	[a-z_A-Z][a-z_A-Z0-9]*
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1412
B       [ \t]
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1413
BN	[ \t\r\n]
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1414
CHARLIT   (("'"\\[0-7]{1,3}"'")|("'"\\."'")|("'"[^'\\\n]{1,4}"'"))
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1415
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1416
%option noyywrap
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1417
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1418
%x      Start
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1419
%x	Command
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1420
%x	SkipCommand
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1421
%x	SkipLine
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1422
%x	CopyLine
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1423
%x	CopyString
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1424
%x      Include
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1425
%x      IncludeID
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1426
%x      EndImport
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1427
%x	DefName
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1428
%x	DefineArg
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1429
%x	DefineText
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1430
%x      SkipCPPBlock
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1431
%x      Ifdef
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1432
%x      Ifndef
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1433
%x	SkipCComment
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1434
%x	CopyCComment
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1435
%x	SkipVerbatim
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1436
%x	SkipCPPComment
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1437
%x	RemoveCComment
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1438
%x	RemoveCPPComment
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1439
%x	Guard
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1440
%x	DefinedExpr1
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1441
%x	DefinedExpr2
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1442
%x	SkipDoubleQuote
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1443
%x	SkipSingleQuote
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1444
%x	UndefName
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1445
%x	IgnoreLine
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1446
%x	FindDefineArgs
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1447
%x	ReadString
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1448
%x	CondLine
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1449
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1450
%%
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1451
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1452
<*>\x06					
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1453
<*>\x00
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1454
<*>\r
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1455
<*>"??"[=/'()!<>-]			{ // Trigraph
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1456
  					  unput(resolveTrigraph(yytext[2]));
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1457
  					}
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1458
<Start>^{B}*"#"				{ BEGIN(Command); }
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1459
<Start>^{B}*/[^#]			{
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1460
 					  outputArray(yytext,yyleng); 
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1461
  					  BEGIN(CopyLine); 
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1462
					}
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1463
<Start>^{B}*[_A-Z][_A-Z0-9]*{B}*"("[^\)\n]*")"/{BN}{1,10}*[:{] { // constructors?
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1464
					  int i;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1465
					  for (i=yyleng-1;i>=0;i--)
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1466
					  {
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1467
					    unput(yytext[i]);
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1468
					  }
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1469
					  BEGIN(CopyLine);
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1470
                                        }
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1471
<Start>^{B}*[_A-Z][_A-Z0-9]*{B}*"("[^\(\)\n]*"("[^\)\n]*")"[^\)\n]*")"{B}*\n | // function list macro with one (...) argument, e.g. for K_GLOBAL_STATIC_WITH_ARGS
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1472
<Start>^{B}*[_A-Z][_A-Z0-9]*{B}*"("[^\)\n]*")"{B}*\n { // function like macro
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1473
  					  static bool skipFuncMacros = Config_getBool("SKIP_FUNCTION_MACROS");
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1474
					  QCString name(yytext);
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1475
					  name=name.left(name.find('(')).stripWhiteSpace();
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1476
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1477
					  Define *def=0;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1478
					  if (skipFuncMacros && 
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1479
					      name!="Q_PROPERTY" &&
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1480
					      !(
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1481
					         (g_includeStack.isEmpty() || g_curlyCount>0) &&
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1482
					         g_macroExpansion &&
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1483
					         (def=g_fileDefineDict->find(name)) &&
4
468f4c8d3d5b Orb version 0.2.0
Jonathan Harrington <jonathan.harrington@nokia.com>
parents: 3
diff changeset
  1484
						 macroIsAccessible(def) &&
3
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1485
					         (!g_expandOnlyPredef || def->isPredefined)
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1486
					       )
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1487
					     )
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1488
					  {
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1489
					    outputChar('\n');
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1490
					    g_yyLineNr++;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1491
					  }
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1492
					  else // don't skip
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1493
					  {
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1494
					    int i;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1495
					    for (i=yyleng-1;i>=0;i--)
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1496
					    {
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1497
					      unput(yytext[i]);
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1498
					    }
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1499
					    BEGIN(CopyLine);
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1500
					  }
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1501
  					}
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1502
<CopyLine>"extern"{BN}{0,80}"\"C\""*{BN}{0,80}"{"	{
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1503
                                          QCString text=yytext;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1504
  					  g_yyLineNr+=text.contains('\n');
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1505
					  outputArray(yytext,yyleng);
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1506
  					}
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1507
<CopyLine>"{"				{ // count brackets inside the main file
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1508
  					  if (g_includeStack.isEmpty()) 
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1509
					  {
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1510
					    g_curlyCount++;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1511
					  }
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1512
					  outputChar(*yytext);
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1513
  					}
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1514
<CopyLine>"}"				{ // count brackets inside the main file
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1515
  					  if (g_includeStack.isEmpty() && g_curlyCount>0) 
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1516
					  {
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1517
					    g_curlyCount--;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1518
					  }
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1519
					  outputChar(*yytext);
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1520
  					}
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1521
<CopyLine>"'"\\[0-7]{1,3}"'"		{ 
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1522
  					  outputArray(yytext,yyleng);
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1523
					}
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1524
<CopyLine>"'"\\."'"			{ 
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1525
  					  outputArray(yytext,yyleng);
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1526
					}
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1527
<CopyLine>"'"."'"			{ 
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1528
  					  outputArray(yytext,yyleng);
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1529
					}
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1530
<CopyLine>\"				{
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1531
					  outputChar(*yytext);
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1532
					  BEGIN( CopyString );
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1533
					}
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1534
<CopyString>[^\"\\\r\n]+		{
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1535
  					  outputArray(yytext,yyleng);
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1536
					}
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1537
<CopyString>\\.				{
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1538
					  outputArray(yytext,yyleng);
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1539
					}
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1540
<CopyString>\"				{
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1541
					  outputChar(*yytext);
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1542
					  BEGIN( CopyLine );
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1543
					}
4
468f4c8d3d5b Orb version 0.2.0
Jonathan Harrington <jonathan.harrington@nokia.com>
parents: 3
diff changeset
  1544
<CopyLine>{ID}/{BN}{0,80}"("		{
468f4c8d3d5b Orb version 0.2.0
Jonathan Harrington <jonathan.harrington@nokia.com>
parents: 3
diff changeset
  1545
  					  g_expectGuard = FALSE;
3
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1546
  					  Define *def=0;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1547
					  def=g_fileDefineDict->find(yytext);
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1548
					  //printf("Search for define %s found=%d g_includeStack.count()=%d "
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1549
					  //       "g_curlyCount=%d g_macroExpansion=%d g_expandOnlyPredef=%d "
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1550
					  //	 "isPreDefined=%d tu=%d\n",yytext,def ? 1 : 0,
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1551
					  //	 g_includeStack.count(),g_curlyCount,g_macroExpansion,g_expandOnlyPredef,
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1552
					  //	 def ? def->isPredefined : -1,
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1553
					  //	 Config_getBool("PREPROCCESS_FULL_TU")
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1554
					  //	);
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1555
					  if ((g_includeStack.isEmpty() || g_curlyCount>0 || Config_getBool("PREPROCCESS_FULL_TU")) &&
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1556
					      g_macroExpansion &&
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1557
					      (def=g_fileDefineDict->find(yytext)) &&
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1558
					      (!g_expandOnlyPredef || def->isPredefined || Config_getBool("PREPROCCESS_FULL_TU"))
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1559
					     )
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1560
					  {
4
468f4c8d3d5b Orb version 0.2.0
Jonathan Harrington <jonathan.harrington@nokia.com>
parents: 3
diff changeset
  1561
					    //printf("Found it! #args=%d\n",def->nargs);
3
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1562
					    g_roundCount=0;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1563
					    g_defArgsStr=yytext;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1564
					    if (def->nargs==-1) // no function macro
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1565
					    {
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1566
					      QCString result = expandMacro(g_defArgsStr);
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1567
					      outputArray(result,result.length());
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1568
					    }
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1569
					    else // zero or more arguments
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1570
					    {
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1571
					      g_findDefArgContext = CopyLine;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1572
					      BEGIN(FindDefineArgs);
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1573
					    }
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1574
					  }
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1575
					  else
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1576
					  {
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1577
					    outputArray(yytext,yyleng);
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1578
					  }
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1579
  					}
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1580
<CopyLine>{ID}				{
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1581
                                          Define *def=0;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1582
					  //printf("Search for define %s\n",yytext);
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1583
  					  if ((g_includeStack.isEmpty() || g_curlyCount>0) && 
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1584
					      g_macroExpansion &&
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1585
					      (def=g_fileDefineDict->find(yytext)) &&
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1586
					      def->nargs==-1 &&
4
468f4c8d3d5b Orb version 0.2.0
Jonathan Harrington <jonathan.harrington@nokia.com>
parents: 3
diff changeset
  1587
				              macroIsAccessible(def) &&
3
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1588
					      (!g_expandOnlyPredef || def->isPredefined)
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1589
					     )
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1590
					  {
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1591
					    //printf("Found it!\n");
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1592
                                            QCString name=yytext;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1593
					    QCString result=expandMacro(name); 
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1594
					    //printf("result=`%s'\n",result.data());
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1595
					    outputArray(result,result.length());
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1596
					  }
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1597
					  else
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1598
					  {
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1599
					    outputArray(yytext,yyleng);
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1600
					  }
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1601
  					}
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1602
<CopyLine>"\\"\r?/\n			{ // strip line continuation characters
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1603
  					}
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1604
<CopyLine>.				{
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1605
  					  outputChar(*yytext);
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1606
  					}
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1607
<CopyLine>\n				{
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1608
  					  outputChar('\n');
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1609
					  BEGIN(Start);
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1610
					  g_yyLineNr++;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1611
  					}
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1612
<FindDefineArgs>"("			{
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1613
  					  g_defArgsStr+='(';
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1614
  					  g_roundCount++;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1615
  					}
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1616
<FindDefineArgs>")"			{
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1617
  					  g_defArgsStr+=')';
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1618
					  g_roundCount--;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1619
					  if (g_roundCount==0)
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1620
					  {
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1621
					    QCString result=expandMacro(g_defArgsStr);
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1622
					    //printf("g_defArgsStr=`%s'->`%s'\n",g_defArgsStr.data(),result.data());
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1623
					    if (g_findDefArgContext==CopyLine)
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1624
					    {
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1625
					      outputArray(result,result.length());
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1626
					      BEGIN(g_findDefArgContext);
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1627
					    }
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1628
					    else // g_findDefArgContext==IncludeID
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1629
					    {
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1630
					      readIncludeFile(result);
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1631
					      g_nospaces=FALSE;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1632
					      BEGIN(Start);
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1633
					    }
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1634
					  }
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1635
  					}
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1636
  /*
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1637
<FindDefineArgs>")"{B}*"("		{
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1638
  					  g_defArgsStr+=yytext;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1639
  					}
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1640
  */
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1641
<FindDefineArgs>{CHARLIT}		{
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1642
  					  g_defArgsStr+=yytext;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1643
  					}
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1644
<FindDefineArgs>\"			{
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1645
  					  g_defArgsStr+=*yytext;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1646
  					  BEGIN(ReadString);
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1647
  					}
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1648
<FindDefineArgs>\n			{
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1649
  					  g_yyLineNr++;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1650
					  outputChar('\n');
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1651
  					}
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1652
<FindDefineArgs>"@"			{
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1653
  					  g_defArgsStr+="@@";
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1654
  					}
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1655
<FindDefineArgs>.			{
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1656
  					  g_defArgsStr+=*yytext;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1657
  					}
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1658
<ReadString>"\""			{
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1659
  					  g_defArgsStr+=*yytext;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1660
					  BEGIN(FindDefineArgs);
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1661
  					}
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1662
<ReadString>"//"|"/*"			{
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1663
  					  g_defArgsStr+=yytext;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1664
  					}
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1665
<ReadString>\\.				{
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1666
  					  g_defArgsStr+=yytext;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1667
  					}
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1668
<ReadString>.				{
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1669
  					  g_defArgsStr+=*yytext;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1670
  					}
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1671
<Command>("include"|"import"){B}+/{ID}	{
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1672
  					  g_isImported = yytext[1]=='m';
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1673
  					  if (g_macroExpansion) 
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1674
					    BEGIN(IncludeID);
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1675
  					}
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1676
<Command>("include"|"import"){B}*[<"]	{ 
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1677
  					  g_isImported = yytext[1]=='m';
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1678
					  char c[2];
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1679
					  c[0]=yytext[yyleng-1];c[1]='\0';
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1680
					  g_incName=c;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1681
  					  BEGIN(Include); 
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1682
					}
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1683
<Command>("cmake")?"define"{B}+		{ 
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1684
  			                  //printf("!!!DefName\n"); 
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1685
  					  BEGIN(DefName); 
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1686
					}
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1687
<Command>"ifdef"/{B}*"("		{
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1688
  					  incrLevel();
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1689
					  g_guardExpr.resize(0);
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1690
  					  BEGIN(DefinedExpr2);
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1691
  					}
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1692
<Command>"ifdef"/{B}+			{
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1693
  					  //printf("Pre.l: ifdef\n");
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1694
  					  incrLevel();
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1695
					  g_guardExpr.resize(0);
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1696
  					  BEGIN(DefinedExpr1);
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1697
  					}
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1698
<Command>"ifndef"/{B}*"("		{
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1699
  					  incrLevel();
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1700
					  g_guardExpr="! ";
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1701
  					  BEGIN(DefinedExpr2);
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1702
					}
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1703
<Command>"ifndef"/{B}+			{
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1704
  					  incrLevel();
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1705
					  g_guardExpr="! ";
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1706
  					  BEGIN(DefinedExpr1);
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1707
  					}
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1708
<Command>"if"/[ \t(!]			{
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1709
  					  incrLevel();
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1710
					  g_guardExpr.resize(0);
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1711
					  BEGIN(Guard);
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1712
					}
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1713
<Command>("elif"|"else"{B}*"if")/[ \t(!]	{
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1714
  					  if (!otherCaseDone())
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1715
					  {
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1716
					    g_guardExpr.resize(0);
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1717
					    BEGIN(Guard);  
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1718
					  }
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1719
					  else
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1720
					  {
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1721
					    g_ifcount=0;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1722
					    BEGIN(SkipCPPBlock);
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1723
					  }
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1724
  					}
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1725
<Command>"else"/[^a-z_A-Z0-9]		{
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1726
					  //printf("else g_levelGuard[%d]=%d\n",g_level-1,g_levelGuard[g_level-1]);
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1727
  					  if (otherCaseDone())
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1728
					  {
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1729
					    g_ifcount=0;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1730
					    BEGIN(SkipCPPBlock);
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1731
					  }
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1732
					  else
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1733
					  {
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1734
					    setCaseDone(TRUE);
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1735
					    //g_levelGuard[g_level-1]=TRUE;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1736
					  } 
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1737
  					}
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1738
<Command>"undef"{B}+			{
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1739
  					  BEGIN(UndefName);
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1740
  					}
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1741
<Command>("elif"|"else"{B}*"if")/[ \t(!]	{
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1742
  					  if (!otherCaseDone())
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1743
					  {
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1744
					    g_guardExpr.resize(0);
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1745
  					    BEGIN(Guard);
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1746
					  }
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1747
  					}
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1748
<Command>"endif"/[^a-z_A-Z0-9]		{
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1749
  					  //printf("Pre.l: #endif\n");
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1750
  					  decrLevel();
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1751
  					}
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1752
<Command,IgnoreLine>\n			{
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1753
  					  outputChar('\n');
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1754
  					  BEGIN(Start);
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1755
					  g_yyLineNr++;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1756
  					}
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1757
<Command>{ID}				{ // unknown directive
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1758
					  BEGIN(IgnoreLine);
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1759
					}
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1760
<IgnoreLine>\\[\r]?\n			{
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1761
  					  outputChar('\n');
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1762
					  g_yyLineNr++;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1763
					}
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1764
<IgnoreLine>.
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1765
<Command>.
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1766
<UndefName>{ID}				{
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1767
  					  Define *def;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1768
  					  if ((def=isDefined(yytext)) 
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1769
					      /*&& !def->isPredefined*/
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1770
					      && !def->nonRecursive
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1771
					     )
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1772
					  {
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1773
					    //printf("undefining %s\n",yytext);
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1774
					    def->undef=TRUE;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1775
					  }
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1776
					  BEGIN(Start);
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1777
  					}
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1778
<Guard>\\[\r]?\n			{
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1779
  					  outputChar('\n');
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1780
  					  g_guardExpr+=' ';
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1781
					  g_yyLineNr++;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1782
  					}
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1783
<Guard>"defined"/{B}*"("		{
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1784
    					  BEGIN(DefinedExpr2);
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1785
    					}
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1786
<Guard>"defined"/{B}+			{
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1787
    					  BEGIN(DefinedExpr1);
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1788
    					}
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1789
<Guard>{ID}				{ g_guardExpr+=yytext; }
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1790
<Guard>.				{ g_guardExpr+=*yytext; }
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1791
<Guard>\n				{
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1792
  					  unput(*yytext);
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1793
  					  //printf("Guard: `%s'\n",
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1794
					  //    g_guardExpr.data());
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1795
					  bool guard=computeExpression(g_guardExpr);
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1796
					  setCaseDone(guard);
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1797
					  //printf("if g_levelGuard[%d]=%d\n",g_level-1,g_levelGuard[g_level-1]);
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1798
					  if (guard)
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1799
					  {
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1800
					    BEGIN(Start);
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1801
					  } 
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1802
					  else
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1803
					  {
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1804
					    g_ifcount=0;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1805
					    BEGIN(SkipCPPBlock);
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1806
					  }
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1807
  					}
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1808
<DefinedExpr1,DefinedExpr2>\\\n		{ g_yyLineNr++; outputChar('\n'); }
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1809
<DefinedExpr1>{ID}			{
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1810
  					  if (isDefined(yytext))
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1811
					    g_guardExpr+=" 1L ";
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1812
					  else
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1813
					    g_guardExpr+=" 0L ";
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1814
					  g_lastGuardName=yytext;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1815
					  BEGIN(Guard);
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1816
  					}
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1817
<DefinedExpr2>{ID}			{
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1818
  					  if (isDefined(yytext))
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1819
					    g_guardExpr+=" 1L ";
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1820
					  else
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1821
					    g_guardExpr+=" 0L ";
4
468f4c8d3d5b Orb version 0.2.0
Jonathan Harrington <jonathan.harrington@nokia.com>
parents: 3
diff changeset
  1822
					  g_lastGuardName=yytext;
3
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1823
  					}
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1824
<DefinedExpr1,DefinedExpr2>\n		{ // should not happen, handle anyway
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1825
                                          g_yyLineNr++;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1826
  					  g_ifcount=0;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1827
 					  BEGIN(SkipCPPBlock); 
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1828
					}
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1829
<DefinedExpr2>")"			{
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1830
  					  BEGIN(Guard);
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1831
  					}
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1832
<DefinedExpr1,DefinedExpr2>.
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1833
<SkipCPPBlock>^{B}*"#"			{ BEGIN(SkipCommand); }
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1834
<SkipCPPBlock>^{B}*/[^#]		{ BEGIN(SkipLine); }
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1835
<SkipCPPBlock>\n			{ g_yyLineNr++; outputChar('\n'); }
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1836
<SkipCPPBlock>.
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1837
<SkipCommand>"if"(("n")?("def"))?/[ \t(!]	{ 
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1838
  					  incrLevel();
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1839
                                          g_ifcount++; 
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1840
  					  //printf("#if... depth=%d\n",g_ifcount);
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1841
					}
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1842
<SkipCommand>"else"			{
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1843
					  //printf("Else! g_ifcount=%d otherCaseDone=%d\n",g_ifcount,otherCaseDone());
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1844
  					  if (g_ifcount==0 && !otherCaseDone())
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1845
					  {
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1846
					    setCaseDone(TRUE);
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1847
  					    //outputChar('\n');
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1848
					    BEGIN(Start);
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1849
					  }
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1850
  					}
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1851
<SkipCommand>("elif"|"else"{B}*"if")/[ \t(!]		{
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1852
  					  if (g_ifcount==0) 
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1853
					  {
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1854
  					    if (!otherCaseDone())
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1855
					    {
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1856
					      g_guardExpr.resize(0);
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1857
					      g_lastGuardName.resize(0);
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1858
  					      BEGIN(Guard);
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1859
					    }
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1860
					    else
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1861
					    {
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1862
					      BEGIN(SkipCPPBlock);
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1863
					    }
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1864
					  }
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1865
					}
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1866
<SkipCommand>"endif"			{ 
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1867
  					  decrLevel();
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1868
  				          if (--g_ifcount<0)
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1869
  					  {
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1870
  					    //outputChar('\n');
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1871
					    BEGIN(Start);
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1872
					  }
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1873
					}
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1874
<SkipCommand>\n				{ 
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1875
  					  outputChar('\n');
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1876
  					  g_yyLineNr++; 
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1877
					  BEGIN(SkipCPPBlock);
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1878
					}
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1879
<SkipCommand>{ID}			{ // unknown directive 
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1880
  					  BEGIN(SkipLine); 
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1881
					}
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1882
<SkipCommand>.
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1883
<SkipLine>[^/\n]+			
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1884
<SkipLine>.
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1885
<SkipLine,SkipCommand,SkipCPPBlock>"//"[^\n]* {
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1886
  					  g_lastCPPContext=YY_START;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1887
  					  BEGIN(RemoveCPPComment);
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1888
					}
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1889
<SkipLine,SkipCommand,SkipCPPBlock>"/*"/[^\n]* {
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1890
					  g_lastCContext=YY_START;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1891
  					  BEGIN(RemoveCComment);
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1892
  					}
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1893
<SkipLine>\n				{
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1894
  					  outputChar('\n');
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1895
					  g_yyLineNr++;  
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1896
					  BEGIN(SkipCPPBlock);
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1897
					}
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1898
<IncludeID>{ID}{B}*/"("			{
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1899
  					  g_nospaces=TRUE;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1900
				          g_roundCount=0;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1901
					  g_defArgsStr=yytext;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1902
					  g_findDefArgContext = IncludeID;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1903
					  BEGIN(FindDefineArgs);
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1904
					}
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1905
<IncludeID>{ID}				{
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1906
  					  g_nospaces=TRUE;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1907
                                          readIncludeFile(expandMacro(yytext));
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1908
					  BEGIN(Start);
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1909
  					}
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1910
<Include>[^\">\n]+[\">]			{ 
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1911
					  g_incName+=yytext;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1912
					  readIncludeFile(g_incName);
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1913
					  if (g_isImported)
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1914
					  {
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1915
					    BEGIN(EndImport);
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1916
					  }
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1917
					  else
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1918
					  {
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1919
					    BEGIN(Start);
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1920
					  }
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1921
  					}
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1922
<EndImport>[^\\\n]*/\n			{
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1923
  					  BEGIN(Start);
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1924
  					}
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1925
<EndImport>\\[\r]?"\n"			{ 
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1926
					  outputChar('\n');
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1927
					  g_yyLineNr++;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1928
					}
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1929
<EndImport>.				{
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1930
  					}
4
468f4c8d3d5b Orb version 0.2.0
Jonathan Harrington <jonathan.harrington@nokia.com>
parents: 3
diff changeset
  1931
<DefName>{ID}/"("			{ // define with argument
3
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1932
  					  //printf("Define() `%s'\n",yytext);
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1933
					  g_argDict = new QDict<int>(31);
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1934
					  g_argDict->setAutoDelete(TRUE);
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1935
					  g_defArgs = 0; 
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1936
                                          g_defArgsStr.resize(0);
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1937
					  g_defText.resize(0);
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1938
					  g_defLitText.resize(0);
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1939
					  g_defName = yytext;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1940
					  g_defVarArgs = FALSE;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1941
					  BEGIN(DefineArg);
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1942
  					}
4
468f4c8d3d5b Orb version 0.2.0
Jonathan Harrington <jonathan.harrington@nokia.com>
parents: 3
diff changeset
  1943
<DefName>{ID}{B}+"1"			{ // special case: define with 1 -> can be "guard"
468f4c8d3d5b Orb version 0.2.0
Jonathan Harrington <jonathan.harrington@nokia.com>
parents: 3
diff changeset
  1944
  					  //printf("Define `%s'\n",yytext);
468f4c8d3d5b Orb version 0.2.0
Jonathan Harrington <jonathan.harrington@nokia.com>
parents: 3
diff changeset
  1945
  					  g_argDict = 0;
468f4c8d3d5b Orb version 0.2.0
Jonathan Harrington <jonathan.harrington@nokia.com>
parents: 3
diff changeset
  1946
					  g_defArgs = -1;
468f4c8d3d5b Orb version 0.2.0
Jonathan Harrington <jonathan.harrington@nokia.com>
parents: 3
diff changeset
  1947
                                          g_defArgsStr.resize(0);
468f4c8d3d5b Orb version 0.2.0
Jonathan Harrington <jonathan.harrington@nokia.com>
parents: 3
diff changeset
  1948
					  g_defName = yytext;
468f4c8d3d5b Orb version 0.2.0
Jonathan Harrington <jonathan.harrington@nokia.com>
parents: 3
diff changeset
  1949
					  g_defName = g_defName.left(g_defName.length()-1).stripWhiteSpace();
468f4c8d3d5b Orb version 0.2.0
Jonathan Harrington <jonathan.harrington@nokia.com>
parents: 3
diff changeset
  1950
					  g_defVarArgs = FALSE;
468f4c8d3d5b Orb version 0.2.0
Jonathan Harrington <jonathan.harrington@nokia.com>
parents: 3
diff changeset
  1951
					  //printf("Guard check: %s!=%s || %d\n",
468f4c8d3d5b Orb version 0.2.0
Jonathan Harrington <jonathan.harrington@nokia.com>
parents: 3
diff changeset
  1952
					  //    g_defName.data(),g_lastGuardName.data(),g_expectGuard);
468f4c8d3d5b Orb version 0.2.0
Jonathan Harrington <jonathan.harrington@nokia.com>
parents: 3
diff changeset
  1953
					  if ( g_defName!=g_lastGuardName || !g_expectGuard)
468f4c8d3d5b Orb version 0.2.0
Jonathan Harrington <jonathan.harrington@nokia.com>
parents: 3
diff changeset
  1954
					  { // define may appear in the output
468f4c8d3d5b Orb version 0.2.0
Jonathan Harrington <jonathan.harrington@nokia.com>
parents: 3
diff changeset
  1955
					    QCString tmp=(QCString)"#define "+g_defName;
468f4c8d3d5b Orb version 0.2.0
Jonathan Harrington <jonathan.harrington@nokia.com>
parents: 3
diff changeset
  1956
					    outputArray(tmp.data(),tmp.length());
468f4c8d3d5b Orb version 0.2.0
Jonathan Harrington <jonathan.harrington@nokia.com>
parents: 3
diff changeset
  1957
					    g_quoteArg=FALSE;
468f4c8d3d5b Orb version 0.2.0
Jonathan Harrington <jonathan.harrington@nokia.com>
parents: 3
diff changeset
  1958
					    g_insideComment=FALSE;
468f4c8d3d5b Orb version 0.2.0
Jonathan Harrington <jonathan.harrington@nokia.com>
parents: 3
diff changeset
  1959
					    g_lastGuardName.resize(0);
468f4c8d3d5b Orb version 0.2.0
Jonathan Harrington <jonathan.harrington@nokia.com>
parents: 3
diff changeset
  1960
				            g_defText="1"; 
468f4c8d3d5b Orb version 0.2.0
Jonathan Harrington <jonathan.harrington@nokia.com>
parents: 3
diff changeset
  1961
					    g_defLitText="1"; 
468f4c8d3d5b Orb version 0.2.0
Jonathan Harrington <jonathan.harrington@nokia.com>
parents: 3
diff changeset
  1962
					    BEGIN(DefineText); 
468f4c8d3d5b Orb version 0.2.0
Jonathan Harrington <jonathan.harrington@nokia.com>
parents: 3
diff changeset
  1963
					  }
468f4c8d3d5b Orb version 0.2.0
Jonathan Harrington <jonathan.harrington@nokia.com>
parents: 3
diff changeset
  1964
					  else // define is a guard => hide
468f4c8d3d5b Orb version 0.2.0
Jonathan Harrington <jonathan.harrington@nokia.com>
parents: 3
diff changeset
  1965
					  {
468f4c8d3d5b Orb version 0.2.0
Jonathan Harrington <jonathan.harrington@nokia.com>
parents: 3
diff changeset
  1966
					    g_defText.resize(0);
468f4c8d3d5b Orb version 0.2.0
Jonathan Harrington <jonathan.harrington@nokia.com>
parents: 3
diff changeset
  1967
					    g_defLitText.resize(0);
468f4c8d3d5b Orb version 0.2.0
Jonathan Harrington <jonathan.harrington@nokia.com>
parents: 3
diff changeset
  1968
					    BEGIN(Start);
468f4c8d3d5b Orb version 0.2.0
Jonathan Harrington <jonathan.harrington@nokia.com>
parents: 3
diff changeset
  1969
					  }
468f4c8d3d5b Orb version 0.2.0
Jonathan Harrington <jonathan.harrington@nokia.com>
parents: 3
diff changeset
  1970
  					}
468f4c8d3d5b Orb version 0.2.0
Jonathan Harrington <jonathan.harrington@nokia.com>
parents: 3
diff changeset
  1971
<DefName>{ID}/{B}*			{ // define with content
3
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1972
  					  //printf("Define `%s'\n",yytext);
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1973
  					  g_argDict = 0;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1974
					  g_defArgs = -1;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1975
                                          g_defArgsStr.resize(0);
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1976
					  g_defText.resize(0);
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1977
					  g_defLitText.resize(0);
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1978
					  g_defName = yytext;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1979
					  g_defVarArgs = FALSE;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1980
					  QCString tmp=(QCString)"#define "+g_defName+g_defArgsStr;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1981
					  outputArray(tmp.data(),tmp.length());
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1982
					  g_quoteArg=FALSE;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1983
					  g_insideComment=FALSE;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1984
					  BEGIN(DefineText); 
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1985
  					}
4
468f4c8d3d5b Orb version 0.2.0
Jonathan Harrington <jonathan.harrington@nokia.com>
parents: 3
diff changeset
  1986
<DefName>{ID}/{B}*"\n"			{ // empty define
3
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1987
  					  g_argDict = 0;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1988
					  g_defArgs = -1;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1989
					  g_defName = yytext;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1990
                                          g_defArgsStr.resize(0);
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1991
					  g_defText.resize(0);
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1992
					  g_defLitText.resize(0);
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1993
					  g_defVarArgs = FALSE;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1994
					  if ( g_defName!=g_lastGuardName || Config_getBool("PREPROCCESS_FULL_TU"))
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1995
					  { // define may appear in the output
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1996
					    QCString tmp=(QCString)"#define "+g_defName;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1997
					    outputArray(tmp.data(),tmp.length());
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1998
					    g_quoteArg=FALSE;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  1999
					    g_insideComment=FALSE;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2000
					    if (g_insideCS) g_defText="1"; // for C#, use "1" as define text
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2001
					    BEGIN(DefineText);
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2002
					  }
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2003
					  else // define is a guard => hide
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2004
					  {
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2005
					    //printf("Found a guard %s\n",yytext);
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2006
					    g_lastGuardName.resize(0);
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2007
					    BEGIN(Start);
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2008
					  }
4
468f4c8d3d5b Orb version 0.2.0
Jonathan Harrington <jonathan.harrington@nokia.com>
parents: 3
diff changeset
  2009
					  g_expectGuard=FALSE;
3
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2010
  					}
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2011
<DefineArg>","{B}*			{ g_defArgsStr+=yytext; }
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2012
<DefineArg>"("{B}*                      { g_defArgsStr+=yytext; }
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2013
<DefineArg>{B}*")"{B}*			{
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2014
                                          g_defArgsStr+=yytext; 
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2015
					  QCString tmp=(QCString)"#define "+g_defName+g_defArgsStr;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2016
					  outputArray(tmp.data(),tmp.length());
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2017
					  g_quoteArg=FALSE;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2018
					  g_insideComment=FALSE;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2019
  					  BEGIN(DefineText);
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2020
  					}
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2021
<DefineArg>"..."			{ // Variadic macro
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2022
					  g_defVarArgs = TRUE;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2023
					  g_defArgsStr+=yytext;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2024
					  g_argDict->insert("__VA_ARGS__",new int(g_defArgs));
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2025
					  g_defArgs++;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2026
  					}
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2027
<DefineArg>{ID}{B}*("..."?)		{
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2028
  					  //printf("Define addArg(%s)\n",yytext);
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2029
  					  QCString argName=yytext;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2030
  					  g_defVarArgs = yytext[yyleng-1]=='.';
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2031
					  if (g_defVarArgs) // strip ellipsis
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2032
					  {
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2033
					    argName=argName.left(argName.length()-3);
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2034
					  }
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2035
					  argName = argName.stripWhiteSpace();
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2036
                                          g_defArgsStr+=yytext;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2037
					  g_argDict->insert(argName,new int(g_defArgs)); 
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2038
					  g_defArgs++;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2039
  					}
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2040
  /*
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2041
<DefineText>"/ **"|"/ *!"			{
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2042
  					  g_defText+=yytext;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2043
					  g_defLitText+=yytext;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2044
					  g_insideComment=TRUE;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2045
  					}
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2046
<DefineText>"* /"			{
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2047
  					  g_defText+=yytext;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2048
					  g_defLitText+=yytext;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2049
					  g_insideComment=FALSE;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2050
  					}
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2051
  */
4
468f4c8d3d5b Orb version 0.2.0
Jonathan Harrington <jonathan.harrington@nokia.com>
parents: 3
diff changeset
  2052
<DefineText>"/*"[!*]?			{
3
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2053
					  g_defText+=yytext;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2054
					  g_defLitText+=yytext;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2055
					  g_lastCContext=YY_START;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2056
					  g_commentCount=1;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2057
  					  BEGIN(CopyCComment);
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2058
  					}
4
468f4c8d3d5b Orb version 0.2.0
Jonathan Harrington <jonathan.harrington@nokia.com>
parents: 3
diff changeset
  2059
<DefineText>"//"[!/]?			{
3
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2060
  				          outputChar('/');outputChar('/');
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2061
  					  g_lastCPPContext=YY_START;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2062
					  g_defLitText+=' ';
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2063
  					  BEGIN(SkipCPPComment);
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2064
  					}
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2065
<SkipCComment>[/]?"*/"			{
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2066
  					  if (yytext[0]=='/') outputChar('/');
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2067
  					  outputChar('*');outputChar('/');
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2068
					  if (--g_commentCount<=0)
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2069
					  {
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2070
					    if (g_lastCContext==Start) 
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2071
					      // small hack to make sure that ^... rule will
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2072
					      // match when going to Start... Example: "/*...*/ some stuff..."
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2073
					    {
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2074
					      YY_CURRENT_BUFFER->yy_at_bol=1;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2075
					    }
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2076
  					    BEGIN(g_lastCContext);  
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2077
					  }
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2078
  					}
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2079
<SkipCComment>"//"("/")*		{
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2080
  					  outputArray(yytext,yyleng);
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2081
  					}
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2082
<SkipCComment>"/*"			{
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2083
  					  outputChar('/');outputChar('*');
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2084
					  //g_commentCount++;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2085
  					}
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2086
<SkipCComment>[\\@][\\@]("f{"|"f$"|"f[") {
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2087
  					  outputArray(yytext,yyleng);
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2088
  					}
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2089
<SkipCComment>[\\@][\\@]("verbatim"|"latexonly"|"htmlonly"|"xmlonly"|"rtfonly"|"manonly"|"dot"|"code"){BN}+ {
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2090
  					  outputArray(yytext,yyleng);
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2091
  					  g_yyLineNr+=QCString(yytext).contains('\n');
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2092
  					}
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2093
<SkipCComment>[\\@]("verbatim"|"latexonly"|"htmlonly"|"xmlonly"|"rtfonly"|"manonly"|"dot"|"code"){BN}+	{
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2094
  					  outputArray(yytext,yyleng);
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2095
  					  g_yyLineNr+=QCString(yytext).contains('\n');
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2096
					  if (yytext[1]=='f')
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2097
					  {
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2098
					    g_blockName="f";
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2099
					  }
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2100
					  else
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2101
					  {
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2102
					    g_blockName=QCString(&yytext[1]).stripWhiteSpace();
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2103
					  }
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2104
					  BEGIN(SkipVerbatim);
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2105
  					}
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2106
<SkipCComment,SkipCPPComment>[\\@]"cond"[ \t]+	{ // conditional section
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2107
  					  g_condCtx = YY_START;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2108
  					  outputArray(yytext,yyleng);
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2109
  					  BEGIN(CondLine);
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2110
  					}
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2111
<CondLine>[a-z_A-Z][a-z_A-Z0-9.\-]*	{
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2112
  				          startCondSection(yytext);
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2113
  					  outputArray(yytext,yyleng);
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2114
  					  BEGIN(g_condCtx);
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2115
  					}
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2116
<SkipCComment,SkipCPPComment>[\\@]"cond"[ \t\r]*\n  |
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2117
<CondLine>.				{
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2118
  					  outputArray(yytext,yyleng);
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2119
  					  g_yyLineNr+=QCString(yytext).contains('\n');
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2120
  					  startCondSection(" ");
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2121
					  if (YY_START==CondLine) BEGIN(g_condCtx);
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2122
  					}
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2123
<SkipCComment,SkipCPPComment>[\\@]"endcond"/[^a-z_A-Z0-9] {
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2124
  					  outputArray(yytext,yyleng);
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2125
  					  endCondSection();
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2126
  					}
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2127
<SkipVerbatim>[\\@]("endverbatim"|"endlatexonly"|"endhtmlonly"|"endxmlonly"|"endrtfonly"|"endmanonly"|"enddot"|"endcode"|"f$"|"f]"|"f}") { /* end of verbatim block */
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2128
  					  outputArray(yytext,yyleng);
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2129
					  if (yytext[1]=='f' && g_blockName=="f")
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2130
					  {
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2131
					    BEGIN(SkipCComment);
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2132
					  }
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2133
					  else if (&yytext[4]==g_blockName)
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2134
					  {
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2135
					    BEGIN(SkipCComment);
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2136
					  }
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2137
  					}
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2138
<SkipVerbatim>"*/"|"/*"			{
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2139
  					  outputArray(yytext,yyleng);
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2140
  					}
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2141
<SkipCComment,SkipVerbatim>[^*\\@\x06\n\/]+ {
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2142
  					  outputArray(yytext,yyleng);
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2143
  					}
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2144
<SkipCComment,SkipVerbatim>\n		{ 
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2145
  					  g_yyLineNr++;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2146
  					  outputChar('\n');
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2147
  					}
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2148
<SkipCComment,SkipVerbatim>.		{
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2149
  					  outputChar(*yytext);
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2150
  					}
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2151
<CopyCComment>[^*a-z_A-Z\n]+		{
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2152
					  g_defLitText+=yytext;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2153
					  g_defText+=escapeAt(yytext);
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2154
  					}
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2155
<CopyCComment>"*/"			{
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2156
					  g_defLitText+=yytext;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2157
					  g_defText+=yytext;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2158
  					  BEGIN(g_lastCContext);
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2159
  					}
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2160
<CopyCComment>\n			{ 
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2161
  					  g_yyLineNr++;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2162
					  g_defLitText+=yytext;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2163
					  g_defText+=' ';
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2164
  					}
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2165
<RemoveCComment>"*/"		        { BEGIN(g_lastCContext); }
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2166
<RemoveCComment>"//"			
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2167
<RemoveCComment>"/*"
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2168
<RemoveCComment>[^*\x06\n]+
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2169
<RemoveCComment>\n			{ g_yyLineNr++; outputChar('\n'); }
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2170
<RemoveCComment>.			
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2171
<SkipCPPComment>[^\n\/\\@]+		{
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2172
  					  outputArray(yytext,yyleng);
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2173
  					}
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2174
<SkipCPPComment,RemoveCPPComment>\n	{
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2175
  					  unput(*yytext);
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2176
  					  BEGIN(g_lastCPPContext);
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2177
  					}
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2178
<SkipCPPComment>"/*"			{
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2179
  					  outputChar('/');outputChar('*');
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2180
  					}
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2181
<SkipCPPComment>"//"			{
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2182
  					  outputChar('/');outputChar('/');
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2183
  					}
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2184
<SkipCPPComment>[^\x06\@\\\n]+		{
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2185
  					  outputArray(yytext,yyleng);
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2186
  					}
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2187
<SkipCPPComment>.			{
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2188
  					  outputChar(*yytext);
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2189
  					}
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2190
<RemoveCPPComment>"/*"
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2191
<RemoveCPPComment>"//"
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2192
<RemoveCPPComment>[^\x06\n]+
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2193
<RemoveCPPComment>.
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2194
<DefineText>"#"				{
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2195
  					  g_quoteArg=TRUE;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2196
					  g_defLitText+=yytext;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2197
  					}
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2198
<DefineText,CopyCComment>{ID}		{
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2199
					  g_defLitText+=yytext;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2200
  					  if (g_quoteArg)
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2201
					  {
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2202
					    g_defText+="\"";
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2203
					  }
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2204
					  if (g_defArgs>0)
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2205
					  {
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2206
					    int *n;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2207
					    if ((n=(*g_argDict)[yytext]))
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2208
					    {
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2209
					      //if (!g_quoteArg) g_defText+=' ';
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2210
					      g_defText+='@';
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2211
					      QCString numStr;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2212
					      numStr.sprintf("%d",*n);
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2213
					      g_defText+=numStr;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2214
					      //if (!g_quoteArg) g_defText+=' ';
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2215
					    }
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2216
					    else
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2217
					    {
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2218
					      g_defText+=yytext;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2219
					    }
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2220
					  }
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2221
					  else
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2222
					  {
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2223
					    g_defText+=yytext;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2224
					  }
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2225
					  if (g_quoteArg)
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2226
					  {
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2227
					    g_defText+="\"";
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2228
					  }
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2229
					  g_quoteArg=FALSE;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2230
  					}
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2231
<CopyCComment>.				{
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2232
					  g_defLitText+=yytext;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2233
					  g_defText+=yytext;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2234
  					}
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2235
<DefineText>\\[\r]?\n			{ 
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2236
					  g_defLitText+=yytext;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2237
					  outputChar('\n');
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2238
  					  g_defText += ' '; g_yyLineNr++; 
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2239
					}
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2240
<DefineText>\n				{
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2241
					  QCString comment=extractTrailingComment(g_defLitText);
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2242
					  g_defLitText+=yytext;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2243
					  if (!comment.isEmpty())
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2244
					  {
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2245
					    outputArray(comment,comment.length());
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2246
					    g_defLitText=g_defLitText.left(g_defLitText.length()-comment.length()-1);
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2247
					  }
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2248
  					  outputChar('\n');
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2249
  					  Define *def=0;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2250
					  //printf("Define name=`%s' text=`%s' litTexti=`%s'\n",g_defName.data(),g_defText.data(),g_defLitText.data());
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2251
					  if (g_includeStack.isEmpty() || g_curlyCount>0) 
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2252
					  {
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2253
					    addDefine();
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2254
					  }
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2255
					  def=g_fileDefineDict->find(g_defName);
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2256
					  if (def==0) // new define
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2257
					  {
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2258
					    //printf("new define!\n");
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2259
					    g_fileDefineDict->insert(g_defName,newDefine());
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2260
					  }
4
468f4c8d3d5b Orb version 0.2.0
Jonathan Harrington <jonathan.harrington@nokia.com>
parents: 3
diff changeset
  2261
					  else if (def && macroIsAccessible(def))
468f4c8d3d5b Orb version 0.2.0
Jonathan Harrington <jonathan.harrington@nokia.com>
parents: 3
diff changeset
  2262
					       // name already exists
3
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2263
					  {
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2264
					    //printf("existing define!\n");
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2265
					    //printf("define found\n");
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2266
					    if (def->undef) // undefined name
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2267
					    {
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2268
					      def->undef = FALSE;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2269
					      def->name = g_defName;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2270
					      def->definition = g_defText.stripWhiteSpace();
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2271
					      def->nargs = g_defArgs;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2272
					      def->fileName = g_yyFileName.copy(); 
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2273
					      def->lineNr = g_yyLineNr;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2274
					    }
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2275
					    else
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2276
					    {
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2277
					      //printf("Error: define %s is defined more than once!\n",g_defName.data());
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2278
					    }
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2279
					  }
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2280
					  delete g_argDict; g_argDict=0;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2281
					  g_yyLineNr++;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2282
					  g_lastGuardName.resize(0);
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2283
					  BEGIN(Start);
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2284
  					}
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2285
<DefineText>{B}*			{ g_defText += ' '; g_defLitText+=yytext; }
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2286
<DefineText>{B}*"##"{B}*		{ g_defText += "##"; g_defLitText+=yytext; }
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2287
<DefineText>"@"				{ g_defText += "@@"; g_defLitText+=yytext; }
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2288
<DefineText>\"				{ 
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2289
                                          g_defText += *yytext; 
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2290
  					  g_defLitText+=yytext; 
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2291
					  if (!g_insideComment)
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2292
					  {
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2293
					    BEGIN(SkipDoubleQuote);
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2294
					  }
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2295
  					}
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2296
<DefineText>\'				{ g_defText += *yytext;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2297
  					  g_defLitText+=yytext; 
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2298
					  if (!g_insideComment)
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2299
					  {
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2300
  					    BEGIN(SkipSingleQuote);
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2301
					  }
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2302
					}
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2303
<SkipDoubleQuote>"//"			{ g_defText += yytext; g_defLitText+=yytext; }
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2304
<SkipDoubleQuote>"/*"			{ g_defText += yytext; g_defLitText+=yytext; }
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2305
<SkipDoubleQuote>\"			{
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2306
  					  g_defText += *yytext; g_defLitText+=yytext; 
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2307
					  BEGIN(DefineText);
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2308
  					}
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2309
<SkipSingleQuote,SkipDoubleQuote>\\.	{
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2310
  					  g_defText += yytext; g_defLitText+=yytext;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2311
					}
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2312
<SkipSingleQuote>\'			{
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2313
  					  g_defText += *yytext; g_defLitText+=yytext;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2314
					  BEGIN(DefineText);
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2315
  					}
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2316
<SkipDoubleQuote>.			{ g_defText += *yytext; g_defLitText+=yytext; }
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2317
<SkipSingleQuote>.			{ g_defText += *yytext; g_defLitText+=yytext; }
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2318
<DefineText>.				{ g_defText += *yytext; g_defLitText+=yytext; }
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2319
<<EOF>>					{
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2320
                                          //fprintf(stderr,"End of include file\n");
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2321
					  //printf("Include stack depth=%d\n",g_includeStack.count());
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2322
  					  if (g_includeStack.isEmpty())
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2323
					  {
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2324
					    //fprintf(stderr,"Terminating scanner!\n");
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2325
					    yyterminate();
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2326
					  }
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2327
					  else
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2328
					  {
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2329
					    FileState *fs=g_includeStack.pop();
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2330
					    //fileDefineCache->merge(g_yyFileName,fs->fileName);
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2331
					    YY_BUFFER_STATE oldBuf = YY_CURRENT_BUFFER;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2332
					    yy_switch_to_buffer( fs->bufState );
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2333
					    yy_delete_buffer( oldBuf );
4
468f4c8d3d5b Orb version 0.2.0
Jonathan Harrington <jonathan.harrington@nokia.com>
parents: 3
diff changeset
  2334
					    g_yyLineNr    = fs->lineNr;
3
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2335
                                            //preYYin = fs->oldYYin;
4
468f4c8d3d5b Orb version 0.2.0
Jonathan Harrington <jonathan.harrington@nokia.com>
parents: 3
diff changeset
  2336
                                            g_inputBuf    = fs->oldFileBuf;
3
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2337
					    g_inputBufPos = fs->oldFileBufPos;
4
468f4c8d3d5b Orb version 0.2.0
Jonathan Harrington <jonathan.harrington@nokia.com>
parents: 3
diff changeset
  2338
					    setFileName(fs->fileName);
3
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2339
					    //fprintf(stderr,"######## FileName %s\n",g_yyFileName.data());
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2340
					    
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2341
                                            // Deal with file changes due to 
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2342
                                            // #include's within { .. } blocks
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2343
                                            QCString lineStr(15+g_yyFileName.length());
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2344
                                            lineStr.sprintf("# %d \"%s\" 2",g_yyLineNr,g_yyFileName.data());
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2345
                                            outputArray(lineStr.data(),lineStr.length());
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2346
					    
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2347
					    delete fs; fs=0;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2348
					  }
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2349
  					}
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2350
<*>"/*"/"*/"				|
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2351
<*>"/*"[*]?				{
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2352
					  outputArray(yytext,yyleng);
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2353
  					  g_lastCContext=YY_START;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2354
					  g_commentCount=1;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2355
					  if (yyleng==3) g_lastGuardName.resize(0); // reset guard in case the #define is documented!
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2356
					  BEGIN(SkipCComment);
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2357
  					}
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2358
<*>"//"[/]?				{
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2359
					  outputArray(yytext,yyleng);
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2360
  					  g_lastCPPContext=YY_START;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2361
					  if (yyleng==3) g_lastGuardName.resize(0); // reset guard in case the #define is documented!
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2362
					  BEGIN(SkipCPPComment);
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2363
					}
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2364
<*>\n					{ 
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2365
  					  outputChar('\n');
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2366
  					  g_yyLineNr++; 
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2367
					}
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2368
<*>.				        {
4
468f4c8d3d5b Orb version 0.2.0
Jonathan Harrington <jonathan.harrington@nokia.com>
parents: 3
diff changeset
  2369
  					  g_expectGuard = FALSE;
3
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2370
  					  outputChar(*yytext);
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2371
  					}
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2372
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2373
%%
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2374
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2375
/*@ ----------------------------------------------------------------------------
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2376
 */
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2377
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2378
static int getNextChar(const QCString &expr,QCString *rest,uint &pos)
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2379
{
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2380
  //printf("getNextChar(%s,%s,%d)\n",expr.data(),rest ? rest->data() : 0,pos);
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2381
  if (pos<expr.length())
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2382
  {
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2383
    //printf("%c=expr()\n",expr.at(pos));
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2384
    return expr.at(pos++);
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2385
  }
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2386
  else if (rest && !rest->isEmpty())
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2387
  {
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2388
    int cc=rest->at(0);
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2389
    *rest=rest->right(rest->length()-1);
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2390
    //printf("%c=rest\n",cc);
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2391
    return cc;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2392
  }
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2393
  else
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2394
  {
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2395
    int cc=yyinput();
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2396
    //printf("%c=yyinput()\n",cc);
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2397
    return cc;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2398
  }
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2399
}
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2400
 
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2401
static int getCurrentChar(const QCString &expr,QCString *rest,uint pos)
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2402
{
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2403
  //printf("getCurrentChar(%s,%s,%d)\n",expr.data(),rest ? rest->data() : 0,pos);
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2404
  if (pos<expr.length())
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2405
  {
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2406
    //printf("%c=expr()\n",expr.at(pos));
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2407
    return expr.at(pos);
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2408
  }
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2409
  else if (rest && !rest->isEmpty())
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2410
  {
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2411
    int cc=rest->at(0);
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2412
    //printf("%c=rest\n",cc);
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2413
    return cc;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2414
  }
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2415
  else
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2416
  {
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2417
    int cc=yyinput();
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2418
    returnCharToStream(cc);
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2419
    //unput((char)cc);
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2420
    //printf("%c=yyinput()\n",cc);
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2421
    return cc;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2422
  }
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2423
}
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2424
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2425
static void unputChar(const QCString &expr,QCString *rest,uint &pos,char c)
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2426
{
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2427
  //printf("unputChar(%s,%s,%d,%c)\n",expr.data(),rest ? rest->data() : 0,pos,c);
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2428
  if (pos<expr.length())
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2429
  {
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2430
    pos++;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2431
  }
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2432
  else if (rest)
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2433
  {
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2434
    //printf("Prepending to rest!\n");
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2435
    char cs[2];cs[0]=c;cs[1]='\0';
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2436
    rest->prepend(cs);
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2437
  }
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2438
  else
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2439
  {
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2440
    //unput(c);
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2441
    returnCharToStream(c);
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2442
  }
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2443
  //printf("result: unputChar(%s,%s,%d,%c)\n",expr.data(),rest ? rest->data() : 0,pos,c);
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2444
}
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2445
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2446
void addSearchDir(const char *dir)
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2447
{
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2448
  QFileInfo fi(dir);
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2449
  if (fi.isDir()) g_pathList->append(fi.absFilePath());
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2450
} 
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2451
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2452
void initPreprocessor()
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2453
{
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2454
  g_pathList = new QStrList;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2455
  addSearchDir(".");
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2456
  g_expandedDict = new DefineDict(17);
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2457
}
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2458
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2459
void cleanUpPreprocessor()
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2460
{
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2461
  delete g_expandedDict; g_expandedDict=0;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2462
  delete g_pathList; g_pathList=0;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2463
}
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2464
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2465
void dumpDefineDict(const DefineDict *theDefDict)
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2466
{
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2467
	if (Debug::isFlagSet(Debug::Preprocessor)) {
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2468
		// Make a map to sort the macros in alphbetical order
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2469
		typedef QMap<QString, Define*> DefineMapType;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2470
		DefineMapType DefineMap;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2471
		Define *def = 0;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2472
		QDictIterator<Define> it(*theDefDict);
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2473
		while (it.current()) {
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2474
			def = it.current();
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2475
			DefineMap.insert(def->name, def);
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2476
			++it;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2477
		}
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2478
		// Now write them out
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2479
		DefineMapType::Iterator mapIt;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2480
		for (mapIt = DefineMap.begin(); mapIt != DefineMap.end(); ++mapIt) {
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2481
			def = mapIt.data();
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2482
			QString myDecl = def->name;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2483
			if (def->nargs > 0) {
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2484
				myDecl.append("(");
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2485
				myDecl.append(def->args);
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2486
				myDecl.append(")");
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2487
			}
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2488
			printf("#define %s %s /* %s %d */\n",
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2489
				myDecl.data(),
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2490
				def->definition.data(),
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2491
				def->fileName.data(),
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2492
				def->lineNr
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2493
				);
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2494
		}
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2495
	}
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2496
}
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2497
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2498
void dumpDefineDicts()
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2499
{
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2500
	if (Debug::isFlagSet(Debug::Preprocessor)) {
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2501
		printf("g_expandedDict:\n");
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2502
		dumpDefineDict(g_expandedDict);
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2503
		printf("g_fileDefineDict:\n");
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2504
		dumpDefineDict(g_fileDefineDict);
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2505
	}
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2506
}
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2507
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2508
void preprocessFile(const char *fileName,BufStr &input,BufStr &output)
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2509
{
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2510
  uint orgOffset=output.curPos();
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2511
  //printf("##########################\n%s\n####################\n",
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2512
  //    input.data());
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2513
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2514
  g_macroExpansion = Config_getBool("MACRO_EXPANSION");
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2515
  g_expandOnlyPredef = Config_getBool("EXPAND_ONLY_PREDEF");
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2516
  g_curlyCount=0;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2517
  g_nospaces=FALSE;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2518
  g_inputBuf=&input;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2519
  g_inputBufPos=0;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2520
  g_outputBuf=&output;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2521
  g_includeStack.setAutoDelete(TRUE);
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2522
  g_includeStack.clear();
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2523
  g_expandedDict->setAutoDelete(FALSE);
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2524
  g_expandedDict->clear();
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2525
  g_condStack.clear();
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2526
  g_condStack.setAutoDelete(TRUE);
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2527
  static bool firstTime=TRUE;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2528
  if (firstTime)
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2529
  {
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2530
    // add predefined macros
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2531
    char *defStr;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2532
    QStrList &predefList = Config_getList("PREDEFINED");
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2533
    QStrListIterator sli(predefList);
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2534
    for (sli.toFirst();(defStr=sli.current());++sli)
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2535
    {
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2536
      QCString ds = defStr;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2537
      int i_equals=ds.find('=');
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2538
      int i_obrace=ds.find('(');
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2539
      int i_cbrace=ds.find(')');
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2540
      bool nonRecursive = i_equals>0 && ds.at(i_equals-1)==':';
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2541
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2542
      if (i_obrace==0) continue; // no define name
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2543
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2544
      if (i_obrace<i_equals && i_cbrace<i_equals && 
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2545
	  i_obrace!=-1      && i_cbrace!=-1      && 
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2546
	  i_obrace<i_cbrace
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2547
	 ) // predefined function macro definition
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2548
      {
4
468f4c8d3d5b Orb version 0.2.0
Jonathan Harrington <jonathan.harrington@nokia.com>
parents: 3
diff changeset
  2549
	//printf("predefined function macro '%s'\n",defStr);
3
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2550
	QRegExp reId("[a-z_A-Z][a-z_A-Z0-9]*"); // regexp matching an id
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2551
	QDict<int> argDict(17);
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2552
	argDict.setAutoDelete(TRUE);
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2553
	int i=i_obrace+1,p,l,count=0;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2554
	// gather the formal arguments in a dictionary 
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2555
	while (i<i_cbrace && (p=reId.match(ds,i,&l)))
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2556
	{
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2557
	  argDict.insert(ds.mid(p,l),new int(count++));
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2558
	  i=p+l;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2559
	}
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2560
	// strip definition part
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2561
	QCString tmp=ds.right(ds.length()-i_equals-1);
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2562
	QCString definition;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2563
	i=0;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2564
	// substitute all occurrences of formal arguments by their 
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2565
	// corresponding markers
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2566
	while ((p=reId.match(tmp,i,&l))!=-1)
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2567
	{
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2568
	  if (p>i) definition+=tmp.mid(i,p-i);
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2569
	  int *argIndex;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2570
	  if ((argIndex=argDict[tmp.mid(p,l)])!=0)
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2571
	  {
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2572
	    QCString marker;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2573
	    marker.sprintf(" @%d ",*argIndex);
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2574
	    definition+=marker;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2575
	  }
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2576
	  else
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2577
	  {
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2578
	    definition+=tmp.mid(p,l);
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2579
	  }
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2580
	  i=p+l;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2581
	}
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2582
	if (i<(int)tmp.length()) definition+=tmp.mid(i,tmp.length()-i);
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2583
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2584
	// add define definition to the dictionary of defines for this file
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2585
	QCString dname = ds.left(i_obrace);
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2586
	if (!dname.isEmpty())
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2587
	{
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2588
	  Define *def = new Define;
4
468f4c8d3d5b Orb version 0.2.0
Jonathan Harrington <jonathan.harrington@nokia.com>
parents: 3
diff changeset
  2589
	  def->name         = dname;
468f4c8d3d5b Orb version 0.2.0
Jonathan Harrington <jonathan.harrington@nokia.com>
parents: 3
diff changeset
  2590
	  def->definition   = definition; 
468f4c8d3d5b Orb version 0.2.0
Jonathan Harrington <jonathan.harrington@nokia.com>
parents: 3
diff changeset
  2591
	  def->nargs        = count;
3
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2592
	  def->isPredefined = TRUE;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2593
	  def->nonRecursive = nonRecursive;
4
468f4c8d3d5b Orb version 0.2.0
Jonathan Harrington <jonathan.harrington@nokia.com>
parents: 3
diff changeset
  2594
	  def->fileDef      = g_yyFileDef;
468f4c8d3d5b Orb version 0.2.0
Jonathan Harrington <jonathan.harrington@nokia.com>
parents: 3
diff changeset
  2595
	  def->fileName     = fileName;
3
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2596
	  g_fileDefineDict->insert(def->name,def);
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2597
	}
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2598
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2599
	//printf("#define `%s' `%s' #nargs=%d\n",
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2600
	//  def->name.data(),def->definition.data(),def->nargs);
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2601
      }
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2602
      else if ((i_obrace==-1 || i_obrace>i_equals) &&
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2603
	  (i_cbrace==-1 || i_cbrace>i_equals) &&
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2604
	  !ds.isEmpty() && (int)ds.length()>i_equals
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2605
	  ) // predefined non-function macro definition
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2606
      {
4
468f4c8d3d5b Orb version 0.2.0
Jonathan Harrington <jonathan.harrington@nokia.com>
parents: 3
diff changeset
  2607
	//printf("predefined normal macro '%s'\n",defStr);
3
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2608
	Define *def = new Define;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2609
	if (i_equals==-1) // simple define without argument
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2610
	{
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2611
	  def->name = ds;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2612
	  def->definition = "1"; // substitute occurrences by 1 (true)
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2613
	}
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2614
	else // simple define with argument
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2615
	{
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2616
	  int ine=i_equals - (nonRecursive ? 1 : 0);
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2617
	  def->name = ds.left(ine);
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2618
	  def->definition = ds.right(ds.length()-i_equals-1);
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2619
	}
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2620
	if (!def->name.isEmpty())
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2621
	{
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2622
	  def->nargs = -1;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2623
	  def->isPredefined = TRUE;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2624
	  def->nonRecursive = nonRecursive;
4
468f4c8d3d5b Orb version 0.2.0
Jonathan Harrington <jonathan.harrington@nokia.com>
parents: 3
diff changeset
  2625
	  def->fileDef      = g_yyFileDef;
468f4c8d3d5b Orb version 0.2.0
Jonathan Harrington <jonathan.harrington@nokia.com>
parents: 3
diff changeset
  2626
	  def->fileName     = fileName;
3
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2627
	  g_fileDefineDict->insert(def->name,def);
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2628
	}
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2629
	else
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2630
	{
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2631
	  delete def;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2632
	}
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2633
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2634
	//printf("#define `%s' `%s' #nargs=%d\n",
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2635
	//  def->name.data(),def->definition.data(),def->nargs);
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2636
      }
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2637
    }
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2638
    firstTime=FALSE;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2639
  }
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2640
 
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2641
  g_yyLineNr = 1;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2642
  g_level    = 0;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2643
  g_ifcount  = 0;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2644
  setFileName(fileName);
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2645
  g_inputFileDef = g_yyFileDef;
4
468f4c8d3d5b Orb version 0.2.0
Jonathan Harrington <jonathan.harrington@nokia.com>
parents: 3
diff changeset
  2646
3
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2647
  BEGIN( Start );
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2648
  
4
468f4c8d3d5b Orb version 0.2.0
Jonathan Harrington <jonathan.harrington@nokia.com>
parents: 3
diff changeset
  2649
  g_expectGuard = TRUE;
3
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2650
  g_lastGuardName.resize(0);
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2651
  g_guardExpr.resize(0);
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2652
  
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2653
  preYYlex();
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2654
  g_lexInit=TRUE;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2655
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2656
  if (Debug::isFlagSet(Debug::Preprocessor))
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2657
  {
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2658
	printf("preprocessFile() dump from %d to %d\n", orgOffset, output.curPos());
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2659
    char *orgPos=output.data()+orgOffset;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2660
    char *newPos=output.data()+output.curPos();
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2661
    printf("Preprocessor output (size: %d bytes):\n",newPos-orgPos);
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2662
    int line=1;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2663
    printf("---------\n00001 ");
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2664
    while (orgPos<newPos) 
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2665
    {
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2666
      putchar(*orgPos);
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2667
      if (*orgPos=='\n') printf("%05d ",++line);
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2668
      orgPos++;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2669
    }
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2670
    printf("\n---------\n");
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2671
	dumpDefineDicts();
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2672
  }
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2673
}
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2674
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2675
void preFreeScanner()
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2676
{
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2677
#if defined(YY_FLEX_SUBMINOR_VERSION) 
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2678
  if (g_lexInit)
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2679
  {
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2680
    preYYlex_destroy();
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2681
  }
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2682
#endif
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2683
}
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2684
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2685
#if !defined(YY_FLEX_SUBMINOR_VERSION) 
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2686
extern "C" { // some bogus code to keep the compiler happy
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2687
//  int  preYYwrap() { return 1 ; }
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2688
  void preYYdummy() { yy_flex_realloc(0,0); } 
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2689
}
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2690
#endif
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
  2691