dtinfo subtree DtMmdb

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

View File

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

View File

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

View File

@@ -48,6 +48,10 @@
*/
#ifndef C_API
#include <sstream>
using namespace std;
#endif
#include "api/info_base.h"
#include "compression/abs_agent.h"
@@ -74,21 +78,22 @@ debug(cerr, base_ds);
*info_base_locale = 0;
char* nm ;
int i;
//////////////////////
// sets
//////////////////////
info_base_set_ptrs = new cset_handlerPtr[num_cset_ptrs];
for ( int i=0; i<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;
}
@@ -104,11 +109,11 @@ debug(cerr, base_ds);
nm = form("%s.%s", base_nm, info_base_list_names[i]);
try {
mtry {
info_base_list_ptrs[i] = (dl_list_handler*)
obj_dict.get_handler(nm);
}
catch_any()
mcatch_any()
{
info_base_list_ptrs[i] = 0;
}
@@ -195,23 +200,23 @@ int info_base::num_of_docs()
//
////////////////////////////////////////////////////////////////////
iterator::iterator( handler* x, c_code_t y) :
Iterator::Iterator( handler* x, c_code_t y) :
collection_hd(x), instance_c_code(y), ind(0)
{
}
iterator::~iterator()
Iterator::~Iterator()
{
}
iterator::operator void*()
Iterator::operator void*()
{
return ( ind == 0 ) ? 0 : (void*)1;
}
iterator* info_base::first(char* col_nm, c_code_t code)
Iterator* info_base::first(char* col_nm, c_code_t code)
{
handler* x = get_set(col_nm);
@@ -233,7 +238,7 @@ iterator* info_base::first(char* col_nm, c_code_t code)
throw(stringException("non page store no supported"));
}
iterator* it = new iterator(x, code);
Iterator* it = new Iterator(x, code);
it -> ind = s -> first_loc();
@@ -244,7 +249,7 @@ iterator* info_base::first(char* col_nm, c_code_t code)
return it;
}
oid_t info_base::get_oid(const iterator& it)
oid_t info_base::get_oid(const Iterator& it)
{
page_storage *s = (page_storage*)( it.collection_hd -> its_store() );
@@ -256,7 +261,7 @@ oid_t info_base::get_oid(const iterator& it)
return r -> my_oid();
}
void info_base::next(iterator& it)
void info_base::next(Iterator& it)
{
page_storage *s = (page_storage*)( it.collection_hd -> its_store());

View File

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

View File

@@ -317,7 +317,7 @@ debug(cerr, base_name);
//fprintf(stderr, "try to init %s\n", base_name);
try {
mtry {
f_obj_dict -> init_a_base((char*)base_path, (char*)base_name);
x = new info_base(*f_obj_dict, set_nm_list, list_nm_list,
@@ -328,7 +328,7 @@ debug(cerr, base_name);
info_base_list.insert_as_tail(new dlist_void_ptr_cell(x));
}
catch (mmdbException &,e)
mcatch (mmdbException &,e)
{
//fprintf(stderr, "in catch block\n");
return 0;
@@ -445,7 +445,8 @@ info_lib::define_info_base( char* base_name, char* base_desc,
/*************************************/
char* lib_nm = form("%s/%s", info_lib_path, MAP_FILE_8_3);
fstream nm_out(lib_nm, ios::app, open_file_prot());
fstream nm_out(lib_nm, ios::out | ios::app);
// fstream nm_out(lib_nm, ios::app, open_file_prot());
if ( !nm_out ) {
MESSAGE(cerr, form("can't open %s/%s for append",
@@ -454,7 +455,7 @@ info_lib::define_info_base( char* base_name, char* base_desc,
throw(streamException(nm_out.rdstate()));
}
if ( bytes(nm_out) == 0 ) {
if ( bytes(lib_nm) == 0 ) {
char* lib_entry = form("%s\t%s\n", info_lib_name, unique_id());
if ( !(nm_out << lib_entry) ) {
@@ -589,7 +590,7 @@ info_lib::getInfobaseByComponent(const char *locator_string, enum TestSelector s
if (ib==0)
throw(stringException("null info_base ptr"));
try { // since an infobase may not have any graphics, we catch
mtry { // since an infobase may not have any graphics, we catch
// any exceptions there and try next infobase.
switch (sel) {
@@ -615,7 +616,7 @@ info_lib::getInfobaseByComponent(const char *locator_string, enum TestSelector s
}
}
catch (mmdbException &,e)
mcatch (mmdbException &,e)
{
} end_try;
@@ -630,7 +631,8 @@ info_base**
info_lib::getInfobasesByComponent(char **locator_strings, int count, enum TestSelector sel)
{
info_base** ibs = new info_basePtr[count];
for ( int i=0; i<count; ibs[i++] = 0 );
int i;
for ( i=0; i<count; ibs[i++] = 0 );
info_base* ib = 0;
@@ -645,7 +647,7 @@ info_lib::getInfobasesByComponent(char **locator_strings, int count, enum TestSe
for ( i=0; i<count; i++ ) {
try {
mtry {
if ( locator_strings[i] && ibs[i] == 0 ) {
switch (sel) {
@@ -674,7 +676,7 @@ info_lib::getInfobasesByComponent(char **locator_strings, int count, enum TestSe
}
}
catch (mmdbException &,e)
mcatch (mmdbException &,e)
{
} end_try;

View File

@@ -55,6 +55,7 @@
#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

View File

@@ -288,8 +288,8 @@ void smart_ptr::update_oid(int i, const oid_t& x)
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);

View File

@@ -52,9 +52,9 @@
#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>