Changeset 2487 for trunk/gsdl/src/phind/host/phindcgi.cpp
- Timestamp:
- 2001-06-01T14:51:29+12:00 (23 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/gsdl/src/phind/host/phindcgi.cpp
r2062 r2487 37 37 */ 38 38 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 42 47 #include <stdlib.h> 43 48 #include <stdio.h> 44 49 #include <assert.h> 45 50 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 48 62 49 63 // Include MGPP functionality. … … 55 69 56 70 // 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" 58 73 // Note that GSDL stores strings as text_t objects (vectors of 16-bit short int), 59 74 // while MGPP stores strings as UCArray objects (vectors of 8-bit unsigned char). … … 156 171 } 157 172 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(); 164 177 165 178 // If we don't know the phrase number, look itup … … 183 196 // Create a TextData object to read the phrase data (pdata) 184 197 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 189 213 get_phrase_all_data(textdata, phrase, word, tf, ef, lf, df, el, 190 214 linkdest, linktype, docNums, docfreq); … … 404 428 405 429 textdata.UnloadData (); 430 431 delete basepath; 432 406 433 return 0; 407 434 } … … 494 521 unsigned long first, unsigned long last) { 495 522 523 // _chdir(basepath); 524 496 525 // Create a TextData object to read the document data 497 526 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; 502 541 503 542 UCArray title, hash; … … 795 834 } 796 835 // store the gsdlhome string 797 gsdlhome = new (char)[len-i];836 gsdlhome = new char[len-i]; 798 837 strncpy(gsdlhome, &(buffer[i]), len-i); 799 838 } … … 916 955 // if no classifier number is supplied, default to 1. 917 956 if (classifier == NULL) { 918 classifier = new (char)[2];957 classifier = new char[2]; 919 958 strcpy(classifier, "1"); 920 959 } … … 971 1010 // Open the index file for searching 972 1011 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; 977 1026 978 1027 // set up the query object
Note:
See TracChangeset
for help on using the changeset viewer.