Ignore:
Timestamp:
2010-12-17T14:04:10+13:00 (13 years ago)
Author:
sjm84
Message:

Committing 64 bit changes into the branch

File:
1 edited

Legend:

Unmodified
Added
Removed
  • main/branches/64_bit_Greenstone/greenstone2/common-src/indexers/mgpp/text/ivf.pass1.cpp

    r16583 r23508  
    5151// structure to determine level information
    5252struct LevelWorker {
    53   unsigned long lastLevelDocNum;
    54   unsigned long count;
     53  mg_u_long lastLevelDocNum;
     54  mg_u_long count;
    5555
    5656  LevelWorker () {
     
    6262// note: the word is stored in the map
    6363struct IvfWordInfo {
    64   unsigned long wordCount;      // word frequency
    65   unsigned long fragCount;      // number of fragments that contain the word
    66   unsigned long lastFragNum;    // last fragment to contain the word
    67   unsigned long chunkWordCount; // word frequency within this chunk
    68   unsigned long chunkFragCount; // number of fragments within this chunk that
     64  mg_u_long wordCount;      // word frequency
     65  mg_u_long fragCount;      // number of fragments that contain the word
     66  mg_u_long lastFragNum;    // last fragment to contain the word
     67  mg_u_long chunkWordCount; // word frequency within this chunk
     68  mg_u_long chunkFragCount; // number of fragments within this chunk that
    6969                                //   contain the word
    7070
     
    8181// tags don't require as much information
    8282struct IvfTagInfo {
    83   unsigned long tagCount;       // tag frequency
    84   unsigned long fragCount;      // number of fragments that contain the tag
    85   unsigned long lastFragNum;    // last fragment to contain the tag
    86   unsigned long chunkFragCount; // number of fragments within this chunk that
     83  mg_u_long tagCount;       // tag frequency
     84  mg_u_long fragCount;      // number of fragments that contain the tag
     85  mg_u_long lastFragNum;    // last fragment to contain the tag
     86  mg_u_long chunkFragCount; // number of fragments within this chunk that
    8787                                //   contain the tag
    8888
     
    109109IvfTagInfoItArray ivfTagInfoOccurOrder;
    110110
    111 static unsigned long chunksWritten;
    112 static unsigned long maxMemNeeded;
    113 
    114 static unsigned long numDocs;
    115 static unsigned long numChunkDocs;
    116 
    117 static unsigned long numFrags;
    118 static unsigned long numChunkFrags;
    119 
    120 static unsigned long numWords;
     111static mg_u_long chunksWritten;
     112static mg_u_long maxMemNeeded;
     113
     114static mg_u_long numDocs;
     115static mg_u_long numChunkDocs;
     116
     117static mg_u_long numFrags;
     118static mg_u_long numChunkFrags;
     119
     120static mg_u_long numWords;
    121121
    122122// the number of document numbers in the inverted file
    123 static unsigned long numChunkEntries;
     123static mg_u_long numChunkEntries;
    124124
    125125// next entry in the inverted file to check memory
    126126// requirements for the current chunk
    127 static unsigned long entryCheckPoint;
     127static mg_u_long entryCheckPoint;
    128128
    129129// information about all the different levels
     
    173173              MAGIC_CHUNK, MG_MESSAGE)))
    174174    return COMPERROR;
    175   fwrite ("    ", sizeof (u_long), 1, ic);  // Space for the maxmem
     175  fwrite ("    ", sizeof (mg_u_long), 1, ic);   // Space for the maxmem
    176176  icb.attachFile (ic);
    177177  icb.encodeStart();
     
    195195
    196196  numChunkEntries = 0;
    197   entryCheckPoint = (unsigned long) ((invf_buffer_size * INIT_CHECK_FRAC) / CHECK_DIV);
     197  entryCheckPoint = (mg_u_long) ((invf_buffer_size * INIT_CHECK_FRAC) / CHECK_DIV);
    198198
    199199  // init the level information
     
    347347
    348348
    349 static unsigned long MemoryRequired (bool wordLevelIndex) {
    350   register unsigned long total = 0;
     349static mg_u_long MemoryRequired (bool wordLevelIndex) {
     350  register mg_u_long total = 0;
    351351
    352352  // add memory required for word entries
     
    372372    if (info.chunkFragCount > 0) {
    373373      // two d entries for each frag entry
    374       unsigned long pTag = info.chunkFragCount*2;
     374      mg_u_long pTag = info.chunkFragCount*2;
    375375      total += BIO_Bblock_Bound (numChunkFrags+pTag, pTag);
    376376    }
     
    385385
    386386/*
    387 static void PrintChunkInfo (unsigned long mem) {
     387static void PrintChunkInfo (mg_u_long mem) {
    388388  cout << "Chunk Number: " << chunksWritten << "\n";
    389389  cout << "numChunkDocs " << numChunkDocs << "\n";
     
    396396  IvfTagInfoMap::iterator tagMapHere = ivfTagInfo.begin();
    397397  IvfTagInfoMap::iterator tagMapEnd = ivfTagInfo.end();
    398   unsigned long tagNum = 0;
     398  mg_u_long tagNum = 0;
    399399  while (tagMapHere != tagMapEnd) {
    400400    cout << (*tagMapHere).first << " " << tagNum
     
    406406*/
    407407
    408 static void OutputChunkInfo (unsigned long mem, bool /*wordLevelIndex*/) {
     408static void OutputChunkInfo (mg_u_long mem, bool /*wordLevelIndex*/) {
    409409  ++chunksWritten;
    410410
     
    493493  // check the amount of memory needed for this chunk
    494494  if (numChunkEntries >= entryCheckPoint) {
    495     unsigned long mem = MemoryRequired (wordLevelIndex);
     495    mg_u_long mem = MemoryRequired (wordLevelIndex);
    496496    if (mem >= invf_buffer_size * CHECK_CLOSE) {
    497497      if (mem > maxMemNeeded) maxMemNeeded = mem;
    498498      OutputChunkInfo (mem, wordLevelIndex);
    499       entryCheckPoint = (unsigned long)
     499      entryCheckPoint = (mg_u_long)
    500500    ((invf_buffer_size * INIT_CHECK_FRAC) / CHECK_DIV);
    501501     
    502502    } else {
    503       entryCheckPoint = (unsigned long)
     503      entryCheckPoint = (mg_u_long)
    504504    (entryCheckPoint * ((CHECK_FRAC * (invf_buffer_size - mem)) / mem) +
    505505     entryCheckPoint);
     
    513513
    514514
    515 static void CalcInvfDictSize (unsigned long &totalBytes,
    516                   unsigned long &indexStringBytes) {
     515static void CalcInvfDictSize (mg_u_long &totalBytes,
     516                  mg_u_long &indexStringBytes) {
    517517  totalBytes = 0;   // The sum of the length of all words, including
    518518            // the length byte
     
    526526  IvfWordInfoMap::iterator wordEnd = ivfWordInfo.end();
    527527  while (wordHere != wordEnd) {
    528     unsigned long wordSize = (*wordHere).first.size();
     528    mg_u_long wordSize = (*wordHere).first.size();
    529529    totalBytes += wordSize + 1;
    530530    indexStringBytes += wordSize + 2;
     
    541541  IvfTagInfoMap::iterator tagEnd = ivfTagInfo.end();
    542542  while (tagHere != tagEnd) {
    543     unsigned long tagSize = (*tagHere).first.size();
     543    mg_u_long tagSize = (*tagHere).first.size();
    544544    totalBytes += tagSize + 1;
    545545    indexStringBytes += tagSize + 2;
     
    642642
    643643  // write out the updated header
    644   fseek (sp, sizeof (u_long), SEEK_SET);
     644  fseek (sp, sizeof (mg_u_long), SEEK_SET);
    645645  if (!idh.Write (sp)) { fclose (sp); return; }
    646646 
     
    691691
    692692  // write out the word translation table
    693   unsigned long wordDictSize = ivfWordInfoOccurOrder.size();
     693  mg_u_long wordDictSize = ivfWordInfoOccurOrder.size();
    694694  IvfWordInfoItArray::iterator wordItHere = ivfWordInfoOccurOrder.begin();
    695695  IvfWordInfoItArray::iterator wordItEnd = ivfWordInfoOccurOrder.end();
    696   unsigned long oN = 0;
     696  mg_u_long oN = 0;
    697697  while (wordItHere != wordItEnd) {
    698698    register IvfWordInfo &ivfWordInfo = (*(*wordItHere)).second;
     
    703703
    704704  // write out the tag translation table
    705   unsigned long tagDictSize = ivfTagInfoOccurOrder.size();
     705  mg_u_long tagDictSize = ivfTagInfoOccurOrder.size();
    706706  IvfTagInfoItArray::iterator tagItHere = ivfTagInfoOccurOrder.begin();
    707707  IvfTagInfoItArray::iterator tagItEnd = ivfTagInfoOccurOrder.end();
     
    737737
    738738  char *temp_str = msg_prefix;
    739   msg_prefix = "ivf.pass1";
     739  msg_prefix = (char*)"ivf.pass1";
    740740
    741741  // output the last chunk
    742742  if (numChunkDocs > 0) {
    743     unsigned long mem = MemoryRequired (wordLevelIndex);
     743    mg_u_long mem = MemoryRequired (wordLevelIndex);
    744744    OutputChunkInfo (mem, wordLevelIndex);
    745745    if (mem > maxMemNeeded) maxMemNeeded = mem;
     
    751751
    752752  // write out the maximum memory required and close the file
    753   fseek (ic, sizeof (long), 0);
     753  fseek (ic, sizeof (mg_u_long), 0);
    754754  WriteUL (ic, maxMemNeeded);
    755755  fclose (ic);
Note: See TracChangeset for help on using the changeset viewer.