diff --git a/cde/programs/dtinfo/DtMmdb/HardCopy/FPExceptions.h b/cde/programs/dtinfo/DtMmdb/HardCopy/FPExceptions.h index 43d5b7019..e0f5b884f 100644 --- a/cde/programs/dtinfo/DtMmdb/HardCopy/FPExceptions.h +++ b/cde/programs/dtinfo/DtMmdb/HardCopy/FPExceptions.h @@ -37,11 +37,7 @@ public: DECLARE_EXCEPTION(hardCopyRendererException, Exception); }; -#if defined(linux) -#define CASTHCREXCEPT (hardCopyRendererException*) -#else #define CASTHCREXCEPT -#endif #endif /* _FPExceptions_h */ /* DO NOT ADD ANY LINES AFTER THIS #endif */ diff --git a/cde/programs/dtinfo/DtMmdb/HardCopy/HardCopyFP.C b/cde/programs/dtinfo/DtMmdb/HardCopy/HardCopyFP.C index 348ea1073..61d490a63 100644 --- a/cde/programs/dtinfo/DtMmdb/HardCopy/HardCopyFP.C +++ b/cde/programs/dtinfo/DtMmdb/HardCopy/HardCopyFP.C @@ -186,7 +186,7 @@ featureProcessor::getFeatureValueArray(const Feature* f) if ( f -> value() -> type() == FeatureValue::array ) return (FeatureValueArray*)(f -> value()); else { - MESSAGE(cerr, form("%s is not of an array type.", f -> name())); + MESSAGE(cerr, form("%s is not of an array type.", f -> name().name())); throw(CASTHCREXCEPT hardCopyRendererException()); } } else diff --git a/cde/programs/dtinfo/DtMmdb/HardCopy/HardCopyFP.h b/cde/programs/dtinfo/DtMmdb/HardCopy/HardCopyFP.h index e7ab6644c..e51fc79d0 100644 --- a/cde/programs/dtinfo/DtMmdb/HardCopy/HardCopyFP.h +++ b/cde/programs/dtinfo/DtMmdb/HardCopy/HardCopyFP.h @@ -25,13 +25,15 @@ #ifndef _fp_h #define _fp_h 1 -#include +#include +using namespace std; #include "FPExceptions.h" #include "StyleSheet/Feature.h" #include "StyleSheet/FeatureValue.h" #include "StyleSheet/Element.h" #include "StyleSheet/Const.h" #include "StyleSheet/Debug.h" +#include "utility/funcs.h" enum BLOCK_MODE { NON_BLOCK, BLOCK }; extern enum BLOCK_MODE g_block_mode; diff --git a/cde/programs/dtinfo/DtMmdb/HardCopy/autoNumber.C b/cde/programs/dtinfo/DtMmdb/HardCopy/autoNumber.C index 567898334..d0b808461 100644 --- a/cde/programs/dtinfo/DtMmdb/HardCopy/autoNumber.C +++ b/cde/programs/dtinfo/DtMmdb/HardCopy/autoNumber.C @@ -23,7 +23,11 @@ // $TOG: autoNumber.C /main/6 1998/04/17 11:47:13 mgreess $ #include +#if defined(CSRG_BASED) +#define MAXINT INT_MAX +#else #include +#endif #include "HardCopy/autoNumber.h" #include "HardCopy/FPExceptions.h" @@ -137,7 +141,7 @@ autoNumberNumeric::getValue() char* ptr = f_buf.get_base(); if (f_values.entries()) - sprintf(ptr, form("%s%d%s", f_prefix, f_values.top(), f_postfix)); + sprintf(ptr, "%s", form("%s%d%s", f_prefix, f_values.top(), f_postfix)); else *ptr = 0; @@ -291,10 +295,12 @@ const char* autoNumberAlphabetic::intToAlpha(int x, enum CaseType a_case) x = z; } - for (int k=0; k length(); i++ ) { + int i; + for (i=0; i length(); i++ ) { gi = stringToCharPtr((*controlList)[i]); key = new CC_String(gi); @@ -353,11 +354,11 @@ autoNumberFP::accept(const char* name, const Expression* expr) { FeatureValue* fv = 0; - try + mtry { fv = expr -> evaluate(); } - catch_any() + mcatch_any() { return false; } diff --git a/cde/programs/dtinfo/DtMmdb/Imakefile b/cde/programs/dtinfo/DtMmdb/Imakefile index 762756b64..934778660 100644 --- a/cde/programs/dtinfo/DtMmdb/Imakefile +++ b/cde/programs/dtinfo/DtMmdb/Imakefile @@ -54,6 +54,13 @@ DONES = \ EXTRALIBRARYDEPS = $(DONES) +XCOMM redefine TopLevelProject to build DtInfo with standard CDE config dir +#undef TopLevelProject +#define TopLevelProject DtInfo +IMAKE_DEFINES = -DTopLevelProject=TopLevelProject \ + -DProjectTmplFile='' \ + -DProjectRulesFile='' + MakeSubdirs($(SUBDIRS)) ForceSubdirs($(SUBDIRS)) DependSubdirs($(SUBDIRS)) @@ -201,8 +208,8 @@ UTILITY_OBJS = \ utility/filter.o utility/mmdb_exception.o \ utility/randomize.o \ utility/streambuf.o utility/charbuf.o utility/filebuf.o \ - utility/strstream.o utility/iostream.o utility/fstream.o \ - utility/stream.o utility/ios.o + utility/stringstream.o utility/iostream.o utility/fstream.o \ + utility/stream.o utility/string.o utility/ios.o OBJS = $(API_OBJS) $(BTREE_OBJS) \ @@ -221,4 +228,8 @@ DYNAMIC = #include +XCOMM Variables to switch on debug mode temporarily +XCOMM CDEBUGFLAGS = -g -DDEBUG +XCOMM CXXDEBUGFLAGS = -g -DDEBUG + DependTarget() diff --git a/cde/programs/dtinfo/DtMmdb/StyleSheet/Attribute.C b/cde/programs/dtinfo/DtMmdb/StyleSheet/Attribute.C index e8e7922b5..1ceb4b7c5 100644 --- a/cde/programs/dtinfo/DtMmdb/StyleSheet/Attribute.C +++ b/cde/programs/dtinfo/DtMmdb/StyleSheet/Attribute.C @@ -38,6 +38,7 @@ Attribute::~Attribute() delete f_value ; } +bool Attribute::operator==(const Attribute &attr) const { /* diff --git a/cde/programs/dtinfo/DtMmdb/StyleSheet/Attribute.h b/cde/programs/dtinfo/DtMmdb/StyleSheet/Attribute.h index 7b95c337f..25916bbbe 100644 --- a/cde/programs/dtinfo/DtMmdb/StyleSheet/Attribute.h +++ b/cde/programs/dtinfo/DtMmdb/StyleSheet/Attribute.h @@ -39,7 +39,7 @@ public: ~Attribute(); const Symbol &name() const { return f_name; } - operator==(const Attribute &) const ; + bool operator==(const Attribute &) const ; const char *value() const { return f_value ; } diff --git a/cde/programs/dtinfo/DtMmdb/StyleSheet/BitVector.h b/cde/programs/dtinfo/DtMmdb/StyleSheet/BitVector.h index e53a651c2..2579e26de 100644 --- a/cde/programs/dtinfo/DtMmdb/StyleSheet/BitVector.h +++ b/cde/programs/dtinfo/DtMmdb/StyleSheet/BitVector.h @@ -25,7 +25,9 @@ #ifndef _BitVector_h #define _BitVector_h 1 -#include +#include +#include +using namespace std; #ifndef CDE_NEXT diff --git a/cde/programs/dtinfo/DtMmdb/StyleSheet/Debug.h b/cde/programs/dtinfo/DtMmdb/StyleSheet/Debug.h index dcff31679..e36dfd425 100644 --- a/cde/programs/dtinfo/DtMmdb/StyleSheet/Debug.h +++ b/cde/programs/dtinfo/DtMmdb/StyleSheet/Debug.h @@ -46,7 +46,8 @@ #ifndef _debug_h #define _debug_h 1 -#include +#include +using namespace std; #ifdef DEBUG #define ON_DEBUG(stmt) stmt diff --git a/cde/programs/dtinfo/DtMmdb/StyleSheet/DocParser.C b/cde/programs/dtinfo/DtMmdb/StyleSheet/DocParser.C index c139fb806..d3f9f59c2 100644 --- a/cde/programs/dtinfo/DtMmdb/StyleSheet/DocParser.C +++ b/cde/programs/dtinfo/DtMmdb/StyleSheet/DocParser.C @@ -52,7 +52,7 @@ DocParser::DocParser(Resolver &r) f_buffer(new char[DATA_BUF_SIZ]), f_output(f_buffer, DATA_BUF_SIZ) #else - f_streambuf(new strstreambuf(DATA_BUF_SIZ)), + f_streambuf(new stringbuf()), f_output(f_streambuf) #endif { @@ -93,7 +93,7 @@ DocParser::rawParse(istream &input) Symbol name(gElemSymTab->intern(terminate(f_output).str())); f_output.rdbuf()->freeze(0); #else - char *data = f_streambuf->str(); + char *data = (char *)f_streambuf->str().c_str(); /* MESSAGE(cerr, "StartTag case:"); @@ -102,9 +102,8 @@ debug(cerr, data); */ #if !defined(SC3) && !defined(__osf__) - data[f_streambuf->pcount()] = 0; + data[f_streambuf->str().size()] = 0; #endif - f_streambuf->freeze(0); Symbol name(gElemSymTab->intern(data)); #endif process(input, f_output, name, 1, 1); @@ -161,7 +160,7 @@ DocParser::process(istream &input, ostream &output, int ignore = 0 ; - try + mtry { // process whatever comes right after start tag TagType tt = read_tag(input, output); @@ -194,15 +193,14 @@ DocParser::process(istream &input, ostream &output, process(input, output, name, child++, child_relative_sibling_number); #else - char *data = f_streambuf->str(); + char *data = (char *)f_streambuf->str().c_str(); #if !defined(SC3) && !defined(__osf__) - data[f_streambuf->pcount()] = 0; + data[f_streambuf->str().size()] = 0; #endif Symbol name(gElemSymTab->intern(data)); update_last_seen_child_name(last_seen_child_name, child_relative_sibling_number, name); - f_streambuf->freeze(0); process(input, output, name, child++, child_relative_sibling_number); #endif @@ -216,12 +214,11 @@ DocParser::process(istream &input, ostream &output, char *data = terminate(f_output).str(); f_output.rdbuf()->freeze(0); #else - char *data = f_streambuf->str(); + char *data = (char*)f_streambuf->str().c_str(); //#ifdef _IBMR2 #if !defined(SC3) && !defined(__osf__) - data[f_streambuf->pcount()] = 0; + data[f_streambuf->str().size()] = 0; #endif - f_streambuf->freeze(0); #endif cerr << "EndTag: " << data << endl; assert(gElemSymTab->intern(data) == name); @@ -246,7 +243,8 @@ DocParser::process(istream &input, ostream &output, !defined(_IBMR2) && \ !defined(__uxp__) && \ !defined(USL) && \ - !defined(linux) + !defined(linux) && \ + !defined(CSRG_BASED) volatile #endif AttributeList *attrs = 0; @@ -255,12 +253,13 @@ DocParser::process(istream &input, ostream &output, !defined(_IBMR2) && \ !defined(__uxp__) && \ !defined(USL) && \ - !defined(linux) + !defined(linux) && \ + !defined(CSRG_BASED) volatile #endif AttributeList *olias_attrs = 0; - try + mtry { process_attributes(input, output, attrs, olias_attrs); @@ -278,7 +277,7 @@ DocParser::process(istream &input, ostream &output, f_ignoring_element = ignore ; } } - catch_any() + mcatch_any() { /* delete attrs ; @@ -318,16 +317,15 @@ DocParser::process(istream &input, ostream &output, f_resolver.data(string, size); f_output.rdbuf()->freeze(0); #else - char *string = f_streambuf->str(); + char *string = (char *)f_streambuf->str().c_str(); //#ifdef _IBMR2 #if !defined(SC3) && !defined(__osf__) - string[f_streambuf->pcount()] = 0; - int size = f_streambuf->pcount() ; + string[f_streambuf->str().size()] = 0; + int size = f_streambuf->str().size() ; #else int size = f_streambuf->pcount() - 1 ; #endif f_resolver.data(string, size); - f_streambuf->freeze(0); // unfreeze buffer frozen by str() call #endif } } @@ -347,12 +345,11 @@ DocParser::process(istream &input, ostream &output, *(data + f_output.pcount()) = 0; f_output.rdbuf()->freeze(0); #else - char *data = f_streambuf->str(); + char *data = (char *)f_streambuf->str().c_str(); //#ifdef _IBMR2 #if !defined(SC3) && !defined(__osf__) - data[f_streambuf->pcount ()] = 0; + data[f_streambuf->str().size()] = 0; #endif - f_streambuf->freeze(0); #endif /* @@ -391,16 +388,15 @@ debug(cerr, f_streambuf->pcount ()); f_resolver.data(string, size); f_output.rdbuf()->freeze(0); #else - char *string = f_streambuf->str(); + char *string = (char *)f_streambuf->str().c_str(); //#ifdef _IBMR2 #if !defined(SC3) && !defined(__osf__) - string[f_streambuf->pcount()] = 0; - int size = f_streambuf->pcount() ; + string[f_streambuf->str().size()] = 0; + int size = f_streambuf->str().size() ; #else int size = f_streambuf->pcount() - 1 ; #endif f_resolver.data(string, size); - f_streambuf->freeze(0); // unfreeze buffer frozen by str() call #endif } } @@ -411,12 +407,11 @@ debug(cerr, f_streambuf->pcount ()); char *data = terminate(f_output).str(); f_output.rdbuf()->freeze(0); #else - char *data = f_streambuf->str(); + char *data = (char*)f_streambuf->str().c_str(); //#ifdef _IBMR2 #if !defined(SC3) && !defined(__osf__) - data[f_streambuf->pcount ()] = 0; + data[f_streambuf->str().size()] = 0; #endif - f_streambuf->freeze(0); #endif cerr << "EndTag: " << data << endl; assert(gElemSymTab->intern(data) == name); @@ -430,7 +425,7 @@ debug(cerr, f_streambuf->pcount ()); if (ignore) f_ignoring_element = 0; } - catch_any() + mcatch_any() { rethrow; } @@ -454,7 +449,7 @@ DocParser::process_attributes(istream &input, ostream &output, char *theData = 0; - try { + mtry { while ((tt = read_tag(input,output)) != NoTag) { switch (tt) @@ -463,8 +458,8 @@ DocParser::process_attributes(istream &input, ostream &output, { //#ifdef _IBMR2 #if !defined(SC3) && !defined(__osf__) - theData = f_streambuf->str (); - theData[f_streambuf->pcount()] = 0; + theData = (char *)f_streambuf->str().c_str(); + theData[f_streambuf->str().size()] = 0; #endif if (!attrs) attrs = new AttributeList ; @@ -495,8 +490,8 @@ DocParser::process_attributes(istream &input, ostream &output, case OliasAttribute: //#ifdef _IBMR2 #if !defined(SC3) && !defined(__osf__) - theData = f_streambuf->str (); - theData[f_streambuf->pcount()] = 0; + theData = (char *)f_streambuf->str().c_str(); + theData[f_streambuf->str().size()] = 0; #endif // mirrors attribute if (!olias_attrs) @@ -525,7 +520,7 @@ DocParser::process_attributes(istream &input, ostream &output, } } } - catch_any() + mcatch_any() { delete newAttribute; @@ -568,12 +563,11 @@ DocParser::process_attribute(istream &input, ostream &output, *(data + f_output.pcount()) = 0; f_output.rdbuf()->freeze(0); #else - char *data = f_streambuf->str(); + char *data = (char *)f_streambuf->str().c_str(); //#ifdef _IBMR2 #if !defined(SC3) && !defined(__osf__) - data[f_streambuf->pcount ()] = 0; + data[f_streambuf->str().size()] = 0; #endif - f_streambuf->freeze(0); #endif Attribute *attr = new Attribute(name, strdup(data)); diff --git a/cde/programs/dtinfo/DtMmdb/StyleSheet/DocParser.h b/cde/programs/dtinfo/DtMmdb/StyleSheet/DocParser.h index 23ef2f37a..c2ba160c4 100644 --- a/cde/programs/dtinfo/DtMmdb/StyleSheet/DocParser.h +++ b/cde/programs/dtinfo/DtMmdb/StyleSheet/DocParser.h @@ -24,8 +24,9 @@ /* Copyright (c) 1995 FUJITSU LIMITED */ /* All Rights Reserved */ -#include -#include +#include +#include +using namespace std; #include "SymTab.h" #include "Exceptions.hh" @@ -84,7 +85,7 @@ private: char* const f_buffer; ostrstream f_output; #else - strstreambuf *f_streambuf ; + stringbuf *f_streambuf; ostream f_output; #endif Resolver &f_resolver; diff --git a/cde/programs/dtinfo/DtMmdb/StyleSheet/Element.C b/cde/programs/dtinfo/DtMmdb/StyleSheet/Element.C index be8fd160c..3863e7d1a 100644 --- a/cde/programs/dtinfo/DtMmdb/StyleSheet/Element.C +++ b/cde/programs/dtinfo/DtMmdb/StyleSheet/Element.C @@ -21,7 +21,8 @@ * Floor, Boston, MA 02110-1301 USA */ // $TOG: Element.C /main/5 1998/04/17 11:48:25 mgreess $ -#include +#include +using namespace std; #include #include "StyleSheetExceptions.h" #include "Element.h" diff --git a/cde/programs/dtinfo/DtMmdb/StyleSheet/Expression.C b/cde/programs/dtinfo/DtMmdb/StyleSheet/Expression.C index 4745618b2..0668ec000 100644 --- a/cde/programs/dtinfo/DtMmdb/StyleSheet/Expression.C +++ b/cde/programs/dtinfo/DtMmdb/StyleSheet/Expression.C @@ -30,7 +30,7 @@ #include "VariableTable.h" #include "Renderer.h" #include "Debug.h" -#include +#include #include "HardCopy/autoNumberFP.h" @@ -141,20 +141,20 @@ BinaryOperatorNode::evaluate() const { // calculate children trees and then have feature value do the operation -#if !defined(SC3) && !defined(_IBMR2) && !defined(__uxp__) && !defined(__osf__) && !defined(USL) && !defined(linux) +#if !defined(SC3) && !defined(_IBMR2) && !defined(__uxp__) && !defined(__osf__) && !defined(USL) && !defined(linux) && !defined(CSRG_BASED) volatile #endif FeatureValue *left = 0; -#if !defined(SC3) && !defined(_IBMR2) && !defined(__uxp__) && !defined(__osf__) && !defined(USL) && !defined(linux) +#if !defined(SC3) && !defined(_IBMR2) && !defined(__uxp__) && !defined(__osf__) && !defined(USL) && !defined(linux) && !defined(CSRG_BASED) volatile #endif FeatureValue *right = 0; -#if !defined(SC3) && !defined(_IBMR2) && !defined(__uxp__) && !defined(__osf__) && !defined(USL) && !defined(linux) +#if !defined(SC3) && !defined(_IBMR2) && !defined(__uxp__) && !defined(__osf__) && !defined(USL) && !defined(linux) && !defined(CSRG_BASED) volatile #endif FeatureValue *result = 0; - try + mtry { left = f_left->evaluate(); right = f_right->evaluate(); @@ -176,7 +176,7 @@ BinaryOperatorNode::evaluate() const } } - catch_any() + mcatch_any() { delete left ; delete right ; @@ -219,11 +219,11 @@ VariableNode::evaluate() const // etc. FeatureValue *return_variable = 0; - try + mtry { return_variable = variable_value->evaluate() ; } - catch_any() + mcatch_any() { delete return_variable; delete variable_value ; diff --git a/cde/programs/dtinfo/DtMmdb/StyleSheet/Feature.h b/cde/programs/dtinfo/DtMmdb/StyleSheet/Feature.h index 70e472ac3..67d58329d 100644 --- a/cde/programs/dtinfo/DtMmdb/StyleSheet/Feature.h +++ b/cde/programs/dtinfo/DtMmdb/StyleSheet/Feature.h @@ -24,7 +24,7 @@ #ifndef _Feature_h #define _Feature_h -#include +#include #ifndef CDE_NEXT diff --git a/cde/programs/dtinfo/DtMmdb/StyleSheet/FeatureDefDictionary.C b/cde/programs/dtinfo/DtMmdb/StyleSheet/FeatureDefDictionary.C index e970d391e..4cab8c514 100644 --- a/cde/programs/dtinfo/DtMmdb/StyleSheet/FeatureDefDictionary.C +++ b/cde/programs/dtinfo/DtMmdb/StyleSheet/FeatureDefDictionary.C @@ -28,7 +28,8 @@ #include "StyleSheet/StyleSheetExceptions.h" #include "utility/const.h" #include "utility/funcs.h" -#include +#include +using namespace std; featureDefDictionary* g_FeatureDefDictionary = 0; @@ -314,34 +315,34 @@ MESSAGE(cerr, ""); } FeatureValue * fv = 0; - try { + mtry { fv = f -> evaluate(); } - catch (undefinedAttributeException&, e) { + mcatch (undefinedAttributeException&, e) { return true; } - catch (undefinedVariableException&, e) { + mcatch (undefinedVariableException&, e) { report_error_location(); cerr << "Undefined variable error.\n"; return false; } /* - catch (badCastException&, e) { + mcatch (badCastException&, e) { report_error_location(); cerr << "Evaluating expression error.\n"; return false; } - catch (badEvaluationException&, e) { + mcatch (badEvaluationException&, e) { report_error_location(); cerr << "Evaluating expression error.\n"; return false; } */ - catch_any() { + mcatch_any() { //report_error_location(); //cerr << "There might be an error in the expression.\n"; return true; diff --git a/cde/programs/dtinfo/DtMmdb/StyleSheet/FeatureSet.C b/cde/programs/dtinfo/DtMmdb/StyleSheet/FeatureSet.C index d347d3030..53f9efa08 100644 --- a/cde/programs/dtinfo/DtMmdb/StyleSheet/FeatureSet.C +++ b/cde/programs/dtinfo/DtMmdb/StyleSheet/FeatureSet.C @@ -75,16 +75,16 @@ FeatureSet::evaluate(FeatureSet *result_set) const while(++next) { FeatureValue *value ; - try + mtry { value = next.key()->evaluate(); result_set->append(new Feature(next.key()->name(), value)); } #ifdef UXPDS - catch_any() + mcatch_any() #else - catch_noarg(badEvaluationException) + mcatch_noarg(badEvaluationException) #endif { /* do nothing...we just ignore any that will not evaluate */ @@ -143,7 +143,8 @@ FeatureSet::print(ostream &o) const // cast to non-const to get iterator CC_TPtrSlistIterator next(*(CC_TPtrSlist*)this); - for (int i = 0 ; i < f_print_indent_level; i++) + int i; + for (i = 0 ; i < f_print_indent_level; i++) o << " " ; o << "{" << endl; diff --git a/cde/programs/dtinfo/DtMmdb/StyleSheet/FeatureValue.C b/cde/programs/dtinfo/DtMmdb/StyleSheet/FeatureValue.C index 554676a57..d20c2f76c 100644 --- a/cde/programs/dtinfo/DtMmdb/StyleSheet/FeatureValue.C +++ b/cde/programs/dtinfo/DtMmdb/StyleSheet/FeatureValue.C @@ -522,7 +522,8 @@ FeatureValueString::operator+(const FeatureValue& x) const char* newString = new char[len1 + len2 + 1]; - for ( int i=0; i(x.length(), 0) { - try + mtry { for ( int i=0; i clone(); return; } - catch_any() + mcatch_any() { for ( int i=0; i evaluate(); } return result; } - catch_any() + mcatch_any() { delete result; rethrow; diff --git a/cde/programs/dtinfo/DtMmdb/StyleSheet/PQTest.C b/cde/programs/dtinfo/DtMmdb/StyleSheet/PQTest.C index 799a818ae..89f935de8 100644 --- a/cde/programs/dtinfo/DtMmdb/StyleSheet/PQTest.C +++ b/cde/programs/dtinfo/DtMmdb/StyleSheet/PQTest.C @@ -21,7 +21,8 @@ * Floor, Boston, MA 02110-1301 USA */ // $XConsortium: PQTest.cc /main/3 1996/06/11 17:07:26 cde-hal $ -#include +#include +using namespace std; #include "SymTab.h" #include "PathQualifier.h" #include "Element.h" diff --git a/cde/programs/dtinfo/DtMmdb/StyleSheet/PathTable.h b/cde/programs/dtinfo/DtMmdb/StyleSheet/PathTable.h index c67d2aab7..5300b5d04 100644 --- a/cde/programs/dtinfo/DtMmdb/StyleSheet/PathTable.h +++ b/cde/programs/dtinfo/DtMmdb/StyleSheet/PathTable.h @@ -32,7 +32,7 @@ #include "dti_cc/cc_hdict.h" #endif -#include +#include #include "Types.h" #include "SymTab.h" #include "SSPath.h" diff --git a/cde/programs/dtinfo/DtMmdb/StyleSheet/SSPath.C b/cde/programs/dtinfo/DtMmdb/StyleSheet/SSPath.C index da161daab..1c313fd79 100644 --- a/cde/programs/dtinfo/DtMmdb/StyleSheet/SSPath.C +++ b/cde/programs/dtinfo/DtMmdb/StyleSheet/SSPath.C @@ -64,7 +64,7 @@ unsigned int PathTerm::operator ==(const PathTerm&) ostream& operator <<(ostream& out, PathTerm& pt) { - out << pt.symbol() << " (" << int(pt.f_PQExpr) << ") "; + out << pt.symbol() << " (" << size_t(pt.f_PQExpr) << ") "; return out; } diff --git a/cde/programs/dtinfo/DtMmdb/StyleSheet/StyleSheetExceptions.h b/cde/programs/dtinfo/DtMmdb/StyleSheet/StyleSheetExceptions.h index 118616def..ba6a8af1b 100644 --- a/cde/programs/dtinfo/DtMmdb/StyleSheet/StyleSheetExceptions.h +++ b/cde/programs/dtinfo/DtMmdb/StyleSheet/StyleSheetExceptions.h @@ -27,21 +27,6 @@ #include "Exceptions.hh" #include "SymTab.h" -#if defined(linux) -#define CASTEXCEPT (Exception*) -#define CASTBCEXCEPT (badCastException*) -#define CASTBEEXCEPT (badEvaluationException*) -#define CASTDPEXCEPT (docParserException*) -#define CASTDPUCEXCEPT (docParserUnexpectedCharacter*) -#define CASTDPUTEXCEPT (docParserUnexpectedTag*) -#define CASTDPUDEXCEPT (docParserUnexpectedData*) -#define CASTDPUEEXCEPT (docParserUnexpectedEof*) -#define CASTSSEXCEPT (StyleSheetException*) -#define CASTSSSEEXCEPT (StyleSheetSyntaxError*) -#define CASTUAEXCEPT (undefinedAttributeException*) -#define CASTUTEXCEPT (unknownTagException*) -#define CASTUVEXCEPT (undefinedVariableException*) -#else #define CASTEXCEPT #define CASTBCEXCEPT #define CASTBEEXCEPT @@ -55,7 +40,6 @@ #define CASTUAEXCEPT #define CASTUTEXCEPT #define CASTUVEXCEPT -#endif class StyleSheetException : public Exception { diff --git a/cde/programs/dtinfo/DtMmdb/StyleSheet/SymTab.h b/cde/programs/dtinfo/DtMmdb/StyleSheet/SymTab.h index 8f8da682e..33ebd0a59 100644 --- a/cde/programs/dtinfo/DtMmdb/StyleSheet/SymTab.h +++ b/cde/programs/dtinfo/DtMmdb/StyleSheet/SymTab.h @@ -31,7 +31,8 @@ #include "dti_cc/CC_String.h" #include "dti_cc/cc_hdict.h" //#include "StyleSheet/cde_next.h" -#include +#include +using namespace std; #endif #include "Types.h" diff --git a/cde/programs/dtinfo/DtMmdb/StyleSheet/defParser.C b/cde/programs/dtinfo/DtMmdb/StyleSheet/defParser.C index 74ed84a12..f8c1d5d4e 100644 --- a/cde/programs/dtinfo/DtMmdb/StyleSheet/defParser.C +++ b/cde/programs/dtinfo/DtMmdb/StyleSheet/defParser.C @@ -27,8 +27,9 @@ static char defParsersccsid[] = "@(#)yaccpar 1.8 (Berkeley) 01/20/90"; #define defParserBYACC 1 #include #include -#include -#include +#include +#include +using namespace std; #include "Debug.h" #include "FeatureDefDictionary.h" @@ -269,14 +270,16 @@ defParserloop: goto defParserreduce; } if (defParsererrflag) goto defParserinrecovery; -#if 0 // Disable for now +// Disable for now +#if 0 #ifdef lint goto defParsernewerror; #endif defParsernewerror: #endif /* 0 */ - defParsererror("syntax error"); -#if 0 // Disable for now + defParsererror((char*)"syntax error"); +// Disable for now +#if 0 #ifdef lint goto defParsererrlab; #endif @@ -516,7 +519,7 @@ to state %d\n", *defParserssp, defParserstate); *++defParservsp = defParserval; goto defParserloop; defParseroverflow: - defParsererror("yacc stack overflow"); + defParsererror((char*)"yacc stack overflow"); defParserabort: return (1); defParseraccept: diff --git a/cde/programs/dtinfo/DtMmdb/StyleSheet/defParser.y b/cde/programs/dtinfo/DtMmdb/StyleSheet/defParser.y index 33e60e275..097815e8b 100644 --- a/cde/programs/dtinfo/DtMmdb/StyleSheet/defParser.y +++ b/cde/programs/dtinfo/DtMmdb/StyleSheet/defParser.y @@ -3,7 +3,7 @@ %{ #include #include -#include +#include #include #include "Debug.h" #include "FeatureDefDictionary.h" diff --git a/cde/programs/dtinfo/DtMmdb/StyleSheet/defToken.C b/cde/programs/dtinfo/DtMmdb/StyleSheet/defToken.C index 238f29541..67f618a65 100644 --- a/cde/programs/dtinfo/DtMmdb/StyleSheet/defToken.C +++ b/cde/programs/dtinfo/DtMmdb/StyleSheet/defToken.C @@ -43,7 +43,7 @@ #include -#if !defined(__osf__) && !defined(USL) +#if !defined(__osf__) && !defined(USL) && !defined(linux) && !defined(CSRG_BASED) #include #endif @@ -196,7 +196,8 @@ typedef struct defParser_buffer_state *defParser_BUFFER_STATE; #include "FeatureDefDictionary.h" #include "defParser.tab.h" #include "Debug.h" -#include +#include +using namespace std; extern istream *g_defParserin; diff --git a/cde/programs/dtinfo/DtMmdb/StyleSheet/defToken.l b/cde/programs/dtinfo/DtMmdb/StyleSheet/defToken.l index fcee33c8c..0aa971d6a 100644 --- a/cde/programs/dtinfo/DtMmdb/StyleSheet/defToken.l +++ b/cde/programs/dtinfo/DtMmdb/StyleSheet/defToken.l @@ -13,7 +13,8 @@ #include "FeatureDefDictionary.h" #include "defParser.tab.h" #include "Debug.h" -#include +#include +using namespace std; extern istream *g_yyin; diff --git a/cde/programs/dtinfo/DtMmdb/StyleSheet/docparser.C b/cde/programs/dtinfo/DtMmdb/StyleSheet/docparser.C index 4f8c938a0..6d251f764 100644 --- a/cde/programs/dtinfo/DtMmdb/StyleSheet/docparser.C +++ b/cde/programs/dtinfo/DtMmdb/StyleSheet/docparser.C @@ -30,7 +30,8 @@ #include "StyleSheet.h" #include "StyleSheetExceptions.h" #include "VariableTable.h" -#include +#include +using namespace std; Renderer *gRenderer = 0; class TestRenderer : public Renderer diff --git a/cde/programs/dtinfo/DtMmdb/StyleSheet/style.C b/cde/programs/dtinfo/DtMmdb/StyleSheet/style.C index fc75df54b..2605417da 100644 --- a/cde/programs/dtinfo/DtMmdb/StyleSheet/style.C +++ b/cde/programs/dtinfo/DtMmdb/StyleSheet/style.C @@ -27,8 +27,9 @@ static char stylesccsid[] = "@(#)yaccpar 1.8 (Berkeley) 01/20/90"; #define styleBYACC 1 #include #include -#include -#include +#include +#include +using namespace std; #include #include "StyleSheetExceptions.h" #include "VariableTable.h" @@ -533,7 +534,7 @@ styleloop: #endif stylenewerror: #endif /* if 0 */ - styleerror("syntax error"); + styleerror((char*)"syntax error"); #if 0 /* remove if needed */ #ifdef lint goto styleerrlab; @@ -1353,7 +1354,7 @@ to state %d\n", *stylessp, stylestate); *++stylevsp = styleval; goto styleloop; styleoverflow: - styleerror("yacc stack overflow"); + styleerror((char*)"yacc stack overflow"); styleabort: return (1); styleaccept: diff --git a/cde/programs/dtinfo/DtMmdb/StyleSheet/style.y b/cde/programs/dtinfo/DtMmdb/StyleSheet/style.y index 6a13a2448..0846f5d0e 100644 --- a/cde/programs/dtinfo/DtMmdb/StyleSheet/style.y +++ b/cde/programs/dtinfo/DtMmdb/StyleSheet/style.y @@ -3,7 +3,7 @@ %{ #include #include -#include +#include #include #include #include "StyleSheetExceptions.h" diff --git a/cde/programs/dtinfo/DtMmdb/StyleSheet/tokenStyle.C b/cde/programs/dtinfo/DtMmdb/StyleSheet/tokenStyle.C index 8258e7089..93ec6137d 100644 --- a/cde/programs/dtinfo/DtMmdb/StyleSheet/tokenStyle.C +++ b/cde/programs/dtinfo/DtMmdb/StyleSheet/tokenStyle.C @@ -43,7 +43,7 @@ #include -#if !defined(__osf__) && !defined(USL) +#if !defined(__osf__) && !defined(USL) && !defined(linux) && !defined(CSRG_BASED) #include #endif @@ -228,7 +228,8 @@ typedef struct style_buffer_state *style_BUFFER_STATE; #include "StyleSheetExceptions.h" #include "style.tab.h" #include "Debug.h" -#include +#include +using namespace std; istream *g_stylein = 0; diff --git a/cde/programs/dtinfo/DtMmdb/api/Imakefile b/cde/programs/dtinfo/DtMmdb/api/Imakefile index 6582bcac4..f58f4ee16 100644 --- a/cde/programs/dtinfo/DtMmdb/api/Imakefile +++ b/cde/programs/dtinfo/DtMmdb/api/Imakefile @@ -23,7 +23,7 @@ XCOMM .../programs/dtinfo/mmdb//Imakefile #define LargePICTable YES #define CplusplusSource YES -DEPEND_DEFINES = $(CXXDEPENDINCLUDES) +DEPEND_DEFINES = $(CXXDEPENDINCLUDES) $(DEPENDDEFINES) XCOMM In DtMmdb we compile as C_API sources. DEFINES = -DC_API diff --git a/cde/programs/dtinfo/DtMmdb/api/base.C b/cde/programs/dtinfo/DtMmdb/api/base.C index 57ea70491..e4fc08896 100644 --- a/cde/programs/dtinfo/DtMmdb/api/base.C +++ b/cde/programs/dtinfo/DtMmdb/api/base.C @@ -102,5 +102,6 @@ base::base(object_dict* obj_dict, base::~base() { + ; } diff --git a/cde/programs/dtinfo/DtMmdb/api/info_base.C b/cde/programs/dtinfo/DtMmdb/api/info_base.C index c202bf372..490cf6636 100644 --- a/cde/programs/dtinfo/DtMmdb/api/info_base.C +++ b/cde/programs/dtinfo/DtMmdb/api/info_base.C @@ -48,6 +48,10 @@ */ +#ifndef C_API +#include +using namespace std; +#endif #include "api/info_base.h" #include "compression/abs_agent.h" @@ -74,21 +78,22 @@ debug(cerr, base_ds); *info_base_locale = 0; char* nm ; + int i; ////////////////////// // sets ////////////////////// info_base_set_ptrs = new cset_handlerPtr[num_cset_ptrs]; - for ( int i=0; i get_handler(nm)); } - catch_any() + mcatch_any() { info_base_set_ptrs[i] = 0; } @@ -104,11 +109,11 @@ debug(cerr, base_ds); nm = form("%s.%s", base_nm, info_base_list_names[i]); - try { + mtry { info_base_list_ptrs[i] = (dl_list_handler*) obj_dict.get_handler(nm); } - catch_any() + mcatch_any() { info_base_list_ptrs[i] = 0; } @@ -195,23 +200,23 @@ int info_base::num_of_docs() // //////////////////////////////////////////////////////////////////// -iterator::iterator( handler* x, c_code_t y) : +Iterator::Iterator( handler* x, c_code_t y) : collection_hd(x), instance_c_code(y), ind(0) { } -iterator::~iterator() +Iterator::~Iterator() { } -iterator::operator void*() +Iterator::operator void*() { return ( ind == 0 ) ? 0 : (void*)1; } -iterator* info_base::first(char* col_nm, c_code_t code) +Iterator* info_base::first(char* col_nm, c_code_t code) { handler* x = get_set(col_nm); @@ -233,7 +238,7 @@ iterator* info_base::first(char* col_nm, c_code_t code) throw(stringException("non page store no supported")); } - iterator* it = new iterator(x, code); + Iterator* it = new Iterator(x, code); it -> ind = s -> first_loc(); @@ -244,7 +249,7 @@ iterator* info_base::first(char* col_nm, c_code_t code) return it; } -oid_t info_base::get_oid(const iterator& it) +oid_t info_base::get_oid(const Iterator& it) { page_storage *s = (page_storage*)( it.collection_hd -> its_store() ); @@ -256,7 +261,7 @@ oid_t info_base::get_oid(const iterator& it) return r -> my_oid(); } -void info_base::next(iterator& it) +void info_base::next(Iterator& it) { page_storage *s = (page_storage*)( it.collection_hd -> its_store()); diff --git a/cde/programs/dtinfo/DtMmdb/api/info_base.h b/cde/programs/dtinfo/DtMmdb/api/info_base.h index 1a2fb7865..dad564339 100644 --- a/cde/programs/dtinfo/DtMmdb/api/info_base.h +++ b/cde/programs/dtinfo/DtMmdb/api/info_base.h @@ -59,11 +59,11 @@ #include "object/cset.h" #include "object/dl_list.h" -class iterator +class Iterator { public: - iterator( handler*, c_code_t ); - ~iterator(); + Iterator( handler*, c_code_t ); + ~Iterator(); operator void*(); @@ -106,9 +106,9 @@ public: mm_version& data_version() { return f_v; }; // iterate over all instances with 'c_code' in a set or a list - iterator* first(char* col_nm, c_code_t c_code); - oid_t get_oid(const iterator& ind); - void next(iterator&); + Iterator* first(char* col_nm, c_code_t c_code); + oid_t get_oid(const Iterator& ind); + void next(Iterator&); #ifdef C_API // an integer id within the infolib diff --git a/cde/programs/dtinfo/DtMmdb/api/info_lib.C b/cde/programs/dtinfo/DtMmdb/api/info_lib.C index e29c1d9c8..69940cdee 100644 --- a/cde/programs/dtinfo/DtMmdb/api/info_lib.C +++ b/cde/programs/dtinfo/DtMmdb/api/info_lib.C @@ -317,7 +317,7 @@ debug(cerr, base_name); //fprintf(stderr, "try to init %s\n", base_name); - try { + mtry { f_obj_dict -> init_a_base((char*)base_path, (char*)base_name); x = new info_base(*f_obj_dict, set_nm_list, list_nm_list, @@ -328,7 +328,7 @@ debug(cerr, base_name); info_base_list.insert_as_tail(new dlist_void_ptr_cell(x)); } - catch (mmdbException &,e) + mcatch (mmdbException &,e) { //fprintf(stderr, "in catch block\n"); return 0; @@ -445,7 +445,8 @@ info_lib::define_info_base( char* base_name, char* base_desc, /*************************************/ char* lib_nm = form("%s/%s", info_lib_path, MAP_FILE_8_3); - fstream nm_out(lib_nm, ios::app, open_file_prot()); + fstream nm_out(lib_nm, ios::out | ios::app); +// fstream nm_out(lib_nm, ios::app, open_file_prot()); if ( !nm_out ) { MESSAGE(cerr, form("can't open %s/%s for append", @@ -454,7 +455,7 @@ info_lib::define_info_base( char* base_name, char* base_desc, throw(streamException(nm_out.rdstate())); } - if ( bytes(nm_out) == 0 ) { + if ( bytes(lib_nm) == 0 ) { char* lib_entry = form("%s\t%s\n", info_lib_name, unique_id()); if ( !(nm_out << lib_entry) ) { @@ -589,7 +590,7 @@ info_lib::getInfobaseByComponent(const char *locator_string, enum TestSelector s if (ib==0) throw(stringException("null info_base ptr")); - try { // since an infobase may not have any graphics, we catch + mtry { // since an infobase may not have any graphics, we catch // any exceptions there and try next infobase. switch (sel) { @@ -615,7 +616,7 @@ info_lib::getInfobaseByComponent(const char *locator_string, enum TestSelector s } } - catch (mmdbException &,e) + mcatch (mmdbException &,e) { } end_try; @@ -630,7 +631,8 @@ info_base** info_lib::getInfobasesByComponent(char **locator_strings, int count, enum TestSelector sel) { info_base** ibs = new info_basePtr[count]; - for ( int i=0; i asciiIn(in); diff --git a/cde/programs/dtinfo/DtMmdb/api/utility.h b/cde/programs/dtinfo/DtMmdb/api/utility.h index 4216f4ec6..a3f4f688c 100644 --- a/cde/programs/dtinfo/DtMmdb/api/utility.h +++ b/cde/programs/dtinfo/DtMmdb/api/utility.h @@ -52,9 +52,9 @@ #define _utility_h 1 #ifdef C_API -#include "utility/c_strstream.h" +#include "utility/c_stringstream.h" #else -#include +#include #endif #include diff --git a/cde/programs/dtinfo/DtMmdb/btree/Imakefile b/cde/programs/dtinfo/DtMmdb/btree/Imakefile index e2eb84755..559a549f8 100644 --- a/cde/programs/dtinfo/DtMmdb/btree/Imakefile +++ b/cde/programs/dtinfo/DtMmdb/btree/Imakefile @@ -23,7 +23,7 @@ XCOMM .../programs/dtinfo/mmdb//Imakefile #define LargePICTable YES #define CplusplusSource YES -DEPEND_DEFINES = $(CXXDEPENDINCLUDES) +DEPEND_DEFINES = $(CXXDEPENDINCLUDES) $(DEPENDDEFINES) XCOMM In DtMmdb we compile as C_API sources. DEFINES = -DC_API diff --git a/cde/programs/dtinfo/DtMmdb/btree_berkeley/bt_put.c b/cde/programs/dtinfo/DtMmdb/btree_berkeley/bt_put.c index 921b9bcc2..6b34452d9 100644 --- a/cde/programs/dtinfo/DtMmdb/btree_berkeley/bt_put.c +++ b/cde/programs/dtinfo/DtMmdb/btree_berkeley/bt_put.c @@ -289,7 +289,7 @@ bt_fast(t, key, data, exactp) const DBT *key, *data; int *exactp; { - EPG e; + static EPG e; PAGE *h; size_t nbytes; int cmp; diff --git a/cde/programs/dtinfo/DtMmdb/btree_berkeley/cdefs.h b/cde/programs/dtinfo/DtMmdb/btree_berkeley/cdefs.h index 4a41bed99..ab698baef 100644 --- a/cde/programs/dtinfo/DtMmdb/btree_berkeley/cdefs.h +++ b/cde/programs/dtinfo/DtMmdb/btree_berkeley/cdefs.h @@ -60,8 +60,12 @@ #define _CDEFS_H_ #if defined(__cplusplus) +#ifndef __BEGIN_DECLS #define __BEGIN_DECLS extern "C" { +#endif +#ifndef __END_DECLS #define __END_DECLS }; +#endif #else #define __BEGIN_DECLS #define __END_DECLS @@ -79,7 +83,9 @@ #undef __P #endif #define __P(protos) protos /* full-blown ANSI C */ +#ifndef __CONCAT #define __CONCAT(x,y) x ## y +#endif #define __STRING(x) #x #else /* !(__STDC__ || __cplusplus) */ @@ -114,7 +120,9 @@ */ #if defined(__GNUC__) && !defined(__STRICT_ANSI__) #define __dead __volatile +#ifndef __pure #define __pure __const +#endif #else #define __dead #define __pure diff --git a/cde/programs/dtinfo/DtMmdb/btree_berkeley/memmove.c b/cde/programs/dtinfo/DtMmdb/btree_berkeley/memmove.c index 9a85a10e6..fe4e715d1 100644 --- a/cde/programs/dtinfo/DtMmdb/btree_berkeley/memmove.c +++ b/cde/programs/dtinfo/DtMmdb/btree_berkeley/memmove.c @@ -111,13 +111,13 @@ bcopy(src0, dst0, length) /* * Copy forward. */ - t = (int)src; /* only need low bits */ - if ((t | (int)dst) & wmask) { + t = (size_t)src; /* only need low bits */ + if ((t | (size_t)dst) & wmask) { /* * Try to align operands. This cannot be done * unless the low bits match. */ - if ((t ^ (int)dst) & wmask || length < wsize) + if ((t ^ (size_t)dst) & wmask || length < wsize) t = length; else t = wsize - (t & wmask); @@ -139,9 +139,9 @@ bcopy(src0, dst0, length) */ src += length; dst += length; - t = (int)src; - if ((t | (int)dst) & wmask) { - if ((t ^ (int)dst) & wmask || length <= wsize) + t = (size_t)src; + if ((t | (size_t)dst) & wmask) { + if ((t ^ (size_t)dst) & wmask || length <= wsize) t = length; else t &= wmask; diff --git a/cde/programs/dtinfo/DtMmdb/btree_berkeley/snprintf.c b/cde/programs/dtinfo/DtMmdb/btree_berkeley/snprintf.c index 4258cce2c..bec780927 100644 --- a/cde/programs/dtinfo/DtMmdb/btree_berkeley/snprintf.c +++ b/cde/programs/dtinfo/DtMmdb/btree_berkeley/snprintf.c @@ -25,6 +25,7 @@ #include "cdefs.h" #include +#include #ifdef __STDC__ #include @@ -52,7 +53,7 @@ snprintf(str, n, fmt, va_alist) va_start(ap); #endif #ifdef VSPRINTF_CHARSTAR - rp = vsprintf(str, fmt, ap); + rp = (char*)(size_t)vsprintf(str, fmt, ap); va_end(ap); return (strlen(rp)); #else @@ -70,7 +71,7 @@ vsnprintf(str, n, fmt, ap) va_list ap; { #ifdef VSPRINTF_CHARSTAR - return (strlen(vsprintf(str, fmt, ap))); + return (strlen((char*)(size_t)vsprintf(str, fmt, ap))); #else return (vsprintf(str, fmt, ap)); #endif diff --git a/cde/programs/dtinfo/DtMmdb/compression/Imakefile b/cde/programs/dtinfo/DtMmdb/compression/Imakefile index 58b0c63b2..d7453dd17 100644 --- a/cde/programs/dtinfo/DtMmdb/compression/Imakefile +++ b/cde/programs/dtinfo/DtMmdb/compression/Imakefile @@ -23,7 +23,7 @@ XCOMM .../programs/dtinfo/mmdb//Imakefile #define LargePICTable YES #define CplusplusSource YES -DEPEND_DEFINES = $(CXXDEPENDINCLUDES) +DEPEND_DEFINES = $(CXXDEPENDINCLUDES) $(DEPENDDEFINES) XCOMM In DtMmdb we compile as C_API sources. DEFINES = -DC_API diff --git a/cde/programs/dtinfo/DtMmdb/compression/huffman.C b/cde/programs/dtinfo/DtMmdb/compression/huffman.C index 612403c7e..f6501bd8e 100644 --- a/cde/programs/dtinfo/DtMmdb/compression/huffman.C +++ b/cde/programs/dtinfo/DtMmdb/compression/huffman.C @@ -400,11 +400,12 @@ io_status huff::cdrOut(buffer& buf) //MESSAGE(cerr, "huff::cdrOut"); //debug(cerr, my_oid()); static buffer v_out_buf(LBUFSIZ); + int i; if ( cts > 0 ) { //MESSAGE(cerr, "huff::cdrOut: dict out"); int sz = sizeof(int); - for ( int i=0; i word -> size() + sizeof(unsigned int) + sizeof(char) diff --git a/cde/programs/dtinfo/DtMmdb/compression/ps.C b/cde/programs/dtinfo/DtMmdb/compression/ps.C index decd747e6..dcf394331 100644 --- a/cde/programs/dtinfo/DtMmdb/compression/ps.C +++ b/cde/programs/dtinfo/DtMmdb/compression/ps.C @@ -43,9 +43,13 @@ #include -#if !defined(__osf__) && !defined(USL) +#if defined(__osf__) || defined(linux) || defined(CSRG_BASED) +#include +#else +#if !defined(__uxp__) && !defined(USL) #include #endif +#endif /* use prototypes in function declarations */ #define ps_USE_PROTOS diff --git a/cde/programs/dtinfo/DtMmdb/compression/sgml.C b/cde/programs/dtinfo/DtMmdb/compression/sgml.C index 1720de22f..248965684 100644 --- a/cde/programs/dtinfo/DtMmdb/compression/sgml.C +++ b/cde/programs/dtinfo/DtMmdb/compression/sgml.C @@ -43,9 +43,13 @@ #include -#if !defined(__osf__) && !defined(USL) +#if defined(__osf__) || defined(linux) || defined(CSRG_BASED) +#include +#else +#if !defined(__uxp__) && !defined(USL) #include #endif +#endif /* use prototypes in function declarations */ #define sgml_USE_PROTOS diff --git a/cde/programs/dtinfo/DtMmdb/compression/trie.C b/cde/programs/dtinfo/DtMmdb/compression/trie.C index 341d2fac4..3f4fd2755 100644 --- a/cde/programs/dtinfo/DtMmdb/compression/trie.C +++ b/cde/programs/dtinfo/DtMmdb/compression/trie.C @@ -360,9 +360,9 @@ Boolean trie::travers_to(char* str, int len, node = root; - int j; + int i, j; - for ( int i=0; i %s", UNCOMPRESSED, COMPRESSED)); + ret = system(form("gzip -c %s > %s", (char*)UNCOMPRESSED,(char*)COMPRESSED)); fstream in(COMPRESSED, ios::in); if ( !in ) throw(streamException(in.rdstate())); - int x = bytes(in); + int x = bytes((char*)COMPRESSED); compressed.expand_chunk(x); @@ -94,6 +95,7 @@ void zip::compress(const buffer& uncompressed, buffer& compressed) void zip::decompress(buffer& compressed, buffer& uncompressed) { + int ret; fstream out(COMPRESSED, ios::out|ios::trunc); if ( !out ) @@ -104,14 +106,14 @@ void zip::decompress(buffer& compressed, buffer& uncompressed) out.close(); - system(form("gzip -cd %s > %s", COMPRESSED, UNCOMPRESSED)); + ret = system(form("gzip -cd %s > %s",(char*)COMPRESSED,(char*)UNCOMPRESSED)); fstream in(UNCOMPRESSED, ios::in); if ( !in ) throw(streamException(in.rdstate())); - int x = bytes(in); + int x = bytes((char*)UNCOMPRESSED); uncompressed.expand_chunk(x); diff --git a/cde/programs/dtinfo/DtMmdb/diskhash/Imakefile b/cde/programs/dtinfo/DtMmdb/diskhash/Imakefile index 3866f7537..497554c64 100644 --- a/cde/programs/dtinfo/DtMmdb/diskhash/Imakefile +++ b/cde/programs/dtinfo/DtMmdb/diskhash/Imakefile @@ -23,7 +23,7 @@ XCOMM .../programs/dtinfo/mmdb//Imakefile #define LargePICTable YES #define CplusplusSource YES -DEPEND_DEFINES = $(CXXDEPENDINCLUDES) +DEPEND_DEFINES = $(CXXDEPENDINCLUDES) $(DEPENDDEFINES) XCOMM In DtMmdb we compile as C_API sources. DEFINES = -DC_API diff --git a/cde/programs/dtinfo/DtMmdb/diskhash/disk_hash.C b/cde/programs/dtinfo/DtMmdb/diskhash/disk_hash.C index c1b52024e..2b68cc8fa 100644 --- a/cde/programs/dtinfo/DtMmdb/diskhash/disk_hash.C +++ b/cde/programs/dtinfo/DtMmdb/diskhash/disk_hash.C @@ -315,7 +315,7 @@ void disk_hash::caching(disk_bucket& b, data_t& w, int slot_num) if ( x ) { hash_vector -> insert( - voidPtr(ind), + (voidPtr)(size_t)ind, x -> slot_num(k, r, p, hash_vector -> count()) ); } @@ -330,7 +330,7 @@ void disk_hash::caching(disk_bucket& b, data_t& w, int slot_num) // others may be overwritten. //////////////////////////////////////// hash_vector -> insert( - voidPtr(slot_num), + (voidPtr)(size_t)slot_num, w.slot_num(k, r, p, hash_vector -> count()) ); } diff --git a/cde/programs/dtinfo/DtMmdb/dstr/Imakefile b/cde/programs/dtinfo/DtMmdb/dstr/Imakefile index ea20792c1..6a846419d 100644 --- a/cde/programs/dtinfo/DtMmdb/dstr/Imakefile +++ b/cde/programs/dtinfo/DtMmdb/dstr/Imakefile @@ -23,7 +23,7 @@ XCOMM .../programs/dtinfo/mmdb//Imakefile #define LargePICTable YES #define CplusplusSource YES -DEPEND_DEFINES = $(CXXDEPENDINCLUDES) +DEPEND_DEFINES = $(CXXDEPENDINCLUDES) $(DEPENDDEFINES) XCOMM In DtMmdb we compile as C_API sources. DEFINES = -DC_API diff --git a/cde/programs/dtinfo/DtMmdb/dstr/dlist.C b/cde/programs/dtinfo/DtMmdb/dstr/dlist.C index 0ec178deb..d2ccb3a9d 100644 --- a/cde/programs/dtinfo/DtMmdb/dstr/dlist.C +++ b/cde/programs/dtinfo/DtMmdb/dstr/dlist.C @@ -53,7 +53,8 @@ #ifdef C_API #include "utility/c_stream.h" #else -#include +#include +using namespace std; #endif diff --git a/cde/programs/dtinfo/DtMmdb/dstr/token_stack.C b/cde/programs/dtinfo/DtMmdb/dstr/token_stack.C index 2d87cd0ab..fa9aa26a6 100644 --- a/cde/programs/dtinfo/DtMmdb/dstr/token_stack.C +++ b/cde/programs/dtinfo/DtMmdb/dstr/token_stack.C @@ -53,7 +53,8 @@ #ifdef C_API #include "utility/c_stream.h" #else -#include +#include +using namespace std; #endif token_stack::token_stack() : curr_token_start(0) diff --git a/cde/programs/dtinfo/DtMmdb/dti_cc/CC_Dlist.C b/cde/programs/dtinfo/DtMmdb/dti_cc/CC_Dlist.C index 8bcc1ac39..793a39b08 100644 --- a/cde/programs/dtinfo/DtMmdb/dti_cc/CC_Dlist.C +++ b/cde/programs/dtinfo/DtMmdb/dti_cc/CC_Dlist.C @@ -56,7 +56,7 @@ CC_TPtrDlist::CC_TPtrDlist(const CC_TPtrDlist&adlist) template void CC_TPtrDlist::clear() { - if ( !destructed ) { + if ( !this->get_destructed() ) { CC_TPtrSlistIterator iter(*this); if (++iter) { while (1) { @@ -82,7 +82,7 @@ template void CC_TPtrDlist::clearAndDestroy() { - destructed = TRUE; + this->set_destructed(TRUE); CC_TPtrDlistIterator iter(*this); if ( ++iter ) { while (1) { diff --git a/cde/programs/dtinfo/DtMmdb/dti_cc/CC_Slist.C b/cde/programs/dtinfo/DtMmdb/dti_cc/CC_Slist.C index ec30dec80..48b3430fb 100644 --- a/cde/programs/dtinfo/DtMmdb/dti_cc/CC_Slist.C +++ b/cde/programs/dtinfo/DtMmdb/dti_cc/CC_Slist.C @@ -41,23 +41,6 @@ CC_TPtrSlist::CC_TPtrSlist(const CC_TPtrSlist&slist) } - -//------------------------------------------------------------------ -template -T *CC_TPtrSlist::at(size_t pos) const -{ - -// Hack to get it passed to iter - CC_TPtrSlistIterator iter( *(CC_TPtrSlist *)this ); - for ( int i = 0; i <=pos; i++ ) { - if ( !(++iter) ) { - throw(CASTCCBEXCEPT ccBoundaryException(0,0,i)); - } - } - - return( iter.key() ); -} - //------------------------------------------------------------------ template T *CC_TPtrSlist::removeAt(size_t pos) { diff --git a/cde/programs/dtinfo/DtMmdb/dti_cc/CC_Slist.h b/cde/programs/dtinfo/DtMmdb/dti_cc/CC_Slist.h index 2f98686c7..5d10f66ce 100644 --- a/cde/programs/dtinfo/DtMmdb/dti_cc/CC_Slist.h +++ b/cde/programs/dtinfo/DtMmdb/dti_cc/CC_Slist.h @@ -25,6 +25,7 @@ #define __CC_Slist_h #include "CC_Listbase.h" +#include "cc_exceptions.h" template class CC_TPtrSlist; template class CC_TPtrSlistIterator; @@ -65,7 +66,7 @@ class CC_TPtrSlist : public CC_Listbase friend class CC_List_Iterator; protected: - CC_Boolean destructed; + CC_Boolean destructed; // Inherit public members from CC_Listbase /* @@ -97,9 +98,20 @@ public: void insert(T* element) { CC_Listbase::append (new CC_Link (element)); } - T* at(size_t pos) const; /* throw boundaryException + T* at(size_t pos) const /* throw boundaryException * if list size is smaller than pos */ + { + // Hack to get it passed to iter + CC_TPtrSlistIterator iter( *(CC_TPtrSlist *)this ); + for ( int i = 0; i <=pos; i++ ) { + if ( !(++iter) ) { + throw(CASTCCBEXCEPT ccBoundaryException(0,0,i)); + } + } + + return( iter.key() ); + } T* removeAt(size_t pos); /* throw boundaryException * if list size is smaller than pos @@ -146,7 +158,11 @@ public: operator CC_Listbase *() { return(this); } + CC_Boolean get_destructed() const + { return (destructed); } + CC_Boolean set_destructed(CC_Boolean what) + { destructed = what; } }; diff --git a/cde/programs/dtinfo/DtMmdb/dti_cc/CC_Stack.C b/cde/programs/dtinfo/DtMmdb/dti_cc/CC_Stack.C index e4cd29cd0..ffcc37996 100644 --- a/cde/programs/dtinfo/DtMmdb/dti_cc/CC_Stack.C +++ b/cde/programs/dtinfo/DtMmdb/dti_cc/CC_Stack.C @@ -23,54 +23,3 @@ // $XConsortium: CC_Stack.C /main/4 1996/10/08 19:22:53 cde-hal $ #include "CC_Stack.h" -//------------------------------------------------------------------------ -template Stack::Stack () -{ - Items = new CC_TValSlist(); -} - -//------------------------------------------------------------------------- -template Stack::~Stack () -{ - delete Items; -} - -//------------------------------------------------------------------------- -template -void -Stack::push (const T newItem) -{ - Items->append ( newItem ); -} - -//--------------------------------------------------------------------------- -template -T -Stack::pop () { - CC_Link *last_elem = (CC_Link *)Items->removeLast(); - - if ( !last_elem ) { - throw (Exception()); - } - - T *ret = last_elem->f_element; - delete last_elem; - - T ret_value = *ret; - delete ret; - - return(ret_value); -} - -//--------------------------------------------------------------------------- -template -T& -Stack::top () const -{ - CC_Link *last_elem = (CC_Link *)Items->last(); - if ( !last_elem ) { - throw(Exception()); - } - - return ( *last_elem->f_element ); -} diff --git a/cde/programs/dtinfo/DtMmdb/dti_cc/CC_Stack.h b/cde/programs/dtinfo/DtMmdb/dti_cc/CC_Stack.h index 9a645fc3a..e6f3a5146 100644 --- a/cde/programs/dtinfo/DtMmdb/dti_cc/CC_Stack.h +++ b/cde/programs/dtinfo/DtMmdb/dti_cc/CC_Stack.h @@ -31,19 +31,55 @@ template class Stack: public Destructable { public: - Stack (); /* This is a value stack, ie an assignment operator - * for T is assumed */ + /* This is a value stack, ie an assignment operator for T is assumed */ + Stack () + { + Items = new CC_TValSlist(); + } - ~Stack (); + ~Stack () + { + delete Items; + } public: - T pop (); - void push (const T); - T& top () const; + T pop () + { + CC_Link *last_elem = (CC_Link *)Items->removeLast(); + + if ( !last_elem ) { + throw (Exception()); + } + + T *ret = last_elem->f_element; + delete last_elem; + + T ret_value = *ret; + delete ret; + + return(ret_value); + } + + void push (const T newItem) + { + Items->append ( newItem ); + } + + T& top () const + { + CC_Link *last_elem = (CC_Link *)Items->last(); + if ( !last_elem ) { + throw(Exception()); + } + + return ( *last_elem->f_element ); + } + int entries() const { return( Items->entries() ); //ie no. of elements in the stack } + int empty() const { return( Items->entries() == 0 ); } diff --git a/cde/programs/dtinfo/DtMmdb/dti_cc/cc_exceptions.C b/cde/programs/dtinfo/DtMmdb/dti_cc/cc_exceptions.C index 4e7f43b35..1912e41e2 100644 --- a/cde/programs/dtinfo/DtMmdb/dti_cc/cc_exceptions.C +++ b/cde/programs/dtinfo/DtMmdb/dti_cc/cc_exceptions.C @@ -23,6 +23,7 @@ // $XConsortium: cc_exceptions.C /main/4 1996/08/21 15:48:54 drk $ #include "dti_cc/cc_exceptions.h" +using namespace std; ostream& ccException::asciiOut(ostream& out) { @@ -43,7 +44,7 @@ ostream& ccBoundaryException::asciiOut(ostream& out) { cerr << low << "\t"; cerr << high << "\t"; - cerr << index << "\n"; + cerr << mindex << "\n"; return out; } diff --git a/cde/programs/dtinfo/DtMmdb/dti_cc/cc_exceptions.h b/cde/programs/dtinfo/DtMmdb/dti_cc/cc_exceptions.h index 2fffaa005..5a149185e 100644 --- a/cde/programs/dtinfo/DtMmdb/dti_cc/cc_exceptions.h +++ b/cde/programs/dtinfo/DtMmdb/dti_cc/cc_exceptions.h @@ -25,7 +25,9 @@ #ifndef _cc_exception_h #define _cc_exception_h 1 -#include +#include +#include +using namespace std; #include "Exceptions.hh" #define END_TRY end_try @@ -36,15 +38,9 @@ extern int errno; #endif -#if defined(linux) -#define CASTCCEXCEPT (ccException*) -#define CASTCCSEXCEPT (ccStringException*) -#define CASTCCBEXCEPT (ccBoundaryException*) -#else #define CASTCCEXCEPT #define CASTCCSEXCEPT #define CASTCCBEXCEPT -#endif class ccException : public Exception { @@ -69,7 +65,7 @@ protected: public: DECLARE_EXCEPTION(ccStringException, ccException); - ccStringException(char* m) : msg(m) {}; + ccStringException(char const* m) : msg((char*)m) {}; ~ccStringException() {}; virtual ostream& asciiOut(ostream&); @@ -81,13 +77,13 @@ class ccBoundaryException : public ccException protected: int low; int high; - int index; + int mindex; public: DECLARE_EXCEPTION(ccBoundaryException, ccException); ccBoundaryException(int l, int h, int i) : - low(l), high(h), index(i) {}; + low(l), high(h), mindex(i) {}; ~ccBoundaryException() {}; virtual ostream& asciiOut(ostream&); diff --git a/cde/programs/dtinfo/DtMmdb/dti_cc/cc_hdict.C b/cde/programs/dtinfo/DtMmdb/dti_cc/cc_hdict.C index 020959b59..98ab4498f 100644 --- a/cde/programs/dtinfo/DtMmdb/dti_cc/cc_hdict.C +++ b/cde/programs/dtinfo/DtMmdb/dti_cc/cc_hdict.C @@ -1,30 +1,8 @@ -/* - * CDE - Common Desktop Environment - * - * Copyright (c) 1993-2012, The Open Group. All rights reserved. - * - * These libraries and programs are free software; you can - * redistribute them and/or modify them under the terms of the GNU - * Lesser General Public License as published by the Free Software - * Foundation; either version 2 of the License, or (at your option) - * any later version. - * - * These libraries and programs are distributed in the hope that - * they will be useful, but WITHOUT ANY WARRANTY; without even the - * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR - * PURPOSE. See the GNU Lesser General Public License for more - * details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with these librararies and programs; if not, write - * to the Free Software Foundation, Inc., 51 Franklin Street, Fifth - * Floor, Boston, MA 02110-1301 USA - */ // $TOG: cc_hdict.C /main/5 1998/04/17 11:45:00 mgreess $ #include "dti_cc/cc_exceptions.h" -#if !defined(__osf__) && !defined(linux) +#if !defined(__osf__) template CC_Boolean kv_pair::f_needRemove = FALSE; #endif diff --git a/cde/programs/dtinfo/DtMmdb/dti_cc/cc_hdict.h b/cde/programs/dtinfo/DtMmdb/dti_cc/cc_hdict.h index 1f0f4d944..0254f9e4c 100644 --- a/cde/programs/dtinfo/DtMmdb/dti_cc/cc_hdict.h +++ b/cde/programs/dtinfo/DtMmdb/dti_cc/cc_hdict.h @@ -29,7 +29,8 @@ #include "dti_cc/cc_pvect.h" #include "dti_cc/CC_Slist.h" -#include +#include +using namespace std; template class kv_pair { diff --git a/cde/programs/dtinfo/DtMmdb/dti_cc/cc_povec.h b/cde/programs/dtinfo/DtMmdb/dti_cc/cc_povec.h index d33d59c07..c70da6f77 100644 --- a/cde/programs/dtinfo/DtMmdb/dti_cc/cc_povec.h +++ b/cde/programs/dtinfo/DtMmdb/dti_cc/cc_povec.h @@ -26,6 +26,7 @@ #define _cc_dlist_array_h #include "dti_cc/CC_Dlist.h" +#include "dti_cc/cc_exceptions.h" template class dlist_array : public CC_TPtrDlist @@ -46,6 +47,21 @@ public: T* first() ; */ + T* at(size_t pos) const /* throw boundaryException + * if list size is smaller than pos + */ + { + // Hack to get it passed to iter + CC_TPtrSlistIterator iter( *(CC_TPtrSlist *)this ); + for ( int i = 0; i <=pos; i++ ) { + if ( !(++iter) ) { + throw(CASTCCBEXCEPT ccBoundaryException(0,0,i)); + } + } + + return( iter.key() ); + } + T* operator()(size_t i) const { return at(i); }; T* operator[](size_t i) const { return at(i); }; }; diff --git a/cde/programs/dtinfo/DtMmdb/dti_cc/cc_pvect.C b/cde/programs/dtinfo/DtMmdb/dti_cc/cc_pvect.C index ac1288e68..473325716 100644 --- a/cde/programs/dtinfo/DtMmdb/dti_cc/cc_pvect.C +++ b/cde/programs/dtinfo/DtMmdb/dti_cc/cc_pvect.C @@ -50,7 +50,7 @@ pointer_vector::~pointer_vector() } template -T* pointer_vector::operator[](size_t i) const +T* pointer_vector::operator[](ptrdiff_t i) const { if ( i<0 || i>= f_size ) throw(CASTCCBEXCEPT ccBoundaryException(0, f_size-1, i)); @@ -59,7 +59,7 @@ T* pointer_vector::operator[](size_t i) const } template -T*& pointer_vector::operator[](size_t i) +T*& pointer_vector::operator[](ptrdiff_t i) { if ( i<0 || i>= f_size ) throw(CASTCCBEXCEPT ccBoundaryException(0, f_size-1, i)); diff --git a/cde/programs/dtinfo/DtMmdb/dti_cc/cc_pvect.h b/cde/programs/dtinfo/DtMmdb/dti_cc/cc_pvect.h index de9255e7b..e702b60c8 100644 --- a/cde/programs/dtinfo/DtMmdb/dti_cc/cc_pvect.h +++ b/cde/programs/dtinfo/DtMmdb/dti_cc/cc_pvect.h @@ -25,6 +25,7 @@ #ifndef _cc_pvector_h #define _cc_pvector_h 1 +#include #include "dti_cc/types.h" template @@ -45,8 +46,8 @@ public: pointer_vector(size_t, T* = 0); ~pointer_vector(); - T* operator[](size_t) const; - T*& operator[](size_t); + T* operator[](ptrdiff_t) const; + T*& operator[](ptrdiff_t); // size_t entries() const { return f_items; }; size_t length() const { return f_size; }; diff --git a/cde/programs/dtinfo/DtMmdb/dti_excs/Destructable_il.hh b/cde/programs/dtinfo/DtMmdb/dti_excs/Destructable_il.hh index 45299f5a6..1d5497a19 100644 --- a/cde/programs/dtinfo/DtMmdb/dti_excs/Destructable_il.hh +++ b/cde/programs/dtinfo/DtMmdb/dti_excs/Destructable_il.hh @@ -80,7 +80,7 @@ Destructable::~Destructable() inline void Destructable::destruct() { -#if defined(linux) +#if defined(linux) || defined(CSRG_BASED) delete this; #else // Have to call this here since some compilers don't allow diff --git a/cde/programs/dtinfo/DtMmdb/dti_excs/Exception.hh b/cde/programs/dtinfo/DtMmdb/dti_excs/Exception.hh index 6adffafcf..9fbc7cfef 100644 --- a/cde/programs/dtinfo/DtMmdb/dti_excs/Exception.hh +++ b/cde/programs/dtinfo/DtMmdb/dti_excs/Exception.hh @@ -1,13 +1,9 @@ -// $TOG: Exception.hh /main/11 1998/04/20 09:55:15 mgreess $ + #include #define G_TEMP_SPACE_SIZE 1024 -#if defined(linux) -#define CASTEXCEPT (Exception*) -#else #define CASTEXCEPT -#endif class Exception : public Destructable { @@ -158,7 +154,7 @@ private: { Exception *temp; \ if (in_stack()) { \ temp = new (0) NAME (*this); \ - (Exception *) (((NAME *)temp)->f_temporary = 1); \ + ((NAME *)temp)->f_temporary = 1; \ } else \ temp = this; \ temp->do_throw (line, file, dbg); } \ diff --git a/cde/programs/dtinfo/DtMmdb/dti_excs/Exceptions.C b/cde/programs/dtinfo/DtMmdb/dti_excs/Exceptions.C index 4ac43740d..79b241030 100644 --- a/cde/programs/dtinfo/DtMmdb/dti_excs/Exceptions.C +++ b/cde/programs/dtinfo/DtMmdb/dti_excs/Exceptions.C @@ -43,42 +43,47 @@ char* Exceptions::f_msg_out_of_exception_memory = 0; char* Exceptions::f_msg_out_of_obj_stack_memory = 0; char* Exceptions::f_msg_memory_already_freed = 0; #else -char *Exceptions::f_msg_internal_error = "Internal exceptions error:"; -char *Exceptions::f_msg_application_error = "Application exceptions error:"; -char *Exceptions::f_msg_throw_message = "Application threw exception:"; +char *Exceptions::f_msg_internal_error = + (char*)"Internal exceptions error:"; + +char *Exceptions::f_msg_application_error = + (char*)"Application exceptions error:"; + +char *Exceptions::f_msg_throw_message = + (char*)"Application threw exception:"; char *Exceptions::f_msg_not_initialized = - "Exceptions library not initialized with INIT_EXCEPTIONS()."; + (char*)"Exceptions library not initialized with INIT_EXCEPTIONS()."; char *Exceptions::f_msg_initialized_twice = - "Attept to call INIT_EXCEPTIONS() more than once."; + (char*)"Attept to call INIT_EXCEPTIONS() more than once."; char *Exceptions::f_msg_not_caught = - "Exception not caught."; + (char*)"Exception not caught."; char *Exceptions::f_msg_no_current_exception = - "There is no current exception (for catch or rethrow)."; + (char*)"There is no current exception (for catch or rethrow)."; char *Exceptions::f_msg_throw_from_terminate = - "Exceptions may not be thrown from terminate."; + (char*)"Exceptions may not be thrown from terminate."; char *Exceptions::f_msg_throw_from_error_handler = - "Exceptions may not be thrown from error handler."; + (char*)"Exceptions may not be thrown from error handler."; char *Exceptions::f_msg_throw_from_destructor = - "Exited destructor with throw while handling an exception."; + (char*)"Exited destructor with throw while handling an exception."; char *Exceptions::f_msg_throw_ptr_to_stack = - "Threw a pointer to an automatic (stack-based) exceptions object."; + (char*)"Threw a pointer to an automatic (stack-based) exceptions object."; char *Exceptions::f_msg_out_of_exception_memory = - "Not enough memory to allocate an exception object."; + (char*)"Not enough memory to allocate an exception object."; char *Exceptions::f_msg_out_of_obj_stack_memory = - "Not enough memory to allocate object stack."; + (char*)"Not enough memory to allocate object stack."; char *Exceptions::f_msg_memory_already_freed = - "Tried to alloc or realloc pool memory that was previously freed."; + (char*)"Tried to alloc or realloc pool memory that was previously freed."; #endif @@ -183,7 +188,7 @@ Exceptions::error (const char *message, error_type_t error_type) // Call user print function if set, otherwise just dump lines. if (g_error_handler != NULL) { - try + mtry { // Reset global variable to NULL before calling to prevent // the possibility of recursive calls. @@ -191,7 +196,7 @@ Exceptions::error (const char *message, error_type_t error_type) (*current) ((const char**)lines, count); set_error_handler (current); } - catch_any() + mcatch_any() { // Error handler will be NULL at this point. Exceptions::error (Exceptions::f_msg_throw_from_error_handler, diff --git a/cde/programs/dtinfo/DtMmdb/dti_excs/Exceptions.hh b/cde/programs/dtinfo/DtMmdb/dti_excs/Exceptions.hh index 754b3427e..e0e08f35b 100644 --- a/cde/programs/dtinfo/DtMmdb/dti_excs/Exceptions.hh +++ b/cde/programs/dtinfo/DtMmdb/dti_excs/Exceptions.hh @@ -4,14 +4,27 @@ #define _Exceptions_hh_active +#ifndef C_API #ifndef NATIVE_EXCEPTIONS +#define NATIVE_EXCEPTIONS +#endif +#define Exception mException +#endif +#ifndef NATIVE_EXCEPTIONS extern "C" { #include #include #include } +#else +extern "C" { +#include +#include +} +#endif +#ifndef NATIVE_EXCEPTIONS #ifdef EXC_DEBUG #define PRINTF(MSG) printf MSG #ifndef DEBUG @@ -45,12 +58,14 @@ extern "C" { #define INIT_EXCEPTIONS() -#define throw(OBJ) throw OBJ +#define mthrow(OBJ) throw OBJ #define rethrow throw -#define catch_any() catch(...) -#define catch_noarg(OBJ) catch(OBJ) -#define catch(TYPE,OBJ) catch(TYPE OBJ) +#define mtry try + +#define mcatch_any() catch(...) +#define mcatch_noarg(OBJ) catch(OBJ) +#define mcatch(TYPE,OBJ) catch(TYPE OBJ) #define end_try @@ -64,7 +79,7 @@ extern "C" { // TRY MACRO -#define try \ +#define mtry \ { \ Jump_Environment __jump_env; \ if (setjmp (__jump_env.f_env) == 0) { @@ -81,10 +96,10 @@ extern "C" { // This works if OBJ is an object or a pointer since Exception objects // overload operator ->. #if !defined(hpux) && !defined(USL) -#define throw(OBJ) \ +#define mthrow(OBJ) \ (OBJ)->throw_it (__LINE__, __FILE__, DEBUG_THROW_FLAG) #else -#define throw(OBJ) \ +#define mthrow(OBJ) \ OBJ->throw_it (__LINE__, __FILE__, DEBUG_THROW_FLAG) #endif @@ -105,16 +120,16 @@ extern "C" { #define PRINT_CATCH #endif -#define catch_any() \ +#define mcatch_any() \ } else if (1) { \ PRINT_CATCH -#define catch_noarg(OBJ) \ +#define mcatch_noarg(OBJ) \ } else if (Exception::current_exception().isa (STRINGIFY(OBJ))) { \ PRINT_CATCH -#define catch(TYPE,OBJ) \ - catch_noarg (TYPE) \ +#define mcatch(TYPE,OBJ) \ + mcatch_noarg (TYPE) \ TYPE OBJ = (TYPE) Exception::current_exception(); #define end_try \ diff --git a/cde/programs/dtinfo/DtMmdb/dti_excs/Imakefile b/cde/programs/dtinfo/DtMmdb/dti_excs/Imakefile index b28fbd147..c13a8dc4c 100644 --- a/cde/programs/dtinfo/DtMmdb/dti_excs/Imakefile +++ b/cde/programs/dtinfo/DtMmdb/dti_excs/Imakefile @@ -23,7 +23,7 @@ XCOMM .../programs/dtinfo/mmdb//Imakefile #define LargePICTable YES #define CplusplusSource YES -DEPEND_DEFINES = $(CXXDEPENDINCLUDES) +DEPEND_DEFINES = $(CXXDEPENDINCLUDES) $(DEPENDDEFINES) #if defined(SunArchitecture) && CplusplusCompilerMajorVersion > 3 EXCEPTION_DEFINES = -DHAS_TERMINATE diff --git a/cde/programs/dtinfo/DtMmdb/dti_excs/init.C b/cde/programs/dtinfo/DtMmdb/dti_excs/init.C index cceb8f12e..b732feda0 100644 --- a/cde/programs/dtinfo/DtMmdb/dti_excs/init.C +++ b/cde/programs/dtinfo/DtMmdb/dti_excs/init.C @@ -30,42 +30,42 @@ void initialize_exception() { -Exceptions::f_msg_internal_error = "Internal exceptions error:"; -Exceptions::f_msg_application_error = "Application exceptions error:"; -Exceptions::f_msg_throw_message = "Application threw exception:"; +Exceptions::f_msg_internal_error = (char*)"Internal exceptions error:"; +Exceptions::f_msg_application_error = (char*)"Application exceptions error:"; +Exceptions::f_msg_throw_message = (char*)"Application threw exception:"; Exceptions::f_msg_not_initialized = - "Exceptions library not initialized with INIT_EXCEPTIONS()."; + (char*)"Exceptions library not initialized with INIT_EXCEPTIONS()."; Exceptions::f_msg_initialized_twice = - "Attept to call INIT_EXCEPTIONS() more than once."; + (char*)"Attept to call INIT_EXCEPTIONS() more than once."; Exceptions::f_msg_not_caught = - "Exception not caught."; + (char*)"Exception not caught."; Exceptions::f_msg_no_current_exception = - "There is no current exception (for catch or rethrow)."; + (char*)"There is no current exception (for catch or rethrow)."; Exceptions::f_msg_throw_from_terminate = - "Exceptions may not be thrown from terminate."; + (char*)"Exceptions may not be thrown from terminate."; Exceptions::f_msg_throw_from_error_handler = - "Exceptions may not be thrown from error handler."; + (char*)"Exceptions may not be thrown from error handler."; Exceptions::f_msg_throw_from_destructor = - "Exited destructor with throw while handling an exception."; + (char*)"Exited destructor with throw while handling an exception."; Exceptions::f_msg_throw_ptr_to_stack = - "Threw a pointer to an automatic (stack-based) exceptions object."; + (char*)"Threw a pointer to an automatic (stack-based) exceptions object."; Exceptions::f_msg_out_of_exception_memory = - "Not enough memory to allocate an exception object."; + (char*)"Not enough memory to allocate an exception object."; Exceptions::f_msg_out_of_obj_stack_memory = - "Not enough memory to allocate object stack."; + (char*)"Not enough memory to allocate object stack."; Exceptions::f_msg_memory_already_freed = - "Tried to alloc or realloc pool memory that was previously freed."; + (char*)"Tried to alloc or realloc pool memory that was previously freed."; Unwind_Stack::g_stack = new Unwind_Record[UNWIND_STACK_SIZE]; Exception::g_temp_space = new char[G_TEMP_SPACE_SIZE]; diff --git a/cde/programs/dtinfo/DtMmdb/dti_excs/new_delete_simple.h b/cde/programs/dtinfo/DtMmdb/dti_excs/new_delete_simple.h index eacd2b594..036869a86 100644 --- a/cde/programs/dtinfo/DtMmdb/dti_excs/new_delete_simple.h +++ b/cde/programs/dtinfo/DtMmdb/dti_excs/new_delete_simple.h @@ -54,7 +54,8 @@ void class_name::operator delete( void* p )\ #else -#include +#include +using namespace std; #endif diff --git a/cde/programs/dtinfo/DtMmdb/dti_excs/terminate.C b/cde/programs/dtinfo/DtMmdb/dti_excs/terminate.C index 8d30ebb5a..90d4b8eed 100644 --- a/cde/programs/dtinfo/DtMmdb/dti_excs/terminate.C +++ b/cde/programs/dtinfo/DtMmdb/dti_excs/terminate.C @@ -48,11 +48,11 @@ terminate() // abuse in the terminate handler. PFV handler = _terminate_handler; _terminate_handler = NULL; - try + mtry { (*handler)(); } - catch_any() + mcatch_any() { Exceptions::error (Exceptions::f_msg_throw_from_terminate, Exceptions::APPLICATION_ERROR); diff --git a/cde/programs/dtinfo/DtMmdb/dynhash/Imakefile b/cde/programs/dtinfo/DtMmdb/dynhash/Imakefile index 0c25071b8..ebcc961ac 100644 --- a/cde/programs/dtinfo/DtMmdb/dynhash/Imakefile +++ b/cde/programs/dtinfo/DtMmdb/dynhash/Imakefile @@ -23,7 +23,7 @@ XCOMM .../programs/dtinfo/mmdb//Imakefile #define LargePICTable YES #define CplusplusSource YES -DEPEND_DEFINES = $(CXXDEPENDINCLUDES) +DEPEND_DEFINES = $(CXXDEPENDINCLUDES) $(DEPENDDEFINES) XCOMM In DtMmdb we compile as C_API sources. DEFINES = -DC_API diff --git a/cde/programs/dtinfo/DtMmdb/dynhash/bsearch.C b/cde/programs/dtinfo/DtMmdb/dynhash/bsearch.C index 3050585c3..59d135f8c 100644 --- a/cde/programs/dtinfo/DtMmdb/dynhash/bsearch.C +++ b/cde/programs/dtinfo/DtMmdb/dynhash/bsearch.C @@ -44,7 +44,8 @@ #include #include -#include +#include +using namespace std; #include #include "dynhash/bucket.h" diff --git a/cde/programs/dtinfo/DtMmdb/dynhash/data_t.C b/cde/programs/dtinfo/DtMmdb/dynhash/data_t.C index 33695a3ec..99a896db7 100644 --- a/cde/programs/dtinfo/DtMmdb/dynhash/data_t.C +++ b/cde/programs/dtinfo/DtMmdb/dynhash/data_t.C @@ -59,7 +59,7 @@ atoi_larson* data_t::larson_convertor_ptr; atoi_pearson* data_t::pearson_convertor_ptr; #else atoi_larson data_t::larson_convertor; -atoi_pearson data_t::pearson_convertor(MAXSHORT, 256); +atoi_pearson data_t::pearson_convertor(SHRT_MAX, 256); #endif data_t::data_t(data_t& d) @@ -214,7 +214,7 @@ istream& operator >>(istream& i, data_t& d) delete d.key.str_key; d.flag = (data_t::flag_type)atoi(buf); - d.dt = voidPtr(atoi(voidPtr_ptr)); + d.dt = (voidPtr)(size_t)atoi(voidPtr_ptr); if ( d.flag == data_t::INT ) d.key.int_key = atoi(key_ptr); diff --git a/cde/programs/dtinfo/DtMmdb/dynhash/imp_die.C b/cde/programs/dtinfo/DtMmdb/dynhash/imp_die.C index bf01029a9..04fb17837 100644 --- a/cde/programs/dtinfo/DtMmdb/dynhash/imp_die.C +++ b/cde/programs/dtinfo/DtMmdb/dynhash/imp_die.C @@ -53,7 +53,8 @@ #ifdef C_API #include "utility/c_iostream.h" #else -#include +#include +using namespace std; #endif int steps[] = { 2, 3, 5, 7, 11, 13, 17, 21, 23, 29, 31, 37, 41, 43, 47, 51 }; @@ -129,7 +130,8 @@ void imp_die::alloc_table(int new_H) void imp_die::init_table() { - for ( int i = 0; i < B; i++ ) { + int i; + for ( i = 0; i < B; i++ ) { bucket_array[i] = 0 ; } for ( i = 0; i < H; i++ ) { @@ -142,7 +144,8 @@ void imp_die::clean() n = 0; collect_all_keys(); - for ( int i=0; i/Imakefile #define LargePICTable YES #define CplusplusSource YES -DEPEND_DEFINES = $(CXXDEPENDINCLUDES) +DEPEND_DEFINES = $(CXXDEPENDINCLUDES) $(DEPENDDEFINES) XCOMM In DtMmdb we compile as C_API sources. DEFINES = -DC_API -DPORTABLE_DB diff --git a/cde/programs/dtinfo/DtMmdb/hmphf/buckets.C b/cde/programs/dtinfo/DtMmdb/hmphf/buckets.C index d174aeec6..f67eb6b6b 100644 --- a/cde/programs/dtinfo/DtMmdb/hmphf/buckets.C +++ b/cde/programs/dtinfo/DtMmdb/hmphf/buckets.C @@ -140,7 +140,8 @@ h_convertor(pms.v_n, 128, rnd) { v_bucket_array = new bucketPtr[v_no_buckets]; - for ( int i=0; i= 0 ) ? 0 : -1; } -verify(buckets& bs, mphf_hash_table& ht, params& pms) +int verify(buckets& bs, mphf_hash_table& ht, params& pms) { int i; int_pattern new_pattern(bs.max_bucket_sz()); @@ -246,7 +246,7 @@ int write_spec(buckets& bs, params& pms, buffer& mphf_buffer) mphf_buffer.put((char*)c_array, g_array_bytes); mphf_buffer.put('\n'); */ - ostrstream fout(mphf_buffer.get_base(), mphf_buffer.buf_sz(), ios::out); + ostringstream fout(mphf_buffer.get_base(), ios::out); fout << pms.v_n << "\n"; fout << pms.v_b << "\n"; @@ -267,6 +267,7 @@ int write_spec(buckets& bs, params& pms, buffer& mphf_buffer) mphf_buffer.set_content_sz(spec_bytes); + memcpy(mphf_buffer.get_base(), fout.str().c_str(), spec_bytes); delete c_array; diff --git a/cde/programs/dtinfo/DtMmdb/hmphf/mphf_funcs.h b/cde/programs/dtinfo/DtMmdb/hmphf/mphf_funcs.h index ef04185cd..6c0962b62 100644 --- a/cde/programs/dtinfo/DtMmdb/hmphf/mphf_funcs.h +++ b/cde/programs/dtinfo/DtMmdb/hmphf/mphf_funcs.h @@ -53,9 +53,9 @@ #define _mphf_funcs_h 1 #ifdef C_API -#include "utility/c_strstream.h" +#include "utility/c_stringstream.h" #else -#include +#include #endif #include "utility/funcs.h" diff --git a/cde/programs/dtinfo/DtMmdb/hmphf/mphf_hash_table.C b/cde/programs/dtinfo/DtMmdb/hmphf/mphf_hash_table.C index fc7c30876..b9c923c2f 100644 --- a/cde/programs/dtinfo/DtMmdb/hmphf/mphf_hash_table.C +++ b/cde/programs/dtinfo/DtMmdb/hmphf/mphf_hash_table.C @@ -152,10 +152,10 @@ int mphf_hash_table::fit_hash_table(int_pattern& pat) { int i, j; for ( i=0; i +#if defined(CSRG_BASED) +#define MAXINT INT_MAX +#else #include +#endif #include "utility/funcs.h" class params diff --git a/cde/programs/dtinfo/DtMmdb/hmphf/sorter.C b/cde/programs/dtinfo/DtMmdb/hmphf/sorter.C index 230f9a8c4..532a5f946 100644 --- a/cde/programs/dtinfo/DtMmdb/hmphf/sorter.C +++ b/cde/programs/dtinfo/DtMmdb/hmphf/sorter.C @@ -78,7 +78,8 @@ void sorter::_init(istream& in) { v_bucket_array = new bucketPtr[NUM_BUCKETS]; - for ( int i=0; i v_no_keys; } diff --git a/cde/programs/dtinfo/DtMmdb/hmphf/sorter.h b/cde/programs/dtinfo/DtMmdb/hmphf/sorter.h index 5e65e36e4..2e1c50d76 100644 --- a/cde/programs/dtinfo/DtMmdb/hmphf/sorter.h +++ b/cde/programs/dtinfo/DtMmdb/hmphf/sorter.h @@ -53,7 +53,12 @@ #ifndef _sorter_h #define _sorter_h 1 +#include +#if defined(CSRG_BASED) +#define MAXINT INT_MAX +#else #include +#endif #include "utility/funcs.h" #include "utility/atoi_fast.h" #include "hmphf/buckets.h" diff --git a/cde/programs/dtinfo/DtMmdb/index/Imakefile b/cde/programs/dtinfo/DtMmdb/index/Imakefile index cb37a9b62..e82b53f3c 100644 --- a/cde/programs/dtinfo/DtMmdb/index/Imakefile +++ b/cde/programs/dtinfo/DtMmdb/index/Imakefile @@ -23,7 +23,7 @@ XCOMM .../programs/dtinfo/mmdb//Imakefile #define LargePICTable YES #define CplusplusSource YES -DEPEND_DEFINES = $(CXXDEPENDINCLUDES) +DEPEND_DEFINES = $(CXXDEPENDINCLUDES) $(DEPENDDEFINES) XCOMM In DtMmdb we compile as C_API sources. DEFINES = -DC_API -DPORTABLE_DB diff --git a/cde/programs/dtinfo/DtMmdb/index/btree_index.C b/cde/programs/dtinfo/DtMmdb/index/btree_index.C index 4ae5708d5..ea00337c7 100644 --- a/cde/programs/dtinfo/DtMmdb/index/btree_index.C +++ b/cde/programs/dtinfo/DtMmdb/index/btree_index.C @@ -76,7 +76,7 @@ btree_index::~btree_index() delete v_idx_agent_ptr; } -int btree_index::handler_to_inv_idx(const handler& query) +size_t btree_index::handler_to_inv_idx(const handler& query) { get_key_string(query); @@ -85,7 +85,7 @@ int btree_index::handler_to_inv_idx(const handler& query) if ( v_idx_agent_ptr -> member(k) == false ) throw(stringException("first_of_invlist(): key is not in btree")); - return int(k.dt); + return size_t(k.dt); } diff --git a/cde/programs/dtinfo/DtMmdb/index/btree_index.h b/cde/programs/dtinfo/DtMmdb/index/btree_index.h index 0475e38ed..bcf0549d1 100644 --- a/cde/programs/dtinfo/DtMmdb/index/btree_index.h +++ b/cde/programs/dtinfo/DtMmdb/index/btree_index.h @@ -65,7 +65,7 @@ public: //init run time data members Boolean init_data_member( inv_lists_handler*, const char* btree_store ); - int handler_to_inv_idx(const handler& query); + size_t handler_to_inv_idx(const handler& query); MMDB_SIGNATURES(btree_index); }; diff --git a/cde/programs/dtinfo/DtMmdb/index/dyn_disk_index.C b/cde/programs/dtinfo/DtMmdb/index/dyn_disk_index.C index 638b78336..8907f44be 100644 --- a/cde/programs/dtinfo/DtMmdb/index/dyn_disk_index.C +++ b/cde/programs/dtinfo/DtMmdb/index/dyn_disk_index.C @@ -72,7 +72,7 @@ dyn_disk_index::init_data_member(inv_lists_handler* y, abs_storage* store) return true; } -int dyn_disk_index::handler_to_inv_idx(const handler&) +size_t dyn_disk_index::handler_to_inv_idx(const handler&) { throw(stringException("handler_to_int() not implemented")); return 0; diff --git a/cde/programs/dtinfo/DtMmdb/index/dyn_disk_index.h b/cde/programs/dtinfo/DtMmdb/index/dyn_disk_index.h index 53f0e161c..13436a90b 100644 --- a/cde/programs/dtinfo/DtMmdb/index/dyn_disk_index.h +++ b/cde/programs/dtinfo/DtMmdb/index/dyn_disk_index.h @@ -65,7 +65,7 @@ public: //init run time data components Boolean init_data_member( inv_lists_handler*, abs_storage* ); - int handler_to_inv_idx(const handler&); + size_t handler_to_inv_idx(const handler&); MMDB_SIGNATURES(dyn_disk_index); }; diff --git a/cde/programs/dtinfo/DtMmdb/index/dyn_index.C b/cde/programs/dtinfo/DtMmdb/index/dyn_index.C index 7f9f54587..cc64dae5b 100644 --- a/cde/programs/dtinfo/DtMmdb/index/dyn_index.C +++ b/cde/programs/dtinfo/DtMmdb/index/dyn_index.C @@ -160,7 +160,7 @@ MESSAGE(cerr, "insert to list after"); (*v_inv_lists_hd) -> append_list(list); - intKey.dt = voidPtr((*v_inv_lists_hd) -> count()); + intKey.dt = (voidPtr)(size_t)(*v_inv_lists_hd) -> count(); //debug(cerr, int(intKey.dt)); v_idx_agent_ptr -> insert( intKey ); diff --git a/cde/programs/dtinfo/DtMmdb/index/dyn_memory_index.C b/cde/programs/dtinfo/DtMmdb/index/dyn_memory_index.C index 344249682..b697e6f7f 100644 --- a/cde/programs/dtinfo/DtMmdb/index/dyn_memory_index.C +++ b/cde/programs/dtinfo/DtMmdb/index/dyn_memory_index.C @@ -93,7 +93,7 @@ dyn_memory_index::~dyn_memory_index() char buf[PATHSIZ]; for ( int i=0; i asciiOut(out); - v_static_key.set_size(out.pcount()); + v_static_key.set_size(out.str().size()); + strcpy(v_static_key.get(), out.str().c_str()); return true; } @@ -119,10 +120,11 @@ Boolean c_index::get_key_string(const oid_t& t) const { v_static_key.reset(); - ostrstream out(v_static_key.get(), v_static_key.alloc_size()); + ostringstream out(v_static_key.get()); t.asciiOut(out); - v_static_key.set_size(out.pcount()); + v_static_key.set_size(out.str().size()); + strcpy(v_static_key.get(), out.str().c_str()); return true; } diff --git a/cde/programs/dtinfo/DtMmdb/index/index.h b/cde/programs/dtinfo/DtMmdb/index/index.h index acc58492a..c6784aa80 100644 --- a/cde/programs/dtinfo/DtMmdb/index/index.h +++ b/cde/programs/dtinfo/DtMmdb/index/index.h @@ -52,9 +52,9 @@ #define _index_h 1 #ifdef C_API -#include "utility/c_strstream.h" +#include "utility/c_stringstream.h" #else -#include +#include #endif #include "object/oid_list.h" @@ -100,7 +100,7 @@ public: virtual int invlist_length(handler&) = 0; // translate a query to an index of an inv_list - virtual int handler_to_inv_idx(const handler& query) = 0; + virtual size_t handler_to_inv_idx(const handler& query) = 0; // status inquiry functions int bound_to() const { return v_cmp_selector; } ; diff --git a/cde/programs/dtinfo/DtMmdb/index/inv_lists.C b/cde/programs/dtinfo/DtMmdb/index/inv_lists.C index 1db0b31ca..f95552e9b 100644 --- a/cde/programs/dtinfo/DtMmdb/index/inv_lists.C +++ b/cde/programs/dtinfo/DtMmdb/index/inv_lists.C @@ -151,7 +151,7 @@ MESSAGE(cerr, "inv::insert"); debug(cerr, index); */ - if ( INRANGE(list_id.ccode(), 0, 1) && + if ( INRANGE((short)list_id.ccode(), 0, 1) && id.ccode() != OID_LIST_CODE ) { diff --git a/cde/programs/dtinfo/DtMmdb/index/mphf_index.C b/cde/programs/dtinfo/DtMmdb/index/mphf_index.C index 033cd0dd5..e4947801f 100644 --- a/cde/programs/dtinfo/DtMmdb/index/mphf_index.C +++ b/cde/programs/dtinfo/DtMmdb/index/mphf_index.C @@ -193,7 +193,7 @@ oid_list_handler* mphf_index::get_loc_list(const oid_t& ) return 0; } -int mphf_index::handler_to_inv_idx(const handler& t) +size_t mphf_index::handler_to_inv_idx(const handler& t) { get_key_string(t); //debug(cerr, v_static_key); @@ -224,7 +224,7 @@ Boolean mphf_index::batch_index_begin() { /* MESSAGE(cerr, "batch_index_begin()"); -debug(cerr, cmp_selector); +debug(cerr, v_cmp_selector); debug(cerr, count()); debug(cerr, int(this)); */ diff --git a/cde/programs/dtinfo/DtMmdb/index/mphf_index.h b/cde/programs/dtinfo/DtMmdb/index/mphf_index.h index 3f47dfb0d..b8301c807 100644 --- a/cde/programs/dtinfo/DtMmdb/index/mphf_index.h +++ b/cde/programs/dtinfo/DtMmdb/index/mphf_index.h @@ -97,7 +97,7 @@ public: virtual oid_t first_of_invlist(const handler&); // - int handler_to_inv_idx(const handler& query); + size_t handler_to_inv_idx(const handler& query); // status inquiry functions virtual Boolean sorted() const { return false; }; diff --git a/cde/programs/dtinfo/DtMmdb/mgrs/Imakefile b/cde/programs/dtinfo/DtMmdb/mgrs/Imakefile index 6a1bd448e..2de957684 100644 --- a/cde/programs/dtinfo/DtMmdb/mgrs/Imakefile +++ b/cde/programs/dtinfo/DtMmdb/mgrs/Imakefile @@ -23,7 +23,7 @@ XCOMM .../programs/dtinfo/mmdb//Imakefile #define LargePICTable YES #define CplusplusSource YES -DEPEND_DEFINES = $(CXXDEPENDINCLUDES) +DEPEND_DEFINES = $(CXXDEPENDINCLUDES) $(DEPENDDEFINES) XCOMM In DtMmdb we compile as C_API sources. DEFINES = -DC_API -DCOMPACTED_DISK_REP -DPORTABLE_DB diff --git a/cde/programs/dtinfo/DtMmdb/mgrs/template_mgr.C b/cde/programs/dtinfo/DtMmdb/mgrs/template_mgr.C index 9bc0f52a7..2db64369c 100644 --- a/cde/programs/dtinfo/DtMmdb/mgrs/template_mgr.C +++ b/cde/programs/dtinfo/DtMmdb/mgrs/template_mgr.C @@ -217,7 +217,7 @@ template_mgr_t::init_obj(abs_storage* store, mmdb_pos_t pos, root*& x) char* dbg_char_ptr; int dbg_int; store->get_str_ptr(pos, dbg_char_ptr, dbg_int); - fprintf(stderr, "init_obj ptr=0x%lx len=%d\n", dbg_char_ptr, dbg_int); + fprintf(stderr, "init_obj ptr=0x%lx len=%d\n", (long)dbg_char_ptr,dbg_int); } #endif @@ -508,7 +508,8 @@ debug(cerr, CLASS_CODE_BYTES); char* dbg_char_ptr; int dbg_int; store->get_str_ptr(pinfo.position, dbg_char_ptr, dbg_int); - fprintf(stderr, "create_obj ptr=0x%lx len=%d\n", dbg_char_ptr, dbg_int); + fprintf(stderr, "create_obj ptr=0x%lx len=%d\n", + (long)dbg_char_ptr, dbg_int); } #endif #endif diff --git a/cde/programs/dtinfo/DtMmdb/misc/unique_id.c b/cde/programs/dtinfo/DtMmdb/misc/unique_id.c index 4f3b2ccb0..881aac50c 100644 --- a/cde/programs/dtinfo/DtMmdb/misc/unique_id.c +++ b/cde/programs/dtinfo/DtMmdb/misc/unique_id.c @@ -53,6 +53,7 @@ #include #include #include +#include #ifdef SVR4 #include @@ -159,8 +160,8 @@ unique_id (void) hostid = gethostid(); #ifdef DEBUG - PRINT_BITS (cur_time.tv_usec); - PRINT_BITS (cur_time.tv_sec); + PRINT_BITS ((unsigned int)cur_time.tv_usec); + PRINT_BITS ((unsigned int)cur_time.tv_sec); PRINT_BITS (pid); PRINT_BITS (hostid); #endif diff --git a/cde/programs/dtinfo/DtMmdb/object/Imakefile b/cde/programs/dtinfo/DtMmdb/object/Imakefile index ceae7d65e..b98197568 100644 --- a/cde/programs/dtinfo/DtMmdb/object/Imakefile +++ b/cde/programs/dtinfo/DtMmdb/object/Imakefile @@ -23,7 +23,7 @@ XCOMM .../programs/dtinfo/mmdb//Imakefile #define LargePICTable YES #define CplusplusSource YES -DEPEND_DEFINES = $(CXXDEPENDINCLUDES) +DEPEND_DEFINES = $(CXXDEPENDINCLUDES) $(DEPENDDEFINES) XCOMM In DtMmdb we compile as C_API sources. DEFINES = -DC_API -DPORTABLE_DB diff --git a/cde/programs/dtinfo/DtMmdb/object/convert.C b/cde/programs/dtinfo/DtMmdb/object/convert.C index e41712adb..fa2b8bb05 100644 --- a/cde/programs/dtinfo/DtMmdb/object/convert.C +++ b/cde/programs/dtinfo/DtMmdb/object/convert.C @@ -22,7 +22,8 @@ */ // $XConsortium: convert.cc /main/3 1996/06/11 17:23:53 cde-hal $ -#include +#include +using namespace std; /*****************************************/ //Note: convert node.dat file to new format diff --git a/cde/programs/dtinfo/DtMmdb/object/cset.C b/cde/programs/dtinfo/DtMmdb/object/cset.C index 23154bc71..b14008c51 100644 --- a/cde/programs/dtinfo/DtMmdb/object/cset.C +++ b/cde/programs/dtinfo/DtMmdb/object/cset.C @@ -168,14 +168,14 @@ io_status cset::asciiIn(istream& in) io_status cset::batch_asciiIn(istream& in) { handler* root_hd_ptr = 0; - +/* #ifdef DEBUG xtime tmr; float f1; long f2; tmr.start(); #endif - +*/ char ccode_buf[LBUFSIZ]; int c; //fprintf(stderr, "batch_asciiIn() : start looping \n"); diff --git a/cde/programs/dtinfo/DtMmdb/object/new_delete.h b/cde/programs/dtinfo/DtMmdb/object/new_delete.h index 26372bd18..e8924139f 100644 --- a/cde/programs/dtinfo/DtMmdb/object/new_delete.h +++ b/cde/programs/dtinfo/DtMmdb/object/new_delete.h @@ -56,7 +56,8 @@ #ifdef C_API #include #else -#include +#include +using namespace std; #endif #define NEW_AND_DELETE_BODIES(class_name) \ diff --git a/cde/programs/dtinfo/DtMmdb/object/oid_t.C b/cde/programs/dtinfo/DtMmdb/object/oid_t.C index 61ad5574d..987909670 100644 --- a/cde/programs/dtinfo/DtMmdb/object/oid_t.C +++ b/cde/programs/dtinfo/DtMmdb/object/oid_t.C @@ -98,7 +98,7 @@ oid_t::oid_t(const char* source, Boolean ascii_format, Boolean swap_order) #endif } else { - istrstream in((char*)source); + istringstream in((char*)source); in >> v_c_code; diff --git a/cde/programs/dtinfo/DtMmdb/object/oid_t.h b/cde/programs/dtinfo/DtMmdb/object/oid_t.h index da87de5f0..0c1cc1470 100644 --- a/cde/programs/dtinfo/DtMmdb/object/oid_t.h +++ b/cde/programs/dtinfo/DtMmdb/object/oid_t.h @@ -52,9 +52,9 @@ #define _oid_t_h 1 #ifdef C_API -#include "utility/c_strstream.h" +#include "utility/c_stringstream.h" #else -#include +#include #endif #include "utility/funcs.h" @@ -83,7 +83,7 @@ public: // oid_t equal and less test Boolean eq(const oid_t&) const; Boolean ls(const oid_t&) const; - operator==(const oid_t& arg) const { return eq(arg); }; + bool operator==(const oid_t& arg) const { return eq(arg); }; // class code, oid type and instance code export functions const c_code_t ccode() const { return v_c_code; } ; diff --git a/cde/programs/dtinfo/DtMmdb/object/random_gen.C b/cde/programs/dtinfo/DtMmdb/object/random_gen.C index 019ab0522..bcaa39550 100644 --- a/cde/programs/dtinfo/DtMmdb/object/random_gen.C +++ b/cde/programs/dtinfo/DtMmdb/object/random_gen.C @@ -86,7 +86,8 @@ const char* random_gen::get_random_string(int low, int high) delete buf; buf = new char[buf_len+1]; } - for ( int i=0; i/Imakefile #define LargePICTable YES #define CplusplusSource YES -DEPEND_DEFINES = $(CXXDEPENDINCLUDES) +DEPEND_DEFINES = $(CXXDEPENDINCLUDES) $(DEPENDDEFINES) #ifdef DtinfoClient DEFINES= -DC_API -DNO_DB_LOCK -DCDE_NEXT diff --git a/cde/programs/dtinfo/DtMmdb/oliasdb/asciiIn_filters.C b/cde/programs/dtinfo/DtMmdb/oliasdb/asciiIn_filters.C index 7b7ed1ea2..146d0f481 100644 --- a/cde/programs/dtinfo/DtMmdb/oliasdb/asciiIn_filters.C +++ b/cde/programs/dtinfo/DtMmdb/oliasdb/asciiIn_filters.C @@ -62,7 +62,7 @@ char* get_oid(info_lib* infolib_ptr, char* base_str, char* locator_line) if ( strcmp(locator, " 0000000000000000000000") == 0 || strcmp(locator, "0") == 0 ) { - return "0.0"; + return (char*)"0.0"; } return get_oid_2(infolib_ptr, base_str, locator); @@ -75,9 +75,9 @@ char* get_oid_2(info_lib* infolib_ptr, char* base_str, char* locator) const char *this_node_locator = x.locator(); if ( strcmp( this_node_locator, locator) == 0 ) { - ostrstream strout(oid_in_string_buf, BUFSIZ, ios::out); + ostringstream strout(oid_in_string_buf, ios::out); x.its_oid().asciiOut(strout); - oid_in_string_buf[strout.pcount()] = NULL; + strcpy(oid_in_string_buf, strout.str().c_str()); } else { cerr << "dangling locator " << locator << "\n" << "mismatches with " << this_node_locator << "\n" diff --git a/cde/programs/dtinfo/DtMmdb/oliasdb/c_api_book.C b/cde/programs/dtinfo/DtMmdb/oliasdb/c_api_book.C index d29ee17c2..eaad18045 100644 --- a/cde/programs/dtinfo/DtMmdb/oliasdb/c_api_book.C +++ b/cde/programs/dtinfo/DtMmdb/oliasdb/c_api_book.C @@ -27,7 +27,7 @@ static doc_smart_ptr* getDocUsingPrOrSecOrSeq(DtMmdbInfoRequest* request) { - try { + mtry { info_base* x = getBookCase(request -> bookcase_descriptor); if ( x == 0 ) return 0; @@ -51,7 +51,7 @@ getDocUsingPrOrSecOrSeq(DtMmdbInfoRequest* request) return new doc_smart_ptr(x, seq+1); } - catch (mmdbException &,e) + mcatch (mmdbException &,e) { return 0; } end_try; @@ -61,7 +61,7 @@ getDocUsingPrOrSecOrSeq(DtMmdbInfoRequest* request) DtMmdbHandle* DtMmdbBookGetTocObjectId(DtMmdbInfoRequest* request) { - try { + mtry { doc_smart_ptr* x = getDocUsingPrOrSecOrSeq(request); if ( x == 0 ) return 0; @@ -71,7 +71,7 @@ DtMmdbBookGetTocObjectId(DtMmdbInfoRequest* request) return z; } - catch (mmdbException &,e) + mcatch (mmdbException &,e) { return 0; } end_try; @@ -81,7 +81,7 @@ DtMmdbBookGetTocObjectId(DtMmdbInfoRequest* request) const char* DtMmdbBookGetShortTitle(DtMmdbInfoRequest* request, unsigned int* length) { - try { + mtry { doc_smart_ptr* x = getDocUsingPrOrSecOrSeq(request); if ( x == 0 ) return 0; @@ -93,7 +93,7 @@ DtMmdbBookGetShortTitle(DtMmdbInfoRequest* request, unsigned int* length) return z; } - catch (mmdbException &,e) + mcatch (mmdbException &,e) { return 0; } end_try; @@ -103,7 +103,7 @@ DtMmdbBookGetShortTitle(DtMmdbInfoRequest* request, unsigned int* length) const char* DtMmdbBookGetLongTitle(DtMmdbInfoRequest* request, unsigned int* length) { - try { + mtry { doc_smart_ptr* x = getDocUsingPrOrSecOrSeq(request); if ( x == 0 ) return 0; @@ -115,7 +115,7 @@ DtMmdbBookGetLongTitle(DtMmdbInfoRequest* request, unsigned int* length) return z; } - catch (mmdbException &,e) + mcatch (mmdbException &,e) { return 0; } end_try; @@ -124,7 +124,7 @@ DtMmdbBookGetLongTitle(DtMmdbInfoRequest* request, unsigned int* length) int DtMmdbBookGetSeqNum(DtMmdbInfoRequest* request) { - try { + mtry { doc_smart_ptr* x = getDocUsingPrOrSecOrSeq(request); if ( x == 0 ) return 0; @@ -134,7 +134,7 @@ int DtMmdbBookGetSeqNum(DtMmdbInfoRequest* request) return z; } - catch (mmdbException &,e) + mcatch (mmdbException &,e) { return 0; } end_try; @@ -144,7 +144,7 @@ int DtMmdbBookGetSeqNum(DtMmdbInfoRequest* request) const char* DtMmdbBookGetSeqLIcense(DtMmdbInfoRequest* request, unsigned int* length) { - try { + mtry { doc_smart_ptr* x = getDocUsingPrOrSecOrSeq(request); if ( x == 0 ) return 0; @@ -156,7 +156,7 @@ DtMmdbBookGetSeqLIcense(DtMmdbInfoRequest* request, unsigned int* length) return z; } - catch (mmdbException &,e) + mcatch (mmdbException &,e) { return 0; } end_try; @@ -165,7 +165,7 @@ DtMmdbBookGetSeqLIcense(DtMmdbInfoRequest* request, unsigned int* length) DtMmdbHandle** DtMmdbBookGetTabList(DtMmdbInfoRequest* request, unsigned int* length) { - try { + mtry { doc_smart_ptr* x = getDocUsingPrOrSecOrSeq(request); if ( x == 0 ) return 0; @@ -182,7 +182,8 @@ DtMmdbHandle** DtMmdbBookGetTabList(DtMmdbInfoRequest* request, unsigned int* le const char* desc = 0; pstring_handler *p = 0; - for (int i=0; iget_component (i+1)); // The format is the title, a tab char, then the section oid. @@ -211,7 +212,7 @@ DtMmdbHandle** DtMmdbBookGetTabList(DtMmdbInfoRequest* request, unsigned int* le return u; } - catch (mmdbException &,e) + mcatch (mmdbException &,e) { return 0; } end_try; diff --git a/cde/programs/dtinfo/DtMmdb/oliasdb/c_api_bookcase.C b/cde/programs/dtinfo/DtMmdb/oliasdb/c_api_bookcase.C index 89a7748bf..60ff2ef91 100644 --- a/cde/programs/dtinfo/DtMmdb/oliasdb/c_api_bookcase.C +++ b/cde/programs/dtinfo/DtMmdb/oliasdb/c_api_bookcase.C @@ -35,7 +35,7 @@ extern OLIAS_DB* mmdb_ptr; int DtMmdbGetBookCaseByName(int infolib_descriptor, const char* name) { - try { + mtry { info_lib* x = mmdb_ptr -> getInfoLib(infolib_descriptor); if ( x == 0 ) return -1; @@ -48,7 +48,7 @@ DtMmdbGetBookCaseByName(int infolib_descriptor, const char* name) return base -> index_id(); } - catch (mmdbException &,e) + mcatch (mmdbException &,e) { return -1; } end_try; @@ -58,7 +58,7 @@ DtMmdbGetBookCaseByName(int infolib_descriptor, const char* name) int DtMmdbGetBookCaseByIndex(int infolib_descriptor, int index) { - try { + mtry { info_lib* x = mmdb_ptr -> getInfoLib(infolib_descriptor); if ( x == 0 ) return -1; @@ -81,7 +81,7 @@ DtMmdbGetBookCaseByIndex(int infolib_descriptor, int index) } else return -1; } - catch (mmdbException &,e) + mcatch (mmdbException &,e) { return -1; } end_try; @@ -91,7 +91,7 @@ DtMmdbGetBookCaseByIndex(int infolib_descriptor, int index) int DtMmdbGetBookCaseByLoc(int infolib_descriptor, const char* locator) { - try { + mtry { info_lib* x = mmdb_ptr -> getInfoLib(infolib_descriptor); if ( x == 0 ) return -1; @@ -105,7 +105,7 @@ DtMmdbGetBookCaseByLoc(int infolib_descriptor, const char* locator) return base -> index_id(); } - catch (mmdbException &,e) + mcatch (mmdbException &,e) { return -1; } end_try; @@ -118,7 +118,7 @@ DtMmdbGetBookCaseByLocs(int infolib_descriptor, const char** locators, int* count_ptr) { - try { + mtry { info_lib* x = mmdb_ptr -> getInfoLib(infolib_descriptor); if ( x == 0 ) return 0; @@ -146,7 +146,7 @@ DtMmdbGetBookCaseByLocs(int infolib_descriptor, const char** locators, return ds; } - catch (mmdbException &,e) + mcatch (mmdbException &,e) { if (count_ptr) *count_ptr = 0; return 0; @@ -159,7 +159,7 @@ DtMmdbGetBookCaseByLocs(int infolib_descriptor, const char** locators, DtMmdbBookCaseInfo* DtMmdbBookCaseGetInfo(int bookcase_descriptor) { - try { + mtry { info_base* x = getBookCase(bookcase_descriptor); if ( x == 0 ) return 0; @@ -175,7 +175,7 @@ DtMmdbBookCaseGetInfo(int bookcase_descriptor) return y; } - catch (mmdbException &,e) + mcatch (mmdbException &,e) { return 0; } end_try; diff --git a/cde/programs/dtinfo/DtMmdb/oliasdb/c_api_common.C b/cde/programs/dtinfo/DtMmdb/oliasdb/c_api_common.C index 35448a689..55f613226 100644 --- a/cde/programs/dtinfo/DtMmdb/oliasdb/c_api_common.C +++ b/cde/programs/dtinfo/DtMmdb/oliasdb/c_api_common.C @@ -26,6 +26,7 @@ #include "storage/page_storage.h" #include "api/info_lib.h" #include +#include #include "schema/store_desc.h" #include "dynhash/data_t.h" #include "index/index.h" @@ -62,7 +63,7 @@ void initialize_MMDB() ostring::input_buf = new char[LBUFSIZ]; data_t::larson_convertor_ptr = new atoi_larson; - data_t::pearson_convertor_ptr = new atoi_pearson(MAXSHORT, 256); + data_t::pearson_convertor_ptr = new atoi_pearson(SHRT_MAX, 256); ground_ptr = new oid_t(c_code_t(0), i_code_t(0)); @@ -230,7 +231,7 @@ DtMmdbGraphicInfo* newDtMmdbGraphicInfo() void DtMmdbFreeHandle(DtMmdbHandle* x) { if ( x ) { - delete x -> oid_ptr; +// delete x -> oid_ptr; free((void*)x); } } @@ -254,7 +255,7 @@ extern int auto_test(int argc, char** argv, OLIAS_DB& db); extern "C" { int auto_test_c_api(int argc, char** argv) { - try + mtry { #ifdef REGRESSION_TEST OLIAS_DB db; @@ -264,7 +265,7 @@ int auto_test_c_api(int argc, char** argv) #endif } - catch (mmdbException &,e) + mcatch (mmdbException &,e) { cerr << "Exception msg: " << e << "\n"; return -1; @@ -331,7 +332,7 @@ char* DtMmdbHandleToString(DtMmdbHandle* x) static char buf[100]; if ( x -> oid_ptr) { oid_t *z = (oid_t*)(x -> oid_ptr); - sprintf(buf, "%d.%d", z -> ccode(), z -> icode()); + sprintf(buf, "%d.%d", z -> ccode(), (int)z -> icode()); } else buf[0] = 0; diff --git a/cde/programs/dtinfo/DtMmdb/oliasdb/c_api_dlp.C b/cde/programs/dtinfo/DtMmdb/oliasdb/c_api_dlp.C index 6d576ca0f..bd8218766 100644 --- a/cde/programs/dtinfo/DtMmdb/oliasdb/c_api_dlp.C +++ b/cde/programs/dtinfo/DtMmdb/oliasdb/c_api_dlp.C @@ -27,7 +27,7 @@ static dlp_smart_ptr* getDlpUsingProid(DtMmdbInfoRequest* request) { - try { + mtry { info_base* x = getBookCase(request -> bookcase_descriptor); if ( x == 0 ) return 0; @@ -40,7 +40,7 @@ getDlpUsingProid(DtMmdbInfoRequest* request) return 0; } - catch (mmdbException &,e) + mcatch (mmdbException &,e) { return 0; } end_try; @@ -50,7 +50,7 @@ getDlpUsingProid(DtMmdbInfoRequest* request) DtMmdbHandle* DtMmdbDlpGetPrevSectionId(DtMmdbInfoRequest* request) { - try { + mtry { dlp_smart_ptr* x = getDlpUsingProid(request); if ( x == 0 ) return 0; DtMmdbHandle *z = 0; @@ -64,7 +64,7 @@ DtMmdbDlpGetPrevSectionId(DtMmdbInfoRequest* request) return z; } - catch (mmdbException &,e) + mcatch (mmdbException &,e) { return 0; } end_try; @@ -74,7 +74,7 @@ DtMmdbDlpGetPrevSectionId(DtMmdbInfoRequest* request) DtMmdbHandle* DtMmdbDlpGetNextSectionId(DtMmdbInfoRequest* request) { - try { + mtry { dlp_smart_ptr* x = getDlpUsingProid(request); if ( x == 0 ) return 0; @@ -89,7 +89,7 @@ DtMmdbDlpGetNextSectionId(DtMmdbInfoRequest* request) return z; } - catch (mmdbException &,e) + mcatch (mmdbException &,e) { return 0; } end_try; diff --git a/cde/programs/dtinfo/DtMmdb/oliasdb/c_api_graphic.C b/cde/programs/dtinfo/DtMmdb/oliasdb/c_api_graphic.C index 53d4b0d34..0308d5952 100644 --- a/cde/programs/dtinfo/DtMmdb/oliasdb/c_api_graphic.C +++ b/cde/programs/dtinfo/DtMmdb/oliasdb/c_api_graphic.C @@ -27,7 +27,7 @@ static graphic_smart_ptr* getGraphicUsingLocAndProid(DtMmdbInfoRequest* request, Boolean checkLocOnly = false) { - try { + mtry { info_base* x = getBookCase(request -> bookcase_descriptor); if ( x == 0 ) return 0; @@ -46,7 +46,7 @@ getGraphicUsingLocAndProid(DtMmdbInfoRequest* request, Boolean checkLocOnly = fa return new graphic_smart_ptr(x, *id); } - catch (mmdbException &,e) + mcatch (mmdbException &,e) { return 0; } end_try; @@ -56,13 +56,13 @@ getGraphicUsingLocAndProid(DtMmdbInfoRequest* request, Boolean checkLocOnly = fa const char* DtMmdbGraphicGetData(DtMmdbInfoRequest* request, unsigned int* data_length) { - try { + mtry { graphic_smart_ptr* x = getGraphicUsingLocAndProid(request, true); if ( x == 0 ) return 0; #ifdef DEBUG - fprintf(stderr, " graphicInfo: mmdb_oid = %d.%d\n", (*x).its_oid().ccode(), (*x).its_oid().icode()); + fprintf(stderr, " graphicInfo: mmdb_oid = %d.%d\n", (int)(*x).its_oid().ccode(), (int)(*x).its_oid().icode()); #endif const char* y = x -> data(); @@ -72,7 +72,7 @@ DtMmdbGraphicGetData(DtMmdbInfoRequest* request, unsigned int* data_length) return y; } - catch (mmdbException &,e) + mcatch (mmdbException &,e) { return 0; } end_try; @@ -83,7 +83,7 @@ DtMmdbGraphicInfo* DtMmdbGraphicGetInfo(DtMmdbInfoRequest* request) { - try { + mtry { graphic_smart_ptr* x = getGraphicUsingLocAndProid(request, true); if ( x == 0 ) return 0; @@ -107,7 +107,7 @@ DtMmdbGraphicGetInfo(DtMmdbInfoRequest* request) return z; } - catch (mmdbException &,e) + mcatch (mmdbException &,e) { return 0; } end_try; @@ -116,7 +116,7 @@ DtMmdbGraphicGetInfo(DtMmdbInfoRequest* request) const char* DtMmdbGraphicGetLoc(DtMmdbInfoRequest* request) { - try { + mtry { graphic_smart_ptr* x = getGraphicUsingLocAndProid(request, true); if ( x == 0 ) return 0; @@ -127,7 +127,7 @@ const char* DtMmdbGraphicGetLoc(DtMmdbInfoRequest* request) return y; } - catch (mmdbException &,e) + mcatch (mmdbException &,e) { return 0; } end_try; diff --git a/cde/programs/dtinfo/DtMmdb/oliasdb/c_api_infolib.C b/cde/programs/dtinfo/DtMmdb/oliasdb/c_api_infolib.C index 0da4bc79b..8e8339a1a 100644 --- a/cde/programs/dtinfo/DtMmdb/oliasdb/c_api_infolib.C +++ b/cde/programs/dtinfo/DtMmdb/oliasdb/c_api_infolib.C @@ -54,7 +54,7 @@ DtMmdbOpenInfoLib( DtMmdbBool delayed_infolib_init ) { - try { + mtry { Boolean option = (delayed_infolib_init == DtMmdbTrue) ? true : false; @@ -74,7 +74,7 @@ DtMmdbOpenInfoLib( return i; } - catch (mmdbException &,e) + mcatch (mmdbException &,e) { return -1; } end_try; @@ -94,7 +94,7 @@ void DtMmdbCloseInfoLib(int infolib_descriptor) DtMmdbInfoLibInfo* DtMmdbInfoLibGetInfo(int infolib_descriptor) { - try { + mtry { info_lib* x = mmdb_ptr -> getInfoLib(infolib_descriptor); if ( x == 0 ) return 0; @@ -111,7 +111,7 @@ DtMmdbInfoLibGetInfo(int infolib_descriptor) return y; } - catch (mmdbException &,e) + mcatch (mmdbException &,e) { return 0; } end_try; diff --git a/cde/programs/dtinfo/DtMmdb/oliasdb/c_api_locator.C b/cde/programs/dtinfo/DtMmdb/oliasdb/c_api_locator.C index 9ffdfe968..5c13a6aa0 100644 --- a/cde/programs/dtinfo/DtMmdb/oliasdb/c_api_locator.C +++ b/cde/programs/dtinfo/DtMmdb/oliasdb/c_api_locator.C @@ -27,7 +27,7 @@ static locator_smart_ptr* getLocatorUsingLocAndProid(DtMmdbInfoRequest* request, Boolean checkLocOnly = false) { - try { + mtry { info_base* x = getBookCase(request -> bookcase_descriptor); if ( x == 0 ) return 0; @@ -49,7 +49,7 @@ getLocatorUsingLocAndProid(DtMmdbInfoRequest* request, Boolean checkLocOnly = fa */ } - catch (mmdbException &,e) + mcatch (mmdbException &,e) { return 0; } end_try; @@ -59,7 +59,7 @@ getLocatorUsingLocAndProid(DtMmdbInfoRequest* request, Boolean checkLocOnly = fa const char* DtMmdbLocatorGetSectionLoc(DtMmdbInfoRequest* request) { - try { + mtry { locator_smart_ptr* x = getLocatorUsingLocAndProid(request, false); if ( x == 0 ) return 0; @@ -68,7 +68,7 @@ DtMmdbLocatorGetSectionLoc(DtMmdbInfoRequest* request) return y; } - catch (mmdbException &,e) + mcatch (mmdbException &,e) { return 0; } end_try; @@ -78,7 +78,7 @@ DtMmdbLocatorGetSectionLoc(DtMmdbInfoRequest* request) DtMmdbHandle* DtMmdbLocatorGetSectionObjectId(DtMmdbInfoRequest* request) { - try { + mtry { locator_smart_ptr* x = getLocatorUsingLocAndProid(request, true); if ( x == 0 ) return 0; DtMmdbHandle *z = newDtMmdbHandle(x -> node_id()); @@ -86,7 +86,7 @@ DtMmdbLocatorGetSectionObjectId(DtMmdbInfoRequest* request) return z; } - catch (mmdbException &,e) + mcatch (mmdbException &,e) { return 0; } end_try; diff --git a/cde/programs/dtinfo/DtMmdb/oliasdb/c_api_section.C b/cde/programs/dtinfo/DtMmdb/oliasdb/c_api_section.C index 4dfe0777e..bbba476d6 100644 --- a/cde/programs/dtinfo/DtMmdb/oliasdb/c_api_section.C +++ b/cde/programs/dtinfo/DtMmdb/oliasdb/c_api_section.C @@ -27,7 +27,7 @@ const char* DtMmdbSectionGetLoc(DtMmdbInfoRequest* request) { - try { + mtry { info_base* x = getBookCase(request -> bookcase_descriptor); if ( x == 0 ) return 0; @@ -40,7 +40,7 @@ DtMmdbSectionGetLoc(DtMmdbInfoRequest* request) return y.locator(); } - catch (mmdbException &,e) + mcatch (mmdbException &,e) { return 0; } end_try; @@ -50,7 +50,7 @@ DtMmdbSectionGetLoc(DtMmdbInfoRequest* request) static node_smart_ptr* getSectionUsingLocAndProid(DtMmdbInfoRequest* request) { - try { + mtry { info_base* x = getBookCase(request -> bookcase_descriptor); if ( x == 0 ) return 0; @@ -67,7 +67,7 @@ getSectionUsingLocAndProid(DtMmdbInfoRequest* request) return new node_smart_ptr(x, *id); } - catch (mmdbException &,e) + mcatch (mmdbException &,e) { return 0; } end_try; @@ -80,7 +80,7 @@ DtMmdbSectionGetLongTitle( unsigned int* title_length ) { - try { + mtry { node_smart_ptr* x = getSectionUsingLocAndProid(request); if ( x == 0 ) return 0; @@ -98,7 +98,7 @@ DtMmdbSectionGetLongTitle( return y; } - catch (mmdbException &,e) + mcatch (mmdbException &,e) { return 0; } end_try; @@ -111,7 +111,7 @@ DtMmdbSectionGetShortTitle( unsigned int* title_length ) { - try { + mtry { node_smart_ptr* x = getSectionUsingLocAndProid(request); if ( x == 0 ) return 0; @@ -122,7 +122,7 @@ DtMmdbSectionGetShortTitle( return y; } - catch (mmdbException &,e) + mcatch (mmdbException &,e) { return 0; } end_try; @@ -136,7 +136,7 @@ DtMmdbSectionGetData unsigned int* data_length ) { - try { + mtry { node_smart_ptr* x = getSectionUsingLocAndProid(request); if ( x == 0 ) return 0; @@ -147,7 +147,7 @@ DtMmdbSectionGetData return y; } - catch (mmdbException &,e) + mcatch (mmdbException &,e) { return 0; } end_try; @@ -156,7 +156,7 @@ DtMmdbSectionGetData int DtMmdbSectionGetDataSize(DtMmdbInfoRequest* request) { - try { + mtry { node_smart_ptr* x = getSectionUsingLocAndProid(request); if ( x == 0 ) return -1; @@ -167,7 +167,7 @@ int DtMmdbSectionGetDataSize(DtMmdbInfoRequest* request) return y; } - catch (mmdbException &,e) + mcatch (mmdbException &,e) { return -1; } end_try; @@ -177,7 +177,7 @@ int DtMmdbSectionGetDataSize(DtMmdbInfoRequest* request) const char* DtMmdbSectionGetTocLoc(DtMmdbInfoRequest* request) { - try { + mtry { node_smart_ptr* x = getSectionUsingLocAndProid(request); if ( x == 0 ) return 0; @@ -187,7 +187,7 @@ const char* DtMmdbSectionGetTocLoc(DtMmdbInfoRequest* request) return y; } - catch (mmdbException &,e) + mcatch (mmdbException &,e) { return 0; } end_try; @@ -198,7 +198,7 @@ const char* DtMmdbSectionGetTocLoc(DtMmdbInfoRequest* request) DtMmdbHandle* DtMmdbSectionGetBookId(DtMmdbInfoRequest* request) { - try { + mtry { node_smart_ptr* x = getSectionUsingLocAndProid(request); if ( x == 0 ) return 0; @@ -209,7 +209,7 @@ DtMmdbSectionGetBookId(DtMmdbInfoRequest* request) return z; } - catch (mmdbException &,e) + mcatch (mmdbException &,e) { return 0; } end_try; @@ -219,7 +219,7 @@ DtMmdbSectionGetBookId(DtMmdbInfoRequest* request) DtMmdbHandle* DtMmdbSectionGetStyleSheetId(DtMmdbInfoRequest* request) { - try { + mtry { node_smart_ptr* x = getSectionUsingLocAndProid(request); if ( x == 0 ) return 0; @@ -230,7 +230,7 @@ DtMmdbSectionGetStyleSheetId(DtMmdbInfoRequest* request) return z; } - catch (mmdbException &,e) + mcatch (mmdbException &,e) { return 0; } end_try; diff --git a/cde/programs/dtinfo/DtMmdb/oliasdb/c_api_stylesheet.C b/cde/programs/dtinfo/DtMmdb/oliasdb/c_api_stylesheet.C index 3351305d6..75b314a30 100644 --- a/cde/programs/dtinfo/DtMmdb/oliasdb/c_api_stylesheet.C +++ b/cde/programs/dtinfo/DtMmdb/oliasdb/c_api_stylesheet.C @@ -27,7 +27,7 @@ static stylesheet_smart_ptr* getStylesheetUsingLocAndProid(DtMmdbInfoRequest* request, Boolean checkPIDOnly = false) { - try { + mtry { info_base* x = getBookCase(request -> bookcase_descriptor); if ( x == 0 ) return 0; @@ -48,7 +48,7 @@ getStylesheetUsingLocAndProid(DtMmdbInfoRequest* request, Boolean checkPIDOnly = } - catch (mmdbException &,e) + mcatch (mmdbException &,e) { return 0; } end_try; @@ -58,7 +58,7 @@ getStylesheetUsingLocAndProid(DtMmdbInfoRequest* request, Boolean checkPIDOnly = const char* DtMmdbStylesheetGetName(DtMmdbInfoRequest* request) { - try { + mtry { stylesheet_smart_ptr* x = getStylesheetUsingLocAndProid(request, true); if ( x == 0 ) return 0; @@ -67,7 +67,7 @@ DtMmdbStylesheetGetName(DtMmdbInfoRequest* request) return y; } - catch (mmdbException &,e) + mcatch (mmdbException &,e) { return 0; } end_try; @@ -77,14 +77,14 @@ DtMmdbStylesheetGetName(DtMmdbInfoRequest* request) const char* DtMmdbStylesheetGetata(DtMmdbInfoRequest* request, unsigned int* data_length) { - try { + mtry { stylesheet_smart_ptr* x = getStylesheetUsingLocAndProid(request, false); if ( x == 0 ) return 0; #ifdef DEBUG - fprintf(stderr, " stylesheetInfo: mmdb_oid = %d.%d\n", (*x).its_oid().ccode() -, (*x).its_oid().icode()); + fprintf(stderr, " stylesheetInfo: mmdb_oid = %d.%d\n", (int)(*x).its_oid().ccode() +, (int)(*x).its_oid().icode()); #endif const char* y = x -> online_data(); @@ -95,7 +95,7 @@ DtMmdbStylesheetGetata(DtMmdbInfoRequest* request, unsigned int* data_length) return y; } - catch (mmdbException &,e) + mcatch (mmdbException &,e) { return 0; } end_try; diff --git a/cde/programs/dtinfo/DtMmdb/oliasdb/c_api_toc.C b/cde/programs/dtinfo/DtMmdb/oliasdb/c_api_toc.C index c7745cd8e..b54549fbe 100644 --- a/cde/programs/dtinfo/DtMmdb/oliasdb/c_api_toc.C +++ b/cde/programs/dtinfo/DtMmdb/oliasdb/c_api_toc.C @@ -27,7 +27,7 @@ static toc_smart_ptr* getTocUsingProid(DtMmdbInfoRequest* request) { - try { + mtry { info_base* x = getBookCase(request -> bookcase_descriptor); if ( x == 0 ) return 0; @@ -38,7 +38,7 @@ getTocUsingProid(DtMmdbInfoRequest* request) return new toc_smart_ptr(x, *id); } - catch (mmdbException &,e) + mcatch (mmdbException &,e) { return 0; } end_try; @@ -49,7 +49,7 @@ getTocUsingProid(DtMmdbInfoRequest* request) DtMmdbHandle* DtMmdbTocGetParentId(DtMmdbInfoRequest* request) { - try { + mtry { toc_smart_ptr* x = getTocUsingProid(request); if ( x == 0 ) return 0; @@ -64,7 +64,7 @@ DtMmdbTocGetParentId(DtMmdbInfoRequest* request) return z; } - catch (mmdbException &,e) + mcatch (mmdbException &,e) { return 0; } end_try; @@ -77,7 +77,7 @@ DtMmdbTocGetChildIds( unsigned int* list_length ) { - try { + mtry { toc_smart_ptr* x = getTocUsingProid(request); if ( x == 0 ) return 0; @@ -92,7 +92,8 @@ DtMmdbTocGetChildIds( //fprintf(stderr, "z=%x\n", (void*)z); if ( z == 0 ) return 0; - for (int i=0; i operator()(i+1)).icode())); } @@ -107,7 +108,7 @@ DtMmdbTocGetChildIds( return z; } - catch (mmdbException &,e) + mcatch (mmdbException &,e) { return 0; } end_try; @@ -116,7 +117,7 @@ DtMmdbTocGetChildIds( int DtMmdbTocGetNumOfChildren( DtMmdbInfoRequest* request) { - try { + mtry { toc_smart_ptr* x = getTocUsingProid(request); if ( x == 0 ) return -1; int y = x -> subtree_size(); @@ -124,7 +125,7 @@ int DtMmdbTocGetNumOfChildren( DtMmdbInfoRequest* request) return y; } - catch (mmdbException &,e) + mcatch (mmdbException &,e) { return -1; } end_try; diff --git a/cde/programs/dtinfo/DtMmdb/oliasdb/doc_test.C b/cde/programs/dtinfo/DtMmdb/oliasdb/doc_test.C index 9f592d023..3a43fb1ea 100644 --- a/cde/programs/dtinfo/DtMmdb/oliasdb/doc_test.C +++ b/cde/programs/dtinfo/DtMmdb/oliasdb/doc_test.C @@ -60,12 +60,12 @@ void print_doc(doc_smart_ptr& x, ostream& out, Boolean out_it_oid, Boolean out_t int compare_doc(doc_smart_ptr& pattern, info_base* base_ptr) { char pattern_buf[LARGE_BUFSIZ]; - ostrstream pattern_out(pattern_buf, LARGE_BUFSIZ, ios::out); + ostringstream pattern_out(pattern_buf, LARGE_BUFSIZ, ios::out); print_doc(pattern, pattern_out, false, false); doc_smart_ptr x( base_ptr, pattern.seq_num()); char db_buf[LARGE_BUFSIZ]; - ostrstream db_out(db_buf, LARGE_BUFSIZ, ios::out); + ostringstream db_out(db_buf, LARGE_BUFSIZ, ios::out); print_doc(x, db_out, false, false); return compare_stream(pattern_out, db_out); diff --git a/cde/programs/dtinfo/DtMmdb/oliasdb/graphic_hd.C b/cde/programs/dtinfo/DtMmdb/oliasdb/graphic_hd.C index 279515a1b..287a78f21 100644 --- a/cde/programs/dtinfo/DtMmdb/oliasdb/graphic_hd.C +++ b/cde/programs/dtinfo/DtMmdb/oliasdb/graphic_hd.C @@ -174,12 +174,12 @@ int graphic_smart_ptr::data_size() const char* graphic_smart_ptr::title() { - try + mtry { return get_string(BASE_COMPONENT_INDEX+5); } - catch (mmdbException&,e) + mcatch (mmdbException&,e) { return 0; } diff --git a/cde/programs/dtinfo/DtMmdb/oliasdb/graphic_test.C b/cde/programs/dtinfo/DtMmdb/oliasdb/graphic_test.C index 0c98f7274..6def80fee 100644 --- a/cde/programs/dtinfo/DtMmdb/oliasdb/graphic_test.C +++ b/cde/programs/dtinfo/DtMmdb/oliasdb/graphic_test.C @@ -67,7 +67,7 @@ void print_graphic(graphic_smart_ptr& x, ostream& out, Boolean out_misc) int compare_graphic(graphic_smart_ptr& pattern, info_base* base_ptr) { char pattern_buf[LARGE_BUFSIZ]; - ostrstream pattern_out(pattern_buf, LARGE_BUFSIZ, ios::out); + ostringstream pattern_out(pattern_buf, LARGE_BUFSIZ, ios::out); print_graphic(pattern, pattern_out, false); char loc[BUFSIZ]; @@ -75,7 +75,7 @@ int compare_graphic(graphic_smart_ptr& pattern, info_base* base_ptr) graphic_smart_ptr x( base_ptr, loc ); char db_buf[LARGE_BUFSIZ]; - ostrstream db_out(db_buf, LARGE_BUFSIZ, ios::out); + ostringstream db_out(db_buf, LARGE_BUFSIZ, ios::out); print_graphic(x, db_out, false); return compare_stream(pattern_out, db_out); diff --git a/cde/programs/dtinfo/DtMmdb/oliasdb/loc_test.C b/cde/programs/dtinfo/DtMmdb/oliasdb/loc_test.C index 0c2d6eb8f..46bbf4a92 100644 --- a/cde/programs/dtinfo/DtMmdb/oliasdb/loc_test.C +++ b/cde/programs/dtinfo/DtMmdb/oliasdb/loc_test.C @@ -38,12 +38,12 @@ void print_loc(locator_smart_ptr& x, ostream& out) int compare_locator(locator_smart_ptr& pattern, info_base* base_ptr) { char pattern_buf[LARGE_BUFSIZ]; - ostrstream pattern_out(pattern_buf, LARGE_BUFSIZ, ios::out); + ostringstream pattern_out(pattern_buf, LARGE_BUFSIZ, ios::out); print_loc(pattern, pattern_out); locator_smart_ptr x( base_ptr, pattern.inside_node_locator_str()); char db_buf[LARGE_BUFSIZ]; - ostrstream db_out(db_buf, LARGE_BUFSIZ, ios::out); + ostringstream db_out(db_buf, LARGE_BUFSIZ, ios::out); print_loc(x, db_out); return compare_stream(pattern_out, db_out); diff --git a/cde/programs/dtinfo/DtMmdb/oliasdb/locator_hd.C b/cde/programs/dtinfo/DtMmdb/oliasdb/locator_hd.C index d7d95a7e6..22dc78a2e 100644 --- a/cde/programs/dtinfo/DtMmdb/oliasdb/locator_hd.C +++ b/cde/programs/dtinfo/DtMmdb/oliasdb/locator_hd.C @@ -100,11 +100,11 @@ const char* locator_smart_ptr::label() { const char* rval; - try + mtry { rval = get_string(BASE_COMPONENT_INDEX+2); } - catch_any() + mcatch_any() { // catch exceptions to ensure backwards compatibility rval = 0; diff --git a/cde/programs/dtinfo/DtMmdb/oliasdb/mark.C b/cde/programs/dtinfo/DtMmdb/oliasdb/mark.C index 66dae0e76..ffc0f0bf7 100644 --- a/cde/programs/dtinfo/DtMmdb/oliasdb/mark.C +++ b/cde/programs/dtinfo/DtMmdb/oliasdb/mark.C @@ -71,7 +71,7 @@ debug(cerr, node_locator); mark_set_hd_ptr = uptr->mark_set_hd; - try { + mtry { mbase -> trans().begin(); abs_storage* marks_store = mark_set_hd_ptr -> its_store(); @@ -126,17 +126,17 @@ debug(cerr, int(v_mark_hd)); mbase -> trans().end(); } - catch (beginTransException&, e) + mcatch (beginTransException&, e) { smart_ptr::_init(ground, 0); // mark the mark obsolete rethrow; } - catch (commitTransException&, e) + mcatch (commitTransException&, e) { smart_ptr::_init(ground, 0); // mark the mark obsolete rethrow; } - catch (mmdbException&, e) + mcatch (mmdbException&, e) { smart_ptr::_init(ground, 0); // mark the mark obsolete mbase -> trans().rollback(); @@ -156,7 +156,7 @@ debug(cerr, uptr -> get_base_name()); debug(cerr, mark_id); #endif - try + mtry { v_loct_hd = (pstring_handler*) get_handler(BASE_COMPONENT_INDEX, STRING_CODE); @@ -164,7 +164,7 @@ debug(cerr, mark_id); get_handler(BASE_COMPONENT_INDEX+1, STRING_CODE); } - catch (mmdbException&, e) + mcatch (mmdbException&, e) { smart_ptr::_init(ground, 0); // mark the mark obsolete rethrow; @@ -187,7 +187,7 @@ void mark_smart_ptr::update_usermark(const pstring& new_mark) void mark_smart_ptr::update_usermark(const char* new_mark_str, int new_mark_str_sz) { - try { + mtry { mbase -> trans().begin(); (*v_mark_hd) -> update(new_mark_str, new_mark_str_sz); @@ -196,15 +196,15 @@ void mark_smart_ptr::update_usermark(const char* new_mark_str, mbase -> trans().end(); } - catch (beginTransException&, e) + mcatch (beginTransException&, e) { rethrow; } - catch (commitTransException&, e) + mcatch (commitTransException&, e) { rethrow; } - catch (mmdbException&, e) + mcatch (mmdbException&, e) { mbase -> trans().rollback(); rethrow; @@ -214,7 +214,7 @@ void mark_smart_ptr::update_usermark(const char* new_mark_str, void mark_smart_ptr::remove_from_db() { - try { + mtry { mbase -> trans().begin(); (*mark_set_hd_ptr) -> remove_component(its_oid()); @@ -223,15 +223,15 @@ void mark_smart_ptr::remove_from_db() mbase -> trans().end(); } - catch (beginTransException&, e) + mcatch (beginTransException&, e) { rethrow; } - catch (commitTransException&, e) + mcatch (commitTransException&, e) { rethrow; } - catch (mmdbException&, e) + mcatch (mmdbException&, e) { mbase -> trans().rollback(); rethrow; diff --git a/cde/programs/dtinfo/DtMmdb/oliasdb/mmdb.C b/cde/programs/dtinfo/DtMmdb/oliasdb/mmdb.C index ebb3445e9..8d0053347 100644 --- a/cde/programs/dtinfo/DtMmdb/oliasdb/mmdb.C +++ b/cde/programs/dtinfo/DtMmdb/oliasdb/mmdb.C @@ -78,7 +78,7 @@ OLIAS_DB::~OLIAS_DB() int OLIAS_DB::validInfoLibPath(const char* path) { - try + mtry { if ( exist_dir(path) == false ) return 0; @@ -91,7 +91,7 @@ int OLIAS_DB::validInfoLibPath(const char* path) } - catch (mmdbException &,e) + mcatch (mmdbException &,e) { return 0; } @@ -104,7 +104,8 @@ info_lib* OLIAS_DB::openInfoLib(const char* infoLibPath, const char* selectedBaseName, const char* infoLibName) { - for ( int i=0; i +#include +using namespace std; #endif MMDB_BODIES(olias_node) diff --git a/cde/programs/dtinfo/DtMmdb/oliasdb/node_test.C b/cde/programs/dtinfo/DtMmdb/oliasdb/node_test.C index 922600880..95b7eb7ff 100644 --- a/cde/programs/dtinfo/DtMmdb/oliasdb/node_test.C +++ b/cde/programs/dtinfo/DtMmdb/oliasdb/node_test.C @@ -51,7 +51,7 @@ void print_node(node_smart_ptr& x, ostream& out, Boolean get_data, Boolean get_d int compare_node(node_smart_ptr& pattern, info_base* base_ptr) { char pattern_buf[LARGE_BUFSIZ]; - ostrstream pattern_out(pattern_buf, LARGE_BUFSIZ, ios::out); + ostringstream pattern_out(pattern_buf, LARGE_BUFSIZ, ios::out); print_node(pattern, pattern_out, false, false); char loc[BUFSIZ]; @@ -59,7 +59,7 @@ int compare_node(node_smart_ptr& pattern, info_base* base_ptr) node_smart_ptr x( base_ptr, loc ); char db_buf[LARGE_BUFSIZ]; - ostrstream db_out(db_buf, LARGE_BUFSIZ, ios::out); + ostringstream db_out(db_buf, LARGE_BUFSIZ, ios::out); print_node(x, db_out, false, false); return compare_stream(pattern_out, db_out); @@ -88,14 +88,14 @@ debug(cerr, loc_size); char* db_buf; int data_size ; - ostrstream* db_out; + ostringstream* db_out; if ( doingTest ) { node_smart_ptr x( base_ptr, loc ); data_size = x.data_size(); db_buf = new char[data_size+1]; - db_out = new ostrstream(db_buf, data_size+1, ios::out); + db_out = new ostringstream(db_buf, data_size+1, ios::out); const char* z = x.data(); for ( int i=0; i> data_size; in.get(); char* pattern_buf = new char[data_size+1]; - ostrstream pattern_out(pattern_buf, data_size+1, ios::out); + ostringstream pattern_out(pattern_buf, data_size+1, ios::out); for ( i=0; i its_store(); @@ -176,7 +177,8 @@ int _load_mixed_objects_from_cin(info_base* base_ptr) int _load_mixed_objects(info_base* base_ptr, istream& in) { - for ( int i = 0; i get_set(set_map[i].col_name); if (x==0) diff --git a/cde/programs/dtinfo/DtMmdb/oliasdb/olias_test.C b/cde/programs/dtinfo/DtMmdb/oliasdb/olias_test.C index 32cee7d4e..1874de840 100644 --- a/cde/programs/dtinfo/DtMmdb/oliasdb/olias_test.C +++ b/cde/programs/dtinfo/DtMmdb/oliasdb/olias_test.C @@ -48,6 +48,7 @@ */ +#include "oliasdb/olias_test.h" #include "api/utility.h" #include "utility/pm_random.h" #include "misc/unique_id.h" @@ -55,7 +56,6 @@ #include "dstr/dstr_test.h" #include "storage/store_test.h" #include "oliasdb/olias_funcs.h" -#include "oliasdb/olias_test.h" #include "object/random_gen.h" @@ -76,7 +76,7 @@ #include "oliasdb/mmdb.h" -#ifdef DEBUG +#ifdef NODEBUG void test_collector_iterator(info_base* base) { MESSAGE(cerr, "node locators:"); @@ -108,7 +108,7 @@ int dump_instances(info_base* base_ptr, char* col_nm, c_code_t ins_code) if ( base_ptr == 0 ) throw(stringException("null base ptr")); - iterator *it = base_ptr -> first(col_nm, ins_code); + Iterator *it = base_ptr -> first(col_nm, ins_code); if (it==0) throw(stringException("null iterator pointer")); @@ -159,7 +159,8 @@ int cache_test( info_lib* infolib_ptr, const char* base_name, int argc, char** a locator_smart_ptrPtr* ptr_array = new locator_smart_ptrPtr[argc]; debug(cerr, argc); - for ( int i=0; i init_a_base(base_path, base_name); @@ -293,7 +293,7 @@ void user_base::_init() ubase_trans.end(); } - catch (mmdbException &,e) { + mcatch (mmdbException &,e) { #ifdef DEBUG fprintf(stderr, "mmdbException caught @ %s line:%d.\n", __FILE__, __LINE__); @@ -372,14 +372,14 @@ void user_base::clean_up() store_ptr = desc_ptr -> get_store(); if ( store_ptr ) { - try { + mtry { /* MESSAGE(cerr, "removing: "); MESSAGE(cerr, store_ptr -> my_name()); */ store_ptr->remove(); } - catch (mmdbException &,e) + mcatch (mmdbException &,e) { } end_try; } diff --git a/cde/programs/dtinfo/DtMmdb/schema/Imakefile b/cde/programs/dtinfo/DtMmdb/schema/Imakefile index 14927d95c..ffc2766a1 100644 --- a/cde/programs/dtinfo/DtMmdb/schema/Imakefile +++ b/cde/programs/dtinfo/DtMmdb/schema/Imakefile @@ -23,7 +23,7 @@ XCOMM .../programs/dtinfo/mmdb//Imakefile #define LargePICTable YES #define CplusplusSource YES -DEPEND_DEFINES = $(CXXDEPENDINCLUDES) +DEPEND_DEFINES = $(CXXDEPENDINCLUDES) $(DEPENDDEFINES) XCOMM In DtMmdb we compile as C_API sources. DEFINES = -DC_API -DPORTABLE_DB diff --git a/cde/programs/dtinfo/DtMmdb/schema/desc.C b/cde/programs/dtinfo/DtMmdb/schema/desc.C index 5d813160e..3508c366e 100644 --- a/cde/programs/dtinfo/DtMmdb/schema/desc.C +++ b/cde/programs/dtinfo/DtMmdb/schema/desc.C @@ -78,7 +78,7 @@ void desc::set_nm(const char* name) void desc::set_oid(const char* source) { - istrstream in((char*)source); + istringstream in((char*)source); v_oid._asciiIn(in); } diff --git a/cde/programs/dtinfo/DtMmdb/schema/object_dict.C b/cde/programs/dtinfo/DtMmdb/schema/object_dict.C index 076074f6b..71c9bed5e 100644 --- a/cde/programs/dtinfo/DtMmdb/schema/object_dict.C +++ b/cde/programs/dtinfo/DtMmdb/schema/object_dict.C @@ -131,7 +131,7 @@ desc* object_dict::init_a_base(char* db_path, char* db_name) x = parse(schema_path); } else { - int sz = bytes(in) - strlen(schema_header) - 1; + int sz = bytes(schema_path) - strlen(schema_header) - 1; char* buf = new char[sz]; if ( !in.read(buf, sz) ) @@ -188,7 +188,7 @@ desc* object_dict::init_a_base(char* define_desc_path, char* db_path, throw(stringException(form("%s does not exist.", define_desc_path))); } - unsigned long len = bytes(in_test)*4; + unsigned long len = bytes(define_desc_path)*4; in_test.close(); @@ -213,21 +213,19 @@ desc* object_dict::init_a_base(char* define_desc_path, char* db_path, throw(streamException(in.rdstate())); } - int sz = bytes(in); + int sz = bytes(define_desc_path); in.close(); char* schema_buf = new char[sz*3]; - ostrstream* string_out = new ostrstream(schema_buf, sz*3); + ostringstream* string_out = new ostringstream(schema_buf); if ( !(*string_out) ) { throw(streamException(string_out -> rdstate())); } x -> asciiOutList(*string_out); - string_out -> put('\0'); // make NULL terminated string - - + strcpy(schema_buf, string_out->str().c_str()); delete string_out; sz = strlen(schema_buf); @@ -242,7 +240,8 @@ desc* object_dict::init_a_base(char* define_desc_path, char* db_path, ///////////////////////////// // save the output to db_path ///////////////////////////// - fstream out(form("%s/%s.%s", db_path, db_name, SCHEMA_FILE_SUFFIX), ios::out, open_file_prot()); + fstream out(form("%s/%s.%s", db_path, db_name, SCHEMA_FILE_SUFFIX), ios::out); +// fstream out(form("%s/%s.%s", db_path, db_name, SCHEMA_FILE_SUFFIX), ios::out, open_file_prot()); if ( !out ) { MESSAGE(cerr, form("bad file name: %s", db_path)); @@ -290,11 +289,11 @@ desc* object_dict::parse(buffer& desc_buf) desc* x = 0; - try { + mtry { x = parse(unique_nm); } - catch (mmdbException &,e) { + mcatch (mmdbException &,e) { del_file(unique_nm); rethrow; } end_try; @@ -318,14 +317,14 @@ desc* object_dict::parse(char* define_desc_path) else ct = 1; - try { + mtry { if ( schemaparse() != 0 ) { fclose(schemain); throw(stringException("Parsing input failed")); } } - catch (mmdbException &,e) { + mcatch (mmdbException &,e) { fclose(schemain); rethrow; } end_try; @@ -341,14 +340,14 @@ void object_dict::_init(desc* x) desc *ptr = x; - try { // init all stores + mtry { // init all stores while ( ptr ) { ptr -> init_store(this -> v_db_path); ptr = ptr -> next_desc; } } - catch (mmdbException &,e) { + mcatch (mmdbException &,e) { _quit_stores(x, ptr); _quit_descs(x, ptr); rethrow; @@ -390,10 +389,10 @@ void object_dict::_quit_stores(desc* start_ptr, desc* end_ptr, Boolean sync) if ( sync == true ) { while ( ptr != end_ptr ) { - try { + mtry { ptr -> sync_store(); } - catch (mmdbException &,e) + mcatch (mmdbException &,e) { #ifdef DEBUG fprintf(stderr, "mmdbException caught @ %s line:%d.\n", @@ -410,11 +409,11 @@ void object_dict::_quit_stores(desc* start_ptr, desc* end_ptr, Boolean sync) ptr = start_ptr; while ( ptr != end_ptr ) { - try { + mtry { ptr -> quit_store(); } - catch (mmdbException &,e) + mcatch (mmdbException &,e) { #ifdef DEBUG fprintf(stderr, "mmdbException caught @ %s line:%d.\n", @@ -434,12 +433,12 @@ void object_dict::_quit_stored_objects(desc* start_ptr, desc* end_ptr) while ( ptr != end_ptr ) { - try { + mtry { ptr -> quit_handler(); //debug(cerr, *ptr); } - catch (mmdbException &,e) + mcatch (mmdbException &,e) { #ifdef DEBUG fprintf(stderr, "mmdbException caught @ %s line:%d.\n", diff --git a/cde/programs/dtinfo/DtMmdb/schema/sheet.C b/cde/programs/dtinfo/DtMmdb/schema/sheet.C index df7f7aa97..1769b63e3 100644 --- a/cde/programs/dtinfo/DtMmdb/schema/sheet.C +++ b/cde/programs/dtinfo/DtMmdb/schema/sheet.C @@ -53,6 +53,7 @@ extern desc* last_desc_ptr; #define CAST_TO_CONTAINER(x) ((container_desc*)x) +#undef alloca #define alloca(x) (malloc(x)) extern void schemaerror(char*); @@ -97,6 +98,7 @@ typedef union #define MODE 284 #define PAGE_SZ 285 #define CACHED_PAGES 286 +#undef BYTE_ORDER #define BYTE_ORDER 287 #define SEPARATOR 288 #define schemaERRCODE 256 @@ -414,7 +416,7 @@ int #endif schemanewerror: #endif - schemaerror("syntax error"); + schemaerror((char*)"syntax error"); #if 0 /* remove if needed */ #ifdef lint goto schemaerrlab; @@ -799,7 +801,7 @@ to state %d\n", * schemassp, schemastate); *++ schemavsp = schemaval; goto schemaloop; schemaoverflow: - schemaerror("yacc stack overflow"); + schemaerror((char*)"yacc stack overflow"); schemaabort: return (1); schemaaccept: diff --git a/cde/programs/dtinfo/DtMmdb/schema/sheet.tab.h b/cde/programs/dtinfo/DtMmdb/schema/sheet.tab.h index dd7b1dac1..1178a880a 100644 --- a/cde/programs/dtinfo/DtMmdb/schema/sheet.tab.h +++ b/cde/programs/dtinfo/DtMmdb/schema/sheet.tab.h @@ -51,6 +51,7 @@ #define MODE 284 #define PAGE_SZ 285 #define CACHED_PAGES 286 +#undef BYTE_ORDER #define BYTE_ORDER 287 #define SEPARATOR 288 typedef union diff --git a/cde/programs/dtinfo/DtMmdb/schema/token.C b/cde/programs/dtinfo/DtMmdb/schema/token.C index 52c3a9ee8..b8caadd76 100644 --- a/cde/programs/dtinfo/DtMmdb/schema/token.C +++ b/cde/programs/dtinfo/DtMmdb/schema/token.C @@ -43,9 +43,13 @@ #include -#if !defined(__osf__) && !defined(USL) +#if defined(__osf__) || defined(linux) || defined(CSRG_BASED) +#include +#else +#if !defined(__uxp__) && !defined(USL) #include #endif +#endif /* use prototypes in function declarations */ #define schema_USE_PROTOS diff --git a/cde/programs/dtinfo/DtMmdb/storage/Imakefile b/cde/programs/dtinfo/DtMmdb/storage/Imakefile index ee32ae4bc..82ea47c2a 100644 --- a/cde/programs/dtinfo/DtMmdb/storage/Imakefile +++ b/cde/programs/dtinfo/DtMmdb/storage/Imakefile @@ -23,7 +23,7 @@ XCOMM .../programs/dtinfo/mmdb//Imakefile #define LargePICTable YES #define CplusplusSource YES -DEPEND_DEFINES = $(CXXDEPENDINCLUDES) +DEPEND_DEFINES = $(CXXDEPENDINCLUDES) $(DEPENDDEFINES) XCOMM In DtMmdb we compile as C_API sources. DEFINES = -DC_API -DPORTABLE_DB diff --git a/cde/programs/dtinfo/DtMmdb/storage/lru.h b/cde/programs/dtinfo/DtMmdb/storage/lru.h index ebe81b76a..394b077a0 100644 --- a/cde/programs/dtinfo/DtMmdb/storage/lru.h +++ b/cde/programs/dtinfo/DtMmdb/storage/lru.h @@ -48,7 +48,7 @@ #ifdef C_API #include "utility/c_stream.h" #else -#include +#include #endif #include "utility/debug.h" diff --git a/cde/programs/dtinfo/DtMmdb/storage/page_storage.C b/cde/programs/dtinfo/DtMmdb/storage/page_storage.C index 2b34145a7..aa15811f8 100644 --- a/cde/programs/dtinfo/DtMmdb/storage/page_storage.C +++ b/cde/programs/dtinfo/DtMmdb/storage/page_storage.C @@ -1110,7 +1110,7 @@ Boolean page_storage::io_mode(int mode) void page_storage::begin_trans() { - try { + mtry { if ( trans_info.status == store_trans::ENABLED ) throw(stringException("trans is still in progress")); @@ -1127,7 +1127,7 @@ void page_storage::begin_trans() updateString(0, (char*)&l_max_pages, sizeof(l_max_pages), 0, true); } - catch (mmdbException&, e) { + mcatch (mmdbException&, e) { // workaround for solaris's /SUNWspro/bin/CC compiler. beginTransException x; throw(x); @@ -1141,7 +1141,7 @@ void page_storage::commit_trans() ////////////////////////////// // sync the touched pages ////////////////////////////// - try { + mtry { int ind = trans_info.log_index -> first_bucket(); while ( ind != -1 ) { @@ -1165,7 +1165,7 @@ void page_storage::commit_trans() trans_info.status = store_trans::DISABLED; } - catch (mmdbException &,e) { + mcatch (mmdbException &,e) { // workaround for solaris's /SUNWspro/bin/CC compiler. commitTransException x; throw(x); @@ -1174,7 +1174,7 @@ void page_storage::commit_trans() void page_storage::roll_back() { - try + mtry { if ( exist_file(form("%s.log", name), path) == false ) return; @@ -1270,7 +1270,7 @@ void page_storage::roll_back() trans_info.status = store_trans::DISABLED; } - catch (mmdbException &,e) + mcatch (mmdbException &,e) { // workaround for solaris's /SUNWspro/bin/CC compiler. rollbackTransException x; @@ -1310,7 +1310,7 @@ debug(cerr, trans_info.max_pages); int log_bytes_before = trans_info.log_store -> bytes(); - try { + mtry { if ( swap_order() == true ) // swap to desired order ORDER_SWAP_UINT(l_pid); @@ -1331,7 +1331,7 @@ debug(cerr, trans_info.max_pages); trans_info.log_index -> insert(pkey); } - catch (mmdbException&, e) { + mcatch (mmdbException&, e) { trans_info.log_store -> truncate(log_bytes_before); rethrow; } diff --git a/cde/programs/dtinfo/DtMmdb/storage/rep_cell.h b/cde/programs/dtinfo/DtMmdb/storage/rep_cell.h index 6e88e59f2..205fc3e36 100644 --- a/cde/programs/dtinfo/DtMmdb/storage/rep_cell.h +++ b/cde/programs/dtinfo/DtMmdb/storage/rep_cell.h @@ -48,7 +48,7 @@ #ifdef C_API #include "utility/c_stream.h" #else -#include +#include #endif #include "dstr/dlist.h" diff --git a/cde/programs/dtinfo/DtMmdb/storage/storage.h b/cde/programs/dtinfo/DtMmdb/storage/storage.h index 611b8eafc..5ec9b3c7f 100644 --- a/cde/programs/dtinfo/DtMmdb/storage/storage.h +++ b/cde/programs/dtinfo/DtMmdb/storage/storage.h @@ -57,7 +57,8 @@ #ifdef C_API #include "utility/c_fstream.h" #else -#include +#include +using namespace std; #endif #include "utility/macro.h" diff --git a/cde/programs/dtinfo/DtMmdb/storage/unixf_storage.C b/cde/programs/dtinfo/DtMmdb/storage/unixf_storage.C index 93f5292b4..7c2f9041d 100644 --- a/cde/programs/dtinfo/DtMmdb/storage/unixf_storage.C +++ b/cde/programs/dtinfo/DtMmdb/storage/unixf_storage.C @@ -86,9 +86,13 @@ MESSAGE(cerr, "~unixf storeage ()"); void unixf_storage::remove() { +#ifdef C_API int fd = rdbuf() -> fd(); fsync(fd); ::close(fd); +#else + rdbuf() -> close(); +#endif del_file(my_name(), my_path()); /* int md = mode; @@ -133,7 +137,7 @@ int unixf_storage::_open(int new_mode) } if ( v_file_exist == false ) { - SET_BIT(new_mode, ios::out); + SET_BIT(new_mode, ios::out | ios::app); v_file_exist = true; } @@ -157,13 +161,23 @@ int unixf_storage::_open(int new_mode) SET_BIT(mode, new_mode); fmt = ::form("%s/%s", path, name); - fstream::open((const char *) fmt, mode, open_file_prot()); +#ifdef C_API + fstream::open((const char *) fmt, mode); +#else + fstream::open((const char *) fmt, (ios_base::openmode)mode); +#endif +// fstream::open((const char *) fmt, mode, open_file_prot()); } else { if ( ! fstream::rdbuf() -> is_open() ) { fmt = ::form("%s/%s", path, name); - fstream::open((const char *) fmt, mode, open_file_prot()); +#ifdef C_API + fstream::open((const char *) fmt, mode); +#else + fstream::open((const char *) fmt, (ios_base::openmode)mode); +#endif +// fstream::open((const char *) fmt, mode, open_file_prot()); } } @@ -254,11 +268,11 @@ fprintf(stderr, "flush option=%d\n", flush_opt); flush(); #ifdef DEBUG - fprintf(stderr, "%d bytes have been written at offset %d in %s/%s @ %s:%d\n", len, loc+string_ofst, path, name, __FILE__, __LINE__); + fprintf(stderr, "%d bytes have been written at offset %ld in %s/%s @ %s:%d\n", len, loc+string_ofst, path, name, __FILE__, __LINE__); #ifndef C_API { char fname[64]; - sprintf(fname, "%s.%d-%d", name, loc+string_ofst, len); + sprintf(fname, "%s.%ld-%d", name, loc+string_ofst, len); ofstream output(fname); output.write(base, len); output.flush(); @@ -296,14 +310,18 @@ int unixf_storage::bytes() { if ( total_bytes == -1 ) { + char* info_lib_file = form("%s/%s", path, name); + _open(ios::in); - if ( !good() ) clear(); - +#ifdef C_API total_bytes = ::bytes(rdbuf() -> fd()); +#else + total_bytes = ::bytes(info_lib_file); +#endif } return total_bytes; @@ -318,7 +336,12 @@ Boolean unixf_storage::io_mode(int test_mode) fstream::close(); } - fstream::open(name, test_mode, open_file_prot()); +#ifdef C_API + fstream::open(name, test_mode); +#else + fstream::open(name, (ios_base::openmode)test_mode); +#endif +// fstream::open(name, test_mode, open_file_prot()); if ( ! fstream::rdbuf() -> is_open() ) return false; @@ -326,7 +349,12 @@ Boolean unixf_storage::io_mode(int test_mode) fstream::close(); if ( opened == true ) +#ifdef C_API fstream::open(name, mode, open_file_prot()); +#else + fstream::open(name, (ios_base::openmode)mode); +#endif +// fstream::open(name, mode, open_file_prot()); return true; } diff --git a/cde/programs/dtinfo/DtMmdb/utility/Imakefile b/cde/programs/dtinfo/DtMmdb/utility/Imakefile index 11dac22a4..cf71ccb2f 100644 --- a/cde/programs/dtinfo/DtMmdb/utility/Imakefile +++ b/cde/programs/dtinfo/DtMmdb/utility/Imakefile @@ -23,7 +23,7 @@ XCOMM .../programs/dtinfo/mmdb//Imakefile #define LargePICTable YES #define CplusplusSource YES -DEPEND_DEFINES = $(CXXDEPENDINCLUDES) +DEPEND_DEFINES = $(CXXDEPENDINCLUDES) $(DEPENDDEFINES) XCOMM In DtMmdb we compile as C_API sources. DEFINES = -DC_API -DPORTABLE_DB @@ -36,8 +36,9 @@ BASE_SRCS = \ randomize.C C_API_SRCS = \ - streambuf.C charbuf.C filebuf.C strstream.C \ - iostream.C fstream.C stream.C ios.C + streambuf.C charbuf.C filebuf.C string.C \ + stringstream.C iostream.C fstream.C stream.C \ + ios.C SRCS = $(BASE_SRCS) $(C_API_SRCS) OBJS = $(BASE_SRCS:.C=.o) $(C_API_SRCS:.C=.o) diff --git a/cde/programs/dtinfo/DtMmdb/utility/atoi_fast.C b/cde/programs/dtinfo/DtMmdb/utility/atoi_fast.C index c51720365..f19ef0a7c 100644 --- a/cde/programs/dtinfo/DtMmdb/utility/atoi_fast.C +++ b/cde/programs/dtinfo/DtMmdb/utility/atoi_fast.C @@ -66,7 +66,8 @@ void atoi_fast::init(int r, int, pm_random& rdm_generator) v_tbl = new char[v_entries]; - for ( int i = 0; i < v_entries; i++ ) + int i; + for ( i = 0; i < v_entries; i++ ) v_tbl[i] = i; for ( i = 0; i < v_entries - 1; i++ ) { diff --git a/cde/programs/dtinfo/DtMmdb/utility/atoi_larson.h b/cde/programs/dtinfo/DtMmdb/utility/atoi_larson.h index 386708a53..40dcc4843 100644 --- a/cde/programs/dtinfo/DtMmdb/utility/atoi_larson.h +++ b/cde/programs/dtinfo/DtMmdb/utility/atoi_larson.h @@ -46,7 +46,12 @@ #ifndef _atoi_larson_h #define _atoi_larson_h 1 +#include +#if defined(CSRG_BASED) +#define MAXINT INT_MAX +#else #include +#endif #include "key.h" // Based on Larson's algorithm presented in CACM ???. diff --git a/cde/programs/dtinfo/DtMmdb/utility/atoi_pearson.C b/cde/programs/dtinfo/DtMmdb/utility/atoi_pearson.C index 70b139a4e..6e9a9f5d1 100644 --- a/cde/programs/dtinfo/DtMmdb/utility/atoi_pearson.C +++ b/cde/programs/dtinfo/DtMmdb/utility/atoi_pearson.C @@ -75,7 +75,8 @@ void atoi_pearson::init(int r, int, pm_random& rdm_generator) v_tbl = new char[v_entries]; - for ( int i = 0; i < v_entries; i++ ) + int i; + for ( i = 0; i < v_entries; i++ ) v_tbl[i] = i; /* diff --git a/cde/programs/dtinfo/DtMmdb/utility/buffer.C b/cde/programs/dtinfo/DtMmdb/utility/buffer.C index 0a6ce4160..344ef69f0 100644 --- a/cde/programs/dtinfo/DtMmdb/utility/buffer.C +++ b/cde/programs/dtinfo/DtMmdb/utility/buffer.C @@ -162,11 +162,7 @@ int buffer::expand_chunk(const int newsz) return 0; } -#if defined(linux) -#define CASTBNDEXCEPT (boundaryException*) -#else #define CASTBNDEXCEPT -#endif /***********************************************************/ // Get sz chars to the array x. x is supposed allocated @@ -433,10 +429,6 @@ Boolean operator ==(buffer&x, buffer& y) debug(cerr, i); debug(cerr, x_buf[i]); debug(cerr, y_buf[i]); -#ifndef __osf__ - debug(cerr, hex(x_buf[i])); - debug(cerr, hex(y_buf[i])); -#endif //return false; } } @@ -459,8 +451,8 @@ ostream& operator<<(ostream& s, buffer& b) int x = b.v_eptr - b.v_base ; - - for ( int i = 0; i < x; i++ ) { + int i; + for ( i = 0; i < x; i++ ) { s << b.v_base[i]; /* diff --git a/cde/programs/dtinfo/DtMmdb/utility/buffer.h b/cde/programs/dtinfo/DtMmdb/utility/buffer.h index 2cf9f2de0..020b29109 100644 --- a/cde/programs/dtinfo/DtMmdb/utility/buffer.h +++ b/cde/programs/dtinfo/DtMmdb/utility/buffer.h @@ -52,6 +52,7 @@ #define _buffer_h 1 #include +#include #include "utility/funcs.h" class buffer diff --git a/cde/programs/dtinfo/DtMmdb/utility/c_ios.h b/cde/programs/dtinfo/DtMmdb/utility/c_ios.h index f5ba78f68..5ee868407 100644 --- a/cde/programs/dtinfo/DtMmdb/utility/c_ios.h +++ b/cde/programs/dtinfo/DtMmdb/utility/c_ios.h @@ -25,6 +25,7 @@ #ifndef _ios_h #define _ios_h +#include #include "utility/macro.h" #include "utility/c_streambuf.h" @@ -57,7 +58,7 @@ public: void clear() { f_state = OK; }; int operator!() { return fail(); }; - operator void*() { return (void*)good(); }; + operator void*() { return (void*)(size_t)good(); }; }; diff --git a/cde/programs/dtinfo/DtMmdb/utility/c_stream.h b/cde/programs/dtinfo/DtMmdb/utility/c_stream.h index 09ab1a7bc..f38c8ae77 100644 --- a/cde/programs/dtinfo/DtMmdb/utility/c_stream.h +++ b/cde/programs/dtinfo/DtMmdb/utility/c_stream.h @@ -27,6 +27,6 @@ #include "utility/c_streambuf.h" -extern char* form(const char* ...); +extern char* sform(const char* ...); #endif diff --git a/cde/programs/dtinfo/DtMmdb/utility/c_strstream.h b/cde/programs/dtinfo/DtMmdb/utility/c_string.h similarity index 72% rename from cde/programs/dtinfo/DtMmdb/utility/c_strstream.h rename to cde/programs/dtinfo/DtMmdb/utility/c_string.h index b0b2b5985..2fabba255 100644 --- a/cde/programs/dtinfo/DtMmdb/utility/c_strstream.h +++ b/cde/programs/dtinfo/DtMmdb/utility/c_string.h @@ -20,32 +20,27 @@ * to the Free Software Foundation, Inc., 51 Franklin Street, Fifth * Floor, Boston, MA 02110-1301 USA */ -/* $XConsortium: c_strstream.h /main/5 1996/08/21 15:55:22 drk $ */ +/* $XConsortium: c_string.h /main/5 2012/09/18 22:54:47 xxx $ */ -#ifndef _strstream_h -#define _strstream_h +#ifndef _string_h +#define _string_h #include #include "utility/c_iostream.h" +#include "utility/c_charbuf.h" -class istrstream : public istream +class string { public: - istrstream(char* str, int size) ; - istrstream(char* str); - ~istrstream() ; + string(char* str); + string(char* str, int size); + ~string() ; + + char* c_str(); + int size(); + +protected: + streambuf* sbuf; // buffer that provides char sequence read/write }; -class ostrstream : public ostream -{ -public: - ostrstream(char* str, int size, int=ios::out); - ~ostrstream() ; - - int pcount() ; - - char* str(); -}; - - #endif diff --git a/cde/programs/dtinfo/DtMmdb/utility/c_stringstream.h b/cde/programs/dtinfo/DtMmdb/utility/c_stringstream.h new file mode 100644 index 000000000..3c8e7ebd8 --- /dev/null +++ b/cde/programs/dtinfo/DtMmdb/utility/c_stringstream.h @@ -0,0 +1,61 @@ +/* + * CDE - Common Desktop Environment + * + * Copyright (c) 1993-2012, The Open Group. All rights reserved. + * + * These libraries and programs are free software; you can + * redistribute them and/or modify them under the terms of the GNU + * Lesser General Public License as published by the Free Software + * Foundation; either version 2 of the License, or (at your option) + * any later version. + * + * These libraries and programs are distributed in the hope that + * they will be useful, but WITHOUT ANY WARRANTY; without even the + * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR + * PURPOSE. See the GNU Lesser General Public License for more + * details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with these librararies and programs; if not, write + * to the Free Software Foundation, Inc., 51 Franklin Street, Fifth + * Floor, Boston, MA 02110-1301 USA + */ +/* $XConsortium: c_stringstream.h /main/5 1996/08/21 15:55:22 drk $ */ + +#ifndef _strstream_h +#define _strstream_h + +#include +#include "utility/c_iostream.h" +#include "utility/c_string.h" + +#define BUF_INITSZ 4096 + +class istringstream : public istream +{ +public: + istringstream(); + istringstream(char* str); + ~istringstream() ; +}; + +class ostringstream : public ostream +{ +public: + ostringstream(); + ostringstream(char* str, int=ios::out); + ~ostringstream() ; + + string str(); +}; + +class stringstream : public istringstream, public ostringstream +{ +public: + stringstream(); + stringstream(char* str); + virtual ~stringstream() {}; +}; + + +#endif diff --git a/cde/programs/dtinfo/DtMmdb/utility/filebuf.C b/cde/programs/dtinfo/DtMmdb/utility/filebuf.C index c09aacb9a..9e1865ec0 100644 --- a/cde/programs/dtinfo/DtMmdb/utility/filebuf.C +++ b/cde/programs/dtinfo/DtMmdb/utility/filebuf.C @@ -26,7 +26,7 @@ #include #include -#if !defined(hpux) && !defined(__osf__) && !defined(USL) +#if !defined(hpux) && !defined(__osf__) && !defined(USL) && !defined(linux) && !defined(CSRG_BASED) #include #endif diff --git a/cde/programs/dtinfo/DtMmdb/utility/filter.h b/cde/programs/dtinfo/DtMmdb/utility/filter.h index 1c3a5eb33..4c31ea102 100644 --- a/cde/programs/dtinfo/DtMmdb/utility/filter.h +++ b/cde/programs/dtinfo/DtMmdb/utility/filter.h @@ -52,9 +52,9 @@ #define _filter_h 1 #ifdef C_API -#include "utility/c_strstream.h" +#include "utility/c_stringstream.h" #else -#include +#include #endif #include "utility/funcs.h" diff --git a/cde/programs/dtinfo/DtMmdb/utility/funcs.C b/cde/programs/dtinfo/DtMmdb/utility/funcs.C index a837b5919..96e8cfedc 100644 --- a/cde/programs/dtinfo/DtMmdb/utility/funcs.C +++ b/cde/programs/dtinfo/DtMmdb/utility/funcs.C @@ -61,12 +61,15 @@ #if defined(linux) #include +#include #elif defined(_AIX) #include #include #include #else #include +#include +#include #endif #ifdef __osf__ extern "C" @@ -138,24 +141,24 @@ int gethostname(char* name, int namelen) } #endif -int compare_stream(ostrstream& x, ostrstream& y) +int compare_stream(ostringstream& x, ostringstream& y) { - if ( x.pcount() != y.pcount() ) { - cerr << x.pcount() << "---" << y.pcount() << endl; -//debug(cerr, x.str()); -//debug(cerr, y.str()); + if ( x.str().size() != y.str().size() ) { + cerr << x.str().size() << "---" << y.str().size() << endl; +//debug(cerr, x.str().c_str()); +//debug(cerr, y.str().c_str()); return 1; } else { - char* u = x.str(); - char* v = y.str(); + char* u = (char *)x.str().c_str(); + char* v = (char *)y.str().c_str(); //debug(cerr, u); //debug(cerr, v); //fprintf(stderr, "u=%s, pcount() = %d\n", u, x.pcount()); //fprintf(stderr, "v=%s, pcount() = %d\n", v, y.pcount()); - if ( memcmp(u, v, x.pcount()) != 0 ) { + if ( memcmp(u, v, x.str().size()) != 0 ) { STDERR_MESSAGE("two streams do not match."); debug(cerr, u); debug(cerr, v); @@ -208,6 +211,7 @@ int pos_of_LSB(const unsigned int y) //debug(cerr, x); //debug(cerr, hex(x)); + int i; for ( int i =0; i>= 8; @@ -217,7 +221,8 @@ int pos_of_LSB(const unsigned int y) //debug(cerr, i); - for ( int j =1; j<=8; j++ ) + int j; + for ( j =1; j<=8; j++ ) if ( (0x00000001 & x) == 0 ) x >>= 1; else @@ -441,7 +446,7 @@ Boolean check_and_create_dir(const char* path) // create the subdirecties while ( path_tail[0] != 0 && - ( slash_ptr = strchr(path_tail, '/') ) ) { + ( slash_ptr = (char *)strchr(path_tail, '/') ) ) { path_tail = slash_ptr + 1; // set for the next check slash_ptr[0] = 0; // temp. set the slash to 0. @@ -632,6 +637,7 @@ char* time_stamp(_Xctimeparams *ctime_buf) return _XCtime(&x, *ctime_buf); } +#ifdef C_API int bytes(fstream& fs) { struct stat file_info; @@ -651,6 +657,49 @@ int bytes(int fd) else return int(file_info.st_size); } +#else +int bytes(fstream* fs) +{ + streampos begin, current, end; + int total_bytes; + + current = fs->tellg(); + fs->seekg(ios::beg); + begin = fs->tellg(); + fs->seekg(ios::end); + end = fs->tellg(); + fs->seekg(current); + total_bytes = end - begin; + return int(total_bytes); +} +#endif + +int bytes(char * file_name) +{ + struct stat file_info; + + if ( stat( file_name, &file_info) != 0 ) + return 0; + else + return int(file_info.st_size); +} + +char* form(const char* fmt, ...) +{ + static char formbuf[BUFSIZ]; + char tempbuf[BUFSIZ]; + va_list args; + + va_start(args, fmt); + + strcpy(tempbuf, formbuf); + (void) vsprintf(tempbuf, fmt, args); + + va_end(args); + + strcpy(formbuf, tempbuf); + return formbuf; +} static char info_buf[BUFSIZ]; @@ -685,9 +734,8 @@ char* access_info( char* request ) char userid[L_cuserid]; #ifndef SVR4 - sprintf(info_buf, "%s-%s-%s-%ld-%s-%s", + sprintf(info_buf, "%s-%s-%ld-%s-%s", host_name, dm_name, - ( cuserid(userid)[0] == 0 ) ? "???" : userid, /* getenv("USER"), */ (long)getpid(), x, request ); @@ -725,7 +773,7 @@ Boolean cc_is_digit(istream& in) unsigned long disk_space(const char* path) { -#if defined(__osf__) || defined (hpux) || defined (SVR4) +#if defined(__osf__) || defined (hpux) || defined (SVR4) || defined(CSRG_BASED) struct statvfs statfs_buf; #else struct statfs statfs_buf; @@ -733,7 +781,7 @@ unsigned long disk_space(const char* path) long free_bytes; -#if defined(__osf__) || defined (hpux) || defined (SVR4) +#if defined(__osf__) || defined (hpux) || defined (SVR4) || defined(CSRG_BASED) if ( statvfs(path, &statfs_buf) == 0 ) { free_bytes = statfs_buf.f_bavail * statfs_buf.f_frsize ; #else @@ -754,8 +802,8 @@ Boolean writeToTmpFile(char* unique_nm, char* str, int size) fstream *out = 0; char* tmp_dir_tbl[4]; tmp_dir_tbl[0] = getenv("TMPDIR"); - tmp_dir_tbl[1] = "/tmp"; - tmp_dir_tbl[2] = "/usr/tmp"; + tmp_dir_tbl[1] = (char*)"/tmp"; + tmp_dir_tbl[2] = (char*)"/usr/tmp"; tmp_dir_tbl[3] = getenv("HOME"); int tmp_dir_tbl_size = 4; @@ -769,7 +817,7 @@ Boolean writeToTmpFile(char* unique_nm, char* str, int size) strcpy(unique_nm, form("%s/tmp.%s", tmp_dir_tbl[i], uid)); - try { + mtry { //debug(cerr, tmp_dir_tbl[i]); //debug(cerr, disk_space(tmp_dir_tbl[i])); if ( disk_space(tmp_dir_tbl[i]) <= size ) @@ -795,7 +843,7 @@ Boolean writeToTmpFile(char* unique_nm, char* str, int size) } } - catch_any() + mcatch_any() { continue; } diff --git a/cde/programs/dtinfo/DtMmdb/utility/funcs.h b/cde/programs/dtinfo/DtMmdb/utility/funcs.h index 3c1a54d67..f46a04d87 100644 --- a/cde/programs/dtinfo/DtMmdb/utility/funcs.h +++ b/cde/programs/dtinfo/DtMmdb/utility/funcs.h @@ -52,10 +52,12 @@ #ifndef _funcs_h #define _funcs_h 1 -#if !defined(USL) && !defined(__osf__) +#if !defined(USL) && !defined(__osf__) && !defined(linux) && \ + !defined(CSRG_BASED) #include #endif -#if defined(hpux) || defined(sgi) || defined(USL) ||defined(__osf__) +#if defined(hpux) || defined(sgi) || defined(USL) ||defined(__osf__) || \ + defined(linux) || defined(CSRG_BASED) #include #else #include @@ -69,12 +71,13 @@ #ifdef C_API #include "utility/c_stream.h" #include "utility/c_fstream.h" -#include "utility/c_strstream.h" +#include "utility/c_stringstream.h" #else #include -#include -#include -#include +#include +#include +#include +using namespace std; #endif #include @@ -109,7 +112,9 @@ extern int strncasecmp(const char *, const char *, size_t); int gethostname(char* name, int namelen); #endif -int compare_stream(ostrstream& x, ostrstream& y); +int compare_stream(ostringstream& x, ostringstream& y); + +char * cuserid(char *s); inline float flog2(unsigned int x) { @@ -195,8 +200,8 @@ int open_dir_prot(); Boolean cc_is_digit(istream&); // "cc" stands for current char -int bytes(fstream&); unsigned long disk_space(const char* path); +char* access_info( char* request ); Boolean int_eq(void*, void*); Boolean int_ls(void*, void*); @@ -217,8 +222,15 @@ Boolean timed_unlock( int fd, int seconds = 5); void onalarm(int); */ +#ifdef C_API int bytes(int fd); -char* access_info( char* request ); +int bytes(fstream&); +#else +int bytes(fstream*); +#endif +int bytes(char* file_name); + +char* form(const char* ...); // lsb is considered as the 0th bit void lsb_putbits(unsigned& target, unsigned position_from_lsb, diff --git a/cde/programs/dtinfo/DtMmdb/utility/ios.C b/cde/programs/dtinfo/DtMmdb/utility/ios.C index 2196a5331..ba87e3536 100644 --- a/cde/programs/dtinfo/DtMmdb/utility/ios.C +++ b/cde/programs/dtinfo/DtMmdb/utility/ios.C @@ -22,9 +22,9 @@ */ // $XConsortium: ios.C /main/4 1996/08/21 15:54:46 drk $ -#include "utility/c_ios.h" #include #include +#include "utility/c_ios.h" ios::ios(streambuf* sb) : sbuf(sb), f_state(OK) { diff --git a/cde/programs/dtinfo/DtMmdb/utility/iostream.C b/cde/programs/dtinfo/DtMmdb/utility/iostream.C index 759e0273e..a7932b560 100644 --- a/cde/programs/dtinfo/DtMmdb/utility/iostream.C +++ b/cde/programs/dtinfo/DtMmdb/utility/iostream.C @@ -83,7 +83,8 @@ istream& istream::_getline(char* b, int lim, int delim, int fill_zero) int i; - for ( int count = 0 ; count < lim-1; count++ ) { + int count; + for ( count = 0 ; count < lim-1; count++ ) { i = sbuf -> get(); diff --git a/cde/programs/dtinfo/DtMmdb/utility/mmdb_exception.C b/cde/programs/dtinfo/DtMmdb/utility/mmdb_exception.C index 7e4b114db..519e0daa5 100644 --- a/cde/programs/dtinfo/DtMmdb/utility/mmdb_exception.C +++ b/cde/programs/dtinfo/DtMmdb/utility/mmdb_exception.C @@ -78,7 +78,7 @@ ostream& boundaryException::asciiOut(ostream& out) { cerr << low << "\t"; cerr << high << "\t"; - cerr << index << "\n"; + cerr << mindex << "\n"; return out; } diff --git a/cde/programs/dtinfo/DtMmdb/utility/mmdb_exception.h b/cde/programs/dtinfo/DtMmdb/utility/mmdb_exception.h index 4b7bbf144..e1aa01ce0 100644 --- a/cde/programs/dtinfo/DtMmdb/utility/mmdb_exception.h +++ b/cde/programs/dtinfo/DtMmdb/utility/mmdb_exception.h @@ -56,7 +56,9 @@ #ifdef C_API #include "utility/c_fstream.h" #else -#include +#include +#include +using namespace std; #endif #define END_TRY end_try @@ -90,7 +92,7 @@ protected: public: DECLARE_EXCEPTION(stringException, mmdbException); - stringException(char* m) : msg(m) {}; + stringException(char const* m) : msg((char*)m) {}; ~stringException() {}; virtual ostream& asciiOut(ostream&); @@ -104,7 +106,7 @@ protected: public: DECLARE_EXCEPTION(formatException, stringException); - formatException(char* m) : stringException(m) {}; + formatException(char const* m) : stringException(m) {}; ~formatException() {}; }; @@ -155,13 +157,13 @@ class boundaryException : public mmdbException protected: long low; long high; - long index; + long mindex; public: DECLARE_EXCEPTION(boundaryException, mmdbException); boundaryException(long l, long h, long i) : - low(l), high(h), index(i) {}; + low(l), high(h), mindex(i) {}; ~boundaryException() {}; virtual ostream& asciiOut(ostream&); diff --git a/cde/programs/dtinfo/DtMmdb/utility/ostring.C b/cde/programs/dtinfo/DtMmdb/utility/ostring.C index d4dd78d29..0e931ec4a 100644 --- a/cde/programs/dtinfo/DtMmdb/utility/ostring.C +++ b/cde/programs/dtinfo/DtMmdb/utility/ostring.C @@ -203,7 +203,8 @@ ostring& ostring::operator +(ostring& s) ostring *new_ostring = new ostring(l1+l2); - for ( int i = 0; i #include -#include +#include +using namespace std; #define BUFSIZ 1000 diff --git a/cde/programs/dtinfo/DtMmdb/utility/randomize.C b/cde/programs/dtinfo/DtMmdb/utility/randomize.C index 82f74a906..3a5542c92 100644 --- a/cde/programs/dtinfo/DtMmdb/utility/randomize.C +++ b/cde/programs/dtinfo/DtMmdb/utility/randomize.C @@ -44,7 +44,8 @@ void randomize::restore(buffer& scrambled) int *pos = new int[bytes-1]; - for ( int i=0; i fd()); +#else + offset = bytes(ai_info); +#endif x << "A-" << reader_info << "\n"; x.close(); @@ -89,7 +93,11 @@ Boolean read_lock(char* lock_file_path, throw(streamException(x.rdstate())); } +#ifdef C_API int sz = bytes(x.rdbuf() -> fd()); +#else + int sz = bytes(ai_info); +#endif ai_info = new char[sz+1]; ai_info[0] = 0; @@ -134,7 +142,11 @@ Boolean read_unlock(char* lock_file_path, char* ai_path, int offset) // and the file size is over 1k /////////////////////////////////////////////// +#ifdef C_API if ( bytes(x.rdbuf() -> fd()) > 1024 ) { +#else + if ( bytes(ai_path) > 1024 ) { +#endif ok = false; char buf[BUFSIZ]; @@ -172,6 +184,7 @@ Boolean write_lock(char* lock_file_path, char*& ai_info ) { + int ret; atomic_lock l(lock_file_path); if ( l.lock() == false ) { @@ -190,7 +203,11 @@ Boolean write_lock(char* lock_file_path, char buf[BUFSIZ]; +#ifdef C_API int sz = bytes(x.rdbuf() -> fd()); +#else + int sz = bytes(ai_path); +#endif ai_info = new char[sz+1]; ai_info[0] = 0; @@ -215,7 +232,7 @@ Boolean write_lock(char* lock_file_path, ///////////////////////////////////////// // create the access info file ///////////////////////////////////////// - truncate(ai_path, 0); + ret = truncate(ai_path, 0); fstream x(ai_path, ios::out); x << "A-" << writer_info << "\n"; diff --git a/cde/programs/dtinfo/DtMmdb/utility/stream.C b/cde/programs/dtinfo/DtMmdb/utility/stream.C index 8f0220780..3447e68f5 100644 --- a/cde/programs/dtinfo/DtMmdb/utility/stream.C +++ b/cde/programs/dtinfo/DtMmdb/utility/stream.C @@ -27,7 +27,7 @@ #include "utility/c_stream.h" -char* form(const char* fmt ...) +char* sform(const char* fmt ...) { static char buf[1024]; diff --git a/cde/programs/dtinfo/DtMmdb/utility/streambuf.C b/cde/programs/dtinfo/DtMmdb/utility/streambuf.C index edf88813d..832087d0d 100644 --- a/cde/programs/dtinfo/DtMmdb/utility/streambuf.C +++ b/cde/programs/dtinfo/DtMmdb/utility/streambuf.C @@ -23,12 +23,10 @@ /* $XConsortium: streambuf.C /main/8 1996/08/21 15:55:14 drk $ */ #include "utility/c_streambuf.h" -#if !defined(USL) && !defined(__osf__) -#include -#endif - -#if defined(USL) || defined(__osf__) +#if defined(USL) || defined(__osf__) || defined(linux) || defined(CSRG_BASED) #include +#else +#include #endif #define DEF_BUF_SIZ 4096 diff --git a/cde/programs/dtinfo/DtMmdb/utility/strstream.C b/cde/programs/dtinfo/DtMmdb/utility/string.C similarity index 64% rename from cde/programs/dtinfo/DtMmdb/utility/strstream.C rename to cde/programs/dtinfo/DtMmdb/utility/string.C index f706ce2db..e5baf2c57 100644 --- a/cde/programs/dtinfo/DtMmdb/utility/strstream.C +++ b/cde/programs/dtinfo/DtMmdb/utility/string.C @@ -20,51 +20,35 @@ * to the Free Software Foundation, Inc., 51 Franklin Street, Fifth * Floor, Boston, MA 02110-1301 USA */ -// $XConsortium: strstream.C /main/5 1996/08/21 15:55:17 drk $ +// $XConsortium: string.C /main/5 2012/09/18 22:56:32 xxx $ -#include "utility/c_strstream.h" +#include "utility/c_string.h" #include "utility/c_charbuf.h" #include -istrstream::istrstream(char* str) : - //ios(new charbuf(str, strlen(str))), istream(0) - istream(0) +string::string(char* str) { sbuf = new charbuf(str, strlen(str), 1); } -istrstream::istrstream(char* str, int size ) : - //istream(new charbuf(str, size)) - istream(0) -{ - sbuf = new charbuf(str, size, 1); -} - -istrstream::~istrstream() -{ -} - -ostrstream::ostrstream(char* str, int size, int) : - //ios(new charbuf(str, size)), ostream(0) - ostream(0) +string::string(char* str, int size) { sbuf = new charbuf(str, size); } -ostrstream::~ostrstream() +string::~string() { } -char* ostrstream::str() +char* string::c_str() { char* x = sbuf -> get_buf(); - x[pcount()] = 0; +// x[pcount()] = 0; return x; } -int ostrstream::pcount() +int string::size() { - int x = sbuf -> pcount(); - return x; + char* x = sbuf -> get_buf(); + return(strlen(x)); } - diff --git a/cde/programs/dtinfo/DtMmdb/utility/stringstream.C b/cde/programs/dtinfo/DtMmdb/utility/stringstream.C new file mode 100644 index 000000000..66b48dfd9 --- /dev/null +++ b/cde/programs/dtinfo/DtMmdb/utility/stringstream.C @@ -0,0 +1,77 @@ +/* + * CDE - Common Desktop Environment + * + * Copyright (c) 1993-2012, The Open Group. All rights reserved. + * + * These libraries and programs are free software; you can + * redistribute them and/or modify them under the terms of the GNU + * Lesser General Public License as published by the Free Software + * Foundation; either version 2 of the License, or (at your option) + * any later version. + * + * These libraries and programs are distributed in the hope that + * they will be useful, but WITHOUT ANY WARRANTY; without even the + * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR + * PURPOSE. See the GNU Lesser General Public License for more + * details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with these librararies and programs; if not, write + * to the Free Software Foundation, Inc., 51 Franklin Street, Fifth + * Floor, Boston, MA 02110-1301 USA + */ +// $XConsortium: stringstream.C /main/5 1996/08/21 15:55:17 drk $ + +#include "utility/c_stringstream.h" +#include "utility/c_charbuf.h" +#include + +istringstream::istringstream() : istream(0) +{ + char str[BUF_INITSZ]; + sbuf = new charbuf(str, strlen(str), 1); +} + +istringstream::istringstream(char* str) : + //ios(new charbuf(str, strlen(str))), istream(0) + istream(0) +{ + sbuf = new charbuf(str, strlen(str), 1); +} + +istringstream::~istringstream() +{ +} + +ostringstream::ostringstream() : ostream(0) +{ + char str[BUF_INITSZ]; + sbuf = new charbuf(str, strlen(str)); +} + +ostringstream::ostringstream(char* str, int) : + //ios(new charbuf(str, size)), ostream(0) + ostream(0) +{ + sbuf = new charbuf(str, strlen(str)); +} + +ostringstream::~ostringstream() +{ +} + +string ostringstream::str() +{ + string x = sbuf -> get_buf(); +// x[pcount()] = 0; + return x; +} + +stringstream::stringstream() : istringstream(), ostringstream() +{ +} + +stringstream::stringstream(char* str) : istringstream(str), ostringstream(str) +{ + sbuf = new charbuf(str, strlen(str)); +} diff --git a/cde/programs/dtinfo/DtMmdb/utility/tst_filebuf.C b/cde/programs/dtinfo/DtMmdb/utility/tst_filebuf.C index 60bff3f12..dc5b8e1a6 100644 --- a/cde/programs/dtinfo/DtMmdb/utility/tst_filebuf.C +++ b/cde/programs/dtinfo/DtMmdb/utility/tst_filebuf.C @@ -22,7 +22,8 @@ */ // $XConsortium: tst_filebuf.C /main/4 1996/08/21 15:55:25 drk $ -#include +#include +using namespace std; #include "utility/debug.h" #include "utility/c_fstream.h" diff --git a/cde/programs/dtinfo/DtMmdb/utility/tst_streambuf.C b/cde/programs/dtinfo/DtMmdb/utility/tst_streambuf.C index 7fa9ee5a7..b6bd0e30a 100644 --- a/cde/programs/dtinfo/DtMmdb/utility/tst_streambuf.C +++ b/cde/programs/dtinfo/DtMmdb/utility/tst_streambuf.C @@ -22,7 +22,8 @@ */ // $XConsortium: tst_streambuf.C /main/4 1996/08/21 15:55:40 drk $ -#include +#include +using namespace std; #include "utility/debug.h" #include "utility/c_charbuf.h" diff --git a/cde/programs/dtinfo/DtMmdb/utility/tst_strstream.C b/cde/programs/dtinfo/DtMmdb/utility/tst_strstream.C index 9231d180b..672d9dea8 100644 --- a/cde/programs/dtinfo/DtMmdb/utility/tst_strstream.C +++ b/cde/programs/dtinfo/DtMmdb/utility/tst_strstream.C @@ -24,20 +24,20 @@ #include -#include "utility/c_strstream.h" +#include "utility/c_stringstream.h" -tst_ostrstream() +tst_ostringstream() { char buf[1024]; - ostrstream os(buf, 1024); + ostringstream os(buf, 1024); os << "istream : virtual public ios."; fprintf(stderr, "buf=%s\n", buf); } -tst_istrstream() +tst_istringstream() { char* buf = "303.0"; - istrstream is(buf, strlen(buf)); + istringstream is(buf, strlen(buf)); int c = is.get() ; fprintf(stderr, "c=%c\n", c); @@ -51,6 +51,6 @@ tst_istrstream() main() { - tst_ostrstream(); - tst_istrstream(); + tst_ostringstream(); + tst_istringstream(); } diff --git a/cde/programs/dtinfo/DtMmdb/utility/types.h b/cde/programs/dtinfo/DtMmdb/utility/types.h index ee0b9ea76..1a319c6eb 100644 --- a/cde/programs/dtinfo/DtMmdb/utility/types.h +++ b/cde/programs/dtinfo/DtMmdb/utility/types.h @@ -49,7 +49,8 @@ #ifdef C_API #include "utility/c_iostream.h" #else -#include +#include +using namespace std; #endif #define true 1 diff --git a/cde/programs/dtinfo/DtMmdb/utility/xclock.h b/cde/programs/dtinfo/DtMmdb/utility/xclock.h index 2496cc50d..d9a03bdee 100644 --- a/cde/programs/dtinfo/DtMmdb/utility/xclock.h +++ b/cde/programs/dtinfo/DtMmdb/utility/xclock.h @@ -59,7 +59,7 @@ #ifdef C_API #include "utility/c_stream.h" #else -#include +#include #endif #include "utility/funcs.h" diff --git a/cde/programs/dtinfo/DtMmdb/utility/xtime.h b/cde/programs/dtinfo/DtMmdb/utility/xtime.h index e23b7418c..afed1fc0a 100644 --- a/cde/programs/dtinfo/DtMmdb/utility/xtime.h +++ b/cde/programs/dtinfo/DtMmdb/utility/xtime.h @@ -56,7 +56,6 @@ #include #include #include -#include #include "funcs.h"