summaryrefslogtreecommitdiff
path: root/xmlhelp
diff options
context:
space:
mode:
authorAndreas Bille <abi@openoffice.org>2001-05-10 14:26:22 +0000
committerAndreas Bille <abi@openoffice.org>2001-05-10 14:26:22 +0000
commit9ec753da9a1da0556a6e67be10afee5c73fe8192 (patch)
tree4e812f27de678b44b35012039be7482957b21550 /xmlhelp
parentf796ed6d917eb9aecaf2d832df8ea459bcd41de9 (diff)
Bug fixing
Diffstat (limited to 'xmlhelp')
-rw-r--r--xmlhelp/source/cxxhelp/qe/ConceptData.cxx50
-rw-r--r--xmlhelp/source/cxxhelp/qe/ContextTables.cxx29
-rw-r--r--xmlhelp/source/cxxhelp/qe/DocGenerator.cxx200
-rw-r--r--xmlhelp/source/cxxhelp/qe/Query.cxx100
-rw-r--r--xmlhelp/source/cxxhelp/qe/Search.cxx388
-rw-r--r--xmlhelp/source/cxxhelp/qe/XmlIndex.cxx30
-rw-r--r--xmlhelp/source/cxxhelp/qe/makefile.mk13
-rw-r--r--xmlhelp/source/cxxhelp/test/makefile.mk44
-rw-r--r--xmlhelp/source/cxxhelp/test/searchdemo.cxx42
-rw-r--r--xmlhelp/source/cxxhelp/util/IndexAccessor.cxx64
-rw-r--r--xmlhelp/source/cxxhelp/util/makefile.mk13
11 files changed, 562 insertions, 411 deletions
diff --git a/xmlhelp/source/cxxhelp/qe/ConceptData.cxx b/xmlhelp/source/cxxhelp/qe/ConceptData.cxx
index 0dfc3483efa7..cabaab328a48 100644
--- a/xmlhelp/source/cxxhelp/qe/ConceptData.cxx
+++ b/xmlhelp/source/cxxhelp/qe/ConceptData.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: ConceptData.cxx,v $
*
- * $Revision: 1.1 $
+ * $Revision: 1.2 $
*
- * last change: $Author: abi $ $Date: 2001-05-08 12:02:45 $
+ * last change: $Author: abi $ $Date: 2001-05-10 15:25:32 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -64,6 +64,7 @@
#ifndef _XMLSEARCH_QE_QUERY_HXX_
#include <qe/Query.hxx>
#endif
+#include <stdio.h>
using namespace xmlsearch::qe;
@@ -71,17 +72,45 @@ using namespace xmlsearch::qe;
const sal_Int32 ConceptData::ProxPerTerm = 10;
+ConceptData::ConceptData( sal_Int32 id,
+ sal_Int32 role,
+ double score,
+ sal_Int32 queryNo,
+ sal_Int32 nColumns,
+ ContextTables* contextTables )
+ : queryNo_( sal_uInt8( queryNo & 0xF ) ),
+ nColumns_( sal_uInt8( nColumns & 0xF ) ),
+ concept_( id ),
+ proximity_( nColumns * ProxPerTerm ),
+ role_( sal_uInt8( role & 0xF ) ),
+ penalty_( score ),
+ ctx_( contextTables ),
+ next_( 0 )
+{
+}
+
+
void ConceptData::runBy( std::vector< Query* >& queries )
{
ConceptData* cd = this;
do
{
- queries[ cd->queryNo_ ]->updateEstimate( cd->role_,cd->penalty_ );
+ Query* query = queries[ cd->queryNo_ ];
+ query->updateEstimate( cd->role_,cd->penalty_ );
}
while( cd = cd->next_ );
}
+void ConceptData::addLast( ConceptData* r )
+{
+ if( next_ )
+ next_->addLast( r );
+ else
+ next_ = r;
+}
+
+
#ifndef _XMLSEARCH_QE_DOCGENERATOR_HXX_
#include <qe/DocGenerator.hxx>
#endif
@@ -91,13 +120,14 @@ void ConceptData::generateFillers( std::vector< RoleFiller* >& array, sal_Int32
{
if( array[ queryNo_ ] != RoleFiller::STOP() ) // not 'prohibited'
{
-// cout << "Conc " << sal_Int32( nColumns_ ) << endl;
- ( new RoleFiller( nColumns_,
- this,
- role_,
- pos,
- ctx_->wordContextLin( pos ),
- pos + proximity_ ) )->use( array, queryNo_ );
+ sal_Int32 wcl = ctx_->wordContextLin( pos );
+ RoleFiller* p = new RoleFiller( nColumns_,
+ this,
+ role_,
+ pos,
+ wcl,
+ pos + proximity_ );
+ p->use( array, queryNo_ );
}
// !!! maybe eliminate tail recursion
if( next_ )
diff --git a/xmlhelp/source/cxxhelp/qe/ContextTables.cxx b/xmlhelp/source/cxxhelp/qe/ContextTables.cxx
index f5ba2704df38..327266fd4714 100644
--- a/xmlhelp/source/cxxhelp/qe/ContextTables.cxx
+++ b/xmlhelp/source/cxxhelp/qe/ContextTables.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: ContextTables.cxx,v $
*
- * $Revision: 1.1 $
+ * $Revision: 1.2 $
*
- * last change: $Author: abi $ $Date: 2001-05-08 12:02:45 $
+ * last change: $Author: abi $ $Date: 2001-05-10 15:25:32 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -189,12 +189,6 @@ void ContextTables::setMicroindex( sal_Int32 docNo ) throw( excep::XmlSearchExce
compr.decode( k0,kTable_ );
// decompress initialWords into auxiliary array
auxArray_.clear();
-#ifdef ABIDEBUG
-// cout << kTable_[0] << endl;
-
-
-// exit(1);
-#endif
compr.ascDecode( kTable_[0],auxArray_ ); // _initialWords
initialWords_ = new sal_Int32[ initialWordsL_ = auxArray_.size() ];
@@ -212,10 +206,6 @@ void ContextTables::setMicroindex( sal_Int32 docNo ) throw( excep::XmlSearchExce
for( k = 0; k < destsL_; ++k ) //?opt
dests_[k] = auxArray_[k];
-#ifdef ABIDEBUG
-// cout << " linkTypesL_ = " << destsL_ - nTextNodes_ - 1 << endl;
-#endif
-
linkTypes_ = new sal_Int32[ linkTypesL_ = destsL_ - nTextNodes_ - 1 ];
compr.decode( kTable_[2],linkTypes_ );
@@ -223,21 +213,9 @@ void ContextTables::setMicroindex( sal_Int32 docNo ) throw( excep::XmlSearchExce
compr.decode( kTable_[ 3 ],seqNumbers_ );
cache_[docNo] = new Tables( this );
-
- /*
- System.out.println("|_initialWords| = " + _nTextNodes);
- System.out.println("|_dests| -1 = " + (_dests.length - 1));
- System.out.println("|_seqNumbers| = " + _seqNumbers.length);
- System.out.println("|_linkTypes| = " + _linkTypes.length);
- */
}
lastDocNo_ = docNo;
-
-#ifdef ABIDEBUG
-// cout << "destL_ = " << destsL_ << endl;
-#endif
-
markers_ = new sal_Int32[ markersL_ = destsL_ ];
}
initialWordsIndex_ = 0;
@@ -296,10 +274,7 @@ bool ContextTables::notIgnored( sal_Int32 ctx,
do
{
if( ignoredElements[ linkTypes_[ ctx ] ] )
- {
- // cout << rtl::OUString::createFromAscii( "hit ignored" ) << endl;
return false;
- }
}
while( ( ctx = dests_[ ctx ] ) > -1 ); // parentContext 'hand inlined'
return true;
diff --git a/xmlhelp/source/cxxhelp/qe/DocGenerator.cxx b/xmlhelp/source/cxxhelp/qe/DocGenerator.cxx
index 668d2db5ee9e..edeeab84393b 100644
--- a/xmlhelp/source/cxxhelp/qe/DocGenerator.cxx
+++ b/xmlhelp/source/cxxhelp/qe/DocGenerator.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: DocGenerator.cxx,v $
*
- * $Revision: 1.1 $
+ * $Revision: 1.2 $
*
- * last change: $Author: abi $ $Date: 2001-05-08 12:02:45 $
+ * last change: $Author: abi $ $Date: 2001-05-10 15:25:32 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -78,6 +78,20 @@ const sal_Int32 ConceptGroupGenerator::BitsInLabel = 4;
RoleFiller RoleFiller::roleFiller_;
+RoleFiller::RoleFiller()
+ : conceptData_( 0 ),
+ fixedRole_( 0 ),
+ filled_( 0 ),
+ begin_( 0 ),
+ end_( 0 ),
+ limit_( 0 ),
+ parentContext_( 0 ),
+ next_( 0 ),
+ fillers_( 0 )
+{
+}
+
+
RoleFiller::RoleFiller( sal_Int32 nColumns,
ConceptData* first,
sal_Int32 role,
@@ -86,7 +100,8 @@ RoleFiller::RoleFiller( sal_Int32 nColumns,
sal_Int32 limit )
: next_( 0 ),
conceptData_( first ),
- fixedRole_( sal_Int8( role) ) // primary/constitutive concept/role
+ fixedRole_( sal_uInt8( role & 0xF ) ), // primary/constitutive concept/role
+ fillers_( nColumns )
{
// cout << "RoleFiller constructed" << nColumns << ' ' << role << ' ' << pos << endl;
filled_ = sal_Int16( 1 << fixedRole_ );
@@ -96,8 +111,7 @@ RoleFiller::RoleFiller( sal_Int32 nColumns,
limit_ = limit;
parentContext_ = parentContext;
next_ = 0;
- fillers_ = new RoleFiller*[ fillersL_ = nColumns ];
- for( int i = 0; i < fillersL_; ++i )
+ for( sal_uInt32 i = 0; i < fillers_.size(); ++i )
fillers_[i] = 0;
fillers_[ role ] = this;
}
@@ -105,9 +119,8 @@ RoleFiller::RoleFiller( sal_Int32 nColumns,
RoleFiller::~RoleFiller()
{
- for( int i = 0; i < fillersL_; ++i )
+ for( sal_uInt32 i = 0; i < fillers_.size(); ++i )
delete fillers_[i];
- delete[] fillers_;
}
@@ -251,6 +264,66 @@ double RoleFiller::penalty( Query* query,sal_Int32 nColumns )
+NextDocGenerator::NextDocGenerator( ConceptData* cd,XmlIndex* env )
+ : document_( 0 ),
+ concept_( cd ? cd->getConcept() : -1 ),
+ queryMask_( cd ? cd->getQueryMask() : -1 ),
+ terms_( cd ),
+ iterator_( env->getDocumentIterator( concept_ ) )
+{
+}
+
+
+
+void NextDocGeneratorHeap::reset()
+{
+ for( sal_Int32 i = 0; i < heapSize_; ++i )
+ {
+ delete heap_[i]; heap_[i] = 0;
+ }
+ free_ = 0;
+ nonEmpty_ = false;
+}
+
+
+
+void NextDocGeneratorHeap::addGenerator( NextDocGenerator* gen )
+{
+ if( sal_uInt32( free_ ) == heap_.size() )
+ {
+ heap_.push_back( 0 );
+ }
+
+ heap_[free_++] = gen;
+}
+
+
+
+void NextDocGeneratorHeap::start()
+{
+ if( ( heapSize_ = free_ ) > 0 )
+ {
+ for( sal_Int32 i = heapSize_ / 2; i >= 0; --i )
+ heapify(i);
+ nonEmpty_ = true;
+ }
+ else
+ nonEmpty_ = false;
+}
+
+
+void NextDocGeneratorHeap::step() throw( excep::XmlSearchException )
+{
+ if( heap_[0]->next() != NonnegativeIntegerGenerator::END )
+ heapify(0);
+ else if ( heapSize_ > 1 )
+ {
+ heap_[0] = heap_[--heapSize_];
+ heapify(0);
+ }
+ else
+ nonEmpty_ = false;
+}
void NextDocGeneratorHeap::heapify( sal_Int32 i )
@@ -276,26 +349,14 @@ void NextDocGeneratorHeap::heapify( sal_Int32 i )
}
-void NextDocGeneratorHeap::step() throw( excep::XmlSearchException )
-{
- if( heap_[0]->next() != NonnegativeIntegerGenerator::END )
- heapify(0);
- else if ( heapSize_ > 1 )
- {
- heap_[0] = heap_[--heapSize_];
- heapify(0);
- }
- else
- nonEmpty_ = false;
-}
-
-
bool NextDocGeneratorHeap::atDocument( sal_Int32 document )
{
return nonEmpty_ && heap_[0]->getDocument() == document;
}
+
+
ConceptGroupGenerator::ConceptGroupGenerator( sal_Int32 dataL,sal_Int8* data,sal_Int32 index,sal_Int32 k )
: last_( 0 ),
k1_( k ),
@@ -362,59 +423,43 @@ void ConceptGroupGenerator::init( sal_Int32 bytesL,sal_Int8* bytes,sal_Int32 ind
last_ = 0;
for( sal_Int32 i = 0;i < NConceptsInGroup; i++ )
{
- delete table_[i];
+// delete table_[i];
table_[i] = 0;
}
}
-bool GeneratorHeap::start( std::vector< RoleFiller* >& array ) throw( xmlsearch::excep::XmlSearchException )
+void ConceptGroupGenerator::addTerms( sal_Int32 index,ConceptData* terms )
{
- if( ( heapSize_ = heap_.size() ) > 0 )
- {
- for( sal_Int32 i = 0; i < heapSize_; ++i )
- heap_[i]->next();
-
- buildHeap();
- heap_[0]->generateFillers( array );
- return true;
- }
- else
- return false;
+ table_[ index ] = terms;
}
-bool GeneratorHeap::next( std::vector< RoleFiller* >& array ) throw( xmlsearch::excep::XmlSearchException )
+
+void GeneratorHeap::reset()
{
- if( heapSize_ > 0 )
+ for( sal_Int32 i = 0; i < heapSize_; ++i )
{
- if( ! heap_[0]->next() ) // no more
- if( heapSize_ > 1)
- heap_[0] = heap_[--heapSize_];
- else
- {
- heapSize_ = 0;
- return false;
- }
- heapify(0);
- heap_[0]->generateFillers( array );
- return true;
+ delete heap_[i]; heap_[i] = 0;
}
- else
- return false;
+ free_ = 0;
}
-
-void GeneratorHeap::reset()
+void GeneratorHeap::addGenerator( ConceptGroupGenerator* cd )
{
- for( sal_uInt32 i = 0; i < heap_.size(); ++i )
- delete heap_[i];
- heap_.clear();
- heapSize_ = 0;
-}
+ if( sal_uInt32( free_ ) == heap_.size() )
+ {
+ heap_.push_back( 0 );
+ }
+ else
+ {
+// delete heap_[free_];
+ }
+ heap_[free_++] = cd;
+}
void GeneratorHeap::buildHeap()
@@ -428,8 +473,8 @@ void GeneratorHeap::heapify( sal_Int32 root )
{
for( sal_Int32 smallest = 0; ; )
{
- sal_Int32 right = ( root + 1 ) << 1;
- sal_Int32 left = right - 1;
+ const sal_Int32 right = ( root + 1 ) << 1;
+ const sal_Int32 left = right - 1;
smallest = ( left < heapSize_ && heap_[left]->position() < heap_[ root ]->position() ) ? left : root;
if( right< heapSize_ && heap_[right]->position() < heap_[smallest]->position() )
smallest = right;
@@ -445,3 +490,42 @@ void GeneratorHeap::heapify( sal_Int32 root )
}
}
+
+bool GeneratorHeap::start( std::vector< RoleFiller* >& array ) throw( xmlsearch::excep::XmlSearchException )
+{
+ if( ( heapSize_ = free_ ) > 0 )
+ {
+ for( sal_Int32 i = 0; i < free_; ++i )
+ heap_[i]->next();
+
+ buildHeap();
+ heap_[0]->generateFillers( array );
+ return true;
+ }
+ else
+ return false;
+}
+
+
+bool GeneratorHeap::next( std::vector< RoleFiller* >& array ) throw( xmlsearch::excep::XmlSearchException )
+{
+ if( heapSize_ > 0 )
+ {
+ if( ! heap_[0]->next() ) // no more
+ if( heapSize_ > 1)
+ {
+ delete heap_[0];
+ heap_[0] = heap_[--heapSize_];
+ }
+ else
+ {
+ heapSize_ = 0;
+ return false;
+ }
+ heapify(0);
+ heap_[0]->generateFillers( array );
+ return true;
+ }
+ else
+ return false;
+}
diff --git a/xmlhelp/source/cxxhelp/qe/Query.cxx b/xmlhelp/source/cxxhelp/qe/Query.cxx
index 8c4dde5e5bf6..adca71711975 100644
--- a/xmlhelp/source/cxxhelp/qe/Query.cxx
+++ b/xmlhelp/source/cxxhelp/qe/Query.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: Query.cxx,v $
*
- * $Revision: 1.1 $
+ * $Revision: 1.2 $
*
- * last change: $Author: abi $ $Date: 2001-05-08 12:02:45 $
+ * last change: $Author: abi $ $Date: 2001-05-10 15:25:32 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -87,7 +87,8 @@ using namespace xmlsearch::qe;
HitStore::HitStore( double initialStandard,sal_Int32 limit,sal_Int32 nColumns )
: standard_( initialStandard ),
- heap_( limit_ = limit ),
+ limit_( limit ),
+ heap_( limit ),
nColumns_( nColumns ),
free_( 0 ),
index_( 0 )
@@ -112,7 +113,6 @@ bool HitStore::goodEnough( double penalty, sal_Int32 begin, sal_Int32 end )
}
-
QueryHit* HitStore::createQueryHit( double penalty,sal_Int32 doc,sal_Int32 begin,sal_Int32 end )
{
QueryHit* hit = new QueryHit( nColumns_,penalty,doc,begin,end );
@@ -137,15 +137,63 @@ QueryHit* HitStore::createQueryHit( double penalty,sal_Int32 doc,sal_Int32 begin
}
+struct CompareQueryHit
+{
+ inline int operator()( const QueryHit* l,const QueryHit* r );
+};
+
+
+int CompareQueryHit::operator()( const QueryHit* l,const QueryHit* r )
+{
+ return l->compareTo( r );
+}
+
+
#include <stl/algorithm>
+sal_Int32 QueryHit::compareTo( const QueryHit* o ) const
+{
+ if( penalty_ != o->penalty_ )
+ return penalty_ < o->penalty_ ? -1 : 1;
+ else if( begin_ != o->begin_ )
+ return begin_ < o->begin_ ? -1 : 1;
+ else if( end_ != o->end_ )
+ return end_ < o->end_ ? -1 : 1;
+ else
+ return 0;
+}
+
+
QueryHit* HitStore::firstBestQueryHit()
{
+// for( sal_uInt32 i = 0; i < heap_.size(); ++i )
+// {
+// heap_[i]->setNum( i );
+// printf( " element %d = %x\n",i,heap_[i] );
+// }
+
+// printf( " and the size %d(%d)\n", free_,heap_.size() );
+
if( free_ > 0)
{
- // std::sort( heap_.begin(),heap_.end() );
- // Arrays.sort( heap_,0,free_ );
+// std::vector< sal_Int32 > bla(100);
+// for( i = 0; i < 100; ++i )
+// bla[i] = i*(i-99);
+// std::sort( bla.begin(),bla.end() );
+
+// CompareQueryHit bla;
+
+// std::sort( heap_.begin(),heap_.end(),bla );
+
+ // quicksort( 0,free_ - 1 );
+
+// for( i = 0; i < heap_.size(); ++i )
+// {
+// heap_[i]->setNum( i );
+// printf( " element %d = %x\n",i,heap_[i] );
+// }
+
index_ = 0;
return nextBestQueryHit();
}
@@ -181,6 +229,38 @@ void HitStore::heapify( sal_Int32 i )
}
+sal_Int32 HitStore::partition( sal_Int32 p,sal_Int32 r )
+{
+ QueryHit* x = heap_[ ((p + r) >> 1) & 0x7FFFFFFF ];
+ sal_Int32 i = p - 1, j = r + 1;
+ while( true )
+ {
+ while( x->compareTo( heap_[--j] ) )
+ ;
+ while( heap_[++i]->compareTo( x ) )
+ ;
+ if( i < j )
+ {
+ QueryHit* t = heap_[i];
+ heap_[i] = heap_[j];
+ heap_[j] = t;
+ }
+ else
+ return j;
+ }
+}
+
+
+void HitStore::quicksort( sal_Int32 p,sal_Int32 r )
+{
+ while( p < r )
+ {
+ sal_Int32 q = partition( p,r );
+ quicksort(p, q);
+ p = q + 1;
+ }
+}
+
/******************************************************************************/
@@ -214,8 +294,6 @@ Query::Query( XmlIndex* env,
{
// for the EmptyQuery case (awaits arch improvement pass)
- //cout << " upperboundTemplateL_ = " << upperboundTemplateL_ << endl;
-
if( missingPenalties )
for( sal_Int32 i = 0;i < nColumns_; ++i )
missingPenalty_[i] = missingPenalties[i];
@@ -340,6 +418,12 @@ bool Query::vote()
}
+void Query::updateEstimate( sal_Int32 role,double penalty )
+{
+ if( penalty < upperboundTemplate_[ role ] )
+ upperboundTemplate_[ role ] = penalty;
+}
+
/******************************************************************************/
/* */
diff --git a/xmlhelp/source/cxxhelp/qe/Search.cxx b/xmlhelp/source/cxxhelp/qe/Search.cxx
index bcc115fa6353..ef422e9bfe4e 100644
--- a/xmlhelp/source/cxxhelp/qe/Search.cxx
+++ b/xmlhelp/source/cxxhelp/qe/Search.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: Search.cxx,v $
*
- * $Revision: 1.1 $
+ * $Revision: 1.2 $
*
- * last change: $Author: abi $ $Date: 2001-05-08 12:02:45 $
+ * last change: $Author: abi $ $Date: 2001-05-10 15:25:32 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -126,7 +126,8 @@ Search::Search( XmlIndex* env )
dataL_( 0 ),
data_( 0 ),
base_( 0 ),
- concepts_( new sal_Int32[ ConceptGroupGenerator::NConceptsInGroup ] )
+ concepts_( new sal_Int32[ ConceptGroupGenerator::NConceptsInGroup ] ),
+ free2_( 0 )
{
}
@@ -186,108 +187,85 @@ extern ostream& operator<<( ostream& out,const rtl::OUString& bla );
void Search::startSearch()
{
-#ifdef ABIDEBUG
-// for( int k = 0; k < conceptData_.size(); ++k )
-// {
-// if( ! conceptData_[k] )
-// continue;
-
-// cout << conceptData_[k]->getConcept() << endl;
-// cout << conceptData_[k]->getPenalty() << endl;
-// cout << sal_Int32( conceptData_[k]->getRole() ) << endl;
-// cout << sal_Int32( conceptData_[k]->getQuery() ) << endl;
-// cout << conceptData_[k]->getScore() << endl;
-// }
-#endif
-
- sal_Int32 i,j;
- // set up ConceptData lists
- // order search terms
- sal_Int32 _free2 = conceptData_.size();
- quicksort( 0, _free2 - 1);
-
- // remove duplicates
- for (i = 0; i < _free2 - 1; i = j)
- for (j = i + 1; j < _free2; j++)
- if( conceptData_[i]->crqEquals( conceptData_[j] ) )
- conceptData_[j] = 0;
- else
- i = j;
-
- // create lists
- for( i = 0; i < _free2 - 1; i = j )
- for (j = i + 1; j < _free2; j++ )
- if( conceptData_[j] )
- if( conceptData_[i]->cEquals( conceptData_[j] ) )
- {
- conceptData_[i]->addLast( conceptData_[j] );
- conceptData_[j] = 0;
- }
- else
- i = j;
-
- // densify
- for (i = 0; i < _free2 - 1; i++)
- if( ! conceptData_[i] )
- for( j = i + 1; j < _free2; j++)
- if (conceptData_[j] )
- {
- conceptData_[i] = conceptData_[j];
- conceptData_[j] = 0;
- break;
- }
+ sal_Int32 i,j;
+ // set up ConceptData lists
+ // order search terms
+ quicksort( 0, free2_ - 1);
-#ifdef ABIDEBUG
- for( i = 0; i < conceptData_.size(); ++i )
+ // remove duplicates
+ for (i = 0; i < free2_ - 1; i = j)
{
- if( ! conceptData_[i] )
- continue;
-
-// cout << conceptData_[i]->getConcept() << endl;
-// cout << conceptData_[i]->getPenalty() << endl;
-// cout << sal_Int32( conceptData_[i]->getRole() ) << endl;
-// cout << sal_Int32( conceptData_[i]->getQuery() ) << endl;
-// cout << conceptData_[i]->getScore() << endl;
+ for (j = i + 1; j < free2_; j++)
+ {
+ if( conceptData_[i]->crqEquals( conceptData_[j] ) )
+ conceptData_[j] = 0;
+ else
+ i = j;
+ }
}
-#endif
- // set up new document generators
- nextDocGenHeap_.reset();
- for( i = 0; i < _free2 && conceptData_[i]; i++)
+ // create lists
+ for( i = 0; i < free2_ - 1; i = j )
{
-#ifdef ABIDEBUG
-// if( conceptData_[i] )
-// cout << rtl::OUString::createFromAscii( "conceptData not zero" ) << endl;
-#endif
+ for (j = i + 1; j < free2_; j++ )
+ {
+ if( conceptData_[j] )
+ if( conceptData_[i]->cEquals( conceptData_[j] ) )
+ {
+ conceptData_[i]->addLast( conceptData_[j] );
+ conceptData_[j] = 0;
+ }
+ else
+ i = j;
+ }
+ }
- NextDocGenerator* gen = new NextDocGenerator( conceptData_[i],env_ );
- try
+ // densify
+ for( i = 0; i < free2_ - 1; i++)
{
- sal_Int32 doc;
- gen->first();
- if( ( doc = gen->getDocument() ) != NonnegativeIntegerGenerator::END )
+ if( ! conceptData_[i] )
{
- /* !!! ??? is concept length used any more in any way
- conceptData_[i].
- setConceptLength(_env.
- getConceptLength(conceptData_[i].getConcept()));
- */
-// cout << "doc = " << doc << endl;
- nextDocGenHeap_.addGenerator( gen );
+ for( j = i + 1; j < free2_; j++)
+ {
+ if (conceptData_[j] )
+ {
+ conceptData_[i] = conceptData_[j];
+ conceptData_[j] = 0;
+ break;
+ }
+ }
}
}
- catch( ... )
+
+ // set up new document generators
+ nextDocGenHeap_.reset();
+ for( i = 0; i < free2_ && conceptData_[i]; i++)
{
-#ifdef ABIDEBUG
- // cout << "Search::startSearch -> catched exception" << endl;
-#endif
- }
+ NextDocGenerator* gen = new NextDocGenerator( conceptData_[i],env_ );
+ try
+ {
+ sal_Int32 doc;
+ gen->first();
+ if( ( doc = gen->getDocument() ) != NonnegativeIntegerGenerator::END )
+ {
+ /* !!! ??? is concept length used any more in any way
+ conceptData_[i].
+ setConceptLength(_env.
+ getConceptLength(conceptData_[i].getConcept()));
+ */
+ nextDocGenHeap_.addGenerator( gen );
+ }
+ }
+ catch( ... )
+ {
+ printf( "Search::startSearch -> catched exception \n" );
+ }
}
- nextDocGenHeap_.start();
- env_->reset();
- env_->resetContextSearch();
- searchDocument();
+ nextDocGenHeap_.start();
+ env_->reset();
+ env_->resetContextSearch();
+ searchDocument();
}
@@ -295,20 +273,16 @@ void Search::startSearch()
void Search::addTerm( sal_Int32 col,sal_Int32 concept,double score )
{
-#ifdef ABIDEBUG
-// cout << concept << endl;
-#endif
if( env_->occursInText( concept ) )
{
-#ifdef ABIDEBUG
-// cout << "occurs" << endl;
-#endif
- conceptData_.push_back( queries_[queries_.size()-1]->makeConceptData( col,concept,score,queries_.size()-1 ) );
+ ConceptData* cd = queries_[queries_.size()-1]->makeConceptData( col,concept,score,queries_.size()-1 );
+ if( sal_uInt32( free2_ ) == conceptData_.size() )
+ {
+ conceptData_.push_back( 0 );
+ conceptVisitor_ = &conceptData_[0];
+ }
+ conceptData_[ free2_++ ] = cd;
}
-#ifdef ABIDEBUG
-// else
-// cout << "does not occur" << endl;
-#endif
}
@@ -322,7 +296,7 @@ void Search::searchDocument()
{
try
{
- switch( nextDocument( start ) )
+ switch( nextDocument( start ) )
{
case 0: // multi group
genHeap_.start( start );
@@ -362,6 +336,9 @@ void Search::searchDocument()
}
+extern void print_rtl_OUString( const rtl::OUString bla );
+
+
sal_Int32 Search::nextDocument( std::vector< RoleFiller* >& start ) throw( xmlsearch::excep::XmlSearchException )
{
while( nextDocGenHeap_.isNonEmpty() )
@@ -381,7 +358,8 @@ sal_Int32 Search::nextDocument( std::vector< RoleFiller* >& start ) throw( xmlse
{
docConcepts_.push_back( nextDocGenHeap_.getConcept() );
queryMasks_.push_back( nextDocGenHeap_.getQueryMask() );
- ( conceptData_[ index++ ] = nextDocGenHeap_.getTerms() )->runBy( queries_ );
+ ConceptData *conceptData = ( conceptData_[ index++ ] = nextDocGenHeap_.getTerms() );
+ conceptData->runBy( queries_ );
nextDocGenHeap_.step();
}
while( nextDocGenHeap_.atDocument( document_) );
@@ -393,22 +371,10 @@ sal_Int32 Search::nextDocument( std::vector< RoleFiller* >& start ) throw( xmlse
// and, with more care, creation of some GroupGenerators can be avoided
// saturating queries with lots of good hits will lead to best results
- rtl::OUString docName = env_->documentName( document_);
-
-#ifdef ABIDEBUG
-// if( document_ == 148 )
-// {
-// cout << "_document = " << document_ << endl;
-// cout << "docName = " << env_->documentName( document_) << endl;
-// }
-// else
-// {
-//
-// cout << "_document = " << document_ << endl;
-// cout << "docName = " << docName << endl;
-// }
-#endif
+// printf( "docNo = %d",document_);
+// print_rtl_OUString( ( rtl::OUString::createFromAscii( " docName = ") +
+// env_->documentName( document_) ) );
sal_Int32 voteMask = 0;
Query* query;
@@ -468,15 +434,7 @@ sal_Int32 Search::nextDocument( std::vector< RoleFiller* >& start ) throw( xmlse
{ // single group
for( sal_Int32 i = 0; i < index; i++ )
if( queryMasks_[i] & voteMask )
-// #ifdef ABIDEBUG
-// {
-// sal_Int32 bla = indexOf( docConcepts_[i] );
-// cout << "indexOf = " << bla << endl;
-// firstGenerator_.addTerms( bla,conceptData_[i] );
-// }
-// #elif
- firstGenerator_.addTerms( indexOf( docConcepts_[i] ),conceptData_[i] );
-// #endif
+ firstGenerator_.addTerms( indexOf( docConcepts_[i] ),conceptData_[i] );
return 1;
}
}
@@ -489,50 +447,50 @@ sal_Int32 Search::nextDocument( std::vector< RoleFiller* >& start ) throw( xmlse
bool Search::openDocumentIndex( sal_Int32 docNo ) throw( excep::XmlSearchException )
{
- data_ = env_->getPositions( dataL_,docNo );
- base_ = env_->getDocumentIndex( docNo );
+ data_ = env_->getPositions( dataL_,docNo );
+ base_ = env_->getDocumentIndex( docNo );
- startingIndex_ = 0;
- sal_Int32 kk = data_[ base_ ] & 0xFF, k2;
+ startingIndex_ = 0;
+ sal_Int32 kk = data_[ base_ ] & 0xFF, k2;
- switch( kk >> 6 )
+ switch( kk >> 6 )
{ // get type
- case 0: // single group, no extents
- k2 = data_[base_ + 1];
- firstGenerator_.init( dataL_,data_,base_ += 2,k2 );
- // decode concept table
- nConcepts_ = firstGenerator_.decodeConcepts( kk & 0x3F,0,concepts_ );
+ case 0: // single group, no extents
+ k2 = data_[base_ + 1];
+ firstGenerator_.init( dataL_,data_,base_ += 2,k2 );
+ // decode concept table
+ nConcepts_ = firstGenerator_.decodeConcepts( kk & 0x3F,0,concepts_ );
// cout << "false" << endl;
- return false;
-
- case 2: // multi group, no extents
- {
- kTable_.clear();
- offsets_.clear();
- maxConcepts_.clear();
- util::ByteArrayDecompressor compr( dataL_,data_,base_ + 1 );
- compr.decode( kk & 0x3F,kTable_ );
-
- sal_Int32 last = kTable_.back();
- kTable_.pop_back();
- compr.ascDecode( last,offsets_ );
- last = kTable_.back();
- kTable_.pop_back();
- compr.ascDecode( last,maxConcepts_ );
-
- base_ += 1 + compr.bytesRead();
- limit_ = maxConcepts_.size();
- }
+ return false;
+
+ case 2: // multi group, no extents
+ {
+ kTable_.clear();
+ offsets_.clear();
+ maxConcepts_.clear();
+ util::ByteArrayDecompressor compr( dataL_,data_,base_ + 1 );
+ compr.decode( kk & 0x3F,kTable_ );
+
+ sal_Int32 last = kTable_.back();
+ kTable_.pop_back();
+ compr.ascDecode( last,offsets_ );
+ last = kTable_.back();
+ kTable_.pop_back();
+ compr.ascDecode( last,maxConcepts_ );
+
+ base_ += 1 + compr.bytesRead();
+ limit_ = maxConcepts_.size();
+ }
// cout << "true" << endl;
- return true;
+ return true;
- case 1: // single group, extents
- case 3: // multi group, extents
- throw excep::XmlSearchException( rtl::OUString::createFromAscii( "extents not yet implemented\n" ) );
+ case 1: // single group, extents
+ case 3: // multi group, extents
+ throw excep::XmlSearchException( rtl::OUString::createFromAscii( "extents not yet implemented\n" ) );
}
// cout << "false1" << endl;
- return false;
+ return false;
}
@@ -540,52 +498,52 @@ bool Search::openDocumentIndex( sal_Int32 docNo ) throw( excep::XmlSearchExcepti
ConceptGroupGenerator* Search::makeGenerator( sal_Int32 group )
- throw( excep::XmlSearchException )
+ throw( excep::XmlSearchException )
{
- sal_Int32 shift,index;
- if( group > 0 )
+ sal_Int32 shift,index;
+ if( group > 0 )
{
- index = base_ + offsets_[ group - 1 ];
- shift = maxConcepts_[ group - 1 ];
+ index = base_ + offsets_[ group - 1 ];
+ shift = maxConcepts_[ group - 1 ];
}
- else
+ else
{
- index = base_;
- shift = 0;
+ index = base_;
+ shift = 0;
}
- // initialize generator
- ConceptGroupGenerator* gen =
- new ConceptGroupGenerator( dataL_,data_,index,kTable_[ 2*group + 1 ] );
- // decode concept table
- nConcepts_ = gen->decodeConcepts( kTable_[2*group],shift,concepts_ );
+ // initialize generator
+ ConceptGroupGenerator* gen =
+ new ConceptGroupGenerator( dataL_,data_,index,kTable_[ 2*group + 1 ] );
+ // decode concept table
+ nConcepts_ = gen->decodeConcepts( kTable_[2*group],shift,concepts_ );
- if( group < limit_ )
- max_ = concepts_[ nConcepts_ ] = maxConcepts_[ group ];
- else
- max_ = concepts_[ nConcepts_ - 1 ];
+ if( group < limit_ )
+ max_ = concepts_[ nConcepts_ ] = maxConcepts_[ group ];
+ else
+ max_ = concepts_[ nConcepts_ - 1 ];
- genHeap_.addGenerator( gen );
- startingIndex_ = 0; // in _concepts; lower search index
- return gen;
+ genHeap_.addGenerator( gen );
+ startingIndex_ = 0; // in _concepts; lower search index
+ return gen;
}
sal_Int32 Search::indexOf(sal_Int32 concept) throw( excep::XmlSearchException )
{
- sal_Int32 i = startingIndex_,j = nConcepts_,k;
- while( i <= j )
- if( concepts_[ k = (i + j)/2 ] < concept )
- i = k + 1;
- else if( concept < concepts_[k] )
- j = k - 1;
- else
- {
- startingIndex_ = k + 1;
- return k;
- }
- throw excep::XmlSearchException( rtl::OUString::createFromAscii( "indexOf not found" ) );
+ sal_Int32 i = startingIndex_,j = nConcepts_,k;
+ while( i <= j )
+ if( concepts_[ k = (i + j)/2 ] < concept )
+ i = k + 1;
+ else if( concept < concepts_[k] )
+ j = k - 1;
+ else
+ {
+ startingIndex_ = k + 1;
+ return k;
+ }
+ throw excep::XmlSearchException( rtl::OUString::createFromAscii( "indexOf not found" ) );
}
@@ -593,22 +551,22 @@ sal_Int32 Search::indexOf(sal_Int32 concept) throw( excep::XmlSearchException )
sal_Int32 Search::partition( sal_Int32 p,sal_Int32 r )
{
- ConceptData* x = conceptData_[ ((p + r) >> 1) & 0x7FFFFFFF ];
- sal_Int32 i = p - 1, j = r + 1;
- while( true )
- {
- while( x->compareWith( conceptData_[--j] ) )
- ;
- while( conceptData_[++i]->compareWith( x ) )
- ;
- if( i < j )
+ ConceptData* x = conceptData_[ ((p + r) >> 1) & 0x7FFFFFFF ];
+ sal_Int32 i = p - 1, j = r + 1;
+ while( true )
{
- ConceptData* t = conceptData_[i];
- conceptData_[i] = conceptData_[j];
- conceptData_[j] = t;
- }
- else
- return j;
+ while( x->compareWith( conceptData_[--j] ) )
+ ;
+ while( conceptData_[++i]->compareWith( x ) )
+ ;
+ if( i < j )
+ {
+ ConceptData* t = conceptData_[i];
+ conceptData_[i] = conceptData_[j];
+ conceptData_[j] = t;
+ }
+ else
+ return j;
}
}
@@ -616,10 +574,10 @@ sal_Int32 Search::partition( sal_Int32 p,sal_Int32 r )
void Search::quicksort( sal_Int32 p,sal_Int32 r )
{
- while (p < r)
+ while (p < r)
{
- sal_Int32 q = partition( p,r );
- quicksort(p, q);
- p = q + 1;
+ sal_Int32 q = partition( p,r );
+ quicksort(p, q);
+ p = q + 1;
}
}
diff --git a/xmlhelp/source/cxxhelp/qe/XmlIndex.cxx b/xmlhelp/source/cxxhelp/qe/XmlIndex.cxx
index f96497db15c3..ad633dd5910e 100644
--- a/xmlhelp/source/cxxhelp/qe/XmlIndex.cxx
+++ b/xmlhelp/source/cxxhelp/qe/XmlIndex.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: XmlIndex.cxx,v $
*
- * $Revision: 1.1 $
+ * $Revision: 1.2 $
*
- * last change: $Author: abi $ $Date: 2001-05-08 12:02:45 $
+ * last change: $Author: abi $ $Date: 2001-05-10 15:25:32 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -325,3 +325,29 @@ void XmlIndex::readMicroindexes( sal_Int32 docNo ) throw( xmlsearch::excep::IOEx
positionsFile_->seek( currentBatchOffset_ );
positionsFile_->readBytes( positions_,upTo - currentBatchOffset_ );
}
+
+
+#ifndef _XMLSEARCH_QE_QUERY_HXX_
+#include <qe/Query.hxx>
+#endif
+
+QueryHitData* XmlIndex::hitToData( QueryHit* hit )
+{
+ sal_Int32 termsL,matchesL;
+ sal_Int32 *matches = hit->getMatches( matchesL );
+ rtl::OUString *terms = new rtl::OUString[ termsL = matchesL >>/*>*/ 1 ];
+ for( sal_Int32 i = 0; i < termsL; ++i )
+ if( matches[ i << 1 ] > 0 )
+ terms[i] = fetch( matches[i << 1] );
+
+ sal_Int32 document = hit->getDocument();
+ QueryHitData *res = new QueryHitData( hit->getPenalty(),
+ documentName( document ),
+ termsL,terms );
+ contextTables_->setMicroindex( document );
+ contextTables_->resetContextSearch();
+// contextTables_->hitLocation(terms, matches, result);
+ return res;
+}
+
+
diff --git a/xmlhelp/source/cxxhelp/qe/makefile.mk b/xmlhelp/source/cxxhelp/qe/makefile.mk
index dfc51d4cae06..fad55953e3be 100644
--- a/xmlhelp/source/cxxhelp/qe/makefile.mk
+++ b/xmlhelp/source/cxxhelp/qe/makefile.mk
@@ -2,9 +2,9 @@
#
# $RCSfile: makefile.mk,v $
#
-# $Revision: 1.1 $
+# $Revision: 1.2 $
#
-# last change: $Author: abi $ $Date: 2001-05-08 12:02:45 $
+# last change: $Author: abi $ $Date: 2001-05-10 15:25:32 $
#
# The Contents of this file are made available subject to the terms of
# either of the following licenses
@@ -70,13 +70,11 @@ ENABLE_EXCEPTIONS=TRUE
# --- Settings -----------------------------------------------------
-.INCLUDE : svpre.mk
.INCLUDE : settings.mk
-.INCLUDE : sv.mk
-# --- Files --------------------------------------------------------
-
-.IF "$(header)" == ""
+.IF "$(GUI)"=="WNT"
+CFLAGS+=/GR
+.ENDIF
SLOFILES=\
$(SLO)$/ConceptData.obj \
@@ -86,7 +84,6 @@ SLOFILES=\
$(SLO)$/QueryProcessor.obj \
$(SLO)$/Search.obj \
$(SLO)$/XmlIndex.obj
-.ENDIF
# --- Targets ------------------------------------------------------
diff --git a/xmlhelp/source/cxxhelp/test/makefile.mk b/xmlhelp/source/cxxhelp/test/makefile.mk
index 335aac898abe..04645b384ea7 100644
--- a/xmlhelp/source/cxxhelp/test/makefile.mk
+++ b/xmlhelp/source/cxxhelp/test/makefile.mk
@@ -2,9 +2,9 @@
#
# $RCSfile: makefile.mk,v $
#
-# $Revision: 1.1 $
+# $Revision: 1.2 $
#
-# last change: $Author: abi $ $Date: 2001-05-08 12:08:05 $
+# last change: $Author: abi $ $Date: 2001-05-10 15:26:22 $
#
# The Contents of this file are made available subject to the terms of
# either of the following licenses
@@ -71,48 +71,30 @@ ENABLE_EXCEPTIONS=TRUE
# --- Settings ---
-.INCLUDE : svpre.mk
.INCLUDE : settings.mk
-.INCLUDE : sv.mk
-# --- Files ---
-.IF "$(depend)" != ""
+.IF "$(GUI)"=="WNT"
+CFLAGS+=/GR
+.ENDIF
+
+# --- Files ---
OBJFILES=\
$(OBJ)$/searchdemo.obj
-.ENDIF # depend
-
-#SRSFILES= $(SRS)$/ucbdemo.srs
-
-#
-# UCBDEMO
-#
APP1TARGET= searchdemo
APP1OBJS=\
$(OBJ)$/searchdemo.obj
-#APP1RES= $(RES)$/searchdemo.res
-
-#.IF "$(COMPHELPERLIB)"==""
-
-#.IF "$(GUI)" == "UNX"
-#COMPHELPERLIB=-licomphelp2
-#.ENDIF # unx
-
-#.IF "$(GUI)"=="WNT"
-#COMPHELPERLIB=icomphelp2.lib
-#.ENDIF # wnt
-
-#.ENDIF
-
APP1STDLIBS=\
$(SALLIB) \
- $(VOSLIB) \
- jaqe.lib \
- jadb.lib \
- jautil.lib
+ $(VOSLIB)
+
+APP1LIBS=\
+ $(SLB)/jaqe.lib \
+ $(SLB)/jadb.lib \
+ $(SLB)/jautil.lib
APP1DEF= $(MISC)\$(APP1TARGET).def
diff --git a/xmlhelp/source/cxxhelp/test/searchdemo.cxx b/xmlhelp/source/cxxhelp/test/searchdemo.cxx
index 6437019f5e09..0884cb8e0849 100644
--- a/xmlhelp/source/cxxhelp/test/searchdemo.cxx
+++ b/xmlhelp/source/cxxhelp/test/searchdemo.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: searchdemo.cxx,v $
*
- * $Revision: 1.1 $
+ * $Revision: 1.2 $
*
- * last change: $Author: abi $ $Date: 2001-05-08 12:08:05 $
+ * last change: $Author: abi $ $Date: 2001-05-10 15:26:22 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -83,19 +83,19 @@ extern RandomAccessStream* theFile();
-// ostream& operator<<( ostream& out,const rtl::OUString& bla )
-// {
-// out << bla.getLength() << endl;
-// rtl::OString bluber = rtl::OString( bla.getStr(),bla.getLength(),RTL_TEXTENCODING_UTF8 );
-// char* bluberChr = new char[ 1+bluber.getLength() ];
-// const sal_Char* jux = bluber.getStr();
+void print_rtl_OUString( const rtl::OUString bla )
+{
+ rtl::OString bluber = rtl::OString( bla.getStr(),bla.getLength(),RTL_TEXTENCODING_UTF8 );
+ char* bluberChr = new char[ 1+bluber.getLength() ];
+ const sal_Char* jux = bluber.getStr();
-// for( int i = 0; i < bluber.getLength(); ++i )
-// bluberChr[i] = jux[i];
+ for( int i = 0; i < bluber.getLength(); ++i )
+ bluberChr[i] = jux[i];
-// bluberChr[ bluber.getLength() ] = 0;
-// return out << bluberChr;
-// }
+ bluberChr[ bluber.getLength() ] = 0;
+ printf( "%s\n",bluberChr );
+ delete[] bluberChr;
+}
extern void bla();
@@ -109,13 +109,13 @@ int main( int argc,char* argv[] )
try
{
- rtl::OUString installDir = rtl::OUString::createFromAscii( "//./home/ab106281/work/index" );
+ rtl::OUString installDir = rtl::OUString::createFromAscii( "//./e|/index/" );
QueryProcessor queryProcessor( installDir );
std::vector<rtl::OUString> Query(1);
Query[0] = ( rtl::OUString::createFromAscii( "text*" ) );
rtl::OUString Scope = rtl::OUString::createFromAscii( "" );
- int HitCount = 100;
+ int HitCount = 10;
QueryStatement queryStatement( HitCount,Query,Scope );
queryResults = queryProcessor.processQuery( queryStatement );
@@ -127,14 +127,22 @@ int main( int argc,char* argv[] )
PrefixTranslator* translator = PrefixTranslator::makePrefixTranslator( translations,2 );
QueryHitIterator* it = queryResults->makeQueryHitIterator();
+ sal_Int32 j = 0;
while( it->next() )
- ; // cout << it->getHit( translator )->getDocument() << endl;
+ {
+ printf( "Ergebnis %2d ",j );
+ QueryHitData* qhd = it->getHit( translator );
+ printf( "Penalty = %10.4f ",qhd->getPenalty() );
+ print_rtl_OUString( qhd->getDocument() );
+ ++j;
+ }
delete it;
}
catch( ... )
{
-
+ printf( "catched exception" );
+ throw;
}
return 0;
}
diff --git a/xmlhelp/source/cxxhelp/util/IndexAccessor.cxx b/xmlhelp/source/cxxhelp/util/IndexAccessor.cxx
index 66c9ac376edd..f96234e179b8 100644
--- a/xmlhelp/source/cxxhelp/util/IndexAccessor.cxx
+++ b/xmlhelp/source/cxxhelp/util/IndexAccessor.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: IndexAccessor.cxx,v $
*
- * $Revision: 1.1 $
+ * $Revision: 1.2 $
*
- * last change: $Author: abi $ $Date: 2001-05-08 12:05:06 $
+ * last change: $Author: abi $ $Date: 2001-05-10 15:25:58 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -79,26 +79,7 @@ class RandomAccessStreamImpl
{
public:
- RandomAccessStreamImpl( const rtl::OUString& aPath,const rtl::OUString& how )
- : file_( aPath )
- {
- sal_uInt32 flags = 0;
- const sal_Unicode* bla = how.getStr();
-
- for( int i = 0; i < how.getLength(); ++i )
- if( bla[i] == sal_Unicode( 'r' ) )
- flags |= Read;
- else if( bla[i] == sal_Unicode( 'w' ) )
- flags |= Write;
- else if( bla[i] == sal_Unicode( 'c' ) )
- flags |= Create;
-
-
- if( file_.open( flags ) != osl::FileBase::E_None )
- {
- file_.close();
- }
- }
+ RandomAccessStreamImpl( const rtl::OUString& aPath,const rtl::OUString& how );
~RandomAccessStreamImpl()
{
@@ -113,7 +94,11 @@ public:
virtual sal_Int32 readBytes( sal_Int8* data,sal_Int32 num )
{
sal_uInt64 nbytesread;
- file_.read( (void*)(data), sal_uInt64(num),nbytesread );
+ osl::FileBase::RC err = file_.read( (void*)(data), sal_uInt64(num),nbytesread );
+
+ if( err != osl::FileBase::E_None )
+ printf( "Bytes requested = %d, Bytes read = %d\n",num,sal_Int32( nbytesread ) );
+
return sal_Int32( nbytesread );
}
@@ -126,7 +111,7 @@ public:
{
osl::DirectoryItem aItem;
osl::FileStatus aStatus( FileStatusMask_FileSize );
- osl::DirectoryItem::get( file_,aItem );
+ osl::DirectoryItem::get( path_,aItem );
aItem.getFileStatus( aStatus );
return sal_Int32( aStatus.getFileSize() );
}
@@ -139,13 +124,38 @@ public:
private:
- osl::File file_;
+ rtl::OUString path_;
+ osl::File file_;
};
+RandomAccessStreamImpl::RandomAccessStreamImpl( const rtl::OUString& aPath,const rtl::OUString& how )
+ : path_( aPath ),
+ file_( aPath )
+{
+ sal_uInt32 flags = 0;
+ const sal_Unicode* bla = how.getStr();
+
+ for( int i = 0; i < how.getLength(); ++i )
+ {
+ if( bla[i] == sal_Unicode( 'r' ) )
+ flags |= Read;
+ else if( bla[i] == sal_Unicode( 'w' ) )
+ flags |= Write;
+ else if( bla[i] == sal_Unicode( 'c' ) )
+ flags |= Create;
+ }
+
+ if( file_.open( flags ) != osl::FileBase::E_None )
+ {
+ printf( "RandomAccessStreamImpl closed" );
+ file_.close();
+ }
+}
+
-RandomAccessStreamImpl Dic( rtl::OUString::createFromAscii( "//./home/ab106281/work/index/DICTIONARY" ),
- rtl::OUString::createFromAscii( "how" ) );
+RandomAccessStreamImpl Dic( rtl::OUString::createFromAscii( "//./e:/index/DICTIONARY" ),
+ rtl::OUString::createFromAscii( "r" ) );
RandomAccessStream* theFile()
diff --git a/xmlhelp/source/cxxhelp/util/makefile.mk b/xmlhelp/source/cxxhelp/util/makefile.mk
index c9d27cb86699..afafcae8a84c 100644
--- a/xmlhelp/source/cxxhelp/util/makefile.mk
+++ b/xmlhelp/source/cxxhelp/util/makefile.mk
@@ -2,9 +2,9 @@
#
# $RCSfile: makefile.mk,v $
#
-# $Revision: 1.1 $
+# $Revision: 1.2 $
#
-# last change: $Author: abi $ $Date: 2001-05-08 12:05:06 $
+# last change: $Author: abi $ $Date: 2001-05-10 15:25:58 $
#
# The Contents of this file are made available subject to the terms of
# either of the following licenses
@@ -70,18 +70,15 @@ ENABLE_EXCEPTIONS=TRUE
# --- Settings -----------------------------------------------------
-.INCLUDE : svpre.mk
.INCLUDE : settings.mk
-.INCLUDE : sv.mk
-# --- Files --------------------------------------------------------
-
-.IF "$(header)" == ""
+.IF "$(GUI)"=="WNT"
+CFLAGS+=/GR
+.ENDIF
SLOFILES=\
$(SLO)$/Decompressor.obj \
$(SLO)$/IndexAccessor.obj
-.ENDIF
# --- Targets ------------------------------------------------------