DtMmdb: move to lib directory as a standalone library.
This commit is contained in:
23
cde/lib/DtMmdb/schema/Makefile.am
Normal file
23
cde/lib/DtMmdb/schema/Makefile.am
Normal file
@@ -0,0 +1,23 @@
|
||||
MAINTAINERCLEANFILES = Makefile.in
|
||||
|
||||
noinst_LTLIBRARIES = libschema.la
|
||||
|
||||
libschema_la_CXXFLAGS = -I..
|
||||
|
||||
libschema_la_SOURCES = desc.C store_desc.C object_dict.C stored_object_desc.C \
|
||||
index_desc.C inv_desc.C agent_desc.C container_desc.C \
|
||||
sheet.C token.C
|
||||
|
||||
AM_YFLAGS = -l -d
|
||||
AM_LFLAGS = -8 -s
|
||||
|
||||
CLEANFILES = sheet.C \
|
||||
sheet.tab.h \
|
||||
token.C
|
||||
|
||||
sheet.C: sheet.yy
|
||||
$(YACC) $(AM_YFLAGS) -p schema -b sheet $<
|
||||
mv sheet.tab.c $@
|
||||
|
||||
token.C: token.ll
|
||||
$(LEX) $(AM_LFLAGS) -P schema -o $@ $<
|
||||
142
cde/lib/DtMmdb/schema/agent_desc.C
Normal file
142
cde/lib/DtMmdb/schema/agent_desc.C
Normal file
@@ -0,0 +1,142 @@
|
||||
/*
|
||||
* 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: agent_desc.cc /main/4 1996/06/11 17:31:35 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 "schema/agent_desc.h"
|
||||
#include "index/fast_mphf.h"
|
||||
#include "compression/abs_agent.h"
|
||||
|
||||
|
||||
mphf_desc::mphf_desc() : stored_object_desc(FAST_MPHF_CODE, "index_agent mphf")
|
||||
{
|
||||
}
|
||||
|
||||
handler* mphf_desc::init_handler(object_dict& dict)
|
||||
{
|
||||
page_storage* store = (page_storage*)dict.get_store(get_store_nm());
|
||||
|
||||
if ( v_oid.icode() == 0 ) {
|
||||
v_handler_ptr = new handler(FAST_MPHF_CODE, store);
|
||||
desc::set_oid(v_handler_ptr -> its_oid());
|
||||
} else
|
||||
v_handler_ptr = new fast_mphf_handler(v_oid, store);
|
||||
|
||||
return v_handler_ptr;
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////
|
||||
|
||||
btree_desc::btree_desc() : stored_object_desc(BTREE_CODE, "index_agent btree")
|
||||
{
|
||||
}
|
||||
|
||||
handler* btree_desc::init_handler(object_dict& dict)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////
|
||||
|
||||
smphf_desc::smphf_desc() : stored_object_desc(DYN_DISK_HASH_CODE, "index_agent smphf")
|
||||
{
|
||||
}
|
||||
|
||||
handler* smphf_desc::init_handler(object_dict& dict)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////
|
||||
|
||||
huffman_desc::huffman_desc() :
|
||||
stored_object_desc(HUFFMAN_AGENT_CODE, "compress huffman")
|
||||
{
|
||||
}
|
||||
|
||||
handler* huffman_desc::init_handler(object_dict& dict)
|
||||
{
|
||||
page_storage* store = (page_storage*)dict.get_store(get_store_nm());
|
||||
|
||||
if ( v_oid.icode() == 0 ) {
|
||||
v_handler_ptr = new handler(HUFFMAN_AGENT_CODE, store);
|
||||
desc::set_oid(v_handler_ptr -> its_oid());
|
||||
} else
|
||||
v_handler_ptr = new compress_agent_handler(v_oid, store);
|
||||
|
||||
return v_handler_ptr;
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////
|
||||
|
||||
dict_desc::dict_desc() :
|
||||
stored_object_desc(DICT_AGENT_CODE, "compress dict")
|
||||
{
|
||||
}
|
||||
|
||||
handler* dict_desc::init_handler(object_dict& dict)
|
||||
{
|
||||
page_storage* store = (page_storage*)dict.get_store(get_store_nm());
|
||||
|
||||
if ( v_oid.icode() == 0 ) {
|
||||
v_handler_ptr = new handler(DICT_AGENT_CODE, store);
|
||||
desc::set_oid(v_handler_ptr -> its_oid());
|
||||
} else
|
||||
v_handler_ptr = new compress_agent_handler(v_oid, store);
|
||||
|
||||
return v_handler_ptr;
|
||||
}
|
||||
|
||||
111
cde/lib/DtMmdb/schema/agent_desc.h
Normal file
111
cde/lib/DtMmdb/schema/agent_desc.h
Normal file
@@ -0,0 +1,111 @@
|
||||
/*
|
||||
* 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: agent_desc.h /main/3 1996/06/11 17:31:41 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 _agent_desc_h
|
||||
#define _agent_desc_h 1
|
||||
|
||||
#include "schema/stored_object_desc.h"
|
||||
#include "schema/object_dict.h"
|
||||
|
||||
class mphf_desc : public stored_object_desc {
|
||||
|
||||
public:
|
||||
mphf_desc();
|
||||
~mphf_desc() {};
|
||||
|
||||
handler* init_handler(object_dict&) ;
|
||||
|
||||
protected:
|
||||
};
|
||||
|
||||
class btree_desc : public stored_object_desc {
|
||||
|
||||
public:
|
||||
btree_desc();
|
||||
~btree_desc() {};
|
||||
|
||||
handler* init_handler(object_dict&) ;
|
||||
protected:
|
||||
};
|
||||
|
||||
class smphf_desc : public stored_object_desc {
|
||||
|
||||
public:
|
||||
smphf_desc();
|
||||
~smphf_desc() {};
|
||||
|
||||
handler* init_handler(object_dict&) ;
|
||||
protected:
|
||||
};
|
||||
|
||||
|
||||
class huffman_desc : public stored_object_desc {
|
||||
|
||||
public:
|
||||
huffman_desc();
|
||||
~huffman_desc() {};
|
||||
|
||||
handler* init_handler(object_dict&) ;
|
||||
protected:
|
||||
};
|
||||
|
||||
|
||||
class dict_desc : public stored_object_desc {
|
||||
|
||||
public:
|
||||
dict_desc();
|
||||
~dict_desc() {};
|
||||
|
||||
handler* init_handler(object_dict&) ;
|
||||
protected:
|
||||
};
|
||||
|
||||
|
||||
#endif
|
||||
285
cde/lib/DtMmdb/schema/container_desc.C
Normal file
285
cde/lib/DtMmdb/schema/container_desc.C
Normal file
@@ -0,0 +1,285 @@
|
||||
/*
|
||||
* 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: container_desc.cc /main/5 1996/07/18 14:49:46 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 "schema/container_desc.h"
|
||||
|
||||
container_desc::container_desc(int code, const char* comment) :
|
||||
stored_object_desc(code, comment), index_nms(10)
|
||||
{
|
||||
}
|
||||
|
||||
container_desc::~container_desc()
|
||||
{
|
||||
int ind = index_nms.first();
|
||||
char* idx_nm = 0;
|
||||
|
||||
while ( ind != -1 ) {
|
||||
|
||||
idx_nm = (char*)index_nms[ind];
|
||||
|
||||
delete idx_nm;
|
||||
|
||||
index_nms.next(ind);
|
||||
}
|
||||
}
|
||||
|
||||
void container_desc::set_index_nm(const char* str)
|
||||
{
|
||||
if ( index_nms.count() <= index_nms.no_elmts() ) {
|
||||
index_nms.expandWith(2*index_nms.count());
|
||||
}
|
||||
|
||||
int i = index_nms.no_elmts() + 1;
|
||||
|
||||
int l = strlen(str);
|
||||
char *x = new char[l+1];
|
||||
memcpy(x, str, l);
|
||||
x[l] = 0;
|
||||
|
||||
//cerr << "container_desc::set_index_nm(): this = " << this << ", str=(long)" << (long)str << " i=" << i << endl;
|
||||
index_nms.insert(x, i);
|
||||
|
||||
index_nms.reset_elmts(i);
|
||||
}
|
||||
|
||||
ostream& container_desc::asciiOut(ostream& out, Boolean last)
|
||||
{
|
||||
if ( index_nms.no_elmts() == 0 ) {
|
||||
stored_object_desc::asciiOut(out, last);
|
||||
return out;
|
||||
}
|
||||
|
||||
stored_object_desc::asciiOut(out, false);
|
||||
|
||||
int ind = index_nms.first();
|
||||
char* index_nm = 0;
|
||||
int num_printed = 1;
|
||||
|
||||
for ( int i=0; i<index_nms.count(); i++ ) {
|
||||
//cerr << "ind=" << ind << endl;
|
||||
index_nm = (char*)index_nms[ind];
|
||||
index_nms.next(ind);
|
||||
|
||||
if ( index_nm ) {
|
||||
//cerr << "this=" << this << "; index_nm=(long)" << (long)index_nm << " ind=" << ind << endl;
|
||||
if ( num_printed < index_nms.no_elmts() )
|
||||
desc_print(out, index_nm);
|
||||
else {
|
||||
if ( last == true ) {
|
||||
desc_print_end(out, index_nm);
|
||||
break;
|
||||
} else
|
||||
desc_print(out, index_nm);
|
||||
}
|
||||
num_printed++;
|
||||
}
|
||||
}
|
||||
|
||||
return out;
|
||||
|
||||
/*
|
||||
char* index_nm = 0;
|
||||
int ind = index_nms.first();
|
||||
int last_ind = 0;
|
||||
|
||||
cerr << "this=" << this << "; index_nms.no_elmts()=" << index_nms.no_elmts();
|
||||
cerr << "first()=" << ind << endl;
|
||||
|
||||
do {
|
||||
last_ind = ind;
|
||||
|
||||
index_nms.next(ind);
|
||||
|
||||
if ( index_nms[ind] == 0 )
|
||||
break;
|
||||
|
||||
} while ( ind != -1 );
|
||||
|
||||
////////////////////////////
|
||||
stored_object_desc::asciiOut(out, false);
|
||||
|
||||
cerr << "last_ind=" << last_ind << endl;
|
||||
cerr << "ind=" << ind << endl;
|
||||
|
||||
while ( ind != last_ind ) {
|
||||
|
||||
index_nm = (char*)index_nms[ind];
|
||||
index_nms.next(ind);
|
||||
|
||||
if ( index_nm ) {
|
||||
cerr << "this=" << this << "; index_nm=(long)" << (long)index_nm << " ind=" << ind << endl;
|
||||
desc_print(out, index_nm);
|
||||
}
|
||||
}
|
||||
|
||||
index_nm = (char*)index_nms[last_ind];
|
||||
|
||||
if ( last == true)
|
||||
desc_print_end(out, index_nm);
|
||||
else
|
||||
desc_print(out, index_nm);
|
||||
|
||||
|
||||
return out;
|
||||
*/
|
||||
}
|
||||
|
||||
void
|
||||
container_desc::init_index_array(object_dict& dict,
|
||||
c_index_handlerPtr*& index_array,
|
||||
int& idx_array_sz)
|
||||
{
|
||||
c_index_handlerPtr* tmp_index_array =
|
||||
new c_index_handlerPtr[index_nms.no_elmts()];
|
||||
|
||||
idx_array_sz = 0;
|
||||
|
||||
int i = 0;
|
||||
int ind = index_nms.first();
|
||||
char* idx_nm = 0;
|
||||
|
||||
while ( ind != -1 ) {
|
||||
|
||||
idx_nm = (char*)index_nms[ind];
|
||||
|
||||
if ( idx_nm ) {
|
||||
|
||||
c_index_handler* idx_handler =
|
||||
(c_index_handler*)dict.get_handler(idx_nm);
|
||||
|
||||
idx_array_sz = MAX(idx_array_sz, (*idx_handler) -> bound_to());
|
||||
|
||||
tmp_index_array[i++] = idx_handler;
|
||||
}
|
||||
|
||||
index_nms.next(ind);
|
||||
//cerr << "ind=" << ind << endl;
|
||||
}
|
||||
|
||||
idx_array_sz++;
|
||||
|
||||
index_array = new c_index_handlerPtr[idx_array_sz];
|
||||
|
||||
for ( ind=0; ind<idx_array_sz; ind++ )
|
||||
index_array[ind] = 0;
|
||||
|
||||
for ( ind=0; ind<i; ind++ ) {
|
||||
int pos = (*tmp_index_array[ind]) -> bound_to();
|
||||
index_array[pos] = tmp_index_array[ind];
|
||||
}
|
||||
|
||||
delete [] tmp_index_array;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
|
||||
set_desc::set_desc() : container_desc(SET_CODE, "container set")
|
||||
{
|
||||
}
|
||||
|
||||
handler* set_desc::init_handler(object_dict& dict)
|
||||
{
|
||||
page_storage* store = (page_storage*)dict.get_store(get_store_nm());
|
||||
|
||||
if ( v_oid.icode() == 0 ) {
|
||||
v_handler_ptr = new handler(SET_CODE, store);
|
||||
desc::set_oid(v_handler_ptr -> its_oid());
|
||||
} else
|
||||
v_handler_ptr = new cset_handler(v_oid, store);
|
||||
|
||||
/////////////////////////////
|
||||
// init index array
|
||||
/////////////////////////////
|
||||
c_index_handlerPtr* idx_array = 0; int sz = 0;
|
||||
|
||||
init_index_array(dict, idx_array, sz) ;
|
||||
|
||||
//debug(cerr, v_handler_ptr -> its_oid());
|
||||
//debug(cerr, int(v_handler_ptr -> operator ->()));
|
||||
|
||||
(*(cset_handler*)v_handler_ptr) -> init_data_member(idx_array, sz);
|
||||
|
||||
return v_handler_ptr;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
|
||||
list_desc::list_desc() : container_desc(DL_LIST_CODE, "container list")
|
||||
{
|
||||
}
|
||||
|
||||
handler* list_desc::init_handler(object_dict& dict)
|
||||
{
|
||||
page_storage* store = (page_storage*)dict.get_store(get_store_nm());
|
||||
|
||||
if ( v_oid.icode() == 0 ) {
|
||||
v_handler_ptr = new handler(DL_LIST_CODE, store);
|
||||
desc::set_oid(v_handler_ptr -> its_oid());
|
||||
} else
|
||||
v_handler_ptr = new dl_list_handler(v_oid, store);
|
||||
|
||||
/////////////////////////////
|
||||
// init index array
|
||||
/////////////////////////////
|
||||
c_index_handlerPtr* idx_array = 0; int sz = 0;
|
||||
|
||||
init_index_array(dict, idx_array, sz) ;
|
||||
|
||||
//debug(cerr, v_handler_ptr -> its_oid());
|
||||
(*(dl_list_handler*)v_handler_ptr) -> init_data_member(idx_array, sz);
|
||||
|
||||
return v_handler_ptr;
|
||||
}
|
||||
|
||||
|
||||
73
cde/lib/DtMmdb/schema/container_desc.h
Normal file
73
cde/lib/DtMmdb/schema/container_desc.h
Normal file
@@ -0,0 +1,73 @@
|
||||
/*
|
||||
* 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: container_desc.h /main/4 1996/06/11 17:31:53 cde-hal $ */
|
||||
|
||||
#ifndef _container_desc_h
|
||||
#define _container_desc_h 1
|
||||
|
||||
#include "schema/stored_object_desc.h"
|
||||
#include "schema/object_dict.h"
|
||||
#include "dstr/void_ptr_array.h"
|
||||
#include "object/dl_list.h"
|
||||
#include "object/cset.h"
|
||||
#include "index/index.h"
|
||||
|
||||
class container_desc : public stored_object_desc {
|
||||
|
||||
public:
|
||||
container_desc(int class_code, const char* comment = "");
|
||||
virtual ~container_desc();
|
||||
|
||||
void set_index_nm(const char*);
|
||||
virtual ostream& asciiOut(ostream& out, Boolean last = true);
|
||||
|
||||
void init_index_array(object_dict&, c_index_handlerPtr*&, int& sz) ;
|
||||
|
||||
protected:
|
||||
void_ptr_array index_nms;
|
||||
};
|
||||
|
||||
class set_desc : public container_desc {
|
||||
|
||||
public:
|
||||
set_desc();
|
||||
virtual ~set_desc() {};
|
||||
|
||||
handler* init_handler(object_dict&) ;
|
||||
|
||||
protected:
|
||||
};
|
||||
|
||||
class list_desc : public container_desc {
|
||||
|
||||
public:
|
||||
list_desc();
|
||||
virtual ~list_desc() {};
|
||||
|
||||
handler* init_handler(object_dict&) ;
|
||||
|
||||
protected:
|
||||
};
|
||||
|
||||
|
||||
#endif
|
||||
150
cde/lib/DtMmdb/schema/desc.C
Normal file
150
cde/lib/DtMmdb/schema/desc.C
Normal file
@@ -0,0 +1,150 @@
|
||||
/*
|
||||
* 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: desc.cc /main/3 1996/06/11 17:31:57 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 "schema/desc.h"
|
||||
|
||||
desc::desc(const char* name) : v_oid(ground), next_desc(0)
|
||||
{
|
||||
nm = strdup(name);
|
||||
type = strdup("");
|
||||
}
|
||||
|
||||
desc::desc(int tp, const char* type_str) : v_oid(ground), next_desc(0)
|
||||
{
|
||||
nm = strdup("");
|
||||
|
||||
v_oid.set_c_code(tp);
|
||||
type = strdup(type_str);
|
||||
}
|
||||
|
||||
desc::~desc()
|
||||
{
|
||||
delete nm;
|
||||
delete type;
|
||||
}
|
||||
|
||||
void desc::set_nm(const char* name)
|
||||
{
|
||||
delete nm;
|
||||
nm = strdup(name);
|
||||
}
|
||||
|
||||
void desc::set_oid(const char* source)
|
||||
{
|
||||
istringstream in((char*)source);
|
||||
v_oid._asciiIn(in);
|
||||
}
|
||||
|
||||
void desc::set_oid(const oid_t& source)
|
||||
{
|
||||
v_oid.become(source);
|
||||
}
|
||||
|
||||
ostream& desc::asciiOut(ostream& out, Boolean last)
|
||||
{
|
||||
out << type << ":\\\n";
|
||||
|
||||
desc_print(out, nm);
|
||||
|
||||
if ( last == true )
|
||||
desc_print_end(out, v_oid);
|
||||
else
|
||||
desc_print(out, v_oid);
|
||||
|
||||
if ( !out )
|
||||
throw(stringException("desc::asciiOut() failed"));
|
||||
|
||||
return out;
|
||||
}
|
||||
|
||||
ostream& desc::asciiOutList(ostream& out)
|
||||
{
|
||||
desc *ptr = this;
|
||||
|
||||
out << "#=====\n";
|
||||
out << "#\n";
|
||||
|
||||
if ( !out )
|
||||
throw(stringException("desc::asciiOutList() failed"));
|
||||
|
||||
while ( ptr ) {
|
||||
out << "#=====\n";
|
||||
ptr -> asciiOut(out);
|
||||
out << "#\n";
|
||||
|
||||
if ( !out )
|
||||
throw(stringException("desc::asciiOutList() failed"));
|
||||
|
||||
ptr = ptr -> next_desc;
|
||||
}
|
||||
|
||||
return out;
|
||||
}
|
||||
|
||||
ostream& operator<<(ostream& out, const desc& ds)
|
||||
{
|
||||
(*(desc*)&ds).asciiOut(out);
|
||||
return out;
|
||||
}
|
||||
|
||||
Boolean desc_name_ls(const void* o1, const void* o2)
|
||||
{
|
||||
desc *x = (desc*)o1;
|
||||
desc *y = (desc*)o2;
|
||||
return (strcmp(x->nm, y->nm) < 0) ? true : false;
|
||||
}
|
||||
|
||||
Boolean desc_name_eq(const void* o1, const void* o2)
|
||||
{
|
||||
desc *x = (desc*)o1;
|
||||
desc *y = (desc*)o2;
|
||||
return (strcmp(x->nm, y->nm) == 0) ? true : false;
|
||||
}
|
||||
|
||||
122
cde/lib/DtMmdb/schema/desc.h
Normal file
122
cde/lib/DtMmdb/schema/desc.h
Normal file
@@ -0,0 +1,122 @@
|
||||
/*
|
||||
* 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: desc.h /main/5 1996/07/18 14:50:09 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
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
#ifndef _desc_h
|
||||
#define _desc_h 1
|
||||
|
||||
#include "object/oid_t.h"
|
||||
#include "object/c_codes.h"
|
||||
#include "storage/abs_storage.h"
|
||||
#include "object/handler.h"
|
||||
|
||||
#define desc_print3(s, n, x) s << " " << n << "=" << (x) << ":\\" << endl
|
||||
#define desc_print_end3(s, n, x) s << " " << n << "=" << (x) << endl
|
||||
|
||||
#if !defined ( __STDC__) && !defined (hpux)
|
||||
#define desc_print(s, x) s << " " << "x" << "=" << (x) << ":\\\n"
|
||||
#define desc_print_end(s, x) s << " " << "x" << "=" << (x) << "\n"
|
||||
#else
|
||||
#define desc_print(s, x) s << " " << #x << "=" << (x) << ":\\\n"
|
||||
#define desc_print_end(s, x) s << " " << #x << "=" << (x) << "\n"
|
||||
#endif
|
||||
|
||||
Boolean desc_name_ls(const void* o1, const void* o2);
|
||||
Boolean desc_name_eq(const void* o1, const void* o2);
|
||||
|
||||
class object_dict;
|
||||
|
||||
class desc : public Destructable {
|
||||
|
||||
public:
|
||||
desc(const char* name);
|
||||
desc(int class_code, const char* type);
|
||||
virtual ~desc();
|
||||
|
||||
virtual handler* init_handler(object_dict&) { return 0; };
|
||||
virtual abs_storage* init_store(char*) { return 0; };
|
||||
|
||||
virtual handler* get_handler() { return 0; };
|
||||
virtual abs_storage* get_store() { return 0; };
|
||||
|
||||
virtual void quit_handler() {};
|
||||
virtual void sync_store() {};
|
||||
virtual void quit_store() {};
|
||||
|
||||
void set_nm(const char*);
|
||||
void set_oid(const char*);
|
||||
void set_oid(const oid_t&);
|
||||
|
||||
void set_next_desc(desc* x) { next_desc = x; };
|
||||
|
||||
const char* get_nm() { return nm; };
|
||||
const char* get_type() { return type; };
|
||||
desc* get_next_desc() { return next_desc; };
|
||||
|
||||
friend ostream& operator<<(ostream&, const desc&);
|
||||
virtual ostream& asciiOut(ostream& out, Boolean last = true);
|
||||
|
||||
ostream& asciiOutList(ostream& out);
|
||||
|
||||
friend Boolean desc_name_ls(const void* o1, const void* o2);
|
||||
friend Boolean desc_name_eq(const void* o1, const void* o2);
|
||||
|
||||
friend class object_dict;
|
||||
|
||||
protected:
|
||||
oid_t v_oid;
|
||||
desc* next_desc;
|
||||
|
||||
private:
|
||||
char* nm;
|
||||
char* type;
|
||||
};
|
||||
|
||||
|
||||
#endif
|
||||
69
cde/lib/DtMmdb/schema/hash_desc.C
Normal file
69
cde/lib/DtMmdb/schema/hash_desc.C
Normal 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: hash_desc.cc /main/3 1996/06/11 17:32:08 cde-hal $
|
||||
|
||||
#include "schema/hash_desc.h"
|
||||
#include "handler/fast_mphf_handler.h"
|
||||
|
||||
|
||||
mphf_desc::mphf_desc() : stored_object_desc(FAST_MPHF_CODE, "index_agent mphf")
|
||||
{
|
||||
}
|
||||
|
||||
handler* mphf_desc::init_handler(object_dict& dict)
|
||||
{
|
||||
page_storage* store = (page_storage*)dict.get_store(store_nm);
|
||||
|
||||
if ( v_oid.icode() == 0 ) {
|
||||
v_handler_ptr = new handler(FAST_MPHF_CODE, store);
|
||||
desc::set_oid(v_handler_ptr -> its_oid());
|
||||
} else
|
||||
v_handler_ptr = new fast_mphf_handler(v_oid, store);
|
||||
|
||||
return v_handler_ptr;
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////
|
||||
|
||||
btree_desc::btree_desc() : stored_object_desc(BTREE_CODE, "index_agent btree")
|
||||
{
|
||||
}
|
||||
|
||||
handler* btree_desc::init_handler(object_dict& dict)
|
||||
{
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////
|
||||
|
||||
smphf_desc::smphf_desc() : stored_object_desc(DYN_DISK_HASH_CODE, "index_agent smphf")
|
||||
{
|
||||
}
|
||||
|
||||
handler* smphf_desc::init_handler(object_dict& dict)
|
||||
{
|
||||
}
|
||||
|
||||
63
cde/lib/DtMmdb/schema/hash_desc.h
Normal file
63
cde/lib/DtMmdb/schema/hash_desc.h
Normal file
@@ -0,0 +1,63 @@
|
||||
/*
|
||||
* 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: hash_desc.h /main/3 1996/06/11 17:32:12 cde-hal $ */
|
||||
|
||||
#ifndef _hash_desc_h
|
||||
#define _hash_desc_h 1
|
||||
|
||||
#include "schema/stored_object_desc.h"
|
||||
#include "schema/object_dict.h"
|
||||
|
||||
class mphf_desc : public stored_object_desc {
|
||||
|
||||
public:
|
||||
mphf_desc();
|
||||
~mphf_desc() {};
|
||||
|
||||
handler* init_handler(object_dict&) ;
|
||||
|
||||
protected:
|
||||
};
|
||||
|
||||
class btree_desc : public stored_object_desc {
|
||||
|
||||
public:
|
||||
btree_desc();
|
||||
~btree_desc() {};
|
||||
|
||||
handler* init_handler(object_dict&) ;
|
||||
protected:
|
||||
};
|
||||
|
||||
class smphf_desc : public stored_object_desc {
|
||||
|
||||
public:
|
||||
smphf_desc();
|
||||
~smphf_desc() {};
|
||||
|
||||
handler* init_handler(object_dict&) ;
|
||||
protected:
|
||||
};
|
||||
|
||||
|
||||
#endif
|
||||
204
cde/lib/DtMmdb/schema/index_desc.C
Normal file
204
cde/lib/DtMmdb/schema/index_desc.C
Normal file
@@ -0,0 +1,204 @@
|
||||
/*
|
||||
* 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: index_desc.cc /main/4 1996/06/11 17:32:17 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 "schema/index_desc.h"
|
||||
|
||||
#include "index/inv_lists.h"
|
||||
#include "index/mphf_index.h"
|
||||
#include "index/dyn_disk_index.h"
|
||||
#include "index/btree_index.h"
|
||||
|
||||
|
||||
index_desc::index_desc(int class_code, const char* comment) :
|
||||
stored_object_desc(class_code, comment), position(0)
|
||||
{
|
||||
inv_nm = strdup("");
|
||||
agent_nm = strdup("");
|
||||
}
|
||||
|
||||
index_desc::~index_desc()
|
||||
{
|
||||
delete inv_nm;
|
||||
delete agent_nm;
|
||||
}
|
||||
|
||||
void index_desc::set_inv_nm(const char* str)
|
||||
{
|
||||
delete inv_nm;
|
||||
inv_nm = strdup(str);
|
||||
}
|
||||
|
||||
void index_desc::set_agent_nm(const char* str)
|
||||
{
|
||||
delete agent_nm;
|
||||
agent_nm = strdup(str);
|
||||
}
|
||||
|
||||
ostream& index_desc::asciiOut(ostream& out, Boolean last)
|
||||
{
|
||||
desc::asciiOut(out, false);
|
||||
desc_print(out, inv_nm);
|
||||
desc_print3(out, "store_nm", get_store_nm());
|
||||
desc_print(out, position);
|
||||
|
||||
if ( last == true )
|
||||
desc_print_end(out, agent_nm);
|
||||
else
|
||||
desc_print(out, agent_nm);
|
||||
|
||||
if ( ! out )
|
||||
throw(stringException("index_desc::asciiOut() failed"));
|
||||
|
||||
return out;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////
|
||||
//
|
||||
//////////////////////////////////////////////////
|
||||
mphf_index_desc::mphf_index_desc() :
|
||||
index_desc(MPHF_INDEX_CODE, "index mphf_index")
|
||||
{
|
||||
}
|
||||
|
||||
handler* mphf_index_desc::init_handler(object_dict& dict)
|
||||
{
|
||||
page_storage* store = (page_storage*)dict.get_store(get_store_nm());
|
||||
|
||||
if ( v_oid.icode() == 0 ) {
|
||||
v_handler_ptr = new handler(MPHF_INDEX_CODE, store);
|
||||
desc::set_oid(v_handler_ptr -> its_oid());
|
||||
} else
|
||||
v_handler_ptr = new mphf_index_handler(v_oid, store);
|
||||
|
||||
/////////////////////////////
|
||||
// get inv list component
|
||||
/////////////////////////////
|
||||
handler* inv_handler = dict.get_handler(get_inv_nm());
|
||||
|
||||
/////////////////////////////
|
||||
// init index agent
|
||||
/////////////////////////////
|
||||
handler* mphf_handler = dict.get_handler(get_agent_nm());
|
||||
|
||||
(*(mphf_index_handler*)v_handler_ptr) ->
|
||||
init_data_member(
|
||||
(fast_mphf_handler*)mphf_handler,
|
||||
(inv_lists_handler*)inv_handler
|
||||
);
|
||||
|
||||
(*(mphf_index_handler*)v_handler_ptr) -> set_selector(position) ;
|
||||
|
||||
return v_handler_ptr;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////
|
||||
//
|
||||
//////////////////////////////////////////////////
|
||||
btree_index_desc::btree_index_desc() :
|
||||
index_desc(MPHF_INDEX_CODE, "index btree_index")
|
||||
{
|
||||
}
|
||||
|
||||
handler* btree_index_desc::init_handler(object_dict& dict)
|
||||
{
|
||||
page_storage* store = (page_storage*)dict.get_store(get_store_nm());
|
||||
|
||||
if ( v_oid.icode() == 0 ) {
|
||||
v_handler_ptr = new handler(BTREE_INDEX_CODE, store);
|
||||
desc::set_oid(v_handler_ptr -> its_oid());
|
||||
} else
|
||||
v_handler_ptr = new btree_index_handler(v_oid, store);
|
||||
|
||||
/////////////////////////////
|
||||
// get inv list component
|
||||
/////////////////////////////
|
||||
handler* inv_handler = dict.get_handler(get_inv_nm());
|
||||
|
||||
(*(btree_index_handler*)v_handler_ptr) ->
|
||||
init_data_member(
|
||||
(inv_lists_handler*)inv_handler,
|
||||
form("%s/%s", get_agent_nm(), dict.db_path())
|
||||
);
|
||||
|
||||
(*(btree_index_handler*)v_handler_ptr) -> set_selector(position) ;
|
||||
|
||||
return v_handler_ptr;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////
|
||||
//
|
||||
//////////////////////////////////////////////////
|
||||
smphf_index_desc::smphf_index_desc() :
|
||||
index_desc(DYN_DISK_INDEX_CODE, "index smphf_index")
|
||||
{
|
||||
}
|
||||
|
||||
handler* smphf_index_desc::init_handler(object_dict& dict)
|
||||
{
|
||||
page_storage* store = (page_storage*)dict.get_store(get_store_nm());
|
||||
|
||||
if ( v_oid.icode() == 0 ) {
|
||||
v_handler_ptr = new handler(DYN_DISK_INDEX_CODE, store);
|
||||
desc::set_oid(v_handler_ptr -> its_oid());
|
||||
} else
|
||||
v_handler_ptr = new dyn_disk_index_handler(v_oid, store);
|
||||
|
||||
handler* inv_handler = dict.get_handler(get_inv_nm());
|
||||
|
||||
page_storage* idx_store = (page_storage*)dict.get_store(get_agent_nm());
|
||||
|
||||
(*(dyn_disk_index_handler*)v_handler_ptr) ->
|
||||
init_data_member( (inv_lists_handler*)inv_handler, idx_store );
|
||||
|
||||
(*(dyn_disk_index_handler*)v_handler_ptr) -> set_selector(position) ;
|
||||
|
||||
return v_handler_ptr;
|
||||
}
|
||||
|
||||
115
cde/lib/DtMmdb/schema/index_desc.h
Normal file
115
cde/lib/DtMmdb/schema/index_desc.h
Normal 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: index_desc.h /main/3 1996/06/11 17:32:22 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 _index_desc_h
|
||||
#define _index_desc_h 1
|
||||
|
||||
#include "schema/stored_object_desc.h"
|
||||
#include "schema/object_dict.h"
|
||||
|
||||
class index_desc : public stored_object_desc {
|
||||
|
||||
public:
|
||||
index_desc(int class_code, const char* comment = "");
|
||||
~index_desc();
|
||||
|
||||
void set_position(int x) { position = x; } ;
|
||||
void set_inv_nm(const char*) ;
|
||||
void set_agent_nm(const char*) ;
|
||||
|
||||
char* get_inv_nm() { return inv_nm; };
|
||||
char* get_agent_nm() { return agent_nm; };
|
||||
|
||||
virtual ostream& asciiOut(ostream& out, Boolean last = true);
|
||||
|
||||
protected:
|
||||
int position;
|
||||
|
||||
private:
|
||||
char* inv_nm;
|
||||
char* agent_nm;
|
||||
};
|
||||
|
||||
|
||||
class mphf_index_desc : public index_desc {
|
||||
|
||||
public:
|
||||
mphf_index_desc();
|
||||
~mphf_index_desc() {};
|
||||
|
||||
handler* init_handler(object_dict&) ;
|
||||
|
||||
protected:
|
||||
};
|
||||
|
||||
class smphf_index_desc : public index_desc {
|
||||
|
||||
public:
|
||||
smphf_index_desc();
|
||||
~smphf_index_desc() {};
|
||||
|
||||
handler* init_handler(object_dict&) ;
|
||||
|
||||
protected:
|
||||
};
|
||||
|
||||
class btree_index_desc : public index_desc {
|
||||
|
||||
public:
|
||||
btree_index_desc();
|
||||
~btree_index_desc() {};
|
||||
|
||||
handler* init_handler(object_dict&) ;
|
||||
|
||||
protected:
|
||||
};
|
||||
|
||||
|
||||
#endif
|
||||
71
cde/lib/DtMmdb/schema/inv_desc.C
Normal file
71
cde/lib/DtMmdb/schema/inv_desc.C
Normal file
@@ -0,0 +1,71 @@
|
||||
/*
|
||||
* 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: inv_desc.cc /main/4 1996/06/11 17:32:27 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 "schema/inv_desc.h"
|
||||
#include "index/inv_lists.h"
|
||||
|
||||
inv_desc::inv_desc() : stored_object_desc(INV_LISTS_CODE, "inv inv")
|
||||
{
|
||||
}
|
||||
|
||||
handler* inv_desc::init_handler(object_dict& dict)
|
||||
{
|
||||
page_storage* store = (page_storage*)dict.get_store(get_store_nm());
|
||||
|
||||
if ( v_oid.icode() == 0 ) {
|
||||
v_handler_ptr = new handler(INV_LISTS_CODE, store);
|
||||
desc::set_oid(v_handler_ptr -> its_oid());
|
||||
} else
|
||||
v_handler_ptr = new inv_lists_handler(v_oid, store);
|
||||
|
||||
return v_handler_ptr;
|
||||
}
|
||||
|
||||
|
||||
43
cde/lib/DtMmdb/schema/inv_desc.h
Normal file
43
cde/lib/DtMmdb/schema/inv_desc.h
Normal file
@@ -0,0 +1,43 @@
|
||||
/*
|
||||
* 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: inv_desc.h /main/3 1996/06/11 17:32:31 cde-hal $ */
|
||||
|
||||
#ifndef _inv_desc_h
|
||||
#define _inv_desc_h 1
|
||||
|
||||
#include "schema/stored_object_desc.h"
|
||||
#include "schema/object_dict.h"
|
||||
|
||||
class inv_desc : public stored_object_desc {
|
||||
|
||||
public:
|
||||
inv_desc();
|
||||
virtual ~inv_desc() {};
|
||||
|
||||
handler* init_handler(object_dict&) ;
|
||||
|
||||
protected:
|
||||
};
|
||||
|
||||
|
||||
#endif
|
||||
56
cde/lib/DtMmdb/schema/main.C
Normal file
56
cde/lib/DtMmdb/schema/main.C
Normal file
@@ -0,0 +1,56 @@
|
||||
/*
|
||||
* 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: main.cc /main/3 1996/06/11 17:32:36 cde-hal $
|
||||
|
||||
#include "utility/funcs.h"
|
||||
#include "schema/object_dict.h"
|
||||
|
||||
int main( int argc, char** argv )
|
||||
{
|
||||
INIT_EXCEPTIONS();
|
||||
|
||||
try
|
||||
{
|
||||
if ( argc != 4 ) {
|
||||
MESSAGE(cerr, "usage: def_name db_path base_nm\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
object_dict od(argv[1], argv[2], argv[3]);
|
||||
}
|
||||
|
||||
catch (mmdbException &,e)
|
||||
{
|
||||
cerr << "Exception msg: " << e << "\n";
|
||||
#ifdef DEBUG
|
||||
abort();
|
||||
#else
|
||||
ok = -1;
|
||||
#endif
|
||||
|
||||
}
|
||||
end_try;
|
||||
|
||||
exit( 0 );
|
||||
}
|
||||
|
||||
542
cde/lib/DtMmdb/schema/object_dict.C
Normal file
542
cde/lib/DtMmdb/schema/object_dict.C
Normal file
@@ -0,0 +1,542 @@
|
||||
/*
|
||||
* 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: object_dict.C /main/7 1996/09/13 20:48:20 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 "schema/object_dict.h"
|
||||
#include "utility/randomize.h"
|
||||
#include "utility/db_version.h"
|
||||
#include "misc/unique_id.h"
|
||||
|
||||
desc* desc_ptr = 0;
|
||||
desc* last_desc_ptr = 0;
|
||||
|
||||
char replace_string[PATHSIZ];
|
||||
int replace_string_len;
|
||||
|
||||
//extern int yyparse();
|
||||
//extern int yyrestart(FILE*);
|
||||
//extern FILE *yyin;
|
||||
|
||||
extern int schemaparse();
|
||||
extern void schemarestart(FILE*);
|
||||
extern FILE *schemain;
|
||||
|
||||
object_dict::object_dict() :
|
||||
v_dict(desc_name_eq, desc_name_ls), v_desc_ptr(0), v_last_desc_ptr(NULL)
|
||||
{
|
||||
v_db_path[0] = 0;
|
||||
}
|
||||
|
||||
object_dict::~object_dict()
|
||||
{
|
||||
quit_a_base(v_desc_ptr, 0, true);
|
||||
}
|
||||
|
||||
void object_dict::quit_a_base(desc* b, desc* e, Boolean sync)
|
||||
{
|
||||
_quit_stored_objects(b, e);
|
||||
_quit_stores(b, e, sync);
|
||||
_quit_descs(b, e);
|
||||
}
|
||||
|
||||
void object_dict::_quit_descs(desc* begin_ptr, desc* end_ptr)
|
||||
{
|
||||
desc *ptr = begin_ptr;
|
||||
desc *x_ptr = 0;
|
||||
|
||||
while ( ptr != end_ptr ) {
|
||||
x_ptr = ptr;
|
||||
ptr = ptr -> next_desc;
|
||||
delete x_ptr;
|
||||
}
|
||||
}
|
||||
|
||||
extern int g_mode_8_3;
|
||||
|
||||
|
||||
desc* object_dict::init_a_base(char* db_path, char* db_name)
|
||||
{
|
||||
//MESSAGE(cerr, "object_dict::init_a_base()");
|
||||
//debug(cerr, db_path);
|
||||
|
||||
int len = MIN(strlen(db_path), PATHSIZ - 1);
|
||||
*((char *) memcpy(v_db_path, db_path, len) + len) = '\0';
|
||||
|
||||
desc* x = 0;
|
||||
|
||||
char* schema_path = 0;
|
||||
|
||||
if ( g_mode_8_3 )
|
||||
schema_path = form("%s/%s.%s", v_db_path, db_name, SCHEMA_FILE_SUFFIX);
|
||||
else
|
||||
schema_path = form("%s/%s", v_db_path, SCHEMA_FILE);
|
||||
|
||||
fstream in(schema_path, ios::in);
|
||||
|
||||
if ( !in )
|
||||
throw(streamException(in.rdstate()));
|
||||
|
||||
char schema_header[LBUFSIZ];
|
||||
|
||||
if ( !in.getline(schema_header, LBUFSIZ) ) {
|
||||
throw(streamException(in.rdstate()));
|
||||
}
|
||||
|
||||
if ( strncmp(schema_header+1, "MMDB", 4) != 0 ) {
|
||||
in.close();
|
||||
x = parse(schema_path);
|
||||
} else {
|
||||
|
||||
unsigned int sz = bytes(schema_path) - strlen(schema_header) - 1;
|
||||
char* buf = new char[sz];
|
||||
|
||||
if ( !in.read(buf, sz) )
|
||||
throw(streamException(in.rdstate()));
|
||||
|
||||
in.close();
|
||||
|
||||
buffer orig(0);
|
||||
orig.set_chunk(buf, sz);
|
||||
orig.set_content_sz(sz);
|
||||
|
||||
randomize rd(233);
|
||||
rd.restore(orig);
|
||||
|
||||
//fprintf(stderr, "buf=%s\n", buf);
|
||||
//debug(cerr, buf);
|
||||
|
||||
////////////////
|
||||
// do the parse
|
||||
////////////////
|
||||
x = parse(orig);
|
||||
|
||||
delete [] buf;
|
||||
|
||||
}
|
||||
|
||||
_init(x);
|
||||
|
||||
return x;
|
||||
}
|
||||
|
||||
desc* object_dict::init_a_base(char* define_desc_path, char* db_path,
|
||||
char* db_name)
|
||||
{
|
||||
//MESSAGE(cerr, "object_dict::init a base (define case)");
|
||||
//debug(cerr, define_desc_path);
|
||||
//debug(cerr, db_path);
|
||||
//debug(cerr, db_name);
|
||||
|
||||
int len;
|
||||
|
||||
len = MIN(strlen(db_path), PATHSIZ - 1);
|
||||
*((char *) memcpy(v_db_path, db_path, len) + len) = '\0';
|
||||
|
||||
if ( db_name ) {
|
||||
len = MIN(strlen(db_name), PATHSIZ - 1);
|
||||
*((char *) memcpy(replace_string, db_name, len) + len) = '\0';
|
||||
replace_string_len = strlen(replace_string);
|
||||
} else {
|
||||
replace_string[0] = 0;
|
||||
replace_string_len = 0;
|
||||
}
|
||||
|
||||
|
||||
fstream in_test(define_desc_path, ios::in);
|
||||
|
||||
if ( ! in_test ) {
|
||||
throw(stringException(form("%s does not exist.", define_desc_path)));
|
||||
}
|
||||
|
||||
unsigned long llen = bytes(define_desc_path)*4;
|
||||
|
||||
in_test.close();
|
||||
|
||||
if ( disk_space(v_db_path) < llen ) {
|
||||
throw(stringException(form("no enough space on %s", v_db_path)));
|
||||
}
|
||||
|
||||
///////////////////////////////////
|
||||
// define and init the dictionary
|
||||
///////////////////////////////////
|
||||
desc* x = parse(define_desc_path);
|
||||
_init(x);
|
||||
|
||||
////////////////////////////
|
||||
// randomize the schema.mmdb
|
||||
////////////////////////////
|
||||
|
||||
fstream in(define_desc_path, ios::in);
|
||||
|
||||
if ( !in) {
|
||||
debug(cerr, define_desc_path);
|
||||
throw(streamException(in.rdstate()));
|
||||
}
|
||||
|
||||
unsigned int sz = bytes(define_desc_path);
|
||||
in.close();
|
||||
|
||||
char* schema_buf = new char[sz*3];
|
||||
|
||||
ostringstream* string_out = new ostringstream(schema_buf);
|
||||
if ( !(*string_out) ) {
|
||||
throw(streamException(string_out -> rdstate()));
|
||||
}
|
||||
|
||||
x -> asciiOutList(*string_out);
|
||||
|
||||
len = MIN((unsigned int) string_out->str().size(), sz*3 - 1);
|
||||
*((char *) memcpy(schema_buf, string_out->str().c_str(), len) + len) = '\0';
|
||||
delete string_out;
|
||||
|
||||
sz = strlen(schema_buf);
|
||||
|
||||
buffer orig(0);
|
||||
orig.set_chunk(schema_buf, sz);
|
||||
orig.set_content_sz(sz);
|
||||
|
||||
randomize rd(233);
|
||||
rd.scramble(orig);
|
||||
|
||||
/////////////////////////////
|
||||
// save the output to db_path
|
||||
/////////////////////////////
|
||||
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));
|
||||
throw(streamException(out.rdstate()));
|
||||
}
|
||||
|
||||
char* desc_header = form("#MMDB\t%d\t%d\n", MAJOR, MINOR);
|
||||
if ( !out.write(desc_header, strlen(desc_header)) ) {
|
||||
MESSAGE(cerr, form("write descirption head in %s failed", db_path));
|
||||
throw(streamException(out.rdstate()));
|
||||
}
|
||||
|
||||
if ( !out.write(schema_buf, strlen(schema_buf)) ) {
|
||||
MESSAGE(cerr, form("write descirption in %s failed", db_path));
|
||||
throw(streamException(out.rdstate()));
|
||||
}
|
||||
|
||||
out.close();
|
||||
|
||||
delete [] schema_buf;
|
||||
|
||||
|
||||
return x;
|
||||
}
|
||||
|
||||
desc* object_dict::parse(buffer& desc_buf)
|
||||
{
|
||||
char unique_nm[PATHSIZ];
|
||||
|
||||
Boolean ok = writeToTmpFile (
|
||||
unique_nm,
|
||||
desc_buf.get_base(),
|
||||
desc_buf.content_sz()
|
||||
);
|
||||
|
||||
//debug(cerr, desc_buf.get_base());
|
||||
//fprintf(stderr, "get_base=%s\n", desc_buf.get_base());
|
||||
//fprintf(stderr, "sz=%d\n", desc_buf.content_sz());
|
||||
//fprintf(stderr, "tmpnm=%s\n", unique_nm);
|
||||
|
||||
if ( ok == false ) {
|
||||
//fprintf(stderr, "write to temp failed\n");
|
||||
throw(stringException("can't prepare the object dictionary."));
|
||||
}
|
||||
|
||||
desc* x = 0;
|
||||
|
||||
mtry {
|
||||
x = parse(unique_nm);
|
||||
}
|
||||
|
||||
mcatch (mmdbException &,e) {
|
||||
del_file(unique_nm);
|
||||
rethrow;
|
||||
} end_try;
|
||||
|
||||
del_file(unique_nm);
|
||||
|
||||
return x;
|
||||
}
|
||||
|
||||
desc* object_dict::parse(char* define_desc_path)
|
||||
{
|
||||
schemain = fopen(define_desc_path, "r");
|
||||
|
||||
if ( schemain == NULL )
|
||||
throw(stringException("open desc file failed"));
|
||||
|
||||
static int ct = 0;
|
||||
|
||||
if ( ct > 0 )
|
||||
schemarestart(schemain);
|
||||
else
|
||||
ct = 1;
|
||||
|
||||
mtry {
|
||||
if ( schemaparse() != 0 ) {
|
||||
fclose(schemain);
|
||||
throw(stringException("Parsing input failed"));
|
||||
}
|
||||
}
|
||||
|
||||
mcatch (mmdbException &,e) {
|
||||
fclose(schemain);
|
||||
rethrow;
|
||||
} end_try;
|
||||
|
||||
fclose(schemain);
|
||||
|
||||
return desc_ptr;
|
||||
}
|
||||
|
||||
|
||||
void object_dict::_init(desc* x)
|
||||
{
|
||||
|
||||
desc *ptr = x;
|
||||
|
||||
mtry { // init all stores
|
||||
while ( ptr ) {
|
||||
ptr -> init_store(this -> v_db_path);
|
||||
ptr = ptr -> next_desc;
|
||||
}
|
||||
}
|
||||
|
||||
mcatch (mmdbException &,e) {
|
||||
_quit_stores(x, ptr);
|
||||
_quit_descs(x, ptr);
|
||||
rethrow;
|
||||
} end_try;
|
||||
|
||||
ptr = x;
|
||||
|
||||
while ( ptr ) { // add to the dict
|
||||
if ( ptr -> get_store() )
|
||||
v_dict.insert(ptr);
|
||||
ptr = ptr -> next_desc;
|
||||
}
|
||||
|
||||
//////////////////////////////
|
||||
// init stored objects
|
||||
//////////////////////////////
|
||||
|
||||
//MESSAGE(cerr, "init stored obj:");
|
||||
ptr = x;
|
||||
|
||||
while ( ptr ) {
|
||||
ptr -> init_handler(*this);
|
||||
v_dict.insert(ptr);
|
||||
ptr = ptr -> next_desc;
|
||||
}
|
||||
|
||||
if ( v_desc_ptr == 0 ) {
|
||||
v_desc_ptr = x;
|
||||
} else {
|
||||
v_last_desc_ptr -> next_desc = x;
|
||||
}
|
||||
v_last_desc_ptr = last_desc_ptr;
|
||||
}
|
||||
|
||||
void object_dict::_quit_stores(desc* start_ptr, desc* end_ptr, Boolean sync)
|
||||
{
|
||||
desc *ptr = start_ptr;
|
||||
|
||||
if ( sync == true ) {
|
||||
while ( ptr != end_ptr ) {
|
||||
|
||||
mtry {
|
||||
ptr -> sync_store();
|
||||
}
|
||||
mcatch (mmdbException &,e)
|
||||
{
|
||||
#ifdef DEBUG
|
||||
fprintf(stderr, "mmdbException caught @ %s line:%d.\n",
|
||||
__FILE__, __LINE__);
|
||||
rethrow;
|
||||
#endif
|
||||
}
|
||||
end_try;
|
||||
|
||||
ptr = ptr -> next_desc;
|
||||
}
|
||||
}
|
||||
|
||||
ptr = start_ptr;
|
||||
|
||||
while ( ptr != end_ptr ) {
|
||||
mtry {
|
||||
ptr -> quit_store();
|
||||
}
|
||||
|
||||
mcatch (mmdbException &,e)
|
||||
{
|
||||
#ifdef DEBUG
|
||||
fprintf(stderr, "mmdbException caught @ %s line:%d.\n",
|
||||
__FILE__, __LINE__);
|
||||
rethrow;
|
||||
#endif
|
||||
}
|
||||
end_try;
|
||||
|
||||
ptr = ptr -> next_desc;
|
||||
}
|
||||
}
|
||||
|
||||
void object_dict::_quit_stored_objects(desc* start_ptr, desc* end_ptr)
|
||||
{
|
||||
desc *ptr = start_ptr;
|
||||
|
||||
while ( ptr != end_ptr ) {
|
||||
|
||||
mtry {
|
||||
ptr -> quit_handler();
|
||||
//debug(cerr, *ptr);
|
||||
}
|
||||
|
||||
mcatch (mmdbException &,e)
|
||||
{
|
||||
#ifdef DEBUG
|
||||
fprintf(stderr, "mmdbException caught @ %s line:%d.\n",
|
||||
__FILE__, __LINE__);
|
||||
rethrow;
|
||||
#endif
|
||||
}
|
||||
end_try;
|
||||
|
||||
ptr = ptr -> next_desc;
|
||||
}
|
||||
}
|
||||
|
||||
handler* object_dict::get_handler(const char* obj_name)
|
||||
{
|
||||
stored_object_desc key((char*)obj_name);
|
||||
|
||||
stored_object_desc* x = (stored_object_desc*)v_dict.member(&key);
|
||||
|
||||
if ( x ) {
|
||||
return x -> get_handler();
|
||||
} else {
|
||||
throw(stringException(form("handler %s not in dict", obj_name)));
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
abs_storage* object_dict::get_store(const char* obj_name)
|
||||
{
|
||||
store_desc key((char*)obj_name);
|
||||
|
||||
store_desc* x = (store_desc*)v_dict.member(&key);
|
||||
|
||||
if ( x ) {
|
||||
return x -> get_store();
|
||||
} else {
|
||||
throw(stringException(form("store %s not in dict", obj_name)));
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
void schemaerror( char* errorstr )
|
||||
{
|
||||
extern int linecount;
|
||||
extern char schematext[];
|
||||
|
||||
if ( strlen( schematext ) > 0 )
|
||||
throw(stringException(form("line %d %s at or before \"%s\"",
|
||||
linecount, errorstr, schematext
|
||||
)
|
||||
));
|
||||
|
||||
else
|
||||
throw(stringException(form("line %d %s illegal-symbol",
|
||||
linecount, errorstr
|
||||
)
|
||||
));
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
//void yyerror( char* errorstr )
|
||||
//{
|
||||
// extern int linecount;
|
||||
// extern char yytext[];
|
||||
//
|
||||
// if ( strlen( yytext ) > 0 )
|
||||
// MESSAGE(cerr, form("line %d %s at or before \"%s\"",
|
||||
// linecount, errorstr, yytext
|
||||
// )
|
||||
// );
|
||||
//
|
||||
// else
|
||||
// MESSAGE(cerr, form("line %d %s illegal-symbol",
|
||||
// linecount, errorstr
|
||||
// )
|
||||
// );
|
||||
//
|
||||
// return;
|
||||
//}
|
||||
//
|
||||
//int yywrap()
|
||||
//{
|
||||
// extern int linecount;
|
||||
// extern char *pname;
|
||||
//
|
||||
//#ifdef DEBUG
|
||||
// MESSAGE(cerr, form("Number of input lines %6d", linecount));
|
||||
//#endif
|
||||
//
|
||||
//cerr << "Calling yywrap()\n";
|
||||
// //return( 1 );
|
||||
// return( 0 );
|
||||
//}
|
||||
101
cde/lib/DtMmdb/schema/object_dict.h
Normal file
101
cde/lib/DtMmdb/schema/object_dict.h
Normal file
@@ -0,0 +1,101 @@
|
||||
/*
|
||||
* 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: object_dict.h /main/4 1996/06/11 17:32:47 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 _object_dict
|
||||
#define _object_dict 1
|
||||
|
||||
#include "dstr/bset.h"
|
||||
#include "utility/ostring.h"
|
||||
#include "object/handler.h"
|
||||
|
||||
#include "mgrs/template_mgr.h"
|
||||
#include "schema/store_desc.h"
|
||||
#include "schema/stored_object_desc.h"
|
||||
|
||||
#define SCHEMA_FILE "schema.mmdb"
|
||||
#define SCHEMA_FILE_SUFFIX "sch"
|
||||
|
||||
class object_dict
|
||||
{
|
||||
|
||||
public:
|
||||
object_dict();
|
||||
virtual ~object_dict();
|
||||
|
||||
handler* get_handler(const char* obj_name);
|
||||
abs_storage* get_store(const char* store_name);
|
||||
|
||||
desc* init_a_base(char* db_path, char* db_name);
|
||||
desc* init_a_base(char* define_desc_path, char* db_path, char* db_name);
|
||||
|
||||
const char* db_path() { return v_db_path; };
|
||||
|
||||
friend class server;
|
||||
|
||||
protected:
|
||||
desc* parse(char* define_desc_path);
|
||||
desc* parse(buffer& desc_buffer);
|
||||
void _init(desc*);
|
||||
|
||||
void quit_a_base(desc* start_ptr, desc* end_ptr = 0, Boolean sync = true);
|
||||
|
||||
void _quit_stores(desc* start_ptr, desc* end_ptr = 0, Boolean sync = true);
|
||||
void _quit_stored_objects(desc* start_ptr, desc* end_ptr = 0);
|
||||
void _quit_descs(desc* start_ptr, desc* end_ptr = 0);
|
||||
|
||||
protected:
|
||||
bset v_dict; // name to oid mapping
|
||||
desc * v_desc_ptr; // list of stored object desc cells
|
||||
desc * v_last_desc_ptr; // tail cell
|
||||
char v_db_path[PATHSIZ]; // db_path
|
||||
};
|
||||
|
||||
#endif
|
||||
368
cde/lib/DtMmdb/schema/sheet.yy
Normal file
368
cde/lib/DtMmdb/schema/sheet.yy
Normal file
@@ -0,0 +1,368 @@
|
||||
/*
|
||||
* $XConsortium: sheet.y /main/2 1996/07/18 14:50:27 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 <stdio.h>
|
||||
#include <ctype.h>
|
||||
#include "utility/funcs.h"
|
||||
#include "schema/store_desc.h"
|
||||
#include "schema/index_desc.h"
|
||||
#include "schema/inv_desc.h"
|
||||
#include "schema/agent_desc.h"
|
||||
#include "schema/container_desc.h"
|
||||
|
||||
extern desc* desc_ptr;
|
||||
extern desc* last_desc_ptr;
|
||||
|
||||
#define CAST_TO_STORED_OBJECT(x) ((stored_object_desc*)x)
|
||||
#define CAST_TO_PAGE_STORE(x) ((page_store_desc*)x)
|
||||
|
||||
#define CAST_TO_INDEX(x) ((index_desc*)x)
|
||||
#define CAST_TO_MPHF_INDEX(x) ((index_desc*)x)
|
||||
#define CAST_TO_SMPHF_INDEX(x) ((smphf_index_desc*)x)
|
||||
|
||||
#define CAST_TO_INV(x) ((inv_desc*)x)
|
||||
|
||||
#define CAST_TO_MPHF(x) ((mphf_desc*)x)
|
||||
#define CAST_TO_SMPHF(x) ((smphf_desc*)x)
|
||||
#define CAST_TO_BTREE(x) ((btree_desc*)x)
|
||||
|
||||
#define CAST_TO_CONTAINER(x) ((container_desc*)x)
|
||||
|
||||
extern void yyerror(char*);
|
||||
extern int yylex();
|
||||
|
||||
#undef yywrap
|
||||
|
||||
%}
|
||||
|
||||
%union
|
||||
{
|
||||
char *string;
|
||||
int integer;
|
||||
desc* trans;
|
||||
page_store_desc* ps_trans;
|
||||
}
|
||||
|
||||
%token <string>
|
||||
TOKEN
|
||||
%token <integer>
|
||||
CONTAINER
|
||||
SET
|
||||
LIST
|
||||
INDEX_NAME
|
||||
INV
|
||||
COMPRESS
|
||||
INV_NAME
|
||||
AGENT_NAME
|
||||
STORE_NAME
|
||||
POSITION
|
||||
INDEX
|
||||
MPHF_INDEX
|
||||
SMPHF_INDEX
|
||||
BTREE_INDEX
|
||||
INDEX_AGENT
|
||||
MPHF
|
||||
SMPHF
|
||||
BTREE
|
||||
HUFFMAN
|
||||
DICT
|
||||
EQUAL
|
||||
NUMBER
|
||||
STORE
|
||||
PAGE_STORE
|
||||
NM
|
||||
V_OID
|
||||
MODE
|
||||
PAGE_SZ
|
||||
CACHED_PAGES
|
||||
ENDIANNESS
|
||||
SEPARATOR
|
||||
%type <integer>
|
||||
|
||||
%type <trans>
|
||||
Sheet
|
||||
DescriptionList
|
||||
Description
|
||||
|
||||
Store_description
|
||||
Index_description
|
||||
Index_Agent_description
|
||||
Inv_description
|
||||
Compress_description
|
||||
Container_description
|
||||
|
||||
%type <ps_trans>
|
||||
Page_store_descriptions
|
||||
MPHF_index_descriptions
|
||||
Hash_descriptions
|
||||
Inv_descriptions
|
||||
Compress_descriptions
|
||||
Container_descriptions
|
||||
|
||||
%start Sheet
|
||||
|
||||
%%
|
||||
|
||||
Sheet : DescriptionList {
|
||||
//$1 -> asciiOutList(cerr);
|
||||
desc_ptr = $1;
|
||||
}
|
||||
|
||||
DescriptionList : Description DescriptionList {
|
||||
$1 -> set_next_desc($2);
|
||||
$$ = $1;
|
||||
}
|
||||
| Description
|
||||
{
|
||||
$1 -> set_next_desc(0);
|
||||
last_desc_ptr = $1;
|
||||
$$ = $1;
|
||||
}
|
||||
|
||||
Description : STORE Store_description
|
||||
{
|
||||
$$ = $2;
|
||||
}
|
||||
| INDEX Index_description
|
||||
{
|
||||
$$ = $2;
|
||||
}
|
||||
| INV Inv_description
|
||||
{
|
||||
$$ = $2;
|
||||
}
|
||||
| COMPRESS Compress_description
|
||||
{
|
||||
$$ = $2;
|
||||
}
|
||||
| INDEX_AGENT Index_Agent_description
|
||||
{
|
||||
$$ = $2;
|
||||
}
|
||||
| CONTAINER Container_description
|
||||
{
|
||||
$$ = $2;
|
||||
}
|
||||
|
||||
Store_description : Page_Store_Head SEPARATOR Page_store_descriptions
|
||||
{
|
||||
$$ = desc_ptr;
|
||||
}
|
||||
|
||||
Index_description : Index_Head SEPARATOR MPHF_index_descriptions
|
||||
{
|
||||
$$ = desc_ptr;
|
||||
}
|
||||
|
||||
Inv_description : Inv_Head SEPARATOR Inv_descriptions
|
||||
{
|
||||
$$ = desc_ptr;
|
||||
}
|
||||
|
||||
Compress_description : Compress_Head SEPARATOR Compress_descriptions
|
||||
{
|
||||
$$ = desc_ptr;
|
||||
}
|
||||
|
||||
Index_Agent_description : Index_Agent_Head SEPARATOR Hash_descriptions
|
||||
{
|
||||
$$ = desc_ptr;
|
||||
}
|
||||
|
||||
Container_description : Container_Head SEPARATOR Container_descriptions
|
||||
{
|
||||
$$ = desc_ptr;
|
||||
}
|
||||
|
||||
Page_Store_Head : PAGE_STORE
|
||||
{
|
||||
desc_ptr = new page_store_desc;
|
||||
}
|
||||
|
||||
Index_Head: MPHF_INDEX
|
||||
{
|
||||
desc_ptr= new mphf_index_desc;
|
||||
}
|
||||
| SMPHF_INDEX
|
||||
{
|
||||
desc_ptr= new smphf_index_desc;
|
||||
}
|
||||
| BTREE_INDEX
|
||||
{
|
||||
desc_ptr= new btree_index_desc;
|
||||
}
|
||||
|
||||
Inv_Head: INV
|
||||
{
|
||||
desc_ptr= new inv_desc;
|
||||
}
|
||||
|
||||
Compress_Head: HUFFMAN
|
||||
{
|
||||
desc_ptr= new huffman_desc;
|
||||
}
|
||||
|
||||
Compress_Head: DICT
|
||||
{
|
||||
desc_ptr= new dict_desc;
|
||||
}
|
||||
|
||||
Index_Agent_Head: MPHF
|
||||
{
|
||||
desc_ptr= new mphf_desc;
|
||||
}
|
||||
| BTREE
|
||||
{
|
||||
desc_ptr= new btree_desc;
|
||||
}
|
||||
| SMPHF
|
||||
{
|
||||
desc_ptr= new smphf_desc;
|
||||
}
|
||||
|
||||
Container_Head: SET
|
||||
{
|
||||
desc_ptr= new set_desc;
|
||||
}
|
||||
| LIST
|
||||
{
|
||||
desc_ptr= new list_desc;
|
||||
}
|
||||
|
||||
Page_store_descriptions : Page_Store_Term SEPARATOR Page_store_descriptions
|
||||
{
|
||||
}
|
||||
| Page_Store_Term
|
||||
{
|
||||
}
|
||||
|
||||
MPHF_index_descriptions: MPHF_Index_Term SEPARATOR MPHF_index_descriptions
|
||||
{
|
||||
}
|
||||
| MPHF_Index_Term
|
||||
{
|
||||
}
|
||||
|
||||
Inv_descriptions: Stored_Object_Term SEPARATOR Inv_descriptions
|
||||
{
|
||||
}
|
||||
| Stored_Object_Term
|
||||
{
|
||||
}
|
||||
|
||||
Compress_descriptions: Stored_Object_Term SEPARATOR Compress_descriptions
|
||||
{
|
||||
}
|
||||
| Stored_Object_Term
|
||||
{
|
||||
}
|
||||
|
||||
Hash_descriptions: Stored_Object_Term SEPARATOR Hash_descriptions
|
||||
{
|
||||
}
|
||||
| Stored_Object_Term
|
||||
{
|
||||
}
|
||||
|
||||
Container_descriptions: Container_Term SEPARATOR Container_descriptions
|
||||
{
|
||||
}
|
||||
| Container_Term
|
||||
{
|
||||
}
|
||||
|
||||
Page_Store_Term : Store_Term
|
||||
{
|
||||
}
|
||||
| CACHED_PAGES EQUAL NUMBER
|
||||
{
|
||||
CAST_TO_PAGE_STORE(desc_ptr) -> set_cached_pages($3);
|
||||
}
|
||||
| ENDIANNESS EQUAL TOKEN
|
||||
{
|
||||
CAST_TO_PAGE_STORE(desc_ptr) -> set_order($3);
|
||||
}
|
||||
| PAGE_SZ EQUAL NUMBER
|
||||
{
|
||||
CAST_TO_PAGE_STORE(desc_ptr) -> set_page_sz($3);
|
||||
}
|
||||
|
||||
Store_Term : Term
|
||||
{
|
||||
}
|
||||
| MODE EQUAL TOKEN
|
||||
{
|
||||
CAST_TO_PAGE_STORE(desc_ptr) -> set_mode($3);
|
||||
}
|
||||
|
||||
Term: NM EQUAL TOKEN
|
||||
{
|
||||
desc_ptr -> set_nm($3);
|
||||
}
|
||||
| V_OID EQUAL TOKEN
|
||||
{
|
||||
desc_ptr -> set_oid($3);
|
||||
}
|
||||
|
||||
MPHF_Index_Term : POSITION EQUAL NUMBER
|
||||
{
|
||||
CAST_TO_MPHF_INDEX(desc_ptr) -> set_position($3);
|
||||
}
|
||||
| Index_Term
|
||||
{
|
||||
}
|
||||
|
||||
Index_Term : INV_NAME EQUAL TOKEN
|
||||
{
|
||||
CAST_TO_INDEX(desc_ptr) -> set_inv_nm($3);
|
||||
}
|
||||
| AGENT_NAME EQUAL TOKEN
|
||||
{
|
||||
CAST_TO_INDEX(desc_ptr) -> set_agent_nm($3);
|
||||
}
|
||||
| Stored_Object_Term
|
||||
{
|
||||
}
|
||||
|
||||
Stored_Object_Term : STORE_NAME EQUAL TOKEN
|
||||
{
|
||||
CAST_TO_STORED_OBJECT(desc_ptr) -> set_store_nm($3);
|
||||
}
|
||||
| Term
|
||||
{
|
||||
}
|
||||
|
||||
Container_Term: INDEX_NAME EQUAL TOKEN
|
||||
{
|
||||
CAST_TO_CONTAINER(desc_ptr) -> set_index_nm($3);
|
||||
}
|
||||
| Stored_Object_Term
|
||||
{
|
||||
}
|
||||
%%
|
||||
253
cde/lib/DtMmdb/schema/store_desc.C
Normal file
253
cde/lib/DtMmdb/schema/store_desc.C
Normal file
@@ -0,0 +1,253 @@
|
||||
/*
|
||||
* 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: store_desc.cc /main/5 1996/07/18 14:50:53 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 "utility/config.h"
|
||||
#include "schema/store_desc.h"
|
||||
#include "api/transaction.h"
|
||||
|
||||
extern transaction* g_transac;
|
||||
|
||||
#ifdef C_API
|
||||
lru* store_desc::v_unixf_pool_ptr;
|
||||
#else
|
||||
lru store_desc::v_unixf_pool(ACTIVE_UNIXF_SZ, INACTIVE_UNIXF_SZ, false);
|
||||
#endif
|
||||
|
||||
store_desc::store_desc(const char* name) : desc(name)
|
||||
{
|
||||
mode_str = strdup("");
|
||||
order_str = 0;
|
||||
|
||||
#ifdef MMDB_BIG_ENDIAN
|
||||
order_str = strdup("big_endian");
|
||||
#endif
|
||||
|
||||
#ifdef MMDB_LITTLE_ENDIAN
|
||||
order_str = strdup("little_endian");
|
||||
#endif
|
||||
|
||||
if ( order_str == 0 )
|
||||
throw(stringException("machine type not supported"));
|
||||
|
||||
v_store_ptr = NULL;
|
||||
}
|
||||
|
||||
store_desc::store_desc(int tp, const char* comment):
|
||||
desc(tp, comment)
|
||||
{
|
||||
mode_str = strdup("");
|
||||
|
||||
order_str = 0;
|
||||
|
||||
#ifdef MMDB_BIG_ENDIAN
|
||||
order_str = strdup("big_endian");
|
||||
#endif
|
||||
|
||||
#ifdef MMDB_LITTLE_ENDIAN
|
||||
order_str = strdup("little_endian");
|
||||
#endif
|
||||
|
||||
if ( order_str == 0 )
|
||||
throw(stringException("machine type not supported"));
|
||||
|
||||
v_store_ptr = NULL;
|
||||
}
|
||||
|
||||
store_desc::~store_desc()
|
||||
{
|
||||
delete mode_str;
|
||||
delete order_str;
|
||||
|
||||
/*
|
||||
store_desc_obj_ct-- ;
|
||||
|
||||
if ( store_desc_obj_ct == 0 )
|
||||
delete v_unixf_pool;
|
||||
*/
|
||||
}
|
||||
|
||||
void store_desc::set_mode(const char* str)
|
||||
{
|
||||
delete mode_str;
|
||||
mode_str = strdup(str);
|
||||
|
||||
get_mode(); // check
|
||||
}
|
||||
|
||||
int store_desc::get_mode()
|
||||
{
|
||||
int mode = 0;
|
||||
for ( unsigned int i=0; i<strlen(mode_str); i++ ) {
|
||||
switch ( mode_str[i] ) {
|
||||
case 'r':
|
||||
mode |= ios::in;
|
||||
break;
|
||||
|
||||
case 'w':
|
||||
mode |= ios::out;
|
||||
break;
|
||||
|
||||
default:
|
||||
throw(stringException("unknown mode char"));
|
||||
}
|
||||
}
|
||||
return mode;
|
||||
}
|
||||
|
||||
void store_desc::set_order(const char* str)
|
||||
{
|
||||
delete order_str;
|
||||
order_str = strdup(str);
|
||||
|
||||
get_order(); // check
|
||||
}
|
||||
|
||||
mmdb_byte_order_t store_desc::get_order()
|
||||
{
|
||||
if ( strcmp(order_str, "big_endian") == 0 )
|
||||
return mmdb_big_endian;
|
||||
else
|
||||
if ( strcmp(order_str, "little_endian") == 0 )
|
||||
return mmdb_little_endian;
|
||||
else
|
||||
throw(stringException("machin type not supported"));
|
||||
|
||||
|
||||
return mmdb_big_endian;
|
||||
}
|
||||
|
||||
ostream& store_desc::asciiOut(ostream& out, Boolean last)
|
||||
{
|
||||
desc::asciiOut(out, false);
|
||||
char* mode = mode_str; desc_print(out, mode);
|
||||
|
||||
char* endianness = order_str;
|
||||
if ( last == true )
|
||||
desc_print_end(out, endianness);
|
||||
else
|
||||
desc_print(out, endianness);
|
||||
|
||||
if ( ! out )
|
||||
throw(stringException("store_desc::asciiOut() failed"));
|
||||
|
||||
return out;
|
||||
}
|
||||
|
||||
page_store_desc::page_store_desc() :
|
||||
store_desc(PAGE_STORAGE_CODE, "store page_store"),
|
||||
page_sz(0), cached_pages(0)
|
||||
{
|
||||
}
|
||||
|
||||
void page_store_desc::set_page_sz(int x)
|
||||
{
|
||||
page_sz = x;
|
||||
}
|
||||
|
||||
void page_store_desc::set_cached_pages(int x)
|
||||
{
|
||||
cached_pages = x;
|
||||
}
|
||||
|
||||
ostream& page_store_desc::asciiOut(ostream& out, Boolean last)
|
||||
{
|
||||
store_desc::asciiOut(out, false);
|
||||
desc_print(out, cached_pages);
|
||||
|
||||
if ( last == true )
|
||||
desc_print_end(out, page_sz);
|
||||
else
|
||||
desc_print(out, page_sz);
|
||||
|
||||
if ( ! out )
|
||||
throw(stringException("page_store_desc::asciiOut() failed"));
|
||||
|
||||
return out;
|
||||
}
|
||||
|
||||
abs_storage* page_store_desc::init_store(char* db_path)
|
||||
{
|
||||
unixf_storage* unixf =
|
||||
new unixf_storage(
|
||||
(char*)db_path,
|
||||
(char*)get_nm(),
|
||||
#ifdef C_API
|
||||
v_unixf_pool_ptr,
|
||||
#else
|
||||
&v_unixf_pool,
|
||||
#endif
|
||||
get_mode()
|
||||
);
|
||||
|
||||
//cached_pages = MIN(cached_pages, 10);
|
||||
|
||||
v_store_ptr =
|
||||
new page_storage((char*)db_path, (char*)get_nm(),
|
||||
unixf, page_sz, cached_pages, get_order());
|
||||
|
||||
|
||||
if ( g_transac )
|
||||
g_transac -> book(v_store_ptr);
|
||||
|
||||
return v_store_ptr;
|
||||
}
|
||||
|
||||
void page_store_desc::sync_store()
|
||||
{
|
||||
if ( v_store_ptr )
|
||||
((page_storage*)v_store_ptr) -> sync();
|
||||
}
|
||||
|
||||
void page_store_desc::quit_store()
|
||||
{
|
||||
delete v_store_ptr;
|
||||
}
|
||||
|
||||
133
cde/lib/DtMmdb/schema/store_desc.h
Normal file
133
cde/lib/DtMmdb/schema/store_desc.h
Normal file
@@ -0,0 +1,133 @@
|
||||
/*
|
||||
* 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: store_desc.h /main/6 1996/07/18 14:51:13 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
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
#ifndef _store_desc_h
|
||||
#define _store_desc_h 1
|
||||
|
||||
#include "object/handler.h"
|
||||
#include "schema/desc.h"
|
||||
|
||||
#include "storage/lru.h"
|
||||
#include "storage/page_storage.h"
|
||||
#include "storage/unixf_storage.h"
|
||||
|
||||
#define NUM_FILES 20
|
||||
#define ACTIVE_UNIXF_SZ NUM_FILES
|
||||
#define INACTIVE_UNIXF_SZ 1000
|
||||
|
||||
|
||||
class store_desc : public desc
|
||||
{
|
||||
|
||||
public:
|
||||
store_desc(const char* name);
|
||||
store_desc(int class_code, const char* comment = "");
|
||||
~store_desc();
|
||||
|
||||
virtual abs_storage* get_store() {
|
||||
return v_store_ptr;
|
||||
};
|
||||
|
||||
void set_mode(const char*);
|
||||
void set_order(const char*);
|
||||
|
||||
int get_mode();
|
||||
mmdb_byte_order_t get_order();
|
||||
|
||||
virtual ostream& asciiOut(ostream& out, Boolean last = true);
|
||||
|
||||
protected:
|
||||
/*
|
||||
char mode_str[NAMESIZ];
|
||||
char order_str[NAMESIZ];
|
||||
*/
|
||||
|
||||
#ifdef C_API
|
||||
static lru* v_unixf_pool_ptr;
|
||||
#define v_unixf_pool (*v_unixf_pool_ptr)
|
||||
#else
|
||||
static lru v_unixf_pool;
|
||||
#endif
|
||||
|
||||
abs_storage* v_store_ptr;
|
||||
|
||||
private:
|
||||
char* mode_str;
|
||||
char* order_str;
|
||||
|
||||
#ifdef C_API
|
||||
friend void initialize_MMDB();
|
||||
friend void quit_MMDB();
|
||||
#endif
|
||||
};
|
||||
|
||||
class page_store_desc : public store_desc
|
||||
{
|
||||
|
||||
public:
|
||||
page_store_desc();
|
||||
~page_store_desc() {};
|
||||
|
||||
abs_storage* init_store(char* store_path);
|
||||
|
||||
void sync_store();
|
||||
void quit_store();
|
||||
|
||||
void set_page_sz(int);
|
||||
void set_cached_pages(int);
|
||||
|
||||
virtual ostream& asciiOut(ostream& out, Boolean last = true);
|
||||
|
||||
protected:
|
||||
int page_sz;
|
||||
int cached_pages;
|
||||
};
|
||||
|
||||
#endif
|
||||
95
cde/lib/DtMmdb/schema/stored_object_desc.C
Normal file
95
cde/lib/DtMmdb/schema/stored_object_desc.C
Normal file
@@ -0,0 +1,95 @@
|
||||
/*
|
||||
* 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: stored_object_desc.cc /main/4 1996/07/18 14:51:31 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 "schema/stored_object_desc.h"
|
||||
|
||||
stored_object_desc::stored_object_desc(const char* name) :
|
||||
desc(name), v_handler_ptr(0)
|
||||
{
|
||||
store_nm = strdup("");
|
||||
}
|
||||
|
||||
stored_object_desc::stored_object_desc(int class_code, const char* _type)
|
||||
: desc(class_code, _type), v_handler_ptr(0)
|
||||
{
|
||||
store_nm = strdup("");
|
||||
}
|
||||
|
||||
stored_object_desc::~stored_object_desc()
|
||||
{
|
||||
free(store_nm);
|
||||
}
|
||||
|
||||
void stored_object_desc::set_store_nm(const char* str)
|
||||
{
|
||||
free(store_nm);
|
||||
store_nm = strdup(str);
|
||||
}
|
||||
|
||||
ostream& stored_object_desc::asciiOut(ostream& out, Boolean last)
|
||||
{
|
||||
desc::asciiOut(out, false);
|
||||
|
||||
if ( last == true )
|
||||
desc_print_end(out, store_nm);
|
||||
else
|
||||
desc_print(out, store_nm);
|
||||
|
||||
if ( ! out )
|
||||
throw(stringException("stored_object_desc::asciiOut() failed"));
|
||||
|
||||
return out;
|
||||
}
|
||||
|
||||
void stored_object_desc::quit_handler()
|
||||
{
|
||||
delete v_handler_ptr;
|
||||
}
|
||||
|
||||
84
cde/lib/DtMmdb/schema/stored_object_desc.h
Normal file
84
cde/lib/DtMmdb/schema/stored_object_desc.h
Normal file
@@ -0,0 +1,84 @@
|
||||
/*
|
||||
* 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: stored_object_desc.h /main/4 1996/06/11 17:33:06 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 _stored_object_desc_h
|
||||
#define _stored_object_desc_h 1
|
||||
|
||||
#include "schema/desc.h"
|
||||
#include "object/handler.h"
|
||||
|
||||
class object_dict;
|
||||
|
||||
class stored_object_desc : public desc {
|
||||
|
||||
public:
|
||||
stored_object_desc(const char* name);
|
||||
stored_object_desc(int class_code, const char* type);
|
||||
|
||||
virtual ~stored_object_desc();
|
||||
|
||||
handler* get_handler() { return v_handler_ptr; };
|
||||
|
||||
void quit_handler();
|
||||
|
||||
void set_store_nm(const char* str) ;
|
||||
char* get_store_nm() { return store_nm; };
|
||||
|
||||
virtual ostream& asciiOut(ostream& out, Boolean last = true);
|
||||
|
||||
protected:
|
||||
handler* v_handler_ptr;
|
||||
|
||||
private:
|
||||
char* store_nm;
|
||||
};
|
||||
|
||||
|
||||
#endif
|
||||
192
cde/lib/DtMmdb/schema/token.ll
Normal file
192
cde/lib/DtMmdb/schema/token.ll
Normal file
@@ -0,0 +1,192 @@
|
||||
/*
|
||||
* $XConsortium: token.l /main/2 1996/07/18 14:51:52 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
|
||||
*
|
||||
*/
|
||||
|
||||
%option noyywrap
|
||||
|
||||
%a 30000
|
||||
%e 10000
|
||||
%k 10000
|
||||
%n 10000
|
||||
%o 40000
|
||||
%p 20000
|
||||
|
||||
%{
|
||||
#include "store_desc.h"
|
||||
#include "sheet.tab.h"
|
||||
extern char replace_string[PATHSIZ];
|
||||
extern int replace_string_len;
|
||||
|
||||
int linecount = 1;
|
||||
%}
|
||||
|
||||
%%
|
||||
|
||||
"container" {
|
||||
return(CONTAINER);
|
||||
}
|
||||
|
||||
"set" {
|
||||
return(SET);
|
||||
}
|
||||
|
||||
"list" {
|
||||
return(LIST);
|
||||
}
|
||||
|
||||
"index_nm" {
|
||||
return(INDEX_NAME);
|
||||
}
|
||||
|
||||
"inv" {
|
||||
return(INV);
|
||||
}
|
||||
|
||||
"compress" {
|
||||
return(COMPRESS);
|
||||
}
|
||||
|
||||
"huffman" {
|
||||
return(HUFFMAN);
|
||||
}
|
||||
|
||||
"dict" {
|
||||
return(DICT);
|
||||
}
|
||||
|
||||
"index_agent" {
|
||||
return(INDEX_AGENT);
|
||||
}
|
||||
|
||||
"mphf" {
|
||||
return(MPHF);
|
||||
}
|
||||
|
||||
"btree" {
|
||||
return(BTREE);
|
||||
}
|
||||
|
||||
"smphf" {
|
||||
return(SMPHF);
|
||||
}
|
||||
|
||||
"index" {
|
||||
return(INDEX);
|
||||
}
|
||||
|
||||
"mphf_index" {
|
||||
return(MPHF_INDEX);
|
||||
}
|
||||
|
||||
"smphf_index" {
|
||||
return(SMPHF_INDEX);
|
||||
}
|
||||
|
||||
"btree_index" {
|
||||
return(BTREE_INDEX);
|
||||
}
|
||||
|
||||
"inv_nm" {
|
||||
return(INV_NAME);
|
||||
}
|
||||
|
||||
"agent_nm" {
|
||||
return(AGENT_NAME);
|
||||
}
|
||||
|
||||
"store_nm" {
|
||||
return(STORE_NAME);
|
||||
}
|
||||
|
||||
"position" {
|
||||
return(POSITION);
|
||||
}
|
||||
|
||||
"store" {
|
||||
return(STORE);
|
||||
}
|
||||
|
||||
"page_store" {
|
||||
return(PAGE_STORE);
|
||||
}
|
||||
|
||||
"nm" {
|
||||
return(NM);
|
||||
}
|
||||
|
||||
"v_oid" {
|
||||
return(V_OID);
|
||||
}
|
||||
|
||||
"mode" {
|
||||
return(MODE);
|
||||
}
|
||||
|
||||
"page_sz" {
|
||||
return(PAGE_SZ);
|
||||
}
|
||||
|
||||
"endianness" {
|
||||
return(ENDIANNESS);
|
||||
}
|
||||
|
||||
"cached_pages" {
|
||||
return(CACHED_PAGES);
|
||||
}
|
||||
|
||||
"=" {
|
||||
return(EQUAL);
|
||||
}
|
||||
|
||||
":"[\\]?[\n]? {
|
||||
return(SEPARATOR);
|
||||
}
|
||||
|
||||
[\n]+ {
|
||||
linecount++;
|
||||
}
|
||||
|
||||
[\t ]+ {
|
||||
}
|
||||
|
||||
^"#".* {
|
||||
}
|
||||
|
||||
[0-9]+ {
|
||||
schemalval.integer = atoi((char*)yytext);
|
||||
return (NUMBER);
|
||||
}
|
||||
|
||||
[a-zA-Z0-9_\-.$]+ {
|
||||
if ( replace_string[0] != 0 && yytext[0] == '$' ) {
|
||||
strcpy(replace_string + replace_string_len, (char*)yytext+1);
|
||||
schemalval.string = replace_string;
|
||||
} else
|
||||
schemalval.string = (char*)yytext;
|
||||
return (TOKEN);
|
||||
}
|
||||
|
||||
%%
|
||||
Reference in New Issue
Block a user