Changeset 93 for trunk/gsdl/src/library
- Timestamp:
- 1998-12-31T22:18:58+13:00 (26 years ago)
- Location:
- trunk/gsdl/src/library
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/gsdl/src/library/libinterface.cpp
r92 r93 11 11 12 12 #include <assert.h> 13 14 15 13 16 14 17 /////////////////////// … … 147 150 libinterface::libinterface() { 148 151 browse = NULL; 152 gbinconvert = NULL; 153 gboutconvert = NULL; 149 154 } 150 155 … … 158 163 thecollectdir = filename_cat (thecollectdir, get_collection_name()); 159 164 filename = filename_cat (thecollectdir, "etc"); 160 filename = filename_cat (filename, "config.cfg"); 165 filename = filename_cat (filename, "collect.cfg"); 166 161 167 if (!file_exists(filename)) thecollectdir = gsdlhome; 162 168 … … 207 213 else if (key == "numbytes") cfg_info.numbytes = (double)cfgline[0].getint(); 208 214 else if (key == "numdocs") cfg_info.numdocs = (double)cfgline[0].getint(); 215 else if (key == "defaultencoding") 216 cfg_info.defaultencoding = cfgline[0]; 209 217 } 210 218 } … … 233 241 #endif 234 242 gdbm.opendatabase (filename); 243 244 245 // set default values for the configuration file 246 cfg_info.defaultencoding = "w"; 235 247 236 248 // read in the configuration files etc/collect.cfg and index/build.cfg … … 265 277 srand(time(NULL)); 266 278 279 gbinconvert = new gbinconvertclass (gsdlhome); 280 281 utf8outconvert.set_rzws(1); 282 gboutconvert = new gboutconvertclass (gsdlhome); 283 if (gboutconvert != NULL) gboutconvert->set_rzws(1); 284 267 285 return collection_init(collection); 268 286 } … … 295 313 outconvertclass *outconvert = NULL; 296 314 if (arg_n == "8") { 297 outconvert = new utf8outconvertclass(); 298 ((utf8outconvertclass *)outconvert)->set_rzws(1); // remove zer-width spaces 299 } 300 else outconvert = new outconvertclass; // default 315 outconvert = &utf8outconvert; 316 } else if (arg_n == "g" && gboutconvert != NULL) { 317 outconvert = gboutconvert; 318 } 319 else outconvert = &asciioutconvert; // default 301 320 302 321 if (outconvert == NULL) return err; … … 327 346 argconfigstr = 328 347 "+a[p]" // action: q=query, b=browse, t=targetdoc, p=page, a1=auxiliary 329 "n[ w]" // encoding: w=western, 8=utf8, 7=utf7, g=GB2312, k=GBK348 "n[]" // encoding: w=western, 8=utf8, 7=utf7, g=GB2312, k=GBK 330 349 "t[1]" // query type: 0=boolean, 1=ranked 331 350 "i[c]" // index: c=chapter, p=paragraph, t=title, b=book … … 459 478 void libinterface::check_args (cgiargsclass &args) 460 479 { 461 text_t collection = get_collection_name();462 args.setarg("c", collection);480 args.setarg("c", get_collection_name()); 481 if (args["n"].empty()) args.setarg("n", cfg_info.defaultencoding); 463 482 } 464 483 -
trunk/gsdl/src/library/libinterface.h
r92 r93 7 7 #include "display.h" 8 8 #include "gdbmclass.h" 9 #include "gsdlunicode.h" 9 10 10 11 #ifdef __GNUG__ … … 42 43 double numbytes; 43 44 double numdocs; 45 text_t defaultencoding; 44 46 }; 45 47 … … 105 107 outconvertclass logconvert; 106 108 displayclass disp; 109 110 inconvertclass asciiinconvert; 111 utf8inconvertclass utf8inconvert; 112 gbinconvertclass *gbinconvert; 113 outconvertclass asciioutconvert; 114 utf8outconvertclass utf8outconvert; 115 gboutconvertclass *gboutconvert; 107 116 108 117
Note:
See TracChangeset
for help on using the changeset viewer.