Changeset 1170


Ignore:
Timestamp:
2000-05-12T15:09:27+12:00 (24 years ago)
Author:
sjboddie
Message:

minor modifications to get web library compiling under VC++ 6.0

Location:
trunk/gsdl
Files:
9 edited

Legend:

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

    r1076 r1170  
    2828/*
    2929   $Log$
     30   Revision 1.20  2000/05/12 03:09:23  sjboddie
     31   minor modifications to get web library compiling under VC++ 6.0
     32
    3033   Revision 1.19  2000/04/06 19:57:58  cs025
    3134   Correcting a correction - reinstated all lib files due to silly
     
    691694    // unicode text
    692695    // get the next two characters
    693     unsigned char c1 = 0, c2 = 0;
     696    char c1 = 0, c2 = 0;
    694697    if (!fin.eof()) fin.get(c1);
    695698    if (!fin.eof()) fin.get(c2);
     
    709712    // utf-8 text
    710713    // how many characters we get depends on what we find
    711     unsigned char c1 = 0, c2 = 0, c3 = 0;
     714    char c1 = 0, c2 = 0, c3 = 0;
    712715    while (!fin.eof()) {
    713716      fin.get(c1);
  • trunk/gsdl/lib/fileutil.cpp

    r1150 r1170  
    2828/*
    2929   $Log$
     30   Revision 1.16  2000/05/12 03:09:22  sjboddie
     31   minor modifications to get web library compiling under VC++ 6.0
     32
    3033   Revision 1.15  2000/05/04 08:27:28  sjboddie
    3134   modifications for windows ports of GCC
     
    121124  path2.erase (path2.begin(), here);
    122125 
    123   // return the concatenation of the two strings
    124   return path1 + path2;
     126  text_t fullpath = path1 + path2;
     127
     128  // make sure all the right slashes are used
     129  here = fullpath.begin();
     130  end = fullpath.end();
     131  while (here != end) {
     132#ifdef __WIN32__
     133    if (*here == '/') *here = '\\';
     134#else
     135    if (*here == '\\') *here = '/';
     136#endif
     137    here ++;
     138  }
     139  return fullpath;
    125140}
    126141
     
    142157bool file_exists (const text_t &filename) {
    143158  char *cstr = filename.getcstr();
     159#ifdef GSDL_USE_IOS_H
    144160  ifstream filestream (cstr, ios::in | ios::nocreate);
     161#else
     162  ifstream filestream (cstr, ios::in);
     163#endif
    145164  delete cstr;
    146165
     
    158177bool file_writable (const text_t &filename) {
    159178  char *cstr = filename.getcstr();
     179#ifdef GSDL_USE_IOS_H
    160180  ifstream filestream (cstr, ios::out | ios::nocreate);
     181#else
     182  ifstream filestream (cstr, ios::out);
     183#endif
    161184  delete cstr;
    162185
  • trunk/gsdl/lib/gsdlconf.h

    r1167 r1170  
    8080#endif
    8181
     82// mktemp
     83
     84#if !defined(__WIN32__) || defined(__GNUC__)
     85#include <unistd.h>
     86#define GSDL_MKTEMP(str) mktemp(str)
     87#else
     88#include <io.h>
     89#define GSDL_MKTEMP(str) _mktemp(str)
     90#endif
     91
     92
    8293
    8394// file locking
    8495
    8596#if defined(__WIN32__)
     97
     98#if !defined(LK_UNLOCK) && defined(LK_UNLCK)
     99#define LK_UNLOCK LK_UNLCK
     100#endif
     101
     102#if defined (GSDL_USE_IOS_H)
    86103#include <io.h>
    87104#include <sys/locking.h>
     105
    88106#if defined(__GNUC__)
    89107#define GSDL_GET_FILEDESC(str) str.filedesc()
     
    91109#define GSDL_GET_FILEDESC(str) str.fd()
    92110#endif
    93 #if !defined(LK_UNLOCK) && defined(LK_UNLCK)
    94 #define LK_UNLOCK LK_UNLCK
     111
     112#define GSDL_UNLOCK_FILE(fd) _locking(fd, LK_UNLCK, 200)
     113#define GSDL_LOCK_FILE(fd) lock_val = _locking(fd, LK_NBLCK, 200)
     114
     115#else
     116
     117// when using <fstream> (i.e. VC++ 6.0) I can't work out how
     118// to return a filedesc. File locking won't currently work
     119// for those windows compilers requiring GSDL_USE_IOS_H to
     120// not be set -- Stefan.
     121#define GSDL_GET_FILEDESC(str) 1
     122#define GSDL_LOCK_FILE(fd) lock_val = 0
     123#define GSDL_UNLOCK_FILE(fd) 0
    95124#endif
    96 #define GSDL_UNLOCK_FILE(fd) _locking(fd, LK_UNLOCK, 200)
    97 #define GSDL_LOCK_FILE(fd) lock_val = _locking(fd, LK_NBLCK, 200)
    98125
    99126#else
  • trunk/gsdl/src/recpt/buildaction.cpp

    r1149 r1170  
    2424 *********************************************************************/
    2525
    26 #if !defined(__WIN32__) || defined(__GNUC__)
    27 #include <unistd.h>
    28 #endif
    29 
    3026#include "OIDtools.h"
    3127#include "fileutil.h"
     
    291287      text_t cfg_fname
    292288    = filename_cat(gsdlhome, "collect", dirname, "etc", "collect.cfg");
     289
     290#ifdef GSDL_USE_IOS_H
    293291      ifstream cfg_ifs (cfg_fname.getcstr(), ios::in | ios::nocreate);
     292#else
     293      ifstream cfg_ifs (cfg_fname.getcstr(), ios::in);
     294#endif
     295
    294296      if (cfg_ifs)
    295297    { 
     
    326328      // read in collect.bld
    327329      text_t bld_fname = filename_cat(gsdlhome, "log", dirname+ ".bld");
     330
     331#ifdef GSDL_USE_IOS_H
    328332      ifstream bld_ifs (bld_fname.getcstr(), ios::in | ios::nocreate);
     333#else
     334      ifstream bld_ifs (bld_fname.getcstr(), ios::in);
     335#endif
     336
    329337      if (bld_ifs)
    330338    {
     
    447455  else
    448456    {
    449       text_t dirname = (args["bc1dirname"] == "") ? (text_t)"unknown" : args["bc1dirname"];
     457      text_t dirname = (args["bc1dirname"] == "") ?
     458    "unknown" : args["bc1dirname"];
     459
    450460      text_t tmpname = dirname+"_XXXXXX";
    451461      char *cstr_tmpname = tmpname.getcstr();
    452       if (mktemp(cstr_tmpname)==NULL)
     462
     463      if (GSDL_MKTEMP (cstr_tmpname)==NULL)
    453464    logout << "Failed to create temporary filename" << endl;
    454465
  • trunk/gsdl/src/recpt/cgiwrapper.cpp

    r1097 r1170  
    2828/*
    2929   $Log$
     30   Revision 1.26  2000/05/12 03:09:26  sjboddie
     31   minor modifications to get web library compiling under VC++ 6.0
     32
    3033   Revision 1.25  2000/04/14 04:45:19  sjboddie
    3134   Modified the English of the debug output slightly
     
    713716      ofstream errout (eout);
    714717      delete eout;
    715       cerr = errout;
     718      cerr.tie(&errout);
    716719   
    717720      // parse the cgi arguments and produce the resulting page if there
  • trunk/gsdl/src/recpt/infodbclass.h

    r928 r1170  
    3333#include "gsdlconf.h"
    3434#include "text_t.h"
     35
     36#if defined(GSDL_USE_OBJECTSPACE)
     37#  include <ospace\std\iostream>
     38#  include <ospace\std\fstream>
     39#elif defined(GSDL_USE_IOS_H)
     40#  include <iostream.h>
     41#  include <fstream.h>
     42#else
     43#  include <iostream>
     44#  include <fstream>
     45#endif
    3546
    3647#ifdef __WIN32__
  • trunk/gsdl/src/recpt/receptionist.cpp

    r1148 r1170  
    2828/*
    2929   $Log$
     30   Revision 1.50  2000/05/12 03:09:25  sjboddie
     31   minor modifications to get web library compiling under VC++ 6.0
     32
    3033   Revision 1.49  2000/05/04 05:18:46  sjboddie
    3134   attempting to get end-user collection building to work under windows
     
    239242#include <time.h>
    240243#include <stdio.h>
     244#if defined (GSDL_USE_IOS_H)
    241245#include <fstream.h>
     246#else
     247#include <fstream>
     248#endif
    242249
    243250#if defined (__WIN32_)
     
    789796  utf8outconvertclass text_t2utf8;
    790797  char *lfile = filename.getcstr();
     798
    791799  ofstream log (lfile, ios::app);
    792800 
     
    912920bool receptionist::produce_content (cgiargsclass &args, ostream &contentout,
    913921                    ostream &logout) {
    914  
     922
    915923  // decide on the output conversion class
    916924  text_t &arg_w = args["w"];
  • trunk/gsdl/src/recpt/recptconfig.cpp

    r1090 r1170  
    2828/*
    2929   $Log$
     30   Revision 1.9  2000/05/12 03:09:24  sjboddie
     31   minor modifications to get web library compiling under VC++ 6.0
     32
    3033   Revision 1.8  2000/04/14 03:10:35  sjboddie
    3134   tidied up a few issues concerning the new debug info which showed
     
    8790  text_tarray cfgline;
    8891  text_t key;
     92
     93#ifdef GSDL_USE_IOS_H
    8994  ifstream confin ("gsdlsite.cfg", ios::in | ios::nocreate);
     95#else
     96  ifstream confin ("gsdlsite.cfg", ios::in);
     97#endif
    9098
    9199  if (confin) {
     
    122130  text_tarray cfgline;
    123131  text_t key;
     132
     133#ifdef GSDL_USE_IOS_H
    124134  ifstream confin ("gsdlsite.cfg", ios::in | ios::nocreate);
     135#else
     136  ifstream confin ("gsdlsite.cfg", ios::in);
     137#endif
    125138
    126139  if (confin) {
     
    153166  if (file_exists (filename)) {
    154167    char *cstr = filename.getcstr();
     168   
     169#ifdef GSDL_USE_IOS_H
    155170    ifstream confin (cstr, ios::in | ios::nocreate);
     171#else
     172    ifstream confin (cstr, ios::in);
     173#endif
     174
    156175    delete cstr;
    157176 
     
    186205    if (!filename.empty()) {
    187206      char *cstr = filename.getcstr();
     207
     208#ifdef GSDL_USE_IOS_H
    188209      ifstream confin (cstr, ios::in | ios::nocreate);
     210#else
     211      ifstream confin (cstr, ios::in);
     212#endif
     213     
    189214      delete cstr;
    190215     
  • trunk/gsdl/src/recpt/statusaction.cpp

    r1129 r1170  
    2828/*
    2929   $Log$
     30   Revision 1.27  2000/05/12 03:09:24  sjboddie
     31   minor modifications to get web library compiling under VC++ 6.0
     32
    3033   Revision 1.26  2000/04/19 22:30:23  sjboddie
    3134   tidied up status pages and end-user collection building
     
    794797  textout << outconvert << "<h2>Init log</h2>\n";
    795798
     799#ifdef GSDL_USE_IOS_H
    796800  ifstream initin (cinitfilename, ios::in | ios::nocreate);
     801#else
     802  ifstream initin (cinitfilename, ios::in);
     803#endif
     804
    797805  delete cinitfilename;
    798806  if (initin) {
     
    834842  logout << flush;
    835843
     844#ifdef GSDL_USE_IOS_H
    836845  ifstream errin (cerrfilename, ios::in | ios::nocreate);
     846#else
     847  ifstream errin (cerrfilename, ios::in);
     848#endif
     849
    837850  delete cerrfilename;
    838851  if (errin) {
Note: See TracChangeset for help on using the changeset viewer.