summaryrefslogtreecommitdiff
path: root/noncore/apps/tinykate/libkate/qt3back/qregexp3.cpp
Unidiff
Diffstat (limited to 'noncore/apps/tinykate/libkate/qt3back/qregexp3.cpp') (more/less context) (show whitespace changes)
-rw-r--r--noncore/apps/tinykate/libkate/qt3back/qregexp3.cpp80
1 files changed, 43 insertions, 37 deletions
diff --git a/noncore/apps/tinykate/libkate/qt3back/qregexp3.cpp b/noncore/apps/tinykate/libkate/qt3back/qregexp3.cpp
index a2c680f..78635b2 100644
--- a/noncore/apps/tinykate/libkate/qt3back/qregexp3.cpp
+++ b/noncore/apps/tinykate/libkate/qt3back/qregexp3.cpp
@@ -35,26 +35,32 @@
35** 35**
36**********************************************************************/ 36**********************************************************************/
37#if QT_VERSION >=300 37#if QT_VERSION >=300
38#error QRegExp3 is now in QT 3 use QRegExp instead 38#error QRegExp3 is now in QT 3 use QRegExp instead
39#endif 39#endif
40 40
41#include "qarray.h"
42#include "qbitarray.h"
43#include "qcache.h"
44#include "qintdict.h"
45#include "qmap.h"
46#if QT_VERSION < 300 41#if QT_VERSION < 300
47#include "./qregexp3.h" 42#include "./qregexp3.h"
48#else 43#else
49#include "qregexp.h" 44#include "qregexp.h"
50#endif 45#endif
51#include "qstring.h"
52#include "qtl.h"
53#include "qvector.h"
54 46
47/* OPIE */
48#include <opie2/odebug.h>
49
50/* QT */
51#include <qarray.h>
52#include <qbitarray.h>
53#include <qcache.h>
54#include <qintdict.h>
55#include <qmap.h>
56#include <qstring.h>
57#include <qtl.h>
58#include <qvector.h>
59
60/* STD */
55#include <limits.h> 61#include <limits.h>
56 62
57/* 63/*
58 WARNING! Be sure to read qregexp.tex before modifying this file. 64 WARNING! Be sure to read qregexp.tex before modifying this file.
59*/ 65*/
60 66
@@ -1428,56 +1434,56 @@ void QRegExpEngine::heuristicallyChooseHeuristic()
1428#endif 1434#endif
1429 1435
1430#if defined(QT_DEBUG) 1436#if defined(QT_DEBUG)
1431void QRegExpEngine::dump() const 1437void QRegExpEngine::dump() const
1432{ 1438{
1433 int i, j; 1439 int i, j;
1434 qDebug( "Case %ssensitive engine", cs ? "" : "in" ); 1440 odebug << "Case " << (cs ? "" : "in") << "sensitive engine" << oendl;
1435 qDebug( " States" ); 1441 odebug << " States" << oendl;
1436 for ( i = 0; i < ns; i++ ) { 1442 for ( i = 0; i < ns; i++ ) {
1437 qDebug( " %d%s", i, 1443 odebug << " " << i
1438 i == InitialState ? " (initial)" : 1444 << (i == InitialState ? " (initial)" : i == FinalState ? " (final)" : "") << oendl;
1439 i == FinalState ? " (final)" : "" ); 1445
1440#ifndef QT_NO_REGEXP_CAPTURE 1446#ifndef QT_NO_REGEXP_CAPTURE
1441 qDebug( " in atom %d", s[i]->atom ); 1447 odebug << " in atom " << s[i]->atom << oendl;
1442#endif 1448#endif
1443 int m = s[i]->match; 1449 int m = s[i]->match;
1444 if ( (m & CharClassBit) != 0 ) { 1450 if ( (m & CharClassBit) != 0 ) {
1445 qDebug( " match character class %d", m ^ CharClassBit ); 1451 odebug << " match character class " << (m ^ CharClassBit) << oendl;
1446#ifndef QT_NO_REGEXP_CCLASS 1452#ifndef QT_NO_REGEXP_CCLASS
1447 cl[m ^ CharClassBit]->dump(); 1453 cl[m ^ CharClassBit]->dump();
1448#else 1454#else
1449 qDebug( " negative character class" ); 1455 odebug << " negative character class" << oendl;
1450#endif 1456#endif
1451 } else if ( (m & BackRefBit) != 0 ) { 1457 } else if ( (m & BackRefBit) != 0 ) {
1452 qDebug( " match back-reference %d", m ^ BackRefBit ); 1458 odebug << " match back-reference " << (m ^ BackRefBit) << oendl;
1453 } else if ( m >= 0x20 && m <= 0x7e ) { 1459 } else if ( m >= 0x20 && m <= 0x7e ) {
1454 qDebug( " match 0x%.4x (%c)", m, m ); 1460 odebug << " match " << QString().sprintf( "0x%.4x", m) << " (" << m << ")" << oendl;
1461
1455 } else { 1462 } else {
1456 qDebug( " match 0x%.4x", m ); 1463 odebug << " match " << QString().sprintf( "0x%.4x", m) << oendl;
1457 } 1464 }
1458 for ( j = 0; j < (int) s[i]->outs.size(); j++ ) { 1465 for ( j = 0; j < (int) s[i]->outs.size(); j++ ) {
1459 int next = s[i]->outs[j]; 1466 int next = s[i]->outs[j];
1460 qDebug( " -> %d", next ); 1467 odebug << " -> " << next << oendl;
1461 if ( s[i]->reenter != 0 && s[i]->reenter->contains(next) ) 1468 if ( s[i]->reenter != 0 && s[i]->reenter->contains(next) )
1462 qDebug( " [reenter %d]", (*s[i]->reenter)[next] ); 1469 odebug << " [reenter " << (*s[i]->reenter)[next] << "]" << oendl;
1463 if ( s[i]->anchors != 0 && at(*s[i]->anchors, next) != 0 ) 1470 if ( s[i]->anchors != 0 && at(*s[i]->anchors, next) != 0 )
1464 qDebug( " [anchors 0x%.8x]", (*s[i]->anchors)[next] ); 1471 odebug << " [anchors " << QString().sprintf( "0x%.8x]", (*s[i]->anchors)[next] ) << oendl;
1465 } 1472 }
1466 } 1473 }
1467#ifndef QT_NO_REGEXP_CAPTURE 1474#ifndef QT_NO_REGEXP_CAPTURE
1468 if ( nf > 0 ) { 1475 if ( nf > 0 ) {
1469 qDebug( " Atom Parent Capture" ); 1476 odebug << " Atom Parent Capture" << oendl;
1470 for ( i = 0; i < nf; i++ ) 1477 for ( i = 0; i < nf; i++ )
1471 qDebug( " %6d %6d %6d", i, f[i].parent, f[i].capture ); 1478 odebug << QString().sprintf(" %6d %6d %6d", i, f[i].parent, f[i].capture ) << oendl;
1472 } 1479 }
1473#endif 1480#endif
1474#ifndef QT_NO_REGEXP_ANCHOR_ALT 1481#ifndef QT_NO_REGEXP_ANCHOR_ALT
1475 for ( i = 0; i < (int) aa.size(); i++ ) 1482 for ( i = 0; i < (int) aa.size(); i++ )
1476 qDebug( " Anchor alternation 0x%.8x: 0x%.8x 0x%.9x", i, aa[i].a, 1483 odebug << QString().sprintf(" Anchor alternation 0x%.8x: 0x%.8x 0x%.9x", i, aa[i].a, aa[i].b ) << oendl;
1477 aa[i].b );
1478#endif 1484#endif
1479} 1485}
1480#endif 1486#endif
1481 1487
1482void QRegExpEngine::setup( bool caseSensitive ) 1488void QRegExpEngine::setup( bool caseSensitive )
1483{ 1489{
@@ -2193,19 +2199,19 @@ bool QRegExpEngine::CharClass::in( QChar ch ) const
2193} 2199}
2194 2200
2195#if defined(QT_DEBUG) 2201#if defined(QT_DEBUG)
2196void QRegExpEngine::CharClass::dump() const 2202void QRegExpEngine::CharClass::dump() const
2197{ 2203{
2198 int i; 2204 int i;
2199 qDebug( " %stive character class", n ? "nega" : "posi" ); 2205 odebug << " " << (n ? "nega" : "posi") << "tive character class" << oendl;
2200#ifndef QT_NO_REGEXP_CCLASS 2206#ifndef QT_NO_REGEXP_CCLASS
2201 if ( c != 0 ) 2207 if ( c != 0 )
2202 qDebug( " categories 0x%.8x", c ); 2208 odebug << QString().sprintf(" categories 0x%.8x", c ) << oendl;
2203#endif 2209#endif
2204 for ( i = 0; i < (int) r.size(); i++ ) 2210 for ( i = 0; i < (int) r.size(); i++ )
2205 qDebug( " 0x%.4x through 0x%.4x", r[i].from, r[i].to ); 2211 odebug << QString().sprintf(" 0x%.4x through 0x%.4x", r[i].from, r[i].to ) << oendl;
2206} 2212}
2207#endif 2213#endif
2208#endif 2214#endif
2209 2215
2210QRegExpEngine::Box::Box( QRegExpEngine *engine ) 2216QRegExpEngine::Box::Box( QRegExpEngine *engine )
2211 : eng( engine ), skipanchors( 0 ) 2217 : eng( engine ), skipanchors( 0 )
@@ -2443,28 +2449,28 @@ void QRegExpEngine::Box::setupHeuristics()
2443#endif 2449#endif
2444 2450
2445#if defined(QT_DEBUG) 2451#if defined(QT_DEBUG)
2446void QRegExpEngine::Box::dump() const 2452void QRegExpEngine::Box::dump() const
2447{ 2453{
2448 int i; 2454 int i;
2449 qDebug( "Box of at least %d character%s", minl, minl == 1 ? "" : "s" ); 2455 odebug << "Box of at least " << minl << " character" << (minl == 1 ? "" : "s") << oendl;
2450 qDebug( " Left states:" ); 2456 odebug << " Left states:" << oendl;
2451 for ( i = 0; i < (int) ls.size(); i++ ) { 2457 for ( i = 0; i < (int) ls.size(); i++ ) {
2452 if ( at(lanchors, ls[i]) == 0 ) 2458 if ( at(lanchors, ls[i]) == 0 )
2453 qDebug( " %d", ls[i] ); 2459 odebug << " " << ls[i] << oendl;
2454 else 2460 else
2455 qDebug( " %d [anchors 0x%.8x]", ls[i], lanchors[ls[i]] ); 2461 odebug << " " << ls[i] << QString().sprintf(" [anchors 0x%.8x]", lanchors[ls[i]]) << oendl;
2456 } 2462 }
2457 qDebug( " Right states:" ); 2463 odebug << " Right states:" << oendl;
2458 for ( i = 0; i < (int) rs.size(); i++ ) { 2464 for ( i = 0; i < (int) rs.size(); i++ ) {
2459 if ( at(ranchors, ls[i]) == 0 ) 2465 if ( at(ranchors, ls[i]) == 0 )
2460 qDebug( " %d", rs[i] ); 2466 odebug << " " << rs[i] << oendl;
2461 else 2467 else
2462 qDebug( " %d [anchors 0x%.8x]", rs[i], ranchors[rs[i]] ); 2468 odebug << " " << rs[i] << QString().sprintf(" [anchors 0x%.8x]", ranchors[rs[i]]) << oendl;
2463 } 2469 }
2464 qDebug( " Skip anchors: 0x%.8x", skipanchors ); 2470 odebug << QString().sprintf(" Skip anchors: 0x%.8x", skipanchors) << oendl;
2465} 2471}
2466#endif 2472#endif
2467 2473
2468void QRegExpEngine::Box::addAnchorsToEngine( const Box& to ) const 2474void QRegExpEngine::Box::addAnchorsToEngine( const Box& to ) const
2469{ 2475{
2470 for ( int i = 0; i < (int) to.ls.size(); i++ ) { 2476 for ( int i = 0; i < (int) to.ls.size(); i++ ) {