DtMmdb: move to lib directory as a standalone library.

This commit is contained in:
Liang Chang
2022-01-13 00:15:14 +08:00
parent f3baea9faa
commit e93b2bc626
589 changed files with 31 additions and 2985 deletions

View File

@@ -0,0 +1,8 @@
MAINTAINERCLEANFILES = Makefile.in
noinst_LTLIBRARIES = libapi.la
libapi_la_CXXFLAGS = -I..
libapi_la_SOURCES = base.C info_base.C info_lib.C smart_ptr.C transaction.C \
utility.C

115
cde/lib/DtMmdb/api/base.C Normal file
View File

@@ -0,0 +1,115 @@
/*
* 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 libraries and programs; if not, write
* to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
* Floor, Boston, MA 02110-1301 USA
*/
/*
* $XConsortium: base.cc /main/4 1996/06/11 17:10:55 cde-hal $
*
* Copyright (c) 1992 HAL Computer Systems International, Ltd.
* All rights reserved. Unpublished -- rights reserved under
* the Copyright Laws of the United States. USE OF A COPYRIGHT
* NOTICE IS PRECAUTIONARY ONLY AND DOES NOT IMPLY PUBLICATION
* OR DISCLOSURE.
*
* THIS SOFTWARE CONTAINS CONFIDENTIAL INFORMATION AND TRADE
* SECRETS OF HAL COMPUTER SYSTEMS INTERNATIONAL, LTD. USE,
* DISCLOSURE, OR REPRODUCTION IS PROHIBITED WITHOUT THE
* PRIOR EXPRESS WRITTEN PERMISSION OF HAL COMPUTER SYSTEMS
* INTERNATIONAL, LTD.
*
* RESTRICTED RIGHTS LEGEND
* Use, duplication, or disclosure by the Government is subject
* to the restrictions as set forth in subparagraph (c)(l)(ii)
* of the Rights in Technical Data and Computer Software clause
* at DFARS 252.227-7013.
*
* HAL COMPUTER SYSTEMS INTERNATIONAL, LTD.
* 1315 Dell Avenue
* Campbell, CA 95008
*
*/
#include "api/base.h"
base::base(object_dict* obj_dict) :
info_base_set_names(0), info_base_list_names(0),
num_cset_ptrs(0), num_list_ptrs(0),
f_obj_dict(obj_dict)
{
base_path[0] = 0;
base_name[0] = 0;
base_desc[0] = 0;
base_uid[0] = 0;
}
base::base(object_dict* obj_dict,
char** set_nms, char** list_nms,
const char* base_dir, const char* base_nm, const char* base_ds,
const char* base_uid_str
) :
info_base_set_names(set_nms), info_base_list_names(list_nms),
num_cset_ptrs(0), num_list_ptrs(0),
f_obj_dict(obj_dict)
{
if ( base_dir ) {
int len = MIN(strlen(base_dir), PATHSIZ - 1);
*((char *) memcpy (base_path, base_dir, len) + len) = '\0';
} else {
base_path[0] = 0;
}
if ( base_nm ) {
int len = MIN(strlen(base_nm), PATHSIZ - 1);
*((char *) memcpy (base_name, base_nm, len) + len) = '\0';
} else {
base_name[0] = 0;
}
if ( base_ds ) {
int len = MIN(strlen(base_ds), PATHSIZ - 1);
*((char *) memcpy (base_desc, base_ds, len) + len) = '\0';
} else {
base_desc[0] = 0;
}
if ( base_uid_str ) {
int len = MIN(strlen(base_uid_str), UIDSIZ - 1);
*((char *) memcpy (base_uid, base_uid_str, len) + len) = '\0';
} else {
base_uid[0] = 0;
}
if ( set_nms )
while ( info_base_set_names[num_cset_ptrs] )
num_cset_ptrs++;
if ( list_nms ) {
while ( info_base_list_names[num_list_ptrs] )
num_list_ptrs++;
}
}
base::~base()
{
;
}

106
cde/lib/DtMmdb/api/base.h Normal file
View File

@@ -0,0 +1,106 @@
/*
* 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 libraries and programs; if not, write
* to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
* Floor, Boston, MA 02110-1301 USA
*/
/*
* $XConsortium: base.h /main/4 1996/06/11 17:11:01 cde-hal $
*
* Copyright (c) 1992 HAL Computer Systems International, Ltd.
* All rights reserved. Unpublished -- rights reserved under
* the Copyright Laws of the United States. USE OF A COPYRIGHT
* NOTICE IS PRECAUTIONARY ONLY AND DOES NOT IMPLY PUBLICATION
* OR DISCLOSURE.
*
* THIS SOFTWARE CONTAINS CONFIDENTIAL INFORMATION AND TRADE
* SECRETS OF HAL COMPUTER SYSTEMS INTERNATIONAL, LTD. USE,
* DISCLOSURE, OR REPRODUCTION IS PROHIBITED WITHOUT THE
* PRIOR EXPRESS WRITTEN PERMISSION OF HAL COMPUTER SYSTEMS
* INTERNATIONAL, LTD.
*
* RESTRICTED RIGHTS LEGEND
* Use, duplication, or disclosure by the Government is subject
* to the restrictions as set forth in subparagraph (c)(l)(ii)
* of the Rights in Technical Data and Computer Software clause
* at DFARS 252.227-7013.
*
* HAL COMPUTER SYSTEMS INTERNATIONAL, LTD.
* 1315 Dell Avenue
* Campbell, CA 95008
*
*/
#ifndef _base_h
#define _base_h 1
#include "object/cset.h"
#include "schema/object_dict.h"
#define MAP_FILE "names.mmdb"
#define MAP_FILE_8_3 "bookcase.map"
#define DATA_FILE_SUFFIX "dbd"
#define INDEX_FILE_SUFFIX "dbi"
#define UIDSIZ 20
/*************************************/
// The base class
/*************************************/
class base : public primitive
{
public:
base(object_dict* dict);
base(object_dict* dict,
char** set_nms, char** list_nms,
const char* base_dir, const char* base_name,
const char* base_desc, const char* base_uid
);
virtual ~base();
object_dict& get_obj_dict() { return *f_obj_dict; };
const char* get_base_name() const { return base_name; };
const char* get_base_desc() const { return base_desc; };
const char* get_base_path() const { return base_path; };
const char* get_base_uid() const { return base_uid; };
protected:
char base_path[PATHSIZ];
char base_name[PATHSIZ];
char base_desc[PATHSIZ];
char base_uid[UIDSIZ];
char** info_base_set_names;
char** info_base_list_names;
int num_cset_ptrs;
int num_list_ptrs;
object_dict* f_obj_dict;
};
typedef base* basePtr;
#endif

View File

@@ -0,0 +1,46 @@
/*
* 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 libraries and programs; if not, write
* to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
* Floor, Boston, MA 02110-1301 USA
*/
/* $XConsortium: db_oid.h /main/3 1996/06/11 17:11:06 cde-hal $ */
#ifndef _db_oid_h
#define _db_oid_h 1
#include "object/oid_t.h"
/*************************************/
// The db_oid class
/*************************************/
class db_oid : public oid_t
{
public:
db_oid() {};
db_oid(oid_t& x) : oid_t(x) {};
virtual ~db_oid() {};
int index_num;
};
#endif

View File

@@ -0,0 +1,354 @@
/*
* 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 libraries and programs; if not, write
* to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
* Floor, Boston, MA 02110-1301 USA
*/
/*
* $XConsortium: info_base.C /main/5 1996/09/04 01:37:05 cde-hal $
*
* Copyright (c) 1992 HAL Computer Systems International, Ltd.
* All rights reserved. Unpublished -- rights reserved under
* the Copyright Laws of the United States. USE OF A COPYRIGHT
* NOTICE IS PRECAUTIONARY ONLY AND DOES NOT IMPLY PUBLICATION
* OR DISCLOSURE.
*
* THIS SOFTWARE CONTAINS CONFIDENTIAL INFORMATION AND TRADE
* SECRETS OF HAL COMPUTER SYSTEMS INTERNATIONAL, LTD. USE,
* DISCLOSURE, OR REPRODUCTION IS PROHIBITED WITHOUT THE
* PRIOR EXPRESS WRITTEN PERMISSION OF HAL COMPUTER SYSTEMS
* INTERNATIONAL, LTD.
*
* RESTRICTED RIGHTS LEGEND
* Use, duplication, or disclosure by the Government is subject
* to the restrictions as set forth in subparagraph (c)(l)(ii)
* of the Rights in Technical Data and Computer Software clause
* at DFARS 252.227-7013.
*
* HAL COMPUTER SYSTEMS INTERNATIONAL, LTD.
* 1315 Dell Avenue
* Campbell, CA 95008
*
*/
#ifndef C_API
#include <sstream>
using namespace std;
#endif
#include "api/info_base.h"
#include "compression/abs_agent.h"
info_base::info_base(object_dict& obj_dict,
char** set_name_list, char** list_name_list,
const char* base_dir, const char* base_nm,
const char* base_ds, const char* base_uid,
const char* base_locale,
const mm_version& v
)
: base(&obj_dict,
set_name_list, list_name_list,
base_dir, base_nm, base_ds, base_uid
), f_v(v)
{
/*
debug(cerr, base_dir);
debug(cerr, base_nm);
debug(cerr, base_ds);
*/
if (base_locale) {
int len = MIN(strlen(base_locale), PATHSIZ - 1);
*((char *) memcpy (info_base_locale, base_locale, len) + len) = '\0';
} else {
*info_base_locale = 0;
}
char* nm ;
int i;
//////////////////////
// sets
//////////////////////
info_base_set_ptrs = new cset_handlerPtr[num_cset_ptrs];
for ( i=0; i<num_cset_ptrs; i++ ) {
nm = form("%s.%s", base_nm, info_base_set_names[i]);
mtry {
info_base_set_ptrs[i] = (cset_handler*)
(f_obj_dict -> get_handler(nm));
}
mcatch_any()
{
info_base_set_ptrs[i] = 0;
}
end_try;
}
//////////////////////
// lists
//////////////////////
info_base_list_ptrs = new dl_list_handlerPtr[num_list_ptrs];
for ( i=0; i<num_list_ptrs; i++ ) {
nm = form("%s.%s", base_nm, info_base_list_names[i]);
mtry {
info_base_list_ptrs[i] = (dl_list_handler*)
obj_dict.get_handler(nm);
}
mcatch_any()
{
info_base_list_ptrs[i] = 0;
}
end_try;
}
#ifdef C_API
f_index_id = 0;
#endif
MESSAGE(cerr, form("info base %s in %s available.", base_name, base_dir));
}
info_base::~info_base()
{
delete info_base_list_ptrs;
delete info_base_set_ptrs;
}
int info_base::get_set_pos(const char* set_nm)
{
for ( int i=0; i<num_cset_ptrs; i++ ) {
if ( strcmp(set_nm, info_base_set_names[i]) == 0 )
return i;
}
return -1;
}
cset_handlerPtr info_base::get_set(const char* set_nm)
{
//MESSAGE(cerr, "in info_base::get_set()");
return get_set(get_set_pos(set_nm));
}
cset_handlerPtr info_base::get_set(int i)
{
if ( !INRANGE(i, 0, num_cset_ptrs-1) )
throw (boundaryException(0, num_cset_ptrs-1, i));
return info_base_set_ptrs[i];
}
///////////////////
// funcs about list
///////////////////
int info_base::get_list_pos(const char* list_nm)
{
for ( int i=0; i<num_list_ptrs; i++ ) {
if ( strcmp(list_nm, info_base_list_names[i]) == 0 )
return i;
}
return -1;
}
dl_list_handlerPtr info_base::get_list(const char* list_nm)
{
return ( get_list(get_list_pos(list_nm)) );
}
dl_list_handlerPtr info_base::get_list(int i)
{
if ( !INRANGE(i, 0, num_list_ptrs-1) ) {
throw(boundaryException(0, num_list_ptrs-1, i));
}
return info_base_list_ptrs[i];
}
int info_base::num_of_docs()
{
// the implementation is temp. It should take
// a hint as where to obtain the information.
// like from a set named so and so.
cset_handler* x = get_set("doc");
if (x) {
return (*x) -> count();
} else {
return 0;
}
}
////////////////////////////////////////////////////////////////////
//
////////////////////////////////////////////////////////////////////
Iterator::Iterator( handler* x, c_code_t y) :
collection_hd(x), instance_c_code(y), ind(0)
{
}
Iterator::~Iterator()
{
}
Iterator::operator void*()
{
return ( ind == 0 ) ? 0 : (void*)1;
}
Iterator* info_base::first(char* col_nm, c_code_t code)
{
handler* x = get_set(col_nm);
if ( x == 0 ) {
x = get_list(col_nm);
}
if ( x == 0 ) {
throw(stringException("unknown collection name"));
}
page_storage *s = (page_storage*)(x -> its_store());
if ( s == 0 ) {
throw(stringException("collection has no store"));
}
if ( s -> my_oid().ccode() != PAGE_STORAGE_CODE ) {
throw(stringException("non page store no supported"));
}
Iterator* it = new Iterator(x, code);
it -> ind = s -> first_loc();
if ( managers::template_mgr -> peek_slot(s, it->ind) != code ) {
this -> next(*it);
}
return it;
}
oid_t info_base::get_oid(const Iterator& it)
{
page_storage *s = (page_storage*)( it.collection_hd -> its_store() );
root *r = 0;
managers::template_mgr -> init_obj(s, it.ind, r);
if (r == 0)
throw(stringException("null root pointer"));
return r -> my_oid();
}
void info_base::next(Iterator& it)
{
page_storage *s = (page_storage*)( it.collection_hd -> its_store());
while ( s -> seek_loc( it.ind, positive, spointer_t::IS_OBJECT ) == true ) {
if ( managers::template_mgr -> peek_slot(s, it.ind) == it.instance_c_code ) {
return;
}
}
it.ind = 0;
}
int stdin_sgml_data_getchar(unsigned char* buf, int max_sz)
{
static int remain_chars = 0;
static int chars_to_read;
static char loc_buf[LBUFSIZ];
if ( remain_chars == 0 ) {
if ( fgets(loc_buf, LBUFSIZ, stdin) == NULL )
return 0;
if ( fgets(loc_buf, LBUFSIZ, stdin) == NULL )
throw(stringException("no locator line"));
if ( fscanf(stdin, "%d", &remain_chars) != 1 )
throw(stringException("sgml_data_getchar(): fscanf() failed"));
if ( getc(stdin) != '\t' ) {
debug(cerr, remain_chars);
throw(stringException("'\\t' expected"));
}
}
chars_to_read = MIN(max_sz, remain_chars);
if ( (int)fread((char*)buf, 1, chars_to_read, stdin) != chars_to_read ) {
throw(stringException("sgml_data_getchar(): fread() failed"));
}
remain_chars -= chars_to_read;
if ( remain_chars == 0 ) {
if ( getc(stdin) != '\n' )
throw(stringException("'\\n' expected"));
}
/*
for ( int i=0; i<chars_to_read; i++ ) {
cerr << buf[i];
}
MESSAGE(cerr, "\n");
debug(cerr, max_sz);
debug(cerr, chars_to_read);
*/
return chars_to_read;
}
int stdin_ps_data_getchar(unsigned char* buf, int max_sz)
{
return fread((char*)buf, 1, max_sz, stdin);
}
extern int sgmllex();
extern int pslex();
void info_base::build_dict(char* agent_name)
{
compress_agent_handler* x = (compress_agent_handler*)
(f_obj_dict -> get_handler(agent_name));
if ( x == 0 )
throw(stringException("info_base::build_dict(): unknown compress agent"));
if ( strstr(agent_name, ".sgml.") != NULL ) {
(*x) -> build_dict(sgmllex, stdin_sgml_data_getchar);
} else
if ( strstr(agent_name, ".ps.") != NULL ) {
(*x) -> build_dict(pslex, stdin_ps_data_getchar);
} else
throw(stringException("info_base::build_dict(): unknown compress target"));
}

View File

@@ -0,0 +1,145 @@
/*
* 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 libraries and programs; if not, write
* to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
* Floor, Boston, MA 02110-1301 USA
*/
/*
* $XConsortium: info_base.h /main/6 1996/09/04 01:37:17 cde-hal $
*
* Copyright (c) 1992 HAL Computer Systems International, Ltd.
* All rights reserved. Unpublished -- rights reserved under
* the Copyright Laws of the United States. USE OF A COPYRIGHT
* NOTICE IS PRECAUTIONARY ONLY AND DOES NOT IMPLY PUBLICATION
* OR DISCLOSURE.
*
* THIS SOFTWARE CONTAINS CONFIDENTIAL INFORMATION AND TRADE
* SECRETS OF HAL COMPUTER SYSTEMS INTERNATIONAL, LTD. USE,
* DISCLOSURE, OR REPRODUCTION IS PROHIBITED WITHOUT THE
* PRIOR EXPRESS WRITTEN PERMISSION OF HAL COMPUTER SYSTEMS
* INTERNATIONAL, LTD.
*
* RESTRICTED RIGHTS LEGEND
* Use, duplication, or disclosure by the Government is subject
* to the restrictions as set forth in subparagraph (c)(l)(ii)
* of the Rights in Technical Data and Computer Software clause
* at DFARS 252.227-7013.
*
* HAL COMPUTER SYSTEMS INTERNATIONAL, LTD.
* 1315 Dell Avenue
* Campbell, CA 95008
*
*/
#ifndef _info_base_h
#define _info_base_h 1
#include "utility/macro.h"
#include "storage/version.h"
#include "api/base.h"
#include "mgrs/managers.h"
#include "schema/object_dict.h"
#include "object/cset.h"
#include "object/dl_list.h"
class Iterator
{
public:
Iterator( handler*, c_code_t );
~Iterator();
operator void*();
protected:
handler* collection_hd;
c_code_t instance_c_code;
mmdb_pos_t ind;
friend class info_base;
};
/*************************************/
// The info_base class
/*************************************/
class info_base : public base
{
public:
info_base( object_dict& dict,
char** set_nms, char** list_nms,
const char* base_dir, const char* base_name,
const char* base_desc, const char* base_uid,
const char* base_locale,
const mm_version& v
);
virtual ~info_base();
// export funcs
cset_handlerPtr get_set( const char* set_name );
cset_handlerPtr get_set( int set_position );
dl_list_handlerPtr get_list( const char* list_name );
dl_list_handlerPtr get_list( int list_position );
void add_composite(char* new_db_path, char* def_spec_path);
// query functions
int num_of_docs();
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&);
#ifdef C_API
// an integer id within the infolib
int index_id() { return f_index_id; };
void set_index_id(int x) { f_index_id = x; };
#endif
// build compression dicts. data is from stdin
void build_dict(char* compress_agent_name);
const char* get_info_base_locale() const { return info_base_locale; }
protected:
cset_handlerPtr* info_base_set_ptrs;
dl_list_handlerPtr* info_base_list_ptrs;
#ifdef C_API
int f_index_id;
#endif
mm_version f_v;
int get_set_pos( const char* set_name );
int get_list_pos( const char* list_name );
friend class info_lib;
char info_base_locale[PATHSIZ];
};
typedef info_base* info_basePtr;
#endif

View File

@@ -0,0 +1,664 @@
/*
* 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 libraries and programs; if not, write
* to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
* Floor, Boston, MA 02110-1301 USA
*/
/*
* $XConsortium: info_lib.C /main/9 1996/12/02 12:47:19 cde-hal $
*
* Copyright (c) 1992 HAL Computer Systems International, Ltd.
* All rights reserved. Unpublished -- rights reserved under
* the Copyright Laws of the United States. USE OF A COPYRIGHT
* NOTICE IS PRECAUTIONARY ONLY AND DOES NOT IMPLY PUBLICATION
* OR DISCLOSURE.
*
* THIS SOFTWARE CONTAINS CONFIDENTIAL INFORMATION AND TRADE
* SECRETS OF HAL COMPUTER SYSTEMS INTERNATIONAL, LTD. USE,
* DISCLOSURE, OR REPRODUCTION IS PROHIBITED WITHOUT THE
* PRIOR EXPRESS WRITTEN PERMISSION OF HAL COMPUTER SYSTEMS
* INTERNATIONAL, LTD.
*
* RESTRICTED RIGHTS LEGEND
* Use, duplication, or disclosure by the Government is subject
* to the restrictions as set forth in subparagraph (c)(l)(ii)
* of the Rights in Technical Data and Computer Software clause
* at DFARS 252.227-7013.
*
* HAL COMPUTER SYSTEMS INTERNATIONAL, LTD.
* 1315 Dell Avenue
* Campbell, CA 95008
*
*/
#include "misc/unique_id.h"
#include "api/info_lib.h"
#include "utility/db_version.h"
#include "oliasdb/locator_hd.h"
#include "oliasdb/graphic_hd.h"
/*
extern void report_total();
extern void reset_total();
*/
int g_mode_8_3 = 0;
typedef char* charPtr;
info_lib::info_lib(char** set_name_array, char** list_name_array,
char* info_lib_dir, char* selected_base_name,
char* infoLibName, int des) :
set_nm_list(set_name_array), list_nm_list(list_name_array),
f_bad_base_array_size(0), f_bad_info_bases(0),
f_bad_info_base_names(0), f_bad_info_base_paths(0), f_descriptor(des)
{
//debug(cerr, info_lib_dir);
//debug(cerr, infoLibName);
int len;
f_obj_dict = new object_dict;
if ( info_lib_dir == 0 ) {
throw(stringException("NULL info lib path"));
}
if ( check_and_create_dir(info_lib_dir) == false )
throw(stringException(
form("infolib %s does not exist or can't be created", info_lib_dir)
)
);
len = MIN(strlen(info_lib_dir), PATHSIZ -1);
*((char *) memcpy (info_lib_path, info_lib_dir, len) + len) = '\0';
len = MIN(strlen(infoLibName), PATHSIZ -1);
*((char *) memcpy (info_lib_name, infoLibName, len) + len) = '\0';
fstream *map_in = 0;
if ( exist_file(MAP_FILE_8_3, info_lib_dir) == true ) {
map_in = new fstream(form("%s/%s", info_lib_dir, MAP_FILE_8_3), ios::in);
g_mode_8_3 = 1;
if ( !map_in -> getline(info_lib_name, PATHSIZ, '\t') ||
!map_in -> getline(info_lib_uid, UIDSIZ, '\n')
)
{
throw(stringException(
form("infolib %s does not have correct name-id entry", info_lib_dir)
)
);
}
} else
if ( exist_file(MAP_FILE, info_lib_dir) == true )
map_in = new fstream(form("%s/%s", info_lib_dir, MAP_FILE), ios::in);
else {
return;
}
char base_name[PATHSIZ];
char base_desc[PATHSIZ];
char base_uid[UIDSIZ];
char base_locale[PATHSIZ];
char db_path_name[PATHSIZ];
int major_mm_version = 0;
int minor_mm_version = 0;
while ( map_in -> getline(base_name, PATHSIZ, '\t') ) {
map_in -> getline(base_desc, PATHSIZ, '\t');
if ( g_mode_8_3 == 1 ) {
map_in -> getline(base_uid, PATHSIZ, '\t');
map_in -> getline(base_locale, PATHSIZ, '\t');
}
else
base_uid[0] = 0;
(*map_in) >> major_mm_version >> minor_mm_version;
map_in -> get();
if ( base_name[0] != CommentChar ) {
//debug(cerr, base_name);
//debug(cerr, base_desc);
//fprintf(stderr, "base_name = %s\n", base_name);
if ((selected_base_name == 0 ||
strcmp(selected_base_name, base_name) == 0))
{
len = MIN(strlen(info_lib_dir) + strlen(base_name) +1, PATHSIZ -1);
*((char *) memcpy (db_path_name,
form("%s/%s", info_lib_dir, base_name),
len) + len) = '\0';
mm_version mmv_code(MAJOR, MINOR);
mm_version mmv_base_data(2, 1);
mm_version mmv_data(major_mm_version, minor_mm_version);
///////////////////////////////////////////////
// Hardcoded knowledge of discontinuation of
// backward compatibility
///////////////////////////////////////////////
if ( mmv_data < mmv_base_data ||
mmv_data == mmv_base_data ||
mmv_code < mmv_data
)
{
if ( f_bad_base_array_size == 0 ||
f_bad_base_array_size <= f_bad_info_bases
)
{
if ( f_bad_base_array_size == 0 ) {
f_bad_base_array_size = 10;
f_bad_info_base_names = new charPtr[f_bad_base_array_size];
f_bad_info_base_paths = new charPtr[f_bad_base_array_size];
for (int i=0; i<f_bad_base_array_size; i++) {
f_bad_info_base_paths[i] = 0;
f_bad_info_base_names[i] = 0;
}
} else {
char** x = new charPtr[2*f_bad_base_array_size];
char** y = new charPtr[2*f_bad_base_array_size];
for (int i=0; i<2*f_bad_base_array_size; i++) {
x[i] = 0;
y[i] = 0;
}
memcpy(x, f_bad_info_base_names, sizeof(charPtr)*f_bad_base_array_size);
memcpy(y, f_bad_info_base_paths, sizeof(charPtr)*f_bad_base_array_size);
f_bad_base_array_size *= 2;
delete [] f_bad_info_base_names;
delete [] f_bad_info_base_paths;
f_bad_info_base_names = x;
f_bad_info_base_paths = y;
}
}
f_bad_info_base_paths[f_bad_info_bases] = strdup(info_lib_dir);
f_bad_info_base_names[f_bad_info_bases] = strdup(base_name);
f_bad_info_bases++;
MESSAGE(cerr, "Data and code version mismatch");
MESSAGE(cerr, form("Data version: v%d.%d",
major_mm_version, minor_mm_version
));
MESSAGE(cerr, form("Code version: v%d.%d",
MAJOR, MINOR
));
MESSAGE(cerr, form("infobase %s is not available.", base_name));
continue;
}
//reset_total();
_init_info_base(db_path_name, base_name, base_desc, base_uid, base_locale,
mm_version(major_mm_version, minor_mm_version));
//report_total();
}
}
}
map_in -> close();
delete map_in ;
}
info_lib::~info_lib()
{
long ind = first();
while ( ind ) {
info_base* x = (*this)(ind);
delete x;
next(ind) ;
}
if ( f_bad_info_base_paths ) {
for (int i=0; i<f_bad_base_array_size; i++) {
delete f_bad_info_base_paths[i];
}
delete f_bad_info_base_paths;
}
if ( f_bad_info_base_names ) {
for (int i=0; i<f_bad_base_array_size; i++) {
delete f_bad_info_base_names[i];
}
delete f_bad_info_base_names;
}
delete f_obj_dict;
}
/* *********************************************************/
// init all bases. play the trick by changing the db_path
// value to load all info bases (each has different db_path).
/* *********************************************************/
info_base *
info_lib::_init_info_base( const char* base_path,
const char* base_name,
const char* base_desc,
const char* base_uid,
const char* base_locale,
const mm_version& v
)
{
/*
debug(cerr, base_path);
debug(cerr, base_name);
*/
//fprintf(stderr, "init_base\n");
//fprintf(stderr, "base_path=%s\n", base_path);
//fprintf(stderr, "base_name=%s\n", base_name);
info_base *x = 0;
if ( ( x = get_info_base(base_name)) == 0 ) {
if ( exist_dir(base_path) == false )
return 0;
//fprintf(stderr, "try to init %s\n", base_name);
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,
base_path, base_name, base_desc, base_uid, base_locale,
v
);
info_base_list.insert_as_tail(new dlist_void_ptr_cell(x));
}
mcatch (mmdbException &,e)
{
//fprintf(stderr, "in catch block\n");
return 0;
} end_try;
}
return x;
}
/******************************************/
//
// def_strings array:
//
// def_strings[0] : infobase name
// def_strings[1] : infobase textual description
// def_strings[2] : define spec file name (full path)
//
/******************************************/
Boolean
info_lib::define_info_base( char* base_name, char* base_desc,
char* spec_file_path
)
{
//MESSAGE(cerr, "define_info_base()");
//debug(cerr, base_name);
//debug(cerr, base_desc);
//debug(cerr, spec_file_path);
char new_db_path[PATHSIZ];
char f_name[PATHSIZ];
char base_uid[UIDSIZ];
int len;
const char* uid;
len = MIN(strlen(info_lib_path) + strlen(base_name) + 1, PATHSIZ -1);
*((char *) memcpy (new_db_path,
form("%s/%s", info_lib_path, base_name),
len) + len) = '\0';
uid = unique_id();
len = MIN(strlen(uid), UIDSIZ -1);
*((char *) memcpy(base_uid, uid, len) + len) = '\0';
g_mode_8_3 = 1;
info_base* base = get_info_base(base_name) ;
/* no checking here. DDK assures unique base name case
if ( base == 0 ) {
*/
//////////////////////////
// check info base path
//////////////////////////
if ( check_and_create_dir(new_db_path) == false ) {
throw(stringException(form("bad base bath %s", new_db_path)));
}
//////////////////////////
// remove any old files
//////////////////////////
len = MIN(strlen(base_name) + strlen(DATA_FILE_SUFFIX) +1, PATHSIZ -1);
*((char *) memcpy(f_name,
form("%s.%s", base_name, DATA_FILE_SUFFIX),
len) + len) = '\0';
if ( exist_file(f_name, new_db_path) == true )
del_file(f_name, new_db_path);
len = MIN(strlen(base_name) + strlen(INDEX_FILE_SUFFIX) + 1, PATHSIZ -1);
*((char *) memcpy(f_name,
form("%s.%s", base_name, INDEX_FILE_SUFFIX),
len) + len) = '\0';
if ( exist_file(f_name, new_db_path) == true )
del_file(f_name, new_db_path);
len = MIN(strlen(base_name) + strlen(SCHEMA_FILE_SUFFIX) +1, PATHSIZ -1);
*((char *) memcpy(f_name,
form("%s.%s", base_name, SCHEMA_FILE_SUFFIX),
len) + len) = '\0';
if ( exist_file(f_name, new_db_path) == true )
del_file(f_name, new_db_path);
f_obj_dict -> init_a_base(spec_file_path, new_db_path, base_name);
const char* lang;
if ((lang = getenv("LC_ALL")) == NULL)
if ((lang = getenv("LC_CTYPE")) == NULL)
if ((lang = getenv("LANG")) == NULL)
lang = "C.UTF-8";
base = new info_base(*f_obj_dict, set_nm_list, list_nm_list,
new_db_path, base_name, base_desc, base_uid,
lang, mm_version(MAJOR, MINOR)
);
info_base_list.insert_as_tail(new dlist_void_ptr_cell(base));
/*************************************/
// add the base name and description
// to the names file
/*************************************/
char* lib_nm = form("%s/%s", info_lib_path, MAP_FILE_8_3);
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",
info_lib_path, MAP_FILE_8_3)
);
throw(streamException(nm_out.rdstate()));
}
if ( bytes(lib_nm) == 0 ) {
char* lib_entry = form("%s\t%s\n", info_lib_name, unique_id());
if ( !(nm_out << lib_entry) ) {
MESSAGE(cerr,
form("write %s.%s failed", info_lib_path, MAP_FILE_8_3));
throw(streamException(nm_out.rdstate()));
}
}
char* base_entry = form("%s\t%s\t%s\t%s\t%d\t%d\n",
base_name, base_desc, base_uid,
lang, MAJOR, MINOR
);
if ( !(nm_out << base_entry) ) {
MESSAGE(cerr, form("write %s.%s failed", info_lib_path, MAP_FILE_8_3));
throw(streamException(nm_out.rdstate()));
}
nm_out.close();
if ( nm_out.fail() ) {
MESSAGE(cerr, form("close %s.%s failed", info_lib_path, MAP_FILE_8_3));
throw(streamException(nm_out.rdstate()));
}
//}
//MESSAGE(cerr, "define() done");
return true;
}
info_base* info_lib::get_info_base(const char* info_base_nm)
{
long ind = first();
//debug(cerr, ind);
while ( ind ) {
info_base* x = (*this)(ind);
/*
debug(cerr, int(x));
debug(cerr, x -> base_name);
debug(cerr, info_base_nm);
*/
if ( strcmp ( x -> base_name, info_base_nm) == 0 )
return x;
next(ind) ;
}
return 0;
}
/* inline */
/*
int info_lib::num_of_bases()
{
return info_base_list.count();
}
*/
/*************************/
// iteration funcstions
/*************************/
/* inline */
/*
int info_lib::first()
{
return info_base_list.first();
}
info_base* info_lib::operator()(int ind)
{
return (info_base*)(((dlist_void_ptr_cell*)ind)->void_ptr());
}
void info_lib::next(int& ind)
{
info_base_list.next(ind) ;
}
*/
int info_lib::bad_infobases()
{
return f_bad_info_bases;
}
const char* info_lib::get_bad_infobase_path(int x)
{
if ( x <= 0 || x > f_bad_info_bases )
return 0;
return f_bad_info_base_paths[x-1];
}
const char* info_lib::get_bad_infobase_name(int x)
{
if ( x <= 0 || x > f_bad_info_bases )
return 0;
return f_bad_info_base_names[x-1];
}
info_base*
info_lib::getInfobaseByComponent(const char *locator_string, enum TestSelector sel)
{
if ( locator_string == 0 )
return 0;
info_base* ib = 0;
long ind = first();
while ( ind ) {
ib = (*this)(ind);
if (ib==0)
throw(stringException("null info_base ptr"));
mtry { // since an infobase may not have any graphics, we catch
// any exceptions there and try next infobase.
switch (sel) {
case LOC:
{
locator_smart_ptr loc(ib, locator_string);
//fprintf(stderr, "inside-loc-string=%s\n", loc.inside_node_locator_str());
//fprintf(stderr, "loc-string=%s\n", locator_string);
if ( strcmp( loc.inside_node_locator_str(), locator_string) == 0 ) {
return ib;
}
}
case GRA:
{
graphic_smart_ptr graphic(ib, locator_string);
if ( strcmp( graphic.locator(), locator_string) == 0 ) {
return ib;
}
}
}
}
mcatch (mmdbException &,e)
{
} end_try;
next(ind);
}
return 0;
}
info_base**
info_lib::getInfobasesByComponent(char **locator_strings, int count, enum TestSelector sel)
{
info_base** ibs = new info_basePtr[count];
int i;
for ( i=0; i<count; ibs[i++] = 0 );
info_base* ib = 0;
long ind = first();
while ( ind ) {
ib = (*this)(ind);
if (ib == 0)
throw(stringException("null info_base ptr"));
for ( i=0; i<count; i++ ) {
mtry {
if ( locator_strings[i] && ibs[i] == 0 ) {
switch (sel) {
case LOC:
{
locator_smart_ptr loc(ib, locator_strings[i]);
if ( strcmp( loc.inside_node_locator_str(),
locator_strings[i]) == 0
)
ibs[i] = ib;
}
break;
case GRA:
{
graphic_smart_ptr graphic(ib, locator_strings[i]);
if ( strcmp( graphic.locator(),
locator_strings[i]) == 0
)
ibs[i] = ib;
}
break;
}
}
}
mcatch (mmdbException &,e)
{
} end_try;
}
next(ind);
}
return ibs;
}

View File

@@ -0,0 +1,151 @@
/*
* 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 libraries and programs; if not, write
* to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
* Floor, Boston, MA 02110-1301 USA
*/
/*
* $XConsortium: info_lib.h /main/5 1996/09/04 01:37:43 cde-hal $
*
* Copyright (c) 1992 HAL Computer Systems International, Ltd.
* All rights reserved. Unpublished -- rights reserved under
* the Copyright Laws of the United States. USE OF A COPYRIGHT
* NOTICE IS PRECAUTIONARY ONLY AND DOES NOT IMPLY PUBLICATION
* OR DISCLOSURE.
*
* THIS SOFTWARE CONTAINS CONFIDENTIAL INFORMATION AND TRADE
* SECRETS OF HAL COMPUTER SYSTEMS INTERNATIONAL, LTD. USE,
* DISCLOSURE, OR REPRODUCTION IS PROHIBITED WITHOUT THE
* PRIOR EXPRESS WRITTEN PERMISSION OF HAL COMPUTER SYSTEMS
* INTERNATIONAL, LTD.
*
* RESTRICTED RIGHTS LEGEND
* Use, duplication, or disclosure by the Government is subject
* to the restrictions as set forth in subparagraph (c)(l)(ii)
* of the Rights in Technical Data and Computer Software clause
* at DFARS 252.227-7013.
*
* HAL COMPUTER SYSTEMS INTERNATIONAL, LTD.
* 1315 Dell Avenue
* Campbell, CA 95008
*
*/
#ifndef _info_lib_h
#define _info_lib_h 1
#include "dstr/dlist.h"
#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
/*************************************/
class info_lib : public primitive
{
public:
info_lib(char** set_name_array, char** list_name_array,
char* info_lib_dir = 0, char* selected_base_name = 0,
char* info_lib_name = (char*)"", int descriptor = -1);
virtual ~info_lib();
// define a base
Boolean define_info_base( char* base_name,
char* base_desc,
char* spec_file_path
);
// get a base (the manager of a collection of documents)
info_base* get_info_base(const char* info_base_name);
// get number of info bases in the lib
int num_of_bases() { return info_base_list.count(); };
// info_lib path/name
const char* get_info_lib_path() { return info_lib_path; };
const char* get_info_lib_name() { return info_lib_name; };
const char* get_info_lib_uid() { return info_lib_uid; };
// iterator. 0 is the termination value
// can be used to get all base names
long first() { return info_base_list.first(); };
info_base* operator()(long ind) {
return (info_base*)(((dlist_void_ptr_cell*)ind)->void_ptr());
};
void next(long& ind) { info_base_list.next(ind); };
enum TestSelector { LOC, GRA };
info_base* getInfobaseByComponent( const char *locator_string,
enum TestSelector sel);
info_base** getInfobasesByComponent( char **locator_strings,
int count, enum TestSelector sel);
int bad_infobases();
const char* get_bad_infobase_path(int);
const char* get_bad_infobase_name(int);
int descriptor() { return f_descriptor; };
protected:
char info_lib_path[PATHSIZ];
char info_lib_name[PATHSIZ];
char info_lib_uid[UIDSIZ];
dlist info_base_list;
char** set_nm_list;
char** list_nm_list;
object_dict *f_obj_dict;
info_base* _init_info_base( const char* new_db_path,
const char* base_name,
const char* base_desc,
const char* base_uid,
const char* base_locale,
const mm_version& v
);
int f_bad_base_array_size;
int f_bad_info_bases;
char** f_bad_info_base_names;
char** f_bad_info_base_paths;
int f_descriptor;
/*
void define_composites(composite_mgr_t* mgr_ptr,
char* new_db_path,
char** def_strings,
Boolean& base_exist);
*/
};
typedef info_lib* info_libPtr;
#endif

View File

@@ -0,0 +1,96 @@
/*
* 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 libraries and programs; if not, write
* to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
* Floor, Boston, MA 02110-1301 USA
*/
/*
* $XConsortium: server.cc /main/3 1996/06/11 17:11:23 cde-hal $
*
* Copyright (c) 1993 HAL Computer Systems International, Ltd.
* All rights reserved. Unpublished -- rights reserved under
* the Copyright Laws of the United States. USE OF A COPYRIGHT
* NOTICE IS PRECAUTIONARY ONLY AND DOES NOT IMPLY PUBLICATION
* OR DISCLOSURE.
*
* THIS SOFTWARE CONTAINS CONFIDENTIAL INFORMATION AND TRADE
* SECRETS OF HAL COMPUTER SYSTEMS INTERNATIONAL, LTD. USE,
* DISCLOSURE, OR REPRODUCTION IS PROHIBITED WITHOUT THE
* PRIOR EXPRESS WRITTEN PERMISSION OF HAL COMPUTER SYSTEMS
* INTERNATIONAL, LTD.
*
* RESTRICTED RIGHTS LEGEND
* Use, duplication, or disclosure by the Government is subject
* to the restrictions as set forth in subparagraph (c)(l)(ii)
* of the Rights in Technical Data and Computer Software clause
* at DFARS 252.227-7013.
*
* HAL COMPUTER SYSTEMS INTERNATIONAL, LTD.
* 1315 Dell Avenue
* Campbell, CA 95008
*
*/
#include "api/server.h"
#include "utility/db_version.h"
server::server(char* x_infolib_path) :
infolibptr(0), info_base_set_names(0), info_base_list_names(0)
{
if ( x_infolib_path == 0 ) {
throw(stringException("NULL info lib path"));
}
if ( check_and_create_dir(x_infolib_path) == false )
throw(stringException(
form("server: infolib %s does not exist or can't be created", x_infolib_path)
)
);
int len = MIN(strlen(x_infolib_path), PATHSIZ - 1);
*((char *) memcpy(info_lib_dir, x_infolib_path, len) + len) = '\0';
}
server::~server()
{
delete infolibptr;
delete info_base_set_names;
delete info_base_list_names;
}
int server::major_code_version()
{
return MAJOR;
}
int server::minor_code_version()
{
return MINOR;
}
mm_version server::code_version()
{
return mm_version(MAJOR, MINOR);
}

View File

@@ -0,0 +1,82 @@
/*
* 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 libraries and programs; if not, write
* to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
* Floor, Boston, MA 02110-1301 USA
*/
/*
* $XConsortium: server.h /main/3 1996/06/11 17:11:28 cde-hal $
*
* Copyright (c) 1993 HAL Computer Systems International, Ltd.
* All rights reserved. Unpublished -- rights reserved under
* the Copyright Laws of the United States. USE OF A COPYRIGHT
* NOTICE IS PRECAUTIONARY ONLY AND DOES NOT IMPLY PUBLICATION
* OR DISCLOSURE.
*
* THIS SOFTWARE CONTAINS CONFIDENTIAL INFORMATION AND TRADE
* SECRETS OF HAL COMPUTER SYSTEMS INTERNATIONAL, LTD. USE,
* DISCLOSURE, OR REPRODUCTION IS PROHIBITED WITHOUT THE
* PRIOR EXPRESS WRITTEN PERMISSION OF HAL COMPUTER SYSTEMS
* INTERNATIONAL, LTD.
*
* RESTRICTED RIGHTS LEGEND
* Use, duplication, or disclosure by the Government is subject
* to the restrictions as set forth in subparagraph (c)(l)(ii)
* of the Rights in Technical Data and Computer Software clause
* at DFARS 252.227-7013.
*
* HAL COMPUTER SYSTEMS INTERNATIONAL, LTD.
* 1315 Dell Avenue
* Campbell, CA 95008
*
*/
#ifndef _server_h
#define _server_h 1
#include "api/info_lib.h"
#include "api/info_base.h"
#include "mgrs/managers.h"
class server
{
public:
server(char* x_info_lib_path);
~server();
info_lib* infolib_ptr() { return infolibptr; };
int major_code_version() ;
int minor_code_version() ;
mm_version code_version();
protected:
char info_lib_dir[PATHSIZ];
info_lib* infolibptr;
char** info_base_set_names;
char** info_base_list_names;
managers internal_managers;
};
#endif

View File

@@ -0,0 +1,343 @@
/*
* 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 libraries and programs; if not, write
* to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
* Floor, Boston, MA 02110-1301 USA
*/
/*
* $XConsortium: smart_ptr.cc /main/4 1996/06/11 17:11:33 cde-hal $
*
* Copyright (c) 1992 HAL Computer Systems International, Ltd.
* All rights reserved. Unpublished -- rights reserved under
* the Copyright Laws of the United States. USE OF A COPYRIGHT
* NOTICE IS PRECAUTIONARY ONLY AND DOES NOT IMPLY PUBLICATION
* OR DISCLOSURE.
*
* THIS SOFTWARE CONTAINS CONFIDENTIAL INFORMATION AND TRADE
* SECRETS OF HAL COMPUTER SYSTEMS INTERNATIONAL, LTD. USE,
* DISCLOSURE, OR REPRODUCTION IS PROHIBITED WITHOUT THE
* PRIOR EXPRESS WRITTEN PERMISSION OF HAL COMPUTER SYSTEMS
* INTERNATIONAL, LTD.
*
* RESTRICTED RIGHTS LEGEND
* Use, duplication, or disclosure by the Government is subject
* to the restrictions as set forth in subparagraph (c)(l)(ii)
* of the Rights in Technical Data and Computer Software clause
* at DFARS 252.227-7013.
*
* HAL COMPUTER SYSTEMS INTERNATIONAL, LTD.
* 1315 Dell Avenue
* Campbell, CA 95008
*
*/
#include "api/smart_ptr.h"
#include "object/compressed_pstring.h"
smart_ptr::smart_ptr(info_lib* lib_ptr,
const char* ibase_name,
int composite_pos,
const handler& query_hd,
int index_selector,
composite_tag tag
)
{
info_base* ibase = lib_ptr -> get_info_base(ibase_name);
if ( ibase == 0 ) {
throw(stringException(
form("unknown base %s in %s\n", ibase_name,
lib_ptr -> get_info_lib_path()
)));
}
//debug(cerr, ibase -> num_of_docs());
switch (tag) {
case SET:
{
cset_handlerPtr set_ptr = ibase -> get_set(composite_pos);
if ( set_ptr == 0 )
throw(stringException("NULL set ptr"));
_init((*set_ptr)->get_first_oid(query_hd, index_selector),
set_ptr -> its_store()
);
}
break;
case LIST:
{
dl_list_handlerPtr list_ptr = ibase -> get_list(composite_pos);
if ( list_ptr == 0 )
throw(stringException("NULL set ptr"));
_init((*list_ptr)->get_first_oid(query_hd, index_selector),
list_ptr -> its_store()
);
}
break;
default:
throw(stringException("unknown tag"));
}
}
smart_ptr::smart_ptr(info_base* ibase,
int composite_pos,
const handler& query_hd,
int index_selector,
composite_tag tag
)
{
switch (tag) {
case SET:
{
cset_handlerPtr set_ptr = ibase -> get_set(composite_pos);
if ( set_ptr == 0 )
throw(stringException("NULL set ptr"));
_init((*set_ptr)->get_first_oid(query_hd, index_selector),
set_ptr -> its_store()
);
}
break;
case LIST:
{
dl_list_handlerPtr list_ptr = ibase -> get_list(composite_pos);
if ( list_ptr == 0 )
throw(stringException("NULL set ptr"));
_init((*list_ptr)->get_first_oid(query_hd, index_selector),
list_ptr -> its_store()
);
}
break;
default:
throw(stringException("unknown tag"));
}
}
/* inlined */
/*
smart_ptr::smart_ptr()
{
}
smart_ptr::~smart_ptr()
{
}
*/
void smart_ptr::_init(const oid_t& id, const abs_storage* x)
{
//MESSAGE(cerr, "smart_ptr::_init()");
obj_id.become(id);
//obj_id.asciiOut(cerr); cerr << "\n";
store = (abs_storage*)x;
obj_ptr = 0;
handler::operator->();
//obj_id.asciiOut(cerr); cerr << "\n";
//debug(cerr, int(obj_ptr));
//MESSAGE(cerr, "smart_ptr::_init() done");
}
handler* smart_ptr::get_handler(int i, c_code_t code)
{
handler* x = _get_component(i);
x -> operator->();
if ( x -> its_oid().ccode() != code )
throw(stringException("invalid node data class code"));
return x;
}
int smart_ptr::get_int(int i)
{
handler* x = get_handler(i, INTEGER_CODE);
int y= (*(integer_handler*)x) -> get();
delete x;
return y;
}
const char* smart_ptr::get_string(int i, buffer& buf)
{
handler* x = _get_component(i);
x -> operator->(); // this will bring the its_oid field up-to-date
char* str;
switch ( x -> its_oid().ccode() ) {
case STRING_CODE:
{
str = (*(pstring_handler*)x) -> get(buf);
break;
}
case COMPRESSED_STRING_CODE:
{
str = (*(compressed_pstring_handler*)x) -> get(buf);
break;
}
default:
throw(stringException("invalid node data class code"));
}
delete x;
return str;
}
const char* smart_ptr::get_string(int i)
{
handler* x = _get_component(i);
x -> operator->(); // this will bring the its_oid field up-to-date
char* str;
switch ( x -> its_oid().ccode() ) {
case STRING_CODE:
{
str = (*(pstring_handler*)x) -> get();
break;
}
case COMPRESSED_STRING_CODE:
{
str = (*(compressed_pstring_handler*)x) -> get();
break;
}
default:
throw(stringException("invalid node data class code"));
}
delete x;
return str;
}
int smart_ptr::get_string_size(int i)
{
handler* x = _get_component(i);
x -> operator->(); // this will bring the its_oid field up-to-date
int y ;
switch ( x -> its_oid().ccode() ) {
case STRING_CODE:
y = (*(pstring_handler*)x) -> size();
break;
case COMPRESSED_STRING_CODE:
y = (*(compressed_pstring_handler*)x) -> size();
break;
default:
throw(stringException("invalid node data class code"));
}
delete x;
return y;
}
oid_t smart_ptr::get_oid(int i)
{
handler* x = get_handler(i, OID_CODE);
oid_t y = (*(oid_handler*)x) -> my_coid();
delete x;
return y;
}
void smart_ptr::update_oid(int i, const oid_t& x)
{
static char buf[64];
handler* z = get_handler(i, OID_CODE);
oid_handler* y = (oid_handler*)z;
snprintf(buf, sizeof(buf), "%d.%d\n", x.ccode(), (int)x.icode());
istringstream in(buf);
(*y) -> asciiIn(in);
delete y;
}
void smart_ptr::update_string(int i, istream& in)
{
handler* x = _get_component(i);
x -> operator->(); // this will bring the its_oid field up-to-date
io_status ok;
switch ( x -> its_oid().ccode() ) {
case STRING_CODE:
ok =(*(pstring_handler*)x) -> asciiIn(in);
break;
case COMPRESSED_STRING_CODE:
ok =(*(compressed_pstring_handler*)x) -> _asciiIn(in);
break;
default:
throw(stringException("invalid node data class code"));
}
if(ok) { ; }
delete x;
}
void smart_ptr::update_string(int i, const char* buf, int size)
{
handler* x = _get_component(i);
x -> operator->(); // this will bring the its_oid field up-to-date
switch ( x -> its_oid().ccode() ) {
case STRING_CODE:
(*(pstring_handler*)x) -> update(buf, size);
break;
case COMPRESSED_STRING_CODE:
(*(compressed_pstring_handler*)x) -> _asciiIn(buf, size);
break;
default:
throw(stringException("invalid node data class code"));
}
delete x;
}

View File

@@ -0,0 +1,104 @@
/*
* 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 libraries and programs; if not, write
* to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
* Floor, Boston, MA 02110-1301 USA
*/
/*
* $XConsortium: smart_ptr.h /main/5 1996/06/11 17:11:38 cde-hal $
*
* Copyright (c) 1992 HAL Computer Systems International, Ltd.
* All rights reserved. Unpublished -- rights reserved under
* the Copyright Laws of the United States. USE OF A COPYRIGHT
* NOTICE IS PRECAUTIONARY ONLY AND DOES NOT IMPLY PUBLICATION
* OR DISCLOSURE.
*
* THIS SOFTWARE CONTAINS CONFIDENTIAL INFORMATION AND TRADE
* SECRETS OF HAL COMPUTER SYSTEMS INTERNATIONAL, LTD. USE,
* DISCLOSURE, OR REPRODUCTION IS PROHIBITED WITHOUT THE
* PRIOR EXPRESS WRITTEN PERMISSION OF HAL COMPUTER SYSTEMS
* INTERNATIONAL, LTD.
*
* RESTRICTED RIGHTS LEGEND
* Use, duplication, or disclosure by the Government is subject
* to the restrictions as set forth in subparagraph (c)(l)(ii)
* of the Rights in Technical Data and Computer Software clause
* at DFARS 252.227-7013.
*
* HAL COMPUTER SYSTEMS INTERNATIONAL, LTD.
* 1315 Dell Avenue
* Campbell, CA 95008
*
*/
#ifndef _smart_ptr_h
#define _smart_ptr_h 1
#include "object/cset.h"
#include "object/dl_list.h"
#include "object/integer.h"
#include "api/info_lib.h"
#include "mgrs/query_mgr.h"
class smart_ptr : public composite_handler
{
public:
enum composite_tag { SET, LIST };
smart_ptr(info_lib* lib_ptr,
const char* infobase_name, int composite_position,
const handler& query_hd, int index_selector, composite_tag);
smart_ptr(info_base* base_ptr, int composite_position,
const handler& query_hd, int index_selector, composite_tag);
smart_ptr(abs_storage* st, const oid_t& x)
/*: composite_handler(c)*/
{
_init(*(oid_t*)&x, st);
};
smart_ptr() {};
virtual ~smart_ptr() {};
int get_int(int component_index);
const char* get_string(int component_index);
const char* get_string(int component_index, buffer&);
int get_string_size(int component_index);
oid_t get_oid(int component_index);
void update_oid(int component_index, const oid_t& x);
void update_string(int component_index, istream& in);
void update_string(int component_index, const char* buf, int size);
protected:
void _init(const oid_t& id, const abs_storage*);
handler* get_handler(int component_index, c_code_t code);
};
typedef smart_ptr* smart_ptrPtr;
#endif

View File

@@ -0,0 +1,177 @@
/*
* 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 libraries and programs; if not, write
* to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
* Floor, Boston, MA 02110-1301 USA
*/
/*
* $XConsortium: transaction.C /main/5 1996/08/21 15:51:19 drk $
*
* Copyright (c) 1993 HAL Computer Systems International, Ltd.
* All rights reserved. Unpublished -- rights reserved under
* the Copyright Laws of the United States. USE OF A COPYRIGHT
* NOTICE IS PRECAUTIONARY ONLY AND DOES NOT IMPLY PUBLICATION
* OR DISCLOSURE.
*
* THIS SOFTWARE CONTAINS CONFIDENTIAL INFORMATION AND TRADE
* SECRETS OF HAL COMPUTER SYSTEMS INTERNATIONAL, LTD. USE,
* DISCLOSURE, OR REPRODUCTION IS PROHIBITED WITHOUT THE
* PRIOR EXPRESS WRITTEN PERMISSION OF HAL COMPUTER SYSTEMS
* INTERNATIONAL, LTD.
*
* RESTRICTED RIGHTS LEGEND
* Use, duplication, or disclosure by the Government is subject
* to the restrictions as set forth in subparagraph (c)(l)(ii)
* of the Rights in Technical Data and Computer Software clause
* at DFARS 252.227-7013.
*
* HAL COMPUTER SYSTEMS INTERNATIONAL, LTD.
* 1315 Dell Avenue
* Campbell, CA 95008
*
*/
#include "api/transaction.h"
#include "dstr/bset.h"
#include "mgrs/misc.h"
transaction* g_transac = 0;
//////////////////////////////////////
// application functions
//////////////////////////////////////
inline void begin_trans(const void* x)
{
((page_storage*)x) -> begin_trans();
}
inline void end_trans(const void* x)
{
((page_storage*)x) -> commit_trans();
}
inline void roll_back(const void* x)
{
((page_storage*)x) -> roll_back();
}
inline void psync(const void* x)
{
((page_storage*)x) -> sync();
}
inline void commit_object(const void* x)
{
name_oid_t *y = (name_oid_t*)x;
if (y==0)
throw(stringException("null pointer"));
handler z(y->v_oid, y->v_store);
z.commit();
}
inline void set_updated_false_f(const void* x)
{
name_oid_t *y = (name_oid_t*)x;
if (y==0)
throw(stringException("null pointer"));
handler z(y->v_oid, y->v_store);
z -> set_mode(UPDATE, false);
}
//////////////////////////////////
//
//
//////////////////////////////////
transaction::transaction() :
v_store_array(), v_updated_objects(oid_storage_eq, oid_storage_ls)
{
}
transaction::~transaction()
{
}
void transaction::book(abs_storage* x)
{
if ( v_store_array.member(x) == 0 ) {
((page_storage*)x) -> begin_trans();
v_store_array.insert(x);
}
}
void transaction::book(oid_t& id, abs_storage* x)
{
char _dummy[1]; _dummy[0] = 0;
name_oid_t* y = new name_oid_t(_dummy, id, x);
if ( v_updated_objects.insert(y) == false )
delete y;
if ( v_store_array.member(x) == 0 ) {
debug(cerr, id);
debug(cerr, x -> my_path());
debug(cerr, x -> my_name());
throw(stringException("store is not in transaction mode"));
}
}
void transaction::begin()
{
v_store_array.apply(begin_trans);
g_transac = this;
//MESSAGE(cerr, "g_tr in transaction.C");
//debug(cerr, int(g_transac));
}
void transaction::end()
{
//MESSAGE(cerr, "transaction::end()");
v_updated_objects.apply(commit_object);
v_store_array.apply(end_trans);
v_updated_objects.del_elements(delete_name_oid_rec_f);
g_transac = 0;
//MESSAGE(cerr, "transaction::end() done");
}
void transaction::abort()
{
v_updated_objects.del_elements(delete_name_oid_rec_f);
g_transac = 0;
}
void transaction::rollback()
{
v_updated_objects.apply(set_updated_false_f);
v_store_array.apply(roll_back);
}
void transaction::sync()
{
v_updated_objects.apply(commit_object);
v_store_array.apply(psync);
g_transac = 0;
}

View File

@@ -0,0 +1,85 @@
/*
* 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 libraries and programs; if not, write
* to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
* Floor, Boston, MA 02110-1301 USA
*/
/*
* $XConsortium: transaction.h /main/4 1996/06/11 17:11:50 cde-hal $
*
* Copyright (c) 1993 HAL Computer Systems International, Ltd.
* All rights reserved. Unpublished -- rights reserved under
* the Copyright Laws of the United States. USE OF A COPYRIGHT
* NOTICE IS PRECAUTIONARY ONLY AND DOES NOT IMPLY PUBLICATION
* OR DISCLOSURE.
*
* THIS SOFTWARE CONTAINS CONFIDENTIAL INFORMATION AND TRADE
* SECRETS OF HAL COMPUTER SYSTEMS INTERNATIONAL, LTD. USE,
* DISCLOSURE, OR REPRODUCTION IS PROHIBITED WITHOUT THE
* PRIOR EXPRESS WRITTEN PERMISSION OF HAL COMPUTER SYSTEMS
* INTERNATIONAL, LTD.
*
* RESTRICTED RIGHTS LEGEND
* Use, duplication, or disclosure by the Government is subject
* to the restrictions as set forth in subparagraph (c)(l)(ii)
* of the Rights in Technical Data and Computer Software clause
* at DFARS 252.227-7013.
*
* HAL COMPUTER SYSTEMS INTERNATIONAL, LTD.
* 1315 Dell Avenue
* Campbell, CA 95008
*
*/
#ifndef _transaction_h
#define _transaction_h 1
#include <stdarg.h>
#include "dstr/bset.h"
#include "object/oid_t.h"
#include "storage/page_storage.h"
#include "mgrs/misc.h"
class transaction
{
public:
transaction();
~transaction();
void book(oid_t&, abs_storage*);
void book(abs_storage*);
void begin();
void end();
void sync(); // checkpoint in odmg93
void rollback();
void abort();
protected:
bset v_store_array;
bset v_updated_objects;
};
extern transaction* g_transac;
#endif

View File

@@ -0,0 +1,92 @@
/*
* 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 libraries and programs; if not, write
* to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
* Floor, Boston, MA 02110-1301 USA
*/
/*
* $XConsortium: utility.cc /main/4 1996/06/11 17:11:55 cde-hal $
*
* Copyright (c) 1992 HAL Computer Systems International, Ltd.
* All rights reserved. Unpublished -- rights reserved under
* the Copyright Laws of the United States. USE OF A COPYRIGHT
* NOTICE IS PRECAUTIONARY ONLY AND DOES NOT IMPLY PUBLICATION
* OR DISCLOSURE.
*
* THIS SOFTWARE CONTAINS CONFIDENTIAL INFORMATION AND TRADE
* SECRETS OF HAL COMPUTER SYSTEMS INTERNATIONAL, LTD. USE,
* DISCLOSURE, OR REPRODUCTION IS PROHIBITED WITHOUT THE
* PRIOR EXPRESS WRITTEN PERMISSION OF HAL COMPUTER SYSTEMS
* INTERNATIONAL, LTD.
*
* RESTRICTED RIGHTS LEGEND
* Use, duplication, or disclosure by the Government is subject
* to the restrictions as set forth in subparagraph (c)(l)(ii)
* of the Rights in Technical Data and Computer Software clause
* at DFARS 252.227-7013.
*
* HAL COMPUTER SYSTEMS INTERNATIONAL, LTD.
* 1315 Dell Avenue
* Campbell, CA 95008
*
*/
#include "api/utility.h"
#include "misc/unique_id.h"
typedef char* charPtr;
int load( info_base* base, char* container_nm )
{
return _load( base, container_nm, cin );
}
int load( info_base* base, char* container_nm, char* data_path )
{
fstream in(data_path, ios::in);
return _load( base, container_nm, in );
}
int load( info_base* base, char** argv, int argc )
{
int ok = 0;
char* container_nm, *data_path;
for ( int i=0; i<argc; i += 2 ) {
container_nm = argv[i];
data_path = argv[i+1];
ok |= load( base, container_nm, data_path );
}
return ok;
}
int _load( info_base* base, char* container_nm, istream& in )
{
handler* x = (base -> get_obj_dict()).get_handler(container_nm);
if ( x ) {
(*(cset_handler*)x) -> asciiIn(in);
return 0;
} else
return -1;
}

View File

@@ -0,0 +1,69 @@
/*
* 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 libraries and programs; if not, write
* to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
* Floor, Boston, MA 02110-1301 USA
*/
/*
* $XConsortium: utility.h /main/5 1996/08/21 15:51:23 drk $
*
* Copyright (c) 1992 HAL Computer Systems International, Ltd.
* All rights reserved. Unpublished -- rights reserved under
* the Copyright Laws of the United States. USE OF A COPYRIGHT
* NOTICE IS PRECAUTIONARY ONLY AND DOES NOT IMPLY PUBLICATION
* OR DISCLOSURE.
*
* THIS SOFTWARE CONTAINS CONFIDENTIAL INFORMATION AND TRADE
* SECRETS OF HAL COMPUTER SYSTEMS INTERNATIONAL, LTD. USE,
* DISCLOSURE, OR REPRODUCTION IS PROHIBITED WITHOUT THE
* PRIOR EXPRESS WRITTEN PERMISSION OF HAL COMPUTER SYSTEMS
* INTERNATIONAL, LTD.
*
* RESTRICTED RIGHTS LEGEND
* Use, duplication, or disclosure by the Government is subject
* to the restrictions as set forth in subparagraph (c)(l)(ii)
* of the Rights in Technical Data and Computer Software clause
* at DFARS 252.227-7013.
*
* HAL COMPUTER SYSTEMS INTERNATIONAL, LTD.
* 1315 Dell Avenue
* Campbell, CA 95008
*
*/
#ifndef _utility_h
#define _utility_h 1
#ifdef C_API
#include "utility/c_stringstream.h"
#else
#include <sstream>
#endif
#include <string.h>
#include "utility/debug.h"
#include "api/info_lib.h"
int _load( info_base*, char* container_nm, istream& in );
int load( info_base*, char* container_nm, char* data_path );
int load( info_base*, char* container_nm ); // from cin
int load( info_base*, char** argv, int argc );
#endif