Initial import of the CDE 2.1.30 sources from the Open Group.

This commit is contained in:
Peter Howkins
2012-03-10 18:21:40 +00:00
commit 83b6996daa
18978 changed files with 3945623 additions and 0 deletions

View File

@@ -0,0 +1,58 @@
XCOMM $XConsortium: Imakefile /main/15 1996/08/21 15:53:37 drk $
XCOMM ** WARNING **
XCOMM
XCOMM The files named here may appear in many different Imakefiles.
XCOMM If you add or remove a file, be sure to update all locations.
XCOMM It's unfortunate, but all this redundancy serves a purpose.
XCOMM
XCOMM Other possible locations are:
XCOMM .../lib/DtMmdb/Imakefile
XCOMM .../lib/DtMmdb/<subdir>/Imakefile
XCOMM .../programs/dtinfo/mmdb/Imakefile
XCOMM .../programs/dtinfo/mmdb/<subdir>/Imakefile
#define DoNormalLib NormalLibDtMmdb
#define DoSharedLib SharedLibDtMmdb
#define DoDebugLib DebugLibDtMmdb
#define DoProfileLib ProfileLibDtMmdb
#define LibName DtMmdb
#define SoRev SODTMMDBREV
#define LibHeaders NO
#define LibCreate NO
#define LargePICTable YES
#define CplusplusSource YES
DEPEND_DEFINES = $(CXXDEPENDINCLUDES)
XCOMM In DtMmdb we compile as C_API sources.
DEFINES = -DC_API -DPORTABLE_DB
INCLUDES = -I.. $(EXCEPTIONS_INCLUDES) -I../misc
NORMAL_SRCS = desc.C store_desc.C object_dict.C \
stored_object_desc.C index_desc.C inv_desc.C \
agent_desc.C container_desc.C
PARSER_SRCS = sheet.C token.C
#if defined(RegenParserFiles)
XCOMM Hide the flex and byacc sources so the normal case is simple.
YACCSTACK = -DYYSTACKSIZE=20000
YFLAGS = -l -d
LFLAGS = -8 -s
LinkFile(token.l,token.lex)
LexTarget(token,schema)
LinkFile(sheet.y,sheet.yacc)
YaccTarget(sheet,schema)
#endif
SRCS = $(NORMAL_SRCS) $(PARSER_SRCS)
OBJS = $(NORMAL_SRCS:.C=.o) $(PARSER_SRCS:.C=.o)
#include <Library.tmpl>
SubdirLibraryRule($(OBJS))
DependTarget()

View File

@@ -0,0 +1,120 @@
/*
* $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;
}

View File

@@ -0,0 +1,89 @@
/*
* $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

View File

@@ -0,0 +1,263 @@
/*
* $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) :
index_nms(10), stored_object_desc(code, comment)
{
}
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;
}

View File

@@ -0,0 +1,51 @@
/* $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

View File

@@ -0,0 +1,128 @@
/*
* $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)
{
istrstream 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;
}

View File

@@ -0,0 +1,100 @@
/*
* $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) && !defined(__osf__)
#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

View File

@@ -0,0 +1,47 @@
// $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)
{
}

View File

@@ -0,0 +1,41 @@
/* $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

View File

@@ -0,0 +1,188 @@
/*
* $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) : position(0),
stored_object_desc(class_code, comment)
{
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);
//strncpy(inv_nm, str, NAMESIZ-1);
//inv_nm[strlen(str)] = 0;
}
void index_desc::set_agent_nm(const char* str)
{
delete agent_nm;
agent_nm = strdup(str);
//strncpy(agent_nm, str, NAMESIZ-1);
//agent_nm[strlen(str)] = 0;
}
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;
}

View File

@@ -0,0 +1,93 @@
/*
* $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

View File

@@ -0,0 +1,49 @@
/*
* $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;
}

View File

@@ -0,0 +1,21 @@
/* $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

View File

@@ -0,0 +1,34 @@
// $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 );
}

View File

@@ -0,0 +1,521 @@
/*
* $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 int schemarestart(FILE*);
extern FILE *schemain;
object_dict::object_dict() :
v_dict(desc_name_eq, desc_name_ls), v_desc_ptr(0)
{
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);
strcpy(v_db_path, db_path);
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 {
int sz = bytes(in) - 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);
strcpy(v_db_path, db_path);
if ( db_name ) {
strcpy(replace_string, db_name);
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 len = bytes(in_test)*4;
in_test.close();
if ( disk_space(v_db_path) < len ) {
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()));
}
int sz = bytes(in);
in.close();
char* schema_buf = new char[sz*3];
ostrstream* string_out = new ostrstream(schema_buf, sz*3);
if ( !(*string_out) ) {
throw(streamException(string_out -> rdstate()));
}
x -> asciiOutList(*string_out);
string_out -> put('\0'); // make NULL terminated string
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, 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;
try {
x = parse(unique_nm);
}
catch (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;
try {
if ( schemaparse() != 0 ) {
fclose(schemain);
throw(stringException("Parsing input failed"));
}
}
catch (mmdbException &,e) {
fclose(schemain);
rethrow;
} end_try;
fclose(schemain);
return desc_ptr;
}
void object_dict::_init(desc* x)
{
desc *ptr = x;
try { // init all stores
while ( ptr ) {
ptr -> init_store(this -> v_db_path);
ptr = ptr -> next_desc;
}
}
catch (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 ) {
try {
ptr -> sync_store();
}
catch (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 ) {
try {
ptr -> quit_store();
}
catch (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 ) {
try {
ptr -> quit_handler();
//debug(cerr, *ptr);
}
catch (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;
}
extern "C" {
int schemawrap()
{
return( 1 );
}
}
//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 );
//}

View File

@@ -0,0 +1,79 @@
/*
* $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:
desc * v_desc_ptr; // list of stored object desc cells
desc * v_last_desc_ptr; // tail cell
char v_db_path[PATHSIZ]; // db_path
bset v_dict; // name to oid mapping
};
#endif

View File

@@ -0,0 +1,785 @@
// $TOG: sheet.C /main/4 1997/12/23 11:20:35 bill $
#ifndef lint
static char schemasccsid[] = "@(#)yaccpar 1.8 (Berkeley) 01/20/90";
#endif
#define schemaBYACC 1
#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)
#define alloca(x) (malloc(x))
extern void schemaerror(char*);
extern int schemalex();
#undef schemawrap
typedef union
{
char *string;
int integer;
desc* trans;
page_store_desc* ps_trans;
} schemaSTYPE;
#define TOKEN 257
#define CONTAINER 258
#define SET 259
#define LIST 260
#define INDEX_NAME 261
#define INV 262
#define COMPRESS 263
#define INV_NAME 264
#define AGENT_NAME 265
#define STORE_NAME 266
#define POSITION 267
#define INDEX 268
#define MPHF_INDEX 269
#define SMPHF_INDEX 270
#define BTREE_INDEX 271
#define INDEX_AGENT 272
#define MPHF 273
#define SMPHF 274
#define BTREE 275
#define HUFFMAN 276
#define DICT 277
#define EQUAL 278
#define NUMBER 279
#define STORE 280
#define PAGE_STORE 281
#define NM 282
#define V_OID 283
#define MODE 284
#define PAGE_SZ 285
#define CACHED_PAGES 286
#define BYTE_ORDER 287
#define SEPARATOR 288
#define schemaERRCODE 256
short schemalhs[] = { -1,
0, 1, 1, 2, 2, 2, 2, 2, 2, 3,
4, 6, 7, 5, 8, 15, 16, 16, 16, 17,
18, 18, 19, 19, 19, 20, 20, 9, 9, 10,
10, 12, 12, 13, 13, 11, 11, 14, 14, 21,
21, 21, 21, 25, 25, 26, 26, 22, 22, 27,
27, 27, 23, 23, 24, 24,
};
short schemalen[] = { 2,
1, 2, 1, 2, 2, 2, 2, 2, 2, 3,
3, 3, 3, 3, 3, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 3, 1, 3,
1, 3, 1, 3, 1, 3, 1, 3, 1, 1,
3, 3, 3, 1, 3, 3, 3, 3, 1, 3,
3, 1, 3, 1, 3, 1,
};
short schemadefred[] = { 0,
0, 0, 0, 0, 0, 0, 0, 1, 0, 26,
27, 9, 0, 20, 6, 0, 21, 22, 7, 0,
17, 18, 19, 5, 0, 23, 25, 24, 8, 0,
16, 4, 0, 2, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 15, 56, 0, 54, 12, 0,
13, 0, 0, 0, 0, 11, 0, 52, 49, 14,
0, 0, 0, 0, 0, 10, 0, 40, 44, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 55, 53, 46, 47,
38, 32, 34, 50, 51, 48, 30, 36, 45, 43,
41, 42, 28,
};
short schemadgoto[] = { 7,
8, 9, 32, 24, 29, 15, 19, 12, 66, 56,
60, 49, 51, 45, 33, 25, 16, 20, 30, 13,
67, 57, 46, 47, 68, 48, 59,
};
short schemasindex[] = { -250,
-206, -260, -221, -219, -254, -272, 0, 0, -250, 0,
0, 0, -277, 0, 0, -243, 0, 0, 0, -231,
0, 0, 0, 0, -230, 0, 0, 0, 0, -229,
0, 0, -228, 0, -251, -249, -249, -241, -249, -247,
-217, -216, -215, -214, 0, 0, -223, 0, 0, -222,
0, -220, -211, -209, -208, 0, -213, 0, 0, 0,
-212, -207, -205, -204, -201, 0, -210, 0, 0, -185,
-178, -177, -176, -251, -249, -249, -175, -174, -232, -241,
-249, -173, -194, -193, -170, -247, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0,
};
short schemarindex[] = { 0,
0, 0, 0, 0, 0, 0, 0, 0, 28, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 1, 0, 0, 3,
0, 14, 0, 0, 0, 0, 16, 0, 0, 0,
27, 0, 0, 0, 0, 0, 29, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0,
};
short schemagindex[] = { 0,
79, 0, 0, 0, 0, 0, 0, 0, 4, 9,
10, 17, 18, 19, 0, 0, 0, 0, 0, 0,
0, 0, -32, 0, 0, -40, 0,
};
#define schemaTABLESIZE 309
short schematable[] = { 69,
39, 14, 33, 50, 52, 58, 61, 1, 31, 41,
35, 2, 3, 35, 42, 31, 42, 4, 26, 27,
28, 5, 53, 54, 42, 55, 37, 3, 29, 6,
43, 44, 43, 44, 43, 44, 62, 63, 64, 65,
43, 44, 50, 52, 36, 69, 96, 58, 61, 21,
22, 23, 10, 11, 17, 18, 37, 38, 39, 40,
70, 71, 72, 73, 74, 75, 77, 76, 78, 79,
82, 87, 83, 84, 80, 81, 85, 86, 88, 89,
90, 94, 95, 99, 100, 101, 102, 34, 97, 103,
98, 92, 91, 93, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 39, 0,
33, 0, 39, 39, 33, 33, 0, 0, 39, 0,
33, 35, 39, 31, 33, 35, 35, 31, 31, 0,
39, 35, 33, 31, 37, 35, 29, 31, 37, 37,
29, 29, 0, 35, 37, 31, 29, 0, 37, 0,
29, 0, 0, 0, 0, 0, 37, 0, 29,
};
short schemacheck[] = { 40,
0, 262, 0, 36, 37, 38, 39, 258, 281, 261,
288, 262, 263, 0, 266, 0, 266, 268, 273, 274,
275, 272, 264, 265, 266, 267, 0, 0, 0, 280,
282, 283, 282, 283, 282, 283, 284, 285, 286, 287,
282, 283, 75, 76, 288, 86, 279, 80, 81, 269,
270, 271, 259, 260, 276, 277, 288, 288, 288, 288,
278, 278, 278, 278, 288, 288, 278, 288, 278, 278,
278, 257, 278, 278, 288, 288, 278, 288, 257, 257,
257, 257, 257, 257, 279, 279, 257, 9, 80, 86,
81, 75, 74, 76, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, 258, -1,
258, -1, 262, 263, 262, 263, -1, -1, 268, -1,
268, 258, 272, 258, 272, 262, 263, 262, 263, -1,
280, 268, 280, 268, 258, 272, 258, 272, 262, 263,
262, 263, -1, 280, 268, 280, 268, -1, 272, -1,
272, -1, -1, -1, -1, -1, 280, -1, 280,
};
#define schemaFINAL 7
#ifndef schemaDEBUG
#define schemaDEBUG 0
#endif
#define schemaMAXTOKEN 288
#if schemaDEBUG
char * schemaname[] = {
"end-of-file",0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,"TOKEN","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","BYTE_ORDER","SEPARATOR",
};
char * schemarule[] = {
"$accept : Sheet",
"Sheet : DescriptionList",
"DescriptionList : Description DescriptionList",
"DescriptionList : Description",
"Description : STORE Store_description",
"Description : INDEX Index_description",
"Description : INV Inv_description",
"Description : COMPRESS Compress_description",
"Description : INDEX_AGENT Index_Agent_description",
"Description : CONTAINER Container_description",
"Store_description : Page_Store_Head SEPARATOR Page_store_descriptions",
"Index_description : Index_Head SEPARATOR MPHF_index_descriptions",
"Inv_description : Inv_Head SEPARATOR Inv_descriptions",
"Compress_description : Compress_Head SEPARATOR Compress_descriptions",
"Index_Agent_description : Index_Agent_Head SEPARATOR Hash_descriptions",
"Container_description : Container_Head SEPARATOR Container_descriptions",
"Page_Store_Head : PAGE_STORE",
"Index_Head : MPHF_INDEX",
"Index_Head : SMPHF_INDEX",
"Index_Head : BTREE_INDEX",
"Inv_Head : INV",
"Compress_Head : HUFFMAN",
"Compress_Head : DICT",
"Index_Agent_Head : MPHF",
"Index_Agent_Head : BTREE",
"Index_Agent_Head : SMPHF",
"Container_Head : SET",
"Container_Head : LIST",
"Page_store_descriptions : Page_Store_Term SEPARATOR Page_store_descriptions",
"Page_store_descriptions : Page_Store_Term",
"MPHF_index_descriptions : MPHF_Index_Term SEPARATOR MPHF_index_descriptions",
"MPHF_index_descriptions : MPHF_Index_Term",
"Inv_descriptions : Stored_Object_Term SEPARATOR Inv_descriptions",
"Inv_descriptions : Stored_Object_Term",
"Compress_descriptions : Stored_Object_Term SEPARATOR Compress_descriptions",
"Compress_descriptions : Stored_Object_Term",
"Hash_descriptions : Stored_Object_Term SEPARATOR Hash_descriptions",
"Hash_descriptions : Stored_Object_Term",
"Container_descriptions : Container_Term SEPARATOR Container_descriptions",
"Container_descriptions : Container_Term",
"Page_Store_Term : Store_Term",
"Page_Store_Term : CACHED_PAGES EQUAL NUMBER",
"Page_Store_Term : BYTE_ORDER EQUAL TOKEN",
"Page_Store_Term : PAGE_SZ EQUAL NUMBER",
"Store_Term : Term",
"Store_Term : MODE EQUAL TOKEN",
"Term : NM EQUAL TOKEN",
"Term : V_OID EQUAL TOKEN",
"MPHF_Index_Term : POSITION EQUAL NUMBER",
"MPHF_Index_Term : Index_Term",
"Index_Term : INV_NAME EQUAL TOKEN",
"Index_Term : AGENT_NAME EQUAL TOKEN",
"Index_Term : Stored_Object_Term",
"Stored_Object_Term : STORE_NAME EQUAL TOKEN",
"Stored_Object_Term : Term",
"Container_Term : INDEX_NAME EQUAL TOKEN",
"Container_Term : Stored_Object_Term",
};
#endif
#define schemaclearin ( schemachar=(-1))
#define schemaerrok ( schemaerrflag=0)
#ifdef schemaSTACKSIZE
#ifndef schemaMAXDEPTH
#define schemaMAXDEPTH schemaSTACKSIZE
#endif
#else
#ifdef schemaMAXDEPTH
#define schemaSTACKSIZE schemaMAXDEPTH
#else
#define schemaSTACKSIZE 500
#define schemaMAXDEPTH 500
#endif
#endif
int schemadebug;
int schemanerrs;
int schemaerrflag;
int schemachar;
short * schemassp;
schemaSTYPE * schemavsp;
schemaSTYPE schemaval;
schemaSTYPE schemalval;
short schemass[ schemaSTACKSIZE];
schemaSTYPE schemavs[ schemaSTACKSIZE];
#define schemastacksize schemaSTACKSIZE
#define schemaABORT goto schemaabort
#define schemaACCEPT goto schemaaccept
#define schemaERROR goto schemaerrlab
#if schemaDEBUG
#ifndef __cplusplus
extern char *getenv(const char *);
#endif
#endif
int
schemaparse()
{
register int schemam, scheman, schemastate;
#if schemaDEBUG
register char * schemas;
if ( schemas = getenv(" schemaDEBUG"))
{
scheman = * schemas;
if ( scheman >= '0' && scheman <= '9')
schemadebug = scheman - '0';
}
#endif
schemanerrs = 0;
schemaerrflag = 0;
schemachar = (-1);
schemassp = schemass;
schemavsp = schemavs;
* schemassp = schemastate = 0;
schemaloop:
if ( scheman = schemadefred[ schemastate]) goto schemareduce;
if ( schemachar < 0)
{
if (( schemachar = schemalex()) < 0) schemachar = 0;
#if schemaDEBUG
if ( schemadebug)
{
schemas = 0;
if ( schemachar <= schemaMAXTOKEN) schemas = schemaname[ schemachar];
if (! schemas) schemas = "illegal-symbol";
printf(" schemadebug: state %d, reading %d (%s)\n", schemastate,
schemachar, schemas);
}
#endif
}
if (( scheman = schemasindex[ schemastate]) && ( scheman += schemachar) >= 0 &&
scheman <= schemaTABLESIZE && schemacheck[ scheman] == schemachar)
{
#if schemaDEBUG
if ( schemadebug)
printf(" schemadebug: state %d, shifting to state %d\n",
schemastate, schematable[ scheman]);
#endif
if ( schemassp >= schemass + schemastacksize - 1)
{
goto schemaoverflow;
}
*++ schemassp = schemastate = schematable[ scheman];
*++ schemavsp = schemalval;
schemachar = (-1);
if ( schemaerrflag > 0) -- schemaerrflag;
goto schemaloop;
}
if (( scheman = schemarindex[ schemastate]) && ( scheman += schemachar) >= 0 &&
scheman <= schemaTABLESIZE && schemacheck[ scheman] == schemachar)
{
scheman = schematable[ scheman];
goto schemareduce;
}
if ( schemaerrflag) goto schemainrecovery;
#if 0 /* remove if needed */
#ifdef lint
goto schemanewerror;
#endif
schemanewerror:
#endif
schemaerror("syntax error");
#if 0 /* remove if needed */
#ifdef lint
goto schemaerrlab;
#endif
schemaerrlab:
#endif
++ schemanerrs;
schemainrecovery:
if ( schemaerrflag < 3)
{
schemaerrflag = 3;
for (;;)
{
if (( scheman = schemasindex[* schemassp]) && ( scheman += schemaERRCODE) >= 0 &&
scheman <= schemaTABLESIZE && schemacheck[ scheman] == schemaERRCODE)
{
#if schemaDEBUG
if ( schemadebug)
printf(" schemadebug: state %d, error recovery shifting\
to state %d\n", * schemassp, schematable[ scheman]);
#endif
if ( schemassp >= schemass + schemastacksize - 1)
{
goto schemaoverflow;
}
*++ schemassp = schemastate = schematable[ scheman];
*++ schemavsp = schemalval;
goto schemaloop;
}
else
{
#if schemaDEBUG
if ( schemadebug)
printf(" schemadebug: error recovery discarding state %d\n",
* schemassp);
#endif
if ( schemassp <= schemass) goto schemaabort;
-- schemassp;
-- schemavsp;
}
}
}
else
{
if ( schemachar == 0) goto schemaabort;
#if schemaDEBUG
if ( schemadebug)
{
schemas = 0;
if ( schemachar <= schemaMAXTOKEN) schemas = schemaname[ schemachar];
if (! schemas) schemas = "illegal-symbol";
printf(" schemadebug: state %d, error recovery discards token %d (%s)\n",
schemastate, schemachar, schemas);
}
#endif
schemachar = (-1);
goto schemaloop;
}
schemareduce:
#if schemaDEBUG
if ( schemadebug)
printf(" schemadebug: state %d, reducing by rule %d (%s)\n",
schemastate, scheman, schemarule[ scheman]);
#endif
schemam = schemalen[ scheman];
schemaval = schemavsp[1- schemam];
switch ( scheman)
{
case 1:
{
/*$1 -> asciiOutList(cerr);*/
desc_ptr = schemavsp[0].trans;
}
break;
case 2:
{
schemavsp[-1].trans -> set_next_desc( schemavsp[0].trans);
schemaval.trans = schemavsp[-1].trans;
}
break;
case 3:
{
schemavsp[0].trans -> set_next_desc(0);
last_desc_ptr = schemavsp[0].trans;
schemaval.trans = schemavsp[0].trans;
}
break;
case 4:
{
schemaval.trans = schemavsp[0].trans;
}
break;
case 5:
{
schemaval.trans = schemavsp[0].trans;
}
break;
case 6:
{
schemaval.trans = schemavsp[0].trans;
}
break;
case 7:
{
schemaval.trans = schemavsp[0].trans;
}
break;
case 8:
{
schemaval.trans = schemavsp[0].trans;
}
break;
case 9:
{
schemaval.trans = schemavsp[0].trans;
}
break;
case 10:
{
schemaval.trans = desc_ptr;
}
break;
case 11:
{
schemaval.trans = desc_ptr;
}
break;
case 12:
{
schemaval.trans = desc_ptr;
}
break;
case 13:
{
schemaval.trans = desc_ptr;
}
break;
case 14:
{
schemaval.trans = desc_ptr;
}
break;
case 15:
{
schemaval.trans = desc_ptr;
}
break;
case 16:
{
desc_ptr = new page_store_desc;
}
break;
case 17:
{
desc_ptr= new mphf_index_desc;
}
break;
case 18:
{
desc_ptr= new smphf_index_desc;
}
break;
case 19:
{
desc_ptr= new btree_index_desc;
}
break;
case 20:
{
desc_ptr= new inv_desc;
}
break;
case 21:
{
desc_ptr= new huffman_desc;
}
break;
case 22:
{
desc_ptr= new dict_desc;
}
break;
case 23:
{
desc_ptr= new mphf_desc;
}
break;
case 24:
{
desc_ptr= new btree_desc;
}
break;
case 25:
{
desc_ptr= new smphf_desc;
}
break;
case 26:
{
desc_ptr= new set_desc;
}
break;
case 27:
{
desc_ptr= new list_desc;
}
break;
case 28:
{
}
break;
case 29:
{
}
break;
case 30:
{
}
break;
case 31:
{
}
break;
case 32:
{
}
break;
case 33:
{
}
break;
case 34:
{
}
break;
case 35:
{
}
break;
case 36:
{
}
break;
case 37:
{
}
break;
case 38:
{
}
break;
case 39:
{
}
break;
case 40:
{
}
break;
case 41:
{
CAST_TO_PAGE_STORE(desc_ptr) -> set_cached_pages( schemavsp[0].integer);
}
break;
case 42:
{
CAST_TO_PAGE_STORE(desc_ptr) -> set_order( schemavsp[0].string);
}
break;
case 43:
{
CAST_TO_PAGE_STORE(desc_ptr) -> set_page_sz( schemavsp[0].integer);
}
break;
case 44:
{
}
break;
case 45:
{
CAST_TO_PAGE_STORE(desc_ptr) -> set_mode( schemavsp[0].string);
}
break;
case 46:
{
desc_ptr -> set_nm( schemavsp[0].string);
}
break;
case 47:
{
desc_ptr -> set_oid( schemavsp[0].string);
}
break;
case 48:
{
CAST_TO_MPHF_INDEX(desc_ptr) -> set_position( schemavsp[0].integer);
}
break;
case 49:
{
}
break;
case 50:
{
CAST_TO_INDEX(desc_ptr) -> set_inv_nm( schemavsp[0].string);
}
break;
case 51:
{
CAST_TO_INDEX(desc_ptr) -> set_agent_nm( schemavsp[0].string);
}
break;
case 52:
{
}
break;
case 53:
{
CAST_TO_STORED_OBJECT(desc_ptr) -> set_store_nm( schemavsp[0].string);
}
break;
case 54:
{
}
break;
case 55:
{
CAST_TO_CONTAINER(desc_ptr) -> set_index_nm( schemavsp[0].string);
}
break;
case 56:
{
}
break;
}
schemassp -= schemam;
schemastate = * schemassp;
schemavsp -= schemam;
schemam = schemalhs[ scheman];
if ( schemastate == 0 && schemam == 0)
{
#if schemaDEBUG
if ( schemadebug)
printf(" schemadebug: after reduction, shifting from state 0 to\
state %d\n", schemaFINAL);
#endif
schemastate = schemaFINAL;
*++ schemassp = schemaFINAL;
*++ schemavsp = schemaval;
if ( schemachar < 0)
{
if (( schemachar = schemalex()) < 0) schemachar = 0;
#if schemaDEBUG
if ( schemadebug)
{
schemas = 0;
if ( schemachar <= schemaMAXTOKEN) schemas = schemaname[ schemachar];
if (! schemas) schemas = "illegal-symbol";
printf(" schemadebug: state %d, reading %d (%s)\n",
schemaFINAL, schemachar, schemas);
}
#endif
}
if ( schemachar == 0) goto schemaaccept;
goto schemaloop;
}
if (( scheman = schemagindex[ schemam]) && ( scheman += schemastate) >= 0 &&
scheman <= schemaTABLESIZE && schemacheck[ scheman] == schemastate)
schemastate = schematable[ scheman];
else
schemastate = schemadgoto[ schemam];
#if schemaDEBUG
if ( schemadebug)
printf(" schemadebug: after reduction, shifting from state %d \
to state %d\n", * schemassp, schemastate);
#endif
if ( schemassp >= schemass + schemastacksize - 1)
{
goto schemaoverflow;
}
*++ schemassp = schemastate;
*++ schemavsp = schemaval;
goto schemaloop;
schemaoverflow:
schemaerror("yacc stack overflow");
schemaabort:
return (1);
schemaaccept:
return (0);
}

View File

@@ -0,0 +1,41 @@
/* $XConsortium: sheet.tab.h /main/3 1996/06/11 17:46:46 cde-hal $ */
#define TOKEN 257
#define CONTAINER 258
#define SET 259
#define LIST 260
#define INDEX_NAME 261
#define INV 262
#define COMPRESS 263
#define INV_NAME 264
#define AGENT_NAME 265
#define STORE_NAME 266
#define POSITION 267
#define INDEX 268
#define MPHF_INDEX 269
#define SMPHF_INDEX 270
#define BTREE_INDEX 271
#define INDEX_AGENT 272
#define MPHF 273
#define SMPHF 274
#define BTREE 275
#define HUFFMAN 276
#define DICT 277
#define EQUAL 278
#define NUMBER 279
#define STORE 280
#define PAGE_STORE 281
#define NM 282
#define V_OID 283
#define MODE 284
#define PAGE_SZ 285
#define CACHED_PAGES 286
#define BYTE_ORDER 287
#define SEPARATOR 288
typedef union
{
char *string;
int integer;
desc* trans;
page_store_desc* ps_trans;
} YYSTYPE;
extern YYSTYPE schemalval;

View File

@@ -0,0 +1,370 @@
/*
* $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)
#define alloca(x) (malloc(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
BYTE_ORDER
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);
}
| BYTE_ORDER 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
{
}
%%

View File

@@ -0,0 +1,229 @@
/*
* $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"));
}
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"));
}
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);
//strncpy(mode_str, str, NAMESIZ-1);
get_mode(); // check
}
int store_desc::get_mode()
{
int mode = 0;
for ( 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* byte_order = order_str;
if ( last == true )
desc_print_end(out, byte_order);
else
desc_print(out, byte_order);
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;
}

View File

@@ -0,0 +1,111 @@
/*
* $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

View File

@@ -0,0 +1,73 @@
/*
* $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()
{
delete store_nm;
}
void stored_object_desc::set_store_nm(const char* str)
{
delete 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;
}

View File

@@ -0,0 +1,62 @@
/*
* $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

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,191 @@
/*
* $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
*
*/
%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);
}
"byte_order" {
return(BYTE_ORDER);
}
"cached_pages" {
return(CACHED_PAGES);
}
"=" {
return(EQUAL);
}
":"[\\]?[\n]? {
return(SEPARATOR);
}
[\n]+ {
linecount++;
}
[\t ]+ {
}
^"#".* {
}
[0-9]+ {
yylval.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);
yylval.string = replace_string;
} else
yylval.string = (char*)yytext;
return (TOKEN);
}
%%