Changeset 2487


Ignore:
Timestamp:
2001-06-01T14:51:29+12:00 (23 years ago)
Author:
sjboddie
Message:

Changes to get phind working under windows

Location:
trunk/gsdl
Files:
13 edited

Legend:

Unmodified
Added
Removed
  • trunk/gsdl/lib/text_t.cpp

    r1860 r2487  
    2828/*
    2929   $Log$
     30   Revision 1.21  2001/06/01 02:51:28  sjboddie
     31   Changes to get phind working under windows
     32
    3033   Revision 1.20  2001/01/25 18:26:44  cs025
    3134   Included CORBA branch for first time
     
    262265}
    263266
    264 
     267unsigned long text_t::getulong () const
     268{
     269  unsigned long i = 0;
     270
     271  const_iterator here = text.begin();
     272  const_iterator end = text.end();
     273
     274  while ((here != end) && (*here >= '0') && (*here <= '9'))
     275    {
     276      i = 10*i + (*here - '0');
     277      here++;
     278    }
     279
     280  return i;
     281}
    265282
    266283void text_t::appendcarr (char *s, size_type len)
  • trunk/gsdl/lib/text_t.h

    r2423 r2487  
    147147  int getint () const;
    148148
     149  // same as getint but returns an unsigned long
     150  unsigned long getulong () const;
     151
    149152  // support for arrays of chars
    150153  void appendcarr (char *s, size_type len);
  • trunk/gsdl/macros/document.dm

    r2021 r2487  
    7676<APPLET CODEBASE="_httpprefix_/src/phind/client" CODE="Phind.class" WIDTH=500 HEIGHT=400>
    7777  <PARAM NAME=library      VALUE="_gwcgi_">
    78   <PARAM NAME=phindcgi     VALUE="phindcgi">
    79 
     78  <PARAM NAME=phindcgi     VALUE="_gwcgi_?a=phind">
    8079  <PARAM NAME=collection   VALUE="_cgiargc_">
    8180  <PARAM NAME=classifier   VALUE="_phindnumber_">
  • trunk/gsdl/packages/mg/src/text/WIN32.MAK

    r2338 r2487  
    205205      copy %%i "$(GSDLHOME)\bin\windows"
    206206
     207# words$o,  removed to avoid conflict with mgpp libtextin.a
    207208LIB_OBJS = \
    208209    query_term_list$o \
     
    212213    read_line$o mg_errors$o backend$o invf_get$o \
    213214    term_lists$o bool_tree$o bool_parser$o bool_optimiser$o \
    214     bool_query$o words$o
     215    bool_query$o
    215216
    216217libtextin.lib: $(LIB_OBJS)
  • trunk/gsdl/perllib/classify/phind.pm

    r2481 r2487  
    8484
    8585
     86%wanted_index_files = ('td'=>1,
     87               't'=>1,
     88               'ti'=>1,
     89               'tl'=>1,
     90               'tsd'=>1,
     91               'idb'=>1,
     92               'ib1'=>1,
     93               'ib2'=>1,
     94               'ib3'=>1,
     95               'i'=>1,
     96               'il'=>1,
     97               'w'=>1,
     98               'wa'=>1);
     99
     100
     101
    86102# Phrase delimiter symbols - these should be abstracted out someplace
    87103
     
    110126    print $out "Checking Phind phrase browser requirements...\n";
    111127
    112     # Make sure we're not in windows
    113     if ($ENV{'GSDLOS'} =~ /windows/i) {
    114     print STDERR "Sorry - Phind currently only works under Unix";
    115     exit(1);
    116     }
    117 
    118128    # Ensure the Phind generate scripts are in place
    119129    my $file1 = &util::filename_cat($ENV{'GSDLHOME'}, "bin", $ENV{'GSDLOS'}, "suffix");
     130    $file1 .= ".exe" if $ENV{'GSDLOS'} =~ /^windows$/;
    120131    my $src = &util::filename_cat($ENV{'GSDLHOME'}, "src", "phind", "generate");
    121132
     
    130141    # Ensure the Phind CGI script is in place
    131142    $file1 = &util::filename_cat($ENV{'GSDLHOME'}, "cgi-bin", "phindcgi");
     143    $file1 .= ".exe" if $ENV{'GSDLOS'} =~ /^windows$/;
    132144    $src =  &util::filename_cat($ENV{'GSDLHOME'}, "src", "phind", "host");
    133145
     
    184196    }
    185197    $self->{'builddir'} = $builddir;
     198
     199    $self->{'total'} = 0;
    186200   
    187201    return bless $self, $class;
     
    251265   
    252266    # record this file
    253     my $total++;
    254     print "file $total: $file\n" if ($self->{'$verbosity'});
     267    $self->{'total'} ++;
     268    print "file $self->{'total'}: $file\n" if ($self->{'$verbosity'});
    255269   
    256270
     
    335349    my $self = shift (@_);
    336350
     351    close $self->{'dochandle'};
    337352    close $self->{'txthandle'};
    338353    my $verbosity = $self->{'verbosity'};
    339354    my $out = $self->{'outhandle'};
    340355    my $phinddir = $self->{'phinddir'};
    341     my $exe = &util::get_os_exe ();
     356
     357    my $osextra = "";
     358    if ($ENV{'GSDLOS'} !~ /^windows$/i) {
     359    $osextra = " -d /";
     360    }
    342361
    343362    if ($verbosity) {
     
    362381    print $out "\nSorting and renumbering phrases for input to mgpp\n" if $verbosity;
    363382    &renumber_phrases($self);
    364    
    365     # Create the mg phrase database
    366383
    367384    print $out "\nCreating phrase databases\n";
    368385    my $mg_input = &util::filename_cat($phinddir, "pdata.txt");
    369     my $mg_stem = "pdata";
    370 
    371     &execute("mgpp_passes$exe -d $phinddir -f $mg_stem -T1 $mg_input", $verbosity, $out);
    372     &execute("mgpp_compression_dict$exe -d $phinddir -f $mg_stem", $verbosity, $out);
    373     &execute("mgpp_passes$exe -d $phinddir -f $mg_stem -T2 $mg_input", $verbosity, $out);
     386    my $mg_stem = &util::filename_cat($phinddir, "pdata");
     387
     388    &execute("mgpp_passes $osextra -f $mg_stem -T1 $mg_input", $verbosity, $out);
     389    &execute("mgpp_compression_dict $osextra -f $mg_stem", $verbosity, $out);
     390    &execute("mgpp_passes $osextra -f $mg_stem -T2 $mg_input", $verbosity, $out);
    374391
    375392    # create the mg index of words
    376393    print $out "\nCreating word-level search indexes\n";
    377394    $mg_input = &util::filename_cat($phinddir, "pword.txt");
    378     $mg_stem = "pword";
    379 
    380     &execute("mgpp_passes$exe -d $phinddir -f $mg_stem -T1 -I1 $mg_input", $verbosity, $out);
    381     &execute("mgpp_compression_dict$exe -d $phinddir -f $mg_stem", $verbosity, $out);
    382     &execute("mgpp_perf_hash_build$exe -d $phinddir -f $mg_stem", $verbosity, $out);
    383     &execute("mgpp_passes$exe -d $phinddir -f $mg_stem -T2 -I2 $mg_input", $verbosity, $out);
    384     &execute("mgpp_weights_build$exe -d $phinddir -f $mg_stem", $verbosity, $out);
    385     &execute("mgpp_invf_dict$exe -d $phinddir -f $mg_stem", $verbosity, $out);
    386 
    387     &execute("mgpp_stem_idx$exe -d $phinddir -f $mg_stem -s 1", $verbosity, $out);
    388     &execute("mgpp_stem_idx$exe -d $phinddir -f $mg_stem -s 2", $verbosity, $out);
    389     &execute("mgpp_stem_idx$exe -d $phinddir -f $mg_stem -s 3", $verbosity, $out);
     395    $mg_stem = &util::filename_cat($phinddir, "pword");
     396
     397    &execute("mgpp_passes $osextra -f $mg_stem -T1 -I1 $mg_input", $verbosity, $out);
     398    &execute("mgpp_compression_dict $osextra -f $mg_stem", $verbosity, $out);
     399    &execute("mgpp_perf_hash_build $osextra -f $mg_stem", $verbosity, $out);
     400    &execute("mgpp_passes $osextra -f $mg_stem -T2 -I2 $mg_input", $verbosity, $out);
     401    &execute("mgpp_weights_build $osextra -f $mg_stem", $verbosity, $out);
     402    &execute("mgpp_invf_dict $osextra -f $mg_stem", $verbosity, $out);
     403
     404    &execute("mgpp_stem_idx $osextra -f $mg_stem -s 1", $verbosity, $out);
     405    &execute("mgpp_stem_idx $osextra -f $mg_stem -s 2", $verbosity, $out);
     406    &execute("mgpp_stem_idx $osextra -f $mg_stem -s 3", $verbosity, $out);
    390407
    391408    # create the mg document information database
    392409    print $out "\nCreating document information databases\n";
    393410    $mg_input = &util::filename_cat($phinddir, "docs.txt");
    394     $mg_stem = "docs";
    395 
    396     &execute("mgpp_passes$exe -d $phinddir -f $mg_stem -T1 $mg_input", $verbosity, $out);
    397     &execute("mgpp_compression_dict$exe -d $phinddir -f $mg_stem", $verbosity, $out);
    398     &execute("mgpp_passes$exe -d $phinddir -f $mg_stem -T2 $mg_input", $verbosity, $out);
    399 
     411    $mg_stem = &util::filename_cat($phinddir, "docs");
     412
     413    &execute("mgpp_passes $osextra -f $mg_stem -T1 $mg_input", $verbosity, $out);
     414    &execute("mgpp_compression_dict $osextra -f $mg_stem", $verbosity, $out);
     415    &execute("mgpp_passes $osextra -f $mg_stem -T2 $mg_input", $verbosity, $out);
    400416
    401417    # Tidy up stray files
    402418    if (!$self->{'untidy'}) {
    403419    print $out "\nCleaning up\n" if ($verbosity > 2);
    404     &util::rm("$phinddir/clauses", "$phinddir/clauses.numbers",
    405           "$phinddir/clauses.vocab", "$phinddir/clauses.stats",
    406           "$phinddir/phrases", "$phinddir/phrases.3", "$phinddir/docs.txt",
    407           "$phinddir/pdata.txt", "$phinddir/pword.txt");
    408     my $outfile = 1;
    409     while (-e "$phinddir/outPhrase.$outfile") {
    410         &util::rm("$phinddir/outPhrase.$outfile");
    411         $outfile++;
    412     }
    413     }
    414 
     420    opendir (DIR, $phinddir) || die;
     421    my @files = readdir DIR;
     422    closedir DIR;
     423   
     424    foreach $file (@files) {
     425        next if $file =~ /^\.\.?$/;
     426        my ($suffix) = $file =~ /\.([^\.]+)$/;
     427        if (!defined $suffix || !defined $wanted_index_files{$suffix}) {
     428        # delete it!
     429        print $out "deleting $file\n"; # if $verbosity > 2;
     430        &util::rm (&util::filename_cat ($phinddir, $file));
     431        }
     432    }
     433    }
    415434
    416435    # Return the information about the classifier that we'll later want to
     
    591610    my ($command, $verbosity, $outhandle) = @_;
    592611    print $outhandle "Executing: $command\n"  if ($verbosity > 2);
     612    $! = 0;
    593613    my $status = system($command);
    594614    if ($status != 0) {
    595     print STDERR "phind - Error executing $command: $!\n";
     615    print STDERR "phind - Error executing '$command': $!\n";
    596616    exit($status);
    597617    }
     
    12641284    $thesaurusdata{$phindid} = "$symbols:$linkcounter:$relations";
    12651285    }
     1286    close TH;
    12661287
    12671288    # 6.
     
    13461367    $symbol[$i++] = $_;
    13471368    }
    1348 
     1369    close V;
    13491370
    13501371    # 2.
  • trunk/gsdl/src/phind/client/Phind.java

    r2054 r2487  
    403403
    404404    // Build the query
    405     String query = phindcgi_address + "x=1&c=" + collection + "&d=" + classifier;
     405    String query = phindcgi_address + "pxml=1&c=" + collection + "&pc=" + classifier;
    406406
    407407    if (keyKnown) {
    408       query = query + "&n=" + word;
     408      query = query + "&ppnum=" + word;
    409409    } else {
    410       query = query + "&p=" + word;
     410      query = query + "&pptext=" + word;
    411411    }
    412412
     
    448448    }
    449449
    450     query = query + "&e=" + first_e + "&f=" + last_e
    451                       + "&h=" + first_d + "&i=" + last_d
    452                       + "&k=" + first_l + "&l=" + last_l;
     450    query = query + "&pfe=" + first_e + "&ple=" + last_e
     451                      + "&pfd=" + first_d + "&pld=" + last_d
     452                      + "&pfl=" + first_l + "&pll=" + last_l;
    453453
    454454    // Send the query to the phindcgi program
     
    497497        // there is not protocol and host
    498498        URL document = getDocumentBase();
    499         address = "http://" + document.getHost() + address;
     499        address = "http://" + document.getHost() + ":" + document.getPort() + address;
    500500    } else {
    501         // this URL is relative to the dirwectory the document is in
     501        // this URL is relative to the directory the document is in
    502502        URL document = getDocumentBase();
    503503        String directory = document.getFile();
    504504        int end = directory.lastIndexOf('/');
    505505        directory = directory.substring(0,end + 1);
    506         address = "http://" + document.getHost() + directory + address;
     506        address = "http://" + document.getHost() + ":" + document.getPort() + directory + address;
    507507
    508508    }
  • trunk/gsdl/src/phind/generate/phrase.cpp

    r1873 r2487  
    2626 *********************************************************************/
    2727
    28 #include <iostream.h>
    2928#include <assert.h>
    30 #include <vector.h>
    3129#include <stdio.h>
     30
     31#if defined(GSDL_USE_STL_H)
     32#  include <vector.h>
     33#else
     34#  include <vector>
     35#endif
     36
     37#if defined(GSDL_USE_IOS_H)
     38#  include <iostream.h>
     39#else
     40#  include <iostream>
     41#endif
    3242
    3343#include "suffix.h"
  • trunk/gsdl/src/phind/generate/phrase.h

    r1873 r2487  
    2525 *
    2626 *********************************************************************/
     27
     28#ifndef PHRASE_H
     29#define PHRASE_H
     30
     31#if defined(GSDL_USE_STL_H)
     32#  include <vector.h>
     33#else
     34#  include <vector>
     35#endif
     36
     37#include "suffix.h"
    2738
    2839class Phrase {
     
    6172  Phrase(symbol *words, cellcount size, int direction);
    6273
     74  // An empty phrase can be created without arguments, but is
     75  // good for nothing and may not be used with any public fuctions.
     76  // We therefore only use it internally.
     77  Phrase();
     78
    6379  // Represent the phrase as  a string
    6480  char *toString();
     
    87103
    88104private:
    89 
    90   // An empty phrase can be created without arguments, but is
    91   // good for nothing and may not be used with any public fuctions.
    92   // We therefore only use it internally.
    93   Phrase();
    94105
    95106  // Does the phrase have a unique suffix/prefix extension?
     
    120131  int expandWhileUniqueSuffixExtension();
    121132  int expandWhileUniquePrefixExtension();
    122 
    123 
    124133};
    125134
     
    128137bool isLonger(Phrase p1, Phrase p2);
    129138
    130 
    131 
    132 
     139#endif
  • trunk/gsdl/src/phind/generate/suffix.cpp

    r1882 r2487  
    2828
    2929#include <assert.h>
    30 #include <fstream.h>
    31 #include <iostream.h>
    3230#include <math.h>
    3331#include <stdio.h>
     
    3533#include <string.h>
    3634
    37 #include <algo.h>
    38 #include <heap.h>
    39 #include <vector.h>
     35#if defined(GSDL_USE_IOS_H)
     36#  include <fstream.h>
     37#  include <iostream.h>
     38#else
     39#  include <fstream>
     40#  include <iostream>
     41#endif
     42
     43#if defined(GSDL_USE_STL_H)
     44#  if defined(GSDL_USE_ALGO_H)
     45#    include <algo.h>
     46#  else
     47#    include <algorithm.h>
     48#  endif
     49#  include <vector.h>
     50#else
     51#  include <algorithm>
     52#  include <vector>
     53#endif
     54#include <stl_heap.h>
     55
    4056
    4157#include "suffix.h"
    4258#include "phrase.h"
    43 
    44 
    4559
    4660// Global variables declared in suffix.h
     
    138152
    139153  // Create the suffix & prefix arrays
    140   suffixArray = new (symbol *)[inputLength];
    141   prefixArray = new (symbol *)[inputLength];
    142   suffixCheck = new (check)[inputLength];
    143   prefixCheck = new (check)[inputLength];
     154  suffixArray = new symbol *[inputLength];
     155  prefixArray = new symbol *[inputLength];
     156  suffixCheck = new check[inputLength];
     157  prefixCheck = new check[inputLength];
    144158  if (prefixCheck == NULL) {
    145159    cerr << "Suffix error: not enough memory to hold " << inputLength
     
    169183  // each phrase occurs in each document.  The number of documents in
    170184  // which a phrase occurs is stored in df.
    171   frequency documentFrequency[numberOfDocuments];
     185  frequency *documentFrequency = new frequency[numberOfDocuments];
    172186  frequency df;
    173187
    174188  // documentArray will be searched in order to discover which document
    175189  // each phrase occurs in.
    176   documentArray = new (symbol *)[numberOfDocuments]; 
     190  documentArray = new symbol *[numberOfDocuments]; 
    177191
    178192  // Discover all the DOCUMENTSTART symbols and store as a phrase
     
    250264  // Iterate over the different symbols by working through the suffix array
    251265  vector<Phrase> result;
    252   cellindex i = 0;
     266  cellindex ij = 0;
    253267  char *tmpString;
    254268
    255   while (i < inputLength) {
     269  while (ij < inputLength) {
    256270
    257271    // make a new phrase of length 1
    258     p = Phrase(suffixArray[i], 1, SUFFIX);
    259     p.findFirstAndLastSuffix(i, inputLength-1);
    260 
    261     // cout << "cell " << i << " - " << p.toString() << endl;
     272    p = Phrase(suffixArray[ij], 1, SUFFIX);
     273    p.findFirstAndLastSuffix(ij, inputLength-1);
     274
     275    // cout << "cell " << ij << " - " << p.toString() << endl;
    262276
    263277    // We ignore this symbol if it occurs only once, if it is a delimiter,
     
    271285    // it explodes the size of the indexes.  So: would it be useful? 
    272286    if (!((p.suffixFrequency <= 1) ||
    273       // (*suffixArray[i] != 23054) ||
    274       (*suffixArray[i] <= LASTDELIMITER) ||
    275       ((phraseMode == STOPWORDS) && (*suffixArray[i] <= lastStopSymbol)))) {
     287      // (*suffixArray[ij] != 23054) ||
     288      (*suffixArray[ij] <= LASTDELIMITER) ||
     289      ((phraseMode == STOPWORDS) && (*suffixArray[ij] <= lastStopSymbol)))) {
    276290
    277291      // Get minimal expansions of the phrase
     
    281295   
    282296    // Remember that we have expanded this phrase
    283     rememberThisPhrase(i, 1);
     297    rememberThisPhrase(ij, 1);
    284298
    285299    // write the phrase text
    286300    tmpString = p.toString();
    287     phraseData << i << "-1:" << tmpString << ":" << p.suffixFrequency << ":"
     301    phraseData << ij << "-1:" << tmpString << ":" << p.suffixFrequency << ":"
    288302           << result.size() << ":";
    289303    delete [] tmpString;
    290304
    291305    // write the results
    292     for (cellcount i = 0; i < result.size(); i++) {
    293       if (i) {
     306    for (cellcount k = 0; k < result.size(); k++) {
     307      if (k) {
    294308        phraseData << ",";
    295309      }
    296       phraseData << result[i].firstSuffixIndex << "-" << result[i].length;
    297       outPhrase << result[i].firstSuffixIndex << " " << result[i].length << endl;
     310      phraseData << result[k].firstSuffixIndex << "-" << result[k].length;
     311      outPhrase << result[k].firstSuffixIndex << " " << result[k].length << endl;
    298312      outPhraseCounter++;
    299313    }
     
    305319
    306320    // write the documents
    307     for (cellcount i = 0, first = 1; i < numberOfDocuments; i++) {
    308       if (documentFrequency[i]) {
     321    for (cellcount m = 0, first = 1; m < numberOfDocuments; m++) {
     322      if (documentFrequency[m]) {
    309323        if (first) {
    310324          first = 0;
     
    315329        // N documents from 0 to N-1, but later they'll be 1-N.  Thus we
    316330        // add 1 to the document id when we output it.
    317         phraseData << "d" << (i+1);
     331        phraseData << "d" << (m+1);
    318332        // Next, output the frequency with which the document occurs, but
    319333        // only if it is > 1.
    320         if (documentFrequency[i] > 1) {
    321           phraseData << "," << documentFrequency[i];
     334        if (documentFrequency[m] > 1) {
     335          phraseData << "," << documentFrequency[m];
    322336        }
    323337      }
     
    338352      }
    339353    }
    340    i = p.lastSuffixIndex + 1;
     354   ij = p.lastSuffixIndex + 1;
    341355  }
    342356  outPhrase.close();
     
    472486  deletePhraseMemory();
    473487
     488  delete [] documentFrequency;
    474489  delete [] symbols;
    475490  delete [] suffixArray;
     
    548563      suffixCheck[i] = c.length;
    549564    }
    550     for (cellcount i = c.firstPrefixIndex; i <= c.lastPrefixIndex; i++) {
    551       prefixCheck[i] = c.length;
     565    for (cellcount ik = c.firstPrefixIndex; ik <= c.lastPrefixIndex; ik++) {
     566      prefixCheck[ik] = c.length;
    552567    }
    553568      }
     
    578593      suffixCheck[i] = c.length;
    579594    }
    580     for (cellcount i = c.firstPrefixIndex; i <= c.lastPrefixIndex; i++) {
    581       prefixCheck[i] = c.length;
     595    for (cellcount ijk = c.firstPrefixIndex; ijk <= c.lastPrefixIndex; ijk++) {
     596      prefixCheck[ijk] = c.length;
    582597    }
    583598
     
    701716    cout << "Allocating symbol arrays for " << inputLength << " symbols" << endl;
    702717  }
    703   symbols = new (symbol)[inputLength];
     718  symbols = new symbol[inputLength];
    704719  if (symbols == NULL) {
    705720    cerr << "Suffix error: not enough memory to hold " << inputLength
     
    757772
    758773  // search for the document in which each occurence of the phrase is found
    759   for (cellcount i = p.firstSuffixIndex; i <= p.lastSuffixIndex; i++) {
     774  for (cellcount j = p.firstSuffixIndex; j <= p.lastSuffixIndex; j++) {
    760775   
    761     // cout << "looking for phrase at suffixArray[" << i << "]\n";
     776    // cout << "looking for phrase at suffixArray[" << j << "]\n";
    762777   
    763     target = suffixArray[i];
     778    target = suffixArray[j];
    764779    begin = 0;
    765780    end = numberOfDocuments - 1;
     
    864879void initialisePhraseMemory() {
    865880
    866   phraseMemory = new (unsigned char)[inputLength];
     881  phraseMemory = new unsigned char[inputLength];
    867882
    868883  // to begin with, everything is empty
  • trunk/gsdl/src/phind/generate/suffix.h

    r1631 r2487  
    2626 *********************************************************************/
    2727
     28#ifndef SUFFIX_H
     29#define SUFFIX_H
    2830
    2931// Types
     
    9193#define LASTDELIMITER 4
    9294
    93 
    94 
     95#endif
  • trunk/gsdl/src/phind/host/phindcgi.cpp

    r2062 r2487  
    3737 */
    3838
    39 
    40 #include <iostream.h>
    41 #include <fstream.h>
     39#if defined(GSDL_USE_IOS_H)
     40#  include <fstream.h>
     41#  include <iostream.h>
     42#else
     43#  include <fstream>
     44#  include <iostream>
     45#endif
     46
    4247#include <stdlib.h>
    4348#include <stdio.h>
    4449#include <assert.h>
    4550
    46 #include <vector.h>
    47 #include <algo.h>
     51#if defined(GSDL_USE_STL_H)
     52#  if defined(GSDL_USE_ALGO_H)
     53#    include <algo.h>
     54#  else
     55#    include <algorithm.h>
     56#  endif
     57#  include <vector.h>
     58#else
     59#  include <algorithm>
     60#  include <vector>
     61#endif
    4862
    4963// Include MGPP functionality.
     
    5569
    5670// Include GSDL's text_t object, which makes parsing cgi arguments easier.
    57 #include <text_t.h>
     71#include "text_t.h"
     72#include "fileutil.h"
    5873// Note that GSDL stores strings as text_t objects (vectors of 16-bit short int),
    5974// while MGPP stores strings as UCArray objects (vectors of 8-bit unsigned char).
     
    156171  }
    157172 
    158   char basepath[FILENAME_MAX] = "";
    159   strcat(basepath, gsdlhome);
    160   strcat(basepath, "/collect/");
    161   strcat(basepath, collection);
    162   strcat(basepath, "/index/phind");
    163   strcat(basepath, classifier);
     173  text_t basepathstr = filename_cat(gsdlhome, "collect", collection,
     174                    "index", text_t("phind") + classifier);
     175
     176  char *basepath = basepathstr.getcstr();
    164177
    165178  // If we don't know the phrase number, look itup
     
    183196  // Create a TextData object to read the phrase data (pdata)
    184197  TextData textdata;
    185   char filename[FILENAME_MAX] = "pdata";
    186   if (!textdata.LoadData (basepath, filename)) {
    187     FatalError (1, "Couldn't load text information for \"%s\"", filename);
    188   }
     198
     199  text_t fullpath = filename_cat(basepath, "pdata");
     200  char *fullpathc = fullpath.getcstr();
     201#if defined __WIN32__
     202  char *base = "";
     203#else
     204  char *base = "/";
     205#endif
     206
     207  if (!textdata.LoadData (base, fullpathc)) {
     208    FatalError (1, "Couldn't load text information for \"%s\"", fullpathc);
     209  }
     210
     211  delete fullpathc;
     212
    189213  get_phrase_all_data(textdata, phrase, word, tf, ef, lf, df, el,
    190214              linkdest, linktype, docNums, docfreq);
     
    404428
    405429  textdata.UnloadData ();
     430
     431  delete basepath;
     432
    406433  return 0;
    407434}
     
    494521             unsigned long first, unsigned long last) {
    495522 
     523  //  _chdir(basepath);
     524
    496525  // Create a TextData object to read the document data
    497526  TextData docdata;
    498   char filename[FILENAME_MAX] = "docs";
    499   if (!docdata.LoadData (basepath, filename)) {
    500     FatalError (1, "Couldn't load text information for \"%s\"", filename);
    501   }
     527
     528  text_t fullpath = filename_cat(basepath, "docs");
     529  char *fullpathc = fullpath.getcstr();
     530#if defined __WIN32__
     531  char *base = "";
     532#else
     533  char *base = "/";
     534#endif
     535
     536  if (!docdata.LoadData (base, fullpathc)) {
     537    FatalError (1, "Couldn't load text information for \"%s\"", fullpathc);
     538  }
     539
     540  delete fullpathc;
    502541
    503542  UCArray title, hash;
     
    795834      }
    796835      // store the gsdlhome string
    797       gsdlhome = new (char)[len-i];
     836      gsdlhome = new char[len-i];
    798837      strncpy(gsdlhome, &(buffer[i]), len-i);
    799838    }
     
    916955  // if no classifier number is supplied, default to 1.
    917956  if (classifier == NULL) {
    918     classifier = new (char)[2];
     957    classifier = new char[2];
    919958    strcpy(classifier, "1");
    920959  }
     
    9711010  // Open the index file for searching
    9721011  IndexData indexData;
    973   char indexfilename[FILENAME_MAX] = "pword";
    974   if (!indexData.LoadData (basepath, indexfilename)) {
    975     FatalError (1, "Couldn't load index information for \"%s\"", indexfilename);
    976   }
     1012
     1013  text_t fullpath = filename_cat(basepath, "pword");
     1014  char *fullpathc = fullpath.getcstr();
     1015#if defined __WIN32__
     1016  char *base = "";
     1017#else
     1018  char *base = "/";
     1019#endif
     1020
     1021  if (!indexData.LoadData (base, fullpathc)) {
     1022    FatalError (1, "Couldn't load index information for \"%s\"", fullpathc);
     1023  }
     1024
     1025  delete fullpathc;
    9771026
    9781027  // set up the query object
  • trunk/gsdl/src/recpt/librarymain.cpp

    r2389 r2487  
    5656#include "collectoraction.h"
    5757#include "browseaction.h"
     58#include "phindaction.h"
    5859
    5960#include "browserclass.h"
     
    150151  recpt.add_action(&abrowseaction);
    151152
     153  phindaction aphindaction;
     154  recpt.add_action(&aphindaction);
     155
    152156  // list of browsers
    153157  vlistbrowserclass avlistbrowserclass;
  • trunk/gsdl/src/w32server/cgiwrapper.cpp

    r2343 r2487  
    6666#include "extlinkaction.h"
    6767#include "collectoraction.h"
     68#include "phindaction.h"
    6869
    6970// browsers
     
    7475#include "pagedbrowserclass.h"
    7576#include "htmlbrowserclass.h"
     77#include "phindbrowserclass.h"
    7678
    7779// the number of times the library has been accessed
     
    495497  recpt.add_action (aauthenaction);
    496498
     499  phindaction *aphindaction = new phindaction();
     500  recpt.add_action (aphindaction);
     501
    497502
    498503  // list of browsers
     
    515520  htmlbrowserclass *ahtmlbrowserclass = new htmlbrowserclass();
    516521  recpt.add_browser (ahtmlbrowserclass);
     522
     523  phindbrowserclass *aphindbrowserclass = new phindbrowserclass();;
     524  recpt.add_browser (aphindbrowserclass);
    517525 
    518526  // set defaults
Note: See TracChangeset for help on using the changeset viewer.