Changeset 860

Show
Ignore:
Timestamp:
18.01.2000 16:53:24 (20 years ago)
Author:
rjmcnab
Message:

Fixed a couple of bugs and made building silent if needed.

Location:
trunk/gsdl/src/mgpp
Files:
13 modified

Legend:

Unmodified
Added
Removed
  • trunk/gsdl/src/mgpp/config.h

    r857 r860  
    104104 
    105105/* The number of bytes in a unsigned char *.  */ 
    106 /* #undef SIZEOF_UNSIGNED_CHAR_P */ 
     106#define SIZEOF_UNSIGNED_CHAR_P 4 
    107107 
    108108/* Define if you have the ftime function.  */ 
  • trunk/gsdl/src/mgpp/lib/Makefile.in

    r855 r860  
    3737CFLAGS = @CFLAGS@ -ansi 
    3838else  
    39 CFLAGS = @CFLAGS@ -ansi -DQUIET 
     39CFLAGS = @CFLAGS@ -ansi -DSILENT 
    4040endif 
    4141CPPFLAGS = @CPPFLAGS@ 
  • trunk/gsdl/src/mgpp/lib/messages.cpp

    r855 r860  
    2424/* 
    2525   $Log$ 
     26   Revision 1.2  2000/01/18 03:53:19  rjmcnab 
     27   Fixed a couple of bugs and made building silent if needed. 
     28 
    2629   Revision 1.1  2000/01/14 02:17:10  sjboddie 
    2730   Rodgers new C++ mg 
     
    8689  va_list args; 
    8790 
    88 #ifdef QUIET 
     91#ifdef SILENT 
    8992  return; /* stop those messages!!!! */ 
    9093#endif   
  • trunk/gsdl/src/mgpp/text/FText.cpp

    r855 r860  
    144144bool TextIdx::Read (FILE *f, const TextLevelInfo &levelInfo, 
    145145            unsigned long docNum) { 
    146   SeekTextIdx (f, levelInfo, docNum); 
     146  if (!SeekTextIdx (f, levelInfo, docNum)) return false; 
    147147  return Read (f); 
    148148} 
  • trunk/gsdl/src/mgpp/text/MGQuery.h

    r855 r860  
    111111 
    112112 
    113 #define NO_TERM_RANGE_START LONG_MIN 
    114 #define NO_TERM_RANGE_END   LONG_MAX 
     113#define NO_TERM_RANGE_START (LONG_MIN/2) 
     114#define NO_TERM_RANGE_END   (LONG_MAX/2) 
    115115 
    116116class TermNode { 
  • trunk/gsdl/src/mgpp/text/Makefile.in

    r856 r860  
    4141CPPFLAGS = @CPPFLAGS@ -ansi -g -Wall -Wunused -pedantic -W -Woverloaded-virtual 
    4242else 
    43 CFLAGS = @CFLAGS@ -ansi -Wall -Wunused -pedantic -W -Woverloaded-virtual -g -DNZDL -DQUIET -DSHORT_SUFFIX -DPARADOCNUM 
    44 CPPFLAGS = @CPPFLAGS@ -ansi -Wall -Wunused -pedantic -W -Woverloaded-virtual -g -DNZDL -DQUIET -DSHORT_SUFFIX -DPARADOCNUM 
     43CFLAGS = @CFLAGS@ -ansi -Wall -Wunused -pedantic -W -Woverloaded-virtual -g  -DSILENT -DSHORT_SUFFIX 
     44CPPFLAGS = @CPPFLAGS@ -ansi -Wall -Wunused -pedantic -W -Woverloaded-virtual -g -DSILENT -DSHORT_SUFFIX 
    4545endif 
    4646DEFS = @DEFS@ 
     
    5757# George Buchanan - August 1999 
    5858#  
    59 # The below section is now irrelevant -  
    60 # see the ifndef on CFLAGS above; simply 
    61 # compiling with make NZDL=1 will auto- 
    62 # matically ensure that the NZDL compile 
    63 # mode is used 
    64 # 
    65 ########################################## 
    66 # 
    67 # Uncomment for compiling for the nzdl project 
    68 # 
    69 #CFLAGS = @CFLAGS@ -DNZDL -DQUIET -DSHORT_SUFFIX -DPARADOCNUM 
     59# compiling with make NZDL=1 to ensure that  
     60# the NZDL compile mode is used 
     61# 
    7062########################################## 
    7163 
  • trunk/gsdl/src/mgpp/text/Queryer.cpp

    r855 r860  
    7575  QueryInfo queryInfo; 
    7676  SetCStr (queryInfo.docLevel, "Document"); 
    77   queryInfo.maxDocs = 10; 
     77  queryInfo.maxDocs = 100000; 
    7878  queryInfo.sortByRank = true; 
    7979  queryInfo.exactWeights = false; 
     
    9595    if (queryArray.size() >= 2 && queryArray[0] == '.') { 
    9696      if (queryArray[1] == 'q') break;  // quit 
     97 
     98      if (queryArray[1] == 'p') { 
     99    // print 
     100    UCArray docText; 
     101    unsigned long docNum = 0; 
     102    cin >> docNum; 
     103    cin.getline(query, 2048, '\n'); // eat up return 
     104 
     105    if (!GetDocText (textData, queryInfo.docLevel, docNum, docText)) { 
     106      FatalError (1, "Error while trying to get document %u", docNum); 
     107    } 
     108 
     109    cout << docText << "\n"; 
     110      } 
    97111       
    98112    } else { 
     
    118132  indexData.UnloadData (); 
    119133} 
     134 
  • trunk/gsdl/src/mgpp/text/Terms.cpp

    r855 r860  
    318318  unsigned long outI = 0; 
    319319 
    320   // increase comFragDataI until resulting range is positive 
    321   if (startRange < 0) { 
    322     while (comFragDataI < comFragDataSize && 
    323        ((signed long)comFragData.fragNums[comFragDataI]+startRange < 0)) { 
    324       comFragDataI++; 
    325     } 
    326   } 
    327    
    328320  while (fragDataI < fragDataSize && 
    329321     comFragDataI < comFragDataSize) { 
    330     unsigned long fragNum = fragData.fragNums[fragDataI]; 
    331     unsigned long comFragNum = comFragData.fragNums[comFragDataI]; 
     322    signed long fragNum = (signed long)fragData.fragNums[fragDataI]; 
     323    signed long comFragNum = (signed long)comFragData.fragNums[comFragDataI]; 
    332324     
    333325    // go to the right fragment limit (for the com frag) 
    334326    if (fragLimits != NULL) { 
    335327      while (fragLimitI+1 < fragLimitSize && 
    336          comFragNum > (*fragLimits)[fragLimitI+1].rangeStart) { 
     328         comFragNum > (signed long)(*fragLimits)[fragLimitI+1].rangeStart) { 
    337329    fragLimitI++; 
    338330      } 
     
    340332 
    341333    if (fragNum <= comFragNum+startRange || 
    342     (fragLimits!=NULL && fragNum<=(*fragLimits)[fragLimitI].rangeStart)) { 
     334    (fragLimits!=NULL && 
     335     fragNum<=(signed long)(*fragLimits)[fragLimitI].rangeStart)) { 
    343336      fragDataI++; 
    344337       
    345338    } else if (fragNum > comFragNum+endRange || 
    346            (fragLimits!=NULL && fragNum>(*fragLimits)[fragLimitI].rangeEnd)) { 
     339           (fragLimits!=NULL && 
     340        fragNum>(signed long)(*fragLimits)[fragLimitI].rangeEnd)) { 
    347341      comFragDataI++; 
    348342       
     
    357351      fragDataI++; 
    358352      comFragDataI++; 
    359       comFragDataI++; 
     353      outI++; 
    360354    } 
    361355  } 
  • trunk/gsdl/src/mgpp/text/mg_compression_dict.cpp

    r856 r860  
    4444/* 
    4545   $Log$ 
     46   Revision 1.2  2000/01/18 03:53:22  rjmcnab 
     47   Fixed a couple of bugs and made building silent if needed. 
     48 
    4649   Revision 1.1  2000/01/14 02:26:11  sjboddie 
    4750   Rodgers new C++ mg 
     
    216219      break; 
    217220    case '1': 
     221#ifndef SILENT 
    218222      Message ("Dictionary limit of %.2f Kb", k / 1024); 
     223#endif 
    219224      Select_on ((int) k, OccuranceOrder); 
    220225      break; 
    221226    case '2': 
     227#ifndef SILENT 
    222228      Message ("Dictionary limit of %.2f Kb", k / 1024); 
     229#endif 
    223230      Select_on ((int) k, DecFreqIncWL); 
    224231      break; 
    225232    case '3': 
     233#ifndef SILENT 
    226234      Message ("Dictionary limit of %.2f Kb", k / 1024); 
     235#endif 
    227236      Method3 ((int) k); 
    228237      break; 
     
    238247    } 
    239248 
     249#ifndef SILENT 
    240250  Message ("Num words           : %8u -> %8u\n", Num[1], keep[1].num_wds); 
    241251  Message ("Num non-words       : %8u -> %8u\n", Num[0], keep[0].num_wds); 
     
    247257       keep[0].chars + keep[1].chars); 
    248258  Message ("Actual mem required : %8u\n", mem_reqd); 
    249  
     259#endif 
    250260  exit (0); 
    251261} 
     
    725735  assert (keep[0].num_wds + discard[0].num_wds == Num[0]); 
    726736  assert (keep[1].num_wds + discard[1].num_wds == Num[1]); 
     737#ifndef SILENT 
    727738  Message ("Keep -> Discard        : %8d", keep_to_discard); 
    728739  Message ("Discard -> Keep        : %8d", discard_to_keep); 
     
    730741  if (recalcs == MAX_RECALCULATIONS) 
    731742    Message ("WARNING: The number of recalculations == %d", MAX_RECALCULATIONS); 
     743#endif 
    732744} 
    733745 
  • trunk/gsdl/src/mgpp/text/mg_fast_comp_dict.cpp

    r856 r860  
    2525/* 
    2626   $Log$ 
     27   Revision 1.2  2000/01/18 03:53:23  rjmcnab 
     28   Fixed a couple of bugs and made building silent if needed. 
     29 
    2730   Revision 1.1  2000/01/14 02:26:13  sjboddie 
    2831   Rodgers new C++ mg 
     
    133136  bzero (fixup, fixup_mem); 
    134137 
     138#ifndef SILENT 
    135139  Message ("Estimated memory for fast_dict %u", mem); 
    136140  Message ("Estimated memory for fixups %u", fixup_mem); 
     141#endif 
    137142 
    138143  load_comp_dict (filename); 
    139144 
     145#ifndef SILENT 
    140146  Message ("Actual memory for fast_dict %u", (char *) cur - (char *) buffer); 
     147#endif 
    141148 
    142149  if ((u_long) cur > (u_long) buffer + mem) 
  • trunk/gsdl/src/mgpp/text/mg_invf_dict.cpp

    r856 r860  
    3030/* 
    3131   $Log$ 
     32   Revision 1.2  2000/01/18 03:53:24  rjmcnab 
     33   Fixed a couple of bugs and made building silent if needed. 
     34 
    3235   Revision 1.1  2000/01/14 02:26:16  sjboddie 
    3336   Rodgers new C++ mg 
     
    193196   
    194197  // print out information 
     198#ifndef SILENT 
    195199  Message ("Max word block size = %d\n", bdh.max_wblk_size); 
    196200  Message ("Max tag block size = %d\n", bdh.max_tblk_size); 
    197201  Message ("Number of word blocks written = %d\n", bdh.num_wblks); 
    198202  Message ("Number of tag blocks written = %d\n", bdh.num_tblks); 
     203#endif 
    199204} 
    200205 
  • trunk/gsdl/src/mgpp/text/mg_stem_idx.cpp

    r858 r860  
    4646/* 
    4747   $Log$ 
     48   Revision 1.3  2000/01/18 03:53:24  rjmcnab 
     49   Fixed a couple of bugs and made building silent if needed. 
     50 
    4851   Revision 1.2  2000/01/14 02:45:51  sjboddie 
    4952   fixed compiler warning 
     
    188191   
    189192  // print out information 
     193#ifndef SILENT 
    190194  Message ("Num word stems = %d\n", sih.dict_size); 
    191195  Message ("Max stem block size = %d\n", sih.max_block_size); 
    192196  Message ("Number of stem blocks written = %d\n", sih.num_blocks); 
     197#endif 
    193198} 
    194199 
  • trunk/gsdl/src/mgpp/text/mg_weights_build.cpp

    r856 r860  
    4848/* 
    4949   $Log$ 
     50   Revision 1.2  2000/01/18 03:53:24  rjmcnab 
     51   Fixed a couple of bugs and made building silent if needed. 
     52 
    5053   Revision 1.1  2000/01/14 02:26:21  sjboddie 
    5154   Rodgers new C++ mg 
     
    158161  wordEl.SetNumLevels (idh.num_levels); 
    159162  for (wordNum=0; wordNum<idh.word_dict_size; wordNum++) { 
     163#ifndef SILENT 
    160164    // give a little feedback every 4096 words 
    161165    if ((wordNum & 0xfff) == 0) fprintf (stderr, "."); 
     166#endif 
    162167     
    163168    wordEl.Read (dictFile, idh.num_levels); 
     
    263268  double B = pow (U / L, pow (2.0, -(double) bits)); 
    264269 
     270#ifndef SILENT 
    265271  fprintf (stderr, "L = %f\n", L); 
    266272  fprintf (stderr, "U = %f\n", U); 
    267273  fprintf (stderr, "B = %f\n", B); 
    268  
     274#endif 
     275   
    269276  WriteUC (approxWeightsFile, bits); 
    270277  WriteD (approxWeightsFile, L); 
     
    281288    if (wgt == 0) { 
    282289      wgt = L; 
    283 #ifndef QUIET 
     290#ifndef SILENT 
    284291      Message ("Warning: Document %d had a weight of 0.", i); 
    285292#endif