1
0
Fork 0
mirror of git://git.code.sf.net/p/cdesktopenv/code synced 2025-02-15 04:32:24 +00:00

dtinfo subtree DtMmdb

This commit is contained in:
Ulrich Wilkens 2012-10-14 15:38:27 +02:00 committed by Jon Trulson
parent b92cf08899
commit 8c8363f4a5
184 changed files with 1090 additions and 773 deletions

View file

@ -37,11 +37,7 @@ public:
DECLARE_EXCEPTION(hardCopyRendererException, Exception); DECLARE_EXCEPTION(hardCopyRendererException, Exception);
}; };
#if defined(linux)
#define CASTHCREXCEPT (hardCopyRendererException*)
#else
#define CASTHCREXCEPT #define CASTHCREXCEPT
#endif
#endif /* _FPExceptions_h */ #endif /* _FPExceptions_h */
/* DO NOT ADD ANY LINES AFTER THIS #endif */ /* DO NOT ADD ANY LINES AFTER THIS #endif */

View file

@ -186,7 +186,7 @@ featureProcessor::getFeatureValueArray(const Feature* f)
if ( f -> value() -> type() == FeatureValue::array ) if ( f -> value() -> type() == FeatureValue::array )
return (FeatureValueArray*)(f -> value()); return (FeatureValueArray*)(f -> value());
else { 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()); throw(CASTHCREXCEPT hardCopyRendererException());
} }
} else } else

View file

@ -25,13 +25,15 @@
#ifndef _fp_h #ifndef _fp_h
#define _fp_h 1 #define _fp_h 1
#include <iostream.h> #include <iostream>
using namespace std;
#include "FPExceptions.h" #include "FPExceptions.h"
#include "StyleSheet/Feature.h" #include "StyleSheet/Feature.h"
#include "StyleSheet/FeatureValue.h" #include "StyleSheet/FeatureValue.h"
#include "StyleSheet/Element.h" #include "StyleSheet/Element.h"
#include "StyleSheet/Const.h" #include "StyleSheet/Const.h"
#include "StyleSheet/Debug.h" #include "StyleSheet/Debug.h"
#include "utility/funcs.h"
enum BLOCK_MODE { NON_BLOCK, BLOCK }; enum BLOCK_MODE { NON_BLOCK, BLOCK };
extern enum BLOCK_MODE g_block_mode; extern enum BLOCK_MODE g_block_mode;

View file

@ -23,7 +23,11 @@
// $TOG: autoNumber.C /main/6 1998/04/17 11:47:13 mgreess $ // $TOG: autoNumber.C /main/6 1998/04/17 11:47:13 mgreess $
#include <ctype.h> #include <ctype.h>
#if defined(CSRG_BASED)
#define MAXINT INT_MAX
#else
#include <values.h> #include <values.h>
#endif
#include "HardCopy/autoNumber.h" #include "HardCopy/autoNumber.h"
#include "HardCopy/FPExceptions.h" #include "HardCopy/FPExceptions.h"
@ -137,7 +141,7 @@ autoNumberNumeric::getValue()
char* ptr = f_buf.get_base(); char* ptr = f_buf.get_base();
if (f_values.entries()) 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 else
*ptr = 0; *ptr = 0;
@ -291,10 +295,12 @@ const char* autoNumberAlphabetic::intToAlpha(int x, enum CaseType a_case)
x = z; x = z;
} }
for (int k=0; k<digits-i; k++ ) int k;
for (k=0; k<digits-i; k++ )
buf[k] = letters[0]; buf[k] = letters[0];
for (int n=0; n<i; n++ ) int n;
for (n=0; n<i; n++ )
buf[k+n] = buf1[n]; buf[k+n] = buf1[n];
buf[k+n] = 0; buf[k+n] = 0;
@ -317,7 +323,7 @@ const char* autoNumberAlphabetic::getValue()
char* ptr = f_buf.get_base(); char* ptr = f_buf.get_base();
if (f_values.entries()) if (f_values.entries())
sprintf(ptr, form("%s%s%s", f_prefix, sprintf(ptr, "%s", form("%s%s%s", f_prefix,
intToAlpha(f_values.top(), f_case), f_postfix)); intToAlpha(f_values.top(), f_case), f_postfix));
else else
*ptr = 0; *ptr = 0;
@ -481,13 +487,14 @@ autoNumberRoman::ArabicToRoman(int x)
const char* romanCardinal = romanCardinals[j][buf[i]-'1']; const char* romanCardinal = romanCardinals[j][buf[i]-'1'];
char precise_romanCardinal[8]; char precise_romanCardinal[8];
int k;
if (f_case == UPPER) { if (f_case == UPPER) {
for (int k=0; romanCardinal[k]; k++) for (k=0; romanCardinal[k]; k++)
precise_romanCardinal[k] = romanCardinal[k]; precise_romanCardinal[k] = romanCardinal[k];
precise_romanCardinal[k] = 0; precise_romanCardinal[k] = 0;
} }
else { else {
for (int k=0; romanCardinal[k]; k++) for (k=0; romanCardinal[k]; k++)
precise_romanCardinal[k] = tolower(romanCardinal[k]); precise_romanCardinal[k] = tolower(romanCardinal[k]);
precise_romanCardinal[k] = 0; precise_romanCardinal[k] = 0;
} }

View file

@ -284,7 +284,8 @@ autoNumberFP::defineAutoNumber(const char* nm, const FeatureValue* f)
const char* gi = 0; const char* gi = 0;
autoNumberListT* anList = 0; autoNumberListT* anList = 0;
for (int i=0; i<controlList -> length(); i++ ) { int i;
for (i=0; i<controlList -> length(); i++ ) {
gi = stringToCharPtr((*controlList)[i]); gi = stringToCharPtr((*controlList)[i]);
key = new CC_String(gi); key = new CC_String(gi);
@ -353,11 +354,11 @@ autoNumberFP::accept(const char* name, const Expression* expr)
{ {
FeatureValue* fv = 0; FeatureValue* fv = 0;
try mtry
{ {
fv = expr -> evaluate(); fv = expr -> evaluate();
} }
catch_any() mcatch_any()
{ {
return false; return false;
} }

View file

@ -54,6 +54,13 @@ DONES = \
EXTRALIBRARYDEPS = $(DONES) EXTRALIBRARYDEPS = $(DONES)
XCOMM redefine TopLevelProject to build DtInfo with standard CDE config dir
#undef TopLevelProject
#define TopLevelProject DtInfo
IMAKE_DEFINES = -DTopLevelProject=TopLevelProject \
-DProjectTmplFile='<DtInfo.tmpl>' \
-DProjectRulesFile='<DtInfo.rules>'
MakeSubdirs($(SUBDIRS)) MakeSubdirs($(SUBDIRS))
ForceSubdirs($(SUBDIRS)) ForceSubdirs($(SUBDIRS))
DependSubdirs($(SUBDIRS)) DependSubdirs($(SUBDIRS))
@ -201,8 +208,8 @@ UTILITY_OBJS = \
utility/filter.o utility/mmdb_exception.o \ utility/filter.o utility/mmdb_exception.o \
utility/randomize.o \ utility/randomize.o \
utility/streambuf.o utility/charbuf.o utility/filebuf.o \ utility/streambuf.o utility/charbuf.o utility/filebuf.o \
utility/strstream.o utility/iostream.o utility/fstream.o \ utility/stringstream.o utility/iostream.o utility/fstream.o \
utility/stream.o utility/ios.o utility/stream.o utility/string.o utility/ios.o
OBJS = $(API_OBJS) $(BTREE_OBJS) \ OBJS = $(API_OBJS) $(BTREE_OBJS) \
@ -221,4 +228,8 @@ DYNAMIC =
#include <Library.tmpl> #include <Library.tmpl>
XCOMM Variables to switch on debug mode temporarily
XCOMM CDEBUGFLAGS = -g -DDEBUG
XCOMM CXXDEBUGFLAGS = -g -DDEBUG
DependTarget() DependTarget()

View file

@ -38,6 +38,7 @@ Attribute::~Attribute()
delete f_value ; delete f_value ;
} }
bool
Attribute::operator==(const Attribute &attr) const Attribute::operator==(const Attribute &attr) const
{ {
/* /*

View file

@ -39,7 +39,7 @@ public:
~Attribute(); ~Attribute();
const Symbol &name() const { return f_name; } const Symbol &name() const { return f_name; }
operator==(const Attribute &) const ; bool operator==(const Attribute &) const ;
const char *value() const { return f_value ; } const char *value() const { return f_value ; }

View file

@ -25,7 +25,9 @@
#ifndef _BitVector_h #ifndef _BitVector_h
#define _BitVector_h 1 #define _BitVector_h 1
#include <stream.h> #include <sstream>
#include <ostream>
using namespace std;
#ifndef CDE_NEXT #ifndef CDE_NEXT

View file

@ -46,7 +46,8 @@
#ifndef _debug_h #ifndef _debug_h
#define _debug_h 1 #define _debug_h 1
#include <iostream.h> #include <iostream>
using namespace std;
#ifdef DEBUG #ifdef DEBUG
#define ON_DEBUG(stmt) stmt #define ON_DEBUG(stmt) stmt

View file

@ -52,7 +52,7 @@ DocParser::DocParser(Resolver &r)
f_buffer(new char[DATA_BUF_SIZ]), f_buffer(new char[DATA_BUF_SIZ]),
f_output(f_buffer, DATA_BUF_SIZ) f_output(f_buffer, DATA_BUF_SIZ)
#else #else
f_streambuf(new strstreambuf(DATA_BUF_SIZ)), f_streambuf(new stringbuf()),
f_output(f_streambuf) f_output(f_streambuf)
#endif #endif
{ {
@ -93,7 +93,7 @@ DocParser::rawParse(istream &input)
Symbol name(gElemSymTab->intern(terminate(f_output).str())); Symbol name(gElemSymTab->intern(terminate(f_output).str()));
f_output.rdbuf()->freeze(0); f_output.rdbuf()->freeze(0);
#else #else
char *data = f_streambuf->str(); char *data = (char *)f_streambuf->str().c_str();
/* /*
MESSAGE(cerr, "StartTag case:"); MESSAGE(cerr, "StartTag case:");
@ -102,9 +102,8 @@ debug(cerr, data);
*/ */
#if !defined(SC3) && !defined(__osf__) #if !defined(SC3) && !defined(__osf__)
data[f_streambuf->pcount()] = 0; data[f_streambuf->str().size()] = 0;
#endif #endif
f_streambuf->freeze(0);
Symbol name(gElemSymTab->intern(data)); Symbol name(gElemSymTab->intern(data));
#endif #endif
process(input, f_output, name, 1, 1); process(input, f_output, name, 1, 1);
@ -161,7 +160,7 @@ DocParser::process(istream &input, ostream &output,
int ignore = 0 ; int ignore = 0 ;
try mtry
{ {
// process whatever comes right after start tag // process whatever comes right after start tag
TagType tt = read_tag(input, output); 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); process(input, output, name, child++, child_relative_sibling_number);
#else #else
char *data = f_streambuf->str(); char *data = (char *)f_streambuf->str().c_str();
#if !defined(SC3) && !defined(__osf__) #if !defined(SC3) && !defined(__osf__)
data[f_streambuf->pcount()] = 0; data[f_streambuf->str().size()] = 0;
#endif #endif
Symbol name(gElemSymTab->intern(data)); Symbol name(gElemSymTab->intern(data));
update_last_seen_child_name(last_seen_child_name, update_last_seen_child_name(last_seen_child_name,
child_relative_sibling_number, name); child_relative_sibling_number, name);
f_streambuf->freeze(0);
process(input, output, name, process(input, output, name,
child++, child_relative_sibling_number); child++, child_relative_sibling_number);
#endif #endif
@ -216,12 +214,11 @@ DocParser::process(istream &input, ostream &output,
char *data = terminate(f_output).str(); char *data = terminate(f_output).str();
f_output.rdbuf()->freeze(0); f_output.rdbuf()->freeze(0);
#else #else
char *data = f_streambuf->str(); char *data = (char*)f_streambuf->str().c_str();
//#ifdef _IBMR2 //#ifdef _IBMR2
#if !defined(SC3) && !defined(__osf__) #if !defined(SC3) && !defined(__osf__)
data[f_streambuf->pcount()] = 0; data[f_streambuf->str().size()] = 0;
#endif #endif
f_streambuf->freeze(0);
#endif #endif
cerr << "EndTag: " << data << endl; cerr << "EndTag: " << data << endl;
assert(gElemSymTab->intern(data) == name); assert(gElemSymTab->intern(data) == name);
@ -246,7 +243,8 @@ DocParser::process(istream &input, ostream &output,
!defined(_IBMR2) && \ !defined(_IBMR2) && \
!defined(__uxp__) && \ !defined(__uxp__) && \
!defined(USL) && \ !defined(USL) && \
!defined(linux) !defined(linux) && \
!defined(CSRG_BASED)
volatile volatile
#endif #endif
AttributeList *attrs = 0; AttributeList *attrs = 0;
@ -255,12 +253,13 @@ DocParser::process(istream &input, ostream &output,
!defined(_IBMR2) && \ !defined(_IBMR2) && \
!defined(__uxp__) && \ !defined(__uxp__) && \
!defined(USL) && \ !defined(USL) && \
!defined(linux) !defined(linux) && \
!defined(CSRG_BASED)
volatile volatile
#endif #endif
AttributeList *olias_attrs = 0; AttributeList *olias_attrs = 0;
try mtry
{ {
process_attributes(input, output, attrs, olias_attrs); process_attributes(input, output, attrs, olias_attrs);
@ -278,7 +277,7 @@ DocParser::process(istream &input, ostream &output,
f_ignoring_element = ignore ; f_ignoring_element = ignore ;
} }
} }
catch_any() mcatch_any()
{ {
/* /*
delete attrs ; delete attrs ;
@ -318,16 +317,15 @@ DocParser::process(istream &input, ostream &output,
f_resolver.data(string, size); f_resolver.data(string, size);
f_output.rdbuf()->freeze(0); f_output.rdbuf()->freeze(0);
#else #else
char *string = f_streambuf->str(); char *string = (char *)f_streambuf->str().c_str();
//#ifdef _IBMR2 //#ifdef _IBMR2
#if !defined(SC3) && !defined(__osf__) #if !defined(SC3) && !defined(__osf__)
string[f_streambuf->pcount()] = 0; string[f_streambuf->str().size()] = 0;
int size = f_streambuf->pcount() ; int size = f_streambuf->str().size() ;
#else #else
int size = f_streambuf->pcount() - 1 ; int size = f_streambuf->pcount() - 1 ;
#endif #endif
f_resolver.data(string, size); f_resolver.data(string, size);
f_streambuf->freeze(0); // unfreeze buffer frozen by str() call
#endif #endif
} }
} }
@ -347,12 +345,11 @@ DocParser::process(istream &input, ostream &output,
*(data + f_output.pcount()) = 0; *(data + f_output.pcount()) = 0;
f_output.rdbuf()->freeze(0); f_output.rdbuf()->freeze(0);
#else #else
char *data = f_streambuf->str(); char *data = (char *)f_streambuf->str().c_str();
//#ifdef _IBMR2 //#ifdef _IBMR2
#if !defined(SC3) && !defined(__osf__) #if !defined(SC3) && !defined(__osf__)
data[f_streambuf->pcount ()] = 0; data[f_streambuf->str().size()] = 0;
#endif #endif
f_streambuf->freeze(0);
#endif #endif
/* /*
@ -391,16 +388,15 @@ debug(cerr, f_streambuf->pcount ());
f_resolver.data(string, size); f_resolver.data(string, size);
f_output.rdbuf()->freeze(0); f_output.rdbuf()->freeze(0);
#else #else
char *string = f_streambuf->str(); char *string = (char *)f_streambuf->str().c_str();
//#ifdef _IBMR2 //#ifdef _IBMR2
#if !defined(SC3) && !defined(__osf__) #if !defined(SC3) && !defined(__osf__)
string[f_streambuf->pcount()] = 0; string[f_streambuf->str().size()] = 0;
int size = f_streambuf->pcount() ; int size = f_streambuf->str().size() ;
#else #else
int size = f_streambuf->pcount() - 1 ; int size = f_streambuf->pcount() - 1 ;
#endif #endif
f_resolver.data(string, size); f_resolver.data(string, size);
f_streambuf->freeze(0); // unfreeze buffer frozen by str() call
#endif #endif
} }
} }
@ -411,12 +407,11 @@ debug(cerr, f_streambuf->pcount ());
char *data = terminate(f_output).str(); char *data = terminate(f_output).str();
f_output.rdbuf()->freeze(0); f_output.rdbuf()->freeze(0);
#else #else
char *data = f_streambuf->str(); char *data = (char*)f_streambuf->str().c_str();
//#ifdef _IBMR2 //#ifdef _IBMR2
#if !defined(SC3) && !defined(__osf__) #if !defined(SC3) && !defined(__osf__)
data[f_streambuf->pcount ()] = 0; data[f_streambuf->str().size()] = 0;
#endif #endif
f_streambuf->freeze(0);
#endif #endif
cerr << "EndTag: " << data << endl; cerr << "EndTag: " << data << endl;
assert(gElemSymTab->intern(data) == name); assert(gElemSymTab->intern(data) == name);
@ -430,7 +425,7 @@ debug(cerr, f_streambuf->pcount ());
if (ignore) if (ignore)
f_ignoring_element = 0; f_ignoring_element = 0;
} }
catch_any() mcatch_any()
{ {
rethrow; rethrow;
} }
@ -454,7 +449,7 @@ DocParser::process_attributes(istream &input, ostream &output,
char *theData = 0; char *theData = 0;
try { mtry {
while ((tt = read_tag(input,output)) != NoTag) while ((tt = read_tag(input,output)) != NoTag)
{ {
switch (tt) switch (tt)
@ -463,8 +458,8 @@ DocParser::process_attributes(istream &input, ostream &output,
{ {
//#ifdef _IBMR2 //#ifdef _IBMR2
#if !defined(SC3) && !defined(__osf__) #if !defined(SC3) && !defined(__osf__)
theData = f_streambuf->str (); theData = (char *)f_streambuf->str().c_str();
theData[f_streambuf->pcount()] = 0; theData[f_streambuf->str().size()] = 0;
#endif #endif
if (!attrs) if (!attrs)
attrs = new AttributeList ; attrs = new AttributeList ;
@ -495,8 +490,8 @@ DocParser::process_attributes(istream &input, ostream &output,
case OliasAttribute: case OliasAttribute:
//#ifdef _IBMR2 //#ifdef _IBMR2
#if !defined(SC3) && !defined(__osf__) #if !defined(SC3) && !defined(__osf__)
theData = f_streambuf->str (); theData = (char *)f_streambuf->str().c_str();
theData[f_streambuf->pcount()] = 0; theData[f_streambuf->str().size()] = 0;
#endif #endif
// mirrors attribute // mirrors attribute
if (!olias_attrs) if (!olias_attrs)
@ -525,7 +520,7 @@ DocParser::process_attributes(istream &input, ostream &output,
} }
} }
} }
catch_any() mcatch_any()
{ {
delete newAttribute; delete newAttribute;
@ -568,12 +563,11 @@ DocParser::process_attribute(istream &input, ostream &output,
*(data + f_output.pcount()) = 0; *(data + f_output.pcount()) = 0;
f_output.rdbuf()->freeze(0); f_output.rdbuf()->freeze(0);
#else #else
char *data = f_streambuf->str(); char *data = (char *)f_streambuf->str().c_str();
//#ifdef _IBMR2 //#ifdef _IBMR2
#if !defined(SC3) && !defined(__osf__) #if !defined(SC3) && !defined(__osf__)
data[f_streambuf->pcount ()] = 0; data[f_streambuf->str().size()] = 0;
#endif #endif
f_streambuf->freeze(0);
#endif #endif
Attribute *attr = new Attribute(name, strdup(data)); Attribute *attr = new Attribute(name, strdup(data));

View file

@ -24,8 +24,9 @@
/* Copyright (c) 1995 FUJITSU LIMITED */ /* Copyright (c) 1995 FUJITSU LIMITED */
/* All Rights Reserved */ /* All Rights Reserved */
#include <iostream.h> #include <iostream>
#include <strstream.h> #include <sstream>
using namespace std;
#include "SymTab.h" #include "SymTab.h"
#include "Exceptions.hh" #include "Exceptions.hh"
@ -84,7 +85,7 @@ private:
char* const f_buffer; char* const f_buffer;
ostrstream f_output; ostrstream f_output;
#else #else
strstreambuf *f_streambuf ; stringbuf *f_streambuf;
ostream f_output; ostream f_output;
#endif #endif
Resolver &f_resolver; Resolver &f_resolver;

View file

@ -21,7 +21,8 @@
* Floor, Boston, MA 02110-1301 USA * Floor, Boston, MA 02110-1301 USA
*/ */
// $TOG: Element.C /main/5 1998/04/17 11:48:25 mgreess $ // $TOG: Element.C /main/5 1998/04/17 11:48:25 mgreess $
#include <iostream.h> #include <iostream>
using namespace std;
#include <stdlib.h> #include <stdlib.h>
#include "StyleSheetExceptions.h" #include "StyleSheetExceptions.h"
#include "Element.h" #include "Element.h"

View file

@ -30,7 +30,7 @@
#include "VariableTable.h" #include "VariableTable.h"
#include "Renderer.h" #include "Renderer.h"
#include "Debug.h" #include "Debug.h"
#include <stream.h> #include <sstream>
#include "HardCopy/autoNumberFP.h" #include "HardCopy/autoNumberFP.h"
@ -141,20 +141,20 @@ BinaryOperatorNode::evaluate() const
{ {
// calculate children trees and then have feature value do the operation // 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 volatile
#endif #endif
FeatureValue *left = 0; 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 volatile
#endif #endif
FeatureValue *right = 0; 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 volatile
#endif #endif
FeatureValue *result = 0; FeatureValue *result = 0;
try mtry
{ {
left = f_left->evaluate(); left = f_left->evaluate();
right = f_right->evaluate(); right = f_right->evaluate();
@ -176,7 +176,7 @@ BinaryOperatorNode::evaluate() const
} }
} }
catch_any() mcatch_any()
{ {
delete left ; delete left ;
delete right ; delete right ;
@ -219,11 +219,11 @@ VariableNode::evaluate() const
// etc. // etc.
FeatureValue *return_variable = 0; FeatureValue *return_variable = 0;
try mtry
{ {
return_variable = variable_value->evaluate() ; return_variable = variable_value->evaluate() ;
} }
catch_any() mcatch_any()
{ {
delete return_variable; delete return_variable;
delete variable_value ; delete variable_value ;

View file

@ -24,7 +24,7 @@
#ifndef _Feature_h #ifndef _Feature_h
#define _Feature_h #define _Feature_h
#include <stream.h> #include <sstream>
#ifndef CDE_NEXT #ifndef CDE_NEXT

View file

@ -28,7 +28,8 @@
#include "StyleSheet/StyleSheetExceptions.h" #include "StyleSheet/StyleSheetExceptions.h"
#include "utility/const.h" #include "utility/const.h"
#include "utility/funcs.h" #include "utility/funcs.h"
#include <iostream.h> #include <iostream>
using namespace std;
featureDefDictionary* g_FeatureDefDictionary = 0; featureDefDictionary* g_FeatureDefDictionary = 0;
@ -314,34 +315,34 @@ MESSAGE(cerr, "");
} }
FeatureValue * fv = 0; FeatureValue * fv = 0;
try { mtry {
fv = f -> evaluate(); fv = f -> evaluate();
} }
catch (undefinedAttributeException&, e) { mcatch (undefinedAttributeException&, e) {
return true; return true;
} }
catch (undefinedVariableException&, e) { mcatch (undefinedVariableException&, e) {
report_error_location(); report_error_location();
cerr << "Undefined variable error.\n"; cerr << "Undefined variable error.\n";
return false; return false;
} }
/* /*
catch (badCastException&, e) { mcatch (badCastException&, e) {
report_error_location(); report_error_location();
cerr << "Evaluating expression error.\n"; cerr << "Evaluating expression error.\n";
return false; return false;
} }
catch (badEvaluationException&, e) { mcatch (badEvaluationException&, e) {
report_error_location(); report_error_location();
cerr << "Evaluating expression error.\n"; cerr << "Evaluating expression error.\n";
return false; return false;
} }
*/ */
catch_any() { mcatch_any() {
//report_error_location(); //report_error_location();
//cerr << "There might be an error in the expression.\n"; //cerr << "There might be an error in the expression.\n";
return true; return true;

View file

@ -75,16 +75,16 @@ FeatureSet::evaluate(FeatureSet *result_set) const
while(++next) while(++next)
{ {
FeatureValue *value ; FeatureValue *value ;
try mtry
{ {
value = next.key()->evaluate(); value = next.key()->evaluate();
result_set->append(new Feature(next.key()->name(), result_set->append(new Feature(next.key()->name(),
value)); value));
} }
#ifdef UXPDS #ifdef UXPDS
catch_any() mcatch_any()
#else #else
catch_noarg(badEvaluationException) mcatch_noarg(badEvaluationException)
#endif #endif
{ {
/* do nothing...we just ignore any that will not evaluate */ /* 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 // cast to non-const to get iterator
CC_TPtrSlistIterator<Feature> next(*(CC_TPtrSlist<Feature>*)this); CC_TPtrSlistIterator<Feature> next(*(CC_TPtrSlist<Feature>*)this);
for (int i = 0 ; i < f_print_indent_level; i++) int i;
for (i = 0 ; i < f_print_indent_level; i++)
o << " " ; o << " " ;
o << "{" << endl; o << "{" << endl;

View file

@ -522,7 +522,8 @@ FeatureValueString::operator+(const FeatureValue& x) const
char* newString = new char[len1 + len2 + 1]; char* newString = new char[len1 + len2 + 1];
for ( int i=0; i<len1; i++ ) int i;
for ( i=0; i<len1; i++ )
newString[i] = str1[i]; newString[i] = str1[i];
for ( i=0; i<len2; i++ ) for ( i=0; i<len2; i++ )
@ -560,14 +561,14 @@ FeatureValueString::operator+(const FeatureValueExpression& expr) const
{ {
FeatureValue *x = 0; FeatureValue *x = 0;
FeatureValue *y = 0; FeatureValue *y = 0;
try mtry
{ {
x = expr.evaluate(); x = expr.evaluate();
y = operator+(*x); y = operator+(*x);
delete x; delete x;
return y; return y;
} }
catch_any() mcatch_any()
{ {
delete x; delete x;
rethrow; rethrow;
@ -2343,13 +2344,13 @@ FeatureValueArray::FeatureValueArray(const FeatureValueArray& x) :
f_name(strdup(x.f_name)), FeatureValue(array), f_name(strdup(x.f_name)), FeatureValue(array),
pointer_vector<FeatureValue>(x.length(), 0) pointer_vector<FeatureValue>(x.length(), 0)
{ {
try mtry
{ {
for ( int i=0; i<length(); i++ ) for ( int i=0; i<length(); i++ )
(*this)[i] = x[i] -> clone(); (*this)[i] = x[i] -> clone();
return; return;
} }
catch_any() mcatch_any()
{ {
for ( int i=0; i<length(); i++ ) for ( int i=0; i<length(); i++ )
delete (*this)[i]; delete (*this)[i];
@ -2371,14 +2372,14 @@ FeatureValueArray::evaluate() const
{ {
FeatureValueArray *result = new FeatureValueArray(f_name, length()); FeatureValueArray *result = new FeatureValueArray(f_name, length());
try mtry
{ {
for ( int i=0; i<length(); i++ ) { for ( int i=0; i<length(); i++ ) {
(*result)[i] = (*this)[i] -> evaluate(); (*result)[i] = (*this)[i] -> evaluate();
} }
return result; return result;
} }
catch_any() mcatch_any()
{ {
delete result; delete result;
rethrow; rethrow;

View file

@ -21,7 +21,8 @@
* Floor, Boston, MA 02110-1301 USA * Floor, Boston, MA 02110-1301 USA
*/ */
// $XConsortium: PQTest.cc /main/3 1996/06/11 17:07:26 cde-hal $ // $XConsortium: PQTest.cc /main/3 1996/06/11 17:07:26 cde-hal $
#include <iostream.h> #include <iostream>
using namespace std;
#include "SymTab.h" #include "SymTab.h"
#include "PathQualifier.h" #include "PathQualifier.h"
#include "Element.h" #include "Element.h"

View file

@ -32,7 +32,7 @@
#include "dti_cc/cc_hdict.h" #include "dti_cc/cc_hdict.h"
#endif #endif
#include <stream.h> #include <sstream>
#include "Types.h" #include "Types.h"
#include "SymTab.h" #include "SymTab.h"
#include "SSPath.h" #include "SSPath.h"

View file

@ -64,7 +64,7 @@ unsigned int PathTerm::operator ==(const PathTerm&)
ostream& operator <<(ostream& out, PathTerm& pt) ostream& operator <<(ostream& out, PathTerm& pt)
{ {
out << pt.symbol() << " (" << int(pt.f_PQExpr) << ") "; out << pt.symbol() << " (" << size_t(pt.f_PQExpr) << ") ";
return out; return out;
} }

View file

@ -27,21 +27,6 @@
#include "Exceptions.hh" #include "Exceptions.hh"
#include "SymTab.h" #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 CASTEXCEPT
#define CASTBCEXCEPT #define CASTBCEXCEPT
#define CASTBEEXCEPT #define CASTBEEXCEPT
@ -55,7 +40,6 @@
#define CASTUAEXCEPT #define CASTUAEXCEPT
#define CASTUTEXCEPT #define CASTUTEXCEPT
#define CASTUVEXCEPT #define CASTUVEXCEPT
#endif
class StyleSheetException : public Exception class StyleSheetException : public Exception
{ {

View file

@ -31,7 +31,8 @@
#include "dti_cc/CC_String.h" #include "dti_cc/CC_String.h"
#include "dti_cc/cc_hdict.h" #include "dti_cc/cc_hdict.h"
//#include "StyleSheet/cde_next.h" //#include "StyleSheet/cde_next.h"
#include <iostream.h> #include <iostream>
using namespace std;
#endif #endif
#include "Types.h" #include "Types.h"

View file

@ -27,8 +27,9 @@ static char defParsersccsid[] = "@(#)yaccpar 1.8 (Berkeley) 01/20/90";
#define defParserBYACC 1 #define defParserBYACC 1
#include <stdio.h> #include <stdio.h>
#include <ctype.h> #include <ctype.h>
#include <stream.h> #include <sstream>
#include <iostream.h> #include <iostream>
using namespace std;
#include "Debug.h" #include "Debug.h"
#include "FeatureDefDictionary.h" #include "FeatureDefDictionary.h"
@ -269,14 +270,16 @@ defParserloop:
goto defParserreduce; goto defParserreduce;
} }
if (defParsererrflag) goto defParserinrecovery; if (defParsererrflag) goto defParserinrecovery;
#if 0 // Disable for now // Disable for now
#if 0
#ifdef lint #ifdef lint
goto defParsernewerror; goto defParsernewerror;
#endif #endif
defParsernewerror: defParsernewerror:
#endif /* 0 */ #endif /* 0 */
defParsererror("syntax error"); defParsererror((char*)"syntax error");
#if 0 // Disable for now // Disable for now
#if 0
#ifdef lint #ifdef lint
goto defParsererrlab; goto defParsererrlab;
#endif #endif
@ -516,7 +519,7 @@ to state %d\n", *defParserssp, defParserstate);
*++defParservsp = defParserval; *++defParservsp = defParserval;
goto defParserloop; goto defParserloop;
defParseroverflow: defParseroverflow:
defParsererror("yacc stack overflow"); defParsererror((char*)"yacc stack overflow");
defParserabort: defParserabort:
return (1); return (1);
defParseraccept: defParseraccept:

View file

@ -3,7 +3,7 @@
%{ %{
#include <stdio.h> #include <stdio.h>
#include <ctype.h> #include <ctype.h>
#include <stream.h> #include <sstream>
#include <iostream.h> #include <iostream.h>
#include "Debug.h" #include "Debug.h"
#include "FeatureDefDictionary.h" #include "FeatureDefDictionary.h"

View file

@ -43,7 +43,7 @@
#include <stdlib.h> #include <stdlib.h>
#if !defined(__osf__) && !defined(USL) #if !defined(__osf__) && !defined(USL) && !defined(linux) && !defined(CSRG_BASED)
#include <osfcn.h> #include <osfcn.h>
#endif #endif
@ -196,7 +196,8 @@ typedef struct defParser_buffer_state *defParser_BUFFER_STATE;
#include "FeatureDefDictionary.h" #include "FeatureDefDictionary.h"
#include "defParser.tab.h" #include "defParser.tab.h"
#include "Debug.h" #include "Debug.h"
#include <iostream.h> #include <iostream>
using namespace std;
extern istream *g_defParserin; extern istream *g_defParserin;

View file

@ -13,7 +13,8 @@
#include "FeatureDefDictionary.h" #include "FeatureDefDictionary.h"
#include "defParser.tab.h" #include "defParser.tab.h"
#include "Debug.h" #include "Debug.h"
#include <iostream.h> #include <iostream>
using namespace std;
extern istream *g_yyin; extern istream *g_yyin;

View file

@ -30,7 +30,8 @@
#include "StyleSheet.h" #include "StyleSheet.h"
#include "StyleSheetExceptions.h" #include "StyleSheetExceptions.h"
#include "VariableTable.h" #include "VariableTable.h"
#include <iostream.h> #include <iostream>
using namespace std;
Renderer *gRenderer = 0; Renderer *gRenderer = 0;
class TestRenderer : public Renderer class TestRenderer : public Renderer

View file

@ -27,8 +27,9 @@ static char stylesccsid[] = "@(#)yaccpar 1.8 (Berkeley) 01/20/90";
#define styleBYACC 1 #define styleBYACC 1
#include <stdio.h> #include <stdio.h>
#include <ctype.h> #include <ctype.h>
#include <stream.h> #include <sstream>
#include <iostream.h> #include <iostream>
using namespace std;
#include <assert.h> #include <assert.h>
#include "StyleSheetExceptions.h" #include "StyleSheetExceptions.h"
#include "VariableTable.h" #include "VariableTable.h"
@ -533,7 +534,7 @@ styleloop:
#endif #endif
stylenewerror: stylenewerror:
#endif /* if 0 */ #endif /* if 0 */
styleerror("syntax error"); styleerror((char*)"syntax error");
#if 0 /* remove if needed */ #if 0 /* remove if needed */
#ifdef lint #ifdef lint
goto styleerrlab; goto styleerrlab;
@ -1353,7 +1354,7 @@ to state %d\n", *stylessp, stylestate);
*++stylevsp = styleval; *++stylevsp = styleval;
goto styleloop; goto styleloop;
styleoverflow: styleoverflow:
styleerror("yacc stack overflow"); styleerror((char*)"yacc stack overflow");
styleabort: styleabort:
return (1); return (1);
styleaccept: styleaccept:

View file

@ -3,7 +3,7 @@
%{ %{
#include <stdio.h> #include <stdio.h>
#include <ctype.h> #include <ctype.h>
#include <stream.h> #include <sstream>
#include <iostream.h> #include <iostream.h>
#include <assert.h> #include <assert.h>
#include "StyleSheetExceptions.h" #include "StyleSheetExceptions.h"

View file

@ -43,7 +43,7 @@
#include <stdlib.h> #include <stdlib.h>
#if !defined(__osf__) && !defined(USL) #if !defined(__osf__) && !defined(USL) && !defined(linux) && !defined(CSRG_BASED)
#include <osfcn.h> #include <osfcn.h>
#endif #endif
@ -228,7 +228,8 @@ typedef struct style_buffer_state *style_BUFFER_STATE;
#include "StyleSheetExceptions.h" #include "StyleSheetExceptions.h"
#include "style.tab.h" #include "style.tab.h"
#include "Debug.h" #include "Debug.h"
#include <iostream.h> #include <iostream>
using namespace std;
istream *g_stylein = 0; istream *g_stylein = 0;

View file

@ -23,7 +23,7 @@ XCOMM .../programs/dtinfo/mmdb/<subdir>/Imakefile
#define LargePICTable YES #define LargePICTable YES
#define CplusplusSource YES #define CplusplusSource YES
DEPEND_DEFINES = $(CXXDEPENDINCLUDES) DEPEND_DEFINES = $(CXXDEPENDINCLUDES) $(DEPENDDEFINES)
XCOMM In DtMmdb we compile as C_API sources. XCOMM In DtMmdb we compile as C_API sources.
DEFINES = -DC_API DEFINES = -DC_API

View file

@ -102,5 +102,6 @@ base::base(object_dict* obj_dict,
base::~base() base::~base()
{ {
;
} }

View file

@ -48,6 +48,10 @@
*/ */
#ifndef C_API
#include <sstream>
using namespace std;
#endif
#include "api/info_base.h" #include "api/info_base.h"
#include "compression/abs_agent.h" #include "compression/abs_agent.h"
@ -74,21 +78,22 @@ debug(cerr, base_ds);
*info_base_locale = 0; *info_base_locale = 0;
char* nm ; char* nm ;
int i;
////////////////////// //////////////////////
// sets // sets
////////////////////// //////////////////////
info_base_set_ptrs = new cset_handlerPtr[num_cset_ptrs]; info_base_set_ptrs = new cset_handlerPtr[num_cset_ptrs];
for ( int i=0; i<num_cset_ptrs; i++ ) { for ( i=0; i<num_cset_ptrs; i++ ) {
nm = form("%s.%s", base_nm, info_base_set_names[i]); nm = form("%s.%s", base_nm, info_base_set_names[i]);
try { mtry {
info_base_set_ptrs[i] = (cset_handler*) info_base_set_ptrs[i] = (cset_handler*)
(f_obj_dict -> get_handler(nm)); (f_obj_dict -> get_handler(nm));
} }
catch_any() mcatch_any()
{ {
info_base_set_ptrs[i] = 0; 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]); nm = form("%s.%s", base_nm, info_base_list_names[i]);
try { mtry {
info_base_list_ptrs[i] = (dl_list_handler*) info_base_list_ptrs[i] = (dl_list_handler*)
obj_dict.get_handler(nm); obj_dict.get_handler(nm);
} }
catch_any() mcatch_any()
{ {
info_base_list_ptrs[i] = 0; 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) 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; 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); 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")); throw(stringException("non page store no supported"));
} }
iterator* it = new iterator(x, code); Iterator* it = new Iterator(x, code);
it -> ind = s -> first_loc(); it -> ind = s -> first_loc();
@ -244,7 +249,7 @@ iterator* info_base::first(char* col_nm, c_code_t code)
return it; 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() ); 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(); 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()); page_storage *s = (page_storage*)( it.collection_hd -> its_store());

View file

@ -59,11 +59,11 @@
#include "object/cset.h" #include "object/cset.h"
#include "object/dl_list.h" #include "object/dl_list.h"
class iterator class Iterator
{ {
public: public:
iterator( handler*, c_code_t ); Iterator( handler*, c_code_t );
~iterator(); ~Iterator();
operator void*(); operator void*();
@ -106,9 +106,9 @@ public:
mm_version& data_version() { return f_v; }; mm_version& data_version() { return f_v; };
// iterate over all instances with 'c_code' in a set or a list // iterate over all instances with 'c_code' in a set or a list
iterator* first(char* col_nm, c_code_t c_code); Iterator* first(char* col_nm, c_code_t c_code);
oid_t get_oid(const iterator& ind); oid_t get_oid(const Iterator& ind);
void next(iterator&); void next(Iterator&);
#ifdef C_API #ifdef C_API
// an integer id within the infolib // an integer id within the infolib

View file

@ -317,7 +317,7 @@ debug(cerr, base_name);
//fprintf(stderr, "try to init %s\n", 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); 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, 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)); info_base_list.insert_as_tail(new dlist_void_ptr_cell(x));
} }
catch (mmdbException &,e) mcatch (mmdbException &,e)
{ {
//fprintf(stderr, "in catch block\n"); //fprintf(stderr, "in catch block\n");
return 0; 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); 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 ) { if ( !nm_out ) {
MESSAGE(cerr, form("can't open %s/%s for append", 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())); 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()); char* lib_entry = form("%s\t%s\n", info_lib_name, unique_id());
if ( !(nm_out << lib_entry) ) { if ( !(nm_out << lib_entry) ) {
@ -589,7 +590,7 @@ info_lib::getInfobaseByComponent(const char *locator_string, enum TestSelector s
if (ib==0) if (ib==0)
throw(stringException("null info_base ptr")); 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. // any exceptions there and try next infobase.
switch (sel) { switch (sel) {
@ -615,7 +616,7 @@ info_lib::getInfobaseByComponent(const char *locator_string, enum TestSelector s
} }
} }
catch (mmdbException &,e) mcatch (mmdbException &,e)
{ {
} end_try; } end_try;
@ -630,7 +631,8 @@ info_base**
info_lib::getInfobasesByComponent(char **locator_strings, int count, enum TestSelector sel) info_lib::getInfobasesByComponent(char **locator_strings, int count, enum TestSelector sel)
{ {
info_base** ibs = new info_basePtr[count]; info_base** ibs = new info_basePtr[count];
for ( int i=0; i<count; ibs[i++] = 0 ); int i;
for ( i=0; i<count; ibs[i++] = 0 );
info_base* ib = 0; info_base* ib = 0;
@ -645,7 +647,7 @@ info_lib::getInfobasesByComponent(char **locator_strings, int count, enum TestSe
for ( i=0; i<count; i++ ) { for ( i=0; i<count; i++ ) {
try { mtry {
if ( locator_strings[i] && ibs[i] == 0 ) { if ( locator_strings[i] && ibs[i] == 0 ) {
switch (sel) { switch (sel) {
@ -674,7 +676,7 @@ info_lib::getInfobasesByComponent(char **locator_strings, int count, enum TestSe
} }
} }
catch (mmdbException &,e) mcatch (mmdbException &,e)
{ {
} end_try; } end_try;

View file

@ -55,6 +55,7 @@
#include "dstr/dlist_void_ptr_cell.h" #include "dstr/dlist_void_ptr_cell.h"
#include "api/info_base.h" #include "api/info_base.h"
#include "utility/funcs.h" #include "utility/funcs.h"
#include "schema/object_dict.h"
/*************************************/ /*************************************/
// The info_lib class // The info_lib class

View file

@ -288,8 +288,8 @@ void smart_ptr::update_oid(int i, const oid_t& x)
handler* z = get_handler(i, OID_CODE); handler* z = get_handler(i, OID_CODE);
oid_handler* y = (oid_handler*)z; oid_handler* y = (oid_handler*)z;
sprintf(buf, "%d.%d\n", x.ccode(), x.icode()); sprintf(buf, "%d.%d\n", x.ccode(), (int)x.icode());
istrstream in(buf, 64); istringstream in(buf);
(*y) -> asciiIn(in); (*y) -> asciiIn(in);

View file

@ -52,9 +52,9 @@
#define _utility_h 1 #define _utility_h 1
#ifdef C_API #ifdef C_API
#include "utility/c_strstream.h" #include "utility/c_stringstream.h"
#else #else
#include <strstream.h> #include <sstream>
#endif #endif
#include <string.h> #include <string.h>

View file

@ -23,7 +23,7 @@ XCOMM .../programs/dtinfo/mmdb/<subdir>/Imakefile
#define LargePICTable YES #define LargePICTable YES
#define CplusplusSource YES #define CplusplusSource YES
DEPEND_DEFINES = $(CXXDEPENDINCLUDES) DEPEND_DEFINES = $(CXXDEPENDINCLUDES) $(DEPENDDEFINES)
XCOMM In DtMmdb we compile as C_API sources. XCOMM In DtMmdb we compile as C_API sources.
DEFINES = -DC_API DEFINES = -DC_API

View file

@ -289,7 +289,7 @@ bt_fast(t, key, data, exactp)
const DBT *key, *data; const DBT *key, *data;
int *exactp; int *exactp;
{ {
EPG e; static EPG e;
PAGE *h; PAGE *h;
size_t nbytes; size_t nbytes;
int cmp; int cmp;

View file

@ -60,8 +60,12 @@
#define _CDEFS_H_ #define _CDEFS_H_
#if defined(__cplusplus) #if defined(__cplusplus)
#ifndef __BEGIN_DECLS
#define __BEGIN_DECLS extern "C" { #define __BEGIN_DECLS extern "C" {
#endif
#ifndef __END_DECLS
#define __END_DECLS }; #define __END_DECLS };
#endif
#else #else
#define __BEGIN_DECLS #define __BEGIN_DECLS
#define __END_DECLS #define __END_DECLS
@ -79,7 +83,9 @@
#undef __P #undef __P
#endif #endif
#define __P(protos) protos /* full-blown ANSI C */ #define __P(protos) protos /* full-blown ANSI C */
#ifndef __CONCAT
#define __CONCAT(x,y) x ## y #define __CONCAT(x,y) x ## y
#endif
#define __STRING(x) #x #define __STRING(x) #x
#else /* !(__STDC__ || __cplusplus) */ #else /* !(__STDC__ || __cplusplus) */
@ -114,7 +120,9 @@
*/ */
#if defined(__GNUC__) && !defined(__STRICT_ANSI__) #if defined(__GNUC__) && !defined(__STRICT_ANSI__)
#define __dead __volatile #define __dead __volatile
#ifndef __pure
#define __pure __const #define __pure __const
#endif
#else #else
#define __dead #define __dead
#define __pure #define __pure

View file

@ -111,13 +111,13 @@ bcopy(src0, dst0, length)
/* /*
* Copy forward. * Copy forward.
*/ */
t = (int)src; /* only need low bits */ t = (size_t)src; /* only need low bits */
if ((t | (int)dst) & wmask) { if ((t | (size_t)dst) & wmask) {
/* /*
* Try to align operands. This cannot be done * Try to align operands. This cannot be done
* unless the low bits match. * unless the low bits match.
*/ */
if ((t ^ (int)dst) & wmask || length < wsize) if ((t ^ (size_t)dst) & wmask || length < wsize)
t = length; t = length;
else else
t = wsize - (t & wmask); t = wsize - (t & wmask);
@ -139,9 +139,9 @@ bcopy(src0, dst0, length)
*/ */
src += length; src += length;
dst += length; dst += length;
t = (int)src; t = (size_t)src;
if ((t | (int)dst) & wmask) { if ((t | (size_t)dst) & wmask) {
if ((t ^ (int)dst) & wmask || length <= wsize) if ((t ^ (size_t)dst) & wmask || length <= wsize)
t = length; t = length;
else else
t &= wmask; t &= wmask;

View file

@ -25,6 +25,7 @@
#include "cdefs.h" #include "cdefs.h"
#include <compat.h> #include <compat.h>
#include <string.h>
#ifdef __STDC__ #ifdef __STDC__
#include <stdarg.h> #include <stdarg.h>
@ -52,7 +53,7 @@ snprintf(str, n, fmt, va_alist)
va_start(ap); va_start(ap);
#endif #endif
#ifdef VSPRINTF_CHARSTAR #ifdef VSPRINTF_CHARSTAR
rp = vsprintf(str, fmt, ap); rp = (char*)(size_t)vsprintf(str, fmt, ap);
va_end(ap); va_end(ap);
return (strlen(rp)); return (strlen(rp));
#else #else
@ -70,7 +71,7 @@ vsnprintf(str, n, fmt, ap)
va_list ap; va_list ap;
{ {
#ifdef VSPRINTF_CHARSTAR #ifdef VSPRINTF_CHARSTAR
return (strlen(vsprintf(str, fmt, ap))); return (strlen((char*)(size_t)vsprintf(str, fmt, ap)));
#else #else
return (vsprintf(str, fmt, ap)); return (vsprintf(str, fmt, ap));
#endif #endif

View file

@ -23,7 +23,7 @@ XCOMM .../programs/dtinfo/mmdb/<subdir>/Imakefile
#define LargePICTable YES #define LargePICTable YES
#define CplusplusSource YES #define CplusplusSource YES
DEPEND_DEFINES = $(CXXDEPENDINCLUDES) DEPEND_DEFINES = $(CXXDEPENDINCLUDES) $(DEPENDDEFINES)
XCOMM In DtMmdb we compile as C_API sources. XCOMM In DtMmdb we compile as C_API sources.
DEFINES = -DC_API DEFINES = -DC_API

View file

@ -400,11 +400,12 @@ io_status huff::cdrOut(buffer& buf)
//MESSAGE(cerr, "huff::cdrOut"); //MESSAGE(cerr, "huff::cdrOut");
//debug(cerr, my_oid()); //debug(cerr, my_oid());
static buffer v_out_buf(LBUFSIZ); static buffer v_out_buf(LBUFSIZ);
int i;
if ( cts > 0 ) { if ( cts > 0 ) {
//MESSAGE(cerr, "huff::cdrOut: dict out"); //MESSAGE(cerr, "huff::cdrOut: dict out");
int sz = sizeof(int); int sz = sizeof(int);
for ( int i=0; i<cts; i++ ) { for ( i=0; i<cts; i++ ) {
sz += ( e_units[i] -> word -> size() + sz += ( e_units[i] -> word -> size() +
sizeof(unsigned int) + sizeof(unsigned int) +
sizeof(char) sizeof(char)

View file

@ -43,9 +43,13 @@
#include <stdlib.h> #include <stdlib.h>
#if !defined(__osf__) && !defined(USL) #if defined(__osf__) || defined(linux) || defined(CSRG_BASED)
#include <unistd.h>
#else
#if !defined(__uxp__) && !defined(USL)
#include <osfcn.h> #include <osfcn.h>
#endif #endif
#endif
/* use prototypes in function declarations */ /* use prototypes in function declarations */
#define ps_USE_PROTOS #define ps_USE_PROTOS

View file

@ -43,9 +43,13 @@
#include <stdlib.h> #include <stdlib.h>
#if !defined(__osf__) && !defined(USL) #if defined(__osf__) || defined(linux) || defined(CSRG_BASED)
#include <unistd.h>
#else
#if !defined(__uxp__) && !defined(USL)
#include <osfcn.h> #include <osfcn.h>
#endif #endif
#endif
/* use prototypes in function declarations */ /* use prototypes in function declarations */
#define sgml_USE_PROTOS #define sgml_USE_PROTOS

View file

@ -360,9 +360,9 @@ Boolean trie::travers_to(char* str, int len,
node = root; node = root;
int j; int i, j;
for ( int i=0; i<len; i++ ) { for ( i=0; i<len; i++ ) {
j = str[i]; j = str[i];
//debug(cerr, str[i]); //debug(cerr, str[i]);

View file

@ -61,6 +61,7 @@ void zip::compress(const buffer& uncompressed, buffer& compressed)
// code for testing. I know it is slow. // code for testing. I know it is slow.
//////////////////////////////////////// ////////////////////////////////////////
int ret;
fstream out(UNCOMPRESSED, ios::out|ios::trunc); fstream out(UNCOMPRESSED, ios::out|ios::trunc);
if ( !out ) if ( !out )
@ -71,14 +72,14 @@ void zip::compress(const buffer& uncompressed, buffer& compressed)
out.close(); out.close();
system(form("gzip -c %s > %s", UNCOMPRESSED, COMPRESSED)); ret = system(form("gzip -c %s > %s", (char*)UNCOMPRESSED,(char*)COMPRESSED));
fstream in(COMPRESSED, ios::in); fstream in(COMPRESSED, ios::in);
if ( !in ) if ( !in )
throw(streamException(in.rdstate())); throw(streamException(in.rdstate()));
int x = bytes(in); int x = bytes((char*)COMPRESSED);
compressed.expand_chunk(x); compressed.expand_chunk(x);
@ -94,6 +95,7 @@ void zip::compress(const buffer& uncompressed, buffer& compressed)
void zip::decompress(buffer& compressed, buffer& uncompressed) void zip::decompress(buffer& compressed, buffer& uncompressed)
{ {
int ret;
fstream out(COMPRESSED, ios::out|ios::trunc); fstream out(COMPRESSED, ios::out|ios::trunc);
if ( !out ) if ( !out )
@ -104,14 +106,14 @@ void zip::decompress(buffer& compressed, buffer& uncompressed)
out.close(); 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); fstream in(UNCOMPRESSED, ios::in);
if ( !in ) if ( !in )
throw(streamException(in.rdstate())); throw(streamException(in.rdstate()));
int x = bytes(in); int x = bytes((char*)UNCOMPRESSED);
uncompressed.expand_chunk(x); uncompressed.expand_chunk(x);

View file

@ -23,7 +23,7 @@ XCOMM .../programs/dtinfo/mmdb/<subdir>/Imakefile
#define LargePICTable YES #define LargePICTable YES
#define CplusplusSource YES #define CplusplusSource YES
DEPEND_DEFINES = $(CXXDEPENDINCLUDES) DEPEND_DEFINES = $(CXXDEPENDINCLUDES) $(DEPENDDEFINES)
XCOMM In DtMmdb we compile as C_API sources. XCOMM In DtMmdb we compile as C_API sources.
DEFINES = -DC_API DEFINES = -DC_API

View file

@ -315,7 +315,7 @@ void disk_hash::caching(disk_bucket& b, data_t& w, int slot_num)
if ( x ) { if ( x ) {
hash_vector -> insert( hash_vector -> insert(
voidPtr(ind), (voidPtr)(size_t)ind,
x -> slot_num(k, r, p, hash_vector -> count()) 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. // others may be overwritten.
//////////////////////////////////////// ////////////////////////////////////////
hash_vector -> insert( hash_vector -> insert(
voidPtr(slot_num), (voidPtr)(size_t)slot_num,
w.slot_num(k, r, p, hash_vector -> count()) w.slot_num(k, r, p, hash_vector -> count())
); );
} }

View file

@ -23,7 +23,7 @@ XCOMM .../programs/dtinfo/mmdb/<subdir>/Imakefile
#define LargePICTable YES #define LargePICTable YES
#define CplusplusSource YES #define CplusplusSource YES
DEPEND_DEFINES = $(CXXDEPENDINCLUDES) DEPEND_DEFINES = $(CXXDEPENDINCLUDES) $(DEPENDDEFINES)
XCOMM In DtMmdb we compile as C_API sources. XCOMM In DtMmdb we compile as C_API sources.
DEFINES = -DC_API DEFINES = -DC_API

View file

@ -53,7 +53,8 @@
#ifdef C_API #ifdef C_API
#include "utility/c_stream.h" #include "utility/c_stream.h"
#else #else
#include <stream.h> #include <sstream>
using namespace std;
#endif #endif

View file

@ -53,7 +53,8 @@
#ifdef C_API #ifdef C_API
#include "utility/c_stream.h" #include "utility/c_stream.h"
#else #else
#include <stream.h> #include <sstream>
using namespace std;
#endif #endif
token_stack::token_stack() : curr_token_start(0) token_stack::token_stack() : curr_token_start(0)

View file

@ -56,7 +56,7 @@ CC_TPtrDlist<T>::CC_TPtrDlist(const CC_TPtrDlist<T>&adlist)
template <class T> template <class T>
void CC_TPtrDlist<T>::clear() void CC_TPtrDlist<T>::clear()
{ {
if ( !destructed ) { if ( !this->get_destructed() ) {
CC_TPtrSlistIterator<T> iter(*this); CC_TPtrSlistIterator<T> iter(*this);
if (++iter) { if (++iter) {
while (1) { while (1) {
@ -82,7 +82,7 @@ template <class T>
void CC_TPtrDlist<T>::clearAndDestroy() void CC_TPtrDlist<T>::clearAndDestroy()
{ {
destructed = TRUE; this->set_destructed(TRUE);
CC_TPtrDlistIterator<T> iter(*this); CC_TPtrDlistIterator<T> iter(*this);
if ( ++iter ) { if ( ++iter ) {
while (1) { while (1) {

View file

@ -41,23 +41,6 @@ CC_TPtrSlist<T>::CC_TPtrSlist(const CC_TPtrSlist<T>&slist)
} }
//------------------------------------------------------------------
template<class T>
T *CC_TPtrSlist<T>::at(size_t pos) const
{
// Hack to get it passed to iter
CC_TPtrSlistIterator<T> iter( *(CC_TPtrSlist<T> *)this );
for ( int i = 0; i <=pos; i++ ) {
if ( !(++iter) ) {
throw(CASTCCBEXCEPT ccBoundaryException(0,0,i));
}
}
return( iter.key() );
}
//------------------------------------------------------------------ //------------------------------------------------------------------
template<class T> template<class T>
T *CC_TPtrSlist<T>::removeAt(size_t pos) { T *CC_TPtrSlist<T>::removeAt(size_t pos) {

View file

@ -25,6 +25,7 @@
#define __CC_Slist_h #define __CC_Slist_h
#include "CC_Listbase.h" #include "CC_Listbase.h"
#include "cc_exceptions.h"
template <class T> class CC_TPtrSlist; template <class T> class CC_TPtrSlist;
template <class T> class CC_TPtrSlistIterator; template <class T> class CC_TPtrSlistIterator;
@ -65,7 +66,7 @@ class CC_TPtrSlist : public CC_Listbase
friend class CC_List_Iterator<T>; friend class CC_List_Iterator<T>;
protected: protected:
CC_Boolean destructed; CC_Boolean destructed;
// Inherit public members from CC_Listbase // Inherit public members from CC_Listbase
/* /*
@ -97,9 +98,20 @@ public:
void insert(T* element) void insert(T* element)
{ CC_Listbase::append (new CC_Link<T> (element)); } { CC_Listbase::append (new CC_Link<T> (element)); }
T* at(size_t pos) const; /* throw boundaryException T* at(size_t pos) const /* throw boundaryException
* if list size is smaller than pos * if list size is smaller than pos
*/ */
{
// Hack to get it passed to iter
CC_TPtrSlistIterator<T> iter( *(CC_TPtrSlist<T> *)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 T* removeAt(size_t pos); /* throw boundaryException
* if list size is smaller than pos * if list size is smaller than pos
@ -146,7 +158,11 @@ public:
operator CC_Listbase *() { return(this); } operator CC_Listbase *() { return(this); }
CC_Boolean get_destructed() const
{ return (destructed); }
CC_Boolean set_destructed(CC_Boolean what)
{ destructed = what; }
}; };

View file

@ -23,54 +23,3 @@
// $XConsortium: CC_Stack.C /main/4 1996/10/08 19:22:53 cde-hal $ // $XConsortium: CC_Stack.C /main/4 1996/10/08 19:22:53 cde-hal $
#include "CC_Stack.h" #include "CC_Stack.h"
//------------------------------------------------------------------------
template <class T> Stack<T>::Stack ()
{
Items = new CC_TValSlist<T>();
}
//-------------------------------------------------------------------------
template <class T> Stack<T>::~Stack ()
{
delete Items;
}
//-------------------------------------------------------------------------
template <class T>
void
Stack<T>::push (const T newItem)
{
Items->append ( newItem );
}
//---------------------------------------------------------------------------
template <class T>
T
Stack<T>::pop () {
CC_Link<T> *last_elem = (CC_Link<T> *)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 <class T>
T&
Stack<T>::top () const
{
CC_Link<T> *last_elem = (CC_Link<T> *)Items->last();
if ( !last_elem ) {
throw(Exception());
}
return ( *last_elem->f_element );
}

View file

@ -31,19 +31,55 @@ template <class T> class Stack: public Destructable
{ {
public: public:
Stack (); /* This is a value stack, ie an assignment operator /* This is a value stack, ie an assignment operator for T is assumed */
* for T is assumed */ Stack ()
{
Items = new CC_TValSlist<T>();
}
~Stack (); ~Stack ()
{
delete Items;
}
public: public:
T pop (); T pop ()
void push (const T); {
T& top () const; CC_Link<T> *last_elem = (CC_Link<T> *)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<T> *last_elem = (CC_Link<T> *)Items->last();
if ( !last_elem ) {
throw(Exception());
}
return ( *last_elem->f_element );
}
int entries() const int entries() const
{ {
return( Items->entries() ); //ie no. of elements in the stack return( Items->entries() ); //ie no. of elements in the stack
} }
int empty() const { int empty() const {
return( Items->entries() == 0 ); return( Items->entries() == 0 );
} }

View file

@ -23,6 +23,7 @@
// $XConsortium: cc_exceptions.C /main/4 1996/08/21 15:48:54 drk $ // $XConsortium: cc_exceptions.C /main/4 1996/08/21 15:48:54 drk $
#include "dti_cc/cc_exceptions.h" #include "dti_cc/cc_exceptions.h"
using namespace std;
ostream& ccException::asciiOut(ostream& out) ostream& ccException::asciiOut(ostream& out)
{ {
@ -43,7 +44,7 @@ ostream& ccBoundaryException::asciiOut(ostream& out)
{ {
cerr << low << "\t"; cerr << low << "\t";
cerr << high << "\t"; cerr << high << "\t";
cerr << index << "\n"; cerr << mindex << "\n";
return out; return out;
} }

View file

@ -25,7 +25,9 @@
#ifndef _cc_exception_h #ifndef _cc_exception_h
#define _cc_exception_h 1 #define _cc_exception_h 1
#include <fstream.h> #include <fstream>
#include <iostream>
using namespace std;
#include "Exceptions.hh" #include "Exceptions.hh"
#define END_TRY end_try #define END_TRY end_try
@ -36,15 +38,9 @@
extern int errno; extern int errno;
#endif #endif
#if defined(linux)
#define CASTCCEXCEPT (ccException*)
#define CASTCCSEXCEPT (ccStringException*)
#define CASTCCBEXCEPT (ccBoundaryException*)
#else
#define CASTCCEXCEPT #define CASTCCEXCEPT
#define CASTCCSEXCEPT #define CASTCCSEXCEPT
#define CASTCCBEXCEPT #define CASTCCBEXCEPT
#endif
class ccException : public Exception class ccException : public Exception
{ {
@ -69,7 +65,7 @@ protected:
public: public:
DECLARE_EXCEPTION(ccStringException, ccException); DECLARE_EXCEPTION(ccStringException, ccException);
ccStringException(char* m) : msg(m) {}; ccStringException(char const* m) : msg((char*)m) {};
~ccStringException() {}; ~ccStringException() {};
virtual ostream& asciiOut(ostream&); virtual ostream& asciiOut(ostream&);
@ -81,13 +77,13 @@ class ccBoundaryException : public ccException
protected: protected:
int low; int low;
int high; int high;
int index; int mindex;
public: public:
DECLARE_EXCEPTION(ccBoundaryException, ccException); DECLARE_EXCEPTION(ccBoundaryException, ccException);
ccBoundaryException(int l, int h, int i) : ccBoundaryException(int l, int h, int i) :
low(l), high(h), index(i) {}; low(l), high(h), mindex(i) {};
~ccBoundaryException() {}; ~ccBoundaryException() {};
virtual ostream& asciiOut(ostream&); virtual ostream& asciiOut(ostream&);

View file

@ -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 $ // $TOG: cc_hdict.C /main/5 1998/04/17 11:45:00 mgreess $
#include "dti_cc/cc_exceptions.h" #include "dti_cc/cc_exceptions.h"
#if !defined(__osf__) && !defined(linux) #if !defined(__osf__)
template <class K, class V> CC_Boolean kv_pair<K, V>::f_needRemove = FALSE; template <class K, class V> CC_Boolean kv_pair<K, V>::f_needRemove = FALSE;
#endif #endif

View file

@ -29,7 +29,8 @@
#include "dti_cc/cc_pvect.h" #include "dti_cc/cc_pvect.h"
#include "dti_cc/CC_Slist.h" #include "dti_cc/CC_Slist.h"
#include <iostream.h> #include <iostream>
using namespace std;
template <class K, class V> template <class K, class V>
class kv_pair { class kv_pair {

View file

@ -26,6 +26,7 @@
#define _cc_dlist_array_h #define _cc_dlist_array_h
#include "dti_cc/CC_Dlist.h" #include "dti_cc/CC_Dlist.h"
#include "dti_cc/cc_exceptions.h"
template <class T> template <class T>
class dlist_array : public CC_TPtrDlist<T> class dlist_array : public CC_TPtrDlist<T>
@ -46,6 +47,21 @@ public:
T* first() ; 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<T> iter( *(CC_TPtrSlist<T> *)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); };
T* operator[](size_t i) const { return at(i); }; T* operator[](size_t i) const { return at(i); };
}; };

View file

@ -50,7 +50,7 @@ pointer_vector<T>::~pointer_vector()
} }
template <class T> template <class T>
T* pointer_vector<T>::operator[](size_t i) const T* pointer_vector<T>::operator[](ptrdiff_t i) const
{ {
if ( i<0 || i>= f_size ) if ( i<0 || i>= f_size )
throw(CASTCCBEXCEPT ccBoundaryException(0, f_size-1, i)); throw(CASTCCBEXCEPT ccBoundaryException(0, f_size-1, i));
@ -59,7 +59,7 @@ T* pointer_vector<T>::operator[](size_t i) const
} }
template <class T> template <class T>
T*& pointer_vector<T>::operator[](size_t i) T*& pointer_vector<T>::operator[](ptrdiff_t i)
{ {
if ( i<0 || i>= f_size ) if ( i<0 || i>= f_size )
throw(CASTCCBEXCEPT ccBoundaryException(0, f_size-1, i)); throw(CASTCCBEXCEPT ccBoundaryException(0, f_size-1, i));

View file

@ -25,6 +25,7 @@
#ifndef _cc_pvector_h #ifndef _cc_pvector_h
#define _cc_pvector_h 1 #define _cc_pvector_h 1
#include <stddef.h>
#include "dti_cc/types.h" #include "dti_cc/types.h"
template <class T> template <class T>
@ -45,8 +46,8 @@ public:
pointer_vector(size_t, T* = 0); pointer_vector(size_t, T* = 0);
~pointer_vector(); ~pointer_vector();
T* operator[](size_t) const; T* operator[](ptrdiff_t) const;
T*& operator[](size_t); T*& operator[](ptrdiff_t);
// size_t entries() const { return f_items; }; // size_t entries() const { return f_items; };
size_t length() const { return f_size; }; size_t length() const { return f_size; };

View file

@ -80,7 +80,7 @@ Destructable::~Destructable()
inline void inline void
Destructable::destruct() Destructable::destruct()
{ {
#if defined(linux) #if defined(linux) || defined(CSRG_BASED)
delete this; delete this;
#else #else
// Have to call this here since some compilers don't allow // Have to call this here since some compilers don't allow

View file

@ -1,13 +1,9 @@
// $TOG: Exception.hh /main/11 1998/04/20 09:55:15 mgreess $
#include <ctype.h> #include <ctype.h>
#define G_TEMP_SPACE_SIZE 1024 #define G_TEMP_SPACE_SIZE 1024
#if defined(linux)
#define CASTEXCEPT (Exception*)
#else
#define CASTEXCEPT #define CASTEXCEPT
#endif
class Exception : public Destructable class Exception : public Destructable
{ {
@ -158,7 +154,7 @@ private:
{ Exception *temp; \ { Exception *temp; \
if (in_stack()) { \ if (in_stack()) { \
temp = new (0) NAME (*this); \ temp = new (0) NAME (*this); \
(Exception *) (((NAME *)temp)->f_temporary = 1); \ ((NAME *)temp)->f_temporary = 1; \
} else \ } else \
temp = this; \ temp = this; \
temp->do_throw (line, file, dbg); } \ temp->do_throw (line, file, dbg); } \

View file

@ -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_out_of_obj_stack_memory = 0;
char* Exceptions::f_msg_memory_already_freed = 0; char* Exceptions::f_msg_memory_already_freed = 0;
#else #else
char *Exceptions::f_msg_internal_error = "Internal exceptions error:"; char *Exceptions::f_msg_internal_error =
char *Exceptions::f_msg_application_error = "Application exceptions error:"; (char*)"Internal exceptions error:";
char *Exceptions::f_msg_throw_message = "Application threw exception:";
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 = 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 = 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 = char *Exceptions::f_msg_not_caught =
"Exception not caught."; (char*)"Exception not caught.";
char *Exceptions::f_msg_no_current_exception = 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 = 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 = 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 = 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 = 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 = 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 = 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 = 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 #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. // Call user print function if set, otherwise just dump lines.
if (g_error_handler != NULL) if (g_error_handler != NULL)
{ {
try mtry
{ {
// Reset global variable to NULL before calling to prevent // Reset global variable to NULL before calling to prevent
// the possibility of recursive calls. // the possibility of recursive calls.
@ -191,7 +196,7 @@ Exceptions::error (const char *message, error_type_t error_type)
(*current) ((const char**)lines, count); (*current) ((const char**)lines, count);
set_error_handler (current); set_error_handler (current);
} }
catch_any() mcatch_any()
{ {
// Error handler will be NULL at this point. // Error handler will be NULL at this point.
Exceptions::error (Exceptions::f_msg_throw_from_error_handler, Exceptions::error (Exceptions::f_msg_throw_from_error_handler,

View file

@ -4,14 +4,27 @@
#define _Exceptions_hh_active #define _Exceptions_hh_active
#ifndef C_API
#ifndef NATIVE_EXCEPTIONS #ifndef NATIVE_EXCEPTIONS
#define NATIVE_EXCEPTIONS
#endif
#define Exception mException
#endif
#ifndef NATIVE_EXCEPTIONS
extern "C" { extern "C" {
#include <setjmp.h> #include <setjmp.h>
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
} }
#else
extern "C" {
#include <stdio.h>
#include <stdlib.h>
}
#endif
#ifndef NATIVE_EXCEPTIONS
#ifdef EXC_DEBUG #ifdef EXC_DEBUG
#define PRINTF(MSG) printf MSG #define PRINTF(MSG) printf MSG
#ifndef DEBUG #ifndef DEBUG
@ -45,12 +58,14 @@ extern "C" {
#define INIT_EXCEPTIONS() #define INIT_EXCEPTIONS()
#define throw(OBJ) throw OBJ #define mthrow(OBJ) throw OBJ
#define rethrow throw #define rethrow throw
#define catch_any() catch(...) #define mtry try
#define catch_noarg(OBJ) catch(OBJ)
#define catch(TYPE,OBJ) catch(TYPE OBJ) #define mcatch_any() catch(...)
#define mcatch_noarg(OBJ) catch(OBJ)
#define mcatch(TYPE,OBJ) catch(TYPE OBJ)
#define end_try #define end_try
@ -64,7 +79,7 @@ extern "C" {
// TRY MACRO // TRY MACRO
#define try \ #define mtry \
{ \ { \
Jump_Environment __jump_env; \ Jump_Environment __jump_env; \
if (setjmp (__jump_env.f_env) == 0) { 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 // This works if OBJ is an object or a pointer since Exception objects
// overload operator ->. // overload operator ->.
#if !defined(hpux) && !defined(USL) #if !defined(hpux) && !defined(USL)
#define throw(OBJ) \ #define mthrow(OBJ) \
(OBJ)->throw_it (__LINE__, __FILE__, DEBUG_THROW_FLAG) (OBJ)->throw_it (__LINE__, __FILE__, DEBUG_THROW_FLAG)
#else #else
#define throw(OBJ) \ #define mthrow(OBJ) \
OBJ->throw_it (__LINE__, __FILE__, DEBUG_THROW_FLAG) OBJ->throw_it (__LINE__, __FILE__, DEBUG_THROW_FLAG)
#endif #endif
@ -105,16 +120,16 @@ extern "C" {
#define PRINT_CATCH #define PRINT_CATCH
#endif #endif
#define catch_any() \ #define mcatch_any() \
} else if (1) { \ } else if (1) { \
PRINT_CATCH PRINT_CATCH
#define catch_noarg(OBJ) \ #define mcatch_noarg(OBJ) \
} else if (Exception::current_exception().isa (STRINGIFY(OBJ))) { \ } else if (Exception::current_exception().isa (STRINGIFY(OBJ))) { \
PRINT_CATCH PRINT_CATCH
#define catch(TYPE,OBJ) \ #define mcatch(TYPE,OBJ) \
catch_noarg (TYPE) \ mcatch_noarg (TYPE) \
TYPE OBJ = (TYPE) Exception::current_exception(); TYPE OBJ = (TYPE) Exception::current_exception();
#define end_try \ #define end_try \

View file

@ -23,7 +23,7 @@ XCOMM .../programs/dtinfo/mmdb/<subdir>/Imakefile
#define LargePICTable YES #define LargePICTable YES
#define CplusplusSource YES #define CplusplusSource YES
DEPEND_DEFINES = $(CXXDEPENDINCLUDES) DEPEND_DEFINES = $(CXXDEPENDINCLUDES) $(DEPENDDEFINES)
#if defined(SunArchitecture) && CplusplusCompilerMajorVersion > 3 #if defined(SunArchitecture) && CplusplusCompilerMajorVersion > 3
EXCEPTION_DEFINES = -DHAS_TERMINATE EXCEPTION_DEFINES = -DHAS_TERMINATE

View file

@ -30,42 +30,42 @@
void initialize_exception() void initialize_exception()
{ {
Exceptions::f_msg_internal_error = "Internal exceptions error:"; Exceptions::f_msg_internal_error = (char*)"Internal exceptions error:";
Exceptions::f_msg_application_error = "Application exceptions error:"; Exceptions::f_msg_application_error = (char*)"Application exceptions error:";
Exceptions::f_msg_throw_message = "Application threw exception:"; Exceptions::f_msg_throw_message = (char*)"Application threw exception:";
Exceptions::f_msg_not_initialized = 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 = 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 = Exceptions::f_msg_not_caught =
"Exception not caught."; (char*)"Exception not caught.";
Exceptions::f_msg_no_current_exception = 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::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::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 = 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 = 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 = 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 = 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 = 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]; Unwind_Stack::g_stack = new Unwind_Record[UNWIND_STACK_SIZE];
Exception::g_temp_space = new char[G_TEMP_SPACE_SIZE]; Exception::g_temp_space = new char[G_TEMP_SPACE_SIZE];

View file

@ -54,7 +54,8 @@ void class_name::operator delete( void* p )\
#else #else
#include <new.h> #include <new>
using namespace std;
#endif #endif

View file

@ -48,11 +48,11 @@ terminate()
// abuse in the terminate handler. // abuse in the terminate handler.
PFV handler = _terminate_handler; PFV handler = _terminate_handler;
_terminate_handler = NULL; _terminate_handler = NULL;
try mtry
{ {
(*handler)(); (*handler)();
} }
catch_any() mcatch_any()
{ {
Exceptions::error (Exceptions::f_msg_throw_from_terminate, Exceptions::error (Exceptions::f_msg_throw_from_terminate,
Exceptions::APPLICATION_ERROR); Exceptions::APPLICATION_ERROR);

View file

@ -23,7 +23,7 @@ XCOMM .../programs/dtinfo/mmdb/<subdir>/Imakefile
#define LargePICTable YES #define LargePICTable YES
#define CplusplusSource YES #define CplusplusSource YES
DEPEND_DEFINES = $(CXXDEPENDINCLUDES) DEPEND_DEFINES = $(CXXDEPENDINCLUDES) $(DEPENDDEFINES)
XCOMM In DtMmdb we compile as C_API sources. XCOMM In DtMmdb we compile as C_API sources.
DEFINES = -DC_API DEFINES = -DC_API

View file

@ -44,7 +44,8 @@
#include <sys/time.h> #include <sys/time.h>
#include <math.h> #include <math.h>
#include <fstream.h> #include <fstream>
using namespace std;
#include <search.h> #include <search.h>
#include "dynhash/bucket.h" #include "dynhash/bucket.h"

View file

@ -59,7 +59,7 @@ atoi_larson* data_t::larson_convertor_ptr;
atoi_pearson* data_t::pearson_convertor_ptr; atoi_pearson* data_t::pearson_convertor_ptr;
#else #else
atoi_larson data_t::larson_convertor; atoi_larson data_t::larson_convertor;
atoi_pearson data_t::pearson_convertor(MAXSHORT, 256); atoi_pearson data_t::pearson_convertor(SHRT_MAX, 256);
#endif #endif
data_t::data_t(data_t& d) data_t::data_t(data_t& d)
@ -214,7 +214,7 @@ istream& operator >>(istream& i, data_t& d)
delete d.key.str_key; delete d.key.str_key;
d.flag = (data_t::flag_type)atoi(buf); 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 ) if ( d.flag == data_t::INT )
d.key.int_key = atoi(key_ptr); d.key.int_key = atoi(key_ptr);

View file

@ -53,7 +53,8 @@
#ifdef C_API #ifdef C_API
#include "utility/c_iostream.h" #include "utility/c_iostream.h"
#else #else
#include <iostream.h> #include <iostream>
using namespace std;
#endif #endif
int steps[] = { 2, 3, 5, 7, 11, 13, 17, 21, 23, 29, 31, 37, 41, 43, 47, 51 }; 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() void imp_die::init_table()
{ {
for ( int i = 0; i < B; i++ ) { int i;
for ( i = 0; i < B; i++ ) {
bucket_array[i] = 0 ; bucket_array[i] = 0 ;
} }
for ( i = 0; i < H; i++ ) { for ( i = 0; i < H; i++ ) {
@ -142,7 +144,8 @@ void imp_die::clean()
n = 0; n = 0;
collect_all_keys(); collect_all_keys();
for ( int i=0; i<B; i++ ) { int i;
for ( i=0; i<B; i++ ) {
if ( bucket_array[i] ) { if ( bucket_array[i] ) {
delete bucket_array[i]; delete bucket_array[i];
bucket_array[i] = 0 ; bucket_array[i] = 0 ;

View file

@ -23,7 +23,7 @@ XCOMM .../programs/dtinfo/mmdb/<subdir>/Imakefile
#define LargePICTable YES #define LargePICTable YES
#define CplusplusSource YES #define CplusplusSource YES
DEPEND_DEFINES = $(CXXDEPENDINCLUDES) DEPEND_DEFINES = $(CXXDEPENDINCLUDES) $(DEPENDDEFINES)
XCOMM In DtMmdb we compile as C_API sources. XCOMM In DtMmdb we compile as C_API sources.
DEFINES = -DC_API -DPORTABLE_DB DEFINES = -DC_API -DPORTABLE_DB

View file

@ -140,7 +140,8 @@ h_convertor(pms.v_n, 128, rnd)
{ {
v_bucket_array = new bucketPtr[v_no_buckets]; v_bucket_array = new bucketPtr[v_no_buckets];
for ( int i=0; i<v_no_buckets; v_bucket_array[i++] = 0); int i;
for ( i=0; i<v_no_buckets; v_bucket_array[i++] = 0);
//debug(cerr, pms); //debug(cerr, pms);
@ -234,7 +235,8 @@ void buckets::sort_by_size()
{ {
//MESSAGE(cerr, "sort()"); //MESSAGE(cerr, "sort()");
int* links = new int[v_no_buckets]; int* links = new int[v_no_buckets];
for ( int i=0; i<v_no_buckets; links[i++]=-1 ); int i;
for ( i=0; i<v_no_buckets; links[i++]=-1 );
int* sizes = new int[v_max_bucket_sz+1]; int* sizes = new int[v_max_bucket_sz+1];
for ( i=0; i<v_max_bucket_sz+1; sizes[i++]=-1 ); for ( i=0; i<v_max_bucket_sz+1; sizes[i++]=-1 );

View file

@ -57,7 +57,7 @@
//compute_a_mphf(char* key_file, params& pms, char* mphf_spec_file) //compute_a_mphf(char* key_file, params& pms, char* mphf_spec_file)
compute_a_mphf(char** keys, params& pms, buffer& mphf_buffer) int compute_a_mphf(char** keys, params& pms, buffer& mphf_buffer)
{ {
mphf_hash_table ht(pms); mphf_hash_table ht(pms);
@ -98,7 +98,7 @@ compute_a_mphf(char** keys, params& pms, buffer& mphf_buffer)
return 1; return 1;
} }
search(buckets& bs, mphf_hash_table& ht, params& pms) int search(buckets& bs, mphf_hash_table& ht, params& pms)
{ {
int i = 0, int i = 0,
fails = 0, fails = 0,
@ -158,7 +158,7 @@ search(buckets& bs, mphf_hash_table& ht, params& pms)
return ( patternFit >= 0 ) ? 0 : -1; return ( patternFit >= 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 i;
int_pattern new_pattern(bs.max_bucket_sz()); 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'); 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_n << "\n";
fout << pms.v_b << "\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); mphf_buffer.set_content_sz(spec_bytes);
memcpy(mphf_buffer.get_base(), fout.str().c_str(), spec_bytes);
delete c_array; delete c_array;

View file

@ -53,9 +53,9 @@
#define _mphf_funcs_h 1 #define _mphf_funcs_h 1
#ifdef C_API #ifdef C_API
#include "utility/c_strstream.h" #include "utility/c_stringstream.h"
#else #else
#include <strstream.h> #include <sstream>
#endif #endif
#include "utility/funcs.h" #include "utility/funcs.h"

View file

@ -152,10 +152,10 @@ int mphf_hash_table::fit_hash_table(int_pattern& pat)
{ {
int i, j; int i, j;
for ( i=0; i<pat.no_elmts(); i++ ) { for ( i=0; i<pat.no_elmts(); i++ ) {
if ( v_rep[int(pat[i])] != (int) NULL ) { if ( v_rep[int(pat[i])] != (int) 0 ) {
for ( j=0; j<=i; j++ ) for ( j=0; j<=i; j++ )
v_rep[int(pat[j])] = (int) NULL; v_rep[int(pat[j])] = (int) 0;
v_num_filled_slots -= i+1; v_num_filled_slots -= i+1;
return -1; return -1;

View file

@ -62,7 +62,8 @@ struct partition_t {
void params::select_value(float bts) void params::select_value(float bts)
{ {
for ( int i=0; ; i++ ) { int i;
for ( i=0; ; i++ ) {
if ( v_n <= partition_tbl[i].upper_bound ) if ( v_n <= partition_tbl[i].upper_bound )
break; break;
} }

View file

@ -51,7 +51,12 @@
#ifndef _params_h #ifndef _params_h
#define _params_h 1 #define _params_h 1
#include <limits.h>
#if defined(CSRG_BASED)
#define MAXINT INT_MAX
#else
#include <values.h> #include <values.h>
#endif
#include "utility/funcs.h" #include "utility/funcs.h"
class params class params

View file

@ -78,7 +78,8 @@ void sorter::_init(istream& in)
{ {
v_bucket_array = new bucketPtr[NUM_BUCKETS]; v_bucket_array = new bucketPtr[NUM_BUCKETS];
for ( int i=0; i<NUM_BUCKETS; v_bucket_array[i++] = 0); int i;
for ( i=0; i<NUM_BUCKETS; v_bucket_array[i++] = 0);
char key_buf[LBUFSIZ]; char key_buf[LBUFSIZ];
@ -105,7 +106,8 @@ void sorter::_init(istream& in)
sorter::~sorter() sorter::~sorter()
{ {
for ( int i=0; i<NUM_BUCKETS; delete v_bucket_array[i++] ); int i;
for ( i=0; i<NUM_BUCKETS; delete v_bucket_array[i++] );
delete v_bucket_array; delete v_bucket_array;
for ( i=0; i<v_no_unique_keys; delete v_unique_keys[i++] ); for ( i=0; i<v_no_unique_keys; delete v_unique_keys[i++] );
@ -117,7 +119,8 @@ void sorter::filter_by_hash()
// a small hash table for keys to map to // a small hash table for keys to map to
v_map_table = new charPtr[2*v_max_bucket_sz]; v_map_table = new charPtr[2*v_max_bucket_sz];
for ( int i=0; i<2*v_max_bucket_sz; v_map_table[i++] = 0 ); int i;
for ( i=0; i<2*v_max_bucket_sz; v_map_table[i++] = 0 );
// an int table remembering slots in the v_map_table // an int table remembering slots in the v_map_table
// that have been mapped. // that have been mapped.
@ -283,7 +286,8 @@ void sorter::remove_keys(bucketPtr bkt, char* key, slist_void_ptr_cell* lp)
void sorter::assemble_unique_keys() void sorter::assemble_unique_keys()
{ {
for ( int i=0; i<NUM_BUCKETS; i++ ) { int i;
for ( i=0; i<NUM_BUCKETS; i++ ) {
if ( v_bucket_array[i] ) { if ( v_bucket_array[i] ) {
v_no_unique_keys += v_bucket_array[i] -> v_no_keys; v_no_unique_keys += v_bucket_array[i] -> v_no_keys;
} }

View file

@ -53,7 +53,12 @@
#ifndef _sorter_h #ifndef _sorter_h
#define _sorter_h 1 #define _sorter_h 1
#include <limits.h>
#if defined(CSRG_BASED)
#define MAXINT INT_MAX
#else
#include <values.h> #include <values.h>
#endif
#include "utility/funcs.h" #include "utility/funcs.h"
#include "utility/atoi_fast.h" #include "utility/atoi_fast.h"
#include "hmphf/buckets.h" #include "hmphf/buckets.h"

View file

@ -23,7 +23,7 @@ XCOMM .../programs/dtinfo/mmdb/<subdir>/Imakefile
#define LargePICTable YES #define LargePICTable YES
#define CplusplusSource YES #define CplusplusSource YES
DEPEND_DEFINES = $(CXXDEPENDINCLUDES) DEPEND_DEFINES = $(CXXDEPENDINCLUDES) $(DEPENDDEFINES)
XCOMM In DtMmdb we compile as C_API sources. XCOMM In DtMmdb we compile as C_API sources.
DEFINES = -DC_API -DPORTABLE_DB DEFINES = -DC_API -DPORTABLE_DB

View file

@ -76,7 +76,7 @@ btree_index::~btree_index()
delete v_idx_agent_ptr; 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); 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 ) if ( v_idx_agent_ptr -> member(k) == false )
throw(stringException("first_of_invlist(): key is not in btree")); throw(stringException("first_of_invlist(): key is not in btree"));
return int(k.dt); return size_t(k.dt);
} }

View file

@ -65,7 +65,7 @@ public:
//init run time data members //init run time data members
Boolean init_data_member( inv_lists_handler*, const char* btree_store ); 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); MMDB_SIGNATURES(btree_index);
}; };

View file

@ -72,7 +72,7 @@ dyn_disk_index::init_data_member(inv_lists_handler* y, abs_storage* store)
return true; 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")); throw(stringException("handler_to_int() not implemented"));
return 0; return 0;

View file

@ -65,7 +65,7 @@ public:
//init run time data components //init run time data components
Boolean init_data_member( inv_lists_handler*, abs_storage* ); 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); MMDB_SIGNATURES(dyn_disk_index);
}; };

View file

@ -160,7 +160,7 @@ MESSAGE(cerr, "insert to list after");
(*v_inv_lists_hd) -> append_list(list); (*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)); //debug(cerr, int(intKey.dt));
v_idx_agent_ptr -> insert( intKey ); v_idx_agent_ptr -> insert( intKey );

View file

@ -93,7 +93,7 @@ dyn_memory_index::~dyn_memory_index()
char buf[PATHSIZ]; char buf[PATHSIZ];
for ( int i=0; i<PATHSIZ; buf[i++]=0 ); for ( int i=0; i<PATHSIZ; buf[i++]=0 );
ostrstream oid_t_out(buf, PATHSIZ); ostringstream oid_t_out(buf, PATHSIZ);
my_oid().asciiOut(oid_t_out); my_oid().asciiOut(oid_t_out);
*/ */
@ -106,7 +106,7 @@ dyn_memory_index::~dyn_memory_index()
} }
} }
int dyn_memory_index::handler_to_inv_idx(const handler&) size_t dyn_memory_index::handler_to_inv_idx(const handler&)
{ {
throw(stringException( throw(stringException(
"dyn_memory_index::handler_to_int(): not implemented yet" "dyn_memory_index::handler_to_int(): not implemented yet"

View file

@ -67,7 +67,7 @@ public:
//init run time data components //init run time data components
Boolean init_data_member( inv_lists_handler*, abs_storage* ); Boolean init_data_member( inv_lists_handler*, abs_storage* );
int handler_to_inv_idx(const handler&); size_t handler_to_inv_idx(const handler&);
virtual Boolean remove_loc(handler&, const oid_t&); virtual Boolean remove_loc(handler&, const oid_t&);
virtual Boolean remove_loc(const oid_t&, const oid_t&); virtual Boolean remove_loc(const oid_t&, const oid_t&);

View file

@ -398,11 +398,14 @@ Boolean fast_mphf::build(istream& in)
throw(stringException("finding a mphf failed")); throw(stringException("finding a mphf failed"));
} }
istrstream strin(mphf_spec.get_base(), mphf_spec.content_sz()); stringstream strin;
if ( !strin ) { if ( !strin ) {
throw(streamException(strin.rdstate())); throw(streamException(strin.rdstate()));
} }
else {
strin.write(mphf_spec.get_base(), mphf_spec.content_sz());
}
asciiIn(strin); asciiIn(strin);

View file

@ -107,10 +107,11 @@ oid_t c_index::first_of_invlist(int ind)
Boolean c_index::get_key_string(const handler& t) const Boolean c_index::get_key_string(const handler& t) const
{ {
ostrstream out(v_static_key.get(), v_static_key.alloc_size()); ostringstream out(v_static_key.get());
((handler&)t) -> asciiOut(out); ((handler&)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; return true;
} }
@ -119,10 +120,11 @@ Boolean c_index::get_key_string(const oid_t& t) const
{ {
v_static_key.reset(); v_static_key.reset();
ostrstream out(v_static_key.get(), v_static_key.alloc_size()); ostringstream out(v_static_key.get());
t.asciiOut(out); 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; return true;
} }

View file

@ -52,9 +52,9 @@
#define _index_h 1 #define _index_h 1
#ifdef C_API #ifdef C_API
#include "utility/c_strstream.h" #include "utility/c_stringstream.h"
#else #else
#include <strstream.h> #include <sstream>
#endif #endif
#include "object/oid_list.h" #include "object/oid_list.h"
@ -100,7 +100,7 @@ public:
virtual int invlist_length(handler&) = 0; virtual int invlist_length(handler&) = 0;
// translate a query to an index of an inv_list // 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 // status inquiry functions
int bound_to() const { return v_cmp_selector; } ; int bound_to() const { return v_cmp_selector; } ;

View file

@ -151,7 +151,7 @@ MESSAGE(cerr, "inv::insert");
debug(cerr, index); debug(cerr, index);
*/ */
if ( INRANGE(list_id.ccode(), 0, 1) && if ( INRANGE((short)list_id.ccode(), 0, 1) &&
id.ccode() != OID_LIST_CODE id.ccode() != OID_LIST_CODE
) { ) {

Some files were not shown because too many files have changed in this diff Show more