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 */
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
#ifndef _fp_h
#define _fp_h 1
-#include <iostream.h>
+#include <iostream>
+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;
// $TOG: autoNumber.C /main/6 1998/04/17 11:47:13 mgreess $
#include <ctype.h>
+#if defined(CSRG_BASED)
+#define MAXINT INT_MAX
+#else
#include <values.h>
+#endif
#include "HardCopy/autoNumber.h"
#include "HardCopy/FPExceptions.h"
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;
x = z;
}
- for (int k=0; k<digits-i; k++ )
+ int k;
+ for (k=0; k<digits-i; k++ )
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] = 0;
char* ptr = f_buf.get_base();
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));
else
*ptr = 0;
const char* romanCardinal = romanCardinals[j][buf[i]-'1'];
char precise_romanCardinal[8];
+ int k;
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] = 0;
}
else {
- for (int k=0; romanCardinal[k]; k++)
+ for (k=0; romanCardinal[k]; k++)
precise_romanCardinal[k] = tolower(romanCardinal[k]);
precise_romanCardinal[k] = 0;
}
const char* gi = 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]);
key = new CC_String(gi);
{
FeatureValue* fv = 0;
- try
+ mtry
{
fv = expr -> evaluate();
}
- catch_any()
+ mcatch_any()
{
return false;
}
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))
ForceSubdirs($(SUBDIRS))
DependSubdirs($(SUBDIRS))
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) \
#include <Library.tmpl>
+XCOMM Variables to switch on debug mode temporarily
+XCOMM CDEBUGFLAGS = -g -DDEBUG
+XCOMM CXXDEBUGFLAGS = -g -DDEBUG
+
DependTarget()
delete f_value ;
}
+bool
Attribute::operator==(const Attribute &attr) const
{
/*
~Attribute();
const Symbol &name() const { return f_name; }
- operator==(const Attribute &) const ;
+ bool operator==(const Attribute &) const ;
const char *value() const { return f_value ; }
#ifndef _BitVector_h
#define _BitVector_h 1
-#include <stream.h>
+#include <sstream>
+#include <ostream>
+using namespace std;
#ifndef CDE_NEXT
#ifndef _debug_h
#define _debug_h 1
-#include <iostream.h>
+#include <iostream>
+using namespace std;
#ifdef DEBUG
#define ON_DEBUG(stmt) stmt
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
{
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:");
*/
#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);
int ignore = 0 ;
- try
+ mtry
{
// process whatever comes right after start tag
TagType tt = read_tag(input, 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
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);
!defined(_IBMR2) && \
!defined(__uxp__) && \
!defined(USL) && \
- !defined(linux)
+ !defined(linux) && \
+ !defined(CSRG_BASED)
volatile
#endif
AttributeList *attrs = 0;
!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);
f_ignoring_element = ignore ;
}
}
- catch_any()
+ mcatch_any()
{
/*
delete attrs ;
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
}
}
*(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
/*
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
}
}
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);
if (ignore)
f_ignoring_element = 0;
}
- catch_any()
+ mcatch_any()
{
rethrow;
}
char *theData = 0;
- try {
+ mtry {
while ((tt = read_tag(input,output)) != NoTag)
{
switch (tt)
{
//#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 ;
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)
}
}
}
- catch_any()
+ mcatch_any()
{
delete newAttribute;
*(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));
/* Copyright (c) 1995 FUJITSU LIMITED */
/* All Rights Reserved */
-#include <iostream.h>
-#include <strstream.h>
+#include <iostream>
+#include <sstream>
+using namespace std;
#include "SymTab.h"
#include "Exceptions.hh"
char* const f_buffer;
ostrstream f_output;
#else
- strstreambuf *f_streambuf ;
+ stringbuf *f_streambuf;
ostream f_output;
#endif
Resolver &f_resolver;
* Floor, Boston, MA 02110-1301 USA
*/
// $TOG: Element.C /main/5 1998/04/17 11:48:25 mgreess $
-#include <iostream.h>
+#include <iostream>
+using namespace std;
#include <stdlib.h>
#include "StyleSheetExceptions.h"
#include "Element.h"
#include "VariableTable.h"
#include "Renderer.h"
#include "Debug.h"
-#include <stream.h>
+#include <sstream>
#include "HardCopy/autoNumberFP.h"
{
// 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();
}
}
- catch_any()
+ mcatch_any()
{
delete left ;
delete right ;
// etc.
FeatureValue *return_variable = 0;
- try
+ mtry
{
return_variable = variable_value->evaluate() ;
}
- catch_any()
+ mcatch_any()
{
delete return_variable;
delete variable_value ;
#ifndef _Feature_h
#define _Feature_h
-#include <stream.h>
+#include <sstream>
#ifndef CDE_NEXT
#include "StyleSheet/StyleSheetExceptions.h"
#include "utility/const.h"
#include "utility/funcs.h"
-#include <iostream.h>
+#include <iostream>
+using namespace std;
featureDefDictionary* g_FeatureDefDictionary = 0;
}
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;
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 */
// cast to non-const to get iterator
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 << "{" << endl;
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];
for ( i=0; i<len2; i++ )
{
FeatureValue *x = 0;
FeatureValue *y = 0;
- try
+ mtry
{
x = expr.evaluate();
y = operator+(*x);
delete x;
return y;
}
- catch_any()
+ mcatch_any()
{
delete x;
rethrow;
f_name(strdup(x.f_name)), FeatureValue(array),
pointer_vector<FeatureValue>(x.length(), 0)
{
- try
+ mtry
{
for ( int i=0; i<length(); i++ )
(*this)[i] = x[i] -> clone();
return;
}
- catch_any()
+ mcatch_any()
{
for ( int i=0; i<length(); i++ )
delete (*this)[i];
{
FeatureValueArray *result = new FeatureValueArray(f_name, length());
- try
+ mtry
{
for ( int i=0; i<length(); i++ ) {
(*result)[i] = (*this)[i] -> evaluate();
}
return result;
}
- catch_any()
+ mcatch_any()
{
delete result;
rethrow;
* Floor, Boston, MA 02110-1301 USA
*/
// $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 "PathQualifier.h"
#include "Element.h"
#include "dti_cc/cc_hdict.h"
#endif
-#include <stream.h>
+#include <sstream>
#include "Types.h"
#include "SymTab.h"
#include "SSPath.h"
ostream& operator <<(ostream& out, PathTerm& pt)
{
- out << pt.symbol() << " (" << int(pt.f_PQExpr) << ") ";
+ out << pt.symbol() << " (" << size_t(pt.f_PQExpr) << ") ";
return out;
}
#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
#define CASTUAEXCEPT
#define CASTUTEXCEPT
#define CASTUVEXCEPT
-#endif
class StyleSheetException : public Exception
{
#include "dti_cc/CC_String.h"
#include "dti_cc/cc_hdict.h"
//#include "StyleSheet/cde_next.h"
-#include <iostream.h>
+#include <iostream>
+using namespace std;
#endif
#include "Types.h"
#define defParserBYACC 1
#include <stdio.h>
#include <ctype.h>
-#include <stream.h>
-#include <iostream.h>
+#include <sstream>
+#include <iostream>
+using namespace std;
#include "Debug.h"
#include "FeatureDefDictionary.h"
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
*++defParservsp = defParserval;
goto defParserloop;
defParseroverflow:
- defParsererror("yacc stack overflow");
+ defParsererror((char*)"yacc stack overflow");
defParserabort:
return (1);
defParseraccept:
%{
#include <stdio.h>
#include <ctype.h>
-#include <stream.h>
+#include <sstream>
#include <iostream.h>
#include "Debug.h"
#include "FeatureDefDictionary.h"
#include <stdlib.h>
-#if !defined(__osf__) && !defined(USL)
+#if !defined(__osf__) && !defined(USL) && !defined(linux) && !defined(CSRG_BASED)
#include <osfcn.h>
#endif
#include "FeatureDefDictionary.h"
#include "defParser.tab.h"
#include "Debug.h"
-#include <iostream.h>
+#include <iostream>
+using namespace std;
extern istream *g_defParserin;
#include "FeatureDefDictionary.h"
#include "defParser.tab.h"
#include "Debug.h"
-#include <iostream.h>
+#include <iostream>
+using namespace std;
extern istream *g_yyin;
#include "StyleSheet.h"
#include "StyleSheetExceptions.h"
#include "VariableTable.h"
-#include <iostream.h>
+#include <iostream>
+using namespace std;
Renderer *gRenderer = 0;
class TestRenderer : public Renderer
#define styleBYACC 1
#include <stdio.h>
#include <ctype.h>
-#include <stream.h>
-#include <iostream.h>
+#include <sstream>
+#include <iostream>
+using namespace std;
#include <assert.h>
#include "StyleSheetExceptions.h"
#include "VariableTable.h"
#endif
stylenewerror:
#endif /* if 0 */
- styleerror("syntax error");
+ styleerror((char*)"syntax error");
#if 0 /* remove if needed */
#ifdef lint
goto styleerrlab;
*++stylevsp = styleval;
goto styleloop;
styleoverflow:
- styleerror("yacc stack overflow");
+ styleerror((char*)"yacc stack overflow");
styleabort:
return (1);
styleaccept:
%{
#include <stdio.h>
#include <ctype.h>
-#include <stream.h>
+#include <sstream>
#include <iostream.h>
#include <assert.h>
#include "StyleSheetExceptions.h"
#include <stdlib.h>
-#if !defined(__osf__) && !defined(USL)
+#if !defined(__osf__) && !defined(USL) && !defined(linux) && !defined(CSRG_BASED)
#include <osfcn.h>
#endif
#include "StyleSheetExceptions.h"
#include "style.tab.h"
#include "Debug.h"
-#include <iostream.h>
+#include <iostream>
+using namespace std;
istream *g_stylein = 0;
#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
*/
+#ifndef C_API
+#include <sstream>
+using namespace std;
+#endif
#include "api/info_base.h"
#include "compression/abs_agent.h"
*info_base_locale = 0;
char* nm ;
+ int i;
//////////////////////
// sets
//////////////////////
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]);
- try {
+ mtry {
info_base_set_ptrs[i] = (cset_handler*)
(f_obj_dict -> get_handler(nm));
}
- catch_any()
+ mcatch_any()
{
info_base_set_ptrs[i] = 0;
}
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;
}
//
////////////////////////////////////////////////////////////////////
-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);
throw(stringException("non page store no supported"));
}
- iterator* it = new iterator(x, code);
+ Iterator* it = new Iterator(x, code);
it -> ind = s -> first_loc();
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() );
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());
#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*();
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
//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,
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;
/*************************************/
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",
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) ) {
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) {
}
}
- catch (mmdbException &,e)
+ mcatch (mmdbException &,e)
{
} end_try;
info_lib::getInfobasesByComponent(char **locator_strings, int count, enum TestSelector sel)
{
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;
for ( i=0; i<count; i++ ) {
- try {
+ mtry {
if ( locator_strings[i] && ibs[i] == 0 ) {
switch (sel) {
}
}
- catch (mmdbException &,e)
+ mcatch (mmdbException &,e)
{
} end_try;
#include "dstr/dlist_void_ptr_cell.h"
#include "api/info_base.h"
#include "utility/funcs.h"
+#include "schema/object_dict.h"
/*************************************/
// The info_lib class
handler* z = get_handler(i, OID_CODE);
oid_handler* y = (oid_handler*)z;
- sprintf(buf, "%d.%d\n", x.ccode(), x.icode());
- istrstream in(buf, 64);
+ sprintf(buf, "%d.%d\n", x.ccode(), (int)x.icode());
+ istringstream in(buf);
(*y) -> asciiIn(in);
#define _utility_h 1
#ifdef C_API
-#include "utility/c_strstream.h"
+#include "utility/c_stringstream.h"
#else
-#include <strstream.h>
+#include <sstream>
#endif
#include <string.h>
#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
const DBT *key, *data;
int *exactp;
{
- EPG e;
+ static EPG e;
PAGE *h;
size_t nbytes;
int cmp;
#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
#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) */
*/
#if defined(__GNUC__) && !defined(__STRICT_ANSI__)
#define __dead __volatile
+#ifndef __pure
#define __pure __const
+#endif
#else
#define __dead
#define __pure
/*
* 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);
*/
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;
#include "cdefs.h"
#include <compat.h>
+#include <string.h>
#ifdef __STDC__
#include <stdarg.h>
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
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
#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
//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<cts; i++ ) {
+ for ( i=0; i<cts; i++ ) {
sz += ( e_units[i] -> word -> size() +
sizeof(unsigned int) +
sizeof(char)
#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>
#endif
+#endif
/* use prototypes in function declarations */
#define ps_USE_PROTOS
#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>
#endif
+#endif
/* use prototypes in function declarations */
#define sgml_USE_PROTOS
node = root;
- int j;
+ int i, j;
- for ( int i=0; i<len; i++ ) {
+ for ( i=0; i<len; i++ ) {
j = str[i];
//debug(cerr, str[i]);
// code for testing. I know it is slow.
////////////////////////////////////////
+ int ret;
fstream out(UNCOMPRESSED, ios::out|ios::trunc);
if ( !out )
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);
if ( !in )
throw(streamException(in.rdstate()));
- int x = bytes(in);
+ int x = bytes((char*)COMPRESSED);
compressed.expand_chunk(x);
void zip::decompress(buffer& compressed, buffer& uncompressed)
{
+ int ret;
fstream out(COMPRESSED, ios::out|ios::trunc);
if ( !out )
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);
#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
if ( x ) {
hash_vector -> insert(
- voidPtr(ind),
+ (voidPtr)(size_t)ind,
x -> slot_num(k, r, p, hash_vector -> count())
);
}
// others may be overwritten.
////////////////////////////////////////
hash_vector -> insert(
- voidPtr(slot_num),
+ (voidPtr)(size_t)slot_num,
w.slot_num(k, r, p, hash_vector -> count())
);
}
#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
#ifdef C_API
#include "utility/c_stream.h"
#else
-#include <stream.h>
+#include <sstream>
+using namespace std;
#endif
#ifdef C_API
#include "utility/c_stream.h"
#else
-#include <stream.h>
+#include <sstream>
+using namespace std;
#endif
token_stack::token_stack() : curr_token_start(0)
template <class T>
void CC_TPtrDlist<T>::clear()
{
- if ( !destructed ) {
+ if ( !this->get_destructed() ) {
CC_TPtrSlistIterator<T> iter(*this);
if (++iter) {
while (1) {
void CC_TPtrDlist<T>::clearAndDestroy()
{
- destructed = TRUE;
+ this->set_destructed(TRUE);
CC_TPtrDlistIterator<T> iter(*this);
if ( ++iter ) {
while (1) {
}
-
-//------------------------------------------------------------------
-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>
T *CC_TPtrSlist<T>::removeAt(size_t pos) {
#define __CC_Slist_h
#include "CC_Listbase.h"
+#include "cc_exceptions.h"
template <class T> class CC_TPtrSlist;
template <class T> class CC_TPtrSlistIterator;
friend class CC_List_Iterator<T>;
protected:
- CC_Boolean destructed;
+ CC_Boolean destructed;
// Inherit public members from CC_Listbase
/*
void insert(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
*/
+ {
+ // 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
* if list size is smaller than pos
operator CC_Listbase *() { return(this); }
+ CC_Boolean get_destructed() const
+ { return (destructed); }
+ CC_Boolean set_destructed(CC_Boolean what)
+ { destructed = what; }
};
// $XConsortium: CC_Stack.C /main/4 1996/10/08 19:22:53 cde-hal $
#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 );
-}
{
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<T>();
+ }
- ~Stack ();
+ ~Stack ()
+ {
+ delete Items;
+ }
public:
- T pop ();
- void push (const T);
- T& top () const;
+ 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);
+ }
+
+ 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
{
return( Items->entries() ); //ie no. of elements in the stack
}
+
int empty() const {
return( Items->entries() == 0 );
}
// $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)
{
{
cerr << low << "\t";
cerr << high << "\t";
- cerr << index << "\n";
+ cerr << mindex << "\n";
return out;
}
#ifndef _cc_exception_h
#define _cc_exception_h 1
-#include <fstream.h>
+#include <fstream>
+#include <iostream>
+using namespace std;
#include "Exceptions.hh"
#define END_TRY end_try
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
{
public:
DECLARE_EXCEPTION(ccStringException, ccException);
- ccStringException(char* m) : msg(m) {};
+ ccStringException(char const* m) : msg((char*)m) {};
~ccStringException() {};
virtual ostream& asciiOut(ostream&);
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&);
-/*
- * 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 <class K, class V> CC_Boolean kv_pair<K, V>::f_needRemove = FALSE;
#endif
#include "dti_cc/cc_pvect.h"
#include "dti_cc/CC_Slist.h"
-#include <iostream.h>
+#include <iostream>
+using namespace std;
template <class K, class V>
class kv_pair {
#define _cc_dlist_array_h
#include "dti_cc/CC_Dlist.h"
+#include "dti_cc/cc_exceptions.h"
template <class T>
class dlist_array : public CC_TPtrDlist<T>
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); };
};
}
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 )
throw(CASTCCBEXCEPT ccBoundaryException(0, f_size-1, i));
}
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 )
throw(CASTCCBEXCEPT ccBoundaryException(0, f_size-1, i));
#ifndef _cc_pvector_h
#define _cc_pvector_h 1
+#include <stddef.h>
#include "dti_cc/types.h"
template <class T>
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; };
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
-// $TOG: Exception.hh /main/11 1998/04/20 09:55:15 mgreess $
+
#include <ctype.h>
#define G_TEMP_SPACE_SIZE 1024
-#if defined(linux)
-#define CASTEXCEPT (Exception*)
-#else
#define CASTEXCEPT
-#endif
class Exception : public Destructable
{
{ 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); } \
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
// 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.
(*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,
#define _Exceptions_hh_active
+#ifndef C_API
#ifndef NATIVE_EXCEPTIONS
+#define NATIVE_EXCEPTIONS
+#endif
+#define Exception mException
+#endif
+#ifndef NATIVE_EXCEPTIONS
extern "C" {
#include <setjmp.h>
#include <stdio.h>
#include <stdlib.h>
}
+#else
+extern "C" {
+#include <stdio.h>
+#include <stdlib.h>
+}
+#endif
+#ifndef NATIVE_EXCEPTIONS
#ifdef EXC_DEBUG
#define PRINTF(MSG) printf MSG
#ifndef DEBUG
#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
// TRY MACRO
-#define try \
+#define mtry \
{ \
Jump_Environment __jump_env; \
if (setjmp (__jump_env.f_env) == 0) {
// 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
#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 \
#define LargePICTable YES
#define CplusplusSource YES
-DEPEND_DEFINES = $(CXXDEPENDINCLUDES)
+DEPEND_DEFINES = $(CXXDEPENDINCLUDES) $(DEPENDDEFINES)
#if defined(SunArchitecture) && CplusplusCompilerMajorVersion > 3
EXCEPTION_DEFINES = -DHAS_TERMINATE
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];
#else
-#include <new.h>
+#include <new>
+using namespace std;
#endif
// 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);
#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
#include <sys/time.h>
#include <math.h>
-#include <fstream.h>
+#include <fstream>
+using namespace std;
#include <search.h>
#include "dynhash/bucket.h"
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)
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);
#ifdef C_API
#include "utility/c_iostream.h"
#else
-#include <iostream.h>
+#include <iostream>
+using namespace std;
#endif
int steps[] = { 2, 3, 5, 7, 11, 13, 17, 21, 23, 29, 31, 37, 41, 43, 47, 51 };
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++ ) {
n = 0;
collect_all_keys();
- for ( int i=0; i<B; i++ ) {
+ int i;
+ for ( i=0; i<B; i++ ) {
if ( bucket_array[i] ) {
delete bucket_array[i];
bucket_array[i] = 0 ;
#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
{
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);
{
//MESSAGE(cerr, "sort()");
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];
for ( i=0; i<v_max_bucket_sz+1; sizes[i++]=-1 );
//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);
return 1;
}
-search(buckets& bs, mphf_hash_table& ht, params& pms)
+int search(buckets& bs, mphf_hash_table& ht, params& pms)
{
int i = 0,
fails = 0,
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_pattern new_pattern(bs.max_bucket_sz());
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";
mphf_buffer.set_content_sz(spec_bytes);
+ memcpy(mphf_buffer.get_base(), fout.str().c_str(), spec_bytes);
delete c_array;
#define _mphf_funcs_h 1
#ifdef C_API
-#include "utility/c_strstream.h"
+#include "utility/c_stringstream.h"
#else
-#include <strstream.h>
+#include <sstream>
#endif
#include "utility/funcs.h"
{
int i, j;
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++ )
- v_rep[int(pat[j])] = (int) NULL;
+ v_rep[int(pat[j])] = (int) 0;
v_num_filled_slots -= i+1;
return -1;
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 )
break;
}
#ifndef _params_h
#define _params_h 1
+#include <limits.h>
+#if defined(CSRG_BASED)
+#define MAXINT INT_MAX
+#else
#include <values.h>
+#endif
#include "utility/funcs.h"
class params
{
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];
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;
for ( i=0; i<v_no_unique_keys; delete v_unique_keys[i++] );
// a small hash table for keys to map to
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
// that have been mapped.
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] ) {
v_no_unique_keys += v_bucket_array[i] -> v_no_keys;
}
#ifndef _sorter_h
#define _sorter_h 1
+#include <limits.h>
+#if defined(CSRG_BASED)
+#define MAXINT INT_MAX
+#else
#include <values.h>
+#endif
#include "utility/funcs.h"
#include "utility/atoi_fast.h"
#include "hmphf/buckets.h"
#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
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);
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);
}
//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);
};
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;
//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);
};
(*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 );
char buf[PATHSIZ];
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);
*/
}
}
-int dyn_memory_index::handler_to_inv_idx(const handler&)
+size_t dyn_memory_index::handler_to_inv_idx(const handler&)
{
throw(stringException(
"dyn_memory_index::handler_to_int(): not implemented yet"
//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&);
virtual Boolean remove_loc(handler&, const oid_t&);
virtual Boolean remove_loc(const oid_t&, const oid_t&);
throw(stringException("finding a mphf failed"));
}
- istrstream strin(mphf_spec.get_base(), mphf_spec.content_sz());
+ stringstream strin;
if ( !strin ) {
throw(streamException(strin.rdstate()));
}
+ else {
+ strin.write(mphf_spec.get_base(), mphf_spec.content_sz());
+ }
asciiIn(strin);
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);
- 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;
}
{
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;
}
#define _index_h 1
#ifdef C_API
-#include "utility/c_strstream.h"
+#include "utility/c_stringstream.h"
#else
-#include <strstream.h>
+#include <sstream>
#endif
#include "object/oid_list.h"
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; } ;
debug(cerr, index);
*/
- if ( INRANGE(list_id.ccode(), 0, 1) &&
+ if ( INRANGE((short)list_id.ccode(), 0, 1) &&
id.ccode() != OID_LIST_CODE
) {
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);
{
/*
MESSAGE(cerr, "batch_index_begin()");
-debug(cerr, cmp_selector);
+debug(cerr, v_cmp_selector);
debug(cerr, count());
debug(cerr, int(this));
*/
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; };
#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
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
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
#include <sys/types.h>
#include <sys/time.h>
#include <stdio.h>
+#include <stdlib.h>
#ifdef SVR4
#include <sys/systeminfo.h>
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
#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
*/
// $XConsortium: convert.cc /main/3 1996/06/11 17:23:53 cde-hal $
-#include <iostream.h>
+#include <iostream>
+using namespace std;
/*****************************************/
//Note: convert node.dat file to new format
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");
#ifdef C_API
#include <stdlib.h>
#else
-#include <new.h>
+#include <new>
+using namespace std;
#endif
#define NEW_AND_DELETE_BODIES(class_name) \
#endif
} else {
- istrstream in((char*)source);
+ istringstream in((char*)source);
in >> v_c_code;
#define _oid_t_h 1
#ifdef C_API
-#include "utility/c_strstream.h"
+#include "utility/c_stringstream.h"
#else
-#include <strstream.h>
+#include <sstream>
#endif
#include "utility/funcs.h"
// 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; } ;
delete buf;
buf = new char[buf_len+1];
}
- for ( int i=0; i<buf_len; i++ )
+ int i;
+ for ( i=0; i<buf_len; i++ )
buf[i] = char_set[rand_gen.rand() % sizeof(char_set)];
buf[i] = 0;
#define LargePICTable YES
#define CplusplusSource YES
-DEPEND_DEFINES = $(CXXDEPENDINCLUDES)
+DEPEND_DEFINES = $(CXXDEPENDINCLUDES) $(DEPENDDEFINES)
#ifdef DtinfoClient
DEFINES= -DC_API -DNO_DB_LOCK -DCDE_NEXT
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);
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"
static doc_smart_ptr*
getDocUsingPrOrSecOrSeq(DtMmdbInfoRequest* request)
{
- try {
+ mtry {
info_base* x = getBookCase(request -> bookcase_descriptor);
if ( x == 0 ) return 0;
return new doc_smart_ptr(x, seq+1);
}
- catch (mmdbException &,e)
+ mcatch (mmdbException &,e)
{
return 0;
} end_try;
DtMmdbHandle*
DtMmdbBookGetTocObjectId(DtMmdbInfoRequest* request)
{
- try {
+ mtry {
doc_smart_ptr* x = getDocUsingPrOrSecOrSeq(request);
if ( x == 0 ) return 0;
return z;
}
- catch (mmdbException &,e)
+ mcatch (mmdbException &,e)
{
return 0;
} end_try;
const char*
DtMmdbBookGetShortTitle(DtMmdbInfoRequest* request, unsigned int* length)
{
- try {
+ mtry {
doc_smart_ptr* x = getDocUsingPrOrSecOrSeq(request);
if ( x == 0 ) return 0;
return z;
}
- catch (mmdbException &,e)
+ mcatch (mmdbException &,e)
{
return 0;
} end_try;
const char*
DtMmdbBookGetLongTitle(DtMmdbInfoRequest* request, unsigned int* length)
{
- try {
+ mtry {
doc_smart_ptr* x = getDocUsingPrOrSecOrSeq(request);
if ( x == 0 ) return 0;
return z;
}
- catch (mmdbException &,e)
+ mcatch (mmdbException &,e)
{
return 0;
} end_try;
int DtMmdbBookGetSeqNum(DtMmdbInfoRequest* request)
{
- try {
+ mtry {
doc_smart_ptr* x = getDocUsingPrOrSecOrSeq(request);
if ( x == 0 ) return 0;
return z;
}
- catch (mmdbException &,e)
+ mcatch (mmdbException &,e)
{
return 0;
} end_try;
const char*
DtMmdbBookGetSeqLIcense(DtMmdbInfoRequest* request, unsigned int* length)
{
- try {
+ mtry {
doc_smart_ptr* x = getDocUsingPrOrSecOrSeq(request);
if ( x == 0 ) return 0;
return z;
}
- catch (mmdbException &,e)
+ mcatch (mmdbException &,e)
{
return 0;
} end_try;
DtMmdbHandle** DtMmdbBookGetTabList(DtMmdbInfoRequest* request, unsigned int* length)
{
- try {
+ mtry {
doc_smart_ptr* x = getDocUsingPrOrSecOrSeq(request);
if ( x == 0 ) return 0;
const char* desc = 0;
pstring_handler *p = 0;
- for (int i=0; i<count; i++) {
+ int i;
+ for (i=0; i<count; i++) {
p = (pstring_handler *)((*z)->get_component (i+1));
// The format is the title, a tab char, then the section oid.
return u;
}
- catch (mmdbException &,e)
+ mcatch (mmdbException &,e)
{
return 0;
} end_try;
int
DtMmdbGetBookCaseByName(int infolib_descriptor, const char* name)
{
- try {
+ mtry {
info_lib* x = mmdb_ptr -> getInfoLib(infolib_descriptor);
if ( x == 0 ) return -1;
return base -> index_id();
}
- catch (mmdbException &,e)
+ mcatch (mmdbException &,e)
{
return -1;
} end_try;
int
DtMmdbGetBookCaseByIndex(int infolib_descriptor, int index)
{
- try {
+ mtry {
info_lib* x = mmdb_ptr -> getInfoLib(infolib_descriptor);
if ( x == 0 ) return -1;
} else
return -1;
}
- catch (mmdbException &,e)
+ mcatch (mmdbException &,e)
{
return -1;
} end_try;
int
DtMmdbGetBookCaseByLoc(int infolib_descriptor, const char* locator)
{
- try {
+ mtry {
info_lib* x = mmdb_ptr -> getInfoLib(infolib_descriptor);
if ( x == 0 ) return -1;
return base -> index_id();
}
- catch (mmdbException &,e)
+ mcatch (mmdbException &,e)
{
return -1;
} end_try;
int* count_ptr)
{
- try {
+ mtry {
info_lib* x = mmdb_ptr -> getInfoLib(infolib_descriptor);
if ( x == 0 ) return 0;
return ds;
}
- catch (mmdbException &,e)
+ mcatch (mmdbException &,e)
{
if (count_ptr) *count_ptr = 0;
return 0;
DtMmdbBookCaseInfo*
DtMmdbBookCaseGetInfo(int bookcase_descriptor)
{
- try {
+ mtry {
info_base* x = getBookCase(bookcase_descriptor);
if ( x == 0 ) return 0;
return y;
}
- catch (mmdbException &,e)
+ mcatch (mmdbException &,e)
{
return 0;
} end_try;
#include "storage/page_storage.h"
#include "api/info_lib.h"
#include <stdlib.h>
+#include <limits.h>
#include "schema/store_desc.h"
#include "dynhash/data_t.h"
#include "index/index.h"
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));
void DtMmdbFreeHandle(DtMmdbHandle* x)
{
if ( x ) {
- delete x -> oid_ptr;
+// delete x -> oid_ptr;
free((void*)x);
}
}
extern "C" {
int auto_test_c_api(int argc, char** argv)
{
- try
+ mtry
{
#ifdef REGRESSION_TEST
OLIAS_DB db;
#endif
}
- catch (mmdbException &,e)
+ mcatch (mmdbException &,e)
{
cerr << "Exception msg: " << e << "\n";
return -1;
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;
static dlp_smart_ptr*
getDlpUsingProid(DtMmdbInfoRequest* request)
{
- try {
+ mtry {
info_base* x = getBookCase(request -> bookcase_descriptor);
if ( x == 0 ) return 0;
return 0;
}
- catch (mmdbException &,e)
+ mcatch (mmdbException &,e)
{
return 0;
} end_try;
DtMmdbHandle*
DtMmdbDlpGetPrevSectionId(DtMmdbInfoRequest* request)
{
- try {
+ mtry {
dlp_smart_ptr* x = getDlpUsingProid(request);
if ( x == 0 ) return 0;
DtMmdbHandle *z = 0;
return z;
}
- catch (mmdbException &,e)
+ mcatch (mmdbException &,e)
{
return 0;
} end_try;
DtMmdbHandle*
DtMmdbDlpGetNextSectionId(DtMmdbInfoRequest* request)
{
- try {
+ mtry {
dlp_smart_ptr* x = getDlpUsingProid(request);
if ( x == 0 ) return 0;
return z;
}
- catch (mmdbException &,e)
+ mcatch (mmdbException &,e)
{
return 0;
} end_try;
static graphic_smart_ptr*
getGraphicUsingLocAndProid(DtMmdbInfoRequest* request, Boolean checkLocOnly = false)
{
- try {
+ mtry {
info_base* x = getBookCase(request -> bookcase_descriptor);
if ( x == 0 ) return 0;
return new graphic_smart_ptr(x, *id);
}
- catch (mmdbException &,e)
+ mcatch (mmdbException &,e)
{
return 0;
} end_try;
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();
return y;
}
- catch (mmdbException &,e)
+ mcatch (mmdbException &,e)
{
return 0;
} end_try;
DtMmdbGraphicGetInfo(DtMmdbInfoRequest* request)
{
- try {
+ mtry {
graphic_smart_ptr* x = getGraphicUsingLocAndProid(request, true);
if ( x == 0 ) return 0;
return z;
}
- catch (mmdbException &,e)
+ mcatch (mmdbException &,e)
{
return 0;
} end_try;
const char* DtMmdbGraphicGetLoc(DtMmdbInfoRequest* request)
{
- try {
+ mtry {
graphic_smart_ptr* x = getGraphicUsingLocAndProid(request, true);
if ( x == 0 ) return 0;
return y;
}
- catch (mmdbException &,e)
+ mcatch (mmdbException &,e)
{
return 0;
} end_try;
DtMmdbBool delayed_infolib_init
)
{
- try {
+ mtry {
Boolean option = (delayed_infolib_init == DtMmdbTrue) ? true : false;
return i;
}
- catch (mmdbException &,e)
+ mcatch (mmdbException &,e)
{
return -1;
} end_try;
DtMmdbInfoLibInfo*
DtMmdbInfoLibGetInfo(int infolib_descriptor)
{
- try {
+ mtry {
info_lib* x = mmdb_ptr -> getInfoLib(infolib_descriptor);
if ( x == 0 ) return 0;
return y;
}
- catch (mmdbException &,e)
+ mcatch (mmdbException &,e)
{
return 0;
} end_try;
static locator_smart_ptr*
getLocatorUsingLocAndProid(DtMmdbInfoRequest* request, Boolean checkLocOnly = false)
{
- try {
+ mtry {
info_base* x = getBookCase(request -> bookcase_descriptor);
if ( x == 0 ) return 0;
*/
}
- catch (mmdbException &,e)
+ mcatch (mmdbException &,e)
{
return 0;
} end_try;
const char*
DtMmdbLocatorGetSectionLoc(DtMmdbInfoRequest* request)
{
- try {
+ mtry {
locator_smart_ptr* x = getLocatorUsingLocAndProid(request, false);
if ( x == 0 ) return 0;
return y;
}
- catch (mmdbException &,e)
+ mcatch (mmdbException &,e)
{
return 0;
} end_try;
DtMmdbHandle*
DtMmdbLocatorGetSectionObjectId(DtMmdbInfoRequest* request)
{
- try {
+ mtry {
locator_smart_ptr* x = getLocatorUsingLocAndProid(request, true);
if ( x == 0 ) return 0;
DtMmdbHandle *z = newDtMmdbHandle(x -> node_id());
return z;
}
- catch (mmdbException &,e)
+ mcatch (mmdbException &,e)
{
return 0;
} end_try;
const char*
DtMmdbSectionGetLoc(DtMmdbInfoRequest* request)
{
- try {
+ mtry {
info_base* x = getBookCase(request -> bookcase_descriptor);
if ( x == 0 ) return 0;
return y.locator();
}
- catch (mmdbException &,e)
+ mcatch (mmdbException &,e)
{
return 0;
} end_try;
static node_smart_ptr*
getSectionUsingLocAndProid(DtMmdbInfoRequest* request)
{
- try {
+ mtry {
info_base* x = getBookCase(request -> bookcase_descriptor);
if ( x == 0 ) return 0;
return new node_smart_ptr(x, *id);
}
- catch (mmdbException &,e)
+ mcatch (mmdbException &,e)
{
return 0;
} end_try;
unsigned int* title_length
)
{
- try {
+ mtry {
node_smart_ptr* x = getSectionUsingLocAndProid(request);
if ( x == 0 ) return 0;
return y;
}
- catch (mmdbException &,e)
+ mcatch (mmdbException &,e)
{
return 0;
} end_try;
unsigned int* title_length
)
{
- try {
+ mtry {
node_smart_ptr* x = getSectionUsingLocAndProid(request);
if ( x == 0 ) return 0;
return y;
}
- catch (mmdbException &,e)
+ mcatch (mmdbException &,e)
{
return 0;
} end_try;
unsigned int* data_length
)
{
- try {
+ mtry {
node_smart_ptr* x = getSectionUsingLocAndProid(request);
if ( x == 0 ) return 0;
return y;
}
- catch (mmdbException &,e)
+ mcatch (mmdbException &,e)
{
return 0;
} end_try;
int DtMmdbSectionGetDataSize(DtMmdbInfoRequest* request)
{
- try {
+ mtry {
node_smart_ptr* x = getSectionUsingLocAndProid(request);
if ( x == 0 ) return -1;
return y;
}
- catch (mmdbException &,e)
+ mcatch (mmdbException &,e)
{
return -1;
} end_try;
const char* DtMmdbSectionGetTocLoc(DtMmdbInfoRequest* request)
{
- try {
+ mtry {
node_smart_ptr* x = getSectionUsingLocAndProid(request);
if ( x == 0 ) return 0;
return y;
}
- catch (mmdbException &,e)
+ mcatch (mmdbException &,e)
{
return 0;
} end_try;
DtMmdbHandle*
DtMmdbSectionGetBookId(DtMmdbInfoRequest* request)
{
- try {
+ mtry {
node_smart_ptr* x = getSectionUsingLocAndProid(request);
if ( x == 0 ) return 0;
return z;
}
- catch (mmdbException &,e)
+ mcatch (mmdbException &,e)
{
return 0;
} end_try;
DtMmdbHandle*
DtMmdbSectionGetStyleSheetId(DtMmdbInfoRequest* request)
{
- try {
+ mtry {
node_smart_ptr* x = getSectionUsingLocAndProid(request);
if ( x == 0 ) return 0;
return z;
}
- catch (mmdbException &,e)
+ mcatch (mmdbException &,e)
{
return 0;
} end_try;
static stylesheet_smart_ptr*
getStylesheetUsingLocAndProid(DtMmdbInfoRequest* request, Boolean checkPIDOnly = false)
{
- try {
+ mtry {
info_base* x = getBookCase(request -> bookcase_descriptor);
if ( x == 0 ) return 0;
}
- catch (mmdbException &,e)
+ mcatch (mmdbException &,e)
{
return 0;
} end_try;
const char*
DtMmdbStylesheetGetName(DtMmdbInfoRequest* request)
{
- try {
+ mtry {
stylesheet_smart_ptr* x = getStylesheetUsingLocAndProid(request, true);
if ( x == 0 ) return 0;
return y;
}
- catch (mmdbException &,e)
+ mcatch (mmdbException &,e)
{
return 0;
} end_try;
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();
return y;
}
- catch (mmdbException &,e)
+ mcatch (mmdbException &,e)
{
return 0;
} end_try;
static toc_smart_ptr*
getTocUsingProid(DtMmdbInfoRequest* request)
{
- try {
+ mtry {
info_base* x = getBookCase(request -> bookcase_descriptor);
if ( x == 0 ) return 0;
return new toc_smart_ptr(x, *id);
}
- catch (mmdbException &,e)
+ mcatch (mmdbException &,e)
{
return 0;
} end_try;
DtMmdbHandle*
DtMmdbTocGetParentId(DtMmdbInfoRequest* request)
{
- try {
+ mtry {
toc_smart_ptr* x = getTocUsingProid(request);
if ( x == 0 ) return 0;
return z;
}
- catch (mmdbException &,e)
+ mcatch (mmdbException &,e)
{
return 0;
} end_try;
unsigned int* list_length
)
{
- try {
+ mtry {
toc_smart_ptr* x = getTocUsingProid(request);
if ( x == 0 ) return 0;
//fprintf(stderr, "z=%x\n", (void*)z);
if ( z == 0 ) return 0;
- for (int i=0; i<count; i++) {
+ int i;
+ for (i=0; i<count; i++) {
z[i] = newDtMmdbHandle(oid_t(OLIAS_NODE_CODE, ((*y) -> operator()(i+1)).icode()));
}
return z;
}
- catch (mmdbException &,e)
+ mcatch (mmdbException &,e)
{
return 0;
} end_try;
int DtMmdbTocGetNumOfChildren( DtMmdbInfoRequest* request)
{
- try {
+ mtry {
toc_smart_ptr* x = getTocUsingProid(request);
if ( x == 0 ) return -1;
int y = x -> subtree_size();
return y;
}
- catch (mmdbException &,e)
+ mcatch (mmdbException &,e)
{
return -1;
} end_try;
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);
const char* graphic_smart_ptr::title()
{
- try
+ mtry
{
return get_string(BASE_COMPONENT_INDEX+5);
}
- catch (mmdbException&,e)
+ mcatch (mmdbException&,e)
{
return 0;
}
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];
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);
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);
{
const char* rval;
- try
+ mtry
{
rval = get_string(BASE_COMPONENT_INDEX+2);
}
- catch_any()
+ mcatch_any()
{
// catch exceptions to ensure backwards compatibility
rval = 0;
mark_set_hd_ptr = uptr->mark_set_hd;
- try {
+ mtry {
mbase -> trans().begin();
abs_storage* marks_store = mark_set_hd_ptr -> its_store();
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();
debug(cerr, mark_id);
#endif
- try
+ mtry
{
v_loct_hd = (pstring_handler*)
get_handler(BASE_COMPONENT_INDEX, STRING_CODE);
get_handler(BASE_COMPONENT_INDEX+1, STRING_CODE);
}
- catch (mmdbException&, e)
+ mcatch (mmdbException&, e)
{
smart_ptr::_init(ground, 0); // mark the mark obsolete
rethrow;
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);
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;
void mark_smart_ptr::remove_from_db()
{
- try {
+ mtry {
mbase -> trans().begin();
(*mark_set_hd_ptr) -> remove_component(its_oid());
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;
int OLIAS_DB::validInfoLibPath(const char* path)
{
- try
+ mtry
{
if ( exist_dir(path) == false )
return 0;
}
- catch (mmdbException &,e)
+ mcatch (mmdbException &,e)
{
return 0;
}
OLIAS_DB::openInfoLib(const char* infoLibPath, const char* selectedBaseName,
const char* infoLibName)
{
- for ( int i=0; i<infolib_array.no_elmts(); i++ ) {
+ int i;
+ for ( i=0; i<infolib_array.no_elmts(); i++ ) {
if ( infolib_array[i] == 0 )
break;
}
#include "oliasdb/node_hd.h"
#ifdef C_API
-#include "utility/c_strstream.h"
+#include "utility/c_stringstream.h"
#else
-#include <strstream.h>
+#include <sstream>
+using namespace std;
#endif
MMDB_BODIES(olias_node)
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];
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);
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; i++ )
in >> 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<data_size; i++ )
pattern_out.put((char)in.get());
#define USER_MARK_CODE 1006
#define USER_CONFIG_CODE 1007
-#define DOC_SET_NAME "doc"
-#define NODE_SET_NAME "node"
-#define TOC_SET_NAME "toc"
-#define LOCATOR_SET_NAME "loc"
-#define GRAPHIC_SET_NAME "graphic"
-#define STYLESHEET_SET_NAME "stylesheet"
+#define DOC_SET_NAME (char*)"doc"
+#define NODE_SET_NAME (char*)"node"
+#define TOC_SET_NAME (char*)"toc"
+#define LOCATOR_SET_NAME (char*)"loc"
+#define GRAPHIC_SET_NAME (char*)"graphic"
+#define STYLESHEET_SET_NAME (char*)"stylesheet"
-#define DLP_LIST_NAME "dlp"
+#define DLP_LIST_NAME (char*)"dlp"
-#define USER_MARK_SET_NAME "mark"
-#define USER_CONFIG_SET_NAME "config"
+#define USER_MARK_SET_NAME (char*)"mark"
+#define USER_CONFIG_SET_NAME (char*)"config"
-#define MARK_SPEC "mmdb.mark.spec"
-#define PREF_SPEC "mmdb.pref.spec"
+#define MARK_SPEC (char*)"mmdb.mark.spec"
+#define PREF_SPEC (char*)"mmdb.pref.spec"
#define NODE_SET_POS 0
#define TOC_SET_POS 1
struct map_record set_map[]=
{
- {"loc", LOCATOR_CODE, 0},
- {"toc", TOC_CODE, 0 },
- {"doc", DOC_CODE, 0 },
- {"graphic", GRAPHIC_CODE, 0 },
-// {"stylesheet", STYLESHEET_CODE, 0 },
+ {(char*)"loc", LOCATOR_CODE, 0},
+ {(char*)"toc", TOC_CODE, 0 },
+ {(char*)"doc", DOC_CODE, 0 },
+ {(char*)"graphic", GRAPHIC_CODE, 0 },
+// {(char*)"stylesheet", STYLESHEET_CODE, 0 },
};
struct map_record list_map[]=
{
- {"dlp", DLP_CODE, 0},
+ {(char*)"dlp", DLP_CODE, 0},
};
//#define SET_MAP_SZ 5
abs_storage* store = 0;
handler* hd = 0;
- for ( int i = 0; i<SET_MAP_SZ ; i++ ) {
+ int i;
+ for ( i = 0; i<SET_MAP_SZ ; i++ ) {
if ( set_map[i].instance_class_code == ccode ) {
obj_type = SET;
store = set_map[i].collection_hd -> its_store();
int _load_mixed_objects(info_base* base_ptr, istream& in)
{
- for ( int i = 0; i<SET_MAP_SZ ; i++ ) {
+ int i;
+ for ( i = 0; i<SET_MAP_SZ ; i++ ) {
cset_handlerPtr x = base_ptr -> get_set(set_map[i].col_name);
if (x==0)
*/
+#include "oliasdb/olias_test.h"
#include "api/utility.h"
#include "utility/pm_random.h"
#include "misc/unique_id.h"
#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"
#include "oliasdb/mmdb.h"
-#ifdef DEBUG
+#ifdef NODEBUG
void test_collector_iterator(info_base* base)
{
MESSAGE(cerr, "node locators:");
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"));
locator_smart_ptrPtr* ptr_array = new locator_smart_ptrPtr[argc];
debug(cerr, argc);
- for ( int i=0; i<argc; i++ ) {
+ int i;
+ for ( i=0; i<argc; i++ ) {
ptr_array[i] = new locator_smart_ptr(infolib_ptr, base_name, argv[i]);
cerr << form("node_id of locator %s:\n", argv[i]);
if ( !stylesheet_stream )
return -1;
- for (int i=0; i<stylesheets; i++ ) {
+ int i;
+ for (i=0; i<stylesheets; i++ ) {
// assume the stylesheet and section are of approx. length
generate_stylesheet_instance(x, stylesheet_stream, min, max);
}
int destroy_stream(char* path)
{
- try {
+ mtry {
del_file(TEST_STY_FILE, path);
del_file(TEST_SEC_FILE, path);
del_file(TEST_MIX_FILE, path);
}
- catch_any()
+ mcatch_any()
{
return -1;
}
handler* root_hd_ptr = 0;
- vm_storage st("", "");
+ vm_storage st((char*)"", (char*)"");
char ccode_buf[LBUFSIZ];
int c;
if ( c == SGML_CONTENT_CODE ) {
if ( code == c || code == 0 )
- ok |= compare_SGML_content(in, base_ptr, true);
+ ok |= compare_SGML_content(in, base_ptr, (Boolean)true);
else
- compare_SGML_content(in, base_ptr, false);
+ compare_SGML_content(in, base_ptr, (Boolean)false);
} else {
root_hd_ptr = new handler(c, &st);
c_code_t code;
} auto_test_spec[] =
{
- {"auto_node_test", OLIAS_NODE_CODE},
- {"auto_SGML_content_test", SGML_CONTENT_CODE},
- {"auto_stylesheet_test", STYLESHEET_CODE},
- {"auto_graphic_test", GRAPHIC_CODE},
- {"auto_doc_test", DOC_CODE},
- {"auto_toc_test", TOC_CODE},
- {"auto_loc_test", LOCATOR_CODE},
+ {(char*)"auto_node_test", OLIAS_NODE_CODE},
+ {(char*)"auto_SGML_content_test", SGML_CONTENT_CODE},
+ {(char*)"auto_stylesheet_test", STYLESHEET_CODE},
+ {(char*)"auto_graphic_test", GRAPHIC_CODE},
+ {(char*)"auto_doc_test", DOC_CODE},
+ {(char*)"auto_toc_test", TOC_CODE},
+ {(char*)"auto_loc_test", LOCATOR_CODE},
};
#define NUM_OF_AUTO_TESTS 7
}
ok =mark_test(argc, argv);
-#ifdef DEBUG
+#ifdef NODEBUG
if (ok < 0) {
cerr << "mark_test failed." << endl;
return ok;
}
#endif
-#ifdef DEBUG
+#ifdef NODEBUG
if ( strcmp(argv[1], "random_gen") == 0 ) {
if ( argc != 7 ) {
cerr << "random_gen args: " << "random_gen base_name path num_sections min_section_len max_sec_len\n";
void stylesheet_smart_ptr::update_data(istream& in, int index)
{
transaction trans ;
- try {
+ mtry {
trans.begin();
update_string(index, in);
trans.end();
}
- catch (beginTransException&, e)
+ mcatch (beginTransException&, e)
{
rethrow;
}
- catch (commitTransException&, e)
+ mcatch (commitTransException&, e)
{
rethrow;
}
- catch (mmdbException&, e)
+ mcatch (mmdbException&, e)
{
trans.rollback();
rethrow;
stylesheet_smart_ptr::update_data(const char* buf, int size, int index)
{
transaction trans ;
- try {
+ mtry {
trans.begin();
update_string(index, buf, size);
trans.end();
}
- catch (beginTransException&, e)
+ mcatch (beginTransException&, e)
{
rethrow;
}
- catch (commitTransException&, e)
+ mcatch (commitTransException&, e)
{
rethrow;
}
- catch (mmdbException&, e)
+ mcatch (mmdbException&, e)
{
trans.rollback();
rethrow;
int compare_stylesheet(stylesheet_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_stylesheet(pattern, pattern_out);
char loc[BUFSIZ];
stylesheet_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_stylesheet(x, db_out);
return compare_stream(pattern_out, db_out);
int compare_toc(toc_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_toc(pattern, pattern_out);
toc_smart_ptr x(base_ptr, pattern.toc_node_oid());
char db_buf[LARGE_BUFSIZ];
- ostrstream db_out(db_buf, LARGE_BUFSIZ, ios::out);
+ ostringstream db_out(db_buf, LARGE_BUFSIZ, ios::out);
print_toc(x, db_out);
return compare_stream(pattern_out, db_out);
char* name = getenv("USER");
if ( name == 0 )
- name = "";
+ name = (char*)"";
strcpy(base_path, path);
strcpy(base_name, name);
user_base::checking_status_t user_base::check_mode()
{
- try {
+ mtry {
switch ( rw_flag ) {
case user_base::READ:
}
}
- catch (systemException&, e)
+ mcatch (systemException&, e)
{
return user_base::FAIL;
}
if (
read_lock(atomic_lock_path, write_lock_path,
- ai_path, access_info("read"), offset, ai_info
+ ai_path, access_info((char*)"read"), offset, ai_info
) == false
) {
if ( ai_info ) {
if (
write_lock(atomic_lock_path, write_lock_path,
- ai_path, access_info("write"), ai_info
+ ai_path, access_info((char*)"write"), ai_info
) == false
) {
if ( ai_info ) {
break;
}
- try
+ mtry
{
ubase_trans.begin();
}
- catch (beginTransException &,e)
+ mcatch (beginTransException &,e)
{
// cases: can't open log or write size info to log
checking_status = user_base::FAIL;
clean_up();
break;
}
- catch (commitTransException &,e)
+ mcatch (commitTransException &,e)
{
// cases: bad log file, can't write to store, etc.
checking_status = user_base::FAIL;
break;
}
// cases: can't do define()
- catch (mmdbException &,e)
+ mcatch (mmdbException &,e)
{
checking_status = user_base::FAIL;
ubase_trans.rollback();
case user_base::SUCC:
- try {
+ mtry {
ubase_trans.begin();
first_desc_ptr = f_obj_dict -> init_a_base(base_path, base_name);
ubase_trans.end();
}
- catch (mmdbException &,e) {
+ mcatch (mmdbException &,e) {
#ifdef DEBUG
fprintf(stderr, "mmdbException caught @ %s line:%d.\n",
__FILE__, __LINE__);
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;
}
#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
void desc::set_oid(const char* source)
{
- istrstream in((char*)source);
+ istringstream in((char*)source);
v_oid._asciiIn(in);
}
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) )
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();
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);
/////////////////////////////
// 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));
desc* x = 0;
- try {
+ mtry {
x = parse(unique_nm);
}
- catch (mmdbException &,e) {
+ mcatch (mmdbException &,e) {
del_file(unique_nm);
rethrow;
} end_try;
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;
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;
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",
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",
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",
#define CAST_TO_CONTAINER(x) ((container_desc*)x)
+#undef alloca
#define alloca(x) (malloc(x))
extern void schemaerror(char*);
#define MODE 284
#define PAGE_SZ 285
#define CACHED_PAGES 286
+#undef BYTE_ORDER
#define BYTE_ORDER 287
#define SEPARATOR 288
#define schemaERRCODE 256
#endif
schemanewerror:
#endif
- schemaerror("syntax error");
+ schemaerror((char*)"syntax error");
#if 0 /* remove if needed */
#ifdef lint
goto schemaerrlab;
*++ schemavsp = schemaval;
goto schemaloop;
schemaoverflow:
- schemaerror("yacc stack overflow");
+ schemaerror((char*)"yacc stack overflow");
schemaabort:
return (1);
schemaaccept:
#define MODE 284
#define PAGE_SZ 285
#define CACHED_PAGES 286
+#undef BYTE_ORDER
#define BYTE_ORDER 287
#define SEPARATOR 288
typedef union
#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>
#endif
+#endif
/* use prototypes in function declarations */
#define schema_USE_PROTOS
#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
#ifdef C_API
#include "utility/c_stream.h"
#else
-#include <stream.h>
+#include <sstream>
#endif
#include "utility/debug.h"
void page_storage::begin_trans()
{
- try {
+ mtry {
if ( trans_info.status == store_trans::ENABLED )
throw(stringException("trans is still in progress"));
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);
//////////////////////////////
// sync the touched pages
//////////////////////////////
- try {
+ mtry {
int ind = trans_info.log_index -> first_bucket();
while ( ind != -1 ) {
trans_info.status = store_trans::DISABLED;
}
- catch (mmdbException &,e) {
+ mcatch (mmdbException &,e) {
// workaround for solaris's /SUNWspro/bin/CC compiler.
commitTransException x;
throw(x);
void page_storage::roll_back()
{
- try
+ mtry
{
if ( exist_file(form("%s.log", name), path) == false )
return;
trans_info.status = store_trans::DISABLED;
}
- catch (mmdbException &,e)
+ mcatch (mmdbException &,e)
{
// workaround for solaris's /SUNWspro/bin/CC compiler.
rollbackTransException x;
int log_bytes_before = trans_info.log_store -> bytes();
- try {
+ mtry {
if ( swap_order() == true ) // swap to desired order
ORDER_SWAP_UINT(l_pid);
trans_info.log_index -> insert(pkey);
}
- catch (mmdbException&, e) {
+ mcatch (mmdbException&, e) {
trans_info.log_store -> truncate(log_bytes_before);
rethrow;
}
#ifdef C_API
#include "utility/c_stream.h"
#else
-#include <stream.h>
+#include <sstream>
#endif
#include "dstr/dlist.h"
#ifdef C_API
#include "utility/c_fstream.h"
#else
-#include <fstream.h>
+#include <fstream>
+using namespace std;
#endif
#include "utility/macro.h"
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;
}
if ( v_file_exist == false ) {
- SET_BIT(new_mode, ios::out);
+ SET_BIT(new_mode, ios::out | ios::app);
v_file_exist = true;
}
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());
}
}
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();
{
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;
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;
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;
}
#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
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)
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++ ) {
#ifndef _atoi_larson_h
#define _atoi_larson_h 1
+#include <limits.h>
+#if defined(CSRG_BASED)
+#define MAXINT INT_MAX
+#else
#include <values.h>
+#endif
#include "key.h"
// Based on Larson's algorithm presented in CACM ???.
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;
/*
return 0;
}
-#if defined(linux)
-#define CASTBNDEXCEPT (boundaryException*)
-#else
#define CASTBNDEXCEPT
-#endif
/***********************************************************/
// Get sz chars to the array x. x is supposed allocated
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;
}
}
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];
/*
#define _buffer_h 1
#include <ctype.h>
+#include <iomanip>
#include "utility/funcs.h"
class buffer
#ifndef _ios_h
#define _ios_h
+#include <sys/types.h>
#include "utility/macro.h"
#include "utility/c_streambuf.h"
void clear() { f_state = OK; };
int operator!() { return fail(); };
- operator void*() { return (void*)good(); };
+ operator void*() { return (void*)(size_t)good(); };
};
#include "utility/c_streambuf.h"
-extern char* form(const char* ...);
+extern char* sform(const char* ...);
#endif
--- /dev/null
+/*
+ * 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_string.h /main/5 2012/09/18 22:54:47 xxx $ */
+
+#ifndef _string_h
+#define _string_h
+
+#include <string.h>
+#include "utility/c_iostream.h"
+#include "utility/c_charbuf.h"
+
+class string
+{
+public:
+ string(char* str);
+ string(char* str, int size);
+ ~string() ;
+
+ char* c_str();
+ int size();
+
+protected:
+ streambuf* sbuf; // buffer that provides char sequence read/write
+};
+
+#endif
--- /dev/null
+/*
+ * 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 <string.h>
+#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
+++ /dev/null
-/*
- * 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_strstream.h /main/5 1996/08/21 15:55:22 drk $ */
-
-#ifndef _strstream_h
-#define _strstream_h
-
-#include <string.h>
-#include "utility/c_iostream.h"
-
-class istrstream : public istream
-{
-public:
- istrstream(char* str, int size) ;
- istrstream(char* str);
- ~istrstream() ;
-};
-
-class ostrstream : public ostream
-{
-public:
- ostrstream(char* str, int size, int=ios::out);
- ~ostrstream() ;
-
- int pcount() ;
-
- char* str();
-};
-
-
-#endif
#include <sys/types.h>
#include <unistd.h>
-#if !defined(hpux) && !defined(__osf__) && !defined(USL)
+#if !defined(hpux) && !defined(__osf__) && !defined(USL) && !defined(linux) && !defined(CSRG_BASED)
#include <sysent.h>
#endif
#define _filter_h 1
#ifdef C_API
-#include "utility/c_strstream.h"
+#include "utility/c_stringstream.h"
#else
-#include <strstream.h>
+#include <sstream>
#endif
#include "utility/funcs.h"
#if defined(linux)
#include <sys/vfs.h>
+#include <stdarg.h>
#elif defined(_AIX)
#include <sys/vfs.h>
#include <sys/statfs.h>
#include <sys/statvfs.h>
#else
#include <sys/statvfs.h>
+#include <stdio.h>
+#include <stdarg.h>
#endif
#ifdef __osf__
extern "C"
}
#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);
//debug(cerr, x);
//debug(cerr, hex(x));
+ int i;
for ( int i =0; i<sizeof(x); i++ ) {
if ( ( 0x000000ff & x) == 0 )
x >>= 8;
//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
// 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.
return _XCtime(&x, *ctime_buf);
}
+#ifdef C_API
int bytes(fstream& fs)
{
struct stat file_info;
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];
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
);
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;
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
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;
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 )
}
}
- catch_any()
+ mcatch_any()
{
continue;
}
#ifndef _funcs_h
#define _funcs_h 1
-#if !defined(USL) && !defined(__osf__)
+#if !defined(USL) && !defined(__osf__) && !defined(linux) && \
+ !defined(CSRG_BASED)
#include <libc.h>
#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 <unistd.h>
#else
#include <sysent.h>
#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 <assert.h>
-#include <stream.h>
-#include <fstream.h>
-#include <strstream.h>
+#include <iostream>
+#include <fstream>
+#include <sstream>
+using namespace std;
#endif
#include <math.h>
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) {
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*);
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,
*/
// $XConsortium: ios.C /main/4 1996/08/21 15:54:46 drk $
-#include "utility/c_ios.h"
#include <ctype.h>
#include <stdio.h>
+#include "utility/c_ios.h"
ios::ios(streambuf* sb) : sbuf(sb), f_state(OK)
{
int i;
- for ( int count = 0 ; count < lim-1; count++ ) {
+ int count;
+ for ( count = 0 ; count < lim-1; count++ ) {
i = sbuf -> get();
{
cerr << low << "\t";
cerr << high << "\t";
- cerr << index << "\n";
+ cerr << mindex << "\n";
return out;
}
#ifdef C_API
#include "utility/c_fstream.h"
#else
-#include <fstream.h>
+#include <fstream>
+#include <iostream>
+using namespace std;
#endif
#define END_TRY end_try
public:
DECLARE_EXCEPTION(stringException, mmdbException);
- stringException(char* m) : msg(m) {};
+ stringException(char const* m) : msg((char*)m) {};
~stringException() {};
virtual ostream& asciiOut(ostream&);
public:
DECLARE_EXCEPTION(formatException, stringException);
- formatException(char* m) : stringException(m) {};
+ formatException(char const* m) : stringException(m) {};
~formatException() {};
};
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&);
ostring *new_ostring = new ostring(l1+l2);
- for ( int i = 0; i<l1; (*new_ostring).v_p[i] = s.v_p[i] ) i++;
+ int i;
+ for ( i = 0; i<l1; (*new_ostring).v_p[i] = s.v_p[i] ) i++;
for ( i = 0; i<l2; (*new_ostring).v_p[l1 + i] = s.v_p[i] ) i++;
return *new_ostring;
#include <stdlib.h>
#include <string.h>
-#include <iostream.h>
+#include <iostream>
+using namespace std;
#define BUFSIZ 1000
int *pos = new int[bytes-1];
- for ( int i=0; i<bytes-1; i++ ) {
+ int i;
+ for ( i=0; i<bytes-1; i++ ) {
pos[i] = rdn.rand() % ( bytes - i ) + i;
}
throw(streamException(x.rdstate()));
}
+#ifdef C_API
offset = bytes(x.rdbuf() -> fd());
+#else
+ offset = bytes(ai_info);
+#endif
x << "A-" << reader_info << "\n";
x.close();
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;
// 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];
char*& ai_info
)
{
+ int ret;
atomic_lock l(lock_file_path);
if ( l.lock() == false ) {
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;
/////////////////////////////////////////
// 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";
#include "utility/c_stream.h"
-char* form(const char* fmt ...)
+char* sform(const char* fmt ...)
{
static char buf[1024];
/* $XConsortium: streambuf.C /main/8 1996/08/21 15:55:14 drk $ */
#include "utility/c_streambuf.h"
-#if !defined(USL) && !defined(__osf__)
-#include <libc.h>
-#endif
-
-#if defined(USL) || defined(__osf__)
+#if defined(USL) || defined(__osf__) || defined(linux) || defined(CSRG_BASED)
#include <stdlib.h>
+#else
+#include <libc.h>
#endif
#define DEF_BUF_SIZ 4096
--- /dev/null
+/*
+ * 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: string.C /main/5 2012/09/18 22:56:32 xxx $
+
+#include "utility/c_string.h"
+#include "utility/c_charbuf.h"
+#include <string.h>
+
+string::string(char* str)
+{
+ sbuf = new charbuf(str, strlen(str), 1);
+}
+
+string::string(char* str, int size)
+{
+ sbuf = new charbuf(str, size);
+}
+
+string::~string()
+{
+}
+
+char* string::c_str()
+{
+ char* x = sbuf -> get_buf();
+// x[pcount()] = 0;
+ return x;
+}
+
+int string::size()
+{
+ char* x = sbuf -> get_buf();
+ return(strlen(x));
+}
--- /dev/null
+/*
+ * 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 <string.h>
+
+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));
+}
+++ /dev/null
-/*
- * 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: strstream.C /main/5 1996/08/21 15:55:17 drk $
-
-#include "utility/c_strstream.h"
-#include "utility/c_charbuf.h"
-#include <string.h>
-
-istrstream::istrstream(char* str) :
- //ios(new charbuf(str, strlen(str))), istream(0)
- istream(0)
-{
- 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)
-{
- sbuf = new charbuf(str, size);
-}
-
-ostrstream::~ostrstream()
-{
-}
-
-char* ostrstream::str()
-{
- char* x = sbuf -> get_buf();
- x[pcount()] = 0;
- return x;
-}
-
-int ostrstream::pcount()
-{
- int x = sbuf -> pcount();
- return x;
-}
-
*/
// $XConsortium: tst_filebuf.C /main/4 1996/08/21 15:55:25 drk $
-#include <iostream.h>
+#include <iostream>
+using namespace std;
#include "utility/debug.h"
#include "utility/c_fstream.h"
*/
// $XConsortium: tst_streambuf.C /main/4 1996/08/21 15:55:40 drk $
-#include <iostream.h>
+#include <iostream>
+using namespace std;
#include "utility/debug.h"
#include "utility/c_charbuf.h"
#include <stdio.h>
-#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);
main()
{
- tst_ostrstream();
- tst_istrstream();
+ tst_ostringstream();
+ tst_istringstream();
}
#ifdef C_API
#include "utility/c_iostream.h"
#else
-#include <iostream.h>
+#include <iostream>
+using namespace std;
#endif
#define true 1
#ifdef C_API
#include "utility/c_stream.h"
#else
-#include <stream.h>
+#include <sstream>
#endif
#include "utility/funcs.h"
#include <sys/types.h>
#include <sys/times.h>
#include <sys/time.h>
-#include <sys/timeb.h>
#include "funcs.h"