Initial import of the CDE 2.1.30 sources from the Open Group.
This commit is contained in:
106
cde/lib/DtSearch/raima/Imakefile
Normal file
106
cde/lib/DtSearch/raima/Imakefile
Normal file
@@ -0,0 +1,106 @@
|
||||
# $XConsortium: Imakefile /main/10 1996/08/14 17:50:16 cde-ibm $
|
||||
#
|
||||
# (c) Copyright 1996 Digital Equipment Corporation.
|
||||
# (c) Copyright 1996 Hewlett-Packard Company.
|
||||
# (c) Copyright 1996 International Business Machines Corp.
|
||||
# (c) Copyright 1996 Sun Microsystems, Inc.
|
||||
# (c) Copyright 1996 Novell, Inc.
|
||||
# (c) Copyright 1996 FUJITSU LIMITED.
|
||||
# (c) Copyright 1996 Hitachi.
|
||||
#
|
||||
|
||||
REQUIREDLIBS = -lc -lm
|
||||
|
||||
#ifdef AlphaArchitecture
|
||||
EXTRA_DEFINES = -DBYTE_SWAP -D_OSF_SOURCE -D_XOPEN_SOURCE
|
||||
#endif
|
||||
|
||||
#ifdef USLArchitecture
|
||||
EXTRA_DEFINES = -DBYTE_SWAP -D_XOPEN_SOURCE
|
||||
#endif
|
||||
|
||||
#ifdef UXPArchitecture
|
||||
EXTRA_DEFINES = -D_XOPEN_SOURCE
|
||||
#endif
|
||||
|
||||
#define DoNormalLib NormalLibDtSearch
|
||||
#define DoSharedLib SharedLibDtSearch
|
||||
#define DoDebugLib DebugLibDtSearch
|
||||
#define DoProfileLib ProfileLibDtSearch
|
||||
#define LibName DtSearch
|
||||
#define SoRev SODTSEARCHREV
|
||||
#define IncSubdir Dt
|
||||
#define LibCreate NO
|
||||
|
||||
#ifndef DtSvcDefines
|
||||
# define DtSvcDefines -DXK_MISCELLANY -DMULTIBYTE
|
||||
#endif
|
||||
DEFINES = DtSvcDefines \
|
||||
-DCDE_INSTALLATION_TOP=\"$(CDE_INSTALLATION_TOP)\" \
|
||||
-DCDE_CONFIGURATION_TOP=\"$(CDE_CONFIGURATION_TOP)\" \
|
||||
-DNO_TRANS -DUNIX -DNO_CONST -D_POSIX_SOURCE
|
||||
|
||||
INCLUDES = -I.
|
||||
|
||||
|
||||
HEADERS = \
|
||||
dbtype.h dproto.h inittab.h ncb.h task.h vista.h \
|
||||
dblock.h dbxtrn.h dtcover.h ll.h proto.h trxlog.h
|
||||
|
||||
SRCS = \
|
||||
alloc.c cmstat.c cmtype.c connect.c \
|
||||
costat.c cotype.c crget.c crread.c crset.c \
|
||||
crstat.c crtype.c crwrite.c csmget.c csmread.c \
|
||||
csmset.c csmwrite.c csoget.c csoread.c csoset.c \
|
||||
csowrite.c csstat.c ctscm.c ctsco.c ctscr.c \
|
||||
dbacode.c dbdpath.c dbfpath.c dblfcns.c \
|
||||
dbswab.c dbuserid.c \
|
||||
delete.c destroy.c dio.c discon.c disdel.c \
|
||||
fillnew.c findco.c findfm.c findlm.c findnm.c \
|
||||
findpm.c gtscm.c gtsco.c gtscr.c gtscs.c \
|
||||
initial.c inittab.c ismember.c \
|
||||
isowner.c keydel.c keyexist.c keyfcns.c \
|
||||
keyfind.c keyfrst.c keylast.c keynext.c keyprev.c \
|
||||
keystore.c libfcns.c makenew.c mapchar.c \
|
||||
members.c netunix.c oflag.c opens.c options.c \
|
||||
pathfcns.c recfcns.c recfrst.c reclast.c recnext.c \
|
||||
recprev.c recread.c recset.c \
|
||||
recstat.c recwrite.c renfile.c rwcurr.c setdb.c \
|
||||
setmm.c setmo.c setmr.c setom.c setoo.c \
|
||||
setor.c setrm.c setro.c startup.c stscm.c \
|
||||
stsco.c stscr.c stscs.c \
|
||||
utscm.c utsco.c utscr.c utscs.c
|
||||
|
||||
/* WARNING!!!!
|
||||
* Any .o's added to this list need to be added to DTUTIL1_OBJS1
|
||||
* and SHARED_DTUTIL1_OBJS1 in the DtSearch Imakefile.
|
||||
*/
|
||||
OBJS = \
|
||||
alloc.o cmstat.o cmtype.o connect.o \
|
||||
costat.o cotype.o crget.o crread.o crset.o \
|
||||
crstat.o crtype.o crwrite.o csmget.o csmread.o \
|
||||
csmset.o csmwrite.o csoget.o csoread.o csoset.o \
|
||||
csowrite.o csstat.o ctscm.o ctsco.o ctscr.o \
|
||||
dbacode.o dbdpath.o dbfpath.o dblfcns.o \
|
||||
dbswab.o dbuserid.o \
|
||||
delete.o destroy.o dio.o discon.o disdel.o \
|
||||
fillnew.o findco.o findfm.o findlm.o findnm.o \
|
||||
findpm.o gtscm.o gtsco.o gtscr.o gtscs.o \
|
||||
initial.o inittab.o ismember.o \
|
||||
isowner.o keydel.o keyexist.o keyfcns.o \
|
||||
keyfind.o keyfrst.o keylast.o keynext.o keyprev.o \
|
||||
keystore.o libfcns.o makenew.o mapchar.o \
|
||||
members.o netunix.o opens.o options.o oflag.o \
|
||||
pathfcns.o recfcns.o recfrst.o reclast.o recnext.o \
|
||||
recprev.o recread.o recset.o \
|
||||
recstat.o recwrite.o renfile.o rwcurr.o setdb.o \
|
||||
setmm.o setmo.o setmr.o setom.o setoo.o \
|
||||
setor.o setrm.o setro.o startup.o stscm.o \
|
||||
stsco.o stscr.o stscs.o \
|
||||
utscm.o utsco.o utscr.o utscs.o
|
||||
|
||||
#include <Library.tmpl>
|
||||
|
||||
SubdirLibraryRule($(OBJS))
|
||||
|
||||
DependTarget()
|
||||
244
cde/lib/DtSearch/raima/alloc.c
Normal file
244
cde/lib/DtSearch/raima/alloc.c
Normal file
@@ -0,0 +1,244 @@
|
||||
/* $XConsortium: alloc.c /main/2 1996/05/09 03:55:49 drk $ */
|
||||
/*
|
||||
* COMPONENT_NAME: austext
|
||||
*
|
||||
* FUNCTIONS: CurrLock
|
||||
* CurrUnlock
|
||||
* I_CALLOC
|
||||
* I_FREE
|
||||
* I_MALLOC
|
||||
* Memlock
|
||||
* Memunlock
|
||||
* NewInit
|
||||
* calloc
|
||||
* d_alloc
|
||||
* d_calloc
|
||||
* d_free
|
||||
* ll_access
|
||||
* ll_append
|
||||
* ll_first
|
||||
* ll_free
|
||||
* ll_next
|
||||
* ll_prepend
|
||||
* malloc
|
||||
* memlock
|
||||
* memunlock
|
||||
*
|
||||
* ORIGINS: 157
|
||||
*
|
||||
* OBJECT CODE ONLY SOURCE MATERIALS
|
||||
*/
|
||||
/*-----------------------------------------------------------------------
|
||||
alloc.c -- db_VISTA dynamic memory allocation module.
|
||||
|
||||
(C) Copyright 1986,1987 by Raima Corporation.
|
||||
-----------------------------------------------------------------------*/
|
||||
/* ********************** EDIT HISTORY *******************************
|
||||
|
||||
SCR DATE INI DESCRIPTION
|
||||
----- --------- --- -----------------------------------------------------
|
||||
420 15-Aug-88 RTK Lock level wasn't incremented when stack had overflowed
|
||||
420 27-Sep-88 RSC there was unreachable code in ll_free (repl 'return' w/
|
||||
'break' inside loop)
|
||||
550 10-Jan-88 RSC ll_free was referencing a segment that was free'd
|
||||
420 13-Feb-89 WLW Removed unnecessary FAR's, modified d_lockpop
|
||||
550 14-Feb-89 RTK Better fix to ll_free problem (windows compatible)
|
||||
|
||||
*/
|
||||
#include <stdio.h>
|
||||
#include "vista.h"
|
||||
#include "dbtype.h"
|
||||
|
||||
|
||||
char *malloc(P1(unsigned));
|
||||
char *calloc(P1(unsigned) Pi(unsigned));
|
||||
#define memlock(p) (p)
|
||||
#define memunlock(p) 1
|
||||
|
||||
#define Memlock(cp) /**/
|
||||
#define Memunlock(cp) /**/
|
||||
#define I_CALLOC(cp, i, s) calloc(i, s)
|
||||
#define I_MALLOC(cp, b) malloc(b)
|
||||
#define I_FREE(cp) free((cp)->ptr)
|
||||
#define CurrUnlock(ll) /**/
|
||||
#define CurrLock(ll) /**/
|
||||
|
||||
|
||||
/*-----------------------------------------------------------------------
|
||||
Uninstrumented dynamic memory allocation functions
|
||||
-----------------------------------------------------------------------*/
|
||||
|
||||
/* Allocate and clear i*s bytes of memory
|
||||
*/
|
||||
char FAR * d_calloc(i, s)
|
||||
unsigned i, s;
|
||||
{
|
||||
return (I_CALLOC(cp, i, s));
|
||||
}
|
||||
|
||||
|
||||
/* Allocate b bytes of memory
|
||||
*/
|
||||
char FAR * d_alloc(b)
|
||||
unsigned b;
|
||||
{
|
||||
return (I_MALLOC(cp, b));
|
||||
}
|
||||
|
||||
/* Free memory
|
||||
*/
|
||||
void d_free(p)
|
||||
CHAR_P FAR *p;
|
||||
{
|
||||
if ((p != NULL) && (p->ptr != NULL)) {
|
||||
I_FREE(p);
|
||||
p->ptr = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static int NewInit(P1(LL_P FAR *));
|
||||
|
||||
/* Resets pointer to current element and checks for an empty list
|
||||
*/
|
||||
BOOLEAN ll_access(ll)
|
||||
llist FAR *ll;
|
||||
{
|
||||
ll->curr = NULL;
|
||||
return( ll->head.ptr != NULL && ll->tail.ptr != NULL );
|
||||
}
|
||||
|
||||
/* Appends item to list
|
||||
*/
|
||||
int ll_append(ll, data)
|
||||
llist FAR *ll;
|
||||
CHAR_P FAR *data;
|
||||
{
|
||||
LL_P item;
|
||||
LL_P hold;
|
||||
|
||||
if ( NewInit(&item) != S_OKAY ) {
|
||||
return( db_status );
|
||||
}
|
||||
if ( ll->head.ptr == NULL ) {
|
||||
/* Empty list */
|
||||
ll->head = ll->tail = item;
|
||||
ll->curr = (LL_P FAR *)&ll->head;
|
||||
CurrLock(ll);
|
||||
}
|
||||
else {
|
||||
CurrUnlock(ll);
|
||||
ll->curr = (LL_P FAR *)&ll->tail;
|
||||
CurrLock(ll);
|
||||
hold = item;
|
||||
MEM_LOCK(&item);
|
||||
ll->curr->ptr->next = item;
|
||||
CurrUnlock(ll);
|
||||
ll->curr = (LL_P FAR *)&ll->tail;
|
||||
*ll->curr = hold;
|
||||
CurrLock(ll);
|
||||
}
|
||||
ll->curr->ptr->data = *data;
|
||||
return( db_status );
|
||||
}
|
||||
|
||||
/* Finds the first element of a list and returns its data
|
||||
*/
|
||||
CHAR_P FAR *ll_first(ll)
|
||||
llist FAR *ll;
|
||||
{
|
||||
if ( ll->head.ptr == NULL ) {
|
||||
return( NULL );
|
||||
}
|
||||
CurrUnlock(ll);
|
||||
ll->curr = (LL_P FAR *)&ll->head;
|
||||
CurrLock(ll);
|
||||
return( (CHAR_P FAR *)&ll->curr->ptr->data );
|
||||
}
|
||||
|
||||
/* Frees a list
|
||||
*/
|
||||
void ll_free(ll)
|
||||
llist FAR *ll;
|
||||
{
|
||||
LL_P FAR *curr, next, free;
|
||||
|
||||
curr = (LL_P FAR *)&ll->head;
|
||||
while ( TRUE ) {
|
||||
MEM_LOCK(curr);
|
||||
if ( curr->ptr == NULL )
|
||||
break;
|
||||
bytecpy(&next, &curr->ptr->next, sizeof(LL_P));
|
||||
if ( curr != NULL )
|
||||
d_free((CHAR_P FAR *)curr);
|
||||
bytecpy(&free, &next, sizeof(LL_P));
|
||||
curr = &free;
|
||||
}
|
||||
byteset(&ll->head, '\0', sizeof(LL_P));
|
||||
byteset(&ll->tail, '\0', sizeof(LL_P));
|
||||
}
|
||||
|
||||
/* Finds the next element and returns its data
|
||||
*/
|
||||
CHAR_P FAR *ll_next(ll)
|
||||
llist FAR *ll;
|
||||
{
|
||||
LL_P FAR *next;
|
||||
|
||||
if ( ll->curr == NULL ) {
|
||||
return( ll_first(ll) );
|
||||
}
|
||||
if ( ll->curr->ptr->next.ptr == NULL ) {
|
||||
return( NULL );
|
||||
}
|
||||
next = &ll->curr->ptr->next;
|
||||
CurrUnlock(ll);
|
||||
ll->curr = next;
|
||||
CurrLock(ll);
|
||||
return( (CHAR_P FAR *)&ll->curr->ptr->data );
|
||||
}
|
||||
|
||||
/* Prepends (stacks) item
|
||||
*/
|
||||
int ll_prepend(ll, data)
|
||||
llist FAR *ll;
|
||||
CHAR_P FAR *data;
|
||||
{
|
||||
LL_P item;
|
||||
|
||||
if ( NewInit(&item) != S_OKAY ) {
|
||||
return( db_status );
|
||||
}
|
||||
if ( ll->head.ptr == NULL ) {
|
||||
/* Empty list */
|
||||
ll->head = ll->tail = item;
|
||||
ll->curr = (LL_P FAR *)&ll->head;
|
||||
CurrLock(ll);
|
||||
}
|
||||
else {
|
||||
CurrUnlock(ll);
|
||||
MEM_LOCK(&item);
|
||||
item.ptr->next = ll->head;
|
||||
MEM_UNLOCK(&item);
|
||||
ll->curr = (LL_P FAR *)&ll->head;
|
||||
*ll->curr = item;
|
||||
CurrLock(ll);
|
||||
}
|
||||
ll->curr->ptr->data = *data;
|
||||
return( db_status );
|
||||
}
|
||||
|
||||
/* Allocates and initializes a new list element
|
||||
*/
|
||||
static int NewInit(new)
|
||||
LL_P FAR *new;
|
||||
{
|
||||
new->ptr = (ll_elem FAR *)ALLOC(new, sizeof(ll_elem), "new");
|
||||
if ( new->ptr == NULL )
|
||||
return( dberr(S_NOMEMORY) );
|
||||
byteset(new->ptr, '\0', sizeof(ll_elem));
|
||||
MEM_UNLOCK(new);
|
||||
return( db_status );
|
||||
}
|
||||
|
||||
/* vpp -nOS2 -dUNIX -nBSD -nVANILLA_BSD -nVMS -nMEMLOCK -nWINDOWS -nFAR_ALLOC -f/usr/users/master/config/nonwin alloc.c */
|
||||
58
cde/lib/DtSearch/raima/cmstat.c
Normal file
58
cde/lib/DtSearch/raima/cmstat.c
Normal file
@@ -0,0 +1,58 @@
|
||||
/* $XConsortium: cmstat.c /main/2 1996/05/09 03:56:07 drk $ */
|
||||
/*
|
||||
* COMPONENT_NAME: austext
|
||||
*
|
||||
* FUNCTIONS: d_cmstat
|
||||
*
|
||||
* ORIGINS: 157
|
||||
*
|
||||
* OBJECT CODE ONLY SOURCE MATERIALS
|
||||
*/
|
||||
/*-----------------------------------------------------------------------
|
||||
cmstat.c -- db_VISTA member timestamp status check module.
|
||||
|
||||
(C) Copyright 1987 by Raima Corporation.
|
||||
-----------------------------------------------------------------------*/
|
||||
|
||||
/* ********************** EDIT HISTORY *******************************
|
||||
|
||||
SCR DATE INI DESCRIPTION
|
||||
----- --------- --- -----------------------------------------------------
|
||||
04-Aug-88 RTK MULTI_TASK changes
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include "vista.h"
|
||||
#include "dbtype.h"
|
||||
|
||||
|
||||
#ifndef NO_TIMESTAMP
|
||||
/* Test timestamp status of current member
|
||||
*/
|
||||
d_cmstat(set TASK_PARM DBN_PARM)
|
||||
int set;
|
||||
TASK_DECL
|
||||
DBN_DECL
|
||||
{
|
||||
ULONG cts, uts;
|
||||
ULONG cmts;
|
||||
|
||||
DB_ENTER(DB_ID TASK_ID LOCK_SET(SET_IO));
|
||||
if ( d_ctscm(set, &cts TASK_PARM DBN_PARM) == S_OKAY ) {
|
||||
if ( cts ) {
|
||||
cmts = cm_time[NUM2INT(set - SETMARK, st_offset)];
|
||||
if ( cts > cmts )
|
||||
db_status = S_DELETED;
|
||||
else {
|
||||
d_utscm(set, &uts TASK_PARM DBN_PARM);
|
||||
if ( uts > cmts )
|
||||
db_status = S_UPDATED;
|
||||
}
|
||||
}
|
||||
else
|
||||
dberr(S_TIMESTAMP);
|
||||
}
|
||||
RETURN( db_status );
|
||||
}
|
||||
#endif
|
||||
/* vpp -nOS2 -dUNIX -nBSD -nVANILLA_BSD -nVMS -nMEMLOCK -nWINDOWS -nFAR_ALLOC -f/usr/users/master/config/nonwin cmstat.c */
|
||||
76
cde/lib/DtSearch/raima/cmtype.c
Normal file
76
cde/lib/DtSearch/raima/cmtype.c
Normal file
@@ -0,0 +1,76 @@
|
||||
/* $XConsortium: cmtype.c /main/2 1996/05/09 03:56:24 drk $ */
|
||||
/*
|
||||
* COMPONENT_NAME: austext
|
||||
*
|
||||
* FUNCTIONS: d_cmtype
|
||||
*
|
||||
* ORIGINS: 157
|
||||
*
|
||||
* OBJECT CODE ONLY SOURCE MATERIALS
|
||||
*/
|
||||
/*-----------------------------------------------------------------------
|
||||
cmtype.c -- db_VISTA member type module.
|
||||
|
||||
(C) Copyright 1987 by Raima Corporation.
|
||||
-----------------------------------------------------------------------*/
|
||||
|
||||
/* ********************** EDIT HISTORY *******************************
|
||||
|
||||
SCR DATE INI DESCRIPTION
|
||||
----- --------- --- -----------------------------------------------------
|
||||
103 24-Jun-88 RSC Improve generation of single-user version
|
||||
04-Aug-88 RTK MULTI_TASK changes
|
||||
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include "vista.h"
|
||||
#include "dbtype.h"
|
||||
|
||||
/* Get current member type
|
||||
*/
|
||||
d_cmtype(set, cmtype TASK_PARM DBN_PARM)
|
||||
int set;
|
||||
int FAR *cmtype;
|
||||
TASK_DECL
|
||||
DBN_DECL
|
||||
{
|
||||
char FAR *mrec;
|
||||
INT crt;
|
||||
SET_ENTRY FAR *set_ptr;
|
||||
#ifndef SINGLE_USER
|
||||
int dbopen_sv;
|
||||
#endif
|
||||
|
||||
DB_ENTER(DB_ID TASK_ID LOCK_SET(SET_IO));
|
||||
|
||||
if (nset_check(set, &set, (SET_ENTRY FAR * FAR *)&set_ptr) != S_OKAY)
|
||||
RETURN( db_status );
|
||||
|
||||
if ( ! curr_mem[set] )
|
||||
RETURN( dberr( S_NOCM ) );
|
||||
|
||||
#ifndef SINGLE_USER
|
||||
/* set up to allow unlocked read */
|
||||
dbopen_sv = dbopen;
|
||||
dbopen = 2;
|
||||
#endif
|
||||
|
||||
/* Read current member */
|
||||
dio_read(curr_mem[set], (char FAR * FAR *)&mrec, NOPGHOLD);
|
||||
#ifndef SINGLE_USER
|
||||
dbopen = dbopen_sv;
|
||||
#endif
|
||||
if (db_status != S_OKAY)
|
||||
RETURN( db_status );
|
||||
|
||||
/* Fetch record type from record header */
|
||||
bytecpy(&crt, mrec, sizeof(INT));
|
||||
#ifndef SINGLE_USER
|
||||
crt &= ~RLBMASK; /* mask off rlb */
|
||||
#endif
|
||||
*cmtype = (int)crt + RECMARK;
|
||||
|
||||
RETURN( db_status );
|
||||
}
|
||||
/* vpp -nOS2 -dUNIX -nBSD -nVANILLA_BSD -nVMS -nMEMLOCK -nWINDOWS -nFAR_ALLOC -f/usr/users/master/config/nonwin cmtype.c */
|
||||
345
cde/lib/DtSearch/raima/connect.c
Normal file
345
cde/lib/DtSearch/raima/connect.c
Normal file
@@ -0,0 +1,345 @@
|
||||
/* $XConsortium: connect.c /main/2 1996/05/09 03:56:41 drk $ */
|
||||
/*
|
||||
* COMPONENT_NAME: austext
|
||||
*
|
||||
* FUNCTIONS: Pi
|
||||
* d_connect
|
||||
* sortcmp
|
||||
*
|
||||
* ORIGINS: 157
|
||||
*
|
||||
* OBJECT CODE ONLY SOURCE MATERIALS
|
||||
*/
|
||||
/*-----------------------------------------------------------------------
|
||||
connect.c -- db_VISTA set connection module
|
||||
|
||||
(C) Copyright 1985, 1986, 1987 by Raima Corp.
|
||||
-----------------------------------------------------------------------*/
|
||||
|
||||
/* ********************** EDIT HISTORY *******************************
|
||||
|
||||
SCR DATE INI DESCRIPTION
|
||||
----- --------- --- -----------------------------------------------------
|
||||
04-Aug-88 RTK MULTI_TASK changes
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include "vista.h"
|
||||
#include "dbtype.h"
|
||||
|
||||
/* Internal function Prototypes */
|
||||
static int sortcmp(P1(SET_ENTRY FAR *) Pi(char FAR *)
|
||||
Pi(char FAR *));
|
||||
|
||||
/* set pointer structure definition */
|
||||
typedef struct {
|
||||
LONG total; /* total number of members in set */
|
||||
DB_ADDR first; /* database address of first member in set */
|
||||
DB_ADDR last; /* database address of last member in set */
|
||||
#ifndef NO_TIMESTAMP
|
||||
ULONG timestamp; /* set update timestamp - if used */
|
||||
#endif
|
||||
} SET_PTR;
|
||||
|
||||
/* member pointer structure definition */
|
||||
typedef struct {
|
||||
DB_ADDR owner; /* database address of owner record */
|
||||
DB_ADDR prev; /* database address of previous member in set */
|
||||
DB_ADDR next; /* database address of next member in set */
|
||||
} MEM_PTR;
|
||||
|
||||
|
||||
/* Connect the current record as member of set
|
||||
*/
|
||||
d_connect(set TASK_PARM DBN_PARM)
|
||||
int set; /* Set constant */
|
||||
TASK_DECL
|
||||
DBN_DECL /* Database number */
|
||||
{
|
||||
MEM_PTR crmp; /* current record's member pointer */
|
||||
SET_PTR cosp; /* current owner's set pointer */
|
||||
MEM_PTR cmmp; /* current member's member pointer */
|
||||
MEM_PTR nmmp; /* next member's member pointer */
|
||||
char FAR *crec; /* ptr to current record contents in cache */
|
||||
char FAR *orec; /* ptr to current owner record contents in cache */
|
||||
char FAR *mrec; /* ptr to current member record contents in cache */
|
||||
char FAR *nrec; /* ptr to next member record contents in cache */
|
||||
DB_ADDR mdba; /* db address of current member record */
|
||||
DB_ADDR ndba; /* db address of next member record */
|
||||
INT ordering; /* set order control variable */
|
||||
int stat, compare; /* status code & sort comparison result */
|
||||
#ifndef NO_TIMESTAMP
|
||||
FILE_NO file;
|
||||
#endif
|
||||
SET_ENTRY FAR *set_ptr;
|
||||
DB_ADDR FAR *co_ptr;
|
||||
DB_ADDR FAR *cm_ptr;
|
||||
|
||||
DB_ENTER(DB_ID TASK_ID LOCK_SET(SET_IO));
|
||||
|
||||
if (nset_check(set, &set, (SET_ENTRY FAR * FAR *)&set_ptr) != S_OKAY)
|
||||
RETURN( db_status );
|
||||
|
||||
/* make sure we have a current record */
|
||||
if ( curr_rec == NULL_DBA )
|
||||
RETURN( dberr(S_NOCR) );
|
||||
|
||||
/* make sure we have a current owner */
|
||||
if ( *(co_ptr = &curr_own[set]) == NULL_DBA )
|
||||
RETURN( dberr(S_NOCO) );
|
||||
|
||||
crec = orec = mrec = nrec = NULL;
|
||||
|
||||
/* read current record */
|
||||
if ( dio_read( curr_rec, (char FAR * FAR *)&crec, PGHOLD ) != S_OKAY )
|
||||
RETURN( db_status );
|
||||
|
||||
/* read owner record */
|
||||
if ( (stat = dio_read(*co_ptr, (char FAR * FAR *)&orec, PGHOLD)) != S_OKAY ) {
|
||||
dio_release( curr_rec );
|
||||
RETURN( stat );
|
||||
}
|
||||
/* get copy of current record's member ptr for set */
|
||||
if ( (stat = r_gmem(set, crec, (char FAR *)&crmp)) != S_OKAY )
|
||||
goto quit;
|
||||
|
||||
/* ensure record not already connected to set */
|
||||
if ( ! crmp.owner == NULL_DBA ) {
|
||||
stat = dberr(S_ISOWNED);
|
||||
goto quit;
|
||||
}
|
||||
/* get set pointer from owner */
|
||||
if ( r_gset(set, orec, (char FAR *)&cosp) != S_OKAY ) {
|
||||
stat = db_status == S_INVOWN ? dberr(S_SYSERR) : db_status;
|
||||
goto quit;
|
||||
}
|
||||
/* set current record's owner to current owner of set */
|
||||
crmp.owner = *co_ptr;
|
||||
|
||||
cm_ptr = &curr_mem[set];
|
||||
/* make insertion based on set order specfication */
|
||||
if (cosp.first == NULL_DBA) {
|
||||
/* set is empty */
|
||||
/* set current owner's first and last to current record */
|
||||
cosp.first = cosp.last = curr_rec;
|
||||
|
||||
/* set current record's next and previous to null */
|
||||
crmp.next = crmp.prev = NULL_DBA;
|
||||
goto inserted;
|
||||
}
|
||||
/* order is as specified in DDL */
|
||||
ordering = set_ptr->st_order;
|
||||
|
||||
while (TRUE) switch (ordering) {
|
||||
case ASCENDING:
|
||||
case DESCENDING:
|
||||
/* perform a linked insertion sort on set -
|
||||
position the current member to the proper place and then
|
||||
switch to order NEXT */
|
||||
for (mdba = cosp.first; TRUE; mdba = cmmp.next) {
|
||||
/* read member record and get member pointer from member
|
||||
record */
|
||||
if (((stat = dio_read(mdba, (char FAR * FAR *)&mrec, NOPGHOLD)) != S_OKAY) ||
|
||||
((stat = r_gmem(set, mrec, (char FAR *)&cmmp)) != S_OKAY))
|
||||
goto quit;
|
||||
|
||||
/* compare sort fields of current record with member record */
|
||||
compare = sortcmp(set_ptr, crec, mrec);
|
||||
if ((ordering == ASCENDING) ? (compare < 0) : (compare > 0)) {
|
||||
/* found insertion position -
|
||||
make previous member the current member of set and
|
||||
switch to next order processing */
|
||||
*cm_ptr = cmmp.prev;
|
||||
ordering = NEXT;
|
||||
break;
|
||||
}
|
||||
if ( cmmp.next == NULL_DBA ) {
|
||||
/* connect at end of list */
|
||||
*cm_ptr = mdba;
|
||||
ordering = NEXT;
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case FIRST:
|
||||
crmp.next = cosp.first;
|
||||
/* read current owner's first member and get first member's
|
||||
member pointer
|
||||
*/
|
||||
mdba = cosp.first;
|
||||
if (((stat = dio_read(mdba, (char FAR * FAR *)&mrec, PGHOLD)) != S_OKAY) ||
|
||||
((stat = r_gmem(set, mrec, (char FAR *)&cmmp)) != S_OKAY))
|
||||
goto quit;
|
||||
|
||||
/* set current member's previous, and current owner's first, to
|
||||
current record */
|
||||
cmmp.prev = cosp.first = curr_rec;
|
||||
goto inserted;
|
||||
case NEXT:
|
||||
if (!*cm_ptr) {
|
||||
/* if no current member, next is same as first */
|
||||
ordering = FIRST;
|
||||
break;
|
||||
}
|
||||
/* insert record after current member */
|
||||
mdba = *cm_ptr;
|
||||
|
||||
/* read current member record and get member pointer from
|
||||
current member
|
||||
*/
|
||||
if (((stat = dio_read(mdba, (char FAR * FAR *)&mrec, PGHOLD)) != S_OKAY) ||
|
||||
((stat = r_gmem(set, mrec, (char FAR *)&cmmp)) != S_OKAY))
|
||||
goto quit;
|
||||
|
||||
/* set current record's next to current member's next */
|
||||
crmp.next = cmmp.next;
|
||||
|
||||
/* set current record's prev to current member */
|
||||
crmp.prev = mdba;
|
||||
|
||||
/* set current member's next ro current record */
|
||||
cmmp.next = curr_rec;
|
||||
|
||||
if (crmp.next == NULL_DBA) {
|
||||
/* current record at end of list -
|
||||
update set pointer's last member */
|
||||
cosp.last = curr_rec;
|
||||
goto inserted;
|
||||
}
|
||||
/* read next member record and member pointer from next member */
|
||||
ndba = crmp.next;
|
||||
if (((stat = dio_read(ndba, (char FAR * FAR *)&nrec, PGHOLD)) != S_OKAY) ||
|
||||
((stat = r_gmem(set, nrec, (char FAR *)&nmmp)) != S_OKAY))
|
||||
goto quit;
|
||||
|
||||
/* set previous pointer in next member to current record */
|
||||
nmmp.prev = curr_rec;
|
||||
goto inserted;
|
||||
case LAST:
|
||||
/* set current member to owner's last pointer */
|
||||
*cm_ptr = cosp.last;
|
||||
/* switch to order next */
|
||||
ordering = NEXT;
|
||||
break;
|
||||
default:
|
||||
/* there are no other possible orderings! */
|
||||
RETURN( dberr(S_SYSERR) );
|
||||
} /* while switch */
|
||||
inserted:
|
||||
/* increment total members in set */
|
||||
++cosp.total;
|
||||
#ifndef NO_TIMESTAMP
|
||||
/* check for timestamp */
|
||||
if ( set_ptr->st_flags & TIMESTAMPED ) {
|
||||
file = NUM2INT((FILE_NO)((*co_ptr >> FILESHIFT) & FILEMASK), ft_offset);
|
||||
cosp.timestamp = dio_pzgetts(file);
|
||||
}
|
||||
#endif
|
||||
if ( mrec ) {
|
||||
/* put member pointer back into member record and mark member
|
||||
record as modified
|
||||
*/
|
||||
if (((stat = r_pmem(set, mrec, (char FAR *)&cmmp)) != S_OKAY) ||
|
||||
((stat = dio_write(mdba, NULL, PGFREE)) != S_OKAY))
|
||||
goto quit;
|
||||
}
|
||||
if ( nrec ) {
|
||||
/* put member pointer back into next record and mark next record
|
||||
as modified
|
||||
*/
|
||||
if (((stat = r_pmem(set, nrec, (char FAR *)&nmmp)) != S_OKAY) ||
|
||||
((stat = dio_write(ndba, NULL, PGFREE)) != S_OKAY))
|
||||
goto quit;
|
||||
}
|
||||
/* put set pointer back into owner record and mark owner record as
|
||||
modified; put member pointer back into current record mark current
|
||||
record as modified */
|
||||
if (((stat = r_pset(set, orec, (char FAR *)&cosp)) != S_OKAY) ||
|
||||
((stat = dio_write(*co_ptr, NULL, PGFREE)) != S_OKAY) ||
|
||||
((stat = r_pmem(set, crec, (char FAR *)&crmp)) != S_OKAY) ||
|
||||
((stat = dio_write(curr_rec, NULL, PGFREE)) != S_OKAY))
|
||||
goto quit;
|
||||
|
||||
/* set current member to current record */
|
||||
*cm_ptr = curr_rec;
|
||||
#ifndef NO_TIMESTAMP
|
||||
/* check and fetch timestamps */
|
||||
if ( db_tsrecs )
|
||||
d_utscr(&cm_time[set] TASK_PARM);
|
||||
if ( db_tssets )
|
||||
cs_time[set] = cosp.timestamp;
|
||||
#endif
|
||||
RETURN( db_status );
|
||||
|
||||
/* error return */
|
||||
quit:
|
||||
if ( crec ) dio_release( curr_rec );
|
||||
if ( orec ) dio_release( *co_ptr );
|
||||
if ( mrec ) dio_release( mdba );
|
||||
if ( nrec ) dio_release( ndba );
|
||||
RETURN( db_status = stat );
|
||||
}
|
||||
|
||||
|
||||
/* Compare two sort fields
|
||||
*/
|
||||
static int sortcmp(set_ptr, mem1, mem2)
|
||||
SET_ENTRY FAR *set_ptr; /* set table entry */
|
||||
char FAR *mem1; /* member record 1 */
|
||||
char FAR *mem2; /* member record 2 */
|
||||
{
|
||||
INT rn1, rn2; /* record numbers for mem1 & mem2 */
|
||||
MEMBER_ENTRY FAR *mt1, FAR *mt2;
|
||||
register MEMBER_ENTRY FAR *mt;
|
||||
int mem, memtot;
|
||||
int cmp; /* fldcmp result */
|
||||
register int maxflds;
|
||||
register SORT_ENTRY FAR *srt1_ptr, FAR *srt2_ptr;
|
||||
FIELD_ENTRY FAR *fld_ptr;
|
||||
|
||||
/* extract record numbers from record header */
|
||||
bytecpy(&rn1, mem1, sizeof(INT));
|
||||
rn1 &= ~RLBMASK; /* mask off rlb */
|
||||
bytecpy(&rn2, mem2, sizeof(INT));
|
||||
rn2 &= ~RLBMASK; /* mask off rlb */
|
||||
#ifndef ONE_DB
|
||||
rn1 += curr_db_table->rt_offset;
|
||||
rn2 += curr_db_table->rt_offset;
|
||||
#endif
|
||||
|
||||
/* locate member_table entries for these record types */
|
||||
mt2 = mt1 = NULL;
|
||||
for (mem = set_ptr->st_members, memtot = mem + set_ptr->st_memtot,
|
||||
mt = &member_table[mem];
|
||||
mem < memtot;
|
||||
++mem, ++mt) {
|
||||
if ( mt->mt_record == rn1 ) {
|
||||
mt1 = mt;
|
||||
if (mt2 != NULL)
|
||||
break;
|
||||
}
|
||||
if ( mt->mt_record == rn2 ) {
|
||||
mt2 = mt;
|
||||
if (mt1 != NULL)
|
||||
break;
|
||||
}
|
||||
}
|
||||
/* set maxflds to number of sort fields in set (min(mt1,mt2)) */
|
||||
maxflds = (mt1->mt_totsf <= mt2->mt_totsf) ? mt1->mt_totsf : mt2->mt_totsf;
|
||||
|
||||
/* do comparison for each field */
|
||||
for (srt1_ptr = &sort_table[mt1->mt_sort_fld],
|
||||
srt2_ptr = &sort_table[mt2->mt_sort_fld];
|
||||
maxflds--;
|
||||
++srt1_ptr, ++srt2_ptr) {
|
||||
/* compare the two fields */
|
||||
/* computation is pointer to next sort field in member record */
|
||||
fld_ptr = &field_table[srt1_ptr->se_fld];
|
||||
if (cmp = fldcmp(fld_ptr, mem1 + fld_ptr->fd_ptr,
|
||||
mem2 + field_table[srt2_ptr->se_fld].fd_ptr))
|
||||
return (cmp); /* return at first unequal fields */
|
||||
}
|
||||
/* fields match */
|
||||
return (0);
|
||||
}
|
||||
/* vpp -nOS2 -dUNIX -nBSD -nVANILLA_BSD -nVMS -nMEMLOCK -nWINDOWS -nFAR_ALLOC -f/usr/users/master/config/nonwin connect.c */
|
||||
59
cde/lib/DtSearch/raima/costat.c
Normal file
59
cde/lib/DtSearch/raima/costat.c
Normal file
@@ -0,0 +1,59 @@
|
||||
/* $XConsortium: costat.c /main/2 1996/05/09 03:56:57 drk $ */
|
||||
/*
|
||||
* COMPONENT_NAME: austext
|
||||
*
|
||||
* FUNCTIONS: d_costat
|
||||
*
|
||||
* ORIGINS: 157
|
||||
*
|
||||
* OBJECT CODE ONLY SOURCE MATERIALS
|
||||
*/
|
||||
/*-----------------------------------------------------------------------
|
||||
costat.c -- db_VISTA owner timestamp status check module.
|
||||
|
||||
(C) Copyright 1987 by Raima Corporation.
|
||||
-----------------------------------------------------------------------*/
|
||||
|
||||
/* ********************** EDIT HISTORY *******************************
|
||||
|
||||
SCR DATE INI DESCRIPTION
|
||||
----- --------- --- -----------------------------------------------------
|
||||
04-Aug-88 RTK MULTI_TASK changes
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include "vista.h"
|
||||
#include "dbtype.h"
|
||||
|
||||
|
||||
#ifndef NO_TIMESTAMP
|
||||
/* Test timestamp status of current owner
|
||||
*/
|
||||
d_costat(set TASK_PARM DBN_PARM)
|
||||
int set;
|
||||
TASK_DECL
|
||||
DBN_DECL
|
||||
{
|
||||
ULONG cts, uts;
|
||||
ULONG cots;
|
||||
|
||||
DB_ENTER(DB_ID TASK_ID LOCK_SET(SET_IO));
|
||||
|
||||
if ( d_ctsco(set, &cts TASK_PARM DBN_PARM) == S_OKAY ) {
|
||||
if ( cts ) {
|
||||
cots = co_time[NUM2INT(set - SETMARK, st_offset)];
|
||||
if ( cts > cots )
|
||||
db_status = S_DELETED;
|
||||
else {
|
||||
d_utsco(set, &uts TASK_PARM DBN_PARM);
|
||||
if ( uts > cots )
|
||||
db_status = S_UPDATED;
|
||||
}
|
||||
}
|
||||
else
|
||||
dberr(S_TIMESTAMP);
|
||||
}
|
||||
RETURN( db_status );
|
||||
}
|
||||
#endif
|
||||
/* vpp -nOS2 -dUNIX -nBSD -nVANILLA_BSD -nVMS -nMEMLOCK -nWINDOWS -nFAR_ALLOC -f/usr/users/master/config/nonwin costat.c */
|
||||
73
cde/lib/DtSearch/raima/cotype.c
Normal file
73
cde/lib/DtSearch/raima/cotype.c
Normal file
@@ -0,0 +1,73 @@
|
||||
/* $XConsortium: cotype.c /main/2 1996/05/09 03:57:15 drk $ */
|
||||
/*
|
||||
* COMPONENT_NAME: austext
|
||||
*
|
||||
* FUNCTIONS: d_cotype
|
||||
*
|
||||
* ORIGINS: 157
|
||||
*
|
||||
* OBJECT CODE ONLY SOURCE MATERIALS
|
||||
*/
|
||||
/*-----------------------------------------------------------------------
|
||||
cotype.c -- db_VISTA owner type module.
|
||||
|
||||
(C) Copyright 1987 by Raima Corporation.
|
||||
-----------------------------------------------------------------------*/
|
||||
|
||||
/* ********************** EDIT HISTORY *******************************
|
||||
|
||||
SCR DATE INI DESCRIPTION
|
||||
----- --------- --- -----------------------------------------------------
|
||||
04-Aug-88 RTK MULTI_TASK changes
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include "vista.h"
|
||||
#include "dbtype.h"
|
||||
|
||||
|
||||
/* Get current owner type
|
||||
*/
|
||||
d_cotype(set, cotype TASK_PARM DBN_PARM)
|
||||
int set;
|
||||
int FAR *cotype;
|
||||
TASK_DECL
|
||||
DBN_DECL
|
||||
{
|
||||
char FAR *orec;
|
||||
INT crt;
|
||||
#ifndef SINGLE_USER
|
||||
int dbopen_sv;
|
||||
#endif
|
||||
SET_ENTRY FAR *set_ptr;
|
||||
|
||||
DB_ENTER(DB_ID TASK_ID LOCK_SET(SET_IO));
|
||||
|
||||
if (nset_check(set, &set, (SET_ENTRY FAR * FAR *)&set_ptr) != S_OKAY)
|
||||
RETURN( db_status );
|
||||
|
||||
if ( ! curr_own[set] )
|
||||
RETURN( dberr( S_NOCO ) );
|
||||
|
||||
/* set up to allow unlocked read */
|
||||
#ifndef SINGLE_USER
|
||||
dbopen_sv = dbopen;
|
||||
dbopen = 2;
|
||||
#endif
|
||||
|
||||
/* Read current owner */
|
||||
dio_read(curr_own[set], (char FAR * FAR *)&orec, NOPGHOLD);
|
||||
#ifndef SINGLE_USER
|
||||
dbopen = dbopen_sv;
|
||||
#endif
|
||||
if (db_status != S_OKAY)
|
||||
RETURN( db_status );
|
||||
|
||||
/* Fetch record type from record header */
|
||||
bytecpy(&crt, orec, sizeof(INT));
|
||||
crt &= ~RLBMASK; /* mask off rlb */
|
||||
*cotype = (int)crt + RECMARK;
|
||||
|
||||
RETURN( db_status );
|
||||
}
|
||||
/* vpp -nOS2 -dUNIX -nBSD -nVANILLA_BSD -nVMS -nMEMLOCK -nWINDOWS -nFAR_ALLOC -f/usr/users/master/config/nonwin cotype.c */
|
||||
46
cde/lib/DtSearch/raima/crget.c
Normal file
46
cde/lib/DtSearch/raima/crget.c
Normal file
@@ -0,0 +1,46 @@
|
||||
/* $XConsortium: crget.c /main/2 1996/05/09 03:57:29 drk $ */
|
||||
/*
|
||||
* COMPONENT_NAME: austext
|
||||
*
|
||||
* FUNCTIONS: d_crget
|
||||
*
|
||||
* ORIGINS: 157
|
||||
*
|
||||
* OBJECT CODE ONLY SOURCE MATERIALS
|
||||
*/
|
||||
/*-----------------------------------------------------------------------
|
||||
crget.c -- db_VISTA current record database address get module.
|
||||
|
||||
(C) Copyright 1987 by Raima Corporation.
|
||||
-----------------------------------------------------------------------*/
|
||||
|
||||
/* ********************** EDIT HISTORY *******************************
|
||||
|
||||
SCR DATE INI DESCRIPTION
|
||||
----- --------- --- -----------------------------------------------------
|
||||
04-Aug-88 RTK MULTI_TASK changes
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include "vista.h"
|
||||
#include "dbtype.h"
|
||||
|
||||
/* Get current record
|
||||
*/
|
||||
d_crget(dba TASK_PARM DBN_PARM)
|
||||
DB_ADDR FAR *dba; /* db address of record to become current */
|
||||
TASK_DECL
|
||||
DBN_DECL
|
||||
{
|
||||
DB_ENTER(DB_ID TASK_ID LOCK_SET(RECORD_NOIO));
|
||||
|
||||
if ( ! dbopen ) RETURN( dberr(S_DBOPEN) );
|
||||
|
||||
if ( *dba = curr_rec )
|
||||
db_status = S_OKAY;
|
||||
else
|
||||
db_status = S_NOCR;
|
||||
|
||||
RETURN( db_status );
|
||||
}
|
||||
/* vpp -nOS2 -dUNIX -nBSD -nVANILLA_BSD -nVMS -nMEMLOCK -nWINDOWS -nFAR_ALLOC -f/usr/users/master/config/nonwin crget.c */
|
||||
70
cde/lib/DtSearch/raima/crread.c
Normal file
70
cde/lib/DtSearch/raima/crread.c
Normal file
@@ -0,0 +1,70 @@
|
||||
/* $XConsortium: crread.c /main/2 1996/05/09 03:57:43 drk $ */
|
||||
/*
|
||||
* COMPONENT_NAME: austext
|
||||
*
|
||||
* FUNCTIONS: d_crread
|
||||
*
|
||||
* ORIGINS: 157
|
||||
*
|
||||
* OBJECT CODE ONLY SOURCE MATERIALS
|
||||
*/
|
||||
/*-----------------------------------------------------------------------
|
||||
crread.c -- db_VISTA current record field read module.
|
||||
|
||||
(C) Copyright 1987 by Raima Corporation.
|
||||
-----------------------------------------------------------------------*/
|
||||
|
||||
/* ********************** EDIT HISTORY *******************************
|
||||
|
||||
SCR DATE INI DESCRIPTION
|
||||
----- --------- --- -----------------------------------------------------
|
||||
04-Aug-88 RTK MULTI_TASK changes
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include "vista.h"
|
||||
#include "dbtype.h"
|
||||
|
||||
|
||||
/* Read data from field of current record
|
||||
*/
|
||||
d_crread(field, data TASK_PARM DBN_PARM)
|
||||
long field; /* Field constant */
|
||||
char FAR *data; /* Data area to contain field contents */
|
||||
TASK_DECL
|
||||
DBN_DECL /* database number */
|
||||
{
|
||||
int fld, rec;
|
||||
#ifndef SINGLE_USER
|
||||
int dbopen_sv;
|
||||
#endif
|
||||
RECORD_ENTRY FAR *rec_ptr;
|
||||
FIELD_ENTRY FAR *fld_ptr;
|
||||
|
||||
DB_ENTER(DB_ID TASK_ID LOCK_SET(RECORD_IO));
|
||||
|
||||
if (nfld_check(field, &rec, &fld, (RECORD_ENTRY FAR * FAR *)&rec_ptr, (FIELD_ENTRY FAR * FAR *)&fld_ptr) != S_OKAY)
|
||||
RETURN( db_status );
|
||||
|
||||
/* Make sure we have a current record */
|
||||
if ( ! curr_rec )
|
||||
RETURN( dberr(S_NOCR) );
|
||||
|
||||
/* set up to allow unlocked read */
|
||||
#ifndef SINGLE_USER
|
||||
dbopen_sv = dbopen;
|
||||
dbopen = 2;
|
||||
#endif
|
||||
|
||||
/* Read current record */
|
||||
dio_read( curr_rec, (char FAR * FAR *)&crloc , NOPGHOLD);
|
||||
#ifndef SINGLE_USER
|
||||
dbopen = dbopen_sv;
|
||||
#endif
|
||||
if (db_status != S_OKAY)
|
||||
RETURN( db_status );
|
||||
|
||||
/* Get data from record and return */
|
||||
RETURN( r_gfld(fld_ptr, crloc, data) );
|
||||
}
|
||||
/* vpp -nOS2 -dUNIX -nBSD -nVANILLA_BSD -nVMS -nMEMLOCK -nWINDOWS -nFAR_ALLOC -f/usr/users/master/config/nonwin crread.c */
|
||||
48
cde/lib/DtSearch/raima/crset.c
Normal file
48
cde/lib/DtSearch/raima/crset.c
Normal file
@@ -0,0 +1,48 @@
|
||||
/* $XConsortium: crset.c /main/2 1996/05/09 03:57:56 drk $ */
|
||||
/*
|
||||
* COMPONENT_NAME: austext
|
||||
*
|
||||
* FUNCTIONS: d_crset
|
||||
*
|
||||
* ORIGINS: 157
|
||||
*
|
||||
* OBJECT CODE ONLY SOURCE MATERIALS
|
||||
*/
|
||||
/*-----------------------------------------------------------------------
|
||||
crset.c -- db_VISTA current record database address set module.
|
||||
|
||||
(C) Copyright 1987 by Raima Corporation.
|
||||
-----------------------------------------------------------------------*/
|
||||
|
||||
/* ********************** EDIT HISTORY *******************************
|
||||
|
||||
SCR DATE INI DESCRIPTION
|
||||
----- --------- --- -----------------------------------------------------
|
||||
04-Aug-88 RTK MULTI_TASK changes
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include "vista.h"
|
||||
#include "dbtype.h"
|
||||
|
||||
/* Set current record
|
||||
*/
|
||||
d_crset(dba TASK_PARM DBN_PARM)
|
||||
DB_ADDR FAR *dba; /* db address of record to become current */
|
||||
TASK_DECL
|
||||
DBN_DECL
|
||||
{
|
||||
DB_ENTER(DB_ID TASK_ID LOCK_SET(RECORD_IO));
|
||||
|
||||
if ( ! dbopen ) RETURN( dberr(S_DBOPEN) );
|
||||
|
||||
if ( dba == NULL ) {
|
||||
curr_rec = NULL_DBA;
|
||||
db_status = S_OKAY;
|
||||
}
|
||||
else if ( check_dba(*dba) == S_OKAY )
|
||||
curr_rec = *dba;
|
||||
|
||||
RETURN( db_status );
|
||||
}
|
||||
/* vpp -nOS2 -dUNIX -nBSD -nVANILLA_BSD -nVMS -nMEMLOCK -nWINDOWS -nFAR_ALLOC -f/usr/users/master/config/nonwin crset.c */
|
||||
53
cde/lib/DtSearch/raima/crstat.c
Normal file
53
cde/lib/DtSearch/raima/crstat.c
Normal file
@@ -0,0 +1,53 @@
|
||||
/* $XConsortium: crstat.c /main/2 1996/05/09 03:58:12 drk $ */
|
||||
/*
|
||||
* COMPONENT_NAME: austext
|
||||
*
|
||||
* FUNCTIONS: d_crstat
|
||||
*
|
||||
* ORIGINS: 157
|
||||
*
|
||||
* OBJECT CODE ONLY SOURCE MATERIALS
|
||||
*/
|
||||
/*-----------------------------------------------------------------------
|
||||
crstat.c -- db_VISTA current record timestamp status check module.
|
||||
|
||||
(C) Copyright 1987 by Raima Corporation.
|
||||
-----------------------------------------------------------------------*/
|
||||
|
||||
/* ********************** EDIT HISTORY *******************************
|
||||
|
||||
SCR DATE INI DESCRIPTION
|
||||
----- --------- --- -----------------------------------------------------
|
||||
04-Aug-88 RTK MULTI_TASK changes
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include "vista.h"
|
||||
#include "dbtype.h"
|
||||
|
||||
|
||||
#ifndef NO_TIMESTAMP
|
||||
/* Test timestamp status of current record
|
||||
*/
|
||||
d_crstat(TASK_ONLY)
|
||||
TASK_DECL
|
||||
{
|
||||
ULONG cts, uts;
|
||||
|
||||
DB_ENTER(NO_DB_ID TASK_ID LOCK_SET(RECORD_IO));
|
||||
|
||||
if ( d_ctscr(&cts TASK_PARM) == S_OKAY ) {
|
||||
if ( cts ) {
|
||||
d_utscr(&uts TASK_PARM);
|
||||
if ( cts > cr_time )
|
||||
db_status = S_DELETED;
|
||||
else if ( uts > cr_time )
|
||||
db_status = S_UPDATED;
|
||||
}
|
||||
else
|
||||
dberr(S_TIMESTAMP);
|
||||
}
|
||||
RETURN( db_status );
|
||||
}
|
||||
#endif
|
||||
/* vpp -nOS2 -dUNIX -nBSD -nVANILLA_BSD -nVMS -nMEMLOCK -nWINDOWS -nFAR_ALLOC -f/usr/users/master/config/nonwin crstat.c */
|
||||
68
cde/lib/DtSearch/raima/crtype.c
Normal file
68
cde/lib/DtSearch/raima/crtype.c
Normal file
@@ -0,0 +1,68 @@
|
||||
/* $XConsortium: crtype.c /main/2 1996/05/09 03:58:25 drk $ */
|
||||
/*
|
||||
* COMPONENT_NAME: austext
|
||||
*
|
||||
* FUNCTIONS: d_crtype
|
||||
*
|
||||
* ORIGINS: 157
|
||||
*
|
||||
* OBJECT CODE ONLY SOURCE MATERIALS
|
||||
*/
|
||||
/*-----------------------------------------------------------------------
|
||||
crtype.c -- db_VISTA current record type module.
|
||||
|
||||
(C) Copyright 1987 by Raima Corporation.
|
||||
-----------------------------------------------------------------------*/
|
||||
|
||||
/* ********************** EDIT HISTORY *******************************
|
||||
|
||||
SCR DATE INI DESCRIPTION
|
||||
----- --------- --- -----------------------------------------------------
|
||||
04-Aug-88 RTK MULTI_TASK changes
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include "vista.h"
|
||||
#include "dbtype.h"
|
||||
|
||||
/* Get current record type
|
||||
*/
|
||||
d_crtype(crtype TASK_PARM DBN_PARM)
|
||||
int FAR *crtype;
|
||||
TASK_DECL
|
||||
DBN_DECL
|
||||
{
|
||||
INT crt;
|
||||
#ifndef SINGLE_USER
|
||||
int dbopen_sv;
|
||||
#endif
|
||||
|
||||
DB_ENTER(DB_ID TASK_ID LOCK_SET(RECORD_IO));
|
||||
|
||||
if ( ! dbopen ) RETURN( dberr(S_DBOPEN) );
|
||||
|
||||
if ( ! curr_rec )
|
||||
RETURN( dberr( S_NOCR ) );
|
||||
|
||||
/* set up to allow unlocked read */
|
||||
#ifndef SINGLE_USER
|
||||
dbopen_sv = dbopen;
|
||||
dbopen = 2;
|
||||
#endif
|
||||
|
||||
/* Read current record */
|
||||
dio_read(curr_rec, (char FAR * FAR *)&crloc, NOPGHOLD);
|
||||
#ifndef SINGLE_USER
|
||||
dbopen = dbopen_sv;
|
||||
#endif
|
||||
if (db_status != S_OKAY)
|
||||
RETURN( db_status );
|
||||
|
||||
/* Fetch record type from record header */
|
||||
bytecpy(&crt, crloc, sizeof(INT));
|
||||
crt &= ~RLBMASK; /* mask off rlb */
|
||||
*crtype = (int)crt + RECMARK;
|
||||
|
||||
RETURN( db_status = S_OKAY );
|
||||
}
|
||||
/* vpp -nOS2 -dUNIX -nBSD -nVANILLA_BSD -nVMS -nMEMLOCK -nWINDOWS -nFAR_ALLOC -f/usr/users/master/config/nonwin crtype.c */
|
||||
87
cde/lib/DtSearch/raima/crwrite.c
Normal file
87
cde/lib/DtSearch/raima/crwrite.c
Normal file
@@ -0,0 +1,87 @@
|
||||
/* $XConsortium: crwrite.c /main/2 1996/05/09 03:58:39 drk $ */
|
||||
/*
|
||||
* COMPONENT_NAME: austext
|
||||
*
|
||||
* FUNCTIONS: d_crwrite
|
||||
*
|
||||
* ORIGINS: 157
|
||||
*
|
||||
* OBJECT CODE ONLY SOURCE MATERIALS
|
||||
*/
|
||||
/*-----------------------------------------------------------------------
|
||||
crwrite.c -- db_VISTA current record field write module.
|
||||
|
||||
(C) Copyright 1987 by Raima Corporation.
|
||||
-----------------------------------------------------------------------*/
|
||||
|
||||
/* ********************** EDIT HISTORY *******************************
|
||||
|
||||
SCR DATE INI DESCRIPTION
|
||||
----- --------- --- -----------------------------------------------------
|
||||
04-Aug-88 RTK MULTI_TASK changes
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include "vista.h"
|
||||
#include "dbtype.h"
|
||||
|
||||
|
||||
/* Write data to a field in the current record
|
||||
*/
|
||||
d_crwrite(field, data TASK_PARM DBN_PARM)
|
||||
long field; /* field constant */
|
||||
char FAR *data; /* data area to contain field contents */
|
||||
TASK_DECL
|
||||
DBN_DECL /* database number */
|
||||
{
|
||||
#ifndef NO_TIMESTAMP
|
||||
ULONG timestamp;
|
||||
#endif
|
||||
int stat, fld, rec;
|
||||
RECORD_ENTRY FAR *rec_ptr;
|
||||
FIELD_ENTRY FAR *fld_ptr;
|
||||
|
||||
DB_ENTER(DB_ID TASK_ID LOCK_SET(SET_IO));
|
||||
|
||||
if (nfld_check(field, &rec, &fld, (RECORD_ENTRY FAR * FAR *)&rec_ptr, (FIELD_ENTRY FAR * FAR *)&fld_ptr) != S_OKAY)
|
||||
RETURN( db_status );
|
||||
|
||||
/* compound keys cannot be updated directly */
|
||||
if ( fld_ptr->fd_type == COMKEY )
|
||||
RETURN( dberr(S_ISCOMKEY) );
|
||||
|
||||
/* field used in compound keys cannot be updated directly */
|
||||
if ( fld_ptr->fd_flags & COMKEYED )
|
||||
RETURN( dberr(S_COMKEY) );
|
||||
|
||||
/* Make sure we have a current record */
|
||||
if ( ! curr_rec )
|
||||
RETURN( dberr(S_NOCR) );
|
||||
|
||||
/* Read current record */
|
||||
if ( dio_read( curr_rec, (char FAR * FAR *)&crloc , PGHOLD) != S_OKAY )
|
||||
RETURN( db_status );
|
||||
|
||||
/* check out the field */
|
||||
if ( (stat = r_chkfld(fld, fld_ptr, crloc, data)) != S_OKAY ) {
|
||||
dio_release(curr_rec);
|
||||
RETURN( db_status = stat );
|
||||
}
|
||||
/* put data into record and return */
|
||||
if ( r_pfld(fld, fld_ptr, crloc, data, &curr_rec) != S_OKAY )
|
||||
RETURN( db_status );
|
||||
#ifndef NO_TIMESTAMP
|
||||
/* check for timestamp */
|
||||
if ( rec_ptr->rt_flags & TIMESTAMPED ) {
|
||||
timestamp = dio_pzgetts(rec_ptr->rt_file);
|
||||
bytecpy( crloc + RECUPTIME, ×tamp, sizeof(LONG));
|
||||
}
|
||||
#endif
|
||||
dio_write(curr_rec, NULL, PGFREE);
|
||||
#ifndef NO_TIMESTAMP
|
||||
if (( db_status == S_OKAY ) && ( rec_ptr->rt_flags & TIMESTAMPED ))
|
||||
cr_time = timestamp;
|
||||
#endif
|
||||
RETURN( db_status );
|
||||
}
|
||||
/* vpp -nOS2 -dUNIX -nBSD -nVANILLA_BSD -nVMS -nMEMLOCK -nWINDOWS -nFAR_ALLOC -f/usr/users/master/config/nonwin crwrite.c */
|
||||
48
cde/lib/DtSearch/raima/csmget.c
Normal file
48
cde/lib/DtSearch/raima/csmget.c
Normal file
@@ -0,0 +1,48 @@
|
||||
/* $XConsortium: csmget.c /main/2 1996/05/09 03:58:53 drk $ */
|
||||
/*
|
||||
* COMPONENT_NAME: austext
|
||||
*
|
||||
* FUNCTIONS: d_csmget
|
||||
*
|
||||
* ORIGINS: 157
|
||||
*
|
||||
* OBJECT CODE ONLY SOURCE MATERIALS
|
||||
*/
|
||||
/*-----------------------------------------------------------------------
|
||||
csmget.c -- db_VISTA current set member database address get module.
|
||||
|
||||
(C) Copyright 1987 by Raima Corporation.
|
||||
-----------------------------------------------------------------------*/
|
||||
|
||||
/* ********************** EDIT HISTORY *******************************
|
||||
|
||||
SCR DATE INI DESCRIPTION
|
||||
----- --------- --- -----------------------------------------------------
|
||||
04-Aug-88 RTK MULTI_TASK changes
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include "vista.h"
|
||||
#include "dbtype.h"
|
||||
|
||||
/* Get current set member
|
||||
*/
|
||||
d_csmget(set, dba TASK_PARM DBN_PARM)
|
||||
int set; /* Set table entry */
|
||||
DB_ADDR FAR *dba; /* db address of record to become current */
|
||||
TASK_DECL
|
||||
DBN_DECL /* database number */
|
||||
{
|
||||
SET_ENTRY FAR *set_ptr;
|
||||
|
||||
DB_ENTER(DB_ID TASK_ID LOCK_SET(SET_NOIO));
|
||||
|
||||
if (nset_check(set, &set, (SET_ENTRY FAR * FAR *)&set_ptr) != S_OKAY)
|
||||
RETURN( db_status );
|
||||
|
||||
if ( ! (*dba = curr_mem[set]) )
|
||||
db_status = S_NOCM;
|
||||
|
||||
RETURN( db_status );
|
||||
}
|
||||
/* vpp -nOS2 -dUNIX -nBSD -nVANILLA_BSD -nVMS -nMEMLOCK -nWINDOWS -nFAR_ALLOC -f/usr/users/master/config/nonwin csmget.c */
|
||||
74
cde/lib/DtSearch/raima/csmread.c
Normal file
74
cde/lib/DtSearch/raima/csmread.c
Normal file
@@ -0,0 +1,74 @@
|
||||
/* $XConsortium: csmread.c /main/2 1996/05/09 03:59:07 drk $ */
|
||||
/*
|
||||
* COMPONENT_NAME: austext
|
||||
*
|
||||
* FUNCTIONS: d_csmread
|
||||
*
|
||||
* ORIGINS: 157
|
||||
*
|
||||
* OBJECT CODE ONLY SOURCE MATERIALS
|
||||
*/
|
||||
/*-----------------------------------------------------------------------
|
||||
csmread.c -- db_VISTA current set member field read module.
|
||||
|
||||
(C) Copyright 1987 by Raima Corporation.
|
||||
-----------------------------------------------------------------------*/
|
||||
|
||||
/* ********************** EDIT HISTORY *******************************
|
||||
|
||||
SCR DATE INI DESCRIPTION
|
||||
----- --------- --- -----------------------------------------------------
|
||||
04-Aug-88 RTK MULTI_TASK changes
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include "vista.h"
|
||||
#include "dbtype.h"
|
||||
|
||||
|
||||
/* Read data from field of current set member
|
||||
*/
|
||||
d_csmread(set, field, data TASK_PARM DBN_PARM)
|
||||
int set; /* Set constant */
|
||||
long field; /* Field constant */
|
||||
char FAR *data; /* Data area to contain field contents */
|
||||
TASK_DECL
|
||||
DBN_DECL /* database number */
|
||||
{
|
||||
int fld, rec;
|
||||
#ifndef SINGLE_USER
|
||||
int dbopen_sv;
|
||||
#endif
|
||||
char FAR *recp;
|
||||
SET_ENTRY FAR *set_ptr;
|
||||
RECORD_ENTRY FAR *rec_ptr;
|
||||
FIELD_ENTRY FAR *fld_ptr;
|
||||
|
||||
DB_ENTER(DB_ID TASK_ID LOCK_SET(SET_IO));
|
||||
|
||||
if ((nset_check(set, &set, (SET_ENTRY FAR * FAR *)&set_ptr) != S_OKAY) ||
|
||||
(nfld_check(field, &rec, &fld, (RECORD_ENTRY FAR * FAR *)&rec_ptr, (FIELD_ENTRY FAR * FAR *)&fld_ptr) != S_OKAY))
|
||||
RETURN( db_status );
|
||||
|
||||
/* Make sure we have a current member */
|
||||
if ( ! curr_mem[set] )
|
||||
RETURN( dberr(S_NOCM) );
|
||||
|
||||
/* set up to allow unlocked read */
|
||||
#ifndef SINGLE_USER
|
||||
dbopen_sv = dbopen;
|
||||
dbopen = 2;
|
||||
#endif
|
||||
|
||||
/* Read current member */
|
||||
dio_read( curr_mem[set], (char FAR * FAR *)&recp , NOPGHOLD);
|
||||
#ifndef SINGLE_USER
|
||||
dbopen = dbopen_sv;
|
||||
#endif
|
||||
if (db_status != S_OKAY)
|
||||
RETURN( db_status );
|
||||
|
||||
/* Get data from record and return */
|
||||
RETURN( r_gfld(fld_ptr, recp, data) );
|
||||
}
|
||||
/* vpp -nOS2 -dUNIX -nBSD -nVANILLA_BSD -nVMS -nMEMLOCK -nWINDOWS -nFAR_ALLOC -f/usr/users/master/config/nonwin csmread.c */
|
||||
70
cde/lib/DtSearch/raima/csmset.c
Normal file
70
cde/lib/DtSearch/raima/csmset.c
Normal file
@@ -0,0 +1,70 @@
|
||||
/* $XConsortium: csmset.c /main/2 1996/05/09 03:59:23 drk $ */
|
||||
/*
|
||||
* COMPONENT_NAME: austext
|
||||
*
|
||||
* FUNCTIONS: d_csmset
|
||||
*
|
||||
* ORIGINS: 157
|
||||
*
|
||||
* OBJECT CODE ONLY SOURCE MATERIALS
|
||||
*/
|
||||
/*-----------------------------------------------------------------------
|
||||
csmset.c -- db_VISTA current set member database address set module.
|
||||
|
||||
(C) Copyright 1987 by Raima Corporation.
|
||||
-----------------------------------------------------------------------*/
|
||||
|
||||
/* ********************** EDIT HISTORY *******************************
|
||||
|
||||
SCR DATE INI DESCRIPTION
|
||||
----- --------- --- -----------------------------------------------------
|
||||
04-Aug-88 RTK MULTI_TASK changes
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include "vista.h"
|
||||
#include "dbtype.h"
|
||||
|
||||
/* Set current set member
|
||||
*/
|
||||
d_csmset(set, dba TASK_PARM DBN_PARM)
|
||||
int set; /* Set table entry */
|
||||
DB_ADDR FAR *dba; /* db address of record to become current */
|
||||
TASK_DECL
|
||||
DBN_DECL /* database number */
|
||||
{
|
||||
INT type;
|
||||
char FAR *ptr;
|
||||
SET_ENTRY FAR *set_ptr;
|
||||
MEMBER_ENTRY FAR *mem_ptr;
|
||||
int mem, memtot;
|
||||
|
||||
DB_ENTER(DB_ID TASK_ID LOCK_SET(SET_IO));
|
||||
|
||||
if (nset_check(set, &set, (SET_ENTRY FAR * FAR *)&set_ptr) != S_OKAY)
|
||||
RETURN( db_status );
|
||||
|
||||
if ( dba == NULL ) {
|
||||
curr_mem[set] = NULL_DBA;
|
||||
}
|
||||
else if ( check_dba(*dba) == S_OKAY ) {
|
||||
/* get the record type */
|
||||
if ( dio_read( *dba, (char FAR * FAR *)&ptr, NOPGHOLD ) ) RETURN( db_status );
|
||||
bytecpy( &type, ptr, sizeof(INT) );
|
||||
type &= ~RLBMASK;
|
||||
#ifndef ONE_DB
|
||||
type += curr_db_table->rt_offset;
|
||||
#endif
|
||||
|
||||
for (mem = set_ptr->st_members, memtot = mem + set_ptr->st_memtot,
|
||||
mem_ptr = &member_table[mem];
|
||||
mem < memtot;
|
||||
++mem, ++mem_ptr) {
|
||||
if (mem_ptr->mt_record == type)
|
||||
RETURN( r_smem(dba, set) );
|
||||
}
|
||||
dberr( S_INVMEM );
|
||||
}
|
||||
RETURN( db_status );
|
||||
}
|
||||
/* vpp -nOS2 -dUNIX -nBSD -nVANILLA_BSD -nVMS -nMEMLOCK -nWINDOWS -nFAR_ALLOC -f/usr/users/master/config/nonwin csmset.c */
|
||||
92
cde/lib/DtSearch/raima/csmwrite.c
Normal file
92
cde/lib/DtSearch/raima/csmwrite.c
Normal file
@@ -0,0 +1,92 @@
|
||||
/* $XConsortium: csmwrite.c /main/2 1996/05/09 03:59:37 drk $ */
|
||||
/*
|
||||
* COMPONENT_NAME: austext
|
||||
*
|
||||
* FUNCTIONS: d_csmwrite
|
||||
*
|
||||
* ORIGINS: 157
|
||||
*
|
||||
* OBJECT CODE ONLY SOURCE MATERIALS
|
||||
*/
|
||||
/*-----------------------------------------------------------------------
|
||||
csmwrite.c -- db_VISTA current set member field write module.
|
||||
|
||||
(C) Copyright 1987 by Raima Corporation.
|
||||
-----------------------------------------------------------------------*/
|
||||
|
||||
/* ********************** EDIT HISTORY *******************************
|
||||
|
||||
SCR DATE INI DESCRIPTION
|
||||
----- --------- --- -----------------------------------------------------
|
||||
04-Aug-88 RTK MULTI_TASK changes
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include "vista.h"
|
||||
#include "dbtype.h"
|
||||
|
||||
|
||||
/* Write data to a field in the current set member
|
||||
*/
|
||||
d_csmwrite(set, field, data TASK_PARM DBN_PARM)
|
||||
int set; /* Set constant */
|
||||
long field; /* Field constant */
|
||||
CONST char FAR *data; /* Data area to contain field contents */
|
||||
TASK_DECL
|
||||
DBN_DECL /* database number */
|
||||
{
|
||||
#ifndef NO_TIMESTAMP
|
||||
ULONG timestamp;
|
||||
#endif
|
||||
int stat, fld, rec;
|
||||
char FAR *recp;
|
||||
SET_ENTRY FAR *set_ptr;
|
||||
RECORD_ENTRY FAR *rec_ptr;
|
||||
FIELD_ENTRY FAR *fld_ptr;
|
||||
DB_ADDR FAR *cm_ptr;
|
||||
|
||||
DB_ENTER(DB_ID TASK_ID LOCK_SET(SET_IO));
|
||||
|
||||
if ((nset_check(set, &set, (SET_ENTRY FAR * FAR *)&set_ptr) != S_OKAY) ||
|
||||
(nfld_check(field, &rec, &fld, (RECORD_ENTRY FAR * FAR *)&rec_ptr, (FIELD_ENTRY FAR * FAR *)&fld_ptr) != S_OKAY))
|
||||
RETURN( db_status );
|
||||
|
||||
/* compound keys cannot be updated directly */
|
||||
if ( fld_ptr->fd_type == COMKEY )
|
||||
RETURN( dberr(S_ISCOMKEY) );
|
||||
|
||||
/* field used in compound keys cannot be updated directly */
|
||||
if ( fld_ptr->fd_flags & COMKEYED )
|
||||
RETURN( dberr(S_COMKEY) );
|
||||
|
||||
/* Make sure we have a current member */
|
||||
if ( ! *(cm_ptr = &curr_mem[set]) )
|
||||
RETURN( dberr(S_NOCM) );
|
||||
|
||||
/* Read current member */
|
||||
if ( dio_read( *cm_ptr, (char FAR * FAR *)&recp , PGHOLD) != S_OKAY )
|
||||
RETURN( db_status );
|
||||
|
||||
/* check out the field */
|
||||
if ( (stat = r_chkfld(fld, fld_ptr, recp, data)) != S_OKAY ) {
|
||||
dio_release(*cm_ptr);
|
||||
RETURN( db_status = stat );
|
||||
}
|
||||
/* Put data into record */
|
||||
if ( r_pfld(fld, fld_ptr, recp, data, cm_ptr) != S_OKAY )
|
||||
RETURN( db_status );
|
||||
#ifndef NO_TIMESTAMP
|
||||
/* check for timestamp */
|
||||
if ( rec_ptr->rt_flags & TIMESTAMPED ) {
|
||||
timestamp = dio_pzgetts(rec_ptr->rt_file);
|
||||
bytecpy( recp + RECUPTIME, ×tamp, sizeof(LONG));
|
||||
}
|
||||
#endif
|
||||
dio_write(*cm_ptr, NULL, PGFREE);
|
||||
#ifndef NO_TIMESTAMP
|
||||
if (( db_status == S_OKAY ) && ( rec_ptr->rt_flags & TIMESTAMPED ))
|
||||
cm_time[set] = timestamp;
|
||||
#endif
|
||||
RETURN( db_status );
|
||||
}
|
||||
/* vpp -nOS2 -dUNIX -nBSD -nVANILLA_BSD -nVMS -nMEMLOCK -nWINDOWS -nFAR_ALLOC -f/usr/users/master/config/nonwin csmwrite.c */
|
||||
49
cde/lib/DtSearch/raima/csoget.c
Normal file
49
cde/lib/DtSearch/raima/csoget.c
Normal file
@@ -0,0 +1,49 @@
|
||||
/* $XConsortium: csoget.c /main/2 1996/05/09 03:59:50 drk $ */
|
||||
/*
|
||||
* COMPONENT_NAME: austext
|
||||
*
|
||||
* FUNCTIONS: d_csoget
|
||||
*
|
||||
* ORIGINS: 157
|
||||
*
|
||||
* OBJECT CODE ONLY SOURCE MATERIALS
|
||||
*/
|
||||
/*-----------------------------------------------------------------------
|
||||
csoget.c -- db_VISTA current set owner database address get module.
|
||||
|
||||
(C) Copyright 1987 by Raima Corporation.
|
||||
-----------------------------------------------------------------------*/
|
||||
|
||||
/* ********************** EDIT HISTORY *******************************
|
||||
|
||||
SCR DATE INI DESCRIPTION
|
||||
----- --------- --- -----------------------------------------------------
|
||||
04-Aug-88 RTK MULTI_TASK changes
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include "vista.h"
|
||||
#include "dbtype.h"
|
||||
|
||||
|
||||
/* Get current set owner
|
||||
*/
|
||||
d_csoget(set, dba TASK_PARM DBN_PARM)
|
||||
int set; /* Set table entry */
|
||||
DB_ADDR FAR *dba; /* db address of record to become current */
|
||||
TASK_DECL
|
||||
DBN_DECL /* database number */
|
||||
{
|
||||
SET_ENTRY FAR *set_ptr;
|
||||
|
||||
DB_ENTER(DB_ID TASK_ID LOCK_SET(SET_NOIO));
|
||||
|
||||
if (nset_check(set, &set, (SET_ENTRY FAR * FAR *)&set_ptr) != S_OKAY)
|
||||
RETURN( db_status );
|
||||
|
||||
if ( ! (*dba = curr_own[set]) )
|
||||
db_status = S_NOCO;
|
||||
|
||||
RETURN( db_status );
|
||||
}
|
||||
/* vpp -nOS2 -dUNIX -nBSD -nVANILLA_BSD -nVMS -nMEMLOCK -nWINDOWS -nFAR_ALLOC -f/usr/users/master/config/nonwin csoget.c */
|
||||
74
cde/lib/DtSearch/raima/csoread.c
Normal file
74
cde/lib/DtSearch/raima/csoread.c
Normal file
@@ -0,0 +1,74 @@
|
||||
/* $XConsortium: csoread.c /main/2 1996/05/09 04:00:07 drk $ */
|
||||
/*
|
||||
* COMPONENT_NAME: austext
|
||||
*
|
||||
* FUNCTIONS: d_csoread
|
||||
*
|
||||
* ORIGINS: 157
|
||||
*
|
||||
* OBJECT CODE ONLY SOURCE MATERIALS
|
||||
*/
|
||||
/*-----------------------------------------------------------------------
|
||||
csoread.c -- db_VISTA current set owner field read module.
|
||||
|
||||
(C) Copyright 1987 by Raima Corporation.
|
||||
-----------------------------------------------------------------------*/
|
||||
|
||||
/* ********************** EDIT HISTORY *******************************
|
||||
|
||||
SCR DATE INI DESCRIPTION
|
||||
----- --------- --- -----------------------------------------------------
|
||||
04-Aug-88 RTK MULTI_TASK changes
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include "vista.h"
|
||||
#include "dbtype.h"
|
||||
|
||||
|
||||
/* Read data from field of current set owner
|
||||
*/
|
||||
d_csoread(set, field, data TASK_PARM DBN_PARM)
|
||||
int set; /* Set constant */
|
||||
long field; /* Field constant */
|
||||
char FAR *data; /* Data area to contain field contents */
|
||||
TASK_DECL
|
||||
DBN_DECL /* database number */
|
||||
{
|
||||
int fld, rec;
|
||||
#ifndef SINGLE_USER
|
||||
int dbopen_sv;
|
||||
#endif
|
||||
char FAR *recp;
|
||||
SET_ENTRY FAR *set_ptr;
|
||||
RECORD_ENTRY FAR *rec_ptr;
|
||||
FIELD_ENTRY FAR *fld_ptr;
|
||||
|
||||
DB_ENTER(DB_ID TASK_ID LOCK_SET(SET_IO));
|
||||
|
||||
if ((nset_check(set, &set, (SET_ENTRY FAR * FAR *)&set_ptr) != S_OKAY) ||
|
||||
(nfld_check(field, &rec, &fld, (RECORD_ENTRY FAR * FAR *)&rec_ptr, (FIELD_ENTRY FAR * FAR *)&fld_ptr) != S_OKAY))
|
||||
RETURN( db_status );
|
||||
|
||||
/* Make sure we have a current owner */
|
||||
if ( ! curr_own[set] )
|
||||
RETURN( dberr(S_NOCO) );
|
||||
|
||||
/* set up to allow unlocked read */
|
||||
#ifndef SINGLE_USER
|
||||
dbopen_sv = dbopen;
|
||||
dbopen = 2;
|
||||
#endif
|
||||
|
||||
/* Read current owner */
|
||||
dio_read( curr_own[set], (char FAR * FAR *)&recp , NOPGHOLD);
|
||||
#ifndef SINGLE_USER
|
||||
dbopen = dbopen_sv;
|
||||
#endif
|
||||
if (db_status != S_OKAY)
|
||||
RETURN( db_status );
|
||||
|
||||
/* Get data from record and return */
|
||||
RETURN( r_gfld(fld_ptr, recp, data) );
|
||||
}
|
||||
/* vpp -nOS2 -dUNIX -nBSD -nVANILLA_BSD -nVMS -nMEMLOCK -nWINDOWS -nFAR_ALLOC -f/usr/users/master/config/nonwin csoread.c */
|
||||
66
cde/lib/DtSearch/raima/csoset.c
Normal file
66
cde/lib/DtSearch/raima/csoset.c
Normal file
@@ -0,0 +1,66 @@
|
||||
/* $XConsortium: csoset.c /main/2 1996/05/09 04:00:24 drk $ */
|
||||
/*
|
||||
* COMPONENT_NAME: austext
|
||||
*
|
||||
* FUNCTIONS: d_csoset
|
||||
*
|
||||
* ORIGINS: 157
|
||||
*
|
||||
* OBJECT CODE ONLY SOURCE MATERIALS
|
||||
*/
|
||||
/*-----------------------------------------------------------------------
|
||||
csoset.c -- db_VISTA current set owner database address set module.
|
||||
|
||||
(C) Copyright 1987 by Raima Corporation.
|
||||
-----------------------------------------------------------------------*/
|
||||
|
||||
/* ********************** EDIT HISTORY *******************************
|
||||
|
||||
SCR DATE INI DESCRIPTION
|
||||
----- --------- --- -----------------------------------------------------
|
||||
04-Aug-88 RTK MULTI_TASK changes
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include "vista.h"
|
||||
#include "dbtype.h"
|
||||
|
||||
|
||||
/* Set current set owner
|
||||
*/
|
||||
d_csoset(set, dba TASK_PARM DBN_PARM)
|
||||
int set; /* Set table entry */
|
||||
DB_ADDR FAR *dba; /* db address of record to become current */
|
||||
TASK_DECL
|
||||
DBN_DECL /* database number */
|
||||
{
|
||||
INT type;
|
||||
char FAR *ptr;
|
||||
SET_ENTRY FAR *set_ptr;
|
||||
|
||||
DB_ENTER(DB_ID TASK_ID LOCK_SET(SET_IO));
|
||||
|
||||
if (nset_check(set, &set, (SET_ENTRY FAR * FAR *)&set_ptr) != S_OKAY)
|
||||
RETURN( db_status );
|
||||
|
||||
if ( dba == NULL ) {
|
||||
curr_own[set] = curr_mem[set] = NULL_DBA;
|
||||
}
|
||||
else if ( check_dba(*dba) == S_OKAY ) {
|
||||
/* get the record type */
|
||||
if ( dio_read( *dba, (char FAR * FAR *)&ptr , NOPGHOLD) ) RETURN( db_status );
|
||||
bytecpy( &type, ptr, sizeof(INT) );
|
||||
type &= ~RLBMASK;
|
||||
#ifndef ONE_DB
|
||||
type += curr_db_table->rt_offset;
|
||||
#endif
|
||||
|
||||
if (set_ptr->st_own_rt != type)
|
||||
RETURN( dberr( S_INVOWN ) );
|
||||
|
||||
curr_own[set] = *dba;
|
||||
curr_mem[set] = NULL_DBA;
|
||||
}
|
||||
RETURN( db_status );
|
||||
}
|
||||
/* vpp -nOS2 -dUNIX -nBSD -nVANILLA_BSD -nVMS -nMEMLOCK -nWINDOWS -nFAR_ALLOC -f/usr/users/master/config/nonwin csoset.c */
|
||||
92
cde/lib/DtSearch/raima/csowrite.c
Normal file
92
cde/lib/DtSearch/raima/csowrite.c
Normal file
@@ -0,0 +1,92 @@
|
||||
/* $XConsortium: csowrite.c /main/2 1996/05/09 04:00:40 drk $ */
|
||||
/*
|
||||
* COMPONENT_NAME: austext
|
||||
*
|
||||
* FUNCTIONS: d_csowrite
|
||||
*
|
||||
* ORIGINS: 157
|
||||
*
|
||||
* OBJECT CODE ONLY SOURCE MATERIALS
|
||||
*/
|
||||
/*-----------------------------------------------------------------------
|
||||
csowrite.c -- db_VISTA current set owner field write module.
|
||||
|
||||
(C) Copyright 1987 by Raima Corporation.
|
||||
-----------------------------------------------------------------------*/
|
||||
|
||||
/* ********************** EDIT HISTORY *******************************
|
||||
|
||||
SCR DATE INI DESCRIPTION
|
||||
----- --------- --- -----------------------------------------------------
|
||||
04-Aug-88 RTK MULTI_TASK changes
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include "vista.h"
|
||||
#include "dbtype.h"
|
||||
|
||||
|
||||
/* Write data to a field in the current set owner
|
||||
*/
|
||||
d_csowrite(set, field, data TASK_PARM DBN_PARM)
|
||||
int set; /* Set constant */
|
||||
long field; /* Field constant */
|
||||
CONST char FAR *data; /* Data area to contain field contents */
|
||||
TASK_DECL
|
||||
DBN_DECL /* database number */
|
||||
{
|
||||
#ifndef NO_TIMESTAMP
|
||||
ULONG timestamp;
|
||||
#endif
|
||||
int stat, fld, rec;
|
||||
char FAR *recp;
|
||||
SET_ENTRY FAR *set_ptr;
|
||||
RECORD_ENTRY FAR *rec_ptr;
|
||||
FIELD_ENTRY FAR *fld_ptr;
|
||||
DB_ADDR FAR *co_ptr;
|
||||
|
||||
DB_ENTER(DB_ID TASK_ID LOCK_SET(SET_IO));
|
||||
|
||||
if ((nset_check(set, &set, (SET_ENTRY FAR * FAR *)&set_ptr) != S_OKAY) ||
|
||||
(nfld_check(field, &rec, &fld, (RECORD_ENTRY FAR * FAR *)&rec_ptr, (FIELD_ENTRY FAR * FAR *)&fld_ptr) != S_OKAY))
|
||||
RETURN( db_status );
|
||||
|
||||
/* compound keys cannot be updated directly */
|
||||
if ( fld_ptr->fd_type == COMKEY )
|
||||
RETURN( dberr(S_ISCOMKEY) );
|
||||
|
||||
/* field used in compound keys cannot be updated directly */
|
||||
if ( fld_ptr->fd_flags & COMKEYED )
|
||||
RETURN( dberr(S_COMKEY) );
|
||||
|
||||
/* Make sure we have a current owner */
|
||||
if ( ! *(co_ptr = &curr_own[set]) )
|
||||
RETURN( dberr(S_NOCO) );
|
||||
|
||||
/* Read current owner */
|
||||
if ( dio_read( *co_ptr, (char FAR * FAR *)&recp , PGHOLD) != S_OKAY )
|
||||
RETURN( db_status );
|
||||
|
||||
/* check out the field */
|
||||
if ( (stat = r_chkfld(fld, fld_ptr, recp, data)) != S_OKAY ) {
|
||||
dio_release(*co_ptr);
|
||||
RETURN( db_status = stat );
|
||||
}
|
||||
/* Put data into record */
|
||||
if ( r_pfld(fld, fld_ptr, recp, data, co_ptr) != S_OKAY )
|
||||
RETURN( db_status );
|
||||
#ifndef NO_TIMESTAMP
|
||||
/* check for timestamp */
|
||||
if ( rec_ptr->rt_flags & TIMESTAMPED ) {
|
||||
timestamp = dio_pzgetts(rec_ptr->rt_file);
|
||||
bytecpy( recp + RECUPTIME, ×tamp, sizeof(LONG));
|
||||
}
|
||||
#endif
|
||||
dio_write(*co_ptr, (char FAR *)NULL, PGFREE);
|
||||
#ifndef NO_TIMESTAMP
|
||||
if (( db_status == S_OKAY ) && ( rec_ptr->rt_flags & TIMESTAMPED ))
|
||||
co_time[set] = timestamp;
|
||||
#endif
|
||||
RETURN( db_status );
|
||||
}
|
||||
/* vpp -nOS2 -dUNIX -nBSD -nVANILLA_BSD -nVMS -nMEMLOCK -nWINDOWS -nFAR_ALLOC -f/usr/users/master/config/nonwin csowrite.c */
|
||||
52
cde/lib/DtSearch/raima/csstat.c
Normal file
52
cde/lib/DtSearch/raima/csstat.c
Normal file
@@ -0,0 +1,52 @@
|
||||
/* $XConsortium: csstat.c /main/2 1996/05/09 04:00:57 drk $ */
|
||||
/*
|
||||
* COMPONENT_NAME: austext
|
||||
*
|
||||
* FUNCTIONS: d_csstat
|
||||
*
|
||||
* ORIGINS: 157
|
||||
*
|
||||
* OBJECT CODE ONLY SOURCE MATERIALS
|
||||
*/
|
||||
/*-----------------------------------------------------------------------
|
||||
csstat.c -- db_VISTA current set timestamp status check module.
|
||||
|
||||
(C) Copyright 1987 by Raima Corporation.
|
||||
-----------------------------------------------------------------------*/
|
||||
|
||||
/* ********************** EDIT HISTORY *******************************
|
||||
|
||||
SCR DATE INI DESCRIPTION
|
||||
----- --------- --- -----------------------------------------------------
|
||||
04-Aug-88 RTK MULTI_TASK changes
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include "vista.h"
|
||||
#include "dbtype.h"
|
||||
|
||||
|
||||
#ifndef NO_TIMESTAMP
|
||||
/* Test timestamp status of current set
|
||||
*/
|
||||
d_csstat(set TASK_PARM DBN_PARM)
|
||||
int set;
|
||||
TASK_DECL
|
||||
DBN_DECL
|
||||
{
|
||||
ULONG uts;
|
||||
|
||||
DB_ENTER(DB_ID TASK_ID LOCK_SET(SET_IO));
|
||||
|
||||
if ( d_utscs(set, &uts TASK_PARM DBN_PARM) == S_OKAY ) {
|
||||
if ( uts ) {
|
||||
if ( uts > cs_time[NUM2INT(set - SETMARK, st_offset)] )
|
||||
db_status = S_UPDATED;
|
||||
}
|
||||
else
|
||||
dberr(S_TIMESTAMP);
|
||||
}
|
||||
RETURN( db_status );
|
||||
}
|
||||
#endif
|
||||
/* vpp -nOS2 -dUNIX -nBSD -nVANILLA_BSD -nVMS -nMEMLOCK -nWINDOWS -nFAR_ALLOC -f/usr/users/master/config/nonwin csstat.c */
|
||||
70
cde/lib/DtSearch/raima/ctscm.c
Normal file
70
cde/lib/DtSearch/raima/ctscm.c
Normal file
@@ -0,0 +1,70 @@
|
||||
/* $XConsortium: ctscm.c /main/2 1996/05/09 04:01:14 drk $ */
|
||||
/*
|
||||
* COMPONENT_NAME: austext
|
||||
*
|
||||
* FUNCTIONS: d_ctscm
|
||||
*
|
||||
* ORIGINS: 157
|
||||
*
|
||||
* OBJECT CODE ONLY SOURCE MATERIALS
|
||||
*/
|
||||
/*-----------------------------------------------------------------------
|
||||
ctscm.c -- db_VISTA current member creation timestamp get module.
|
||||
|
||||
(C) Copyright 1987 by Raima Corporation.
|
||||
-----------------------------------------------------------------------*/
|
||||
|
||||
/* ********************** EDIT HISTORY *******************************
|
||||
|
||||
SCR DATE INI DESCRIPTION
|
||||
----- --------- --- -----------------------------------------------------
|
||||
04-Aug-88 RTK MULTI_TASK changes
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include "vista.h"
|
||||
#include "dbtype.h"
|
||||
|
||||
|
||||
#ifndef NO_TIMESTAMP
|
||||
/* Get creation timestamp of current member
|
||||
*/
|
||||
d_ctscm(set, timestamp TASK_PARM DBN_PARM)
|
||||
int set;
|
||||
ULONG FAR *timestamp;
|
||||
TASK_DECL
|
||||
DBN_DECL
|
||||
{
|
||||
INT rec;
|
||||
char FAR *rptr;
|
||||
SET_ENTRY FAR *set_ptr;
|
||||
|
||||
DB_ENTER(DB_ID TASK_ID LOCK_SET(SET_IO));
|
||||
|
||||
if (nset_check(set, &set, (SET_ENTRY FAR * FAR *)&set_ptr) != S_OKAY)
|
||||
RETURN( db_status );
|
||||
|
||||
/* make sure we have a current member */
|
||||
if ( ! curr_mem[set] )
|
||||
RETURN( dberr(S_NOCM) );
|
||||
|
||||
/* read current member */
|
||||
if ( dio_read( curr_mem[set], (char FAR * FAR *)&rptr , NOPGHOLD) != S_OKAY )
|
||||
RETURN( db_status );
|
||||
|
||||
/* get record id */
|
||||
bytecpy(&rec, rptr, sizeof(INT));
|
||||
if ( rec >= 0 ) {
|
||||
rec &= ~RLBMASK; /* mask off rlb */
|
||||
if (record_table[NUM2INT(rec, rt_offset)].rt_flags & TIMESTAMPED)
|
||||
bytecpy(timestamp, rptr + RECCRTIME, sizeof(ULONG));
|
||||
else
|
||||
*timestamp = 0L;
|
||||
}
|
||||
else
|
||||
db_status = S_DELETED;
|
||||
|
||||
RETURN( db_status );
|
||||
}
|
||||
#endif
|
||||
/* vpp -nOS2 -dUNIX -nBSD -nVANILLA_BSD -nVMS -nMEMLOCK -nWINDOWS -nFAR_ALLOC -f/usr/users/master/config/nonwin ctscm.c */
|
||||
70
cde/lib/DtSearch/raima/ctsco.c
Normal file
70
cde/lib/DtSearch/raima/ctsco.c
Normal file
@@ -0,0 +1,70 @@
|
||||
/* $XConsortium: ctsco.c /main/2 1996/05/09 04:01:31 drk $ */
|
||||
/*
|
||||
* COMPONENT_NAME: austext
|
||||
*
|
||||
* FUNCTIONS: d_ctsco
|
||||
*
|
||||
* ORIGINS: 157
|
||||
*
|
||||
* OBJECT CODE ONLY SOURCE MATERIALS
|
||||
*/
|
||||
/*-----------------------------------------------------------------------
|
||||
ctsco.c -- db_VISTA current owner creation timestamp get module.
|
||||
|
||||
(C) Copyright 1987 by Raima Corporation.
|
||||
-----------------------------------------------------------------------*/
|
||||
|
||||
/* ********************** EDIT HISTORY *******************************
|
||||
|
||||
SCR DATE INI DESCRIPTION
|
||||
----- --------- --- -----------------------------------------------------
|
||||
04-Aug-88 RTK MULTI_TASK changes
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include "vista.h"
|
||||
#include "dbtype.h"
|
||||
|
||||
|
||||
#ifndef NO_TIMESTAMP
|
||||
/* Get creation timestamp of current owner
|
||||
*/
|
||||
d_ctsco(set, timestamp TASK_PARM DBN_PARM)
|
||||
int set;
|
||||
ULONG FAR *timestamp;
|
||||
TASK_DECL
|
||||
DBN_DECL
|
||||
{
|
||||
INT rec;
|
||||
char FAR *rptr;
|
||||
SET_ENTRY FAR *set_ptr;
|
||||
|
||||
DB_ENTER(DB_ID TASK_ID LOCK_SET(SET_IO));
|
||||
|
||||
if (nset_check(set, &set, (SET_ENTRY FAR * FAR *)&set_ptr) != S_OKAY)
|
||||
RETURN( db_status );
|
||||
|
||||
/* make sure we have a current owner */
|
||||
if ( ! curr_own[set] )
|
||||
RETURN( dberr(S_NOCO) );
|
||||
|
||||
/* read current owner */
|
||||
if ( dio_read( curr_own[set], (char FAR * FAR *)&rptr , NOPGHOLD) != S_OKAY )
|
||||
RETURN( db_status );
|
||||
|
||||
/* get record id */
|
||||
bytecpy(&rec, rptr, sizeof(INT));
|
||||
if ( rec >= 0 ) {
|
||||
rec &= ~RLBMASK; /* mask off rlb */
|
||||
if (record_table[NUM2INT(rec, rt_offset)].rt_flags & TIMESTAMPED)
|
||||
bytecpy(timestamp, rptr + RECCRTIME, sizeof(ULONG));
|
||||
else
|
||||
*timestamp = 0L;
|
||||
}
|
||||
else
|
||||
db_status = S_DELETED;
|
||||
|
||||
RETURN( db_status );
|
||||
}
|
||||
#endif
|
||||
/* vpp -nOS2 -dUNIX -nBSD -nVANILLA_BSD -nVMS -nMEMLOCK -nWINDOWS -nFAR_ALLOC -f/usr/users/master/config/nonwin ctsco.c */
|
||||
63
cde/lib/DtSearch/raima/ctscr.c
Normal file
63
cde/lib/DtSearch/raima/ctscr.c
Normal file
@@ -0,0 +1,63 @@
|
||||
/* $XConsortium: ctscr.c /main/2 1996/05/09 04:01:47 drk $ */
|
||||
/*
|
||||
* COMPONENT_NAME: austext
|
||||
*
|
||||
* FUNCTIONS: d_ctscr
|
||||
*
|
||||
* ORIGINS: 157
|
||||
*
|
||||
* OBJECT CODE ONLY SOURCE MATERIALS
|
||||
*/
|
||||
/*-----------------------------------------------------------------------
|
||||
ctscr.c -- db_VISTA current record creation timestamp get module.
|
||||
|
||||
(C) Copyright 1987 by Raima Corporation.
|
||||
-----------------------------------------------------------------------*/
|
||||
|
||||
/* ********************** EDIT HISTORY *******************************
|
||||
|
||||
SCR DATE INI DESCRIPTION
|
||||
----- --------- --- -----------------------------------------------------
|
||||
04-Aug-88 RTK MULTI_TASK changes
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include "vista.h"
|
||||
#include "dbtype.h"
|
||||
|
||||
|
||||
#ifndef NO_TIMESTAMP
|
||||
/* Get creation timestamp of current record
|
||||
*/
|
||||
d_ctscr(timestamp TASK_PARM)
|
||||
ULONG FAR *timestamp;
|
||||
TASK_DECL
|
||||
{
|
||||
INT rec;
|
||||
|
||||
DB_ENTER(NO_DB_ID TASK_ID LOCK_SET(RECORD_IO));
|
||||
|
||||
/* make sure we have a current record */
|
||||
if ( ! curr_rec )
|
||||
RETURN( dberr(S_NOCR) );
|
||||
|
||||
/* read current record */
|
||||
if ( dio_read( curr_rec, (char FAR * FAR *)&crloc , NOPGHOLD) != S_OKAY )
|
||||
RETURN( db_status );
|
||||
|
||||
/* get record id */
|
||||
bytecpy(&rec, crloc, sizeof(INT));
|
||||
if ( rec >= 0 ) {
|
||||
rec &= ~RLBMASK; /* mask off rlb */
|
||||
if (record_table[NUM2INT(rec, rt_offset)].rt_flags & TIMESTAMPED)
|
||||
bytecpy(timestamp, crloc + RECCRTIME, sizeof(ULONG));
|
||||
else
|
||||
*timestamp = 0L;
|
||||
}
|
||||
else
|
||||
db_status = S_DELETED;
|
||||
|
||||
RETURN( db_status );
|
||||
}
|
||||
#endif
|
||||
/* vpp -nOS2 -dUNIX -nBSD -nVANILLA_BSD -nVMS -nMEMLOCK -nWINDOWS -nFAR_ALLOC -f/usr/users/master/config/nonwin ctscr.c */
|
||||
46
cde/lib/DtSearch/raima/dbacode.c
Normal file
46
cde/lib/DtSearch/raima/dbacode.c
Normal file
@@ -0,0 +1,46 @@
|
||||
/* $XConsortium: dbacode.c /main/2 1996/05/09 04:02:05 drk $ */
|
||||
/*
|
||||
* COMPONENT_NAME: austext
|
||||
*
|
||||
* FUNCTIONS: d_decode_dba
|
||||
* d_encode_dba
|
||||
*
|
||||
* ORIGINS: 157
|
||||
*
|
||||
* OBJECT CODE ONLY SOURCE MATERIALS
|
||||
*/
|
||||
/*-----------------------------------------------------------------------
|
||||
dbacode.c -- Module for encoding and decoding database addresses
|
||||
|
||||
(C) Copyright 1987 by Raima Corporation.
|
||||
-----------------------------------------------------------------------*/
|
||||
#include <stdio.h>
|
||||
#include "vista.h"
|
||||
#include "dbtype.h"
|
||||
|
||||
|
||||
/* Decode file and slot number from a database address
|
||||
*/
|
||||
d_decode_dba(dba, file, slot)
|
||||
DB_ADDR dba; /* database address */
|
||||
int FAR *file; /* returned file number */
|
||||
long FAR *slot; /* returned slot number */
|
||||
{
|
||||
*file = (int)(FILEMASK & (dba >> FILESHIFT));
|
||||
*slot = ADDRMASK & dba;
|
||||
return ( db_status = S_OKAY );
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* Encode database address from file and slot number
|
||||
*/
|
||||
d_encode_dba(file, slot, dba)
|
||||
int file; /* returned file number */
|
||||
long slot; /* returned slot number */
|
||||
DB_ADDR FAR *dba; /* database address */
|
||||
{
|
||||
*dba = ((FILEMASK & file) << FILESHIFT) | slot;
|
||||
return ( db_status = S_OKAY );
|
||||
}
|
||||
/* vpp -nOS2 -dUNIX -nBSD -nVANILLA_BSD -nVMS -nMEMLOCK -nWINDOWS -nFAR_ALLOC -f/usr/users/master/config/nonwin dbacode.c */
|
||||
46
cde/lib/DtSearch/raima/dbdpath.c
Normal file
46
cde/lib/DtSearch/raima/dbdpath.c
Normal file
@@ -0,0 +1,46 @@
|
||||
/* $XConsortium: dbdpath.c /main/2 1996/05/09 04:02:22 drk $ */
|
||||
/*
|
||||
* COMPONENT_NAME: austext
|
||||
*
|
||||
* FUNCTIONS: d_dbdpath
|
||||
*
|
||||
* ORIGINS: 157
|
||||
*
|
||||
* OBJECT CODE ONLY SOURCE MATERIALS
|
||||
*/
|
||||
/*-----------------------------------------------------------------------
|
||||
dbdpath.c -- db_VISTA dictionary path set module.
|
||||
|
||||
(C) Copyright 1987 by Raima Corporation.
|
||||
-----------------------------------------------------------------------*/
|
||||
|
||||
/* ********************** EDIT HISTORY *******************************
|
||||
|
||||
SCR DATE INI DESCRIPTION
|
||||
----- --------- --- -----------------------------------------------------
|
||||
04-Aug-88 RTK MULTI_TASK changes
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include "vista.h"
|
||||
#include "dbtype.h"
|
||||
|
||||
/* Set Database Dictionary Path
|
||||
*/
|
||||
d_dbdpath(path TASK_PARM)
|
||||
CONST char FAR *path;
|
||||
TASK_DECL
|
||||
{
|
||||
DB_ENTER(NO_DB_ID TASK_ID LOCK_SET(LOCK_NONE));
|
||||
|
||||
if (dbopen)
|
||||
dberr(S_DBOPEN);
|
||||
else if (strlen(path) >= FILENMLEN - 4)
|
||||
dberr(S_NAMELEN);
|
||||
else {
|
||||
strcpy(dbdpath, path);
|
||||
db_status = S_OKAY;
|
||||
}
|
||||
RETURN( db_status );
|
||||
}
|
||||
/* vpp -nOS2 -dUNIX -nBSD -nVANILLA_BSD -nVMS -nMEMLOCK -nWINDOWS -nFAR_ALLOC -f/usr/users/master/config/nonwin dbdpath.c */
|
||||
46
cde/lib/DtSearch/raima/dbfpath.c
Normal file
46
cde/lib/DtSearch/raima/dbfpath.c
Normal file
@@ -0,0 +1,46 @@
|
||||
/* $XConsortium: dbfpath.c /main/2 1996/05/09 04:02:40 drk $ */
|
||||
/*
|
||||
* COMPONENT_NAME: austext
|
||||
*
|
||||
* FUNCTIONS: d_dbfpath
|
||||
*
|
||||
* ORIGINS: 157
|
||||
*
|
||||
* OBJECT CODE ONLY SOURCE MATERIALS
|
||||
*/
|
||||
/*-----------------------------------------------------------------------
|
||||
dbfpath.c -- db_VISTA files path set module.
|
||||
|
||||
(C) Copyright 1987 by Raima Corporation.
|
||||
-----------------------------------------------------------------------*/
|
||||
|
||||
/* ********************** EDIT HISTORY *******************************
|
||||
|
||||
SCR DATE INI DESCRIPTION
|
||||
----- --------- --- -----------------------------------------------------
|
||||
04-Aug-88 RTK MULTI_TASK changes
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include "vista.h"
|
||||
#include "dbtype.h"
|
||||
|
||||
/* Set Database Files Path
|
||||
*/
|
||||
d_dbfpath(path TASK_PARM)
|
||||
CONST char FAR *path;
|
||||
TASK_DECL
|
||||
{
|
||||
DB_ENTER(NO_DB_ID TASK_ID LOCK_SET(LOCK_NONE));
|
||||
|
||||
if (dbopen)
|
||||
dberr(S_DBOPEN);
|
||||
else if (strlen(path) >= FILENMLEN - 1)
|
||||
dberr(S_NAMELEN);
|
||||
else {
|
||||
strcpy(dbfpath, path);
|
||||
db_status = S_OKAY;
|
||||
}
|
||||
RETURN( db_status );
|
||||
}
|
||||
/* vpp -nOS2 -dUNIX -nBSD -nVANILLA_BSD -nVMS -nMEMLOCK -nWINDOWS -nFAR_ALLOC -f/usr/users/master/config/nonwin dbfpath.c */
|
||||
2338
cde/lib/DtSearch/raima/dblfcns.c
Normal file
2338
cde/lib/DtSearch/raima/dblfcns.c
Normal file
File diff suppressed because it is too large
Load Diff
172
cde/lib/DtSearch/raima/dblock.h
Normal file
172
cde/lib/DtSearch/raima/dblock.h
Normal file
@@ -0,0 +1,172 @@
|
||||
/* $XConsortium: dblock.h /main/2 1996/05/09 04:02:57 drk $ */
|
||||
/*
|
||||
* COMPONENT_NAME: austext
|
||||
*
|
||||
* FUNCTIONS: FCNINIT
|
||||
*
|
||||
* ORIGINS: 157
|
||||
*
|
||||
*/
|
||||
/* ********************** EDIT HISTORY *******************************
|
||||
|
||||
SCR DATE INI DESCRIPTION
|
||||
----- --------- --- -----------------------------------------------------
|
||||
368 28-Jul-88 RSC Integrate BSD changes into code
|
||||
115 16-Aug-88 RSC Integrate VAX/VMS changes into source code
|
||||
423 09-Sep-88 RSC Change variables to be compatible with MULTI_TASK
|
||||
420 07-Oct-88 RSC Unoptimized use of fl_list (full of bugs)
|
||||
441 09-Dec-88 RSC Modified defn of FCNPID for general lockmgr
|
||||
*/
|
||||
|
||||
/* Lock Manager/Runtime function interaction */
|
||||
|
||||
/* Network Bios Status codes */
|
||||
#define N_BUSY 0xff
|
||||
#define N_OKAY 0x00
|
||||
#define N_TIMEOUT 0x05
|
||||
#define N_SESCLOSED 0x0a
|
||||
#define N_DUPNAME 0x0d
|
||||
#define N_TABFULL 0x11
|
||||
#define N_OPENREJ 0x12
|
||||
#define N_CALLNAME 0x14
|
||||
#define N_NAMEUSED 0x16
|
||||
#define N_NAMEDEL 0x17
|
||||
#define N_SESABORT 0x18
|
||||
#define N_INTFBUSY 0x21
|
||||
#define N_COMMANDS 0x22
|
||||
|
||||
/* Function/Status codes */
|
||||
#define L_RECOVER -5
|
||||
#define L_QUEUEFULL -4
|
||||
#define L_TIMEOUT -3
|
||||
#define L_UNAVAIL -2
|
||||
#define L_SYSERR -1
|
||||
|
||||
#define L_OKAY 0
|
||||
|
||||
#define L_DBOPEN 1
|
||||
#define L_DBCLOSE 2
|
||||
#define L_LOCK 3
|
||||
#define L_FREE 4
|
||||
#define L_TRCOMMIT 5
|
||||
#define L_TREND 6
|
||||
#define L_SETTIME 7
|
||||
#define L_RECDONE 8
|
||||
#define L_LOGIN 9
|
||||
#define L_DELETE 10
|
||||
|
||||
#ifndef LOGFILELEN
|
||||
#define LOGFILELEN 48
|
||||
#endif
|
||||
|
||||
/* Macros for VMS mailbox usage */
|
||||
|
||||
|
||||
typedef struct LM_LOCKREQ_S {
|
||||
INT fref;
|
||||
INT type;
|
||||
} LM_LOCKREQ;
|
||||
|
||||
/* Message packets, Runtime to Lock Manager */
|
||||
|
||||
/* Some macro / typdefs to make this file much more readable */
|
||||
|
||||
#define PERMISSION 0666
|
||||
|
||||
#ifdef GENERAL
|
||||
|
||||
/* Defines for GENERAL LOCKMGR */
|
||||
|
||||
#define FCNPID INT fcn;
|
||||
#define FCNDEF INT fcn;
|
||||
#define FCNINIT() 0
|
||||
typedef char LM_FILEID;
|
||||
|
||||
#else /* GENERAL */
|
||||
|
||||
|
||||
/* Defines for UNIX SYS-V */
|
||||
|
||||
#define FCNPID LONG fcn;\
|
||||
int pid;
|
||||
#define FCNDEF LONG fcn;
|
||||
#define FCNINIT() 0
|
||||
|
||||
/* Defines for both UNIX SYS-V and BSD */
|
||||
|
||||
typedef struct LM_FILEID_S {
|
||||
ino_t inode;
|
||||
dev_t device;
|
||||
} LM_FILEID;
|
||||
|
||||
#endif /* GENERAL */
|
||||
|
||||
typedef struct LM_LOGIN_S {
|
||||
FCNPID
|
||||
char dbusrid[80];
|
||||
} LM_LOGIN;
|
||||
|
||||
typedef struct LM_DBOPEN_S {
|
||||
FCNPID
|
||||
INT nfiles;
|
||||
INT type;
|
||||
LM_FILEID fnames[1];
|
||||
} LM_DBOPEN;
|
||||
|
||||
typedef struct LM_DBCLOSE_S {
|
||||
FCNPID
|
||||
INT nfiles;
|
||||
INT frefs[1];
|
||||
} LM_DBCLOSE;
|
||||
|
||||
typedef struct LM_LOCK_S {
|
||||
FCNPID
|
||||
INT nfiles;
|
||||
LM_LOCKREQ locks[1];
|
||||
} LM_LOCK;
|
||||
|
||||
typedef struct LM_RECOVERED_S {
|
||||
FCNPID
|
||||
} LM_RECOVERED;
|
||||
|
||||
typedef struct LM_FREE_S {
|
||||
FCNPID
|
||||
INT nfiles;
|
||||
INT frefs[1];
|
||||
} LM_FREE;
|
||||
|
||||
typedef struct LM_TRCOMMIT_S {
|
||||
FCNPID
|
||||
char logfile[LOGFILELEN];
|
||||
} LM_TRCOMMIT;
|
||||
|
||||
typedef struct LM_TREND_S {
|
||||
FCNPID
|
||||
} LM_TREND;
|
||||
|
||||
typedef struct LM_SETTIME_S {
|
||||
FCNPID
|
||||
INT secs;
|
||||
} LM_SETTIME;
|
||||
|
||||
|
||||
/* Message packets, Lock Manager to Runtime */
|
||||
|
||||
|
||||
typedef struct LR_DBOPEN_S {
|
||||
FCNDEF
|
||||
INT status;
|
||||
char logfile[LOGFILELEN];
|
||||
INT nusers;
|
||||
INT nfiles;
|
||||
INT frefs[1];
|
||||
} LR_DBOPEN;
|
||||
|
||||
typedef struct LR_LOCK_S {
|
||||
FCNDEF
|
||||
INT status;
|
||||
char logfile[LOGFILELEN];
|
||||
} LR_LOCK;
|
||||
|
||||
#define DBLOCK_H
|
||||
/* vpp -nOS2 -dUNIX -nBSD -nVANILLA_BSD -nVMS -nMEMLOCK -nWINDOWS -nFAR_ALLOC -f/usr/users/master/config/nonwin dblock.h */
|
||||
45
cde/lib/DtSearch/raima/dblog.c
Normal file
45
cde/lib/DtSearch/raima/dblog.c
Normal file
@@ -0,0 +1,45 @@
|
||||
/* $XConsortium: dblog.c /main/2 1996/05/09 04:03:14 drk $ */
|
||||
/*
|
||||
* COMPONENT_NAME: austext
|
||||
*
|
||||
* FUNCTIONS: d_dblog
|
||||
*
|
||||
* ORIGINS: 157
|
||||
*
|
||||
* OBJECT CODE ONLY SOURCE MATERIALS
|
||||
*/
|
||||
/*-----------------------------------------------------------------------
|
||||
dblog.c -- db_VISTA database log filename/path set module.
|
||||
|
||||
(C) Copyright 1987 by Raima Corporation.
|
||||
-----------------------------------------------------------------------*/
|
||||
|
||||
/* ********************** EDIT HISTORY *******************************
|
||||
|
||||
SCR DATE INI DESCRIPTION
|
||||
----- --------- --- -----------------------------------------------------
|
||||
04-Aug-88 RTK MULTI_TASK changes
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include "vista.h"
|
||||
#include "dbtype.h"
|
||||
|
||||
/* Set database log file name/path
|
||||
*/
|
||||
d_dblog(log TASK_PARM)
|
||||
CONST char FAR *log;
|
||||
TASK_DECL
|
||||
{
|
||||
DB_ENTER(NO_DB_ID TASK_ID LOCK_SET(LOCK_NONE));
|
||||
|
||||
if (dbopen)
|
||||
dberr(S_DBOPEN);
|
||||
else {
|
||||
strncpy(dblog, log, FILENMLEN - 1);
|
||||
dblog[FILENMLEN - 1] = '\0';
|
||||
db_status = S_OKAY;
|
||||
}
|
||||
RETURN( db_status );
|
||||
}
|
||||
/* vpp -nOS2 -dUNIX -nBSD -nVANILLA_BSD -nVMS -nMEMLOCK -nWINDOWS -nFAR_ALLOC -f/usr/users/master/config/nonwin dblog.c */
|
||||
240
cde/lib/DtSearch/raima/dbswab.c
Normal file
240
cde/lib/DtSearch/raima/dbswab.c
Normal file
@@ -0,0 +1,240 @@
|
||||
/*
|
||||
* COMPONENT_NAME: austext
|
||||
*
|
||||
* FUNCTIONS: swab_page
|
||||
*
|
||||
* ORIGINS: 27
|
||||
*
|
||||
* (C) COPYRIGHT International Business Machines Corp. 1996
|
||||
* All Rights Reserved
|
||||
* Licensed Materials - Property of IBM
|
||||
* US Government Users Restricted Rights - Use, duplication or
|
||||
* disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
|
||||
*/
|
||||
/********************* DBSWAB.C **********************************
|
||||
* $XConsortium: dbswab.c /main/3 1996/10/28 13:59:11 drk $
|
||||
* July 1996.
|
||||
* These functions do byte swap and other manipulations on
|
||||
* vista cache pages to ensure that database files are
|
||||
* maintained in a canonical format no matter what machine
|
||||
* they are used on.
|
||||
* The DtSearch data records are presumed already in external
|
||||
* file format by code at the DtSearch level (dtsrswab.c).
|
||||
* These functions use the standard htonl, htons, ntohl, and ntohs
|
||||
* network conversion functions for byte order neutrality.
|
||||
* They use the LONG and INT typedefs in vista.h
|
||||
* to control integer size.
|
||||
* The external database files are in the canonical,
|
||||
* big-endian "network" order.
|
||||
* So that they can be defined as "null" macros on big endian machines,
|
||||
* the functions (1) always byte swap in place, and (2) always succeed.
|
||||
*
|
||||
* $Log$
|
||||
*/
|
||||
#include "vista.h"
|
||||
#include "dbtype.h"
|
||||
#include "dbswab.h"
|
||||
|
||||
#define DEBUG_DBSWAB
|
||||
#ifdef DEBUG_DBSWAB
|
||||
#include <stdio.h>
|
||||
int debugging_dbswab = FALSE;
|
||||
int debugging_key_swabs = FALSE;
|
||||
#endif
|
||||
|
||||
|
||||
/********************************/
|
||||
/* */
|
||||
/* swab_page */
|
||||
/* */
|
||||
/********************************/
|
||||
/* Performs byte swap on all slots of any cache page except page 0.
|
||||
* 4-byte timestamp page header already swapped by caller.
|
||||
*
|
||||
* WARNING! The algorithms will only work for the
|
||||
* DtSearch schema. For data pages, they ignore the
|
||||
* 1-byte optional key flags except for the OR_MISC record.
|
||||
* The first 6 bytes of each slot (rectype, dba)
|
||||
* are always byte swapped. Thereafter every 4-bytes
|
||||
* is swapped as set or member ptrs until we reach
|
||||
* the data offset. For OR_MISC records we presume
|
||||
* exactly 1 byte of optional key flags before the
|
||||
* set/member ptrs.
|
||||
*/
|
||||
void swab_page (char *pgbuf, FILE_ENTRY *file_ptr, SWABDIR direction)
|
||||
{
|
||||
#ifndef BYTE_SWAP
|
||||
return;
|
||||
#else
|
||||
INT slotno;
|
||||
char *slotptr;
|
||||
char *cptr;
|
||||
INT slsize = file_ptr->ft_slsize;
|
||||
INT slots = file_ptr->ft_slots; /* # slots per page */
|
||||
INT recno;
|
||||
INT used_count;
|
||||
INT key_prefix;
|
||||
INT curr_offset, data_offset;
|
||||
INT align_INT;
|
||||
LONG align_LONG;
|
||||
|
||||
/*----------------- DATA PAGES --------------------
|
||||
* If file is 'data' file, slots begin immediately after
|
||||
* the page's timestamp. For each slot we have to swap
|
||||
* the optional set and member tables as well as fixed
|
||||
* slot header data.
|
||||
*/
|
||||
if (file_ptr->ft_type == DATA) {
|
||||
#ifdef DEBUG_DBSWAB
|
||||
if (debugging_dbswab) {
|
||||
printf (__FILE__"073 %s DATA page '%s': slct=%d slsz=%d pgsz=%d\n",
|
||||
(direction == HTON)? "WRITE" : "READ",
|
||||
file_ptr->ft_name, (int)file_ptr->ft_slots,
|
||||
(int)file_ptr->ft_slsize, (int)file_ptr->ft_pgsize);
|
||||
fflush(stdout);
|
||||
}
|
||||
#endif
|
||||
|
||||
for ( slotno = 0, slotptr = pgbuf + 4; /* over timestamp */
|
||||
slotno < slots;
|
||||
slotno++, slotptr += slsize) {
|
||||
|
||||
/* record number (= record type)
|
||||
* Save the correct host order value in 'recno'.
|
||||
*/
|
||||
memcpy (&align_INT, slotptr, sizeof(INT));
|
||||
if (direction == HTON) {
|
||||
recno = align_INT;
|
||||
HTONS (align_INT);
|
||||
}
|
||||
else {
|
||||
NTOHS (align_INT);
|
||||
recno = align_INT;
|
||||
}
|
||||
memcpy (slotptr, &align_INT, sizeof(INT));
|
||||
|
||||
/* dba, or delete chain ptr */
|
||||
memcpy (&align_LONG, slotptr + sizeof(INT), sizeof(LONG));
|
||||
align_LONG = HTONL (align_LONG);
|
||||
memcpy (slotptr + sizeof(INT), &align_LONG, sizeof(LONG));
|
||||
|
||||
/* If this is a deleted record, we're done */
|
||||
if (recno & 0x8000)
|
||||
continue;
|
||||
|
||||
/* Swap 4-byte set/member ptrs till we hit data */
|
||||
recno &= 0x0fff; /* switch off delete and lock bits */
|
||||
data_offset = record_table[recno].rt_data;
|
||||
for ( curr_offset = (recno == MISCREC_RECNO)? 7 : 6;
|
||||
curr_offset < data_offset;
|
||||
curr_offset += sizeof(LONG)) {
|
||||
memcpy (&align_LONG, slotptr + curr_offset, sizeof(LONG));
|
||||
align_LONG = HTONL (align_LONG);
|
||||
memcpy (slotptr + curr_offset, &align_LONG, sizeof(LONG));
|
||||
}
|
||||
} /* end loop on each slot */
|
||||
} /* end if (data page) */
|
||||
|
||||
/*----------------- KEY PAGES --------------------
|
||||
* DtSearch doesn't use anything but key and data files
|
||||
* so this must be a key file. A b-tree node = one cache page.
|
||||
* Before the slots begin in a key file page there is
|
||||
* additional header data to be swapped after the timestamp:
|
||||
* the used_slots count (2 bytes) and the orphan ptr (4 bytes).
|
||||
* If used_slots == 0, then the page is not used and the
|
||||
* orphan ptr is really a delete chain ptr for the entire node.
|
||||
*/
|
||||
else {
|
||||
/* 'used_slots'
|
||||
* Save the correct host order value in 'used_count'.
|
||||
*/
|
||||
memcpy (&align_INT, pgbuf + 4, sizeof(INT));
|
||||
if (direction == HTON) {
|
||||
used_count = align_INT;
|
||||
HTONS (align_INT);
|
||||
}
|
||||
else {
|
||||
NTOHS (align_INT);
|
||||
used_count = align_INT;
|
||||
}
|
||||
memcpy (pgbuf + 4, &align_INT, sizeof(INT));
|
||||
|
||||
/* 'orphan' ptr or 'delete chain' ptr */
|
||||
memcpy (&align_LONG, pgbuf + 6, sizeof(LONG));
|
||||
align_LONG = HTONL (align_LONG);
|
||||
memcpy (pgbuf + 6, &align_LONG, sizeof(LONG));
|
||||
|
||||
#ifdef DEBUG_DBSWAB
|
||||
if (debugging_dbswab || debugging_key_swabs) {
|
||||
printf (__FILE__
|
||||
"124 %s KEY page '%s': slct=%d used=%d slsz=%d pgsz=%d\n",
|
||||
(direction == HTON)? "WRITE" : "READ",
|
||||
file_ptr->ft_name, (int)slots,
|
||||
(int)used_count,
|
||||
(int)slsize, (int)file_ptr->ft_pgsize);
|
||||
fflush (stdout);
|
||||
}
|
||||
#endif
|
||||
/* For each used slot we have to swap the key prefix
|
||||
* at the beginning of the slot, then at the *end*
|
||||
* of the key, the dba, followed by the child node ptr.
|
||||
* (This is not the format raima published but it's true!)
|
||||
* Slots start at pg offset 10: timestamp + used_slots + orphan ptr.
|
||||
* Note that if used_count == 0, we won't process
|
||||
* this deleted node any further.
|
||||
*/
|
||||
for ( slotno = 0, slotptr = pgbuf + 10;
|
||||
slotno < used_count;
|
||||
slotno++, slotptr += slsize) {
|
||||
|
||||
/* 'key prefix. Save host order value. */
|
||||
memcpy (&align_INT, slotptr, sizeof(INT));
|
||||
if (direction == HTON) {
|
||||
key_prefix = align_INT;
|
||||
HTONS (align_INT);
|
||||
}
|
||||
else {
|
||||
NTOHS (align_INT);
|
||||
key_prefix = align_INT;
|
||||
}
|
||||
memcpy (slotptr, &align_INT, sizeof(INT));
|
||||
|
||||
#ifdef DEBUG_DBSWAB
|
||||
if (debugging_key_swabs)
|
||||
printf (" slot #%02d: prefix=%d",
|
||||
(int)slotno, (int)key_prefix);
|
||||
#endif
|
||||
/* database address.
|
||||
* All DtSearch keys are unswapped char strings.
|
||||
* The dba is just past the key, 8 bytes before
|
||||
* of the end of the slot.
|
||||
*/
|
||||
cptr = slotptr + slsize - 8;
|
||||
|
||||
memcpy (&align_LONG, cptr, sizeof(LONG));
|
||||
align_LONG = HTONL (align_LONG);
|
||||
memcpy (cptr, &align_LONG, sizeof(LONG));
|
||||
|
||||
#ifdef DEBUG_DBSWAB
|
||||
if (debugging_key_swabs) {
|
||||
printf (" dba=x%08lx key='%s'\n", (direction == NTOH)?
|
||||
(long)align_LONG : (long)ntohl(align_LONG),
|
||||
slotptr + 2);
|
||||
fflush (stdout);
|
||||
}
|
||||
#endif
|
||||
|
||||
/* 'child ptr'. after dba, 4 bytes before end of slot. */
|
||||
cptr += 4;
|
||||
memcpy (&align_LONG, cptr, sizeof(LONG));
|
||||
align_LONG = HTONL (align_LONG);
|
||||
memcpy (cptr, &align_LONG, sizeof(LONG));
|
||||
|
||||
} /* end loop on each slot */
|
||||
} /* end if (key page) */
|
||||
|
||||
return;
|
||||
#endif /* BYTE_SWAP */
|
||||
} /* swab_page() */
|
||||
|
||||
/********************* DBSWAB.C **********************************/
|
||||
82
cde/lib/DtSearch/raima/dbswab.h
Normal file
82
cde/lib/DtSearch/raima/dbswab.h
Normal file
@@ -0,0 +1,82 @@
|
||||
/*
|
||||
* COMPONENT_NAME: austext
|
||||
*
|
||||
* FUNCTIONS: HTONL
|
||||
* HTONS
|
||||
* NTOHL
|
||||
* NTOHS
|
||||
* SWABDIR
|
||||
* htonl
|
||||
* htons
|
||||
* ntohl
|
||||
* ntohs
|
||||
*
|
||||
* ORIGINS: 27
|
||||
*
|
||||
*
|
||||
* (C) COPYRIGHT International Business Machines Corp. 1996
|
||||
* All Rights Reserved
|
||||
* Licensed Materials - Property of IBM
|
||||
* US Government Users Restricted Rights - Use, duplication or
|
||||
* disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
|
||||
*/
|
||||
/********************* DBSWAB.H **********************************
|
||||
* $XConsortium: dbswab.h /main/2 1996/10/28 14:00:06 drk $
|
||||
* July 1996.
|
||||
* Header file for all internal vista byte swap modifications.
|
||||
* The mods byte swap vista cache pages, dbd tables, etc,
|
||||
* to ensure that database files are maintained in a canonical
|
||||
* format no matter what machine they are used on.
|
||||
* The DtSearch data records are byte swapped in code at the
|
||||
* DtSearch level (dtsrswab.c, defns in SearchP.h).
|
||||
* Byte swap is performed with the standard htonl, htons, ntohl,
|
||||
* and ntohs network conversion functions for byte order neutrality.
|
||||
* Canonical integer length is enforced with the typedefs
|
||||
* LONG and INT in vista.h
|
||||
* The external database files are in big-endian ("network") order.
|
||||
* So that they can be defined as "null" macros on big endian machines,
|
||||
* new functions (1) always byte swap in place, and (2) always succeed.
|
||||
*
|
||||
* An #include "vista.h" and #include "dbtype.h" must precede this include.
|
||||
*
|
||||
* $Log$
|
||||
*/
|
||||
#ifndef _H_DBSWAB
|
||||
#define _H_DBSWAB
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <netinet/in.h>
|
||||
|
||||
/* Record number for OR_MISCREC DtSearch record */
|
||||
#define MISCREC_RECNO 3
|
||||
|
||||
/* Direction of io to indicate correct byte swap function.
|
||||
* HTON is host to network, internal RAM to external database file.
|
||||
* NTOH is network to host, file to RAM.
|
||||
*/
|
||||
typedef enum {HTON=1, NTOH} SWABDIR;
|
||||
|
||||
extern void swab_page (char *pgbuf, FILE_ENTRY *file_ptr, SWABDIR direction);
|
||||
|
||||
#ifdef BYTE_SWAP /* ie (BYTE_ORDER != BIG_ENDIAN) */
|
||||
|
||||
#define HTONL(x) x = htonl(x)
|
||||
#define HTONS(x) x = htons(x)
|
||||
#define NTOHL(x) x = ntohl(x)
|
||||
#define NTOHS(x) x = ntohs(x)
|
||||
|
||||
#else /* !BYTE_SWAP, ie (BYTE_ORDER == BIG_ENDIAN) */
|
||||
|
||||
#define HTONL(x)
|
||||
#define HTONS(x)
|
||||
#define NTOHL(x)
|
||||
#define NTOHS(x)
|
||||
|
||||
#endif /* BYTE_SWAP */
|
||||
|
||||
/******** debug stuff *******/
|
||||
extern char *debug_keyslot_ptr;
|
||||
extern void snap_dump (char *label, void *ptr, int len);
|
||||
|
||||
/********************* DBSWAB.H **********************************/
|
||||
#endif /* _H_DBSWAB */
|
||||
64
cde/lib/DtSearch/raima/dbtaf.c
Normal file
64
cde/lib/DtSearch/raima/dbtaf.c
Normal file
@@ -0,0 +1,64 @@
|
||||
/* $XConsortium: dbtaf.c /main/3 1996/05/09 04:03:32 drk $ */
|
||||
/*
|
||||
* COMPONENT_NAME: austext
|
||||
*
|
||||
* FUNCTIONS: d_dbtaf
|
||||
*
|
||||
* ORIGINS: 157
|
||||
*
|
||||
* OBJECT CODE ONLY SOURCE MATERIALS
|
||||
*/
|
||||
/*-----------------------------------------------------------------------
|
||||
dbtaf.c -- db_VISTA transaction activity filename/path set module.
|
||||
|
||||
(C) Copyright 1987 by Raima Corporation.
|
||||
-----------------------------------------------------------------------*/
|
||||
|
||||
/* ********************** EDIT HISTORY *******************************
|
||||
|
||||
SCR DATE INI DESCRIPTION
|
||||
----- --------- --- -----------------------------------------------------
|
||||
04-Aug-88 RTK MULTI_TASK changes
|
||||
05-May-89 WLW Added TASK_PARM for multi-tasking
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include "vista.h"
|
||||
#include "dbtype.h"
|
||||
|
||||
static char VISTATAF[] = "vista.taf";
|
||||
|
||||
/* Set database transaction activity file name/path
|
||||
*/
|
||||
d_dbtaf(taf TASK_PARM)
|
||||
CONST char FAR *taf;
|
||||
TASK_DECL
|
||||
{
|
||||
char dbtaf[FILENMLEN];
|
||||
int len;
|
||||
|
||||
DB_ENTER(NO_DB_ID TASK_ID LOCK_SET(LOCK_NONE));
|
||||
if (dbopen)
|
||||
dberr(S_DBOPEN);
|
||||
else {
|
||||
len = strlen(taf);
|
||||
if (len > (FILENMLEN - 1)) {
|
||||
strncpy(dbtaf, taf, FILENMLEN - 1);
|
||||
dbtaf[FILENMLEN - 1] = '\0';
|
||||
}
|
||||
else if (taf[len - 1] == DIRCHAR) {
|
||||
if (len > (FILENMLEN - sizeof(VISTATAF))) {
|
||||
strncpy(dbtaf, taf, FILENMLEN - sizeof(VISTATAF) - 1);
|
||||
dbtaf[(len = (FILENMLEN - sizeof(VISTATAF))) - 1] = DIRCHAR;
|
||||
}
|
||||
else
|
||||
strcpy(dbtaf, taf);
|
||||
strcpy(&dbtaf[len], VISTATAF);
|
||||
}
|
||||
else
|
||||
strcpy(dbtaf, taf);
|
||||
db_status = S_OKAY;
|
||||
}
|
||||
RETURN (db_status = S_OKAY);
|
||||
}
|
||||
/* vpp -nOS2 -dUNIX -nBSD -nVANILLA_BSD -nVMS -nMEMLOCK -nWINDOWS -nFAR_ALLOC -f/usr/users/master/config/nonwin dbtaf.c */
|
||||
626
cde/lib/DtSearch/raima/dbtype.h
Normal file
626
cde/lib/DtSearch/raima/dbtype.h
Normal file
@@ -0,0 +1,626 @@
|
||||
/*
|
||||
* COMPONENT_NAME: austext
|
||||
*
|
||||
* FUNCTIONS: ALLOC
|
||||
* BITS
|
||||
* CALLOC
|
||||
* DB_ENTER
|
||||
* DB_REF
|
||||
* FREE
|
||||
* LOCK_SET
|
||||
* MEM_LOCK
|
||||
* MEM_UNLOCK
|
||||
* NUM2EXT
|
||||
* NUM2INT
|
||||
* ORIGIN
|
||||
* RETURN
|
||||
* RN_REF
|
||||
* TABLE_SIZE
|
||||
* arraysize
|
||||
* bytecmp
|
||||
* bytecpy
|
||||
* byteset
|
||||
*
|
||||
* ORIGINS: 27,157
|
||||
*
|
||||
* (C) COPYRIGHT International Business Machines Corp. 1995, 1996
|
||||
* All Rights Reserved
|
||||
* US Government Users Restricted Rights - Use, duplication or
|
||||
* disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
|
||||
*/
|
||||
/*----------------------------------------------------------------------------
|
||||
$TOG: dbtype.h /main/6 1998/03/19 19:00:38 mgreess $
|
||||
dbtype.h: Standard db_VISTA header file containing:
|
||||
|
||||
- DDL dictionary type definitions
|
||||
- Machine dependent constant definitions
|
||||
- Miscellaneous constants used by runtime functions
|
||||
- Virtual memory page table type definitions
|
||||
|
||||
(An #include "vista.h" must precede this include)
|
||||
|
||||
(C) Copyright 1984, 1985, 1986 by Raima Corporation.
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/* ********************** EDIT HISTORY *******************************
|
||||
|
||||
SCR DATE INI DESCRIPTION
|
||||
----- --------- --- -----------------------------------------------------
|
||||
101 21-Jun-88 RSC Added rn_type and rn_dba to database table
|
||||
344 06-Jul-88 RSC LOGFILELEN also defined in dblock.h - add ifndef
|
||||
115 18-Jul-88 RSC Integrate VAX VMS changes
|
||||
21-Jul-88 RSC Fix bugaboo in VAX integration
|
||||
368 28-Jul-88 RSC Integrate BSD changes into code
|
||||
310 10-Aug-88 RSC Cleanup function prototype
|
||||
19-Aug-88 RSC Moved rn_type,rn_dba to separate table for compatibility
|
||||
with db_QUERY and db_REVISE
|
||||
423 10-Sep-88 RSC Add dbpush names for netunix.c
|
||||
423 22-Sep-88 RSC Modify/simplify DB_ENTER macro for Lattice compiler
|
||||
368 23-Sep-88 RSC Change type of pid from INT to int and
|
||||
corrected defn of MESSAGE
|
||||
423 26-Sep-88 RSC Moved INIT_PAGE_P defn to initial.c
|
||||
11-Oct-88 RSC Fix for ONE_DB compile
|
||||
441 06-Dec-88 RSC Move defn of MESSAGE from netgen.h to here
|
||||
532 06-Jan-89 RSC Fixed defn of DB_ID for ONE_DB
|
||||
|
||||
$Log$
|
||||
* Revision 1.2 1995/10/13 18:29:38 miker
|
||||
* Added #define DtSrFILENMLEN to expand max filename len.
|
||||
* Changed FILENMLEN from 48 to DtSrFILENMLEN (240: 256 - 16).
|
||||
*/
|
||||
|
||||
/* Compiler dependencies are handled with ifdef macros:
|
||||
NOTE: One of these macros should be defined on the compile command,
|
||||
for example
|
||||
cc -c -DUNIX fillnew.c
|
||||
Failure to do so will produce compilation errors.
|
||||
|
||||
UNIX = Unix C compiler
|
||||
LAT = Lattice
|
||||
MSC = Microsoft
|
||||
AZ = Aztec
|
||||
C86 = CI C86
|
||||
DS = DeSmet
|
||||
VMS = Vax/VMS
|
||||
HHS = Harris H-series
|
||||
*/
|
||||
|
||||
#ifdef NO_TRANS
|
||||
#define SINGLE_USER
|
||||
#endif
|
||||
#ifdef SINGLE_USER
|
||||
#define NO_TIMESTAMP
|
||||
#endif
|
||||
|
||||
#define PGHOLD 1
|
||||
#define NOPGHOLD 0
|
||||
#define PGFREE 1
|
||||
#define NOPGFREE 0
|
||||
|
||||
#define KEYFIND 0
|
||||
#define KEYNEXT 1
|
||||
#define KEYPREV 2
|
||||
#define KEYFRST 3
|
||||
#define KEYLAST 4
|
||||
|
||||
/* dictionary attribute flags */
|
||||
#define SORTFLD 0x0001 /* field is a set sort field */
|
||||
#define STRUCTFLD 0x0002 /* field is sub-field of struct */
|
||||
#define UNSIGNEDFLD 0x0004 /* field is unsigned */
|
||||
#define STATIC 0x0002 /* file/record is static */
|
||||
#define LOCAL 0x0004 /* file/record is local */
|
||||
#define COMKEYED 0x0010 /* record/field contains/included in compound key */
|
||||
#define TIMESTAMPED 0x0001 /* record/set is timestamped */
|
||||
|
||||
#define TRUE 1
|
||||
#define FALSE 0
|
||||
#define YES 1
|
||||
#define NO 0
|
||||
|
||||
#define BITS_PER_BYTE 8
|
||||
|
||||
/* Number of bits in a "type" */
|
||||
#define BITS( type ) (BITS_PER_BYTE * sizeof( type ))
|
||||
|
||||
/* Number of elements in a vector */
|
||||
#define arraysize(v) (sizeof(v)/sizeof(*(v)))
|
||||
|
||||
/* Number of bytes in a disk block */
|
||||
#define D_BLKSZ 512
|
||||
|
||||
#define DBD_COMPAT_LEN 6
|
||||
#define INT_SIZE sizeof(int)
|
||||
#define SHORT_SIZE sizeof(short)
|
||||
#define LONG_SIZE sizeof(long)
|
||||
#ifndef NO_FLOAT
|
||||
#define FLOAT_SIZE sizeof(float)
|
||||
#define DOUBLE_SIZE sizeof(double)
|
||||
#endif
|
||||
#define CHAR_SIZE sizeof(char)
|
||||
#define DB_ADDR_SIZE sizeof(LONG)
|
||||
#define PGHDRSIZE 4
|
||||
#define CTBNAME "vista.ctb"
|
||||
|
||||
#define RECHDRSIZE 6
|
||||
#define NONE -1
|
||||
|
||||
/* FILEMASK, ADDRMASK, FILESHIFT always operate on 4-byte variables */
|
||||
#define FILEMASK 0x000000FF
|
||||
#define ADDRMASK 0x00FFFFFF
|
||||
#define FILESHIFT 24
|
||||
|
||||
#define OPTKEYSHIFT 10
|
||||
#define OPTKEYMASK 0xFC00
|
||||
#define OPTKEYNDX 0x003F
|
||||
#define OPTKEY_LIMIT 63
|
||||
#define RLBMASK 0x4000
|
||||
|
||||
/* The following constants all depend on the size of INT and DB_ADDR */
|
||||
|
||||
/* creation timestamp in rec hdr = sizeof(INT) + DB_ADDR_SIZE */
|
||||
#define RECCRTIME 6
|
||||
/* update timestamp in rec hdr = RECCRTIME + sizeof(LONG) */
|
||||
#define RECUPTIME 10
|
||||
|
||||
/* member count prior + next timestamp (opt) */
|
||||
/* max size of set pointer = sizeof(LONG) + 2*DB_ADDR_SIZE + sizeof(ULONG) */
|
||||
#define SETPSIZE 16
|
||||
/* Offset to total members in set ptr */
|
||||
#define SP_MEMBERS 0
|
||||
/* Offset to first member ptr in set ptr */
|
||||
#define SP_FIRST 4
|
||||
/* Offset to last member ptr in set ptr = 2+DB_ADDR_SIZE */
|
||||
#define SP_LAST 8
|
||||
#ifndef NO_TIMESTAMP
|
||||
/* Offset to timestamp in set ptr */
|
||||
#define SP_UTIME 12
|
||||
#endif
|
||||
/* Size of member pointer = 3*DB_ADDR_SIZE */
|
||||
#define MEMPSIZE 12
|
||||
/* Offset to owner ptr in member ptr */
|
||||
#define MP_OWNER 0
|
||||
/* Offset to previous member ptr in member ptr = DB_ADDR_SIZE */
|
||||
#define MP_PREV 4
|
||||
/* Offset to next member ptr in member ptr = 2*DB_ADDR_SIZE */
|
||||
#define MP_NEXT 8
|
||||
|
||||
/* maximum length of a database file name */
|
||||
#define DtSrFILENMLEN 240 /* expand max filename len from 48 */
|
||||
#ifndef FILENMLEN
|
||||
#define FILENMLEN DtSrFILENMLEN
|
||||
#endif
|
||||
#ifndef LOGFILELEN
|
||||
#define LOGFILELEN 48
|
||||
#endif
|
||||
/* maximum length of a database name */
|
||||
#define DBNMLEN 12
|
||||
/* maximum length of a database path */
|
||||
#define PATHLEN FILENMLEN-15
|
||||
|
||||
#define MAXDIMS 3
|
||||
|
||||
#define OPEN 'o'
|
||||
#define CLOSED 'c'
|
||||
#define DATA 'd'
|
||||
#define KEY 'k'
|
||||
#define OVERFLOW 'o'
|
||||
|
||||
typedef struct FILE_ENTRY_S {
|
||||
char ft_name[FILENMLEN]; /* name of file */
|
||||
INT ft_desc; /* file descriptor */
|
||||
char ft_status; /* 'o'=opened, 'c'=closed */
|
||||
char ft_type; /* 'd'=data, 'k'=key, 'o'=overflow */
|
||||
INT ft_slots; /* record slots per page */
|
||||
INT ft_slsize; /* size of record slots in bytes */
|
||||
INT ft_pgsize; /* size of page */
|
||||
INT ft_flags; /* 0x0002 is set if file is static */
|
||||
} FILE_ENTRY;
|
||||
|
||||
typedef struct RECORD_ENTRY_S {
|
||||
INT rt_file; /* file table entry of file containing record */
|
||||
INT rt_len; /* total length of record */
|
||||
INT rt_data; /* offset to start of data in record */
|
||||
INT rt_fields; /* first field def in field_table */
|
||||
INT rt_fdtot; /* total number of fields in record */
|
||||
INT rt_flags; /* 0x0001 is set if record is timestamped
|
||||
0x0002 is set if record is static */
|
||||
} RECORD_ENTRY;
|
||||
|
||||
|
||||
#define FIRST 'f'
|
||||
#define LAST 'l'
|
||||
#define ASCENDING 'a'
|
||||
#define DESCENDING 'd'
|
||||
#define NOORDER 'n'
|
||||
#define NEXT 'n'
|
||||
typedef struct SET_ENTRY_S {
|
||||
INT st_order; /* 'f'=first, 'l'=last, 'a'=ascending,
|
||||
'd'=descending, 'n'=no order */
|
||||
INT st_own_rt; /* record table entry of owner */
|
||||
INT st_own_ptr; /* offset to set pointers in record */
|
||||
INT st_members; /* index of first member record in member table */
|
||||
INT st_memtot; /* total number of members of set */
|
||||
INT st_flags; /* 0x0001 is set if record is timestamped */
|
||||
} SET_ENTRY;
|
||||
|
||||
|
||||
typedef struct MEMBER_ENTRY_S {
|
||||
INT mt_record; /* record table entry for this member */
|
||||
INT mt_mem_ptr; /* offset to member ptrs in record */
|
||||
INT mt_sort_fld; /* sort table entry of first sort field */
|
||||
INT mt_totsf; /* total number of sort fields */
|
||||
} MEMBER_ENTRY;
|
||||
|
||||
|
||||
typedef struct SORT_ENTRY_S {
|
||||
INT se_fld; /* field table entry of sort field */
|
||||
INT se_set; /* set table entry of sorted set */
|
||||
} SORT_ENTRY;
|
||||
|
||||
|
||||
#define NOKEY 'n'
|
||||
#define DUPLICATES 'd'
|
||||
#define UNIQUE 'u'
|
||||
#define CHARACTER 'c'
|
||||
#define SHORTINT 's'
|
||||
#define REGINT 'i'
|
||||
#define LONGINT 'l'
|
||||
#ifndef NO_FLOAT
|
||||
#define FLOAT 'f'
|
||||
#define DOUBLE 'F'
|
||||
#endif
|
||||
#define DBADDR 'd'
|
||||
#define GROUPED 'g'
|
||||
#define COMKEY 'k'
|
||||
typedef struct FIELD_ENTRY_S {
|
||||
char fd_key; /* 'n'=none, 'd'=duplicates, 'u'=unique */
|
||||
char fd_type; /* 'c'=char, 's'=short, 'i'=int, 'l'=long, 'd'=DB_ADDR,
|
||||
'f' = float, 'D' = double, 'g'=grouped field,
|
||||
'k' = compound key */
|
||||
INT fd_len; /* length of field in bytes */
|
||||
INT fd_dim[MAXDIMS]; /* size of each array dimension */
|
||||
INT fd_keyfile; /* file_table entry for key file */
|
||||
INT fd_keyno; /* key prefix number */
|
||||
INT fd_ptr; /* offset to field in record or
|
||||
1st compound key field in key_table */
|
||||
INT fd_rec; /* record table entry of record containing field */
|
||||
INT fd_flags; /* 0x0001 is set if field in "by" clause of set spec
|
||||
0x0002 is set if field member of struct field
|
||||
0x0004 is set if field is unsigned data type
|
||||
0x0008 is set if field is an optional key */
|
||||
} FIELD_ENTRY;
|
||||
|
||||
/* compound key table entry declaration */
|
||||
typedef struct KEY_ENTRY_S {
|
||||
INT kt_key; /* compound key field number */
|
||||
INT kt_field; /* field number of included field */
|
||||
INT kt_ptr; /* offset to start of field data in key */
|
||||
INT kt_sort; /* 'a' = ascending, 'd' = descending */
|
||||
} KEY_ENTRY;
|
||||
|
||||
#ifndef ONE_DB
|
||||
/* database table entry declaration */
|
||||
typedef struct DB_ENTRY_S {
|
||||
char db_name[DBNMLEN]; /* name of this database */
|
||||
char db_path[PATHLEN]; /* name of path to this database */
|
||||
DB_ADDR sysdba; /* database address of system record */
|
||||
DB_ADDR curr_dbt_rec;/* this db's current record */
|
||||
INT Page_size; /* size of this db's page */
|
||||
INT Size_ft; /* size of this db's file_table */
|
||||
INT ft_offset; /* offset to start of this db's file_table entries */
|
||||
INT Size_rt; /* size of this db's record_table */
|
||||
INT rt_offset; /* offset to start of this db's record_table entries */
|
||||
INT Size_fd; /* size of this db's field_table */
|
||||
INT fd_offset; /* offset to start of this db's field_table entries */
|
||||
INT Size_st; /* size of this db's set_table */
|
||||
INT st_offset; /* offset to start of this db's set_table entries */
|
||||
INT Size_mt; /* size of this db's member_table */
|
||||
INT mt_offset; /* offset to start of this db's member_table entries */
|
||||
INT Size_srt; /* size of this db's sort_table */
|
||||
INT srt_offset; /* offset to start of this db's sort_table entries */
|
||||
INT Size_kt; /* size of this db's key_table */
|
||||
INT kt_offset; /* offset to strary of this db's key table entries */
|
||||
INT key_offset; /* key prefix offset for this db */
|
||||
} DB_ENTRY;
|
||||
|
||||
/* Structure containing current record type & address for recfrst/set/next..*/
|
||||
typedef struct RN_ENTRY_S {
|
||||
INT rn_type; /* Last record type supplied to recfrst/recset */
|
||||
DB_ADDR rn_dba; /* Last db addr computed by recfrst/recset/recnext */
|
||||
} RN_ENTRY;
|
||||
#define DB_REF(item) (db_global.Curr_db_table->item)
|
||||
#define RN_REF(item) (curr_rn_table->item)
|
||||
#define NUM2INT(num, offset) ((num) + db_global.Curr_db_table->offset)
|
||||
#define NUM2EXT(num, offset) ((num) - db_global.Curr_db_table->offset)
|
||||
#define ORIGIN(offset) (curr_db_table->offset)
|
||||
#ifndef NO_DBN
|
||||
#define CURR_DB_PARM , curr_db
|
||||
#define DBN_PARM , dbn
|
||||
#define DBN_ONLY dbn
|
||||
#define DBN_DECL int dbn;
|
||||
#else
|
||||
#define CURR_DB_PARM /**/
|
||||
#define DBN_PARM /**/
|
||||
#define DBN_ONLY /**/
|
||||
#define DBN_DECL /**/
|
||||
#endif
|
||||
#else
|
||||
#define DB_REF(item) (db_global.item)
|
||||
#define RN_REF(item) (db_global.item)
|
||||
#define NUM2INT(num, offset) (num)
|
||||
#define NUM2EXT(num, offset) (num)
|
||||
#define ORIGIN(offset) (0)
|
||||
#define CURR_DB_PARM /**/
|
||||
#define DBN_PARM /**/
|
||||
#define DBN_ONLY /**/
|
||||
#define DBN_DECL /**/
|
||||
#endif
|
||||
#define TABLE_SIZE(size) DB_REF(size)
|
||||
|
||||
/* DBN_PARM... and TASK_PARM... are used for function interfaces */
|
||||
#ifdef MULTI_TASK
|
||||
#define TASK_PARM , task
|
||||
#define TASK_PARM_DBN task ,
|
||||
#define TASK_ONLY task
|
||||
#define TASK_DECL DB_TASK task;
|
||||
#define TASK_PTR_DECL DB_TASK FAR *task;
|
||||
#define TASK_DBN_ONLY task DBN_PARM
|
||||
#else
|
||||
#define TASK_PARM /**/
|
||||
#define TASK_PARM_DBN /**/
|
||||
#define TASK_ONLY /**/
|
||||
#define TASK_DECL /**/
|
||||
#define TASK_PTR_DECL /**/
|
||||
#define TASK_DBN_ONLY DBN_ONLY
|
||||
#endif
|
||||
|
||||
#ifndef NO_COUNTRY
|
||||
/* Country code table definition */
|
||||
typedef struct CNTRY_TBL_S {
|
||||
unsigned char out_chr;
|
||||
unsigned char sort_as1;
|
||||
unsigned char sort_as2;
|
||||
unsigned char sub_sort;
|
||||
} CNTRY_TBL;
|
||||
#endif
|
||||
|
||||
/* names lists structure declaration */
|
||||
typedef struct OBJNAMES_S {
|
||||
char **recs;
|
||||
char **flds;
|
||||
char **sets;
|
||||
} OBJNAMES;
|
||||
|
||||
|
||||
/* directory separator character:
|
||||
MS-DOS: '\'
|
||||
UNIX: '/'
|
||||
*/
|
||||
#ifdef HHS
|
||||
#define DIRCHAR '*'
|
||||
#else
|
||||
#define DIRCHAR '/'
|
||||
#endif
|
||||
|
||||
/* The following define aid in the use of a set of routines which use RMS
|
||||
directly to do the i/o to database files. */
|
||||
|
||||
#define DB_OPEN open_b
|
||||
#define DB_CLOSE close
|
||||
#define DB_LSEEK lseek
|
||||
#define DB_WRITE write
|
||||
#define DB_READ read
|
||||
|
||||
typedef struct {FILE_NO FAR *ptr; LOCK_DESC} FILE_NO_P;
|
||||
typedef struct {int FAR *ptr; LOCK_DESC} INT_P;
|
||||
typedef struct {struct NODE_PATH_S FAR *ptr; LOCK_DESC} NODE_PATH_P;
|
||||
#ifndef SINGLE_USER
|
||||
typedef struct {struct lock_descr FAR *ptr; LOCK_DESC} LOCK_DESCR_P;
|
||||
typedef struct {struct LM_LOCK_S FAR *ptr; LOCK_DESC} LM_LOCK_P;
|
||||
typedef struct {struct LM_FREE_S FAR *ptr; LOCK_DESC} LM_FREE_P;
|
||||
typedef struct {struct LM_DBOPEN_S FAR *ptr; LOCK_DESC} LM_DBOPEN_P;
|
||||
typedef struct {struct LM_DBCLOSE_S FAR *ptr; LOCK_DESC} LM_DBCLOSE_P;
|
||||
typedef struct {struct LR_DBOPEN_S FAR *ptr; LOCK_DESC} LR_DBOPEN_P;
|
||||
#endif
|
||||
typedef struct {struct KEY_INFO_S FAR *ptr; LOCK_DESC} KEY_INFO_P;
|
||||
typedef struct {struct ren_entry FAR *ptr; LOCK_DESC} REN_ENTRY_P;
|
||||
typedef struct {struct RN_ENTRY_S FAR *ptr; LOCK_DESC} RN_ENTRY_P;
|
||||
typedef struct {struct LOOKUP_ENTRY_S FAR *ptr; LOCK_DESC} LOOKUP_ENTRY_P;
|
||||
typedef struct {struct page_entry FAR *ptr; LOCK_DESC} PAGE_ENTRY_P;
|
||||
typedef struct {struct DB_ENTRY_S FAR *ptr; LOCK_DESC} DB_ENTRY_P;
|
||||
typedef struct {struct FILE_ENTRY_S FAR *ptr; LOCK_DESC} FILE_ENTRY_P;
|
||||
typedef struct {struct RECORD_ENTRY_S FAR *ptr; LOCK_DESC} RECORD_ENTRY_P;
|
||||
typedef struct {struct SET_ENTRY_S FAR *ptr; LOCK_DESC} SET_ENTRY_P;
|
||||
typedef struct {struct MEMBER_ENTRY_S FAR *ptr; LOCK_DESC} MEMBER_ENTRY_P;
|
||||
typedef struct {struct SORT_ENTRY_S FAR *ptr; LOCK_DESC} SORT_ENTRY_P;
|
||||
typedef struct {struct FIELD_ENTRY_S FAR *ptr; LOCK_DESC} FIELD_ENTRY_P;
|
||||
typedef struct {struct KEY_ENTRY_S FAR *ptr; LOCK_DESC} KEY_ENTRY_P;
|
||||
typedef struct {struct PGZERO_S FAR *ptr; LOCK_DESC} PGZERO_P;
|
||||
typedef struct {struct RI_ENTRY_S FAR *ptr; LOCK_DESC} RI_ENTRY_P;
|
||||
typedef struct {ULONG FAR *ptr; LOCK_DESC} ULONG_P;
|
||||
typedef struct {LONG FAR *ptr; LOCK_DESC} LONG_P;
|
||||
#ifndef NO_COUNTRY
|
||||
typedef struct {struct CNTRY_TBL_S FAR *ptr; LOCK_DESC} CNTRY_TBL_P;
|
||||
#endif
|
||||
static struct sk {
|
||||
INT sk_fld;
|
||||
CHAR_P sk_val;
|
||||
} __SK__;
|
||||
typedef struct { struct sk FAR *ptr; LOCK_DESC } SK_P;
|
||||
|
||||
/* node key search path stack entry: one per level per key field */
|
||||
typedef struct NODE_PATH_S {
|
||||
F_ADDR node; /* node (page) number */
|
||||
INT slot; /* slot number of key */
|
||||
} NODE_PATH;
|
||||
|
||||
/* index key information: one entry per key field */
|
||||
typedef struct KEY_INFO_S {
|
||||
NODE_PATH_P Node_path; /* stack of node #s in search path */
|
||||
INT level; /* current level # in node path */
|
||||
INT max_lvls; /* maximum possible levels for key */
|
||||
INT lstat; /* last key function status */
|
||||
INT fldno; /* field number of key */
|
||||
FILE_NO keyfile; /* key file containing this key */
|
||||
CHAR_P Keyval; /* ptr to last key value */
|
||||
DB_ADDR dba; /* db address of last key */
|
||||
} KEY_INFO;
|
||||
#define node_path Node_path.ptr
|
||||
#define keyval Keyval.ptr
|
||||
|
||||
/* key slot structure */
|
||||
typedef struct key_slot {
|
||||
F_ADDR child; /* child node pointer */
|
||||
INT keyno; /* key number */
|
||||
char data[1]; /* start of key data */
|
||||
} KEY_SLOT;
|
||||
|
||||
typedef union key_type {
|
||||
char kd[256];
|
||||
struct key_slot ks;
|
||||
} KEY_TYPE;
|
||||
|
||||
/* file rename table entry declarations */
|
||||
typedef struct ren_entry {
|
||||
CHAR_P Ren_db_name;
|
||||
CHAR_P File_name;
|
||||
FILE_NO file_no;
|
||||
} REN_ENTRY;
|
||||
|
||||
#define bytecpy(s1, s2, n) memcpy((char *)(s1), (char *)(s2), (unsigned)(n))
|
||||
#define bytecmp(s1, s2, n) memcmp((char *)(s1), (char *)(s2), (unsigned)(n))
|
||||
#define byteset(s, c, n) memset((char *)(s), (char)(c), (unsigned)(n))
|
||||
|
||||
typedef struct MESSAGE_S {
|
||||
#ifdef GENERAL
|
||||
INT mtype;
|
||||
char mtext[1];
|
||||
#else /* GENERAL */
|
||||
LONG mtype;
|
||||
int pid;
|
||||
char mtext[1];
|
||||
#endif /* GENERAL */
|
||||
} MESSAGE;
|
||||
|
||||
#ifdef ONE_DB
|
||||
#define NO_DBN
|
||||
#endif
|
||||
|
||||
#ifndef NO_DBN /* NO_DBN */
|
||||
#ifdef COMMA /* COMMA */
|
||||
#define DB_ID , dbn
|
||||
#define NO_DB_ID , -1
|
||||
#define DBN_PARAM , b
|
||||
#else /* COMMA */
|
||||
#define DB_ID dbn
|
||||
#define NO_DB_ID -1
|
||||
#define DBN_PARAM b
|
||||
#define COMMA
|
||||
#endif /* COMMA */
|
||||
#else /* NO_DBN */
|
||||
#define DBN_PARAM /**/
|
||||
#define DB_ID /**/
|
||||
#define DB_PARM /**/
|
||||
#define NO_DB_ID /**/
|
||||
#endif /* NO_DBN */
|
||||
|
||||
#ifdef MULTI_TASK
|
||||
#ifdef COMMA
|
||||
#define TASK_ID , &task
|
||||
#define TASK_PTR_ID , task
|
||||
#define NO_TASK_ID , NULL
|
||||
#define TASK_PARAM , c
|
||||
#else
|
||||
#define TASK_ID &task
|
||||
#define TASK_PTR_ID task
|
||||
#define NO_TASK_ID NULL
|
||||
#define TASK_PARAM c
|
||||
#define COMMA
|
||||
#endif
|
||||
#else
|
||||
#define TASK_PARAM /**/
|
||||
#define TASK_ID /**/
|
||||
#define TASK_PTR_ID /**/
|
||||
#define NO_TASK_ID /**/
|
||||
#endif
|
||||
|
||||
#define LOCK_PARAM /**/
|
||||
#define LOCK_PARM /**/
|
||||
#define LOCK_DECL /**/
|
||||
#define LOCK_SET(a) /**/
|
||||
|
||||
#define TDTL_PARAM DBN_PARAM TASK_PARAM LOCK_PARAM
|
||||
|
||||
#define DB_ENTER(TDTL_PARAM) if ( startup(TDTL_PARAM) != S_OKAY ) { return( db_status ); } else
|
||||
|
||||
#define RETURN(x) return( x )
|
||||
#define ALLOC(l, b, v) d_alloc(b)
|
||||
#define CALLOC(l, i, s, v) d_calloc(i, s)
|
||||
#define MEM_LOCK(cp) d_memlock((CHAR_P FAR *)(cp))
|
||||
#define MEM_UNLOCK(cp) d_memunlock((CHAR_P FAR *)(cp))
|
||||
#define FREE(cp) d_free((CHAR_P FAR *)(cp))
|
||||
|
||||
/* Lock sets are defined in dblfcns.c */
|
||||
#define LOCK_NONE -1
|
||||
#define LOCK_ALL 0
|
||||
#define LOCK_IO 1
|
||||
#define LOCK_NOIO 2
|
||||
#define RECORD_IO 3
|
||||
#define RECORD_NOIO 4
|
||||
#define SET_IO 5
|
||||
#define SET_NOIO 6
|
||||
|
||||
#ifdef GENERAL
|
||||
#define TIMEOUT_DEF 20
|
||||
#else
|
||||
#define TIMEOUT_DEF 10
|
||||
#endif
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include "trxlog.h"
|
||||
#include "dblock.h"
|
||||
#include "ll.h"
|
||||
#include "dbxtrn.h"
|
||||
|
||||
typedef struct LOOKUP_ENTRY_S {
|
||||
#ifdef MULTI_TASK
|
||||
TASK FAR *task; /* task pointer */
|
||||
#endif
|
||||
FILE_NO file; /* file table entry number (0..size_ft-1) */
|
||||
F_ADDR pageno; /* database page number */
|
||||
short pg_slot; /* page table slot pointing to this entry */
|
||||
} LOOKUP_ENTRY;
|
||||
|
||||
/* virtual page table entry */
|
||||
typedef struct page_entry {
|
||||
BOOLEAN recently_used; /* LRU flag */
|
||||
BOOLEAN modified; /* TRUE if page has been modified */
|
||||
INT holdcnt; /* "hold-in-cache" counter */
|
||||
short lu_slot; /* lookup table slot pointing to this entry */
|
||||
#ifndef NO_TRANS
|
||||
F_ADDR ovfl_addr; /* overflow file address of page */
|
||||
#endif
|
||||
CHAR_P Buff; /* page buffer pointer */
|
||||
} PAGE_ENTRY;
|
||||
#define buff Buff.ptr
|
||||
|
||||
#include "proto.h"
|
||||
#ifdef MULTI_TASK
|
||||
#ifdef NO_DT_COVER
|
||||
#include "dtcover.h"
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef SINGLE_USER
|
||||
/* record/set lock descriptor */
|
||||
struct lock_descr {
|
||||
FILE_NO_P fl_list; /* array of files used by record/set */
|
||||
int fl_cnt; /* Number of elements in fl_list */
|
||||
BOOLEAN fl_kept; /* Is lock kept after transaction? */
|
||||
char fl_type; /* lock type: 'r' = read, 'w' = write,
|
||||
'x' = exclusive, 'f' = free */
|
||||
char fl_prev; /* previous lock type */
|
||||
};
|
||||
#endif
|
||||
/* vpp -nOS2 -dUNIX -nBSD -nVANILLA_BSD -nVMS -nMEMLOCK -nWINDOWS -nFAR_ALLOC dbtype.h */
|
||||
58
cde/lib/DtSearch/raima/dbuserid.c
Normal file
58
cde/lib/DtSearch/raima/dbuserid.c
Normal file
@@ -0,0 +1,58 @@
|
||||
/* $XConsortium: dbuserid.c /main/2 1996/05/09 04:03:46 drk $ */
|
||||
/*
|
||||
* COMPONENT_NAME: austext
|
||||
*
|
||||
* FUNCTIONS: d_dbuserid
|
||||
*
|
||||
* ORIGINS: 157
|
||||
*
|
||||
* OBJECT CODE ONLY SOURCE MATERIALS
|
||||
*/
|
||||
/*-----------------------------------------------------------------------
|
||||
dbuserid.c -- db_VISTA user identifier set module.
|
||||
|
||||
(C) Copyright 1987 by Raima Corporation.
|
||||
-----------------------------------------------------------------------*/
|
||||
|
||||
/* ********************** EDIT HISTORY *******************************
|
||||
|
||||
SCR DATE INI DESCRIPTION
|
||||
----- --------- --- -----------------------------------------------------
|
||||
04-Aug-88 RTK MULTI_TASK changes
|
||||
418 05-Oct-88 RSC also allow underscores in dbuserid
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <ctype.h>
|
||||
#include "vista.h"
|
||||
#include "dbtype.h"
|
||||
|
||||
/* Set Database User Identifier
|
||||
*/
|
||||
d_dbuserid(id TASK_PARM)
|
||||
CONST char FAR *id;
|
||||
TASK_DECL
|
||||
{
|
||||
CONST char FAR *chk_id;
|
||||
|
||||
DB_ENTER(NO_DB_ID TASK_ID LOCK_SET(LOCK_NONE));
|
||||
|
||||
for (chk_id = id; *chk_id; chk_id++) {
|
||||
if (isascii(*chk_id)) {
|
||||
if (!isalnum(*chk_id)) {
|
||||
if (*chk_id != '_') RETURN ( dberr(S_BADUSERID));
|
||||
}
|
||||
}
|
||||
else RETURN ( dberr(S_BADUSERID));
|
||||
}
|
||||
|
||||
if (dbopen)
|
||||
dberr(S_DBOPEN);
|
||||
else {
|
||||
strncpy(dbuserid, id, FILENMLEN - 1);
|
||||
dbuserid[FILENMLEN - 1] = '\0';
|
||||
db_status = S_OKAY;
|
||||
}
|
||||
RETURN( db_status );
|
||||
}
|
||||
/* vpp -nOS2 -dUNIX -nBSD -nVANILLA_BSD -nVMS -nMEMLOCK -nWINDOWS -nFAR_ALLOC -f/usr/users/master/config/nonwin dbuserid.c */
|
||||
266
cde/lib/DtSearch/raima/dbxtrn.h
Normal file
266
cde/lib/DtSearch/raima/dbxtrn.h
Normal file
@@ -0,0 +1,266 @@
|
||||
/* $XConsortium: dbxtrn.h /main/2 1996/05/09 04:04:00 drk $ */
|
||||
/*
|
||||
* COMPONENT_NAME: austext
|
||||
*
|
||||
* FUNCTIONS: none
|
||||
*
|
||||
* ORIGINS: 157
|
||||
*
|
||||
*/
|
||||
/*----------------------------------------------------------------------------
|
||||
dbxtrn.h: db_VISTA external data header file
|
||||
|
||||
(This file is included by dbtype.h)
|
||||
|
||||
(C) Copyright 1984 by Raima Corporation.
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/* ********************** EDIT HISTORY *******************************
|
||||
|
||||
SCR DATE INI DESCRIPTION
|
||||
----- --------- --- -----------------------------------------------------
|
||||
423 22-Sep-88 RSC Cleanup file to compile under Lattice
|
||||
368 23-Sep-88 RSC Changed defn of Last_mtype to match dbtype.h
|
||||
439 17-Nov-88 RSC Integrate 3.10 branch (w/o windows) into main
|
||||
440 13-Dec-88 RSC LR_LOCK was removed from db_global for general LM
|
||||
532 06-Jan-89 RSC Fixed defns of rn_dba/type,db_name for ONE_DB
|
||||
05-May-89 WLW Changed TASK_P to DB_TASK for query multi-tasking
|
||||
|
||||
*/
|
||||
|
||||
/* Database Dictionary Tables */
|
||||
extern INT largest_page;
|
||||
|
||||
#ifndef ONE_DB
|
||||
extern INT old_size_ft;
|
||||
extern INT old_size_fd;
|
||||
extern INT old_size_st;
|
||||
extern INT old_size_mt;
|
||||
extern INT old_size_srt;
|
||||
extern INT old_size_kt;
|
||||
extern INT old_size_rt;
|
||||
extern INT old_no_of_dbs;
|
||||
#else
|
||||
#define old_size_ft 0
|
||||
#define old_size_fd 0
|
||||
#define old_size_st 0
|
||||
#define old_size_mt 0
|
||||
#define old_size_srt 0
|
||||
#define old_size_kt 0
|
||||
#define old_size_rt 0
|
||||
#define old_no_of_dbs 0
|
||||
#endif
|
||||
|
||||
extern char FAR *crloc; /* location in page buffer of current record */
|
||||
|
||||
typedef struct TASK_S {
|
||||
/* The following global variables came from dblfcns.c */
|
||||
#ifndef SINGLE_USER
|
||||
int Lock_tries; /* lock_tries = 5 */
|
||||
int Dbwait_time; /* dbwait_time = 1 */
|
||||
int Db_timeout; /* db_timeout = TIMEOUT_DEF */
|
||||
#endif
|
||||
int Dbopen; /* dbopen = 0 */
|
||||
#ifndef SINGLE_USER
|
||||
int Db_lockmgr; /* db_lockmgr = 1 */
|
||||
#endif
|
||||
char Dbuserid[FILENMLEN]; /* dbuserid = "" */
|
||||
char Dbdpath[FILENMLEN*2]; /* dbdpath = "" */
|
||||
char Dbfpath[FILENMLEN*2]; /* dbdpath = "" */
|
||||
#ifndef SINGLE_USER
|
||||
INT_P App_locks; /* app_locks = NULL */
|
||||
INT_P Excl_locks; /* excl_locks = NULL */
|
||||
INT_P Kept_locks; /* kept_locks = NULL */
|
||||
#endif
|
||||
CONST char FAR *Trans_id; /* trans_id = NULL */
|
||||
char Dblog[FILENMLEN]; /* dblog = "" */
|
||||
#ifndef SINGLE_USER
|
||||
LOCK_DESCR_P Rec_locks; /* rec_locks = NULL */
|
||||
LOCK_DESCR_P Set_locks; /* set_locks = NULL */
|
||||
LOCK_DESCR_P Key_locks; /* key_locks = NULL */
|
||||
int Keyl_cnt;
|
||||
int Lp_size;
|
||||
int Fp_size;
|
||||
LM_LOCK_P Lock_pkt; /* lock_pkt = NULL */
|
||||
LM_FREE_P Free_pkt; /* free_pkt = NULL */
|
||||
FILE_NO_P File_refs;
|
||||
int Lsn;
|
||||
BOOLEAN Session_active; /* session_active = FALSE */
|
||||
#endif
|
||||
/* The following global variables came from dio.c */
|
||||
BOOLEAN Cache_ovfl; /* cache_ovfl = FALSE */
|
||||
PGZERO_P Pgzero; /* database file page 0 array */
|
||||
/* The following global variables came from keyfcns.c */
|
||||
int No_of_keys; /* no_of_keys = 0 */
|
||||
KEY_INFO_P Key_info; /* key_info = NULL */
|
||||
KEY_TYPE Key_type;
|
||||
/* The following global variables came from netwdos.c */
|
||||
int Net_status;
|
||||
LONG Last_mtype;
|
||||
/* The following global variables came from options.c */
|
||||
int Dboptions; /* ifdef NO_TRANS: dboptions =
|
||||
DCHAINUSE | TRLOGGING
|
||||
else: dboptions = DCHAINUSE */
|
||||
/* The following global variables came from ovfcns.c */
|
||||
long Ov_initaddr; /* ov_initaddr = 0L */
|
||||
long Ov_rootaddr; /* ov_rootaddr = 0L */
|
||||
long Ov_nextaddr; /* ov_nextaddr = 0L */
|
||||
RI_ENTRY_P Root_ix;
|
||||
/* The following global variables came from renfiles.c */
|
||||
llist Ren_list; /* Ren_list = LLIST_INIT() */
|
||||
/* The following global variables came from inittab.h */
|
||||
INT Page_size;
|
||||
#ifndef ONE_DB
|
||||
int Curr_db;
|
||||
DB_ENTRY FAR *Curr_db_table;
|
||||
#endif
|
||||
DB_ADDR Curr_rec; /* current record address */
|
||||
DB_ADDR_P Curr_own; /* current set owners array */
|
||||
DB_ADDR_P Curr_mem; /* current set members array */
|
||||
#ifndef NO_TIMESTAMP
|
||||
ULONG Cr_time;
|
||||
ULONG_P Co_time; /* co_time = NULL */
|
||||
ULONG_P Cm_time; /* cm_time = NULL */
|
||||
ULONG_P Cs_time; /* cs_time = NULL */
|
||||
BOOLEAN Db_tsrecs;
|
||||
BOOLEAN Db_tssets;
|
||||
#endif
|
||||
FILE_NO Ov_file;
|
||||
#ifndef ONE_DB
|
||||
BOOLEAN Setdb_on;
|
||||
INT No_of_dbs;
|
||||
RN_ENTRY_P Rn_table;
|
||||
RN_ENTRY FAR *Curr_rn_table;
|
||||
#else
|
||||
DB_ADDR rn_dba; /* last computed dba by recfrst/recset/recnext */
|
||||
INT rn_type; /* last record type supplied to recfrst/recset */
|
||||
INT Ft_offset;
|
||||
#endif
|
||||
#ifndef ONE_DB
|
||||
DB_ENTRY_P Db_table;
|
||||
#else
|
||||
char db_name[DBNMLEN]; /* name of this database */
|
||||
char db_path[PATHLEN]; /* name of path to this database */
|
||||
DB_ADDR sysdba; /* database address of system record */
|
||||
#endif
|
||||
FILE_ENTRY_P File_table;
|
||||
INT Size_ft;
|
||||
RECORD_ENTRY_P Record_table;
|
||||
INT Size_rt;
|
||||
SET_ENTRY_P Set_table;
|
||||
INT Size_st;
|
||||
MEMBER_ENTRY_P Member_table;
|
||||
INT Size_mt;
|
||||
SORT_ENTRY_P Sort_table;
|
||||
INT Size_srt;
|
||||
FIELD_ENTRY_P Field_table;
|
||||
INT Size_fd;
|
||||
KEY_ENTRY_P Key_table;
|
||||
INT Size_kt;
|
||||
int Lock_lvl;
|
||||
#define LOCK_STACK_SIZE 10
|
||||
int Lock_stack[LOCK_STACK_SIZE];
|
||||
#ifndef NO_COUNTRY
|
||||
CNTRY_TBL_P country_tbl;
|
||||
int ctbl_activ;
|
||||
char ctbpath[FILENMLEN];
|
||||
#endif
|
||||
llist Sk_list;
|
||||
} TASK;
|
||||
|
||||
/* Dynamically allocated global variables */
|
||||
#define app_locks db_global.App_locks.ptr
|
||||
#define excl_locks db_global.Excl_locks.ptr
|
||||
#define kept_locks db_global.Kept_locks.ptr
|
||||
#define rec_locks db_global.Rec_locks.ptr
|
||||
#define set_locks db_global.Set_locks.ptr
|
||||
#define key_locks db_global.Key_locks.ptr
|
||||
#define lock_pkt db_global.Lock_pkt.ptr
|
||||
#define free_pkt db_global.Free_pkt.ptr
|
||||
#define file_refs db_global.File_refs.ptr
|
||||
#define key_info db_global.Key_info.ptr
|
||||
#define curr_own db_global.Curr_own.ptr
|
||||
#define curr_mem db_global.Curr_mem.ptr
|
||||
#define rn_table db_global.Rn_table.ptr
|
||||
#define db_table db_global.Db_table.ptr
|
||||
#define file_table db_global.File_table.ptr
|
||||
#define record_table db_global.Record_table.ptr
|
||||
#define set_table db_global.Set_table.ptr
|
||||
#define member_table db_global.Member_table.ptr
|
||||
#define sort_table db_global.Sort_table.ptr
|
||||
#define field_table db_global.Field_table.ptr
|
||||
#define key_table db_global.Key_table.ptr
|
||||
#define pgzero db_global.Pgzero.ptr
|
||||
#define root_ix db_global.Root_ix.ptr
|
||||
#ifndef NO_TIMESTAMP
|
||||
#define co_time db_global.Co_time.ptr
|
||||
#define cm_time db_global.Cm_time.ptr
|
||||
#define cs_time db_global.Cs_time.ptr
|
||||
#endif
|
||||
/* Used in DIO.C and OVFCNS.C */
|
||||
#define ixpg_table Ixpg_table.ptr
|
||||
#define dbpgbuff Dbpgbuff.ptr
|
||||
#define ix_lookup Ix_lookup.ptr
|
||||
|
||||
/* Non-dynamically allocated global variables */
|
||||
#define lock_tries db_global.Lock_tries
|
||||
#define dbwait_time db_global.Dbwait_time
|
||||
#define db_timeout db_global.Db_timeout
|
||||
#define dbopen db_global.Dbopen
|
||||
#define db_lockmgr db_global.Db_lockmgr
|
||||
#define dbuserid db_global.Dbuserid
|
||||
#define dbdpath db_global.Dbdpath
|
||||
#define dbfpath db_global.Dbfpath
|
||||
#define trans_id db_global.Trans_id
|
||||
#define dblog db_global.Dblog
|
||||
#define keyl_cnt db_global.Keyl_cnt
|
||||
#define lp_size db_global.Lp_size
|
||||
#define fp_size db_global.Fp_size
|
||||
#define session_active db_global.Session_active
|
||||
#define cache_ovfl db_global.Cache_ovfl
|
||||
#define no_of_keys db_global.No_of_keys
|
||||
#define key_type db_global.Key_type
|
||||
#define net_status db_global.Net_status
|
||||
#define last_mtype db_global.Last_mtype
|
||||
#define dboptions db_global.Dboptions
|
||||
#define ov_initaddr db_global.Ov_initaddr
|
||||
#define ov_rootaddr db_global.Ov_rootaddr
|
||||
#define ov_nextaddr db_global.Ov_nextaddr
|
||||
#define page_size db_global.Page_size
|
||||
#define curr_db db_global.Curr_db
|
||||
#define curr_db_table db_global.Curr_db_table
|
||||
#define curr_rec db_global.Curr_rec
|
||||
#ifndef NO_TIMESTAMP
|
||||
#define cr_time db_global.Cr_time
|
||||
#define db_tsrecs db_global.Db_tsrecs
|
||||
#define db_tssets db_global.Db_tssets
|
||||
#endif
|
||||
#define ov_file db_global.Ov_file
|
||||
#ifndef ONE_DB
|
||||
#define setdb_on db_global.Setdb_on
|
||||
#define no_of_dbs db_global.No_of_dbs
|
||||
#define curr_rn_table db_global.Curr_rn_table
|
||||
#endif
|
||||
#define size_ft db_global.Size_ft
|
||||
#define size_rt db_global.Size_rt
|
||||
#define size_st db_global.Size_st
|
||||
#define size_mt db_global.Size_mt
|
||||
#define size_srt db_global.Size_srt
|
||||
#define size_fd db_global.Size_fd
|
||||
#define size_kt db_global.Size_kt
|
||||
#define lock_lvl db_global.Lock_lvl
|
||||
#define lock_stack db_global.Lock_stack
|
||||
#define ren_list db_global.Ren_list
|
||||
#define sk_list db_global.Sk_list
|
||||
|
||||
extern TASK db_global;
|
||||
extern int db_glob_init;
|
||||
#ifdef MULTI_TASK
|
||||
extern DB_TASK Currtask;
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef MULTI_TASK
|
||||
extern int task_count;
|
||||
#endif
|
||||
/* vpp -nOS2 -dUNIX -nBSD -nVANILLA_BSD -nVMS -nMEMLOCK -nWINDOWS -nFAR_ALLOC -f/usr/users/master/config/nonwin dbxtrn.h */
|
||||
116
cde/lib/DtSearch/raima/delete.c
Normal file
116
cde/lib/DtSearch/raima/delete.c
Normal file
@@ -0,0 +1,116 @@
|
||||
/* $XConsortium: delete.c /main/2 1996/05/09 04:04:16 drk $ */
|
||||
/*
|
||||
* COMPONENT_NAME: austext
|
||||
*
|
||||
* FUNCTIONS: d_delete
|
||||
*
|
||||
* ORIGINS: 157
|
||||
*
|
||||
* OBJECT CODE ONLY SOURCE MATERIALS
|
||||
*/
|
||||
/*-----------------------------------------------------------------------
|
||||
delete.c -- db_VISTA record deletion module.
|
||||
|
||||
(C) Copyright 1987 by Raima Corporation.
|
||||
-----------------------------------------------------------------------*/
|
||||
|
||||
/* ********************** EDIT HISTORY *******************************
|
||||
|
||||
SCR DATE INI DESCRIPTION
|
||||
----- --------- --- -----------------------------------------------------
|
||||
04-Aug-88 RTK MULTI_TASK changes
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include "vista.h"
|
||||
#include "dbtype.h"
|
||||
|
||||
static DB_ADDR zap_dba = NULL_DBA;
|
||||
|
||||
|
||||
/* Delete the current record, with error checking
|
||||
*/
|
||||
d_delete(TASK_DBN_ONLY)
|
||||
TASK_DECL
|
||||
DBN_DECL
|
||||
{
|
||||
register int st_lc, mt_lc; /* loop control */
|
||||
INT i, rt;
|
||||
char FAR *ptr;
|
||||
SET_ENTRY FAR *set_ptr;
|
||||
MEMBER_ENTRY FAR *mem_ptr;
|
||||
DB_ADDR FAR *co_ptr, FAR *cm_ptr;
|
||||
#ifndef NO_TIMESTAMP
|
||||
ULONG FAR *cots_ptr, FAR *cmts_ptr, FAR *sts_ptr;
|
||||
#endif
|
||||
|
||||
DB_ENTER(DB_ID TASK_ID LOCK_SET(SET_IO));
|
||||
|
||||
if ( ! dbopen ) RETURN( dberr(S_DBOPEN) );
|
||||
|
||||
if ( ! curr_rec ) RETURN( dberr( S_NOCR ) );
|
||||
|
||||
/* get the record type of the current record */
|
||||
if ( dio_read( curr_rec, (char FAR * FAR *)&ptr , NOPGHOLD) != S_OKAY )
|
||||
RETURN( db_status );
|
||||
bytecpy( &rt, ptr, sizeof(INT) );
|
||||
if (rt < 0)
|
||||
RETURN( dberr(S_INVADDR) );
|
||||
rt &= ~RLBMASK; /* mask off rlb */
|
||||
#ifndef ONE_DB
|
||||
rt += curr_db_table->rt_offset;
|
||||
#endif
|
||||
|
||||
/* make sure this is not the system record */
|
||||
if ( record_table[rt].rt_fdtot == -1 )
|
||||
RETURN( dberr( S_DELSYS ) );
|
||||
|
||||
/* scan the set list for sets that this record owns to confirm it is
|
||||
empty
|
||||
*/
|
||||
for (st_lc = size_st, set_ptr = set_table; --st_lc >= 0; ++set_ptr) {
|
||||
if ((set_ptr->st_own_rt == rt) &&
|
||||
(bytecmp(ptr+set_ptr->st_own_ptr+SP_FIRST,&zap_dba,DB_ADDR_SIZE) != 0))
|
||||
RETURN( dberr( S_HASMEM ) );
|
||||
}
|
||||
/* scan the member list for sets which own this record */
|
||||
for (mt_lc = size_mt, mem_ptr = member_table; --mt_lc >= 0; ++mem_ptr) {
|
||||
if ((mem_ptr->mt_record == rt) &&
|
||||
(bytecmp(ptr+mem_ptr->mt_mem_ptr+MP_OWNER,&zap_dba,DB_ADDR_SIZE) != 0))
|
||||
RETURN( dberr( S_ISMEM ) );
|
||||
}
|
||||
/* delete record */
|
||||
if ( r_delrec( rt, curr_rec ) == S_OKAY ) {
|
||||
/* nullify any currency containing deleted record */
|
||||
#ifndef NO_TIMESTAMP
|
||||
for (i = 0, co_ptr = curr_own, cm_ptr = curr_mem, cots_ptr = co_time,
|
||||
cmts_ptr = cm_time, sts_ptr = cs_time;
|
||||
i < size_st;
|
||||
++i, ++co_ptr, ++cm_ptr, ++cots_ptr, ++cmts_ptr, ++sts_ptr) {
|
||||
#else
|
||||
for (i = 0, co_ptr = curr_own, cm_ptr = curr_mem;
|
||||
i < size_st;
|
||||
++i, ++co_ptr, ++cm_ptr) {
|
||||
#endif
|
||||
if ( ADDRcmp(&curr_rec, co_ptr) == 0 ) {
|
||||
*co_ptr = NULL_DBA;
|
||||
#ifndef NO_TIMESTAMP
|
||||
if ( db_tsrecs ) *cots_ptr = 0L;
|
||||
if ( db_tssets ) *sts_ptr = 0L;
|
||||
#endif
|
||||
}
|
||||
if ( ADDRcmp(&curr_rec, cm_ptr) == 0 ) {
|
||||
*cm_ptr = NULL_DBA;
|
||||
#ifndef NO_TIMESTAMP
|
||||
if ( db_tsrecs ) *cmts_ptr = 0L;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
curr_rec = NULL_DBA;
|
||||
#ifndef NO_TIMESTAMP
|
||||
cr_time = 0L;
|
||||
#endif
|
||||
}
|
||||
RETURN( db_status );
|
||||
}
|
||||
/* vpp -nOS2 -dUNIX -nBSD -nVANILLA_BSD -nVMS -nMEMLOCK -nWINDOWS -nFAR_ALLOC -f/usr/users/master/config/nonwin delete.c */
|
||||
71
cde/lib/DtSearch/raima/destroy.c
Normal file
71
cde/lib/DtSearch/raima/destroy.c
Normal file
@@ -0,0 +1,71 @@
|
||||
/* $XConsortium: destroy.c /main/2 1996/05/09 04:04:29 drk $ */
|
||||
/*
|
||||
* COMPONENT_NAME: austext
|
||||
*
|
||||
* FUNCTIONS: d_destroy
|
||||
*
|
||||
* ORIGINS: 157
|
||||
*
|
||||
* OBJECT CODE ONLY SOURCE MATERIALS
|
||||
*/
|
||||
/*-----------------------------------------------------------------------
|
||||
destroy.c -- db_VISTA database remove module.
|
||||
|
||||
(C) Copyright 1987 by Raima Corporation.
|
||||
-----------------------------------------------------------------------*/
|
||||
|
||||
/* ********************** EDIT HISTORY *******************************
|
||||
|
||||
SCR DATE INI DESCRIPTION
|
||||
----- --------- --- -----------------------------------------------------
|
||||
04-Aug-88 RTK MULTI_TASK changes
|
||||
17-Oct-88 RSC Changed return to RETURN
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include "vista.h"
|
||||
#include "dbtype.h"
|
||||
|
||||
|
||||
/* Database remove function
|
||||
*/
|
||||
/* Warning: this function will destroy the entire contents
|
||||
of the database
|
||||
*/
|
||||
d_destroy(dbname TASK_PARM)
|
||||
CONST char FAR *dbname;
|
||||
TASK_DECL
|
||||
{
|
||||
register int ft_lc; /* loop control */
|
||||
register FILE_ENTRY FAR *file_ptr;
|
||||
int ovfl_save;
|
||||
|
||||
DB_ENTER(NO_DB_ID TASK_ID LOCK_SET(LOCK_ALL));
|
||||
|
||||
/* database must be closed (might be multiple databases open) */
|
||||
if ( dbopen ) d_close(TASK_ONLY);
|
||||
#ifndef NO_TRANS
|
||||
|
||||
ovfl_save = use_ovfl;
|
||||
use_ovfl = NO;
|
||||
#endif
|
||||
|
||||
/* prepare for the inittab and read in the database tables */
|
||||
if ((initdbt(dbname) != S_OKAY) || (inittab() != S_OKAY))
|
||||
RETURN( db_status );
|
||||
|
||||
/* remove db files in file_table */
|
||||
for (ft_lc = size_ft, file_ptr = file_table; --ft_lc >= 0; ++file_ptr) {
|
||||
unlink(file_ptr->ft_name);
|
||||
}
|
||||
|
||||
/* free all residual memory */
|
||||
termfree();
|
||||
#ifndef NO_TRANS
|
||||
|
||||
use_ovfl = ovfl_save;
|
||||
#endif
|
||||
|
||||
RETURN( db_status );
|
||||
}
|
||||
/* vpp -nOS2 -dUNIX -nBSD -nVANILLA_BSD -nVMS -nMEMLOCK -nWINDOWS -nFAR_ALLOC -f/usr/users/master/config/nonwin destroy.c */
|
||||
1901
cde/lib/DtSearch/raima/dio.c
Normal file
1901
cde/lib/DtSearch/raima/dio.c
Normal file
File diff suppressed because it is too large
Load Diff
176
cde/lib/DtSearch/raima/discon.c
Normal file
176
cde/lib/DtSearch/raima/discon.c
Normal file
@@ -0,0 +1,176 @@
|
||||
/* $XConsortium: discon.c /main/2 1996/05/09 04:04:43 drk $ */
|
||||
/*
|
||||
* COMPONENT_NAME: austext
|
||||
*
|
||||
* FUNCTIONS: d_discon
|
||||
*
|
||||
* ORIGINS: 157
|
||||
*
|
||||
* OBJECT CODE ONLY SOURCE MATERIALS
|
||||
*/
|
||||
/*-----------------------------------------------------------------------
|
||||
discon.c -- db_VISTA set dicconnection module
|
||||
|
||||
(C) Copyright 1985, 1986, 1987 by Raima Corp.
|
||||
-----------------------------------------------------------------------*/
|
||||
|
||||
/* ********************** EDIT HISTORY *******************************
|
||||
|
||||
SCR DATE INI DESCRIPTION
|
||||
----- --------- --- -----------------------------------------------------
|
||||
04-Aug-88 RTK MULTI_TASK changes
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include "vista.h"
|
||||
#include "dbtype.h"
|
||||
|
||||
/* set pointer structure definition */
|
||||
typedef struct {
|
||||
LONG total; /* total number of members in set */
|
||||
DB_ADDR first; /* database address of first member in set */
|
||||
DB_ADDR last; /* database address of last member in set */
|
||||
#ifndef NO_TIMESTAMP
|
||||
ULONG timestamp; /* set update timestamp - if used */
|
||||
#endif
|
||||
} SET_PTR;
|
||||
|
||||
/* member pointer structure definition */
|
||||
typedef struct {
|
||||
DB_ADDR owner; /* database address of owner record */
|
||||
DB_ADDR prev; /* database address of previous member in set */
|
||||
DB_ADDR next; /* database address of next member in set */
|
||||
} MEM_PTR;
|
||||
|
||||
|
||||
/* Disconnect the current member of set
|
||||
*/
|
||||
d_discon(nset TASK_PARM DBN_PARM)
|
||||
int nset; /* set number */
|
||||
TASK_DECL
|
||||
DBN_DECL /* database number */
|
||||
{
|
||||
SET_PTR cosp; /* current owner's set pointer */
|
||||
MEM_PTR cmmp; /* member's member pointer */
|
||||
MEM_PTR npmp; /* next or previous member's member pointer */
|
||||
char FAR *orec; /* ptr to current owner record contents in cache */
|
||||
char FAR *mrec = NULL; /* ptr to member record contents in cache */
|
||||
char FAR *nprec = NULL; /* ptr to next or prev record contents in cache */
|
||||
DB_ADDR mdba; /* db address of member record */
|
||||
DB_ADDR npdba; /* db address of next or previous member */
|
||||
int set; /* set_table entry */
|
||||
int stat; /* status code variable */
|
||||
#ifndef NO_TIMESTAMP
|
||||
FILE_NO file; /* file containing owner record */
|
||||
#endif
|
||||
SET_ENTRY FAR *set_ptr;
|
||||
DB_ADDR FAR *co_ptr, FAR *cm_ptr;
|
||||
|
||||
DB_ENTER(DB_ID TASK_ID LOCK_SET(SET_IO));
|
||||
|
||||
if (nset_check(nset, &set, (SET_ENTRY FAR * FAR *)&set_ptr) != S_OKAY)
|
||||
RETURN( db_status );
|
||||
|
||||
/* make sure we have a current owner */
|
||||
if ( !*(co_ptr = &curr_own[set]) )
|
||||
RETURN( dberr(S_NOCO) );
|
||||
|
||||
/* make sure we have a current member */
|
||||
if ( !*(cm_ptr = &curr_mem[set]) )
|
||||
RETURN( dberr(S_NOCM) );
|
||||
|
||||
/* read member record */
|
||||
mdba = *cm_ptr;
|
||||
if ( dio_read(mdba, (char FAR * FAR *)&mrec, PGHOLD) != S_OKAY )
|
||||
RETURN( db_status );
|
||||
|
||||
/* ensure record is connected */
|
||||
if ( (stat = r_gmem(set, mrec, (char FAR *)&cmmp)) != S_OKAY )
|
||||
goto quit_b;
|
||||
if ( cmmp.owner == NULL_DBA ) { /* checks owner pointer */
|
||||
stat = S_NOTCON;
|
||||
goto quit_b;
|
||||
}
|
||||
/* read owner record */
|
||||
if ( (stat = dio_read(*co_ptr, (char FAR * FAR *)&orec, PGHOLD)) != S_OKAY )
|
||||
goto quit_b;
|
||||
|
||||
/* get set pointer from owner */
|
||||
if ( r_gset(set, orec, (char FAR *)&cosp) != S_OKAY )
|
||||
goto quit_a;
|
||||
|
||||
if ( cmmp.next == NULL_DBA )
|
||||
/* last record in set */
|
||||
cosp.last = cmmp.prev;
|
||||
else {
|
||||
/* set next record's prev to current member's prev */
|
||||
npdba = cmmp.next;
|
||||
if ((dio_read(npdba, (char FAR * FAR *)&nprec, NOPGHOLD) != S_OKAY) ||
|
||||
(r_gmem(set, nprec, (char FAR *)&npmp) != S_OKAY))
|
||||
goto quit_a;
|
||||
npmp.prev = cmmp.prev;
|
||||
if ((r_pmem(set, nprec, (char FAR *)&npmp) != S_OKAY) ||
|
||||
(dio_write(npdba, NULL, NOPGFREE) != S_OKAY))
|
||||
goto quit_a;
|
||||
}
|
||||
if ( cmmp.prev == NULL_DBA )
|
||||
/* first record in set */
|
||||
cosp.first = cmmp.next;
|
||||
else {
|
||||
/* set previous record's next to current member's next */
|
||||
npdba = cmmp.prev;
|
||||
if ((dio_read(npdba, (char FAR * FAR *)&nprec, NOPGHOLD) != S_OKAY) ||
|
||||
(r_gmem(set, nprec, (char FAR *)&npmp) != S_OKAY))
|
||||
goto quit_a;
|
||||
npmp.next = cmmp.next;
|
||||
if ((r_pmem(set, nprec, (char FAR *)&npmp) != S_OKAY) ||
|
||||
(dio_write(npdba, NULL, NOPGFREE) != S_OKAY))
|
||||
goto quit_a;
|
||||
}
|
||||
#ifndef NO_TIMESTAMP
|
||||
/* check for timestamp */
|
||||
if ( set_ptr->st_flags & TIMESTAMPED ) {
|
||||
file = NUM2INT((FILE_NO)((*co_ptr >> FILESHIFT) & FILEMASK), ft_offset);
|
||||
cosp.timestamp = dio_pzgetts(file);
|
||||
}
|
||||
#endif
|
||||
/* update membership count */
|
||||
--cosp.total;
|
||||
|
||||
/* update owner record's set pointer */
|
||||
if ((r_pset(set, orec, (char FAR *)&cosp) != S_OKAY) ||
|
||||
(dio_write(*co_ptr, NULL, PGFREE) != S_OKAY))
|
||||
RETURN( db_status );
|
||||
|
||||
/* update current record and current member */
|
||||
curr_rec = mdba;
|
||||
*cm_ptr = cmmp.next;
|
||||
|
||||
/* make member record's member pointer null */
|
||||
cmmp.owner = cmmp.prev = cmmp.next = NULL_DBA;
|
||||
|
||||
/* update member record */
|
||||
if ((r_pmem(set, mrec, (char FAR *)&cmmp) != S_OKAY) ||
|
||||
(dio_write(mdba, NULL, PGFREE) != S_OKAY))
|
||||
RETURN( db_status );
|
||||
#ifndef NO_TIMESTAMP
|
||||
/* note timestamps */
|
||||
if ( db_tsrecs )
|
||||
d_utscr( &cr_time TASK_PARM );
|
||||
if ( db_tsrecs && *cm_ptr )
|
||||
d_utscm(nset, &cm_time[set] TASK_PARM DBN_PARM);
|
||||
|
||||
/* check for timestamp */
|
||||
if ( set_ptr->st_flags & TIMESTAMPED )
|
||||
cs_time[set] = cosp.timestamp;
|
||||
#endif
|
||||
RETURN( db_status = *cm_ptr ? S_OKAY : S_EOS );
|
||||
|
||||
quit_a:
|
||||
stat = db_status;
|
||||
dio_write(mdba, NULL, PGFREE);
|
||||
quit_b:
|
||||
dio_write(*co_ptr, NULL, PGFREE);
|
||||
RETURN( db_status = stat );
|
||||
}
|
||||
/* vpp -nOS2 -dUNIX -nBSD -nVANILLA_BSD -nVMS -nMEMLOCK -nWINDOWS -nFAR_ALLOC -f/usr/users/master/config/nonwin discon.c */
|
||||
95
cde/lib/DtSearch/raima/disdel.c
Normal file
95
cde/lib/DtSearch/raima/disdel.c
Normal file
@@ -0,0 +1,95 @@
|
||||
/* $XConsortium: disdel.c /main/2 1996/05/09 04:04:57 drk $ */
|
||||
/*
|
||||
* COMPONENT_NAME: austext
|
||||
*
|
||||
* FUNCTIONS: d_disdel
|
||||
*
|
||||
* ORIGINS: 157
|
||||
*
|
||||
* OBJECT CODE ONLY SOURCE MATERIALS
|
||||
*/
|
||||
/*-----------------------------------------------------------------------
|
||||
disdel.c -- db_VISTA set disconnection/deletion module
|
||||
|
||||
(C) Copyright 1985, 1986, 1987 by Raima Corp.
|
||||
-----------------------------------------------------------------------*/
|
||||
|
||||
/* ********************** EDIT HISTORY *******************************
|
||||
|
||||
SCR DATE INI DESCRIPTION
|
||||
----- --------- --- -----------------------------------------------------
|
||||
04-Aug-88 RTK MULTI_TASK changes
|
||||
518 06-Jan-89 RSC d_discon infinite loops (not checking d_discon status)
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include "vista.h"
|
||||
#include "dbtype.h"
|
||||
|
||||
/* Disconnect from all sets (owner and member) and delete record
|
||||
*/
|
||||
d_disdel(TASK_DBN_ONLY)
|
||||
TASK_DECL
|
||||
DBN_DECL
|
||||
{
|
||||
int rectype, nset, cset;
|
||||
register int set, mem;
|
||||
DB_ADDR dba, odba, mdba;
|
||||
DB_ADDR FAR *co_ptr, FAR *cm_ptr;
|
||||
register SET_ENTRY FAR *set_ptr;
|
||||
register MEMBER_ENTRY FAR *mem_ptr;
|
||||
int memtot;
|
||||
|
||||
DB_ENTER(DB_ID TASK_ID LOCK_SET(SET_IO));
|
||||
|
||||
if ( d_crtype(&rectype TASK_PARM DBN_PARM) != S_OKAY )
|
||||
RETURN( db_status );
|
||||
rectype += NUM2INT(-RECMARK, rt_offset);
|
||||
|
||||
d_crget(&dba TASK_PARM DBN_PARM);
|
||||
for (set = 0, set_ptr = &set_table[ORIGIN(st_offset)];
|
||||
set < TABLE_SIZE(Size_st);
|
||||
++set, ++set_ptr) {
|
||||
nset = set + SETMARK;
|
||||
cset = set + ORIGIN(st_offset);
|
||||
co_ptr = &curr_own[cset];
|
||||
cm_ptr = &curr_mem[cset];
|
||||
odba = *co_ptr;
|
||||
mdba = *cm_ptr;
|
||||
if (set_ptr->st_own_rt == rectype) {
|
||||
/* disconnect all member records from set s */
|
||||
d_setor(nset TASK_PARM DBN_PARM);
|
||||
while (d_findfm(nset TASK_PARM DBN_PARM) == S_OKAY)
|
||||
if (d_discon(nset TASK_PARM DBN_PARM) < S_OKAY)
|
||||
RETURN (db_status);
|
||||
d_setro(nset TASK_PARM DBN_PARM);
|
||||
}
|
||||
for (mem = set_ptr->st_members, memtot = mem + set_ptr->st_memtot,
|
||||
mem_ptr = &member_table[mem];
|
||||
mem < memtot;
|
||||
++mem, ++mem_ptr) {
|
||||
if (mem_ptr->mt_record == rectype) {
|
||||
/* disconnect current record from set */
|
||||
if (d_ismember(nset TASK_PARM DBN_PARM) == S_OKAY) {
|
||||
d_csmset(nset, &dba TASK_PARM DBN_PARM);
|
||||
if (d_discon(nset TASK_PARM DBN_PARM) < S_OKAY)
|
||||
RETURN (db_status);
|
||||
}
|
||||
}
|
||||
}
|
||||
curr_rec = dba;
|
||||
if ( dba == odba ) {
|
||||
*co_ptr = NULL_DBA;
|
||||
*cm_ptr = NULL_DBA;
|
||||
}
|
||||
else
|
||||
*co_ptr = odba;
|
||||
|
||||
if ( dba == mdba )
|
||||
*cm_ptr = NULL_DBA;
|
||||
else
|
||||
*cm_ptr = mdba;
|
||||
}
|
||||
RETURN( d_delete(TASK_DBN_ONLY) );
|
||||
}
|
||||
/* vpp -nOS2 -dUNIX -nBSD -nVANILLA_BSD -nVMS -nMEMLOCK -nWINDOWS -nFAR_ALLOC -f/usr/users/master/config/nonwin disdel.c */
|
||||
311
cde/lib/DtSearch/raima/dproto.h
Normal file
311
cde/lib/DtSearch/raima/dproto.h
Normal file
@@ -0,0 +1,311 @@
|
||||
/* $XConsortium: dproto.h /main/2 1996/05/09 04:05:13 drk $ */
|
||||
/*
|
||||
* COMPONENT_NAME: austext
|
||||
*
|
||||
* FUNCTIONS: Pi
|
||||
* d_alloc
|
||||
* d_calloc
|
||||
* d_cmstat
|
||||
* d_cmtype
|
||||
* d_connect
|
||||
* d_costat
|
||||
* d_cotype
|
||||
* d_crget
|
||||
* d_crread
|
||||
* d_crset
|
||||
* d_crtype
|
||||
* d_crwrite
|
||||
* d_csmget
|
||||
* d_csmread
|
||||
* d_csmset
|
||||
* d_csmwrite
|
||||
* d_csoget
|
||||
* d_csoread
|
||||
* d_csoset
|
||||
* d_csowrite
|
||||
* d_csstat
|
||||
* d_ctbpath
|
||||
* d_ctscm
|
||||
* d_ctsco
|
||||
* d_ctscr
|
||||
* d_dbdpath
|
||||
* d_dbfpath
|
||||
* d_dblog
|
||||
* d_dbtaf
|
||||
* d_dbuserid
|
||||
* d_decode_dba
|
||||
* d_destroy
|
||||
* d_discon
|
||||
* d_encode_dba
|
||||
* d_fillnew
|
||||
* d_findco
|
||||
* d_findfm
|
||||
* d_findlm
|
||||
* d_findnm
|
||||
* d_findpm
|
||||
* d_free
|
||||
* d_gtscm
|
||||
* d_gtsco
|
||||
* d_gtscr
|
||||
* d_gtscs
|
||||
* d_initfile
|
||||
* d_ismember
|
||||
* d_isowner
|
||||
* d_keydel
|
||||
* d_keyexist
|
||||
* d_keyfind
|
||||
* d_keyfree
|
||||
* d_keyfrst
|
||||
* d_keylast
|
||||
* d_keylock
|
||||
* d_keylstat
|
||||
* d_keynext
|
||||
* d_keyprev
|
||||
* d_keyread
|
||||
* d_keystore
|
||||
* d_lock
|
||||
* d_makenew
|
||||
* d_mapchar
|
||||
* d_members
|
||||
* d_memlock
|
||||
* d_memlock_group
|
||||
* d_memunlock
|
||||
* d_memunlock_group
|
||||
* d_off_opt
|
||||
* d_on_opt
|
||||
* d_open
|
||||
* d_rdcurr
|
||||
* d_recfree
|
||||
* d_recfrst
|
||||
* d_reclast
|
||||
* d_reclock
|
||||
* d_reclstat
|
||||
* d_recover
|
||||
* d_recread
|
||||
* d_recset
|
||||
* d_recstat
|
||||
* d_recwrite
|
||||
* d_renfile
|
||||
* d_rerdcurr
|
||||
* d_retries
|
||||
* d_set_dberr
|
||||
* d_setdb
|
||||
* d_setfiles
|
||||
* d_setfree
|
||||
* d_setkey
|
||||
* d_setlock
|
||||
* d_setlstat
|
||||
* d_setmm
|
||||
* d_setmo
|
||||
* d_setmr
|
||||
* d_setom
|
||||
* d_setoo
|
||||
* d_setor
|
||||
* d_setpages
|
||||
* d_setrm
|
||||
* d_setro
|
||||
* d_stscm
|
||||
* d_stsco
|
||||
* d_stscr
|
||||
* d_stscs
|
||||
* d_timeout
|
||||
* d_trbegin
|
||||
* d_trlog
|
||||
* d_utscm
|
||||
* d_utsco
|
||||
* d_utscr
|
||||
* d_utscs
|
||||
* d_wrcurr
|
||||
* dberr
|
||||
* dt_closetask
|
||||
* dt_opentask
|
||||
*
|
||||
* ORIGINS: 157
|
||||
*
|
||||
*/
|
||||
/*----------------------------------------------------------------------------
|
||||
dproto.h: db_VISTA (user) function declaration header file
|
||||
|
||||
(C) Copyright 1988 by Raima Corporation.
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/* ********************** EDIT HISTORY *******************************
|
||||
|
||||
SCR DATE INI DESCRIPTION
|
||||
----- --------- --- -----------------------------------------------------
|
||||
571 31-Jan-89 RSC Placed ctbpath inside NO_COUNTRY, not NO_TIMESTAMP
|
||||
*/
|
||||
|
||||
|
||||
int d_setfiles(P1(int)); /* dio.c */
|
||||
int d_setpages(P1(int) Pi(int)); /* dio.c */
|
||||
int d_trbound(P0); /* trlog.c */
|
||||
int d_trlog(P1(int) Pi(int) Pi(CONST char FAR *) Pi(int));
|
||||
/* trlog.c */
|
||||
int d_trmark(P0); /* trlog.c */
|
||||
int d_tron(P0); /* trlog.c */
|
||||
int d_troff(P0); /* trlog.c */
|
||||
int d_decode_dba(P1(DB_ADDR) Pi(int FAR *) Pi(long FAR *));
|
||||
/* dbacode.c */
|
||||
int d_encode_dba(P1(int) Pi(long) Pi(DB_ADDR FAR *));
|
||||
/* dbacode.c */
|
||||
|
||||
#define d_memlock(p) /**/
|
||||
#define d_memlock_group(lg) S_OKAY
|
||||
#define d_memunlock(p) /**/
|
||||
#define d_memunlock_group(lg) /**/
|
||||
char FAR * d_alloc(P1(unsigned)); /* alloc.c */
|
||||
char FAR * d_calloc(P1(unsigned) Pi(unsigned)); /* alloc.c */
|
||||
void d_free(P1(CHAR_P FAR *)); /* alloc.c */
|
||||
|
||||
#ifndef MULTI_TASK /* MULTI_TASK */
|
||||
#define dt_opentask(a) S_OKAY
|
||||
#define dt_closetask(a) S_OKAY
|
||||
|
||||
int d_close(P0); /* dblfcns.c */
|
||||
int d_cmstat(P1(int) DBN_Dn); /* cmstat.c */
|
||||
int d_cmtype(P1(int) Pi(int FAR *) DBN_Dn); /* cmtype.c */
|
||||
int d_connect(P1(int) DBN_Dn); /* connect.c */
|
||||
#ifndef NO_TIMESTAMP /* NO_TIMESTAMP */
|
||||
int d_costat(P1(int) DBN_Dn); /* costat.c */
|
||||
#endif /* NO_TIMESTAMP */
|
||||
int d_cotype(P1(int) Pi(int FAR *) DBN_Dn); /* cotype.c */
|
||||
int d_crget(P1(DB_ADDR FAR *) DBN_Dn); /* crget.c */
|
||||
int d_crread(P1(long) Pi(char FAR *) DBN_Dn); /* crread.c */
|
||||
int d_crset(P1(DB_ADDR FAR *) DBN_Dn); /* crset.c */
|
||||
#ifndef NO_TIMESTAMP /* NO_TIMESTAMP */
|
||||
int d_crstat(P0); /* crstat.c */
|
||||
#endif /* NO_TIMESTAMP */
|
||||
int d_crtype(P1(int FAR *) DBN_Dn); /* crtype.c */
|
||||
int d_crwrite(P1(long) Pi(char FAR *) DBN_Dn); /* crwrite.c */
|
||||
int d_csmget(P1(int) Pi(DB_ADDR FAR *) DBN_Dn); /* csmget.c */
|
||||
int d_csmread(P1(int) Pi(long) Pi(char FAR *) DBN_Dn);
|
||||
/* csmread.c */
|
||||
int d_csmset(P1(int) Pi(DB_ADDR FAR *) DBN_Dn); /* csmset.c */
|
||||
int d_csmwrite(P1(int) Pi(long) Pi(CONST char FAR *) DBN_Dn);
|
||||
/* csmwrite.c */
|
||||
int d_csoget(P1(int) Pi(DB_ADDR FAR *) DBN_Dn); /* csoget.c */
|
||||
int d_csoread(P1(int) Pi(long) Pi(char FAR *) DBN_Dn);
|
||||
/* csoread.c */
|
||||
int d_csoset(P1(int) Pi(DB_ADDR FAR *) DBN_Dn); /* csoset.c */
|
||||
int d_csowrite(P1(int) Pi(long) Pi(CONST char FAR *) DBN_Dn);
|
||||
/* csowrite.c */
|
||||
#ifndef NO_TIMESTAMP /* NO_TIMESTAMP */
|
||||
int d_csstat(P1(int) DBN_Dn); /* csstat.c */
|
||||
int d_ctscm(P1(int) Pi(ULONG FAR *) DBN_Dn); /* ctscm.c */
|
||||
int d_ctsco(P1(int) Pi(ULONG FAR *) DBN_Dn); /* ctsco.c */
|
||||
int d_ctscr(P1(ULONG FAR *)); /* ctscr.c */
|
||||
#endif /* NO_TIMESTAMP */
|
||||
#ifndef NO_COUNTRY
|
||||
int d_ctbpath(P1(CONST char FAR *)); /* pathfcns.c */
|
||||
#endif /* NO_COUNTRY */
|
||||
int d_dbdpath(P1(CONST char FAR *)); /* dbdpath.c */
|
||||
int d_dbfpath(P1(CONST char FAR *)); /* dbfpath.c */
|
||||
int d_dblog(P1(CONST char FAR *)); /* dblog.c */
|
||||
int d_dbtaf(P1(CONST char FAR *)); /* dbtaf.c */
|
||||
int d_dbuserid(P1(CONST char FAR *)); /* dbuserid.c */
|
||||
int d_delete(DBN_D1); /* delete.c */
|
||||
int d_disdel(DBN_D1); /* disdel.c */
|
||||
int d_recnext(DBN_D1); /* recnext.c */
|
||||
int d_recprev(DBN_D1); /* recprev.c */
|
||||
int d_destroy(P1(CONST char FAR *)); /* destroy.c */
|
||||
int d_discon(P1(int) DBN_Dn); /* discon.c */
|
||||
int d_fillnew(P1(int) Pi(CONST char FAR *) DBN_Dn); /* fillnew.c */
|
||||
int d_findco(P1(int) DBN_Dn); /* findco.c */
|
||||
int d_findfm(P1(int) DBN_Dn); /* findfm.c */
|
||||
int d_findlm(P1(int) DBN_Dn); /* findlm.c */
|
||||
int d_findnm(P1(int) DBN_Dn); /* findnm.c */
|
||||
int d_findpm(P1(int) DBN_Dn); /* findpm.c */
|
||||
int d_freeall(P0); /* dblfcns.c */
|
||||
#ifndef NO_TIMESTAMP /* NO_TIMESTAMP */
|
||||
int d_gtscm(P1(int) Pi(ULONG FAR *) DBN_Dn); /* gtscm.c */
|
||||
int d_gtsco(P1(int) Pi(ULONG FAR *) DBN_Dn); /* gtsco.c */
|
||||
int d_gtscr(P1(ULONG FAR *)); /* gtscr.c */
|
||||
int d_gtscs(P1(int) Pi(ULONG FAR *) DBN_Dn); /* gtscs.c */
|
||||
#endif /* NO_TIMESTAMP */
|
||||
int d_initialize(DBN_D1); /* initial.c */
|
||||
int d_initfile(P1(FILE_NO) DBN_Dn); /* initial.c */
|
||||
int d_ismember(P1(int) DBN_Dn); /* ismember.c */
|
||||
int d_isowner(P1(int) DBN_Dn); /* isowner.c */
|
||||
int d_keydel(P1(long) DBN_Dn); /* keydel.c */
|
||||
int d_keyexist(P1(long) DBN_Dn); /* keyexist.c */
|
||||
int d_keyfind(P1(long) Pi(CONST char FAR *) DBN_Dn);
|
||||
/* keyfind.c */
|
||||
int d_keyfree(P1(long) DBN_Dn); /* dblfcns.c */
|
||||
int d_keyfrst(P1(long) DBN_Dn); /* keyfrst.c */
|
||||
int d_keylast(P1(long) DBN_Dn); /* keylast.c */
|
||||
int d_keylock(P1(long) Pi(char FAR *) DBN_Dn); /* dblfcns.c */
|
||||
int d_keylstat(P1(long) Pi(char FAR *) DBN_Dn); /* dblfcns.c */
|
||||
int d_keynext(P1(long) DBN_Dn); /* keynext.c */
|
||||
int d_keyprev(P1(long) DBN_Dn); /* keyprev.c */
|
||||
int d_keyread(P1(char FAR *)); /* keyfcns.c */
|
||||
int d_keystore(P1(long) DBN_Dn); /* keystore.c */
|
||||
int d_lock(P1(int) Pi(LOCK_REQUEST FAR *) DBN_Dn); /* dblfcns.c */
|
||||
int d_makenew(P1(int) DBN_Dn); /* makenew.c */
|
||||
int d_mapchar(P1(unsigned char) Pi(unsigned char)
|
||||
Pi(CONST char FAR *) Pi(unsigned char)); /* mapchar.c */
|
||||
int d_members(P1(int) Pi(LONG FAR *) DBN_Dn); /* members.c */
|
||||
int d_off_opt(P1(int)); /* options.c */
|
||||
int d_on_opt(P1(int)); /* options.c */
|
||||
int d_open(P1(CONST char FAR *) Pi(CONST char FAR *));
|
||||
/* dblfcns.c */
|
||||
int d_rerdcurr(P1(DB_ADDR FAR **)); /* rwcurr.c */
|
||||
int d_rdcurr(P1(DB_ADDR FAR **) Pi(int FAR *)); /* rwcurr.c */
|
||||
int d_wrcurr(P1(DB_ADDR FAR *)); /* rwcurr.c */
|
||||
int d_recfree(P1(int) DBN_Dn); /* dblfcns.c */
|
||||
int d_recfrst(P1(int) DBN_Dn); /* recfrst.c */
|
||||
int d_reclast(P1(int) DBN_Dn); /* reclast.c */
|
||||
int d_reclock(P1(int) Pi(char FAR *) DBN_Dn); /* dblfcns.c */
|
||||
int d_reclstat(P1(int) Pi(char FAR *) DBN_Dn); /* dblfcns.c */
|
||||
int d_recover(P1(CONST char FAR *)); /* recover.c */
|
||||
int d_recread(P1(char FAR *) DBN_Dn); /* recread.c */
|
||||
int d_recset(P1(int) DBN_Dn); /* recset.c */
|
||||
#ifndef NO_TIMESTAMP /* NO_TIMESTAMP */
|
||||
int d_recstat(P1(DB_ADDR) Pi(ULONG)); /* recstat.c */
|
||||
#endif /* NO_TIMESTAMP */
|
||||
int d_recwrite(P1(CONST char FAR *) DBN_Dn); /* recwrite.c */
|
||||
int d_renfile(P1(CONST char FAR *) Pi(FILE_NO)
|
||||
Pi(CONST char FAR *)); /* renfile.c */
|
||||
int d_retries(P1(int)); /* dblfcns.c */
|
||||
int d_rlbclr(P0); /* dblfcns.c */
|
||||
int d_rlbset(P0); /* dblfcns.c */
|
||||
int d_rlbtst(P0); /* dblfcns.c */
|
||||
int d_set_dberr(P1(FARPROC)); /* dberr.c */
|
||||
#ifndef ONE_DB /* ONE_DB */
|
||||
int d_setdb(P1(int)); /* setdb.c */
|
||||
#endif /* ONE_DB */
|
||||
int d_setfree(P1(int) DBN_Dn); /* dblfcns.c */
|
||||
int d_setkey(P1(long) Pi(CONST char FAR *) DBN_Dn); /* makenew.c */
|
||||
int d_setlock(P1(int) Pi(char FAR *) DBN_Dn); /* dblfcns.c */
|
||||
int d_setlstat(P1(int) Pi(char FAR *) DBN_Dn); /* dblfcns.c */
|
||||
int d_setmm(P1(int) Pi(int) DBN_Dn); /* setmm.c */
|
||||
int d_setmo(P1(int) Pi(int) DBN_Dn); /* setmo.c */
|
||||
int d_setmr(P1(int) DBN_Dn); /* setmr.c */
|
||||
int d_setom(P1(int) Pi(int) DBN_Dn); /* setom.c */
|
||||
int d_setoo(P1(int) Pi(int) DBN_Dn); /* setoo.c */
|
||||
int d_setor(P1(int) DBN_Dn); /* setor.c */
|
||||
int d_setrm(P1(int) DBN_Dn); /* setrm.c */
|
||||
int d_setro(P1(int) DBN_Dn); /* setro.c */
|
||||
#ifndef NO_TIMESTAMP /* NO_TIMESTAMP */
|
||||
int d_stscm(P1(int) Pi(ULONG) DBN_Dn); /* stscm.c */
|
||||
int d_stsco(P1(int) Pi(ULONG) DBN_Dn); /* stsco.c */
|
||||
int d_stscr(P1(ULONG)); /* stscr.c */
|
||||
int d_stscs(P1(int) Pi(ULONG) DBN_Dn); /* stscs.c */
|
||||
#endif /* NO_TIMESTAMP */
|
||||
int d_timeout(P1(int)); /* dblfcns.c */
|
||||
int d_trabort(P0); /* dblfcns.c */
|
||||
int d_trbegin(P1(CONST char FAR *)); /* dblfcns.c */
|
||||
int d_trend(P0); /* dblfcns.c */
|
||||
#ifndef NO_TIMESTAMP /* NO_TIMESTAMP */
|
||||
int d_utscm(P1(int) Pi(ULONG FAR *) DBN_Dn); /* utscm.c */
|
||||
int d_utsco(P1(int) Pi(ULONG FAR *) DBN_Dn); /* utsco.c */
|
||||
int d_utscr(P1(ULONG FAR *)); /* utscr.c */
|
||||
int d_utscs(P1(int) Pi(ULONG FAR *) DBN_Dn); /* utscs.c */
|
||||
#endif /* NO_TIMESTAMP */
|
||||
|
||||
#endif /* MULTI_TASK */
|
||||
|
||||
int dberr(P1(int)); /* dberr.c */
|
||||
|
||||
#define D_FUNCTIONS_H
|
||||
/* vpp -nOS2 -dUNIX -nBSD -nVANILLA_BSD -nVMS -nMEMLOCK -nWINDOWS -nFAR_ALLOC -f/usr/users/master/config/nonwin dproto.h */
|
||||
153
cde/lib/DtSearch/raima/dtcover.h
Normal file
153
cde/lib/DtSearch/raima/dtcover.h
Normal file
@@ -0,0 +1,153 @@
|
||||
/* $XConsortium: dtcover.h /main/2 1996/05/09 04:05:27 drk $ */
|
||||
/*
|
||||
* COMPONENT_NAME: austext
|
||||
*
|
||||
* FUNCTIONS: none
|
||||
*
|
||||
* ORIGINS: 157
|
||||
*
|
||||
*/
|
||||
/*----------------------------------------------------------------------------
|
||||
dtcover.h: converts d_* calls to dt_* for MULTI_TASKing
|
||||
|
||||
(C) Copyright 1988 by Raima Corporation.
|
||||
----------------------------------------------------------------------------*/
|
||||
/* ********************** EDIT HISTORY *******************************
|
||||
|
||||
SCR DATE INI DESCRIPTION
|
||||
----- --------- --- -----------------------------------------------------
|
||||
571 31-Jan-89 RSC Placed ctbpath inside NO_COUNTRY, not NO_TIMESTAMP
|
||||
*/
|
||||
|
||||
|
||||
#define d_close dt_close
|
||||
#define d_cmstat dt_cmstat
|
||||
#define d_cmtype dt_cmtype
|
||||
#define d_connect dt_connect
|
||||
#ifndef NO_TIMESTAMP
|
||||
#define d_costat dt_costat
|
||||
#endif
|
||||
#define d_cotype dt_cotype
|
||||
#define d_crget dt_crget
|
||||
#define d_crread dt_crread
|
||||
#define d_crset dt_crset
|
||||
#ifndef NO_TIMESTAMP
|
||||
#define d_crstat dt_crstat
|
||||
#endif
|
||||
#define d_crtype dt_crtype
|
||||
#define d_crwrite dt_crwrite
|
||||
#define d_csmget dt_csmget
|
||||
#define d_csmread dt_csmread
|
||||
#define d_csmset dt_csmset
|
||||
#define d_csmwrite dt_csmwrite
|
||||
#define d_csoget dt_csoget
|
||||
#define d_csoread dt_csoread
|
||||
#define d_csoset dt_csoset
|
||||
#define d_csowrite dt_csowrite
|
||||
#ifndef NO_TIMESTAMP
|
||||
#define d_csstat dt_csstat
|
||||
#define d_ctscm dt_ctscm
|
||||
#define d_ctsco dt_ctsco
|
||||
#define d_ctscr dt_ctscr
|
||||
#endif
|
||||
#ifndef NO_COUNTRY
|
||||
#define d_ctbpath dt_ctbpath
|
||||
#endif
|
||||
#define d_dbdpath dt_dbdpath
|
||||
#define d_dbfpath dt_dbfpath
|
||||
#define d_dblog dt_dblog
|
||||
#define d_dbtaf dt_dbtaf
|
||||
#define d_dbuserid dt_dbuserid
|
||||
#define d_delete dt_delete
|
||||
#define d_disdel dt_disdel
|
||||
#define d_recnext dt_recnext
|
||||
#define d_recprev dt_recprev
|
||||
#define d_destroy dt_destroy
|
||||
#define d_discon dt_discon
|
||||
#define d_fillnew dt_fillnew
|
||||
#define d_findco dt_findco
|
||||
#define d_findfm dt_findfm
|
||||
#define d_findlm dt_findlm
|
||||
#define d_findnm dt_findnm
|
||||
#define d_findpm dt_findpm
|
||||
#define d_freeall dt_freeall
|
||||
#ifndef NO_TIMESTAMP
|
||||
#define d_gtscm dt_gtscm
|
||||
#define d_gtsco dt_gtsco
|
||||
#define d_gtscr dt_gtscr
|
||||
#define d_gtscs dt_gtscs
|
||||
#endif
|
||||
#define d_initialize dt_initialize
|
||||
#define d_initfile dt_initfile
|
||||
#define d_ismember dt_ismember
|
||||
#define d_isowner dt_isowner
|
||||
#define d_keydel dt_keydel
|
||||
#define d_keyexist dt_keyexist
|
||||
#define d_keyfind dt_keyfind
|
||||
#define d_keyfree dt_keyfree
|
||||
#define d_keyfrst dt_keyfrst
|
||||
#define d_keylast dt_keylast
|
||||
#define d_keylock dt_keylock
|
||||
#define d_keylstat dt_keylstat
|
||||
#define d_keynext dt_keynext
|
||||
#define d_keyprev dt_keyprev
|
||||
#define d_keyread dt_keyread
|
||||
#define d_keystore dt_keystore
|
||||
#define d_lock dt_lock
|
||||
#define d_makenew dt_makenew
|
||||
#define d_mapchar dt_mapchar
|
||||
#define d_members dt_members
|
||||
#define d_off_opt dt_off_opt
|
||||
#define d_on_opt dt_on_opt
|
||||
#define d_open dt_open
|
||||
#define d_rdcurr dt_rdcurr
|
||||
#define d_rerdcurr dt_rerdcurr
|
||||
#define d_recfree dt_recfree
|
||||
#define d_recfrst dt_recfrst
|
||||
#define d_reclast dt_reclast
|
||||
#define d_reclock dt_reclock
|
||||
#define d_reclstat dt_reclstat
|
||||
#define d_recover dt_recover
|
||||
#define d_recread dt_recread
|
||||
#define d_recset dt_recset
|
||||
#ifndef NO_TIMESTAMP
|
||||
#define d_recstat dt_recstat
|
||||
#endif
|
||||
#define d_recwrite dt_recwrite
|
||||
#define d_renfile dt_renfile
|
||||
#define d_retries dt_retries
|
||||
#define d_rlbclr dt_rlbclr
|
||||
#define d_rlbset dt_rlbset
|
||||
#define d_rlbtst dt_rlbtst
|
||||
#define d_set_dberr dt_set_dberr
|
||||
#define d_setdb dt_setdb
|
||||
#define d_setfree dt_setfree
|
||||
#define d_setkey dt_setkey
|
||||
#define d_setlock dt_setlock
|
||||
#define d_setlstat dt_setlstat
|
||||
#define d_setmm dt_setmm
|
||||
#define d_setmo dt_setmo
|
||||
#define d_setmr dt_setmr
|
||||
#define d_setom dt_setom
|
||||
#define d_setoo dt_setoo
|
||||
#define d_setor dt_setor
|
||||
#define d_setrm dt_setrm
|
||||
#define d_setro dt_setro
|
||||
#ifndef NO_TIMESTAMP
|
||||
#define d_stscm dt_stscm
|
||||
#define d_stsco dt_stsco
|
||||
#define d_stscr dt_stscr
|
||||
#define d_stscs dt_stscs
|
||||
#endif
|
||||
#define d_timeout dt_timeout
|
||||
#define d_trabort dt_trabort
|
||||
#define d_trbegin dt_trbegin
|
||||
#define d_trend dt_trend
|
||||
#ifndef NO_TIMESTAMP
|
||||
#define d_utscm dt_utscm
|
||||
#define d_utsco dt_utsco
|
||||
#define d_utscr dt_utscr
|
||||
#define d_utscs dt_utscs
|
||||
#endif
|
||||
#define d_wrcurr dt_wrcurr
|
||||
/* vpp -nOS2 -dUNIX -nBSD -nVANILLA_BSD -nVMS -nMEMLOCK -nWINDOWS -nFAR_ALLOC dtcover.h */
|
||||
137
cde/lib/DtSearch/raima/fillnew.c
Normal file
137
cde/lib/DtSearch/raima/fillnew.c
Normal file
@@ -0,0 +1,137 @@
|
||||
/* $XConsortium: fillnew.c /main/3 1996/08/12 12:33:46 cde-ibm $ */
|
||||
/*
|
||||
* COMPONENT_NAME: austext
|
||||
*
|
||||
* FUNCTIONS: d_fillnew
|
||||
*
|
||||
* ORIGINS: 157
|
||||
*
|
||||
* OBJECT CODE ONLY SOURCE MATERIALS
|
||||
*/
|
||||
/*-----------------------------------------------------------------------
|
||||
fillnew.c -- db_VISTA (filled) record creation module
|
||||
|
||||
(C) Copyright 1987 by Raima Corp.
|
||||
-----------------------------------------------------------------------*/
|
||||
|
||||
/* ********************** EDIT HISTORY *******************************
|
||||
|
||||
SCR DATE INI DESCRIPTION
|
||||
----- --------- --- -----------------------------------------------------
|
||||
158 15-JUN-88 RSC inform key_bldcom NOT to complement compound keys
|
||||
04-Aug-88 RTK MULTI_TASK changes
|
||||
|
||||
*/
|
||||
#include <stdio.h>
|
||||
#include "vista.h"
|
||||
#include "dbtype.h"
|
||||
|
||||
#define FALSE 0
|
||||
#define TRUE 1
|
||||
|
||||
|
||||
/* Create and fill a new record
|
||||
*/
|
||||
d_fillnew( nrec, recval TASK_PARM DBN_PARM )
|
||||
int nrec; /* record number */
|
||||
CONST char FAR *recval; /* record value */
|
||||
TASK_DECL
|
||||
DBN_DECL /* database number */
|
||||
{
|
||||
#ifndef NO_TIMESTAMP
|
||||
ULONG timestamp;
|
||||
#endif
|
||||
DB_ADDR db_addr;
|
||||
INT recnum, stat;
|
||||
FILE_NO file;
|
||||
F_ADDR rec_addr;
|
||||
char FAR *ptr;
|
||||
char key[256];
|
||||
RECORD_ENTRY FAR *rec_ptr;
|
||||
FIELD_ENTRY FAR *fld_ptr;
|
||||
int fld, fldtot;
|
||||
|
||||
DB_ENTER(DB_ID TASK_ID LOCK_SET(RECORD_IO));
|
||||
|
||||
if (nrec_check(nrec, &nrec, (RECORD_ENTRY FAR * FAR *)&rec_ptr) != S_OKAY)
|
||||
RETURN( db_status );
|
||||
recnum = NUM2EXT(nrec, rt_offset);
|
||||
|
||||
/* check for duplicate keys */
|
||||
db_addr = curr_rec;
|
||||
for (fld = rec_ptr->rt_fields, fldtot = fld + rec_ptr->rt_fdtot,
|
||||
fld_ptr = &field_table[fld];
|
||||
(fld < fldtot) || (fld_ptr->fd_type == COMKEY);
|
||||
++fld, ++fld_ptr) {
|
||||
if ((fld_ptr->fd_key == UNIQUE) && !(fld_ptr->fd_flags & OPTKEYMASK)) {
|
||||
if (fld_ptr->fd_type != COMKEY)
|
||||
ptr = (char FAR *)recval + fld_ptr->fd_ptr - rec_ptr->rt_data;
|
||||
else
|
||||
key_bldcom(fld, (char FAR *)recval, ptr = key, FALSE); /* Don't complement */
|
||||
d_keyfind(FLDMARK*(long)recnum + (fld - rec_ptr->rt_fields), ptr
|
||||
TASK_PARM DBN_PARM);
|
||||
curr_rec = db_addr;
|
||||
if ( db_status == S_OKAY )
|
||||
RETURN( db_status = S_DUPLICATE );
|
||||
}
|
||||
}
|
||||
/* pull out the file number */
|
||||
file = rec_ptr->rt_file;
|
||||
db_addr = (NUM2EXT(file, ft_offset) & FILEMASK) << FILESHIFT;
|
||||
|
||||
/* select a record pointer to use */
|
||||
if ( dio_pzalloc(file, &rec_addr) != S_OKAY )
|
||||
RETURN( db_status );
|
||||
|
||||
db_addr |= rec_addr;
|
||||
|
||||
/* read record */
|
||||
if (dio_read(db_addr, (char FAR * FAR *)&ptr, PGHOLD) != S_OKAY)
|
||||
RETURN( db_status );
|
||||
|
||||
/* zero fill the record */
|
||||
byteset(ptr, 0, rec_ptr->rt_len);
|
||||
|
||||
/* place the record number and db_addr at the start of the record */
|
||||
bytecpy( ptr, &recnum, sizeof(INT) );
|
||||
bytecpy( ptr+sizeof(INT), &db_addr, DB_ADDR_SIZE );
|
||||
#ifndef NO_TIMESTAMP
|
||||
/* check for timestamp */
|
||||
if ( rec_ptr->rt_flags & TIMESTAMPED ) {
|
||||
timestamp = dio_pzgetts(file);
|
||||
bytecpy( ptr + RECCRTIME, ×tamp, sizeof(LONG));
|
||||
bytecpy( ptr + RECUPTIME, ×tamp, sizeof(LONG));
|
||||
}
|
||||
else timestamp = 0;
|
||||
#endif
|
||||
/* copy the record value into place */
|
||||
bytecpy( ptr+rec_ptr->rt_data, recval, rec_ptr->rt_len-rec_ptr->rt_data );
|
||||
|
||||
/* for each keyed field, enter the key value into the key file */
|
||||
for (fld = rec_ptr->rt_fields, fldtot = fld + rec_ptr->rt_fdtot,
|
||||
fld_ptr = &field_table[fld];
|
||||
(fld < fldtot) || (fld_ptr->fd_type == COMKEY);
|
||||
++fld, ++fld_ptr) {
|
||||
if ((fld_ptr->fd_key != 'n') && !(fld_ptr->fd_flags & OPTKEYMASK)) {
|
||||
if ( fld_ptr->fd_type != COMKEY )
|
||||
ptr = (char FAR *)recval + fld_ptr->fd_ptr - rec_ptr->rt_data;
|
||||
else
|
||||
key_bldcom(fld, (char FAR *)recval, ptr = key, TRUE);
|
||||
if ((stat = key_insert(fld, ptr, db_addr)) != S_OKAY) {
|
||||
r_delrec( nrec, db_addr );
|
||||
dio_write(db_addr, NULL, PGFREE);
|
||||
RETURN( db_status = stat );
|
||||
}
|
||||
}
|
||||
}
|
||||
/* 'touch' page, do page's update housekeeping */
|
||||
if ( dio_write(db_addr, NULL, PGFREE) == S_OKAY ) {
|
||||
curr_rec = db_addr;
|
||||
|
||||
#ifndef NO_TIMESTAMP
|
||||
if ( db_tsrecs ) cr_time = timestamp;
|
||||
#endif
|
||||
}
|
||||
RETURN( db_status );
|
||||
}
|
||||
/* vpp -nOS2 -dUNIX -nBSD -nVANILLA_BSD -nVMS -nMEMLOCK -nWINDOWS -nFAR_ALLOC -f/usr/users/master/config/nonwin fillnew.c */
|
||||
78
cde/lib/DtSearch/raima/findco.c
Normal file
78
cde/lib/DtSearch/raima/findco.c
Normal file
@@ -0,0 +1,78 @@
|
||||
/* $XConsortium: findco.c /main/2 1996/05/09 04:06:00 drk $ */
|
||||
/*
|
||||
* COMPONENT_NAME: austext
|
||||
*
|
||||
* FUNCTIONS: d_findco
|
||||
*
|
||||
* ORIGINS: 157
|
||||
*
|
||||
* OBJECT CODE ONLY SOURCE MATERIALS
|
||||
*/
|
||||
/*-----------------------------------------------------------------------
|
||||
findco.c -- db_VISTA find owner of current record module
|
||||
|
||||
(C) Copyright 1987 by Raima Corp.
|
||||
-----------------------------------------------------------------------*/
|
||||
|
||||
/* ********************** EDIT HISTORY *******************************
|
||||
|
||||
SCR DATE INI DESCRIPTION
|
||||
----- --------- --- -----------------------------------------------------
|
||||
04-Aug-88 RTK MULTI_TASK changes
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include "vista.h"
|
||||
#include "dbtype.h"
|
||||
|
||||
/* Find owner of current record
|
||||
*/
|
||||
d_findco(nset TASK_PARM DBN_PARM)
|
||||
int nset;
|
||||
TASK_DECL
|
||||
DBN_DECL
|
||||
{
|
||||
int set;
|
||||
char mem[MEMPSIZE];
|
||||
DB_ADDR own;
|
||||
SET_ENTRY FAR *set_ptr;
|
||||
|
||||
DB_ENTER(DB_ID TASK_ID LOCK_SET(SET_IO));
|
||||
|
||||
if (nset_check(nset, &set, (SET_ENTRY FAR * FAR *)&set_ptr) != S_OKAY)
|
||||
RETURN( db_status );
|
||||
|
||||
/* Make sure we have a current record */
|
||||
if ( ! curr_rec )
|
||||
RETURN( dberr(S_NOCR) );
|
||||
|
||||
/* Read current record */
|
||||
if ( dio_read(curr_rec, (char FAR * FAR *)&crloc, NOPGHOLD) != S_OKAY )
|
||||
RETURN( db_status );
|
||||
|
||||
/* Get the member ptr for this set */
|
||||
if ( r_gmem(set, crloc, mem) != S_OKAY )
|
||||
RETURN( db_status );
|
||||
|
||||
/* Extract the owner ptr from the member ptr */
|
||||
bytecpy(&own, mem+MP_OWNER, DB_ADDR_SIZE);
|
||||
if ( ! own ) /* Record not connected to set */
|
||||
RETURN( dberr( S_NOTCON ) );
|
||||
|
||||
/* set the new current owner and member */
|
||||
curr_own[set] = own;
|
||||
curr_mem[set] = curr_rec;
|
||||
curr_rec = own;
|
||||
#ifndef NO_TIMESTAMP
|
||||
/* set any timestamps */
|
||||
if ( db_tsrecs ) {
|
||||
d_utscr( &cr_time TASK_PARM );
|
||||
d_utscm(nset, &cm_time[set] TASK_PARM DBN_PARM);
|
||||
co_time[set] = cr_time;
|
||||
}
|
||||
if ( db_tssets )
|
||||
d_utscs(nset, &cs_time[set] TASK_PARM DBN_PARM);
|
||||
#endif
|
||||
RETURN( db_status = S_OKAY );
|
||||
}
|
||||
/* vpp -nOS2 -dUNIX -nBSD -nVANILLA_BSD -nVMS -nMEMLOCK -nWINDOWS -nFAR_ALLOC -f/usr/users/master/config/nonwin findco.c */
|
||||
80
cde/lib/DtSearch/raima/findfm.c
Normal file
80
cde/lib/DtSearch/raima/findfm.c
Normal file
@@ -0,0 +1,80 @@
|
||||
/* $XConsortium: findfm.c /main/2 1996/05/09 04:06:14 drk $ */
|
||||
/*
|
||||
* COMPONENT_NAME: austext
|
||||
*
|
||||
* FUNCTIONS: d_findfm
|
||||
*
|
||||
* ORIGINS: 157
|
||||
*
|
||||
* OBJECT CODE ONLY SOURCE MATERIALS
|
||||
*/
|
||||
/*-----------------------------------------------------------------------
|
||||
findfm.c -- db_VISTA find first member module
|
||||
|
||||
(C) Copyright 1987 by Raima Corp.
|
||||
-----------------------------------------------------------------------*/
|
||||
|
||||
/* ********************** EDIT HISTORY *******************************
|
||||
|
||||
SCR DATE INI DESCRIPTION
|
||||
----- --------- --- -----------------------------------------------------
|
||||
04-Aug-88 RTK MULTI_TASK changes
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include "vista.h"
|
||||
#include "dbtype.h"
|
||||
|
||||
/* Find first member of set
|
||||
*/
|
||||
d_findfm(nset TASK_PARM DBN_PARM)
|
||||
int nset;
|
||||
TASK_DECL
|
||||
DBN_DECL
|
||||
{
|
||||
char setp[SETPSIZE];
|
||||
DB_ADDR mem;
|
||||
char FAR *recp;
|
||||
int set;
|
||||
SET_ENTRY FAR *set_ptr;
|
||||
|
||||
DB_ENTER(DB_ID TASK_ID LOCK_SET(SET_IO));
|
||||
|
||||
if (nset_check(nset, &set, (SET_ENTRY FAR * FAR *)&set_ptr) != S_OKAY)
|
||||
RETURN( db_status );
|
||||
|
||||
/* make sure we have a current owner */
|
||||
if ( ! curr_own[set] )
|
||||
RETURN( dberr(S_NOCO) );
|
||||
|
||||
/* read current owner of set */
|
||||
if ( dio_read(curr_own[set], (char FAR * FAR *)&recp, NOPGHOLD) != S_OKAY )
|
||||
RETURN( db_status );
|
||||
|
||||
/* get set pointer from record */
|
||||
if ( r_gset(set, recp, setp) != S_OKAY )
|
||||
RETURN( db_status == S_INVOWN? dberr(S_SYSERR): db_status );
|
||||
|
||||
/* extract address of first member */
|
||||
bytecpy(&mem, setp+SP_FIRST, DB_ADDR_SIZE);
|
||||
|
||||
/* set current record and member */
|
||||
curr_mem[set] = mem;
|
||||
|
||||
if ( ! mem ) /* end of set if no first member */
|
||||
RETURN( db_status = S_EOS );
|
||||
|
||||
curr_rec = mem;
|
||||
#ifndef NO_TIMESTAMP
|
||||
/* set timestamps */
|
||||
if ( db_tsrecs ) {
|
||||
d_utscr( &cr_time TASK_PARM );
|
||||
cm_time[set] = cr_time;
|
||||
}
|
||||
if ( db_tssets )
|
||||
/* only needed for system record support */
|
||||
d_utscs(nset, &cs_time[set] TASK_PARM DBN_PARM);
|
||||
#endif
|
||||
RETURN( db_status = S_OKAY );
|
||||
}
|
||||
/* vpp -nOS2 -dUNIX -nBSD -nVANILLA_BSD -nVMS -nMEMLOCK -nWINDOWS -nFAR_ALLOC -f/usr/users/master/config/nonwin findfm.c */
|
||||
80
cde/lib/DtSearch/raima/findlm.c
Normal file
80
cde/lib/DtSearch/raima/findlm.c
Normal file
@@ -0,0 +1,80 @@
|
||||
/* $XConsortium: findlm.c /main/2 1996/05/09 04:06:29 drk $ */
|
||||
/*
|
||||
* COMPONENT_NAME: austext
|
||||
*
|
||||
* FUNCTIONS: d_findlm
|
||||
*
|
||||
* ORIGINS: 157
|
||||
*
|
||||
* OBJECT CODE ONLY SOURCE MATERIALS
|
||||
*/
|
||||
/*-----------------------------------------------------------------------
|
||||
findlm.c -- db_VISTA find last member module
|
||||
|
||||
(C) Copyright 1987 by Raima Corp.
|
||||
-----------------------------------------------------------------------*/
|
||||
|
||||
/* ********************** EDIT HISTORY *******************************
|
||||
|
||||
SCR DATE INI DESCRIPTION
|
||||
----- --------- --- -----------------------------------------------------
|
||||
04-Aug-88 RTK MULTI_TASK changes
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include "vista.h"
|
||||
#include "dbtype.h"
|
||||
|
||||
/* Find last member of set
|
||||
*/
|
||||
d_findlm(nset TASK_PARM DBN_PARM)
|
||||
int nset;
|
||||
TASK_DECL
|
||||
DBN_DECL
|
||||
{
|
||||
char setp[SETPSIZE];
|
||||
DB_ADDR mem;
|
||||
char FAR *recp;
|
||||
int set;
|
||||
SET_ENTRY FAR *set_ptr;
|
||||
|
||||
DB_ENTER(DB_ID TASK_ID LOCK_SET(SET_IO));
|
||||
|
||||
if (nset_check(nset, &set, (SET_ENTRY FAR * FAR *)&set_ptr) != S_OKAY)
|
||||
RETURN( db_status );
|
||||
|
||||
/* make sure we have a current owner */
|
||||
if ( ! curr_own[set] )
|
||||
RETURN( dberr(S_NOCO) );
|
||||
|
||||
/* read current owner of set */
|
||||
if ( dio_read(curr_own[set], (char FAR * FAR *)&recp, NOPGHOLD) != S_OKAY )
|
||||
RETURN( db_status );
|
||||
|
||||
/* get set pointer from record */
|
||||
if ( r_gset(set, recp, setp) != S_OKAY )
|
||||
RETURN( (db_status == S_INVOWN) ? dberr(S_SYSERR) : db_status );
|
||||
|
||||
/* extract address of last member */
|
||||
bytecpy(&mem, setp+SP_LAST, DB_ADDR_SIZE);
|
||||
|
||||
/* set current record and member */
|
||||
curr_mem[set] = mem;
|
||||
|
||||
if ( ! mem ) /* end of set if no first member */
|
||||
RETURN( db_status = S_EOS );
|
||||
|
||||
curr_rec = mem;
|
||||
#ifndef NO_TIMESTAMP
|
||||
/* set timestamps */
|
||||
if ( db_tsrecs ) {
|
||||
d_utscr( &cr_time TASK_PARM );
|
||||
cm_time[set] = cr_time;
|
||||
}
|
||||
if ( db_tssets )
|
||||
/* only needed for system record support */
|
||||
d_utscs(nset, &cs_time[set] TASK_PARM DBN_PARM);
|
||||
#endif
|
||||
RETURN( db_status = S_OKAY );
|
||||
}
|
||||
/* vpp -nOS2 -dUNIX -nBSD -nVANILLA_BSD -nVMS -nMEMLOCK -nWINDOWS -nFAR_ALLOC -f/usr/users/master/config/nonwin findlm.c */
|
||||
79
cde/lib/DtSearch/raima/findnm.c
Normal file
79
cde/lib/DtSearch/raima/findnm.c
Normal file
@@ -0,0 +1,79 @@
|
||||
/* $XConsortium: findnm.c /main/2 1996/05/09 04:06:45 drk $ */
|
||||
/*
|
||||
* COMPONENT_NAME: austext
|
||||
*
|
||||
* FUNCTIONS: d_findnm
|
||||
*
|
||||
* ORIGINS: 157
|
||||
*
|
||||
* OBJECT CODE ONLY SOURCE MATERIALS
|
||||
*/
|
||||
/*-----------------------------------------------------------------------
|
||||
findnm.c -- db_VISTA find next member module
|
||||
|
||||
(C) Copyright 1987 by Raima Corp.
|
||||
-----------------------------------------------------------------------*/
|
||||
|
||||
/* ********************** EDIT HISTORY *******************************
|
||||
|
||||
SCR DATE INI DESCRIPTION
|
||||
----- --------- --- -----------------------------------------------------
|
||||
04-Aug-88 RTK MULTI_TASK changes
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include "vista.h"
|
||||
#include "dbtype.h"
|
||||
|
||||
/* Find next member of set
|
||||
*/
|
||||
d_findnm(nset TASK_PARM DBN_PARM)
|
||||
int nset;
|
||||
TASK_DECL
|
||||
DBN_DECL
|
||||
{
|
||||
int set;
|
||||
char memp[MEMPSIZE];
|
||||
DB_ADDR mem;
|
||||
char FAR *recp;
|
||||
DB_ADDR FAR *cm_ptr;
|
||||
SET_ENTRY FAR *set_ptr;
|
||||
|
||||
DB_ENTER(DB_ID TASK_ID LOCK_SET(SET_IO));
|
||||
|
||||
if (nset_check(nset, &set, (SET_ENTRY FAR * FAR *)&set_ptr) != S_OKAY)
|
||||
RETURN( db_status );
|
||||
|
||||
/* make sure we have a current owner */
|
||||
if ( ! curr_own[set] )
|
||||
RETURN( dberr(S_NOCO) );
|
||||
|
||||
/* find first member if no current member */
|
||||
if ( !*(cm_ptr = &curr_mem[set]) )
|
||||
RETURN( d_findfm(nset TASK_PARM DBN_PARM) );
|
||||
|
||||
/* read current member of set and get member pointer from record */
|
||||
if ((dio_read(*cm_ptr, (char FAR * FAR *)&recp, NOPGHOLD) != S_OKAY) ||
|
||||
(r_gmem(set, recp, memp) != S_OKAY))
|
||||
RETURN( db_status );
|
||||
|
||||
/* extract address of next member */
|
||||
bytecpy(&mem, memp+MP_NEXT, DB_ADDR_SIZE);
|
||||
|
||||
/* set current record and member */
|
||||
*cm_ptr = mem;
|
||||
|
||||
if ( ! mem ) /* end of set */
|
||||
RETURN( db_status = S_EOS );
|
||||
|
||||
curr_rec = mem;
|
||||
#ifndef NO_TIMESTAMP
|
||||
/* set timestamps */
|
||||
if ( db_tsrecs ) {
|
||||
d_utscr( &cr_time TASK_PARM );
|
||||
cm_time[set] = cr_time;
|
||||
}
|
||||
#endif
|
||||
RETURN( db_status = S_OKAY );
|
||||
}
|
||||
/* vpp -nOS2 -dUNIX -nBSD -nVANILLA_BSD -nVMS -nMEMLOCK -nWINDOWS -nFAR_ALLOC -f/usr/users/master/config/nonwin findnm.c */
|
||||
79
cde/lib/DtSearch/raima/findpm.c
Normal file
79
cde/lib/DtSearch/raima/findpm.c
Normal file
@@ -0,0 +1,79 @@
|
||||
/* $XConsortium: findpm.c /main/2 1996/05/09 04:06:57 drk $ */
|
||||
/*
|
||||
* COMPONENT_NAME: austext
|
||||
*
|
||||
* FUNCTIONS: d_findpm
|
||||
*
|
||||
* ORIGINS: 157
|
||||
*
|
||||
* OBJECT CODE ONLY SOURCE MATERIALS
|
||||
*/
|
||||
/*-----------------------------------------------------------------------
|
||||
findpm.c -- db_VISTA find previous member module
|
||||
|
||||
(C) Copyright 1987 by Raima Corp.
|
||||
-----------------------------------------------------------------------*/
|
||||
|
||||
/* ********************** EDIT HISTORY *******************************
|
||||
|
||||
SCR DATE INI DESCRIPTION
|
||||
----- --------- --- -----------------------------------------------------
|
||||
04-Aug-88 RTK MULTI_TASK changes
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include "vista.h"
|
||||
#include "dbtype.h"
|
||||
|
||||
/* Find previous member of set
|
||||
*/
|
||||
d_findpm(nset TASK_PARM DBN_PARM)
|
||||
int nset;
|
||||
TASK_DECL
|
||||
DBN_DECL
|
||||
{
|
||||
int set;
|
||||
char memp[MEMPSIZE];
|
||||
DB_ADDR mem;
|
||||
char FAR *recp;
|
||||
DB_ADDR FAR *cm_ptr;
|
||||
SET_ENTRY FAR *set_ptr;
|
||||
|
||||
DB_ENTER(DB_ID TASK_ID LOCK_SET(SET_IO));
|
||||
|
||||
if (nset_check(nset, &set, (SET_ENTRY FAR * FAR *)&set_ptr) != S_OKAY)
|
||||
RETURN( db_status );
|
||||
|
||||
/* make sure we have a current owner */
|
||||
if ( ! curr_own[set] )
|
||||
RETURN( dberr(S_NOCO) );
|
||||
|
||||
/* find last member if no current member */
|
||||
if ( !*(cm_ptr = &curr_mem[set]) )
|
||||
RETURN( d_findlm(nset TASK_PARM DBN_PARM) );
|
||||
|
||||
/* read current member of set and get member pointer from record */
|
||||
if ((dio_read(*cm_ptr, (char FAR * FAR *)&recp, NOPGHOLD) != S_OKAY) ||
|
||||
(r_gmem(set, recp, memp) != S_OKAY))
|
||||
RETURN( db_status );
|
||||
|
||||
/* extract address of previous member */
|
||||
bytecpy( &mem, memp+MP_PREV, DB_ADDR_SIZE);
|
||||
|
||||
/* set current record and member */
|
||||
*cm_ptr = mem;
|
||||
|
||||
if ( ! mem ) /* end of set */
|
||||
RETURN( db_status = S_EOS );
|
||||
|
||||
curr_rec = mem;
|
||||
#ifndef NO_TIMESTAMP
|
||||
/* set timestamps */
|
||||
if ( db_tsrecs ) {
|
||||
d_utscr( &cr_time TASK_PARM );
|
||||
cm_time[set] = cr_time;
|
||||
}
|
||||
#endif
|
||||
RETURN( db_status = S_OKAY );
|
||||
}
|
||||
/* vpp -nOS2 -dUNIX -nBSD -nVANILLA_BSD -nVMS -nMEMLOCK -nWINDOWS -nFAR_ALLOC -f/usr/users/master/config/nonwin findpm.c */
|
||||
58
cde/lib/DtSearch/raima/gtscm.c
Normal file
58
cde/lib/DtSearch/raima/gtscm.c
Normal file
@@ -0,0 +1,58 @@
|
||||
/* $XConsortium: gtscm.c /main/2 1996/05/09 04:07:14 drk $ */
|
||||
/*
|
||||
* COMPONENT_NAME: austext
|
||||
*
|
||||
* FUNCTIONS: d_gtscm
|
||||
*
|
||||
* ORIGINS: 157
|
||||
*
|
||||
* OBJECT CODE ONLY SOURCE MATERIALS
|
||||
*/
|
||||
/*-----------------------------------------------------------------------
|
||||
gtscm.c -- db_VISTA current member timestamp get module.
|
||||
|
||||
(C) Copyright 1987 by Raima Corporation.
|
||||
-----------------------------------------------------------------------*/
|
||||
|
||||
/* ********************** EDIT HISTORY *******************************
|
||||
|
||||
SCR DATE INI DESCRIPTION
|
||||
----- --------- --- -----------------------------------------------------
|
||||
04-Aug-88 RTK MULTI_TASK changes
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include "vista.h"
|
||||
#include "dbtype.h"
|
||||
|
||||
|
||||
#ifndef NO_TIMESTAMP
|
||||
/* Get timestamp of current member
|
||||
*/
|
||||
d_gtscm(set, timestamp TASK_PARM DBN_PARM)
|
||||
int set;
|
||||
ULONG FAR *timestamp;
|
||||
TASK_DECL
|
||||
DBN_DECL
|
||||
{
|
||||
SET_ENTRY FAR *set_ptr;
|
||||
|
||||
DB_ENTER(DB_ID TASK_ID LOCK_SET(SET_NOIO));
|
||||
|
||||
if (nset_check(set, &set, (SET_ENTRY FAR * FAR *)&set_ptr) != S_OKAY)
|
||||
RETURN( db_status );
|
||||
|
||||
/* make sure we have a current member */
|
||||
if ( curr_mem[set] ) {
|
||||
if ( db_tsrecs )
|
||||
*timestamp = cm_time[set];
|
||||
else
|
||||
dberr(S_TIMESTAMP);
|
||||
}
|
||||
else
|
||||
dberr(S_NOCM);
|
||||
|
||||
RETURN( db_status );
|
||||
}
|
||||
#endif
|
||||
/* vpp -nOS2 -dUNIX -nBSD -nVANILLA_BSD -nVMS -nMEMLOCK -nWINDOWS -nFAR_ALLOC -f/usr/users/master/config/nonwin gtscm.c */
|
||||
58
cde/lib/DtSearch/raima/gtsco.c
Normal file
58
cde/lib/DtSearch/raima/gtsco.c
Normal file
@@ -0,0 +1,58 @@
|
||||
/* $XConsortium: gtsco.c /main/2 1996/05/09 04:07:28 drk $ */
|
||||
/*
|
||||
* COMPONENT_NAME: austext
|
||||
*
|
||||
* FUNCTIONS: d_gtsco
|
||||
*
|
||||
* ORIGINS: 157
|
||||
*
|
||||
* OBJECT CODE ONLY SOURCE MATERIALS
|
||||
*/
|
||||
/*-----------------------------------------------------------------------
|
||||
gtsco.c -- db_VISTA current owner timestamp get module.
|
||||
|
||||
(C) Copyright 1987 by Raima Corporation.
|
||||
-----------------------------------------------------------------------*/
|
||||
|
||||
/* ********************** EDIT HISTORY *******************************
|
||||
|
||||
SCR DATE INI DESCRIPTION
|
||||
----- --------- --- -----------------------------------------------------
|
||||
04-Aug-88 RTK MULTI_TASK changes
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include "vista.h"
|
||||
#include "dbtype.h"
|
||||
|
||||
|
||||
#ifndef NO_TIMESTAMP
|
||||
/* Get timestamp of current owner
|
||||
*/
|
||||
d_gtsco(set, timestamp TASK_PARM DBN_PARM)
|
||||
int set;
|
||||
ULONG FAR *timestamp;
|
||||
TASK_DECL
|
||||
DBN_DECL
|
||||
{
|
||||
SET_ENTRY FAR *set_ptr;
|
||||
|
||||
DB_ENTER(DB_ID TASK_ID LOCK_SET(SET_NOIO));
|
||||
|
||||
if (nset_check(set, &set, (SET_ENTRY FAR * FAR *)&set_ptr) != S_OKAY)
|
||||
RETURN( db_status );
|
||||
|
||||
/* make sure we have a current owner */
|
||||
if ( curr_own[set] ) {
|
||||
if ( db_tsrecs )
|
||||
*timestamp = co_time[set];
|
||||
else
|
||||
dberr(S_TIMESTAMP);
|
||||
}
|
||||
else
|
||||
dberr(S_NOCO);
|
||||
|
||||
RETURN( db_status );
|
||||
}
|
||||
#endif
|
||||
/* vpp -nOS2 -dUNIX -nBSD -nVANILLA_BSD -nVMS -nMEMLOCK -nWINDOWS -nFAR_ALLOC -f/usr/users/master/config/nonwin gtsco.c */
|
||||
53
cde/lib/DtSearch/raima/gtscr.c
Normal file
53
cde/lib/DtSearch/raima/gtscr.c
Normal file
@@ -0,0 +1,53 @@
|
||||
/* $XConsortium: gtscr.c /main/2 1996/05/09 04:07:42 drk $ */
|
||||
/*
|
||||
* COMPONENT_NAME: austext
|
||||
*
|
||||
* FUNCTIONS: d_gtscr
|
||||
*
|
||||
* ORIGINS: 157
|
||||
*
|
||||
* OBJECT CODE ONLY SOURCE MATERIALS
|
||||
*/
|
||||
/*-----------------------------------------------------------------------
|
||||
gtscr.c -- db_VISTA current record timestamp get module.
|
||||
|
||||
(C) Copyright 1987 by Raima Corporation.
|
||||
-----------------------------------------------------------------------*/
|
||||
|
||||
/* ********************** EDIT HISTORY *******************************
|
||||
|
||||
SCR DATE INI DESCRIPTION
|
||||
----- --------- --- -----------------------------------------------------
|
||||
04-Aug-88 RTK MULTI_TASK changes
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include "vista.h"
|
||||
#include "dbtype.h"
|
||||
|
||||
|
||||
#ifndef NO_TIMESTAMP
|
||||
/* Get timestamp of current record
|
||||
*/
|
||||
d_gtscr(timestamp TASK_PARM)
|
||||
ULONG FAR *timestamp;
|
||||
TASK_DECL
|
||||
{
|
||||
DB_ENTER(NO_DB_ID TASK_ID LOCK_SET(RECORD_NOIO));
|
||||
|
||||
db_status = S_OKAY;
|
||||
|
||||
/* make sure we have a current record */
|
||||
if ( curr_rec ) {
|
||||
if ( db_tsrecs )
|
||||
*timestamp = cr_time;
|
||||
else
|
||||
dberr(S_TIMESTAMP);
|
||||
}
|
||||
else
|
||||
dberr(S_NOCR);
|
||||
|
||||
RETURN( db_status );
|
||||
}
|
||||
#endif
|
||||
/* vpp -nOS2 -dUNIX -nBSD -nVANILLA_BSD -nVMS -nMEMLOCK -nWINDOWS -nFAR_ALLOC -f/usr/users/master/config/nonwin gtscr.c */
|
||||
58
cde/lib/DtSearch/raima/gtscs.c
Normal file
58
cde/lib/DtSearch/raima/gtscs.c
Normal file
@@ -0,0 +1,58 @@
|
||||
/* $XConsortium: gtscs.c /main/2 1996/05/09 04:07:58 drk $ */
|
||||
/*
|
||||
* COMPONENT_NAME: austext
|
||||
*
|
||||
* FUNCTIONS: d_gtscs
|
||||
*
|
||||
* ORIGINS: 157
|
||||
*
|
||||
* OBJECT CODE ONLY SOURCE MATERIALS
|
||||
*/
|
||||
/*-----------------------------------------------------------------------
|
||||
gtscs.c -- db_VISTA set timestamp get module.
|
||||
|
||||
(C) Copyright 1987 by Raima Corporation.
|
||||
-----------------------------------------------------------------------*/
|
||||
|
||||
/* ********************** EDIT HISTORY *******************************
|
||||
|
||||
SCR DATE INI DESCRIPTION
|
||||
----- --------- --- -----------------------------------------------------
|
||||
04-Aug-88 RTK MULTI_TASK changes
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include "vista.h"
|
||||
#include "dbtype.h"
|
||||
|
||||
|
||||
#ifndef NO_TIMESTAMP
|
||||
/* Get timestamp of set
|
||||
*/
|
||||
d_gtscs(set, timestamp TASK_PARM DBN_PARM)
|
||||
int set;
|
||||
ULONG FAR *timestamp;
|
||||
TASK_DECL
|
||||
DBN_DECL
|
||||
{
|
||||
SET_ENTRY FAR *set_ptr;
|
||||
|
||||
DB_ENTER(DB_ID TASK_ID LOCK_SET(SET_NOIO));
|
||||
|
||||
if (nset_check(set, &set, (SET_ENTRY FAR * FAR *)&set_ptr) != S_OKAY)
|
||||
RETURN( db_status );
|
||||
|
||||
/* make sure we have a current owner */
|
||||
if ( curr_own[set] ) {
|
||||
if ( db_tssets )
|
||||
*timestamp = cs_time[set];
|
||||
else
|
||||
dberr(S_TIMESTAMP);
|
||||
}
|
||||
else
|
||||
dberr(S_NOCO);
|
||||
|
||||
RETURN( db_status );
|
||||
}
|
||||
#endif
|
||||
/* vpp -nOS2 -dUNIX -nBSD -nVANILLA_BSD -nVMS -nMEMLOCK -nWINDOWS -nFAR_ALLOC -f/usr/users/master/config/nonwin gtscs.c */
|
||||
215
cde/lib/DtSearch/raima/initial.c
Normal file
215
cde/lib/DtSearch/raima/initial.c
Normal file
@@ -0,0 +1,215 @@
|
||||
/* $XConsortium: initial.c /main/3 1996/08/12 12:34:00 cde-ibm $ */
|
||||
/*
|
||||
* COMPONENT_NAME: austext
|
||||
*
|
||||
* FUNCTIONS: d_initfile
|
||||
* d_initialize
|
||||
*
|
||||
* ORIGINS: 157
|
||||
*
|
||||
* OBJECT CODE ONLY SOURCE MATERIALS
|
||||
*/
|
||||
/*-----------------------------------------------------------------------
|
||||
initial.c -- db_VISTA database initialization module.
|
||||
|
||||
(C) Copyright 1987 by Raima Corporation.
|
||||
-----------------------------------------------------------------------*/
|
||||
|
||||
/* ********************** EDIT HISTORY *******************************
|
||||
|
||||
SCR DATE INI DESCRIPTION
|
||||
----- --------- --- -----------------------------------------------------
|
||||
295 01-Jul-88 RSC d_initialize/d_initfile can corrupt disk
|
||||
115 19-Jul-88 RSC Integrate VAX/VMS changes into code
|
||||
365 25-Jul-88 RSC Add dbn argument to d_initialize
|
||||
368 28-Jul-88 RSC Integrate BSD changes into code
|
||||
04-Aug-88 RTK MULTI_TASK changes
|
||||
115 16-Aug-88 RSC Fixup of VMS integration
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <fcntl.h>
|
||||
#include "vista.h"
|
||||
#include "dbtype.h"
|
||||
#include "dbswab.h"
|
||||
|
||||
#define LENVDBID 48
|
||||
|
||||
typedef union INIT_PAGE_U {
|
||||
struct {
|
||||
F_ADDR dchain; /* delete chain pointer */
|
||||
F_ADDR next; /* next page or record slot */
|
||||
LONG timestamp; /* file's timestamp value */
|
||||
LONG cdate; /* creation date,time */
|
||||
LONG bdate; /* date/time of last backup */
|
||||
char vdb_id[LENVDBID]; /* db_vista id mark */
|
||||
} pg0;
|
||||
struct {
|
||||
LONG chg_date; /* date of last page change */
|
||||
char init_int[sizeof(INT)]; /* # filled slots on key file;
|
||||
System record # on data file */
|
||||
char init_addr[sizeof(LONG)]; /* NONE node pointer on key file;
|
||||
System record db_addr on data file */
|
||||
char init_crts[sizeof(LONG)]; /* if system record is timestamped */
|
||||
char init_upts[sizeof(LONG)]; /* if system record is timestamped */
|
||||
} pg1;
|
||||
} INIT_PAGE;
|
||||
|
||||
typedef struct {union INIT_PAGE_U FAR *ptr; LOCK_DESC} INIT_PAGE_P;
|
||||
|
||||
static char nulls[5] = "\0\0\0\0";
|
||||
static int dbfile;
|
||||
extern int cnt_open_files; /* see dio.c */
|
||||
extern int max_open_files; /* see dio.c */
|
||||
|
||||
|
||||
/* Database initialization function
|
||||
*/
|
||||
d_initialize(TASK_DBN_ONLY)
|
||||
TASK_DECL
|
||||
DBN_DECL
|
||||
{
|
||||
FILE_NO fno;
|
||||
|
||||
DB_ENTER(DB_ID TASK_ID LOCK_SET(RECORD_IO));
|
||||
|
||||
if (dbopen != 2)
|
||||
dberr(S_EXCLUSIVE);
|
||||
else {
|
||||
/* initialize db files in file_table */
|
||||
for (fno = 0; fno < DB_REF(Size_ft); ++fno) {
|
||||
if ( d_initfile(fno TASK_PARM DBN_PARM) != S_OKAY )
|
||||
break;
|
||||
}
|
||||
}
|
||||
RETURN( db_status );
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* Initialize database file
|
||||
*/
|
||||
d_initfile(fno TASK_PARM DBN_PARM)
|
||||
FILE_NO fno; /* file table entry of file to be initialized */
|
||||
TASK_DECL
|
||||
DBN_DECL
|
||||
{
|
||||
INIT_PAGE_P Page;
|
||||
#define page (Page.ptr)
|
||||
F_ADDR addr;
|
||||
ULONG ts;
|
||||
INT rno, rec;
|
||||
FILE_ENTRY FAR *file_ptr;
|
||||
RECORD_ENTRY FAR *rec_ptr;
|
||||
time_t local_timestamp;
|
||||
LONG extern_timestamp;
|
||||
|
||||
DB_ENTER(DB_ID TASK_ID LOCK_SET(RECORD_IO));
|
||||
|
||||
if ( dbopen != 2 )
|
||||
RETURN( dberr(S_EXCLUSIVE) );
|
||||
|
||||
time (&local_timestamp);
|
||||
extern_timestamp = htonl ((LONG) local_timestamp);
|
||||
|
||||
#ifndef ONE_DB
|
||||
fno += curr_db_table->ft_offset;
|
||||
#endif
|
||||
file_ptr = &file_table[fno];
|
||||
|
||||
/* If file is open - close it */
|
||||
if (file_ptr->ft_status == OPEN) dio_close(fno);
|
||||
else if (cnt_open_files == max_open_files) {
|
||||
/* We don't have enuf files, open then close this file to free one */
|
||||
dio_open(fno);
|
||||
dio_close(fno);
|
||||
}
|
||||
dio_clrfile(fno); /* clear file's pages */
|
||||
|
||||
if ((dbfile = DB_OPEN(file_ptr->ft_name, O_RDWR | O_CREAT | O_TRUNC)) < 0)
|
||||
RETURN( dberr(S_NOFILE) );
|
||||
|
||||
page = (INIT_PAGE FAR *)ALLOC(&Page, file_ptr->ft_pgsize, "page");
|
||||
if ( page == NULL ) RETURN( dberr(S_NOMEMORY) );
|
||||
|
||||
/*--------- Init PAGE 0 ---------*/
|
||||
byteset(page, '\0', file_ptr->ft_pgsize);
|
||||
/**time(&page->pg0.cdate);***/
|
||||
page->pg0.cdate = extern_timestamp;
|
||||
strcpy(page->pg0.vdb_id, "db_VISTA Version ");
|
||||
strcat(page->pg0.vdb_id, db_VERSION);
|
||||
page->pg0.bdate = 0;
|
||||
if (file_ptr->ft_type == KEY) {
|
||||
/*--------- Write KEY FILE PAGE 0 ---------*/
|
||||
page->pg0.dchain = htonl ((LONG) NONE);
|
||||
page->pg0.next = htonl (2);
|
||||
page->pg0.timestamp = 0; /* not really used by key file */
|
||||
DB_WRITE(dbfile, (char FAR *)page, (int)file_ptr->ft_pgsize);
|
||||
|
||||
/*--------- Write KEY FILE PAGE 1 ---------*/
|
||||
byteset(page, '\0', file_ptr->ft_pgsize);
|
||||
page->pg1.chg_date = extern_timestamp;
|
||||
/* node 1, current # of filled slots */
|
||||
bytecpy(page->pg1.init_int, nulls, sizeof(INT));
|
||||
/* node 1, NONE page pointer */
|
||||
addr = -1;
|
||||
bytecpy(page->pg1.init_addr, &addr, sizeof(F_ADDR));
|
||||
DB_WRITE(dbfile, (char FAR *)page, (int)file_ptr->ft_pgsize);
|
||||
}
|
||||
else {
|
||||
/*--------- Init DATA PAGE 0 ---------
|
||||
* We'll write a page 0 and page 1 for the file (if any)
|
||||
* with the system record, otherwise just a generic page 0.
|
||||
*/
|
||||
page->pg0.dchain = 0;
|
||||
page->pg0.timestamp = htonl (1);
|
||||
/* check to see if this file contains a system record */
|
||||
for (rec = 0, rec_ptr = record_table; rec < size_rt; ++rec, ++rec_ptr) {
|
||||
if ((rec_ptr->rt_fdtot == -1) && (rec_ptr->rt_file == fno)) {
|
||||
|
||||
/*---Write special DATA FILE PAGE 0 for system record file ---*/
|
||||
page->pg0.next = htonl (2);
|
||||
DB_WRITE(dbfile, (char FAR *)page, (int)file_ptr->ft_pgsize);
|
||||
|
||||
/*--------- Write DATA FILE PAGE 1 for system record ---------*/
|
||||
byteset(page, '\0', file_ptr->ft_pgsize);
|
||||
/* Data page header is current timestamp */
|
||||
/*****time(&page->pg1.chg_date);****/
|
||||
page->pg1.chg_date = extern_timestamp;
|
||||
addr = (((LONG) NUM2EXT(fno, ft_offset) & FILEMASK)
|
||||
<< FILESHIFT) | 1;
|
||||
HTONL (addr);
|
||||
bytecpy(page->pg1.init_addr, &addr, sizeof(F_ADDR));
|
||||
|
||||
/* Slot 1 (system record) header is recid, dba,
|
||||
* maybe two phony timestamps, no set ptrs or member ptrs.
|
||||
*/
|
||||
rno = htons (NUM2EXT(rec, rt_offset));
|
||||
bytecpy(page->pg1.init_int, &rno, sizeof(INT));
|
||||
if ( rec_ptr->rt_flags & TIMESTAMPED ) {
|
||||
/* timestamp system record */
|
||||
ts = htonl (1);
|
||||
bytecpy(page->pg1.init_crts, &ts, sizeof(ULONG));
|
||||
bytecpy(page->pg1.init_upts, &ts, sizeof(ULONG));
|
||||
}
|
||||
DB_WRITE(dbfile, (char FAR *)page, (int)file_ptr->ft_pgsize);
|
||||
break;
|
||||
}
|
||||
}
|
||||
/*--------- Write generic DATA FILE PAGE 0 ---------
|
||||
* If we went through whole record table without finding
|
||||
* a system record, just write a generic page 0.
|
||||
*/
|
||||
if (rec == size_rt) {
|
||||
page->pg0.next = htonl (1);
|
||||
DB_WRITE(dbfile, (char FAR *)page, (int)file_ptr->ft_pgsize);
|
||||
}
|
||||
}
|
||||
/* close database file */
|
||||
DB_CLOSE(dbfile);
|
||||
dio_pzread(fno); /* re-read file header */
|
||||
MEM_UNLOCK(&Page);
|
||||
FREE(&Page);
|
||||
RETURN( db_status );
|
||||
}
|
||||
/* vpp -nOS2 -dUNIX -nBSD -nVANILLA_BSD -nVMS -nMEMLOCK -nWINDOWS -nFAR_ALLOC -f/usr/users/master/config/nonwin initial.c */
|
||||
761
cde/lib/DtSearch/raima/inittab.c
Normal file
761
cde/lib/DtSearch/raima/inittab.c
Normal file
@@ -0,0 +1,761 @@
|
||||
/*
|
||||
* COMPONENT_NAME: austext
|
||||
*
|
||||
* FUNCTIONS: alloc_dict
|
||||
* initcurr
|
||||
* inittab
|
||||
*
|
||||
* ORIGINS: 27,157
|
||||
*
|
||||
* This module contains IBM CONFIDENTIAL code. -- (IBM
|
||||
* Confidential Restricted when combined with the aggregated
|
||||
* modules for this product)
|
||||
*
|
||||
* OBJECT CODE ONLY SOURCE MATERIALS
|
||||
* (C) COPYRIGHT International Business Machines Corp. 1995, 1996
|
||||
* All Rights Reserved
|
||||
* US Government Users Restricted Rights - Use, duplication or
|
||||
* disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
|
||||
*/
|
||||
/*-----------------------------------------------------------------------
|
||||
$XConsortium: inittab.c /main/5 1996/08/12 12:34:15 cde-ibm $
|
||||
inittab.c -- db_VISTA table initialization module.
|
||||
|
||||
(C) Copyright 1987 by Raima Corporation.
|
||||
-----------------------------------------------------------------------*/
|
||||
|
||||
/* ********************** EDIT HISTORY *******************************
|
||||
|
||||
SCR DATE INI DESCRIPTION
|
||||
----- --------- --- -----------------------------------------------------
|
||||
101 21-Jun-88 RSC Initialized rn_type and rn_dba
|
||||
23-Jun-88 RSC Make const_dbd, const_dbf unique to 7 chars
|
||||
274 30-Jun-88 RSC Initialization of curr_rec was goofy (erroneous)
|
||||
115 19-Jul-88 RSC Integrate VAX/VMS changes into code
|
||||
04-Aug-88 RTK MULTI_TASK changes
|
||||
18-Aug-88 RSC moved rn_type/dba to separate table.
|
||||
417 31-Aug-88 RSC Initialized curr_rn_table.
|
||||
420 19-Oct-88 RSC key_count was initialized wrong causing memory overwrites
|
||||
438 06-Jan-89 RSC need to explicitly initialize size_xx
|
||||
532 06-Jan-89 RSC Fixes to compile with ONE_DB
|
||||
*
|
||||
* $Log$
|
||||
* Revision 1.3 1995/10/17 19:19:59 miker
|
||||
* Changed .dbd file open mode from O_RDWR to O_RDONLY.
|
||||
* When initializing tables only need to read .dbd file.
|
||||
*
|
||||
* Revision 1.2 1995/10/13 18:48:16 miker
|
||||
* Change hardcoded dbfile[] size from 48 to DtSrFILENMLEN.
|
||||
*
|
||||
* Revision 1.1 1995/10/13 18:48:00 miker
|
||||
* Original vista source.
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <fcntl.h>
|
||||
#include "vista.h"
|
||||
#include "dbtype.h"
|
||||
#include "inittab.h"
|
||||
#include "dbswab.h"
|
||||
|
||||
#define DEBUG_INITTAB
|
||||
int debugging_inittab = FALSE;
|
||||
int dump_init_tables = FALSE;
|
||||
|
||||
|
||||
/* Internal function prototypes */
|
||||
static int alloc_dict(P0);
|
||||
static int initcurr(P0);
|
||||
|
||||
|
||||
|
||||
|
||||
/* Initialize database tables
|
||||
*/
|
||||
inittab()
|
||||
{
|
||||
register int dbt_lc; /* loop control */
|
||||
register INT i, j;
|
||||
int key_offset = 0, key_count;
|
||||
char dbfile[DtSrFILENMLEN], dbd_ver[DBD_COMPAT_LEN + 1];
|
||||
char dbname[FILENMLEN]; /* Temporary working space */
|
||||
int dbf;
|
||||
FILE_ENTRY FAR *file_ptr;
|
||||
FIELD_ENTRY FAR *fld_ptr;
|
||||
#ifndef ONE_DB
|
||||
#define DB_ENABLE 1
|
||||
#else
|
||||
#define DB_ENABLE 0
|
||||
#endif
|
||||
#ifndef NO_TIMESTAMP
|
||||
#define TS_ENABLE 1
|
||||
#else
|
||||
#define TS_ENABLE 0
|
||||
#endif
|
||||
#if DB_ENABLE | TS_ENABLE
|
||||
RECORD_ENTRY FAR *rec_ptr;
|
||||
SET_ENTRY FAR *set_ptr;
|
||||
#endif
|
||||
#ifndef ONE_DB
|
||||
MEMBER_ENTRY FAR *mem_ptr;
|
||||
SORT_ENTRY FAR *srt_ptr;
|
||||
KEY_ENTRY FAR *key_ptr;
|
||||
#endif
|
||||
|
||||
#ifndef NO_TIMESTAMP
|
||||
db_tsrecs = db_tssets = FALSE;
|
||||
#endif
|
||||
size_ft = size_rt = size_st = size_mt = size_srt = size_fd = size_kt = 0;
|
||||
|
||||
/* compute individual dictionary sizes and offsets */
|
||||
#ifndef ONE_DB
|
||||
for (dbt_lc = 0, curr_db_table = &db_table[old_no_of_dbs];
|
||||
dbt_lc < no_of_dbs; ++dbt_lc, ++curr_db_table) {
|
||||
#endif
|
||||
|
||||
/* form database dictionary name */
|
||||
if ( DB_REF(db_path[0]) )
|
||||
strcpy(dbname, DB_REF(db_path));
|
||||
else
|
||||
dbname[0] = '\0';
|
||||
|
||||
#ifdef DEBUG_INITTAB
|
||||
if (debugging_inittab) {
|
||||
printf (__FILE__"100 inittab: path='%s' dbname='%s'\n",
|
||||
dbname, DB_REF(db_name));
|
||||
fflush (stdout);
|
||||
}
|
||||
#endif
|
||||
if (strlen(dbname) + strlen(DB_REF(db_name)) >= FILENMLEN+4)
|
||||
return( dberr(S_NAMELEN) );
|
||||
strcat(dbname, DB_REF(db_name));
|
||||
if (con_dbd(dbfile, dbname, get_element(dbdpath, dbt_lc)) != S_OKAY)
|
||||
return( dberr(db_status) );
|
||||
|
||||
/*----------------- PASS 1 -------------------
|
||||
* In this first pass, only opening to determine
|
||||
* required table sizes, so opening read-only is ok.
|
||||
*/
|
||||
if ( (dbf = open_b(dbfile, O_RDONLY)) < 0 )
|
||||
return( dberr( S_INVDB ) );
|
||||
|
||||
/* Read in and verify the dictionary version */
|
||||
DB_READ(dbf, dbd_ver, DBD_COMPAT_LEN);
|
||||
dbd_ver[DBD_COMPAT_LEN] = '\0';
|
||||
for ( i=0; i<size_compat; i++ ) {
|
||||
if ( strcmp( dbd_ver, compat_dbd[i] ) == 0 ) goto goodver;
|
||||
}
|
||||
|
||||
/* Incompatible dictionary file */
|
||||
close( dbf );
|
||||
return( dberr( S_INCOMPAT ) );
|
||||
goodver:
|
||||
|
||||
/* Read in database page size */
|
||||
DB_READ(dbf, (char FAR *)&DB_REF(Page_size), sizeof(INT));
|
||||
NTOHS (DB_REF(Page_size));
|
||||
|
||||
/* Read in table sizes */
|
||||
DB_READ(dbf, (char FAR *)&DB_REF(Size_ft), sizeof(INT));
|
||||
NTOHS (DB_REF(Size_ft));
|
||||
DB_READ(dbf, (char FAR *)&DB_REF(Size_rt), sizeof(INT));
|
||||
NTOHS (DB_REF(Size_rt));
|
||||
DB_READ(dbf, (char FAR *)&DB_REF(Size_fd), sizeof(INT));
|
||||
NTOHS (DB_REF(Size_fd));
|
||||
DB_READ(dbf, (char FAR *)&DB_REF(Size_st), sizeof(INT));
|
||||
NTOHS (DB_REF(Size_st));
|
||||
DB_READ(dbf, (char FAR *)&DB_REF(Size_mt), sizeof(INT));
|
||||
NTOHS (DB_REF(Size_mt));
|
||||
DB_READ(dbf, (char FAR *)&DB_REF(Size_srt), sizeof(INT));
|
||||
NTOHS (DB_REF(Size_srt));
|
||||
DB_READ(dbf, (char FAR *)&DB_REF(Size_kt), sizeof(INT));
|
||||
NTOHS (DB_REF(Size_kt));
|
||||
close(dbf); /* end of PASS 1 */
|
||||
|
||||
#ifdef DEBUG_INITTAB
|
||||
if (debugging_inittab) {
|
||||
printf (__FILE__"152 sizes: pg=%d ft=%d rt=%d fd=%d\n"
|
||||
" st=%d mt=%d srt=%d kt=%d\n",
|
||||
(int) DB_REF(Page_size),
|
||||
(int) DB_REF(Size_ft),
|
||||
(int) DB_REF(Size_rt),
|
||||
(int) DB_REF(Size_fd),
|
||||
(int) DB_REF(Size_st),
|
||||
(int) DB_REF(Size_mt),
|
||||
(int) DB_REF(Size_srt),
|
||||
(int) DB_REF(Size_kt)
|
||||
);
|
||||
fflush (stdout);
|
||||
}
|
||||
#endif
|
||||
|
||||
DB_REF(sysdba) = NULL_DBA;
|
||||
|
||||
#ifndef ONE_DB
|
||||
/* update merged dictionary offsets and sizes */
|
||||
if ( curr_db_table->Page_size > page_size ) {
|
||||
page_size = curr_db_table->Page_size;
|
||||
#ifdef DEBUG_INITTAB
|
||||
if (debugging_inittab) {
|
||||
printf (__FILE__"191 db's page_size-->%d (largest = %d)\n",
|
||||
(int)page_size, (int)largest_page);
|
||||
fflush(stdout);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
curr_db_table->ft_offset = size_ft;
|
||||
size_ft += curr_db_table->Size_ft;
|
||||
curr_db_table->rt_offset = size_rt;
|
||||
size_rt += curr_db_table->Size_rt;
|
||||
curr_db_table->fd_offset = size_fd;
|
||||
size_fd += curr_db_table->Size_fd;
|
||||
curr_db_table->st_offset = size_st;
|
||||
size_st += curr_db_table->Size_st;
|
||||
curr_db_table->mt_offset = size_mt;
|
||||
size_mt += curr_db_table->Size_mt;
|
||||
curr_db_table->srt_offset = size_srt;
|
||||
size_srt += curr_db_table->Size_srt;
|
||||
curr_db_table->kt_offset = size_kt;
|
||||
size_kt += curr_db_table->Size_kt;
|
||||
}
|
||||
#endif
|
||||
/* allocate dictionary space */
|
||||
if ( alloc_dict() != S_OKAY ) return( db_status );
|
||||
|
||||
/* read in and adjust dictionary entries for each database */
|
||||
#ifndef ONE_DB
|
||||
for (dbt_lc = 0, curr_db_table = &db_table[old_no_of_dbs];
|
||||
dbt_lc < no_of_dbs;
|
||||
++dbt_lc, ++curr_db_table) {
|
||||
#endif
|
||||
|
||||
/* form database dictionary name */
|
||||
if ( DB_REF(db_path[0]) )
|
||||
strcpy(dbname, DB_REF(db_path));
|
||||
else
|
||||
dbname[0] = '\0';
|
||||
if (strlen(dbname) + strlen(DB_REF(db_name)) >= FILENMLEN+4)
|
||||
return( dberr(S_NAMELEN) );
|
||||
strcat(dbname,DB_REF(db_name));
|
||||
if (con_dbd(dbfile,dbname,get_element(dbdpath, dbt_lc)) != S_OKAY)
|
||||
return( dberr(db_status) );
|
||||
#ifdef DEBUG_INITTAB
|
||||
if (dump_init_tables) {
|
||||
printf (__FILE__"247 Tables for database '%s':\n", dbfile);
|
||||
fflush (stdout);
|
||||
}
|
||||
#endif
|
||||
|
||||
/*----------------- PASS 2 -------------------
|
||||
* Second pass just loads allocated tables,
|
||||
* so opening .dbd file read-only is still ok.
|
||||
*/
|
||||
dbf = open_b (dbfile, O_RDONLY);
|
||||
DB_LSEEK(dbf, DBD_COMPAT_LEN + 8L*sizeof(INT), 0);
|
||||
|
||||
/*----------------- FILE TABLE -------------------*/
|
||||
DB_READ(dbf, (char FAR *)&file_table[ORIGIN(ft_offset)],
|
||||
(DB_REF(Size_ft)*sizeof(FILE_ENTRY)));
|
||||
/* Invalid if sizeof(xxxx_ENTRY) diff on each machine */
|
||||
for ( i = 0, file_ptr = &file_table[ORIGIN(ft_offset)];
|
||||
i < DB_REF(Size_ft);
|
||||
i++, file_ptr++) {
|
||||
/* Byte swap each INT on LITTLE_ENDIAN machines */
|
||||
NTOHS (file_ptr->ft_slots);
|
||||
NTOHS (file_ptr->ft_slsize);
|
||||
NTOHS (file_ptr->ft_pgsize);
|
||||
NTOHS (file_ptr->ft_flags);
|
||||
#ifdef DEBUG_INITTAB
|
||||
if (dump_init_tables) {
|
||||
printf (" FILE#%d: ty=%c slts=%2d slsz=%3d pgsz=%d '%s'\n",
|
||||
(int)i,
|
||||
file_ptr->ft_type,
|
||||
(int)file_ptr->ft_slots,
|
||||
(int)file_ptr->ft_slsize,
|
||||
(int)file_ptr->ft_pgsize,
|
||||
file_ptr->ft_name);
|
||||
fflush (stdout);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
/*----------------- RECORD TABLE -------------------*/
|
||||
DB_READ(dbf, (char FAR *)&record_table[ORIGIN(rt_offset)],
|
||||
(DB_REF(Size_rt)*sizeof(RECORD_ENTRY)));
|
||||
for ( i = 0, rec_ptr = &record_table[ORIGIN(rt_offset)];
|
||||
i < DB_REF(Size_rt);
|
||||
i++, rec_ptr++) {
|
||||
/* Byte swap each INT on LITTLE_ENDIAN machines */
|
||||
NTOHS (rec_ptr->rt_file);
|
||||
NTOHS (rec_ptr->rt_len);
|
||||
NTOHS (rec_ptr->rt_data);
|
||||
NTOHS (rec_ptr->rt_fields);
|
||||
NTOHS (rec_ptr->rt_fdtot);
|
||||
NTOHS (rec_ptr->rt_flags);
|
||||
#ifdef DEBUG_INITTAB
|
||||
if (dump_init_tables) {
|
||||
printf (
|
||||
" REC #%d: fil=%d len=%3d data=%2d fld1=%2d flds=%2d\n",
|
||||
(int)i,
|
||||
(int)rec_ptr->rt_file,
|
||||
(int)rec_ptr->rt_len,
|
||||
(int)rec_ptr->rt_data,
|
||||
(int)rec_ptr->rt_fields,
|
||||
(int)rec_ptr->rt_fdtot);
|
||||
fflush (stdout);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
/*----------------- FIELD TABLE -------------------*/
|
||||
DB_READ(dbf, (char FAR *)&field_table[ORIGIN(fd_offset)],
|
||||
(DB_REF(Size_fd)*sizeof(FIELD_ENTRY)));
|
||||
for ( i = 0, fld_ptr = &field_table[ORIGIN(fd_offset)];
|
||||
i < DB_REF(Size_fd);
|
||||
i++, fld_ptr++) {
|
||||
/* Byte swap each INT on LITTLE_ENDIAN machines */
|
||||
NTOHS (fld_ptr->fd_len);
|
||||
NTOHS (fld_ptr->fd_keyfile);
|
||||
NTOHS (fld_ptr->fd_keyno);
|
||||
NTOHS (fld_ptr->fd_ptr);
|
||||
NTOHS (fld_ptr->fd_rec);
|
||||
NTOHS (fld_ptr->fd_flags);
|
||||
for (j=0; j<MAXDIMS; j++)
|
||||
NTOHS (fld_ptr->fd_dim[j]);
|
||||
#ifdef DEBUG_INITTAB
|
||||
if (dump_init_tables) {
|
||||
if (i == 0)
|
||||
puts (" key typ len kfil key# ofs rec# flg dims");
|
||||
printf (
|
||||
" FLD#%2d %c %c %3d %d %d %3d %d %x",
|
||||
(int)i,
|
||||
fld_ptr->fd_key,
|
||||
fld_ptr->fd_type,
|
||||
(int)fld_ptr->fd_len,
|
||||
(int)fld_ptr->fd_keyfile,
|
||||
(int)fld_ptr->fd_keyno,
|
||||
(int)fld_ptr->fd_ptr,
|
||||
(int)fld_ptr->fd_rec,
|
||||
(int)fld_ptr->fd_flags);
|
||||
for (j=0; j<MAXDIMS; j++)
|
||||
if (fld_ptr->fd_dim[j])
|
||||
printf (" %d:%d", j, (int)fld_ptr->fd_dim[j]);
|
||||
putchar ('\n');
|
||||
fflush (stdout);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
/*----------------- SET TABLE -------------------*/
|
||||
DB_READ(dbf, (char FAR *)&set_table[ORIGIN(st_offset)],
|
||||
(DB_REF(Size_st)*sizeof(SET_ENTRY)));
|
||||
for ( i = 0, set_ptr = &set_table[ORIGIN(st_offset)];
|
||||
i < DB_REF(Size_st);
|
||||
i++, set_ptr++) {
|
||||
/* Byte swap each INT on LITTLE_ENDIAN machines */
|
||||
NTOHS (set_ptr->st_order);
|
||||
NTOHS (set_ptr->st_own_rt);
|
||||
NTOHS (set_ptr->st_own_ptr);
|
||||
NTOHS (set_ptr->st_members);
|
||||
NTOHS (set_ptr->st_memtot);
|
||||
NTOHS (set_ptr->st_flags);
|
||||
#ifdef DEBUG_INITTAB
|
||||
if (dump_init_tables) {
|
||||
printf (
|
||||
" SET #%d: ord=%c owner=%d ownofs=%2d mem1=%d mems=%d\n",
|
||||
(int)i,
|
||||
(char)set_ptr->st_order,
|
||||
(int)set_ptr->st_own_rt,
|
||||
(int)set_ptr->st_own_ptr,
|
||||
(int)set_ptr->st_members,
|
||||
(int)set_ptr->st_memtot);
|
||||
fflush (stdout);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
/*----------------- MEMBER TABLE -------------------*/
|
||||
DB_READ(dbf, (char FAR *)&member_table[ORIGIN(mt_offset)],
|
||||
(DB_REF(Size_mt)*sizeof(MEMBER_ENTRY)));
|
||||
for ( i = 0, mem_ptr = &member_table[ORIGIN(mt_offset)];
|
||||
i < DB_REF(Size_mt);
|
||||
i++, mem_ptr++) {
|
||||
/* Byte swap each INT on LITTLE_ENDIAN machines */
|
||||
NTOHS (mem_ptr->mt_record);
|
||||
NTOHS (mem_ptr->mt_mem_ptr);
|
||||
NTOHS (mem_ptr->mt_sort_fld);
|
||||
NTOHS (mem_ptr->mt_totsf);
|
||||
#ifdef DEBUG_INITTAB
|
||||
if (dump_init_tables) {
|
||||
printf (
|
||||
" MEM #%d: rec=%d ofs=%d sort1=%d sorts=%d\n",
|
||||
(int)i,
|
||||
(int)mem_ptr->mt_record,
|
||||
(int)mem_ptr->mt_mem_ptr,
|
||||
(int)mem_ptr->mt_sort_fld,
|
||||
(int)mem_ptr->mt_totsf);
|
||||
fflush (stdout);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
DB_READ(dbf, (char FAR *)&sort_table[ORIGIN(srt_offset)],
|
||||
(DB_REF(Size_srt)*sizeof(SORT_ENTRY)));
|
||||
/* Member sort tables not used by DtSearch @@@ */
|
||||
if (DB_REF(Size_srt)) {
|
||||
/* Byte swap each INT on LITTLE_ENDIAN machines */
|
||||
srt_ptr = &sort_table[ORIGIN(srt_offset)];
|
||||
NTOHS (srt_ptr->se_fld);
|
||||
NTOHS (srt_ptr->se_set);
|
||||
}
|
||||
|
||||
DB_READ(dbf, (char FAR *)&key_table[ORIGIN(kt_offset)],
|
||||
(DB_REF(Size_kt)*sizeof(KEY_ENTRY)));
|
||||
/* Compound key tables not used by DtSearch @@@ */
|
||||
if (DB_REF(Size_kt)) {
|
||||
/* Byte swap each INT on LITTLE_ENDIAN machines */
|
||||
key_ptr = &key_table[ORIGIN(kt_offset)];
|
||||
NTOHS (key_ptr->kt_key);
|
||||
NTOHS (key_ptr->kt_field);
|
||||
NTOHS (key_ptr->kt_ptr);
|
||||
NTOHS (key_ptr->kt_sort);
|
||||
}
|
||||
|
||||
close(dbf); /* end of PASS 2 */
|
||||
#ifdef DEBUG_INITTAB
|
||||
dump_init_tables = FALSE;
|
||||
#endif
|
||||
#ifndef ONE_DB
|
||||
curr_db_table->key_offset = key_offset;
|
||||
#endif
|
||||
|
||||
/* update file table path entries */
|
||||
if ( DB_REF(db_path[0]) || dbfpath[0] ) {
|
||||
for (i = 0, file_ptr = &file_table[ORIGIN(ft_offset)];
|
||||
i < DB_REF(Size_ft);
|
||||
++i, ++file_ptr) {
|
||||
|
||||
/* Construct the data/key file name */
|
||||
if ( DB_REF(db_path[0]) )
|
||||
strcpy(dbname, DB_REF(db_path));
|
||||
else
|
||||
dbname[0] = '\0';
|
||||
if (strlen(dbname) + strlen(DB_REF(db_name)) >= FILENMLEN+4)
|
||||
return( dberr(S_NAMELEN) );
|
||||
strcat(dbname, DB_REF(db_name));
|
||||
if (con_dbf(dbfile, file_ptr->ft_name, dbname,
|
||||
get_element(dbfpath, dbt_lc)) != S_OKAY)
|
||||
return( dberr(db_status) );
|
||||
|
||||
/* Save new name in dictionary */
|
||||
strcpy(file_ptr->ft_name, dbfile);
|
||||
}
|
||||
}
|
||||
#if DB_ENABLE | TS_ENABLE
|
||||
/* adjust record table entries */
|
||||
for (i = ORIGIN(rt_offset), rec_ptr = &record_table[ORIGIN(rt_offset)];
|
||||
i < ORIGIN(rt_offset) + DB_REF(Size_rt);
|
||||
++i, ++rec_ptr) {
|
||||
#ifndef ONE_DB
|
||||
rec_ptr->rt_file += curr_db_table->ft_offset;
|
||||
rec_ptr->rt_fields += curr_db_table->fd_offset;
|
||||
#endif
|
||||
#ifndef NO_TIMESTAMP
|
||||
if ( rec_ptr->rt_flags & TIMESTAMPED ) {
|
||||
db_tsrecs = TRUE;
|
||||
#ifdef ONE_DB
|
||||
break;
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
/* adjust field table entries */
|
||||
for (key_count = 0, i = ORIGIN(fd_offset),
|
||||
fld_ptr = &field_table[ORIGIN(fd_offset)];
|
||||
i < ORIGIN(fd_offset) + DB_REF(Size_fd);
|
||||
++i, ++fld_ptr) {
|
||||
#ifndef ONE_DB
|
||||
fld_ptr->fd_rec += curr_db_table->rt_offset;
|
||||
#endif
|
||||
if ( fld_ptr->fd_key != NOKEY ) {
|
||||
fld_ptr->fd_keyno += key_offset;
|
||||
++key_count;
|
||||
#ifndef ONE_DB
|
||||
fld_ptr->fd_keyfile += curr_db_table->ft_offset;
|
||||
if ( fld_ptr->fd_type == 'k' )
|
||||
fld_ptr->fd_ptr += curr_db_table->kt_offset;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
key_offset += key_count;
|
||||
|
||||
#if DB_ENABLE | TS_ENABLE
|
||||
/* adjust set table entries */
|
||||
for (i = ORIGIN(st_offset), set_ptr = &set_table[ORIGIN(st_offset)];
|
||||
i < ORIGIN(st_offset) + DB_REF(Size_st);
|
||||
++i, ++set_ptr) {
|
||||
#ifndef ONE_DB
|
||||
set_ptr->st_own_rt += curr_db_table->rt_offset;
|
||||
set_ptr->st_members += curr_db_table->mt_offset;
|
||||
#endif
|
||||
#ifndef NO_TIMESTAMP
|
||||
if ( set_ptr->st_flags & TIMESTAMPED ) {
|
||||
db_tssets = TRUE;
|
||||
#ifdef ONE_DB
|
||||
break;
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifndef ONE_DB
|
||||
/* adjust member table entries */
|
||||
for (i = curr_db_table->mt_offset,
|
||||
mem_ptr = &member_table[curr_db_table->mt_offset];
|
||||
i < curr_db_table->mt_offset + curr_db_table->Size_mt;
|
||||
++i, ++mem_ptr) {
|
||||
mem_ptr->mt_record += curr_db_table->rt_offset;
|
||||
mem_ptr->mt_sort_fld += curr_db_table->srt_offset;
|
||||
}
|
||||
|
||||
/* adjust sort table entries */
|
||||
for (i = curr_db_table->srt_offset,
|
||||
srt_ptr = &sort_table[curr_db_table->srt_offset];
|
||||
i < curr_db_table->srt_offset + curr_db_table->Size_srt;
|
||||
++i, ++srt_ptr) {
|
||||
srt_ptr->se_fld += curr_db_table->fd_offset;
|
||||
srt_ptr->se_set += curr_db_table->st_offset;
|
||||
}
|
||||
|
||||
/* adjust key table entries */
|
||||
for (i = curr_db_table->kt_offset,
|
||||
key_ptr = &key_table[curr_db_table->kt_offset];
|
||||
i < curr_db_table->kt_offset + curr_db_table->Size_kt;
|
||||
++i, ++key_ptr) {
|
||||
key_ptr->kt_key += curr_db_table->fd_offset;
|
||||
key_ptr->kt_field += curr_db_table->fd_offset;
|
||||
}
|
||||
} /* end loop for each database */
|
||||
#endif
|
||||
initcurr();
|
||||
return( db_status );
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* Allocate space for dictionary
|
||||
*/
|
||||
static int alloc_dict()
|
||||
{
|
||||
int old_size;
|
||||
int new_size;
|
||||
int extra_file = 0;
|
||||
#ifndef ONE_DB
|
||||
DB_ENTRY FAR *db_ptr;
|
||||
#endif
|
||||
|
||||
/* allocate and initialize file_table */
|
||||
#ifndef NO_TRANS
|
||||
if ( use_ovfl ) {
|
||||
extra_file = 1;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifndef ONE_DB
|
||||
if ( old_no_of_dbs == 0 ) {
|
||||
old_size_ft = 0;
|
||||
old_size_fd = 0;
|
||||
old_size_st = 0;
|
||||
old_size_mt = 0;
|
||||
old_size_srt = 0;
|
||||
old_size_kt = 0;
|
||||
old_size_rt = 0;
|
||||
}
|
||||
else {
|
||||
db_ptr = &db_table[old_no_of_dbs];
|
||||
old_size_ft = db_ptr->Size_ft + db_ptr->ft_offset + extra_file;
|
||||
old_size_fd = db_ptr->Size_fd + db_ptr->fd_offset;
|
||||
old_size_st = db_ptr->Size_st + db_ptr->st_offset;
|
||||
old_size_mt = db_ptr->Size_mt + db_ptr->mt_offset;
|
||||
old_size_srt = db_ptr->Size_srt + db_ptr->srt_offset;
|
||||
old_size_kt = db_ptr->Size_kt + db_ptr->kt_offset;
|
||||
old_size_rt = db_ptr->Size_rt + db_ptr->rt_offset;
|
||||
}
|
||||
#endif
|
||||
|
||||
new_size = (size_ft + extra_file) * sizeof(FILE_ENTRY);
|
||||
old_size = old_size_ft * sizeof(FILE_ENTRY);
|
||||
if ( ALLOC_TABLE(&db_global.File_table, new_size, old_size, "file_table")
|
||||
!= S_OKAY ) {
|
||||
return( db_status );
|
||||
}
|
||||
|
||||
/* allocate record_table */
|
||||
new_size = size_rt * sizeof(RECORD_ENTRY);
|
||||
old_size = old_size_rt * sizeof(RECORD_ENTRY);
|
||||
if ( ALLOC_TABLE(&db_global.Record_table, new_size, old_size, "record_table")
|
||||
!= S_OKAY ) {
|
||||
return( db_status );
|
||||
}
|
||||
|
||||
/* allocate field_table */
|
||||
new_size = size_fd * sizeof(FIELD_ENTRY);
|
||||
old_size = old_size_fd * sizeof(FIELD_ENTRY);
|
||||
if ( ALLOC_TABLE(&db_global.Field_table, new_size, old_size, "field_table")
|
||||
!= S_OKAY ) {
|
||||
return( db_status );
|
||||
}
|
||||
|
||||
/* allocate set table */
|
||||
if ( size_st ) {
|
||||
new_size = size_st * sizeof(SET_ENTRY);
|
||||
old_size = old_size_st * sizeof(SET_ENTRY);
|
||||
if ( ALLOC_TABLE(&db_global.Set_table, new_size, old_size, "set_table")
|
||||
!= S_OKAY ) {
|
||||
return( db_status );
|
||||
}
|
||||
} else set_table = NULL;
|
||||
|
||||
/* allocate member_table */
|
||||
if ( size_mt ) {
|
||||
new_size = size_mt * sizeof(MEMBER_ENTRY);
|
||||
old_size = old_size_mt * sizeof(MEMBER_ENTRY);
|
||||
if ( ALLOC_TABLE(&db_global.Member_table, new_size, old_size, "member_table")
|
||||
!= S_OKAY ) {
|
||||
return( db_status );
|
||||
}
|
||||
} else member_table = NULL;
|
||||
|
||||
/* allocate sort_table */
|
||||
if ( size_srt ) {
|
||||
new_size = size_srt * sizeof(SORT_ENTRY);
|
||||
old_size = old_size_srt * sizeof(SORT_ENTRY);
|
||||
if ( ALLOC_TABLE(&db_global.Sort_table, new_size, old_size, "sort_table")
|
||||
!= S_OKAY ) {
|
||||
return( db_status );
|
||||
}
|
||||
} else sort_table = NULL;
|
||||
|
||||
/* allocate key_table */
|
||||
if ( size_kt ) {
|
||||
new_size = size_kt * sizeof(KEY_ENTRY);
|
||||
old_size = old_size_kt * sizeof(KEY_ENTRY);
|
||||
if ( ALLOC_TABLE(&db_global.Key_table, new_size, old_size, "key_table")
|
||||
!= S_OKAY ) {
|
||||
return( db_status );
|
||||
}
|
||||
} else key_table = NULL;
|
||||
|
||||
return( db_status = S_OKAY );
|
||||
}
|
||||
|
||||
/* Initialize currency tables
|
||||
*/
|
||||
static int initcurr()
|
||||
{
|
||||
register int dbt_lc; /* loop control */
|
||||
register int rec, i;
|
||||
RECORD_ENTRY FAR *rec_ptr;
|
||||
SET_ENTRY FAR *set_ptr;
|
||||
DB_ADDR FAR *co_ptr;
|
||||
int old_size;
|
||||
int new_size;
|
||||
|
||||
/* Initialize current record and type */
|
||||
#ifndef ONE_DB
|
||||
for (dbt_lc = no_of_dbs, curr_db_table = &db_table[old_no_of_dbs],
|
||||
curr_rn_table = &rn_table[old_no_of_dbs];
|
||||
--dbt_lc >= 0; ++curr_db_table, ++curr_rn_table) {
|
||||
DB_REF(curr_dbt_rec) = NULL_DBA;
|
||||
#endif
|
||||
RN_REF(rn_dba) = NULL_DBA;
|
||||
RN_REF(rn_type) = -1;
|
||||
#ifndef ONE_DB
|
||||
}
|
||||
#endif
|
||||
|
||||
if ( size_st ) {
|
||||
new_size = size_st * sizeof(DB_ADDR);
|
||||
old_size = old_size_st * sizeof(DB_ADDR);
|
||||
if ( ALLOC_TABLE(&db_global.Curr_own, new_size, old_size, "curr_own")
|
||||
!= S_OKAY ) {
|
||||
return( db_status );
|
||||
}
|
||||
if ( ALLOC_TABLE(&db_global.Curr_mem, new_size, old_size, "curr_mem")
|
||||
!= S_OKAY ) {
|
||||
return( db_status );
|
||||
}
|
||||
#ifndef NO_TIMESTAMP
|
||||
new_size = size_st * sizeof(ULONG);
|
||||
old_size = old_size_st * sizeof(ULONG);
|
||||
if ( db_tsrecs ) {
|
||||
if ( ALLOC_TABLE(&db_global.Co_time, new_size, old_size, "co_time")
|
||||
!= S_OKAY ) {
|
||||
return( db_status );
|
||||
}
|
||||
if ( ALLOC_TABLE(&db_global.Cm_time, new_size, old_size, "cm_time")
|
||||
!= S_OKAY ) {
|
||||
return( db_status );
|
||||
}
|
||||
}
|
||||
if ( db_tssets ) {
|
||||
if ( ALLOC_TABLE(&db_global.Cs_time, new_size, old_size, "cs_time")
|
||||
!= S_OKAY ) {
|
||||
return( db_status );
|
||||
}
|
||||
}
|
||||
#endif
|
||||
/* for each db make system record as curr_own of its sets */
|
||||
#ifndef ONE_DB
|
||||
for (dbt_lc = no_of_dbs, curr_db_table = &db_table[old_no_of_dbs];
|
||||
--dbt_lc >= 0; ++curr_db_table) {
|
||||
#endif
|
||||
for (rec = ORIGIN(rt_offset),
|
||||
rec_ptr = &record_table[ORIGIN(rt_offset)];
|
||||
rec < ORIGIN(rt_offset) + DB_REF(Size_rt);
|
||||
++rec, ++rec_ptr) {
|
||||
if (rec_ptr->rt_fdtot == -1) {
|
||||
/* found system record */
|
||||
curr_rec = ((FILEMASK & NUM2EXT(rec_ptr->rt_file, ft_offset))
|
||||
<< FILESHIFT) | 1L;
|
||||
/* make system record current of sets it owns */
|
||||
for (i = ORIGIN(st_offset),
|
||||
set_ptr = &set_table[ORIGIN(st_offset)],
|
||||
co_ptr = &curr_own[ORIGIN(st_offset)];
|
||||
i < ORIGIN(st_offset) + DB_REF(Size_st);
|
||||
++i, ++set_ptr, ++co_ptr) {
|
||||
if (set_ptr->st_own_rt == rec) {
|
||||
*co_ptr = curr_rec;
|
||||
}
|
||||
}
|
||||
DB_REF(sysdba) = curr_rec;
|
||||
#ifndef ONE_DB
|
||||
DB_REF(curr_dbt_rec) = curr_rec;
|
||||
#endif
|
||||
break;
|
||||
}
|
||||
}
|
||||
#ifndef ONE_DB
|
||||
}
|
||||
#endif
|
||||
}
|
||||
else {
|
||||
curr_own = NULL;
|
||||
curr_mem = NULL;
|
||||
}
|
||||
#ifndef ONE_DB
|
||||
curr_db = 0;
|
||||
MEM_LOCK(&db_global.Db_table);
|
||||
curr_db_table = db_table;
|
||||
MEM_LOCK(&db_global.Rn_table);
|
||||
curr_rn_table = rn_table;
|
||||
setdb_on = FALSE;
|
||||
curr_rec = DB_REF(curr_dbt_rec);
|
||||
#endif
|
||||
return( db_status = S_OKAY );
|
||||
}
|
||||
/* vpp -nOS2 -dUNIX -nBSD -nVANILLA_BSD -nVMS -nMEMLOCK -nWINDOWS -nFAR_ALLOC -f/usr/users/master/config/nonwin inittab.c */
|
||||
66
cde/lib/DtSearch/raima/inittab.h
Normal file
66
cde/lib/DtSearch/raima/inittab.h
Normal file
@@ -0,0 +1,66 @@
|
||||
/*
|
||||
* COMPONENT_NAME: austext
|
||||
*
|
||||
* FUNCTIONS: sizeof
|
||||
*
|
||||
* ORIGINS: 27,157
|
||||
*
|
||||
* (C) COPYRIGHT International Business Machines Corp. 1995, 1996
|
||||
* All Rights Reserved
|
||||
* US Government Users Restricted Rights - Use, duplication or
|
||||
* disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
|
||||
*/
|
||||
/*----------------------------------------------------------------------------
|
||||
$XConsortium: inittab.h /main/5 1996/11/25 18:48:42 drk $
|
||||
inittab.h: db_VISTA header file containing:
|
||||
|
||||
- Compatible dictionary file versions
|
||||
|
||||
This file is intended to be included in inittab.c only. There are
|
||||
multiple versions of inittab.c which share this header.
|
||||
|
||||
(An #include "vista.h" must precede this include)
|
||||
|
||||
(C) Copyright 1987 by Raima Corporation.
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/* ********************** EDIT HISTORY *******************************
|
||||
|
||||
SCR DATE INI DESCRIPTION
|
||||
----- --------- --- -----------------------------------------------------
|
||||
101 21-Jun-88 RSC Added decl for rn_type and rn_dba for ONE_DB
|
||||
08-Aug-88 RTK Moved rn_dba and rn_type to vista.h - needed in rec*.c
|
||||
18-Aug-88 RSC Moved rn_type/dba to separate table, add curr_rn_table..
|
||||
|
||||
$Log$
|
||||
* Revision 1.2 1995/10/13 18:36:46 miker
|
||||
* Changed compat_dbd[] from hardcoded str to dbd_VERSION.
|
||||
* (dbd_VERSION in vista.h changed bcs expanded max file name length.)
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
int db_status = 0;
|
||||
|
||||
/* database dictionary tables */
|
||||
INT largest_page = 0;
|
||||
|
||||
char FAR *crloc = NULL;
|
||||
|
||||
#ifndef ONE_DB
|
||||
INT old_size_ft = 0;
|
||||
INT old_size_fd = 0;
|
||||
INT old_size_st = 0;
|
||||
INT old_size_mt = 0;
|
||||
INT old_size_srt = 0;
|
||||
INT old_size_kt = 0;
|
||||
INT old_size_rt = 0;
|
||||
INT old_no_of_dbs = 0;
|
||||
#endif
|
||||
|
||||
/* Compatible dictionary versions */
|
||||
char *compat_dbd[] = {
|
||||
dbd_VERSION
|
||||
};
|
||||
int size_compat = sizeof(compat_dbd)/sizeof(*compat_dbd);
|
||||
/* vpp -nOS2 -dUNIX -nBSD -nVANILLA_BSD -nVMS -nMEMLOCK -nWINDOWS -nFAR_ALLOC -f/usr/users/master/config/nonwin inittab.h */
|
||||
56
cde/lib/DtSearch/raima/ismember.c
Normal file
56
cde/lib/DtSearch/raima/ismember.c
Normal file
@@ -0,0 +1,56 @@
|
||||
/* $XConsortium: ismember.c /main/2 1996/05/09 04:08:28 drk $ */
|
||||
/*
|
||||
* COMPONENT_NAME: austext
|
||||
*
|
||||
* FUNCTIONS: d_ismember
|
||||
*
|
||||
* ORIGINS: 157
|
||||
*
|
||||
* OBJECT CODE ONLY SOURCE MATERIALS
|
||||
*/
|
||||
/*-----------------------------------------------------------------------
|
||||
ismember.c -- db_VISTA membership test module.
|
||||
|
||||
(C) Copyright 1987 by Raima Corporation.
|
||||
-----------------------------------------------------------------------*/
|
||||
|
||||
/* ********************** EDIT HISTORY *******************************
|
||||
|
||||
SCR DATE INI DESCRIPTION
|
||||
----- --------- --- -----------------------------------------------------
|
||||
04-Aug-88 RTK MULTI_TASK changes
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include "vista.h"
|
||||
#include "dbtype.h"
|
||||
|
||||
|
||||
/* Check to see if current record is a connected member of SET
|
||||
*/
|
||||
d_ismember(set TASK_PARM DBN_PARM)
|
||||
int set; /* set table entry */
|
||||
TASK_DECL
|
||||
DBN_DECL /* database number */
|
||||
{
|
||||
char crmp[MEMPSIZE]; /* current record's member pointer */
|
||||
SET_ENTRY FAR *set_ptr;
|
||||
|
||||
DB_ENTER(DB_ID TASK_ID LOCK_SET(SET_IO));
|
||||
|
||||
if (nset_check(set, &set, (SET_ENTRY FAR * FAR *)&set_ptr) != S_OKAY)
|
||||
RETURN( db_status );
|
||||
|
||||
/* Make sure we have a current record */
|
||||
if ( ! curr_rec )
|
||||
RETURN( dberr(S_NOCR) );
|
||||
|
||||
/* Read current record and check connection */
|
||||
if ((dio_read( curr_rec, (char FAR * FAR *)&crloc , NOPGHOLD) == S_OKAY) &&
|
||||
(r_gmem(set, crloc, crmp) == S_OKAY) &&
|
||||
null_dba(crmp + MP_OWNER))
|
||||
db_status = S_EOS; /* end-of-set if curr rec not owned */
|
||||
|
||||
RETURN( db_status );
|
||||
}
|
||||
/* vpp -nOS2 -dUNIX -nBSD -nVANILLA_BSD -nVMS -nMEMLOCK -nWINDOWS -nFAR_ALLOC -f/usr/users/master/config/nonwin ismember.c */
|
||||
56
cde/lib/DtSearch/raima/isowner.c
Normal file
56
cde/lib/DtSearch/raima/isowner.c
Normal file
@@ -0,0 +1,56 @@
|
||||
/* $XConsortium: isowner.c /main/2 1996/05/09 04:08:42 drk $ */
|
||||
/*
|
||||
* COMPONENT_NAME: austext
|
||||
*
|
||||
* FUNCTIONS: d_isowner
|
||||
*
|
||||
* ORIGINS: 157
|
||||
*
|
||||
* OBJECT CODE ONLY SOURCE MATERIALS
|
||||
*/
|
||||
/*-----------------------------------------------------------------------
|
||||
isowner.c -- db_VISTA ownership test module.
|
||||
|
||||
(C) Copyright 1987 by Raima Corporation.
|
||||
-----------------------------------------------------------------------*/
|
||||
|
||||
/* ********************** EDIT HISTORY *******************************
|
||||
|
||||
SCR DATE INI DESCRIPTION
|
||||
----- --------- --- -----------------------------------------------------
|
||||
04-Aug-88 RTK MULTI_TASK changes
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include "vista.h"
|
||||
#include "dbtype.h"
|
||||
|
||||
|
||||
/* Check to see if current record is a owner of non-empty SET
|
||||
*/
|
||||
d_isowner(set TASK_PARM DBN_PARM)
|
||||
int set; /* set table entry */
|
||||
TASK_DECL
|
||||
DBN_DECL /* database number */
|
||||
{
|
||||
char crsp[SETPSIZE]; /* current record's set pointer */
|
||||
SET_ENTRY FAR *set_ptr;
|
||||
|
||||
DB_ENTER(DB_ID TASK_ID LOCK_SET(SET_IO));
|
||||
|
||||
if (nset_check(set, &set, (SET_ENTRY FAR * FAR *)&set_ptr) != S_OKAY)
|
||||
RETURN( db_status );
|
||||
|
||||
/* Make sure we have a current record */
|
||||
if ( ! curr_rec )
|
||||
RETURN( dberr(S_NOCR) );
|
||||
|
||||
/* Read current record and check for members */
|
||||
if ((dio_read( curr_rec, (char FAR * FAR *)&crloc, NOPGHOLD) == S_OKAY) &&
|
||||
(r_gset(set, crloc, crsp) == S_OKAY) &&
|
||||
null_dba(crsp + SP_FIRST))
|
||||
db_status = S_EOS; /* end-of-set if curr rec not owner */
|
||||
|
||||
RETURN( db_status );
|
||||
}
|
||||
/* vpp -nOS2 -dUNIX -nBSD -nVANILLA_BSD -nVMS -nMEMLOCK -nWINDOWS -nFAR_ALLOC -f/usr/users/master/config/nonwin isowner.c */
|
||||
90
cde/lib/DtSearch/raima/keydel.c
Normal file
90
cde/lib/DtSearch/raima/keydel.c
Normal file
@@ -0,0 +1,90 @@
|
||||
/* $XConsortium: keydel.c /main/2 1996/05/09 04:08:58 drk $ */
|
||||
/*
|
||||
* COMPONENT_NAME: austext
|
||||
*
|
||||
* FUNCTIONS: d_keydel
|
||||
*
|
||||
* ORIGINS: 157
|
||||
*
|
||||
* OBJECT CODE ONLY SOURCE MATERIALS
|
||||
*/
|
||||
/*-----------------------------------------------------------------------
|
||||
keydel.c -- db_VISTA key deletion module.
|
||||
|
||||
(C) Copyright 1987 by Raima Corporation.
|
||||
-----------------------------------------------------------------------*/
|
||||
|
||||
/* ********************** EDIT HISTORY *******************************
|
||||
|
||||
SCR DATE INI DESCRIPTION
|
||||
----- --------- --- -----------------------------------------------------
|
||||
158 15-JUN-88 RSC added flag to key_bldcom - always compliment compound keys
|
||||
04-Aug-88 RTK MULTI_TASK changes
|
||||
|
||||
*/
|
||||
#include <stdio.h>
|
||||
#include "vista.h"
|
||||
#include "dbtype.h"
|
||||
|
||||
#define FALSE 0
|
||||
#define TRUE 1
|
||||
|
||||
/* Delete optional key value
|
||||
*/
|
||||
d_keydel(field TASK_PARM DBN_PARM)
|
||||
long field; /* key field constant */
|
||||
TASK_DECL
|
||||
DBN_DECL /* database number */
|
||||
{
|
||||
int fld; /* field number */
|
||||
int rec, rn; /* record type of current record */
|
||||
char FAR *rptr; /* pointer to current record */
|
||||
CONST char FAR *fptr; /* pointer to field contents */
|
||||
char ckey[256]; /* compound key data */
|
||||
int stat;
|
||||
RECORD_ENTRY FAR *rec_ptr;
|
||||
FIELD_ENTRY FAR *fld_ptr;
|
||||
|
||||
DB_ENTER(DB_ID TASK_ID LOCK_SET(RECORD_IO));
|
||||
|
||||
if (nfld_check(field, &rec, &fld, (RECORD_ENTRY FAR * FAR *)&rec_ptr, (FIELD_ENTRY FAR * FAR *)&fld_ptr) != S_OKAY)
|
||||
RETURN( db_status );
|
||||
|
||||
/* ensure current record is valid for this field */
|
||||
d_crtype(&rn TASK_PARM DBN_PARM);
|
||||
|
||||
if (rec != NUM2INT(rn - RECMARK, rt_offset))
|
||||
RETURN( dberr(S_BADFIELD) );
|
||||
|
||||
/* ensure field is an optional key field */
|
||||
if ( ! (fld_ptr->fd_flags & OPTKEYMASK) )
|
||||
RETURN( dberr(S_NOTOPTKEY) );
|
||||
|
||||
/* read current record */
|
||||
if ( (stat = dio_read(curr_rec, (char FAR * FAR *)&rptr, PGHOLD)) == S_OKAY ) {
|
||||
/* Make sure that the key has been stored */
|
||||
if ( r_tstopt( fld_ptr, rptr ) == S_OKAY ) {
|
||||
if ( dio_release( curr_rec ) != S_OKAY )
|
||||
RETURN( db_status );
|
||||
RETURN( db_status = S_NOTFOUND );
|
||||
}
|
||||
if ( fld_ptr->fd_type == COMKEY ) {
|
||||
key_bldcom(fld, rptr + rec_ptr->rt_data, ckey, TRUE);
|
||||
fptr = ckey;
|
||||
}
|
||||
else
|
||||
fptr = rptr + fld_ptr->fd_ptr;
|
||||
|
||||
/* delete key from value in current record */
|
||||
stat = key_delete(fld, fptr, curr_rec);
|
||||
|
||||
/* Clear the optional key flag in the record */
|
||||
if ( stat == S_OKAY )
|
||||
stat = r_clropt( fld_ptr, rptr );
|
||||
|
||||
/* The data record has been updated */
|
||||
dio_write(curr_rec, rptr, PGFREE);
|
||||
}
|
||||
RETURN( db_status = stat );
|
||||
}
|
||||
/* vpp -nOS2 -dUNIX -nBSD -nVANILLA_BSD -nVMS -nMEMLOCK -nWINDOWS -nFAR_ALLOC -f/usr/users/master/config/nonwin keydel.c */
|
||||
64
cde/lib/DtSearch/raima/keyexist.c
Normal file
64
cde/lib/DtSearch/raima/keyexist.c
Normal file
@@ -0,0 +1,64 @@
|
||||
/* $XConsortium: keyexist.c /main/2 1996/05/09 04:09:12 drk $ */
|
||||
/*
|
||||
* COMPONENT_NAME: austext
|
||||
*
|
||||
* FUNCTIONS: d_keyexist
|
||||
*
|
||||
* ORIGINS: 157
|
||||
*
|
||||
* OBJECT CODE ONLY SOURCE MATERIALS
|
||||
*/
|
||||
|
||||
/* ********************** EDIT HISTORY *******************************
|
||||
|
||||
SCR DATE INI DESCRIPTION
|
||||
----- --------- --- -----------------------------------------------------
|
||||
04-Aug-88 RTK MULTI_TASK changes
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include "vista.h"
|
||||
#include "dbtype.h"
|
||||
|
||||
|
||||
/* Check for optional key existence
|
||||
*/
|
||||
d_keyexist(field TASK_PARM DBN_PARM)
|
||||
long field; /* key field constant */
|
||||
TASK_DECL
|
||||
DBN_DECL /* database number */
|
||||
{
|
||||
int fld; /* field number */
|
||||
int rec, rn; /* record type of current record */
|
||||
char FAR *rptr; /* pointer to current record */
|
||||
int stat;
|
||||
RECORD_ENTRY FAR *rec_ptr;
|
||||
FIELD_ENTRY FAR *fld_ptr;
|
||||
|
||||
DB_ENTER(DB_ID TASK_ID LOCK_SET(RECORD_IO));
|
||||
|
||||
if (nfld_check(field, &rec, &fld, (RECORD_ENTRY FAR * FAR *)&rec_ptr, (FIELD_ENTRY FAR * FAR *)&fld_ptr) != S_OKAY)
|
||||
RETURN( db_status );
|
||||
|
||||
/* ensure current record is valid for this field */
|
||||
d_crtype(&rn TASK_PARM DBN_PARM);
|
||||
|
||||
if (rec != NUM2INT(rn - RECMARK, rt_offset))
|
||||
RETURN( dberr(S_BADFIELD) );
|
||||
|
||||
/* ensure field is an optional key field */
|
||||
if ( ! (fld_ptr->fd_flags & OPTKEYMASK) )
|
||||
RETURN( dberr(S_NOTOPTKEY) );
|
||||
|
||||
/* read current record */
|
||||
if ( (stat = dio_read(curr_rec, (char FAR * FAR *)&rptr, NOPGHOLD)) == S_OKAY ) {
|
||||
/* Check the bit map and return S_OKAY if already stored,
|
||||
else S_NOTFOUND */
|
||||
if ((stat = r_tstopt(fld_ptr, rptr)) == S_OKAY)
|
||||
stat = S_NOTFOUND;
|
||||
else if (stat == S_DUPLICATE)
|
||||
stat = S_OKAY;
|
||||
}
|
||||
RETURN( db_status = stat );
|
||||
}
|
||||
/* vpp -nOS2 -dUNIX -nBSD -nVANILLA_BSD -nVMS -nMEMLOCK -nWINDOWS -nFAR_ALLOC -f/usr/users/master/config/nonwin keyexist.c */
|
||||
1268
cde/lib/DtSearch/raima/keyfcns.c
Normal file
1268
cde/lib/DtSearch/raima/keyfcns.c
Normal file
File diff suppressed because it is too large
Load Diff
134
cde/lib/DtSearch/raima/keyfind.c
Normal file
134
cde/lib/DtSearch/raima/keyfind.c
Normal file
@@ -0,0 +1,134 @@
|
||||
/* $XConsortium: keyfind.c /main/2 1996/05/09 04:09:43 drk $ */
|
||||
/*
|
||||
* COMPONENT_NAME: austext
|
||||
*
|
||||
* FUNCTIONS: Pi
|
||||
* chk_desc_key
|
||||
* d_keyfind
|
||||
*
|
||||
* ORIGINS: 157
|
||||
*
|
||||
* OBJECT CODE ONLY SOURCE MATERIALS
|
||||
*/
|
||||
/*-----------------------------------------------------------------------
|
||||
keyfind.c -- db_VISTA key find module.
|
||||
|
||||
(C) Copyright 1987 by Raima Corporation.
|
||||
-----------------------------------------------------------------------*/
|
||||
|
||||
/* ********************** EDIT HISTORY *******************************
|
||||
|
||||
SCR DATE INI DESCRIPTION
|
||||
----- --------- --- -----------------------------------------------------
|
||||
04-Aug-88 RTK MULTI_TASK changes
|
||||
310 10-Aug-88 RSC Cleanup function prototype.
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include "vista.h"
|
||||
#include "dbtype.h"
|
||||
|
||||
/* Internal function prototypes */
|
||||
static void chk_desc_key(P1(int) Pi(FIELD_ENTRY FAR *)
|
||||
Pi(CONST char FAR *) Pi(char FAR *));
|
||||
|
||||
/* Find record thru key field
|
||||
*/
|
||||
d_keyfind(field, fldval TASK_PARM DBN_PARM)
|
||||
long field; /* field constant */
|
||||
CONST char FAR *fldval; /* value of the data field */
|
||||
TASK_DECL
|
||||
DBN_DECL /* database number */
|
||||
{
|
||||
int fld, rec;
|
||||
DB_ADDR dba;
|
||||
RECORD_ENTRY FAR *rec_ptr;
|
||||
FIELD_ENTRY FAR *fld_ptr;
|
||||
char ckey[256];
|
||||
|
||||
DB_ENTER(DB_ID TASK_ID LOCK_SET(RECORD_IO));
|
||||
|
||||
if ((nfld_check(field, &rec, &fld, (RECORD_ENTRY FAR * FAR *)&rec_ptr, (FIELD_ENTRY FAR * FAR *)&fld_ptr) != S_OKAY) ||
|
||||
/* initialize key function operation */
|
||||
(key_init(fld) != S_OKAY))
|
||||
RETURN( db_status );
|
||||
|
||||
if ( fldval == NULL )
|
||||
key_boundary(KEYFIND, &dba);
|
||||
else {
|
||||
/* locate record with specified key */
|
||||
if (fld_ptr->fd_type == 'k') {
|
||||
chk_desc_key(fld, fld_ptr, fldval, ckey);
|
||||
fldval = ckey;
|
||||
}
|
||||
dba = NULL_DBA;
|
||||
if ( key_locpos( fldval, &dba ) != S_OKAY )
|
||||
RETURN( db_status );
|
||||
|
||||
/* set current record to found db addr */
|
||||
curr_rec = dba;
|
||||
}
|
||||
#ifndef NO_TIMESTAMP
|
||||
/* set timestamp */
|
||||
if ( curr_rec && db_tsrecs )
|
||||
d_utscr( &cr_time TASK_PARM );
|
||||
#endif
|
||||
RETURN( db_status = S_OKAY );
|
||||
}
|
||||
|
||||
|
||||
/* Check compound key value for descending fields
|
||||
*/
|
||||
static void chk_desc_key(fld, fld_ptr, fldval, ckey)
|
||||
int fld;
|
||||
FIELD_ENTRY FAR *fld_ptr;
|
||||
CONST char FAR *fldval;
|
||||
char FAR *ckey;
|
||||
{
|
||||
register int kt_lc; /* loop control */
|
||||
#ifndef NO_FLOAT
|
||||
float fv;
|
||||
double dv;
|
||||
#endif
|
||||
char FAR *fptr;
|
||||
char FAR *tptr;
|
||||
FIELD_ENTRY FAR *kfld_ptr;
|
||||
register KEY_ENTRY FAR *key_ptr;
|
||||
|
||||
/* complement descending compound key values */
|
||||
for (kt_lc = size_kt - fld_ptr->fd_ptr,
|
||||
key_ptr = &key_table[fld_ptr->fd_ptr];
|
||||
(--kt_lc >= 0) && (key_ptr->kt_key == fld); ++key_ptr) {
|
||||
kfld_ptr = &field_table[key_ptr->kt_field];
|
||||
fptr = (char FAR *)fldval + key_ptr->kt_ptr;
|
||||
tptr = ckey + key_ptr->kt_ptr;
|
||||
if ( key_ptr->kt_sort == 'd' ) {
|
||||
switch ( kfld_ptr->fd_type ) {
|
||||
#ifndef NO_FLOAT
|
||||
case FLOAT:
|
||||
bytecpy(&fv, fptr, sizeof(float));
|
||||
fv = (float)0.0 - fv;
|
||||
bytecpy(fptr, &fv, sizeof(float));
|
||||
break;
|
||||
case DOUBLE:
|
||||
bytecpy(&dv, fptr, sizeof(double));
|
||||
dv = 0.0 - dv;
|
||||
bytecpy(fptr, &dv, sizeof(double));
|
||||
break;
|
||||
#endif
|
||||
case CHARACTER:
|
||||
key_cmpcpy(tptr, fptr, kfld_ptr->fd_len);
|
||||
if ( kfld_ptr->fd_dim[0] > 1 && kfld_ptr->fd_dim[1] == 0 ) {
|
||||
/* make sure a null byte is at the end */
|
||||
tptr[kfld_ptr->fd_len-1] = '\0';
|
||||
}
|
||||
break;
|
||||
default:
|
||||
key_cmpcpy(tptr, fptr, kfld_ptr->fd_len);
|
||||
}
|
||||
}
|
||||
else
|
||||
bytecpy(tptr, fptr, kfld_ptr->fd_len);
|
||||
}
|
||||
}
|
||||
/* vpp -nOS2 -dUNIX -nBSD -nVANILLA_BSD -nVMS -nMEMLOCK -nWINDOWS -nFAR_ALLOC -f/usr/users/master/config/nonwin keyfind.c */
|
||||
58
cde/lib/DtSearch/raima/keyfrst.c
Normal file
58
cde/lib/DtSearch/raima/keyfrst.c
Normal file
@@ -0,0 +1,58 @@
|
||||
/* $XConsortium: keyfrst.c /main/2 1996/05/09 04:09:59 drk $ */
|
||||
/*
|
||||
* COMPONENT_NAME: austext
|
||||
*
|
||||
* FUNCTIONS: d_keyfrst
|
||||
*
|
||||
* ORIGINS: 157
|
||||
*
|
||||
* OBJECT CODE ONLY SOURCE MATERIALS
|
||||
*/
|
||||
/*-----------------------------------------------------------------------
|
||||
keyfrst.c -- db_VISTA first key find module.
|
||||
|
||||
(C) Copyright 1987 by Raima Corporation.
|
||||
-----------------------------------------------------------------------*/
|
||||
|
||||
/* ********************** EDIT HISTORY *******************************
|
||||
|
||||
SCR DATE INI DESCRIPTION
|
||||
----- --------- --- -----------------------------------------------------
|
||||
04-Aug-88 RTK MULTI_TASK changes
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include "vista.h"
|
||||
#include "dbtype.h"
|
||||
|
||||
|
||||
/* Find first key
|
||||
*/
|
||||
d_keyfrst(field TASK_PARM DBN_PARM)
|
||||
long field; /* field constant */
|
||||
TASK_DECL
|
||||
DBN_DECL /* database number */
|
||||
{
|
||||
int fld, rec;
|
||||
DB_ADDR dba;
|
||||
RECORD_ENTRY FAR *rec_ptr;
|
||||
FIELD_ENTRY FAR *fld_ptr;
|
||||
|
||||
DB_ENTER(DB_ID TASK_ID LOCK_SET(RECORD_IO));
|
||||
|
||||
if ((nfld_check(field, &rec, &fld, (RECORD_ENTRY FAR * FAR *)&rec_ptr, (FIELD_ENTRY FAR * FAR *)&fld_ptr) != S_OKAY) ||
|
||||
/* initialize key function operation */
|
||||
(key_init(fld) != S_OKAY))
|
||||
RETURN( db_status );
|
||||
|
||||
if ( key_boundary(KEYFRST, &dba) == S_OKAY ) {
|
||||
curr_rec = dba;
|
||||
#ifndef NO_TIMESTAMP
|
||||
/* set timestamp */
|
||||
if ( db_tsrecs )
|
||||
d_utscr( &cr_time TASK_PARM );
|
||||
#endif
|
||||
}
|
||||
RETURN( db_status );
|
||||
}
|
||||
/* vpp -nOS2 -dUNIX -nBSD -nVANILLA_BSD -nVMS -nMEMLOCK -nWINDOWS -nFAR_ALLOC -f/usr/users/master/config/nonwin keyfrst.c */
|
||||
58
cde/lib/DtSearch/raima/keylast.c
Normal file
58
cde/lib/DtSearch/raima/keylast.c
Normal file
@@ -0,0 +1,58 @@
|
||||
/* $XConsortium: keylast.c /main/2 1996/05/09 04:10:12 drk $ */
|
||||
/*
|
||||
* COMPONENT_NAME: austext
|
||||
*
|
||||
* FUNCTIONS: d_keylast
|
||||
*
|
||||
* ORIGINS: 157
|
||||
*
|
||||
* OBJECT CODE ONLY SOURCE MATERIALS
|
||||
*/
|
||||
/*-----------------------------------------------------------------------
|
||||
keylast.c -- db_VISTA last key find module.
|
||||
|
||||
(C) Copyright 1987 by Raima Corporation.
|
||||
-----------------------------------------------------------------------*/
|
||||
|
||||
/* ********************** EDIT HISTORY *******************************
|
||||
|
||||
SCR DATE INI DESCRIPTION
|
||||
----- --------- --- -----------------------------------------------------
|
||||
04-Aug-88 RTK MULTI_TASK changes
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include "vista.h"
|
||||
#include "dbtype.h"
|
||||
|
||||
|
||||
/* Find last key
|
||||
*/
|
||||
d_keylast(field TASK_PARM DBN_PARM)
|
||||
long field; /* field constant */
|
||||
TASK_DECL
|
||||
DBN_DECL /* database number */
|
||||
{
|
||||
int fld, rec;
|
||||
DB_ADDR dba;
|
||||
RECORD_ENTRY FAR *rec_ptr;
|
||||
FIELD_ENTRY FAR *fld_ptr;
|
||||
|
||||
DB_ENTER(DB_ID TASK_ID LOCK_SET(RECORD_IO));
|
||||
|
||||
if ((nfld_check(field, &rec, &fld, (RECORD_ENTRY FAR * FAR *)&rec_ptr, (FIELD_ENTRY FAR * FAR *)&fld_ptr) != S_OKAY) ||
|
||||
/* initialize key function operation */
|
||||
(key_init(fld) != S_OKAY))
|
||||
RETURN( db_status );
|
||||
|
||||
if ( key_boundary(KEYLAST, &dba) == S_OKAY ) {
|
||||
curr_rec = dba;
|
||||
#ifndef NO_TIMESTAMP
|
||||
/* set timestamp */
|
||||
if ( db_tsrecs )
|
||||
d_utscr( &cr_time TASK_PARM );
|
||||
#endif
|
||||
}
|
||||
RETURN( db_status );
|
||||
}
|
||||
/* vpp -nOS2 -dUNIX -nBSD -nVANILLA_BSD -nVMS -nMEMLOCK -nWINDOWS -nFAR_ALLOC -f/usr/users/master/config/nonwin keylast.c */
|
||||
59
cde/lib/DtSearch/raima/keynext.c
Normal file
59
cde/lib/DtSearch/raima/keynext.c
Normal file
@@ -0,0 +1,59 @@
|
||||
/* $XConsortium: keynext.c /main/2 1996/05/09 04:10:29 drk $ */
|
||||
/*
|
||||
* COMPONENT_NAME: austext
|
||||
*
|
||||
* FUNCTIONS: d_keynext
|
||||
*
|
||||
* ORIGINS: 157
|
||||
*
|
||||
* OBJECT CODE ONLY SOURCE MATERIALS
|
||||
*/
|
||||
/*-----------------------------------------------------------------------
|
||||
keynext.c -- db_VISTA next key find module.
|
||||
|
||||
(C) Copyright 1987 by Raima Corporation.
|
||||
-----------------------------------------------------------------------*/
|
||||
|
||||
/* ********************** EDIT HISTORY *******************************
|
||||
|
||||
SCR DATE INI DESCRIPTION
|
||||
----- --------- --- -----------------------------------------------------
|
||||
04-Aug-88 RTK MULTI_TASK changes
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include "vista.h"
|
||||
#include "dbtype.h"
|
||||
|
||||
|
||||
|
||||
/* Find next record thru key field
|
||||
*/
|
||||
d_keynext(field TASK_PARM DBN_PARM)
|
||||
long field; /* field constant */
|
||||
TASK_DECL
|
||||
DBN_DECL /* database number */
|
||||
{
|
||||
int fld, rec;
|
||||
DB_ADDR dba;
|
||||
RECORD_ENTRY FAR *rec_ptr;
|
||||
FIELD_ENTRY FAR *fld_ptr;
|
||||
|
||||
DB_ENTER(DB_ID TASK_ID LOCK_SET(RECORD_IO));
|
||||
|
||||
if ((nfld_check(field, &rec, &fld, (RECORD_ENTRY FAR * FAR *)&rec_ptr, (FIELD_ENTRY FAR * FAR *)&fld_ptr) != S_OKAY) ||
|
||||
/* initialize key function operation */
|
||||
(key_init(fld) != S_OKAY))
|
||||
RETURN( db_status );
|
||||
|
||||
if ( key_scan(KEYNEXT, &dba) == S_OKAY ) {
|
||||
curr_rec = dba;
|
||||
#ifndef NO_TIMESTAMP
|
||||
/* set timestamp */
|
||||
if ( db_tsrecs )
|
||||
d_utscr( &cr_time TASK_PARM );
|
||||
#endif
|
||||
}
|
||||
RETURN( db_status );
|
||||
}
|
||||
/* vpp -nOS2 -dUNIX -nBSD -nVANILLA_BSD -nVMS -nMEMLOCK -nWINDOWS -nFAR_ALLOC -f/usr/users/master/config/nonwin keynext.c */
|
||||
59
cde/lib/DtSearch/raima/keyprev.c
Normal file
59
cde/lib/DtSearch/raima/keyprev.c
Normal file
@@ -0,0 +1,59 @@
|
||||
/* $XConsortium: keyprev.c /main/2 1996/05/09 04:10:45 drk $ */
|
||||
/*
|
||||
* COMPONENT_NAME: austext
|
||||
*
|
||||
* FUNCTIONS: d_keyprev
|
||||
*
|
||||
* ORIGINS: 157
|
||||
*
|
||||
* OBJECT CODE ONLY SOURCE MATERIALS
|
||||
*/
|
||||
/*-----------------------------------------------------------------------
|
||||
keyprev.c -- db_VISTA previous key find module.
|
||||
|
||||
(C) Copyright 1987 by Raima Corporation.
|
||||
-----------------------------------------------------------------------*/
|
||||
|
||||
/* ********************** EDIT HISTORY *******************************
|
||||
|
||||
SCR DATE INI DESCRIPTION
|
||||
----- --------- --- -----------------------------------------------------
|
||||
04-Aug-88 RTK MULTI_TASK changes
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include "vista.h"
|
||||
#include "dbtype.h"
|
||||
|
||||
|
||||
|
||||
/* Find previous record thru key field
|
||||
*/
|
||||
d_keyprev(field TASK_PARM DBN_PARM)
|
||||
long field; /* field constant */
|
||||
TASK_DECL
|
||||
DBN_DECL /* database number */
|
||||
{
|
||||
int fld, rec;
|
||||
DB_ADDR dba;
|
||||
RECORD_ENTRY FAR *rec_ptr;
|
||||
FIELD_ENTRY FAR *fld_ptr;
|
||||
|
||||
DB_ENTER(DB_ID TASK_ID LOCK_SET(RECORD_IO));
|
||||
|
||||
if ((nfld_check(field, &rec, &fld, (RECORD_ENTRY FAR * FAR *)&rec_ptr, (FIELD_ENTRY FAR * FAR *)&fld_ptr) != S_OKAY) ||
|
||||
/* initialize key function operation */
|
||||
(key_init(fld) != S_OKAY))
|
||||
RETURN( db_status );
|
||||
|
||||
if ( key_scan(KEYPREV, &dba) == S_OKAY ) {
|
||||
curr_rec = dba;
|
||||
#ifndef NO_TIMESTAMP
|
||||
/* set timestamp */
|
||||
if ( db_tsrecs )
|
||||
d_utscr( &cr_time TASK_PARM );
|
||||
#endif
|
||||
}
|
||||
RETURN( db_status );
|
||||
}
|
||||
/* vpp -nOS2 -dUNIX -nBSD -nVANILLA_BSD -nVMS -nMEMLOCK -nWINDOWS -nFAR_ALLOC -f/usr/users/master/config/nonwin keyprev.c */
|
||||
94
cde/lib/DtSearch/raima/keystore.c
Normal file
94
cde/lib/DtSearch/raima/keystore.c
Normal file
@@ -0,0 +1,94 @@
|
||||
/* $XConsortium: keystore.c /main/2 1996/05/09 04:10:59 drk $ */
|
||||
/*
|
||||
* COMPONENT_NAME: austext
|
||||
*
|
||||
* FUNCTIONS: d_keystore
|
||||
*
|
||||
* ORIGINS: 157
|
||||
*
|
||||
* OBJECT CODE ONLY SOURCE MATERIALS
|
||||
*/
|
||||
/*-----------------------------------------------------------------------
|
||||
keystore.c -- db_VISTA optional key store module.
|
||||
|
||||
(C) Copyright 1987 by Raima Corporation.
|
||||
-----------------------------------------------------------------------*/
|
||||
|
||||
/* ********************** EDIT HISTORY *******************************
|
||||
|
||||
SCR DATE INI DESCRIPTION
|
||||
----- --------- --- -----------------------------------------------------
|
||||
158 15-JUN-88 RSC passed new flag to key_bldcom - always compliment compound
|
||||
04-Aug-88 RTK MULTI_TASK changes
|
||||
*/
|
||||
#include <stdio.h>
|
||||
#include "vista.h"
|
||||
#include "dbtype.h"
|
||||
|
||||
#define FALSE 0
|
||||
#define TRUE 1
|
||||
|
||||
/* Store optional key value
|
||||
*/
|
||||
d_keystore(field TASK_PARM DBN_PARM)
|
||||
long field; /* key field constant */
|
||||
TASK_DECL
|
||||
DBN_DECL /* database number */
|
||||
{
|
||||
int fld; /* field number */
|
||||
int rec, rn; /* record type of current record */
|
||||
char FAR *rptr; /* pointer to current record */
|
||||
char FAR *fptr; /* pointer to field contents */
|
||||
char ckey[256]; /* compound key */
|
||||
int stat;
|
||||
RECORD_ENTRY FAR *rec_ptr;
|
||||
FIELD_ENTRY FAR *fld_ptr;
|
||||
|
||||
DB_ENTER(DB_ID TASK_ID LOCK_SET(RECORD_IO));
|
||||
|
||||
if (nfld_check(field, &rec, &fld, (RECORD_ENTRY FAR * FAR *)&rec_ptr, (FIELD_ENTRY FAR * FAR *)&fld_ptr) != S_OKAY)
|
||||
RETURN( db_status );
|
||||
|
||||
/* Make sure we have a current record */
|
||||
if ( ! curr_rec )
|
||||
RETURN( dberr(S_NOCR) );
|
||||
|
||||
/* ensure current record is valid for this field */
|
||||
d_crtype(&rn TASK_PARM DBN_PARM);
|
||||
|
||||
if (rec != NUM2INT(rn - RECMARK, rt_offset))
|
||||
RETURN( dberr(S_BADFIELD) );
|
||||
|
||||
/* ensure field is an optional key field */
|
||||
if ( ! (fld_ptr->fd_flags & OPTKEYMASK) )
|
||||
RETURN( dberr(S_NOTOPTKEY) );
|
||||
|
||||
/* read current record */
|
||||
if ( (stat = dio_read(curr_rec, (char FAR * FAR *)&rptr, PGHOLD)) == S_OKAY ) {
|
||||
/* Make sure that the key has not already been stored */
|
||||
if ( (stat = r_tstopt( fld_ptr, rptr )) != S_OKAY ) {
|
||||
if ( dio_release( curr_rec ) != S_OKAY )
|
||||
RETURN( db_status );
|
||||
RETURN( db_status = S_OKAY );
|
||||
}
|
||||
|
||||
if ( fld_ptr->fd_type == COMKEY ) {
|
||||
key_bldcom(fld, rptr + rec_ptr->rt_data, ckey, TRUE);
|
||||
fptr = ckey;
|
||||
}
|
||||
else
|
||||
fptr = rptr + fld_ptr->fd_ptr;
|
||||
|
||||
/* store key from value in current record */
|
||||
stat = key_insert(fld, fptr, curr_rec);
|
||||
|
||||
/* Set the optional key bit */
|
||||
if ( stat == S_OKAY )
|
||||
stat = r_setopt( fld_ptr, rptr );
|
||||
|
||||
/* The data record has been modified */
|
||||
dio_write(curr_rec, rptr, PGFREE);
|
||||
}
|
||||
RETURN( db_status = stat );
|
||||
}
|
||||
/* vpp -nOS2 -dUNIX -nBSD -nVANILLA_BSD -nVMS -nMEMLOCK -nWINDOWS -nFAR_ALLOC -f/usr/users/master/config/nonwin keystore.c */
|
||||
443
cde/lib/DtSearch/raima/libfcns.c
Normal file
443
cde/lib/DtSearch/raima/libfcns.c
Normal file
@@ -0,0 +1,443 @@
|
||||
/* $XConsortium: libfcns.c /main/2 1996/05/09 04:11:16 drk $ */
|
||||
/*
|
||||
* COMPONENT_NAME: austext
|
||||
*
|
||||
* FUNCTIONS: ADDRcmp
|
||||
* INTcmp
|
||||
* Pi
|
||||
* check_dba
|
||||
* ctblcmp
|
||||
* dbn_check
|
||||
* fldcmp
|
||||
* nfld_check
|
||||
* nrec_check
|
||||
* nset_check
|
||||
* null_dba
|
||||
* rec_okay
|
||||
*
|
||||
* ORIGINS: 157
|
||||
*
|
||||
* OBJECT CODE ONLY SOURCE MATERIALS
|
||||
*/
|
||||
/*****************************************************************************
|
||||
Miscellaneous db_VISTA library functions
|
||||
*****************************************************************************/
|
||||
|
||||
/* ********************** EDIT HISTORY *******************************
|
||||
|
||||
SCR DATE INI DESCRIPTION
|
||||
----- --------- --- -----------------------------------------------------
|
||||
255 30-Jun-88 RSC check_dba: don't assume page 0 read
|
||||
115 19-Jul-88 RSC Integrate VAX/VMS changes
|
||||
04-Aug-88 RTK MULTI_TASK changes
|
||||
310 10-Aug-88 RSC Cleanup function prototype.
|
||||
18-Aug-88 RSC Moved rn_type/dba to separate table
|
||||
424 21-Sep-88 RSC Integrate international character set (ESM)
|
||||
420 06-Dec-88 WLW Updated Curr_db_table when using setdb.
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include "vista.h"
|
||||
#include "dbtype.h"
|
||||
|
||||
/* Internal function prototypes */
|
||||
static int rec_okay(P1(int) Pi(int *)
|
||||
Pi(RECORD_ENTRY FAR * FAR *));
|
||||
static int ctblcmp(P1(CONST unsigned char FAR*)
|
||||
Pi(CONST unsigned char FAR*) Pi(int));
|
||||
|
||||
#ifndef ONE_DB
|
||||
/* Check for valid db number and set curr_db, curr_db_table and curr_rn_table
|
||||
*/
|
||||
dbn_check(dbn)
|
||||
int dbn;
|
||||
{
|
||||
if ( ! dbopen )
|
||||
return( dberr(S_DBOPEN) );
|
||||
|
||||
if ( no_of_dbs > 1 && ! setdb_on ) {
|
||||
if ( dbn < 0 || dbn >= no_of_dbs )
|
||||
return( dberr(S_INVDB) );
|
||||
db_table[curr_db].curr_dbt_rec = curr_rec;
|
||||
curr_db_table = &db_table[curr_db = dbn];
|
||||
curr_rn_table = &rn_table[curr_db]; /* point to new rn_table */
|
||||
curr_rec = curr_db_table->curr_dbt_rec;
|
||||
}
|
||||
return( db_status = S_OKAY );
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
/* Check for valid (external) set number and return (internal) set number
|
||||
and set_table pointer.
|
||||
*/
|
||||
nset_check(nset, set, set_ptr )
|
||||
register int nset;
|
||||
int *set;
|
||||
SET_ENTRY FAR * FAR *set_ptr;
|
||||
{
|
||||
nset -= SETMARK;
|
||||
if ((nset < 0) || (nset >= TABLE_SIZE(Size_st)))
|
||||
return( dberr(S_INVSET) );
|
||||
|
||||
*set_ptr = &set_table[*set = NUM2INT(nset, st_offset)];
|
||||
return( db_status = S_OKAY );
|
||||
}
|
||||
|
||||
|
||||
/* Check for valid (external) field number and return (internal) record
|
||||
and field numbers and pointers.
|
||||
*/
|
||||
nfld_check(nfld, rec, fld, rec_ptr, fld_ptr )
|
||||
long nfld;
|
||||
int *rec;
|
||||
int *fld;
|
||||
RECORD_ENTRY FAR * FAR *rec_ptr;
|
||||
FIELD_ENTRY FAR * FAR *fld_ptr;
|
||||
{
|
||||
int trec;
|
||||
int tfld;
|
||||
|
||||
if (!rec_okay(trec = (int)(nfld/FLDMARK), rec, (RECORD_ENTRY FAR * FAR *)rec_ptr) ||
|
||||
((tfld = (int)(nfld - trec*FLDMARK)) < 0) ||
|
||||
(tfld >= TABLE_SIZE(Size_fd)))
|
||||
return( dberr(S_INVFLD) );
|
||||
|
||||
*fld_ptr = &field_table[*fld = tfld + (*rec_ptr)->rt_fields];
|
||||
return( db_status = S_OKAY );
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* Check for valid (external) record number and return (internal) record
|
||||
number and pointer.
|
||||
*/
|
||||
nrec_check(nrec, rec, rec_ptr)
|
||||
int nrec;
|
||||
int *rec;
|
||||
RECORD_ENTRY FAR * FAR *rec_ptr;
|
||||
{
|
||||
if (rec_okay(nrec - RECMARK, rec, (RECORD_ENTRY FAR * FAR *)rec_ptr))
|
||||
db_status = S_OKAY;
|
||||
else
|
||||
dberr(S_INVREC);
|
||||
return( db_status );
|
||||
}
|
||||
|
||||
|
||||
/* Internal record number check
|
||||
*/
|
||||
static int rec_okay(nrec, rec, rec_ptr)
|
||||
register int nrec;
|
||||
int *rec;
|
||||
RECORD_ENTRY FAR * FAR *rec_ptr;
|
||||
{
|
||||
if ((nrec < 0) || (nrec >= TABLE_SIZE(Size_rt)))
|
||||
return (FALSE);
|
||||
|
||||
*rec_ptr = &record_table[*rec = NUM2INT(nrec, rt_offset)];
|
||||
return (TRUE);
|
||||
}
|
||||
|
||||
|
||||
/* Compare values of two db_VISTA data fields
|
||||
*/
|
||||
int fldcmp(fld_ptr, f1, f2)
|
||||
FIELD_ENTRY FAR *fld_ptr;
|
||||
CONST char FAR *f1; /* pointer to field 1 */
|
||||
CONST char FAR *f2; /* pointer to field 2 */
|
||||
/*
|
||||
returns < 0 if f1 < f2,
|
||||
= 0 if f1 == f2,
|
||||
> 0 if f1 > f2
|
||||
*/
|
||||
{
|
||||
register int kt_lc; /* loop control */
|
||||
int i, k, elt, result, len, cur_len, sub_len, entries;
|
||||
#ifdef DS
|
||||
int ui1, ui2;
|
||||
long ul1, ul2;
|
||||
short us1, us2;
|
||||
#else
|
||||
unsigned int ui1, ui2;
|
||||
unsigned long ul1, ul2;
|
||||
unsigned short us1, us2;
|
||||
#endif
|
||||
int i1, i2;
|
||||
long l1, l2;
|
||||
short s1, s2;
|
||||
#ifndef NO_FLOAT
|
||||
float F1, F2;
|
||||
double d1, d2;
|
||||
#endif
|
||||
FIELD_ENTRY FAR *fld_max;
|
||||
FIELD_ENTRY FAR *sfld_ptr;
|
||||
KEY_ENTRY FAR *key_ptr;
|
||||
INT FAR *dim_ptr;
|
||||
|
||||
len = fld_ptr->fd_len;
|
||||
|
||||
/* compute number of array elements */
|
||||
entries = 1;
|
||||
for (i = 0, dim_ptr = fld_ptr->fd_dim;
|
||||
(i < MAXDIMS) && *dim_ptr;
|
||||
++i, ++dim_ptr)
|
||||
entries *= *dim_ptr;
|
||||
|
||||
switch ( fld_ptr->fd_type ) {
|
||||
case CHARACTER:
|
||||
if ( fld_ptr->fd_dim[1] )
|
||||
return ( bytecmp(f1, f2, len) );
|
||||
else if ( fld_ptr->fd_dim[0] )
|
||||
{
|
||||
#ifdef NO_COUNTRY
|
||||
return ( strncmp(f1, f2, len) );
|
||||
#else
|
||||
if ( db_global.ctbl_activ ) return ( ctblcmp(f1, f2, len) );
|
||||
else return ( strncmp(f1, f2, len) );
|
||||
#endif
|
||||
}
|
||||
else
|
||||
return ( (int)(*f1) - (int)(*f2) );
|
||||
case REGINT:
|
||||
for ( result = elt = 0; result == 0 && elt < entries; ++elt ) {
|
||||
if ( fld_ptr->fd_flags & UNSIGNEDFLD ) {
|
||||
bytecpy(&ui1, f1+(elt*sizeof(int)), sizeof(int));
|
||||
bytecpy(&ui2, f2+(elt*sizeof(int)), sizeof(int));
|
||||
if ( ui1 < ui2 ) result = -1;
|
||||
else if ( ui1 > ui2 ) result = 1;
|
||||
}
|
||||
else {
|
||||
bytecpy(&i1, f1+(elt*sizeof(int)), sizeof(int));
|
||||
bytecpy(&i2, f2+(elt*sizeof(int)), sizeof(int));
|
||||
if ( i1 < i2 ) result = -1;
|
||||
else if ( i1 > i2 ) result = 1;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case LONGINT:
|
||||
for ( result = elt = 0; result == 0 && elt < entries; ++elt ) {
|
||||
if ( fld_ptr->fd_flags & UNSIGNEDFLD ) {
|
||||
bytecpy(&ul1, f1+(elt*sizeof(long)), sizeof(long));
|
||||
bytecpy(&ul2, f2+(elt*sizeof(long)), sizeof(long));
|
||||
if ( ul1 < ul2 ) result = -1;
|
||||
else if ( ul1 > ul2 ) result = 1;
|
||||
}
|
||||
else {
|
||||
bytecpy(&l1, f1+(elt*sizeof(long)), sizeof(long));
|
||||
bytecpy(&l2, f2+(elt*sizeof(long)), sizeof(long));
|
||||
if ( l1 < l2 ) result = -1;
|
||||
else if ( l1 > l2 ) result = 1;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case SHORTINT:
|
||||
for ( result = elt = 0; result == 0 && elt < entries; ++elt ) {
|
||||
if ( fld_ptr->fd_flags & UNSIGNEDFLD ) {
|
||||
bytecpy(&us1, f1+(elt*sizeof(short)), sizeof(short));
|
||||
bytecpy(&us2, f2+(elt*sizeof(short)), sizeof(short));
|
||||
if ( us1 < us2 ) result = -1;
|
||||
else if ( us1 > us2 ) result = 1;
|
||||
}
|
||||
else {
|
||||
bytecpy(&s1, f1+(elt*sizeof(short)), sizeof(short));
|
||||
bytecpy(&s2, f2+(elt*sizeof(short)), sizeof(short));
|
||||
if ( s1 < s2 ) result = -1;
|
||||
else if ( s1 > s2 ) result = 1;
|
||||
}
|
||||
}
|
||||
break;
|
||||
#ifndef NO_FLOAT
|
||||
case FLOAT:
|
||||
for ( result = elt = 0; result == 0 && elt < entries; ++elt ) {
|
||||
bytecpy(&F1, f1+(elt*sizeof(float)), sizeof(float));
|
||||
bytecpy(&F2, f2+(elt*sizeof(float)), sizeof(float));
|
||||
if ( F1 < F2 ) result = -1;
|
||||
else if ( F1 > F2 ) result = 1;
|
||||
}
|
||||
break;
|
||||
case DOUBLE:
|
||||
for ( result = elt = 0; result == 0 && elt < entries; ++elt ) {
|
||||
bytecpy(&d1, f1+(elt*sizeof(double)), sizeof(double));
|
||||
bytecpy(&d2, f2+(elt*sizeof(double)), sizeof(double));
|
||||
if ( d1 < d2 ) result = -1;
|
||||
else if ( d1 > d2 ) result = 1;
|
||||
}
|
||||
break;
|
||||
#endif
|
||||
case DBADDR:
|
||||
for ( result = elt = 0; result == 0 && elt < entries; ++elt ) {
|
||||
result = ADDRcmp((DB_ADDR FAR *)(f1+(elt*sizeof(DB_ADDR))),
|
||||
(DB_ADDR FAR *)(f2+(elt*sizeof(DB_ADDR))));
|
||||
}
|
||||
break;
|
||||
case GROUPED:
|
||||
len /= entries; /* length of each entry */
|
||||
fld_max = &field_table[size_fd];
|
||||
for (i = 0, cur_len = 0; i < entries; ++i, cur_len += len) {
|
||||
for (sfld_ptr = fld_ptr + 1;
|
||||
(sfld_ptr < fld_max) && (sfld_ptr->fd_flags & STRUCTFLD);
|
||||
++sfld_ptr) {
|
||||
sub_len = cur_len + sfld_ptr->fd_ptr - fld_ptr->fd_ptr;
|
||||
if (k = fldcmp(sfld_ptr, f1 + sub_len, f2 + sub_len))
|
||||
return ( k );
|
||||
}
|
||||
}
|
||||
return ( 0 );
|
||||
case COMKEY:
|
||||
for (kt_lc = size_kt - fld_ptr->fd_ptr,
|
||||
key_ptr = &key_table[fld_ptr->fd_ptr];
|
||||
(--kt_lc >= 0) && (&field_table[key_ptr->kt_key] == fld_ptr);
|
||||
++key_ptr) {
|
||||
i = key_ptr->kt_ptr;
|
||||
if ( k = fldcmp(&field_table[key_ptr->kt_field], f1 + i, f2 + i) )
|
||||
return ( k );
|
||||
}
|
||||
return ( 0 );
|
||||
}
|
||||
return( result );
|
||||
}
|
||||
|
||||
|
||||
/* compare the INT variables
|
||||
*/
|
||||
int INTcmp( i1, i2 )
|
||||
CONST char FAR *i1, FAR *i2;
|
||||
{
|
||||
INT I1, I2;
|
||||
|
||||
bytecpy( &I1, i1, sizeof(INT) );
|
||||
bytecpy( &I2, i2, sizeof(INT) );
|
||||
return( (int)( I1-I2 ) );
|
||||
}
|
||||
|
||||
|
||||
/* compare two DB_ADDR variables
|
||||
*/
|
||||
int ADDRcmp( d1, d2 )
|
||||
CONST DB_ADDR FAR *d1, FAR *d2;
|
||||
{
|
||||
DB_ADDR a1, a2;
|
||||
FILE_NO f1, f2;
|
||||
F_ADDR r1, r2;
|
||||
|
||||
bytecpy(&a1, d1, DB_ADDR_SIZE);
|
||||
bytecpy(&a2, d2, DB_ADDR_SIZE);
|
||||
|
||||
f1 = (FILE_NO)(FILEMASK & (a1 >> FILESHIFT));
|
||||
f2 = (FILE_NO)(FILEMASK & (a2 >> FILESHIFT));
|
||||
r1 = ADDRMASK & a1;
|
||||
r2 = ADDRMASK & a2;
|
||||
|
||||
if ( f1 == f2 ) {
|
||||
if ( r1 < r2 ) return( -1 );
|
||||
if ( r1 > r2 ) return( 1 );
|
||||
return( 0 );
|
||||
}
|
||||
else
|
||||
return(f1 - f2);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/* check for empty DB_ADDR
|
||||
*/
|
||||
null_dba( db_addr )
|
||||
CONST char FAR *db_addr;
|
||||
{
|
||||
DB_ADDR dba;
|
||||
|
||||
bytecpy( &dba, db_addr, DB_ADDR_SIZE );
|
||||
return( dba == NULL_DBA );
|
||||
}
|
||||
|
||||
|
||||
/* check for valid DB_ADDR
|
||||
*/
|
||||
check_dba( dba )
|
||||
DB_ADDR dba;
|
||||
{
|
||||
FILE_NO fno;
|
||||
F_ADDR rno, last;
|
||||
|
||||
fno = (FILE_NO)(FILEMASK & (dba >> FILESHIFT));
|
||||
rno = ADDRMASK & dba;
|
||||
|
||||
/* Make sure page 0 has been read */
|
||||
if ( (last = dio_pznext(NUM2INT(fno, ft_offset))) <= 0 )
|
||||
return( db_status );
|
||||
|
||||
if (((fno < 0) || (fno >= TABLE_SIZE(Size_ft))) ||
|
||||
((rno <= 0L) || (rno >= last)))
|
||||
dberr(S_INVADDR);
|
||||
else
|
||||
db_status = S_OKAY;
|
||||
|
||||
return( db_status );
|
||||
}
|
||||
|
||||
#ifndef NO_COUNTRY
|
||||
/* Compare two strings with sorting according to char-table
|
||||
*/
|
||||
static int ctblcmp(s, t, n)
|
||||
CONST unsigned char FAR *s; /* String 1 */
|
||||
CONST unsigned char FAR *t; /* String 2 */
|
||||
int n; /* Max. String length */
|
||||
{
|
||||
int x;
|
||||
unsigned char f1, f2, x1, x2;
|
||||
|
||||
/* Always return immediately if first difference found */
|
||||
for (; (n && *s && *t); n--) {
|
||||
if ( db_global.country_tbl.ptr[*s].sort_as1 )
|
||||
f1 = db_global.country_tbl.ptr[*s].sort_as1;
|
||||
else f1 = *s;
|
||||
if ( db_global.country_tbl.ptr[*t].sort_as1 )
|
||||
f2 = db_global.country_tbl.ptr[*t].sort_as1;
|
||||
else f2 = *t;
|
||||
|
||||
if (x = f1 - f2) return(x);
|
||||
|
||||
/* Check sort_as2-values if sort_as1-values are equal */
|
||||
/*----------------------------------------------------*/
|
||||
x1 = db_global.country_tbl.ptr[*s].sort_as2;
|
||||
x2 = db_global.country_tbl.ptr[*t].sort_as2;
|
||||
if ( x1 && x2 ) { /* We have an entry for char. of both strings */
|
||||
if ( x = x1 - x2 ) return(x);
|
||||
}
|
||||
else {
|
||||
if ( x1 || x2 ) { /* Only sort_as2 value for one string */
|
||||
if ( x1 ) {
|
||||
*t++; /* Compare with next character in string 2 */
|
||||
if ( db_global.country_tbl.ptr[*t].sort_as1 )
|
||||
f2 = db_global.country_tbl.ptr[*t].sort_as1;
|
||||
else f2 = *t;
|
||||
if ( x = x1 - f2 ) return(x);
|
||||
}
|
||||
if ( x2 ) {
|
||||
*s++; /* Compare with next character in string 1 */
|
||||
if ( db_global.country_tbl.ptr[*s].sort_as1 )
|
||||
f1 = db_global.country_tbl.ptr[*s].sort_as1;
|
||||
else f1 = *s;
|
||||
if ( x = f1 - x2 ) return(x);
|
||||
}
|
||||
}
|
||||
|
||||
/* if both are equal compare sub_sort values */
|
||||
/*-------------------------------------------*/
|
||||
if (x = db_global.country_tbl.ptr[*s].sub_sort -
|
||||
db_global.country_tbl.ptr[*t].sub_sort)
|
||||
return(x);
|
||||
}
|
||||
*s++;
|
||||
*t++;
|
||||
}
|
||||
if (n) {
|
||||
if (*s) return(1);
|
||||
if (*t) return(-1);
|
||||
}
|
||||
return(0);
|
||||
}
|
||||
#endif
|
||||
/* vpp -nOS2 -dUNIX -nBSD -nVANILLA_BSD -nVMS -nMEMLOCK -nWINDOWS -nFAR_ALLOC -f/usr/users/master/config/nonwin libfcns.c */
|
||||
44
cde/lib/DtSearch/raima/ll.h
Normal file
44
cde/lib/DtSearch/raima/ll.h
Normal file
@@ -0,0 +1,44 @@
|
||||
/* $XConsortium: ll.h /main/2 1996/05/09 04:11:29 drk $ */
|
||||
/*
|
||||
* COMPONENT_NAME: austext
|
||||
*
|
||||
* FUNCTIONS: LLIST_INIT
|
||||
* LL_ELEM_INIT
|
||||
* ll_access
|
||||
* ll_append
|
||||
* ll_deaccess
|
||||
* ll_first
|
||||
* ll_free
|
||||
* ll_next
|
||||
* ll_prepend
|
||||
*
|
||||
* ORIGINS: 157
|
||||
*
|
||||
*/
|
||||
/* The functions in this file are defined in alloc.c */
|
||||
|
||||
typedef struct {struct ll_elem FAR *ptr; LOCK_DESC} LL_P;
|
||||
|
||||
typedef struct ll_elem {
|
||||
LL_P next;
|
||||
CHAR_P data;
|
||||
} ll_elem;
|
||||
|
||||
#define LL_ELEM_INIT() { POINTER_INIT(), POINTER_INIT() }
|
||||
|
||||
typedef struct {
|
||||
LL_P head;
|
||||
LL_P tail;
|
||||
LL_P FAR *curr;
|
||||
} llist;
|
||||
|
||||
#define LLIST_INIT() { POINTER_INIT(), POINTER_INIT(), NULL }
|
||||
|
||||
BOOLEAN ll_access(P1(llist FAR *));
|
||||
int ll_append(P1(llist FAR *) Pi(CHAR_P FAR *));
|
||||
#define ll_deaccess(ll) /**/
|
||||
CHAR_P FAR *ll_first(P1(llist FAR *));
|
||||
void ll_free(P1(llist FAR *));
|
||||
CHAR_P FAR *ll_next(P1(llist FAR *));
|
||||
int ll_prepend(P1(llist FAR *) Pi(CHAR_P FAR *));
|
||||
/* vpp -nOS2 -dUNIX -nBSD -nVANILLA_BSD -nVMS -nMEMLOCK -nWINDOWS -nFAR_ALLOC -f/usr/users/master/config/nonwin ll.h */
|
||||
239
cde/lib/DtSearch/raima/makenew.c
Normal file
239
cde/lib/DtSearch/raima/makenew.c
Normal file
@@ -0,0 +1,239 @@
|
||||
/* $XConsortium: makenew.c /main/2 1996/05/09 04:11:43 drk $ */
|
||||
/*
|
||||
* COMPONENT_NAME: austext
|
||||
*
|
||||
* FUNCTIONS: d_makenew
|
||||
* d_setkey
|
||||
* sk_free
|
||||
*
|
||||
* ORIGINS: 157
|
||||
*
|
||||
* OBJECT CODE ONLY SOURCE MATERIALS
|
||||
*/
|
||||
/*-----------------------------------------------------------------------
|
||||
makenew.c -- db_VISTA (empty) record creation module
|
||||
|
||||
(C) Copyright 1987 by Raima Corp.
|
||||
-----------------------------------------------------------------------*/
|
||||
|
||||
/* ********************** EDIT HISTORY *******************************
|
||||
|
||||
SCR DATE INI DESCRIPTION
|
||||
----- --------- --- -----------------------------------------------------
|
||||
04-Aug-88 RTK MULTI_TASK changes
|
||||
11-Oct-88 RTK Moved sk_list into db_global
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include "vista.h"
|
||||
#include "dbtype.h"
|
||||
|
||||
|
||||
/* Set the value of a key field
|
||||
*/
|
||||
d_setkey( field, fldvalue TASK_PARM DBN_PARM )
|
||||
long field;
|
||||
CONST char FAR *fldvalue;
|
||||
TASK_DECL
|
||||
DBN_DECL
|
||||
{
|
||||
SK_P FAR *sk_ptr;
|
||||
SK_P sk_p;
|
||||
int fld, rec;
|
||||
RECORD_ENTRY FAR *rec_ptr;
|
||||
FIELD_ENTRY FAR *fld_ptr;
|
||||
|
||||
DB_ENTER(DB_ID TASK_ID LOCK_SET(RECORD_NOIO));
|
||||
|
||||
if (nfld_check(field, &rec, &fld, (RECORD_ENTRY FAR * FAR *)&rec_ptr, (FIELD_ENTRY FAR * FAR *)&fld_ptr) != S_OKAY)
|
||||
RETURN( db_status );
|
||||
|
||||
if ( fld_ptr->fd_key == 'n' )
|
||||
RETURN( dberr(S_NOTKEY) );
|
||||
|
||||
ll_access(&sk_list);
|
||||
while ((sk_ptr = (SK_P FAR *)ll_next(&sk_list)) != NULL) {
|
||||
if ( sk_ptr->ptr->sk_fld == fld ) {
|
||||
MEM_LOCK(&sk_ptr->ptr->sk_val);
|
||||
if ( fld_ptr->fd_type != CHARACTER || fld_ptr->fd_dim[1] )
|
||||
bytecpy( sk_ptr->ptr->sk_val.ptr, fldvalue, fld_ptr->fd_len );
|
||||
else if ( fld_ptr->fd_dim[0] )
|
||||
strncpy( sk_ptr->ptr->sk_val.ptr, fldvalue, fld_ptr->fd_len );
|
||||
else
|
||||
*(sk_ptr->ptr->sk_val.ptr) = *fldvalue;
|
||||
MEM_UNLOCK(&sk_ptr->ptr->sk_val);
|
||||
ll_deaccess(&sk_list);
|
||||
RETURN( db_status = S_OKAY );
|
||||
}
|
||||
}
|
||||
/* need to allocate a slot for a new fld */
|
||||
sk_p.ptr = (struct sk FAR *)ALLOC(&sk_p, sizeof(struct sk), "sk_ptr->ptr");
|
||||
if ( sk_p.ptr == NULL )
|
||||
RETURN( dberr( S_NOMEMORY ) );
|
||||
if ( ll_prepend(&sk_list, (CHAR_P FAR *)&sk_p) != S_OKAY ) {
|
||||
RETURN( db_status );
|
||||
}
|
||||
sk_p.ptr->sk_fld = fld;
|
||||
sk_p.ptr->sk_val.ptr = ALLOC(&sk_p.ptr->sk_val, fld_ptr->fd_len + 1,
|
||||
"sk_p.ptr->sk_val.ptr");
|
||||
if ( sk_p.ptr->sk_val.ptr == NULL )
|
||||
RETURN( dberr( S_NOMEMORY ) );
|
||||
|
||||
if ( fld_ptr->fd_type != CHARACTER || fld_ptr->fd_dim[1] )
|
||||
bytecpy( sk_p.ptr->sk_val.ptr, fldvalue, fld_ptr->fd_len );
|
||||
else if ( fld_ptr->fd_dim[0] )
|
||||
strncpy( sk_p.ptr->sk_val.ptr, fldvalue, fld_ptr->fd_len );
|
||||
else
|
||||
*(sk_p.ptr->sk_val.ptr) = *fldvalue;
|
||||
MEM_UNLOCK(&sk_p.ptr->sk_val);
|
||||
ll_deaccess(&sk_list);
|
||||
|
||||
RETURN( db_status = S_OKAY );
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* Free the memory allocated for the sk_list
|
||||
*/
|
||||
int sk_free()
|
||||
{
|
||||
SK_P FAR *sk_ptr;
|
||||
|
||||
ll_access(&sk_list);
|
||||
while ((sk_ptr = (SK_P FAR *)ll_next(&sk_list)) != NULL) {
|
||||
MEM_UNLOCK(&sk_ptr->ptr->sk_val);
|
||||
FREE(&sk_ptr->ptr->sk_val);
|
||||
}
|
||||
ll_deaccess(&sk_list);
|
||||
ll_free(&sk_list);
|
||||
return( db_status );
|
||||
}
|
||||
|
||||
|
||||
/* Create a new empty record
|
||||
*/
|
||||
d_makenew( nrec TASK_PARM DBN_PARM )
|
||||
int nrec;
|
||||
TASK_DECL
|
||||
DBN_DECL
|
||||
{
|
||||
#ifndef NO_TIMESTAMP
|
||||
ULONG timestamp;
|
||||
#endif
|
||||
DB_ADDR db_addr;
|
||||
INT recnum, fld, stat;
|
||||
FILE_NO file;
|
||||
F_ADDR rec_addr;
|
||||
char FAR *ptr;
|
||||
SK_P FAR *sk_ptr;
|
||||
RECORD_ENTRY FAR *rec_ptr;
|
||||
FIELD_ENTRY FAR *fld_ptr;
|
||||
int fldtot;
|
||||
|
||||
DB_ENTER(DB_ID TASK_ID LOCK_SET(RECORD_IO));
|
||||
|
||||
if (nrec_check(nrec, &nrec, (RECORD_ENTRY FAR * FAR *)&rec_ptr) != S_OKAY)
|
||||
RETURN( db_status );
|
||||
|
||||
recnum = NUM2EXT(nrec, rt_offset);
|
||||
if ( rec_ptr->rt_flags & COMKEYED )
|
||||
RETURN( dberr(S_COMKEY) );
|
||||
|
||||
/* check for duplicate keys */
|
||||
db_addr = curr_rec;
|
||||
for (fld = rec_ptr->rt_fields, fldtot = fld + rec_ptr->rt_fdtot,
|
||||
fld_ptr = &field_table[fld];
|
||||
fld < fldtot;
|
||||
++fld, ++fld_ptr) {
|
||||
if ((fld_ptr->fd_key == UNIQUE) && !(fld_ptr->fd_flags & OPTKEYMASK)) {
|
||||
/* locate the key value in the set_key table */
|
||||
ll_access(&sk_list);
|
||||
while (((sk_ptr = (SK_P FAR *)ll_next(&sk_list)) != NULL) &&
|
||||
(sk_ptr->ptr->sk_fld != fld))
|
||||
; /* NOP */
|
||||
if (sk_ptr == NULL) {
|
||||
ll_deaccess(&sk_list);
|
||||
RETURN( dberr( S_KEYREQD ) );
|
||||
}
|
||||
MEM_LOCK(&sk_ptr->ptr->sk_val);
|
||||
d_keyfind(FLDMARK*(long)recnum + (long)(fld - rec_ptr->rt_fields),
|
||||
sk_ptr->ptr->sk_val.ptr TASK_PARM DBN_PARM);
|
||||
MEM_UNLOCK(&sk_ptr->ptr->sk_val);
|
||||
curr_rec = db_addr;
|
||||
ll_deaccess(&sk_list);
|
||||
if ( db_status == S_OKAY ) RETURN( db_status = S_DUPLICATE );
|
||||
}
|
||||
}
|
||||
/* pull out the file number */
|
||||
file = rec_ptr->rt_file;
|
||||
db_addr = (NUM2EXT(file, ft_offset) & FILEMASK) << FILESHIFT;
|
||||
|
||||
/* select a record pointer to use */
|
||||
if ( dio_pzalloc(file, &rec_addr) != S_OKAY )
|
||||
RETURN( db_status );
|
||||
db_addr |= rec_addr;
|
||||
|
||||
/* read record */
|
||||
if ( dio_read( db_addr, (char FAR * FAR *)&ptr, PGHOLD) != S_OKAY )
|
||||
RETURN( db_status );
|
||||
|
||||
/* zero fill the record */
|
||||
byteset(ptr, 0, rec_ptr->rt_len);
|
||||
|
||||
/* place the record number and db_addr at the start of the record */
|
||||
bytecpy( ptr, &recnum, sizeof(INT) );
|
||||
bytecpy( ptr+sizeof(INT), &db_addr, DB_ADDR_SIZE);
|
||||
#ifndef NO_TIMESTAMP
|
||||
/* check for timestamp */
|
||||
if ( rec_ptr->rt_flags & TIMESTAMPED ) {
|
||||
timestamp = dio_pzgetts(file);
|
||||
bytecpy( ptr + RECCRTIME, ×tamp, sizeof(LONG));
|
||||
bytecpy( ptr + RECUPTIME, ×tamp, sizeof(LONG));
|
||||
}
|
||||
else timestamp = 0L;
|
||||
#endif
|
||||
/* for each keyed field, enter the key value into the key file */
|
||||
for (fld = rec_ptr->rt_fields, fldtot = fld + rec_ptr->rt_fdtot,
|
||||
fld_ptr = &field_table[fld];
|
||||
fld < fldtot;
|
||||
++fld, ++fld_ptr) {
|
||||
if ((fld_ptr->fd_key != 'n') && !(fld_ptr->fd_flags & OPTKEYMASK)) {
|
||||
/* locate the key value in the set_key table */
|
||||
ll_access(&sk_list);
|
||||
sk_ptr = (SK_P FAR *)ll_first(&sk_list);
|
||||
while (sk_ptr != NULL) {
|
||||
if ( sk_ptr->ptr->sk_fld == fld ) {
|
||||
MEM_LOCK(&sk_ptr->ptr->sk_val);
|
||||
if ((stat = key_insert(fld, sk_ptr->ptr->sk_val.ptr, db_addr))
|
||||
!= S_OKAY) {
|
||||
dio_write(db_addr, NULL, PGFREE);
|
||||
r_delrec( nrec, db_addr );
|
||||
MEM_UNLOCK(&sk_ptr->ptr->sk_val);
|
||||
ll_deaccess(&sk_list);
|
||||
RETURN( db_status = stat );
|
||||
}
|
||||
if ((fld_ptr->fd_type != CHARACTER) || fld_ptr->fd_dim[0] )
|
||||
bytecpy(ptr+fld_ptr->fd_ptr, sk_ptr->ptr->sk_val.ptr,
|
||||
fld_ptr->fd_len);
|
||||
else
|
||||
strncpy(ptr + fld_ptr->fd_ptr, sk_ptr->ptr->sk_val.ptr,
|
||||
fld_ptr->fd_len);
|
||||
MEM_UNLOCK(&sk_ptr->ptr->sk_val);
|
||||
break;
|
||||
}
|
||||
sk_ptr = (SK_P FAR *)ll_next(&sk_list);
|
||||
}
|
||||
ll_deaccess(&sk_list);
|
||||
if ( sk_ptr == NULL ) RETURN( dberr( S_KEYREQD ) );
|
||||
}
|
||||
}
|
||||
if ( dio_write(db_addr, NULL, PGFREE) == S_OKAY ) {
|
||||
curr_rec = db_addr;
|
||||
#ifndef NO_TIMESTAMP
|
||||
if ( db_tsrecs )
|
||||
cr_time = timestamp;
|
||||
#endif
|
||||
}
|
||||
RETURN( db_status );
|
||||
}
|
||||
/* vpp -nOS2 -dUNIX -nBSD -nVANILLA_BSD -nVMS -nMEMLOCK -nWINDOWS -nFAR_ALLOC -f/usr/users/master/config/nonwin makenew.c */
|
||||
185
cde/lib/DtSearch/raima/mapchar.c
Normal file
185
cde/lib/DtSearch/raima/mapchar.c
Normal file
@@ -0,0 +1,185 @@
|
||||
/* $XConsortium: mapchar.c /main/3 1996/10/01 16:39:53 drk $ */
|
||||
/*
|
||||
* COMPONENT_NAME: austext
|
||||
*
|
||||
* FUNCTIONS: bgets
|
||||
* ctb_init
|
||||
* ctbl_alloc
|
||||
* ctbl_free
|
||||
* d_mapchar
|
||||
* nextc
|
||||
*
|
||||
* ORIGINS: 157
|
||||
*
|
||||
* OBJECT CODE ONLY SOURCE MATERIALS
|
||||
*/
|
||||
#ifndef NO_COUNTRY
|
||||
/*-----------------------------------------------------------------------
|
||||
|
||||
mapchar.c -- db_VISTA character map module.
|
||||
|
||||
detailed description
|
||||
|
||||
AUTHOR: Guido Weischedel
|
||||
DATE: August, 1988
|
||||
PROJECT: International Character sets
|
||||
|
||||
Copyright (C) 1988 by Raima Corporation
|
||||
|
||||
-----------------------------------------------------------------------*/
|
||||
|
||||
/* ********************** EDIT HISTORY *******************************
|
||||
|
||||
SCR DATE INI DESCRIPTION
|
||||
----- --------- --- -----------------------------------------------------
|
||||
20-Sep-88 WLW MULTI_TASK changes
|
||||
|
||||
*/
|
||||
|
||||
|
||||
/* ********************** INCLUDE FILES ****************************** */
|
||||
#include <stdio.h>
|
||||
#include <fcntl.h>
|
||||
#include "vista.h"
|
||||
#include "dbtype.h"
|
||||
|
||||
/* ********************** LOCAL VARIABLE DECLARATIONS **************** */
|
||||
static char buf[30];
|
||||
static int cptr = -1;
|
||||
static int buflen;
|
||||
|
||||
/* ********************** LOCAL FUNCTION DECLARATIONS **************** */
|
||||
static void bgets(P1(char *) Pi(int) Pi(int));
|
||||
static int nextc(P1(int));
|
||||
|
||||
/* Map ASCII-Characters for output and sorting
|
||||
*/
|
||||
int d_mapchar(inchar,outchar,sort_str,subsort TASK_PARM)
|
||||
unsigned char inchar; /* value of character to be mapped */
|
||||
unsigned char outchar; /* output character as ... */
|
||||
CONST char FAR *sort_str; /* sort string (max. len = 2) */
|
||||
unsigned char subsort; /* subsort value, to distinguish between two */
|
||||
/* equal values (e.g. 'a' and 'A', if necessary) */
|
||||
TASK_DECL
|
||||
{
|
||||
int indx;
|
||||
|
||||
DB_ENTER(NO_DB_ID TASK_ID LOCK_SET(RECORD_IO));
|
||||
|
||||
if ( strlen(sort_str) > 2 )
|
||||
RETURN( dberr(S_INVSORT) );
|
||||
|
||||
/* Is character-set table already installed? */
|
||||
if ( !db_global.ctbl_activ ) {
|
||||
if ( ctbl_alloc() != S_OKAY )
|
||||
RETURN( db_status );
|
||||
db_global.ctbl_activ = TRUE;
|
||||
}
|
||||
|
||||
/* Modify table for inchar specifications */
|
||||
indx = inchar;
|
||||
db_global.country_tbl.ptr[indx].out_chr = outchar;
|
||||
db_global.country_tbl.ptr[indx].sort_as1 = sort_str[0];
|
||||
db_global.country_tbl.ptr[indx].sort_as2 = sort_str[1];
|
||||
db_global.country_tbl.ptr[indx].sub_sort = subsort;
|
||||
|
||||
RETURN( db_status=S_OKAY );
|
||||
}
|
||||
|
||||
/* read MAP_FILE and make appropriate d_mapchar-calls
|
||||
*/
|
||||
int ctb_init()
|
||||
{
|
||||
int map_fd;
|
||||
unsigned char inchar, outchar, subsort;
|
||||
char loc_buf[21], sortas[3];
|
||||
short subs_i;
|
||||
char ctb_name[FILENMLEN*2];
|
||||
|
||||
strcpy( ctb_name, db_global.ctbpath );
|
||||
strcat( ctb_name, CTBNAME );
|
||||
|
||||
if ( (map_fd = open_b(ctb_name,O_RDONLY)) != -1 ) {
|
||||
while(bgets(loc_buf,20,map_fd), *loc_buf) {
|
||||
if ( strcmp( loc_buf, "ignorecase" ) == 0 ) {
|
||||
if ( d_on_opt( IGNORECASE CURRTASK_PARM ) != S_OKAY )
|
||||
break;
|
||||
}
|
||||
else {
|
||||
sscanf(loc_buf,"%c,%c,%hd,%2s",&inchar,&outchar,&subs_i,&sortas[0]);
|
||||
subsort = (unsigned char) subs_i;
|
||||
if (d_mapchar(inchar,outchar,sortas,subsort CURRTASK_PARM) != S_OKAY )
|
||||
break;
|
||||
}
|
||||
}
|
||||
close(map_fd);
|
||||
return( db_status );
|
||||
}
|
||||
return(db_status = S_OKAY);
|
||||
}
|
||||
|
||||
/* do an fgets from a binary file */
|
||||
static void bgets( s, len, fd )
|
||||
char *s;
|
||||
int len, fd;
|
||||
{
|
||||
int c;
|
||||
|
||||
len--;
|
||||
while ( len-- ) {
|
||||
do {
|
||||
c = nextc( fd );
|
||||
if ( c == -1 ) goto eof;
|
||||
c &= 0xff;
|
||||
} while ( c == '\r' );
|
||||
if ( c == '\n' ) break;
|
||||
*s++ = (char)c;
|
||||
}
|
||||
eof:
|
||||
*s = '\0';
|
||||
}
|
||||
|
||||
/* get one character from the file */
|
||||
static int nextc( fd )
|
||||
int fd;
|
||||
{
|
||||
int n;
|
||||
|
||||
if ( cptr < 0 || cptr >= buflen ) {
|
||||
n = read( fd, buf, 30 );
|
||||
if ( n == 0 ) {
|
||||
cptr = -1;
|
||||
return( -1 );
|
||||
}
|
||||
cptr = 0;
|
||||
buflen = n;
|
||||
}
|
||||
return( (int)buf[cptr++] );
|
||||
}
|
||||
|
||||
|
||||
/* Allocate and initialize country_table
|
||||
*/
|
||||
int ctbl_alloc()
|
||||
{
|
||||
if ((db_global.country_tbl.ptr = (CNTRY_TBL FAR *)
|
||||
ALLOC(&db_global.country_tbl,256*sizeof(CNTRY_TBL)+1,"country_tbl"))
|
||||
== NULL ) return( dberr(S_NOMEMORY) );
|
||||
|
||||
/* fill table with standard values */
|
||||
byteset(db_global.country_tbl.ptr, '\0', 256*sizeof(CNTRY_TBL)+1);
|
||||
|
||||
return( db_status = S_OKAY );
|
||||
}
|
||||
|
||||
/* Free country table
|
||||
*/
|
||||
void ctbl_free()
|
||||
{
|
||||
MEM_UNLOCK( &db_global.country_tbl );
|
||||
FREE( &db_global.country_tbl );
|
||||
db_global.ctbl_activ = FALSE;
|
||||
}
|
||||
|
||||
#endif /* NO_COUNTRY */
|
||||
/* vpp -nOS2 -dUNIX -nBSD -nVANILLA_BSD -nVMS -nMEMLOCK -nWINDOWS -nFAR_ALLOC -f/usr/users/master/config/nonwin mapchar.c */
|
||||
65
cde/lib/DtSearch/raima/members.c
Normal file
65
cde/lib/DtSearch/raima/members.c
Normal file
@@ -0,0 +1,65 @@
|
||||
/* $XConsortium: members.c /main/2 1996/05/09 04:12:13 drk $ */
|
||||
/*
|
||||
* COMPONENT_NAME: austext
|
||||
*
|
||||
* FUNCTIONS: d_members
|
||||
*
|
||||
* ORIGINS: 157
|
||||
*
|
||||
* OBJECT CODE ONLY SOURCE MATERIALS
|
||||
*/
|
||||
/*-----------------------------------------------------------------------
|
||||
members.c -- db_VISTA set member count get module
|
||||
|
||||
(C) Copyright 1987 by Raima Corp.
|
||||
-----------------------------------------------------------------------*/
|
||||
|
||||
/* ********************** EDIT HISTORY *******************************
|
||||
|
||||
SCR DATE INI DESCRIPTION
|
||||
----- --------- --- -----------------------------------------------------
|
||||
04-Aug-88 RTK MULTI_TASK changes
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include "vista.h"
|
||||
#include "dbtype.h"
|
||||
|
||||
|
||||
/* Get number of members of the current set owner
|
||||
*/
|
||||
d_members(set, tot TASK_PARM DBN_PARM)
|
||||
int set; /* Set table entry */
|
||||
LONG FAR *tot; /* total members of set */
|
||||
TASK_DECL
|
||||
DBN_DECL /* database number */
|
||||
{
|
||||
char setp[SETPSIZE];
|
||||
char FAR *recp;
|
||||
LONG total;
|
||||
SET_ENTRY FAR *set_ptr;
|
||||
|
||||
DB_ENTER(DB_ID TASK_ID LOCK_SET(SET_IO));
|
||||
|
||||
if (nset_check(set, &set, (SET_ENTRY FAR * FAR *)&set_ptr) != S_OKAY)
|
||||
RETURN( db_status );
|
||||
|
||||
/* Make sure we have a current owner */
|
||||
if ( ! curr_own[set] )
|
||||
RETURN( dberr(S_NOCO) );
|
||||
|
||||
/* Read owner record */
|
||||
if ( dio_read( curr_own[set], (char FAR * FAR *)&recp, NOPGHOLD) != S_OKAY )
|
||||
RETURN( db_status );
|
||||
|
||||
/* Get set pointer from owner record */
|
||||
if ( r_gset(set, recp, setp) != S_OKAY )
|
||||
RETURN( (db_status == S_INVOWN) ? dberr(S_SYSERR) : db_status );
|
||||
|
||||
/* Copy total members from owner pointer */
|
||||
bytecpy(&total, setp+SP_MEMBERS, sizeof(LONG));
|
||||
*tot = total;
|
||||
|
||||
RETURN( db_status = S_OKAY );
|
||||
}
|
||||
/* vpp -nOS2 -dUNIX -nBSD -nVANILLA_BSD -nVMS -nMEMLOCK -nWINDOWS -nFAR_ALLOC -f/usr/users/master/config/nonwin members.c */
|
||||
103
cde/lib/DtSearch/raima/ncb.h
Normal file
103
cde/lib/DtSearch/raima/ncb.h
Normal file
@@ -0,0 +1,103 @@
|
||||
/* $XConsortium: ncb.h /main/2 1996/05/09 04:12:28 drk $ */
|
||||
/*
|
||||
* COMPONENT_NAME: austext
|
||||
*
|
||||
* FUNCTIONS: none
|
||||
*
|
||||
* ORIGINS: 157
|
||||
*
|
||||
*/
|
||||
#define NETNAME_LEN 16
|
||||
#ifndef NULL
|
||||
#define NULL (char *)0
|
||||
#endif
|
||||
|
||||
#define NETBIOS_INT 0x5c
|
||||
|
||||
#define ADDNAME 0x30
|
||||
#define DELNAME 0x31
|
||||
#define RESET 0x32
|
||||
#define STATUS 0x33
|
||||
#define SESSTAT 0x34
|
||||
#define CALL 0x10
|
||||
#define LISTEN 0x11
|
||||
#define HANGUP 0x12
|
||||
#define SEND 0x14
|
||||
#define RECEIVE 0x15
|
||||
#define ADDNAIT 0xB0
|
||||
#define DELNAIT 0xB1
|
||||
#define CALNAIT 0x90
|
||||
#define LISNAIT 0x91
|
||||
#define HANNAIT 0x92
|
||||
#define SENNAIT 0x94
|
||||
#define RECNAIT 0x95
|
||||
#define ARENAIT 0x96
|
||||
#define ANY 0xFF
|
||||
#define PENDING 0xFFFF
|
||||
#define NCBSIZE 64
|
||||
|
||||
#ifdef TURBO
|
||||
#ifdef __SMALL__
|
||||
#define SMALL_DATA
|
||||
#endif
|
||||
#ifdef __MEDIUM__
|
||||
#define SMALL_DATA
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef MSC
|
||||
#ifdef M_I86SM
|
||||
#define SMALL_DATA
|
||||
#endif
|
||||
#ifdef M_I86MM
|
||||
#define SMALL_DATA
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef LAT
|
||||
#ifdef SPTR
|
||||
#define SMALL_DATA
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/***** NCB Commands parameter block *****/
|
||||
typedef struct {
|
||||
char command; /* NETBIOS Command */
|
||||
char retcode; /* Return value (some enumerated below) */
|
||||
char lsn; /* Local session number */
|
||||
char num; /* Name number */
|
||||
char FAR *buffer_off; /* Message buffer offset */
|
||||
#ifdef SMALL_DATA
|
||||
int buffer_seg; /* Message buffer segment */
|
||||
#endif
|
||||
int length; /* Length of message buffer */
|
||||
char callname[NETNAME_LEN]; /* Name of user being called */
|
||||
char name[NETNAME_LEN]; /* My name */
|
||||
char rto; /* Receive timeout (500ms units) */
|
||||
char sto; /* Send timeout (500ms units) */
|
||||
char FAR *post_off; /* Post function offset */
|
||||
#ifdef SMALL_DATA
|
||||
int post_seg; /* Post function segment */
|
||||
#endif
|
||||
char lana_num; /* Local area network adapter number (use 0) */
|
||||
char cmd_cplt; /* Command complete return value, used when posting */
|
||||
char reserve[14]; /* reserved for Net BIOS */
|
||||
} NCB;
|
||||
|
||||
typedef struct {
|
||||
char rep_sess;
|
||||
char name_sess;
|
||||
char gram;
|
||||
char rcvany;
|
||||
struct {
|
||||
char lsn;
|
||||
char state_sess;
|
||||
char loc_name[16];
|
||||
char rem_name[16];
|
||||
char rcvs;
|
||||
char sends;
|
||||
} s[32];
|
||||
} SESSION;
|
||||
|
||||
#define NCB_H
|
||||
/* vpp -nOS2 -dUNIX -nBSD -nVANILLA_BSD -nVMS -nMEMLOCK -nWINDOWS -nFAR_ALLOC -f/usr/users/master/config/nonwin ncb.h */
|
||||
335
cde/lib/DtSearch/raima/netunix.c
Normal file
335
cde/lib/DtSearch/raima/netunix.c
Normal file
@@ -0,0 +1,335 @@
|
||||
/* $XConsortium: netunix.c /main/4 1996/11/01 10:13:29 drk $ */
|
||||
/*
|
||||
* COMPONENT_NAME: austext
|
||||
*
|
||||
* FUNCTIONS: netbios_chk
|
||||
* nw_addnm
|
||||
* nw_call
|
||||
* nw_cleanup
|
||||
* nw_delnm
|
||||
* nw_hangup
|
||||
* nw_rcvmsg
|
||||
* nw_send
|
||||
* nw_sestat
|
||||
*
|
||||
* ORIGINS: 157
|
||||
*
|
||||
* OBJECT CODE ONLY SOURCE MATERIALS
|
||||
*/
|
||||
/*------------------------------------------------------------------------
|
||||
netunix.c -- db_VISTA System-V/BSD Interface Module
|
||||
|
||||
The "nw_" prefix specifies that the function will not return
|
||||
until the command has completed. For example, nw_send will return
|
||||
when the sent message has been received.
|
||||
|
||||
NOTES FOR UNIX SYS V/BSD ARE EMBEDDED BELOW. RUNTIME FUNCTIONS WILL USE
|
||||
THESE FUNCTIONS IN THE SAME WAY ON DOS OR UNIX.
|
||||
|
||||
These functions are used by the db_VISTA runtime.
|
||||
|
||||
nw_addnm -- Adds user id name to network.
|
||||
DO NOTHING.
|
||||
nw_delnm -- Deletes user id name from network.
|
||||
DO NOTHING.
|
||||
nw_call -- Calls a user id to establish communication session.
|
||||
SYS V:
|
||||
CREATE THE TOKEN FILE, AND MAKE SURE THAT THE LOCK
|
||||
MANAGER'S EXISTS.
|
||||
CREATE AND SET VALUE OF SEMAPHORE.
|
||||
CREATE AN INCOMING MESSAGE QUEUE.
|
||||
BSD:
|
||||
MAKE SURE THAT THE LOCK MANAGER EXISTS.
|
||||
OPEN A BIDIRECTIONAL COMMUNICATION SOCKET TO IT.
|
||||
SEND FIRST MESSAGE TO LOCK MANAGER. MESSAGE WILL INCLUDE
|
||||
DBUSERID (RECEIVED BY nw_addnm()), AND PROCESS ID.
|
||||
nw_hangup -- Disconnects session.
|
||||
SYS V:
|
||||
REMOVE THE TOKEN FILE.
|
||||
DELETE THE SEMAPHORE.
|
||||
DELETE THE INCOMING MESSAGE QUEUE.
|
||||
BSD:
|
||||
CLOSE THE SOCKET.
|
||||
nw_send -- Sends message to specific user.
|
||||
SEND THE MESSAGE, AS IS, TO LOCK MANAGER.
|
||||
nw_rcvmsg -- Receives message from specific user.
|
||||
RECEIVE THE MESSAGE, AS IS, FROM LOCK MANAGER.
|
||||
|
||||
------------------------------------------------------------------------*/
|
||||
|
||||
/* ********************** EDIT HISTORY *******************************
|
||||
|
||||
SCR DATE INI DESCRIPTION
|
||||
----- --------- --- -----------------------------------------------------
|
||||
310 10-Aug-88 RSC Cleanup function prototype (put MESSAGE in dbtype.h)
|
||||
368 25-Aug-88 RSC Fix BSD integration
|
||||
423 08-Sep-88 RSC Change for compatibility with Multi-tasking
|
||||
423 10-Sep-88 RSC Change dbpush to use new calling convention
|
||||
08-Feb-90 WLW In nw_hangup, unlink file after deleting queue (SYSV)
|
||||
*/
|
||||
|
||||
#include <sys/errno.h>
|
||||
#include <stdio.h>
|
||||
#include "vista.h"
|
||||
#include "dbtype.h"
|
||||
#include <sys/types.h>
|
||||
#include <sys/ipc.h>
|
||||
#include <sys/msg.h>
|
||||
#include <sys/sem.h>
|
||||
|
||||
#ifndef SINGLE_USER
|
||||
# include <X11/Xos.h>
|
||||
# include <errno.h>
|
||||
# ifdef X_NOT_STDC_ENV
|
||||
extern int errno;
|
||||
# endif
|
||||
|
||||
static char tokfile[80];
|
||||
static int inqid;
|
||||
static int outqid;
|
||||
static int semid;
|
||||
static int mypid;
|
||||
static char tmpdir[] = "/tmp/";
|
||||
|
||||
|
||||
|
||||
/* Check for the existence of NetBIOS on this machine
|
||||
*/
|
||||
int netbios_chk()
|
||||
{
|
||||
/* On UNIX, indicate that there is no problem */
|
||||
return( 1 );
|
||||
}
|
||||
|
||||
/* Issue ADD NAME command - wait
|
||||
*/
|
||||
/*ARGSUSED*/
|
||||
int nw_addnm(name, ncb_num)
|
||||
char *name;
|
||||
int *ncb_num;
|
||||
{
|
||||
return( net_status = N_OKAY );
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* Issue DELETE NAME command - wait
|
||||
*/
|
||||
/*ARGSUSED*/
|
||||
int nw_delnm(name)
|
||||
char *name;
|
||||
{
|
||||
return( net_status = N_OKAY );
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/* Cleanup any dirty sessions
|
||||
*/
|
||||
/*ARGSUSED*/
|
||||
int nw_cleanup(dbusrid)
|
||||
char *dbusrid;
|
||||
{
|
||||
return( net_status = N_OKAY );
|
||||
}
|
||||
|
||||
|
||||
/* Issue a session status call
|
||||
*/
|
||||
int nw_sestat()
|
||||
{
|
||||
return( net_status = N_OKAY );
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* Issue CALL command - wait
|
||||
*/
|
||||
int nw_call(them, me, ncb_lsn)
|
||||
char *them;
|
||||
char *me;
|
||||
int *ncb_lsn;
|
||||
{
|
||||
key_t key;
|
||||
FILE *fp;
|
||||
struct sembuf sops[1];
|
||||
LM_LOGIN login;
|
||||
int tokpos;
|
||||
|
||||
if ( ! db_lockmgr )
|
||||
RETURN( net_status = N_OKAY );
|
||||
|
||||
/* create the token file for the lock manager */
|
||||
strcpy(tokfile, tmpdir);
|
||||
tokpos = sizeof(tmpdir) - 1;
|
||||
strcpy(&tokfile[tokpos], them);
|
||||
|
||||
if ( ( key = ftok( tokfile, 1 ) ) == -1 )
|
||||
/* /tmp/lockmgr file non-existant */
|
||||
RETURN( net_status = N_CALLNAME );
|
||||
|
||||
/* obtain the id to the lock manager's input queue and check the
|
||||
value of the semaphore
|
||||
*/
|
||||
if (((outqid = msgget(key, PERMISSION | IPC_CREAT)) == -1) ||
|
||||
((semid = semget(key, 1, PERMISSION)) == -1))
|
||||
RETURN( net_status = N_TIMEOUT );
|
||||
|
||||
if ( semctl( semid, 0, GETVAL, NULL ) != 1 ) {
|
||||
/* the lockmgr has terminated, but has not been cleared */
|
||||
RETURN( net_status = N_CALLNAME );
|
||||
}
|
||||
|
||||
/* create the token file for this dbuserid */
|
||||
strcpy(&tokfile[tokpos], me);
|
||||
|
||||
/* get a key that is unique for the token file */
|
||||
if ( ( key = ftok( tokfile, 1 ) ) != -1 ) {
|
||||
/* The token file exists. Is it because there is another active
|
||||
process which is using the id?
|
||||
*/
|
||||
/* check the value of the semaphore */
|
||||
if ( ( semid = semget( key, 1, PERMISSION | IPC_CREAT ) ) == -1 )
|
||||
RETURN( net_status = N_TIMEOUT );
|
||||
if ( semctl( semid, 0, GETVAL, NULL ) == 1 ) {
|
||||
/* this dbuserid is already active */
|
||||
RETURN( net_status = N_NAMEUSED );
|
||||
}
|
||||
/* just in case this process formerly aborted with message remaining
|
||||
in its input queue, delete the queue
|
||||
*/
|
||||
if (((inqid = msgget(key, PERMISSION | IPC_CREAT)) == -1) ||
|
||||
(msgctl(inqid, IPC_RMID, (struct msqid_ds *)NULL) == -1))
|
||||
RETURN( net_status = N_TIMEOUT );
|
||||
}
|
||||
else {
|
||||
/* create the token file */
|
||||
if ( ( fp = fopen( tokfile, "w" ) ) == NULL )
|
||||
RETURN( net_status = N_TIMEOUT );
|
||||
fclose( fp );
|
||||
|
||||
/* get the key value for the token file */
|
||||
if ( ( key = ftok( tokfile, 1 ) ) == -1 ) {
|
||||
RETURN( net_status = N_TIMEOUT );
|
||||
}
|
||||
}
|
||||
|
||||
/* create and set the value of a semaphore */
|
||||
if ( ( semid = semget( key, 1, PERMISSION | IPC_CREAT ) ) == -1 )
|
||||
RETURN( net_status = N_TIMEOUT );
|
||||
sops[0].sem_num = 0;
|
||||
sops[0].sem_op = 1;
|
||||
sops[0].sem_flg = SEM_UNDO;
|
||||
while ( semop( semid, sops, 1 ) == -1 ) {
|
||||
if ( errno == EINTR ) continue;
|
||||
RETURN( net_status = N_TIMEOUT );
|
||||
}
|
||||
|
||||
/* create my incoming message queue */
|
||||
if ( ( inqid = msgget( key, PERMISSION | IPC_CREAT ) ) == -1 )
|
||||
RETURN( net_status = N_TIMEOUT );
|
||||
|
||||
/* send the message to the lock manager */
|
||||
login.fcn = L_LOGIN;
|
||||
strcpy( login.dbusrid, me );
|
||||
login.pid = getpid();
|
||||
mypid = login.pid;
|
||||
while ( msgsnd(outqid, (struct msgbuf *)&login,
|
||||
sizeof(LM_LOGIN)-sizeof(LONG), 0) == -1 ) {
|
||||
if ( errno == EINTR ) continue;
|
||||
RETURN( net_status = N_TIMEOUT );
|
||||
}
|
||||
*ncb_lsn = 0;
|
||||
RETURN( net_status = N_OKAY );
|
||||
}
|
||||
|
||||
|
||||
/* Issue HANGUP command - wait
|
||||
*/
|
||||
/*ARGSUSED*/
|
||||
int nw_hangup(lsn)
|
||||
int lsn;
|
||||
{
|
||||
if ( ! db_lockmgr )
|
||||
RETURN( net_status = N_OKAY );
|
||||
|
||||
/* delete the incoming message queue */
|
||||
msgctl( inqid, IPC_RMID, (struct msqid_ds *)NULL );
|
||||
|
||||
/* delete the semaphore */
|
||||
semctl( semid, 0, IPC_RMID, NULL );
|
||||
|
||||
/* delete the token file */
|
||||
unlink( tokfile );
|
||||
RETURN( net_status = N_OKAY );
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* Issue SEND command - wait
|
||||
*/
|
||||
/*ARGSUSED*/
|
||||
int nw_send(lsn, msgtxt, msglen)
|
||||
int lsn;
|
||||
MESSAGE *msgtxt;
|
||||
int msglen;
|
||||
{
|
||||
|
||||
if ( ! db_lockmgr ) {
|
||||
last_mtype = msgtxt->mtype;
|
||||
RETURN( net_status = N_OKAY );
|
||||
}
|
||||
msgtxt->pid = mypid;
|
||||
|
||||
/* everything should be ready, just send it */
|
||||
while ( msgsnd(outqid, (struct msgbuf *)msgtxt, msglen-sizeof(LONG),
|
||||
0) == -1 ) {
|
||||
if ( errno == EINTR ) continue;
|
||||
RETURN( net_status = N_TIMEOUT );
|
||||
}
|
||||
|
||||
RETURN( net_status = N_OKAY );
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* Issue RECEIVE command - wait
|
||||
*/
|
||||
/*ARGSUSED*/
|
||||
int nw_rcvmsg(lsn, msgtxt, msglen, ncb_len)
|
||||
int lsn;
|
||||
MESSAGE *msgtxt;
|
||||
int msglen;
|
||||
int *ncb_len;
|
||||
{
|
||||
LR_DBOPEN *dp;
|
||||
LR_LOCK *lp;
|
||||
|
||||
if ( ! db_lockmgr ) {
|
||||
if ( last_mtype == L_LOCK ) {
|
||||
lp = (LR_LOCK *)msgtxt;
|
||||
lp->fcn = L_LOCK;
|
||||
lp->status = L_OKAY;
|
||||
}
|
||||
else {
|
||||
dp = (LR_DBOPEN *)msgtxt;
|
||||
dp->fcn = L_DBOPEN;
|
||||
dp->status = L_OKAY;
|
||||
dp->nusers = 1;
|
||||
}
|
||||
RETURN( net_status = N_OKAY );
|
||||
}
|
||||
while ( ( *ncb_len = msgrcv(inqid, (struct msgbuf *)msgtxt,
|
||||
msglen-sizeof(LONG), (LONG)0, 0) ) == -1 ) {
|
||||
if ( errno == EINTR ) continue;
|
||||
RETURN( net_status = N_TIMEOUT );
|
||||
}
|
||||
|
||||
RETURN( net_status = N_OKAY );
|
||||
}
|
||||
|
||||
/* The remaining functions are BSD only */
|
||||
|
||||
#endif
|
||||
/* vpp -nOS2 -dUNIX -nBSD -nVANILLA_BSD -nVMS -nMEMLOCK -nWINDOWS -nFAR_ALLOC -f/usr/users/master/config/nonwin netunix.c */
|
||||
35
cde/lib/DtSearch/raima/oflag.c
Normal file
35
cde/lib/DtSearch/raima/oflag.c
Normal file
@@ -0,0 +1,35 @@
|
||||
/*
|
||||
* COMPONENT_NAME: austext
|
||||
*
|
||||
* FUNCTIONS: none
|
||||
*
|
||||
* ORIGINS: 27,157
|
||||
*
|
||||
* This module contains IBM CONFIDENTIAL code. -- (IBM
|
||||
* Confidential Restricted when combined with the aggregated
|
||||
* modules for this product)
|
||||
*
|
||||
* OBJECT CODE ONLY SOURCE MATERIALS
|
||||
* (C) COPYRIGHT International Business Machines Corp. 1995, 1996
|
||||
* All Rights Reserved
|
||||
* US Government Users Restricted Rights - Use, duplication or
|
||||
* disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
|
||||
*/
|
||||
/* $XConsortium: oflag.c /main/3 1996/05/07 13:46:59 drk $
|
||||
* Author: Mike Russell, October 1995.
|
||||
* Global db_oflag replaces hardcoded O_RDWR in calls
|
||||
* to open_b() in runtime and open_u() in utilities
|
||||
* to permit read-only database opens.
|
||||
* Placed in its own module because there are no common
|
||||
* modules or headers in both runtime and utility source sets.
|
||||
* This module is duplicated exactly in both directories.
|
||||
*
|
||||
* $Log$
|
||||
* Revision 1.1 1995/10/17 19:57:02 miker
|
||||
* Initial revision
|
||||
*
|
||||
*/
|
||||
#include <fcntl.h>
|
||||
|
||||
int db_oflag = O_RDWR;
|
||||
|
||||
71
cde/lib/DtSearch/raima/opens.c
Normal file
71
cde/lib/DtSearch/raima/opens.c
Normal file
@@ -0,0 +1,71 @@
|
||||
/* $XConsortium: opens.c /main/2 1996/05/09 04:12:57 drk $ */
|
||||
/*
|
||||
* COMPONENT_NAME: austext
|
||||
*
|
||||
* FUNCTIONS: open_b
|
||||
*
|
||||
* ORIGINS: 157
|
||||
*
|
||||
* OBJECT CODE ONLY SOURCE MATERIALS
|
||||
*/
|
||||
/*-----------------------------------------------------------------------
|
||||
opens.c -- db_VISTA system open() interface module
|
||||
|
||||
(C) Copyright 1987 by Raima Corp.
|
||||
-----------------------------------------------------------------------*/
|
||||
|
||||
/* ********************** EDIT HISTORY *******************************
|
||||
|
||||
SCR DATE INI DESCRIPTION
|
||||
----- --------- --- -----------------------------------------------------
|
||||
115 19-Jul-88 RSC Integrate VAX/VMS changes into code
|
||||
368 28-Jul-88 RSC Integrate BSD changes into code
|
||||
310 10-Aug-88 RSC Cleanup function prototype.
|
||||
571 27-Jan-89 RSC Removed extraneous include dbtype.h
|
||||
571 30-Jan-89 WLW Added required header info for Windows compile w/o dbtype.h
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <fcntl.h>
|
||||
#include "vista.h"
|
||||
#ifdef MSC
|
||||
#include <share.h>
|
||||
#include <io.h>
|
||||
#include <string.h>
|
||||
#endif
|
||||
|
||||
|
||||
/* Open a binary file for shared access
|
||||
*/
|
||||
int open_b(filenm, flags)
|
||||
CONST char FAR *filenm;
|
||||
int flags;
|
||||
{
|
||||
int desc;
|
||||
|
||||
desc = open(filenm, flags, 0666);
|
||||
if ( desc < 0 && (flags & O_CREAT) )
|
||||
desc = creat(filenm, 0666);
|
||||
if ((desc >= 3) && (fcntl(desc, F_SETFD, 1) < 0)) {
|
||||
close(desc);
|
||||
desc = -1;
|
||||
}
|
||||
#ifdef MSC
|
||||
flags |= O_BINARY;
|
||||
desc = sopen((char *)filenm, flags, SH_DENYNO, 0666);
|
||||
#endif
|
||||
#ifdef TURBO
|
||||
flags |= O_BINARY | O_DENYNONE;
|
||||
desc = open(filenm, flags, 0666);
|
||||
#endif
|
||||
#ifdef LAT
|
||||
flags |= O_RAW | O_SDN;
|
||||
desc = open(filenm, flags, 0666);
|
||||
#endif
|
||||
#ifdef WIZ
|
||||
flags |= O_BINARY;
|
||||
desc = open(filenm, flags, 0666);
|
||||
#endif
|
||||
return( desc );
|
||||
}
|
||||
/* vpp -nOS2 -dUNIX -nBSD -nVANILLA_BSD -nVMS -nMEMLOCK -nWINDOWS -nFAR_ALLOC -f/usr/users/master/config/nonwin opens.c */
|
||||
81
cde/lib/DtSearch/raima/options.c
Normal file
81
cde/lib/DtSearch/raima/options.c
Normal file
@@ -0,0 +1,81 @@
|
||||
/* $XConsortium: options.c /main/2 1996/05/09 04:13:11 drk $ */
|
||||
/*
|
||||
* COMPONENT_NAME: austext
|
||||
*
|
||||
* FUNCTIONS: d_off_opt
|
||||
* d_on_opt
|
||||
*
|
||||
* ORIGINS: 157
|
||||
*
|
||||
* OBJECT CODE ONLY SOURCE MATERIALS
|
||||
*/
|
||||
/*-----------------------------------------------------------------------
|
||||
options.c -- db_VISTA options module.
|
||||
|
||||
(C) Copyright 1987 by Raima Corporation.
|
||||
-----------------------------------------------------------------------*/
|
||||
#include <stdio.h>
|
||||
#include "vista.h"
|
||||
#include "dbtype.h"
|
||||
|
||||
|
||||
/* Turn on db_VISTA runtime options
|
||||
*/
|
||||
d_on_opt(optflag TASK_PARM)
|
||||
int optflag;
|
||||
TASK_DECL
|
||||
{
|
||||
int i;
|
||||
|
||||
DB_ENTER(NO_DB_ID TASK_ID LOCK_SET(LOCK_ALL));
|
||||
dboptions |= optflag;
|
||||
|
||||
#ifndef NO_TRANS
|
||||
if ( optflag & ARCLOGGING ) d_tron();
|
||||
#endif
|
||||
|
||||
#ifndef NO_COUNTRY
|
||||
if ( optflag & IGNORECASE ) {
|
||||
if ( !db_global.ctbl_activ) {
|
||||
if (ctbl_alloc() != S_OKAY )
|
||||
RETURN (db_status);
|
||||
db_global.ctbl_activ = TRUE;
|
||||
}
|
||||
for ( i = 97; i < 123; i++)
|
||||
/* map lower to upper */
|
||||
db_global.country_tbl.ptr[i].sort_as1 = (char)(i-32);
|
||||
}
|
||||
#endif
|
||||
|
||||
RETURN( db_status = S_OKAY );
|
||||
}
|
||||
|
||||
|
||||
/* Turn off db_VISTA runtime options
|
||||
*/
|
||||
d_off_opt(optflag TASK_PARM)
|
||||
int optflag;
|
||||
TASK_DECL
|
||||
{
|
||||
int i;
|
||||
|
||||
DB_ENTER(NO_DB_ID TASK_ID LOCK_SET(LOCK_ALL));
|
||||
dboptions &= ~optflag;
|
||||
|
||||
#ifndef NO_TRANS
|
||||
if ( optflag & ARCLOGGING ) d_troff();
|
||||
#endif
|
||||
|
||||
#ifndef NO_COUNTRY
|
||||
if ( optflag & IGNORECASE ) {
|
||||
if ( db_global.ctbl_activ) {
|
||||
for ( i = 97; i < 123; i++)
|
||||
/* restore lower to lower */
|
||||
db_global.country_tbl.ptr[i].sort_as1 = (char)i;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
RETURN( db_status = S_OKAY );
|
||||
}
|
||||
/* vpp -nOS2 -dUNIX -nBSD -nVANILLA_BSD -nVMS -nMEMLOCK -nWINDOWS -nFAR_ALLOC -f/usr/users/master/config/nonwin options.c */
|
||||
308
cde/lib/DtSearch/raima/pathfcns.c
Normal file
308
cde/lib/DtSearch/raima/pathfcns.c
Normal file
@@ -0,0 +1,308 @@
|
||||
/* $XConsortium: pathfcns.c /main/2 1996/05/09 04:13:28 drk $ */
|
||||
/*
|
||||
* COMPONENT_NAME: austext
|
||||
*
|
||||
* FUNCTIONS: con_dbd
|
||||
* con_dbf
|
||||
* d_ctbpath
|
||||
* get_element
|
||||
* isabs
|
||||
* remdrv
|
||||
* remfile
|
||||
*
|
||||
* ORIGINS: 157
|
||||
*
|
||||
* OBJECT CODE ONLY SOURCE MATERIALS
|
||||
*/
|
||||
/*-----------------------------------------------------------------------
|
||||
pathfcns.c - Dictionary and file path functions
|
||||
|
||||
This file contains the functions con_dbd and con_dbf which construct
|
||||
the full path for the dictionary and data files. It provides a uniform
|
||||
method of dealing with how to construct the full paths given the schema
|
||||
path, d_open path, and the paths provided in DBDPATH and DBFPATH. This
|
||||
function does not depend upon the runtime and can be included with
|
||||
utilities that do not call the runtime.
|
||||
|
||||
This file also contains the function get_element which extracts a single
|
||||
element out of the possibly multiple-element DBDPATH or DBFPATH. Each
|
||||
element is separated by a semacolon.
|
||||
|
||||
AUTHOR: R.S. Carlson
|
||||
DATE: 08-Jun-88
|
||||
PROJECT: db_VISTA 3.10 enhancements
|
||||
|
||||
Copyright (C) 1988 by Raima Corporation
|
||||
-----------------------------------------------------------------------*/
|
||||
|
||||
/* ********************** EDIT HISTORY *******************************
|
||||
|
||||
SCR DATE INI DESCRIPTION
|
||||
----- --------- --- -----------------------------------------------------
|
||||
16-JUN-88 RSC Cleaned up prototyping (proto.h) and made functions static
|
||||
23-Jun-88 RSC Make const_dbd and const_dbf unique to 7 chars
|
||||
*/
|
||||
|
||||
|
||||
/* ********************** INCLUDE FILES ****************************** */
|
||||
|
||||
#include <stdio.h>
|
||||
#include "vista.h"
|
||||
#include "dbtype.h"
|
||||
|
||||
#ifdef dbdpath
|
||||
#undef dbdpath
|
||||
#endif
|
||||
#ifdef dbfpath
|
||||
#undef dbfpath
|
||||
#endif
|
||||
|
||||
/* ********************** FUNCTION PROTOTYPES ************************ */
|
||||
|
||||
static int isabs(P1(char FAR *));
|
||||
/* TRUE if path is absolute */
|
||||
static char FAR * remdrv(P1(char FAR *));
|
||||
/* Removes drive spec from path */
|
||||
static char FAR * remfile(P1(char FAR *));
|
||||
/* Removes file from path */
|
||||
|
||||
/* ======================================================================
|
||||
Construct the full path to the dictionary.
|
||||
*/
|
||||
int con_dbd(path_str,dbname,dbdpath)
|
||||
char FAR *path_str; /* (output) string to receive the full path to the
|
||||
dictionary */
|
||||
char FAR *dbname; /* contains the filename of the dictionary preceeded
|
||||
optionally by a path preceeded optionally (DOS only)
|
||||
by a drive spec. */
|
||||
char FAR *dbdpath; /* contains one element of the environment variable
|
||||
DBDPATH. NULL means no DBDPATH defined. */
|
||||
{
|
||||
/*
|
||||
RETURNS: db_status, S_OKAY means no errors
|
||||
ASSUMES: That the string dbdpath contains enough room
|
||||
to add a DIRCHAR if it isn't in there.
|
||||
*/
|
||||
|
||||
int i; /* Trusty loop counter / index */
|
||||
|
||||
/* We stop constructing the string when we find an absolute path */
|
||||
if (isabs(dbname)) {
|
||||
strcpy(path_str,dbname);
|
||||
}
|
||||
else {
|
||||
|
||||
/* See if dbdpath was defined. Make sure it ends with a DIRCHAR
|
||||
or ':' */
|
||||
if (dbdpath) {
|
||||
i = strlen(dbdpath);
|
||||
if (dbdpath[i-1] != DIRCHAR && dbdpath[i-1] != ':') {
|
||||
dbdpath[i++] = DIRCHAR;
|
||||
dbdpath[i] = '\0';
|
||||
}
|
||||
if (i >= FILENMLEN - 4) return (db_status = S_NAMELEN);
|
||||
|
||||
/* Now construct the path with dbdpath + dbname */
|
||||
strcpy(path_str,dbdpath);
|
||||
if (strlen(path_str) + strlen(remdrv(dbname)) >= FILENMLEN - 4)
|
||||
return (db_status = S_NAMELEN);
|
||||
strcat(path_str,remdrv(dbname));
|
||||
}
|
||||
else /* dbdpath not defined */
|
||||
strcpy(path_str,dbname);
|
||||
}
|
||||
|
||||
/* Now add the .dbd extension */
|
||||
strcat(path_str,".dbd");
|
||||
return (db_status = S_OKAY);
|
||||
|
||||
}
|
||||
/* ======================================================================
|
||||
Construct full path to data/key files
|
||||
*/
|
||||
int con_dbf(path_str, dbfile, dbname, dbfpath)
|
||||
char FAR *path_str; /* (output) receives full path to dictionary */
|
||||
char FAR *dbfile; /* path to database file (defn in schema) */
|
||||
char FAR *dbname; /* d_open dbname argument - path to dictionary */
|
||||
char FAR *dbfpath; /* one element from DBFPATH, or NULL for no path */
|
||||
{
|
||||
/*
|
||||
RETURNS: db_status, S_OKAY means no error.
|
||||
ASSUMES: None.
|
||||
*/
|
||||
char filespec[FILENMLEN]; /* Scratch work space */
|
||||
int i; /* Trusty loop counter/index */
|
||||
|
||||
/* Stop construction when we get to an absolute path. If we prepend
|
||||
then remove the previous drive specifier */
|
||||
strcpy(path_str,dbfile);
|
||||
if (isabs(dbfile)) return (db_status = S_OKAY);
|
||||
|
||||
/* Add only the drive specification and directory component of the
|
||||
path supplied in dbname */
|
||||
if ((dbname = remfile(dbname)) != NULL) {
|
||||
if (strlen(path_str) + strlen(dbname) >= FILENMLEN)
|
||||
return(db_status = S_NAMELEN);
|
||||
strcpy(filespec,dbname); /* Copy to working space */
|
||||
strcat(filespec,remdrv(path_str));/* Construct dbname + schema */
|
||||
strcpy(path_str,filespec); /* Place in o/p string */
|
||||
if (isabs(dbname)) return (db_status = S_OKAY);
|
||||
}
|
||||
|
||||
/* Now add the path specification from DBFPATH, if defined */
|
||||
if (dbfpath == NULL) return (db_status = S_OKAY);
|
||||
i = strlen(dbfpath); /* Make sure it ends with DIRCHAR */
|
||||
if (dbfpath[i-1] != DIRCHAR && dbfpath[i-1] != ';') {
|
||||
dbfpath[i++] = DIRCHAR;
|
||||
dbfpath[i] = '\0';
|
||||
}
|
||||
if (strlen(path_str) + strlen(dbfpath) >= FILENMLEN)
|
||||
return (db_status = S_NAMELEN);
|
||||
strcpy(filespec,dbfpath);
|
||||
strcat(filespec,remdrv(path_str));
|
||||
strcpy(path_str,filespec);
|
||||
return (db_status = S_OKAY);
|
||||
|
||||
}
|
||||
|
||||
/* ======================================================================
|
||||
extracts a single element from DBxPATH type variables
|
||||
*/
|
||||
char FAR * get_element(dbxpath,num)
|
||||
char FAR *dbxpath; /* DBxPATH, elements separated by semicolons
|
||||
NULL causes get_element to return NULL.
|
||||
A NULL string also causes a NULL return */
|
||||
int num; /* Element to extract (0 = first) */
|
||||
{
|
||||
/*
|
||||
RETURNS: Pointer to string with element. NULL if no such element
|
||||
exists. If there is only one element in the string, then
|
||||
that element is returned regardless of the value of num.
|
||||
ASSUMES: dbxpath cannot exceed FILENMLEN chars.
|
||||
*/
|
||||
|
||||
static char element[FILENMLEN+1]; /* return value */
|
||||
int i;
|
||||
char FAR *save;
|
||||
|
||||
if (dbxpath == NULL) return (NULL);
|
||||
if (dbxpath[0] == '\0') return (NULL); /* NULL string? */
|
||||
strcpy(element,dbxpath);
|
||||
|
||||
/* If there is only one element, always return that */
|
||||
if (strchr(element,';') == NULL) {
|
||||
i = strlen(element);
|
||||
if (element[i-1] != DIRCHAR && element[i-1] != ':') {
|
||||
element[i++] = DIRCHAR;
|
||||
element[i] = '\0';
|
||||
}
|
||||
return (element);
|
||||
}
|
||||
|
||||
/* There are multiple elements - return the one requested */
|
||||
dbxpath = element - 1;
|
||||
for (i=0; i<num; i++)
|
||||
if ((dbxpath = strchr(dbxpath+1,';')) == NULL) return (NULL);
|
||||
dbxpath++;
|
||||
if ((save = strchr(dbxpath+1,';')) != NULL) *save = '\0';
|
||||
i = (dbxpath - (char FAR *)element) + strlen((CONST char FAR *)dbxpath);
|
||||
if (element[i-1] != DIRCHAR && element[i-1] != ':') {
|
||||
element[i++] = DIRCHAR;
|
||||
element[i] = '\0';
|
||||
}
|
||||
return (dbxpath);
|
||||
}
|
||||
|
||||
/* ======================================================================
|
||||
Returns TRUE of path is absolute
|
||||
*/
|
||||
static int isabs(path_str)
|
||||
char FAR *path_str; /* path to test, NULL causes iabs to return FALSE */
|
||||
{
|
||||
/*
|
||||
RETURNS: TRUE if path is absolute
|
||||
ASSUMES: None.
|
||||
*/
|
||||
char FAR *path; /* Points to path w/o drive spec */
|
||||
|
||||
if (path_str == NULL) return (FALSE);
|
||||
path = remdrv(path_str);
|
||||
if (path[0] != DIRCHAR) return (FALSE);
|
||||
return (TRUE);
|
||||
}
|
||||
|
||||
/* ======================================================================
|
||||
Removes drive specifier from path
|
||||
*/
|
||||
static char FAR * remdrv(path_str)
|
||||
char FAR *path_str; /* path to remove drive from */
|
||||
{
|
||||
/*
|
||||
RETURNS: Pointer to string w/o drive specification. Note that
|
||||
this simply points further into path_str.
|
||||
ASSUMES: None.
|
||||
*/
|
||||
char FAR *path; /* Return value */
|
||||
|
||||
if ((path = strrchr(path_str,':')) == NULL) return (path_str);
|
||||
return (path+1);
|
||||
}
|
||||
|
||||
/* ======================================================================
|
||||
Removes file from a path.
|
||||
*/
|
||||
static char FAR * remfile(path_str)
|
||||
char FAR *path_str; /* Path to remove filename from */
|
||||
{
|
||||
/*
|
||||
RETURNS: Pointer to the path with the filename removed (a static
|
||||
string declared within remfile). If there is no filename
|
||||
(only a directory or drive spec), remfile will return
|
||||
NULL. The returned string will end with a DIRCHAR
|
||||
ASSUMES: path_str cannot exceed FILENMLEN characters.
|
||||
*/
|
||||
static char dirpath[FILENMLEN]; /* Return value */
|
||||
|
||||
/* There is only a filename if string does not contain a DIRCHAR or
|
||||
':' which separates drive spec from path. */
|
||||
if (path_str == NULL) return (NULL);
|
||||
strcpy(dirpath,path_str); /* Copy into output string */
|
||||
if ((path_str = strrchr(dirpath,DIRCHAR)) == NULL)
|
||||
if ((path_str = strrchr(dirpath,':')) == NULL) return (NULL);
|
||||
path_str[1] = '\0'; /* Truncate string */
|
||||
return (dirpath);
|
||||
}
|
||||
|
||||
#ifndef NO_COUNTRY
|
||||
/* Set Country Table path
|
||||
*/
|
||||
int d_ctbpath(ctb TASK_PARM)
|
||||
CONST char FAR *ctb;
|
||||
TASK_DECL
|
||||
{
|
||||
int i;
|
||||
|
||||
DB_ENTER(NO_DB_ID TASK_ID LOCK_SET(LOCK_NONE));
|
||||
|
||||
if ( dbopen )
|
||||
dberr(S_DBOPEN);
|
||||
else {
|
||||
strncpy(db_global.ctbpath, ctb, FILENMLEN - 1);
|
||||
db_global.ctbpath[FILENMLEN - 1] = '\0';
|
||||
if ( db_global.ctbpath[0] ) {
|
||||
i = strlen(db_global.ctbpath);
|
||||
if ( db_global.ctbpath[i-1] != DIRCHAR &&
|
||||
db_global.ctbpath[i-1] != ':' ) {
|
||||
db_global.ctbpath[i++] = DIRCHAR;
|
||||
db_global.ctbpath[i] = '\0';
|
||||
}
|
||||
if ( i >= FILENMLEN-1 ) RETURN( dberr(S_NAMELEN) );
|
||||
}
|
||||
|
||||
db_status = S_OKAY;
|
||||
}
|
||||
|
||||
RETURN( db_status );
|
||||
}
|
||||
#endif
|
||||
/* vpp -nOS2 -dUNIX -nBSD -nVANILLA_BSD -nVMS -nMEMLOCK -nWINDOWS -nFAR_ALLOC -f/usr/users/master/config/nonwin pathfcns.c */
|
||||
325
cde/lib/DtSearch/raima/proto.h
Normal file
325
cde/lib/DtSearch/raima/proto.h
Normal file
@@ -0,0 +1,325 @@
|
||||
/* $TOG: proto.h /main/5 1998/03/19 19:00:54 mgreess $ */
|
||||
/*
|
||||
* COMPONENT_NAME: austext
|
||||
*
|
||||
* FUNCTIONS: ADDRcmp
|
||||
* ALLOC_TABLE
|
||||
* INTcmp
|
||||
* Pi
|
||||
* alloc_table
|
||||
* check_dba
|
||||
* close
|
||||
* con_dbd
|
||||
* con_dbf
|
||||
* dbn_check
|
||||
* dio_close
|
||||
* dio_clrfile
|
||||
* dio_findpg
|
||||
* dio_get
|
||||
* dio_open
|
||||
* dio_out
|
||||
* dio_pzalloc
|
||||
* dio_pzdel
|
||||
* dio_pzgetts
|
||||
* dio_pznext
|
||||
* dio_pzread
|
||||
* dio_pzsetts
|
||||
* dio_read
|
||||
* dio_release
|
||||
* dio_rrlb
|
||||
* dio_setdef
|
||||
* dio_touch
|
||||
* dio_write
|
||||
* dio_wrlb
|
||||
* exit
|
||||
* fldcmp
|
||||
* free
|
||||
* get_element
|
||||
* getenv
|
||||
* initdbt
|
||||
* key_bldcom
|
||||
* key_boundary
|
||||
* key_cmpcpy
|
||||
* key_delete
|
||||
* key_init
|
||||
* key_insert
|
||||
* key_locpos
|
||||
* key_reset
|
||||
* key_scan
|
||||
* locking
|
||||
* lseek
|
||||
* memcmp
|
||||
* memcpy
|
||||
* memset
|
||||
* nfld_check
|
||||
* nrec_check
|
||||
* nset_check
|
||||
* null_dba
|
||||
* nw_addnm
|
||||
* nw_call
|
||||
* nw_cleanup
|
||||
* nw_delnm
|
||||
* nw_hangup
|
||||
* nw_rcvmsg
|
||||
* nw_reset
|
||||
* nw_send
|
||||
* o_fileinit
|
||||
* o_pages
|
||||
* o_pzwrite
|
||||
* o_search
|
||||
* o_write
|
||||
* open_b
|
||||
* r_chkfld
|
||||
* r_clropt
|
||||
* r_delrec
|
||||
* r_gfld
|
||||
* r_gmem
|
||||
* r_gset
|
||||
* r_pfld
|
||||
* r_pmem
|
||||
* r_pset
|
||||
* r_setopt
|
||||
* r_smem
|
||||
* r_tstopt
|
||||
* read
|
||||
* startup
|
||||
* strcat
|
||||
* strchr
|
||||
* strcmp
|
||||
* strcpy
|
||||
* strlen
|
||||
* strncmp
|
||||
* strncpy
|
||||
* strrchr
|
||||
* taf_add
|
||||
* taf_del
|
||||
* task_switch
|
||||
* taskinit
|
||||
* time
|
||||
* unlink
|
||||
* write
|
||||
*
|
||||
* ORIGINS: 157
|
||||
*
|
||||
*/
|
||||
/*----------------------------------------------------------------------------
|
||||
proto.h: db_VISTA function declaration header file
|
||||
|
||||
(This file must be included after dbtype.h)
|
||||
|
||||
(C) Copyright 1988 by Raima Corporation.
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/* ********************** EDIT HISTORY *******************************
|
||||
|
||||
SCR DATE INI DESCRIPTION
|
||||
----- --------- --- -----------------------------------------------------
|
||||
03-AUG-88 RTK Added internal MULTI_TASKing function prototypes
|
||||
310 10-Aug-88 RSC Cleanup of function prototypes
|
||||
|
||||
*/
|
||||
|
||||
/* From dberr.c: */
|
||||
void dbautorec(P0);
|
||||
|
||||
/* From dblfcns.c: */
|
||||
int taskinit(P1(TASK FAR *));
|
||||
int initdbt(P1(CONST char FAR *));
|
||||
int alloc_table(P1(CHAR_P FAR *) Pi(unsigned) Pi(unsigned));
|
||||
#define ALLOC_TABLE(t, n, o, v) alloc_table((CHAR_P FAR *)(t), n, o)
|
||||
#ifndef SINGLE_USER
|
||||
int termses(P0);
|
||||
#endif
|
||||
void termfree(P0);
|
||||
#ifndef SINGLE_USER
|
||||
int neterr(P0);
|
||||
#endif
|
||||
|
||||
/* From dio.c: */
|
||||
int dio_open(P1(FILE_NO));
|
||||
int dio_close(P1(FILE_NO));
|
||||
int dio_init(P0);
|
||||
void dio_free(P0);
|
||||
int dio_clrfile(P1(FILE_NO));
|
||||
int dio_clear(P0);
|
||||
int dio_flush(P0);
|
||||
void dio_setdef(P1(FILE_NO));
|
||||
int dio_get(P1(F_ADDR) Pi(char FAR * FAR *) Pi(int));
|
||||
int dio_touch(P1(F_ADDR));
|
||||
int dio_read(P1(DB_ADDR) Pi(char FAR * FAR *) Pi(int));
|
||||
int dio_write(P1(DB_ADDR) Pi(CONST char FAR *) Pi(int));
|
||||
int dio_release(P1(DB_ADDR));
|
||||
int dio_rrlb(P1(DB_ADDR) Pi(INT *));
|
||||
int dio_wrlb(P1(DB_ADDR) Pi(INT));
|
||||
int dio_findpg(P1(FILE_NO) Pi(F_ADDR) Pi(PAGE_ENTRY FAR *)
|
||||
Pi(PAGE_ENTRY FAR * FAR *)
|
||||
Pi(LOOKUP_ENTRY FAR * FAR *));
|
||||
#ifdef NO_TRANS
|
||||
int dio_out(P1(PAGE_ENTRY FAR *) Pi(LOOKUP_ENTRY FAR *));
|
||||
#else
|
||||
int dio_out(P1(PAGE_ENTRY FAR *) Pi(LOOKUP_ENTRY FAR *)
|
||||
Pi(BOOLEAN));
|
||||
#endif
|
||||
#ifndef NO_TIMESTAMP
|
||||
ULONG dio_pzsetts(P1(FILE_NO));
|
||||
ULONG dio_pzgetts(P1(FILE_NO));
|
||||
#endif
|
||||
int dio_pzread(P1(FILE_NO));
|
||||
int dio_pzalloc(P1(FILE_NO) Pi(F_ADDR *));
|
||||
int dio_pzdel(P1(FILE_NO) Pi(F_ADDR));
|
||||
F_ADDR dio_pznext(P1(FILE_NO));
|
||||
void dio_pzclr(P0);
|
||||
|
||||
/* From initenv.c: */
|
||||
int initenv(P0);
|
||||
|
||||
/* From inittab.c: */
|
||||
int inittab(P0);
|
||||
|
||||
/* From keyfcns.c: */
|
||||
int key_open(P0);
|
||||
void key_close(P0);
|
||||
int key_init(P1(int));
|
||||
int key_reset(P1(FILE_NO));
|
||||
int key_locpos(P1(CONST char FAR *) Pi(DB_ADDR FAR *));
|
||||
int key_scan(P1(int) Pi(DB_ADDR *));
|
||||
int key_boundary(P1(int) Pi(DB_ADDR *));
|
||||
int key_insert(P1(int) Pi(CONST char FAR *) Pi(DB_ADDR));
|
||||
int key_delete(P1(int) Pi(CONST char FAR *) Pi(DB_ADDR));
|
||||
/* Due to a problem with MSC 5.1, we couldn't declare the 2nd parm
|
||||
of key_bldcom as const (see keyfcns.c) */
|
||||
int key_bldcom(P1(int) Pi(char FAR *) Pi(char FAR *) Pi(int));
|
||||
/* Because of a "problem" with the MSC 5.1 compiler, we couldn't declare
|
||||
the second argument to key_cmpcpy with a const attribute. Hence we
|
||||
were not able to define the 2nd argument of key_bldcom as const. */
|
||||
void key_cmpcpy(P1(char FAR *) Pi(char FAR *) Pi(INT));
|
||||
|
||||
/* From libfcns.c: */
|
||||
#ifndef ONE_DB
|
||||
int dbn_check(P1(int));
|
||||
#endif
|
||||
int nset_check(P1(int) Pi(int *) Pi(SET_ENTRY FAR * FAR *));
|
||||
int nfld_check(P1(long) Pi(int *) Pi(int *)
|
||||
Pi(RECORD_ENTRY FAR * FAR *)
|
||||
Pi(FIELD_ENTRY FAR * FAR *));
|
||||
int nrec_check(P1(int) Pi(int *) Pi(RECORD_ENTRY FAR * FAR *));
|
||||
int fldcmp(P1(FIELD_ENTRY FAR *) Pi(CONST char FAR *)
|
||||
Pi(CONST char FAR *));
|
||||
int INTcmp(P1(CONST char FAR *) Pi(CONST char FAR *));
|
||||
int ADDRcmp(P1(CONST DB_ADDR FAR *) Pi(CONST DB_ADDR FAR *));
|
||||
int null_dba(P1(CONST char FAR *));
|
||||
int check_dba(P1(DB_ADDR));
|
||||
|
||||
/* From makenew.c: */
|
||||
int sk_free(P0);
|
||||
|
||||
/* From netwdos.c: */
|
||||
int netbios_chk(P0);
|
||||
int nw_reset(P1(int) Pi(int));
|
||||
int nw_addnm(P1(char FAR *) Pi(int *));
|
||||
int nw_cleanup(P1(char FAR *));
|
||||
int nw_sestat(P0);
|
||||
int nw_delnm(P1(char FAR *));
|
||||
int nw_call(P1(char FAR *) Pi(char FAR *) Pi(int *));
|
||||
int nw_hangup(P1(int));
|
||||
int nw_send(P1(int) Pi(MESSAGE FAR *) Pi(int));
|
||||
int nw_rcvmsg(P1(int) Pi(MESSAGE FAR *) Pi(int) Pi(int *));
|
||||
|
||||
/* From opens.c: */
|
||||
int open_b(P1(CONST char FAR *) Pi(int));
|
||||
|
||||
/* From ovfcns.c: */
|
||||
int o_setup(P0);
|
||||
int o_init(P0);
|
||||
int o_fileinit(P1(FILE_NO));
|
||||
int o_search(P1(FILE_NO) Pi(F_ADDR) Pi(F_ADDR *));
|
||||
int o_write(P1(PAGE_ENTRY FAR *) Pi(LOOKUP_ENTRY FAR *));
|
||||
int o_pzwrite(P1(FILE_NO));
|
||||
int o_flush(P0);
|
||||
int o_update(P0);
|
||||
long o_pages(P1(FILE_NO));
|
||||
void o_free(P0);
|
||||
|
||||
/* From recfcns.c: */
|
||||
int r_chkfld(P1(INT) Pi(FIELD_ENTRY FAR *) Pi(char FAR *)
|
||||
Pi(CONST char FAR *));
|
||||
int r_delrec(P1(INT) Pi(DB_ADDR));
|
||||
int r_gfld(P1(FIELD_ENTRY FAR *) Pi(char FAR *) Pi(char FAR *));
|
||||
int r_gmem(P1(int) Pi(char FAR *) Pi(char FAR *));
|
||||
int r_gset(P1(int) Pi(char FAR *) Pi(char FAR *));
|
||||
int r_pfld(P1(INT) Pi(FIELD_ENTRY FAR *) Pi(char FAR *)
|
||||
Pi(CONST char FAR *) Pi(DB_ADDR FAR *));
|
||||
int r_pmem(P1(int) Pi(char FAR *) Pi(char FAR *));
|
||||
int r_pset(P1(int) Pi(char FAR *) Pi(char FAR *));
|
||||
int r_smem(P1(DB_ADDR FAR *) Pi(INT));
|
||||
int r_setopt(P1(FIELD_ENTRY FAR *) Pi(char FAR *));
|
||||
int r_clropt(P1(FIELD_ENTRY FAR *) Pi(char FAR *));
|
||||
int r_tstopt(P1(FIELD_ENTRY FAR *) Pi(char FAR *));
|
||||
|
||||
/* From pathfcns.c */
|
||||
int con_dbd(P1(char FAR *) Pi(char FAR *) Pi(char FAR *));
|
||||
int con_dbf(P1(char FAR *) Pi(char FAR *) Pi(char FAR *)
|
||||
Pi(char FAR *));
|
||||
char FAR * get_element(P1(char FAR *) Pi(int));
|
||||
|
||||
/* From renfile.c: */
|
||||
int renfiles(P0);
|
||||
|
||||
/* From startup.c: */
|
||||
#ifndef NO_DBN_PARM
|
||||
int startup(DBN_FIX_D1 TASK_PTR_Di LOCK_Di);
|
||||
#else
|
||||
#ifdef MULTI_TASK
|
||||
int startup(TASK_PTR_D1 LOCK_Di);
|
||||
#else
|
||||
#define startup() S_OKAY
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/* From taffcns.c: */
|
||||
int taf_open(P0);
|
||||
int taf_close(P0);
|
||||
int taf_access(P0);
|
||||
int taf_release(P0);
|
||||
int taf_add(P1(CONST char FAR *));
|
||||
int taf_del(P1(CONST char FAR *) );
|
||||
|
||||
/* From task.c */
|
||||
#ifdef MULTI_TASK
|
||||
void task_switch(P1(DB_TASK FAR *));
|
||||
#endif
|
||||
|
||||
/* From mapchar.c */
|
||||
int ctb_init(P0);
|
||||
int ctbl_alloc(P0);
|
||||
void ctbl_free(P0);
|
||||
|
||||
/* System functions */
|
||||
#ifndef _STRING_H
|
||||
#ifndef linux
|
||||
void CDECL memcpy(P1(char *) Pi(char *) Pi(int));
|
||||
#endif
|
||||
int CDECL memcmp(P1(char *) Pi(char *) Pi(int));
|
||||
void CDECL memset(P1(char *) Pi(char) Pi(int));
|
||||
|
||||
int CDECL strcmp(P1(CONST char *) Pi(CONST char *));
|
||||
char * CDECL strcpy(P1(char *) Pi(CONST char *));
|
||||
char * CDECL strcat(P1(char *) Pi(CONST char *));
|
||||
int CDECL strlen(P1(CONST char *));
|
||||
int CDECL strncmp(P1(CONST char *) Pi(CONST char *) Pi(int));
|
||||
char * CDECL strncpy(P1(char *) Pi(CONST char *) Pi(int));
|
||||
char * CDECL strchr(P1(CONST char *) Pi(int));
|
||||
char * CDECL strrchr(P1(CONST char *) Pi(int));
|
||||
#endif
|
||||
|
||||
void CDECL free(P1(void FAR *)); /* AIXV3 - DPG 07/05/90 */
|
||||
time_t CDECL time(P1(long *));
|
||||
int CDECL write(P1(int) Pi(char *) Pi(unsigned int));
|
||||
int CDECL read(P1(int) Pi(char *) Pi(unsigned int));
|
||||
long CDECL lseek(P1(int) Pi(long) Pi(int));
|
||||
int CDECL close(P1(int));
|
||||
void CDECL exit(P1(int));
|
||||
char * CDECL getenv(P1(CONST char *));
|
||||
int CDECL locking(P1(int) Pi(int) Pi(long));
|
||||
int CDECL unlink(P1(CONST char *));
|
||||
/* vpp -nOS2 -dUNIX -nBSD -nVANILLA_BSD -nVMS -nMEMLOCK -nWINDOWS -nFAR_ALLOC -f/usr/users/master/config/nonwin proto.h */
|
||||
588
cde/lib/DtSearch/raima/recfcns.c
Normal file
588
cde/lib/DtSearch/raima/recfcns.c
Normal file
@@ -0,0 +1,588 @@
|
||||
/* $XConsortium: recfcns.c /main/2 1996/05/09 04:13:59 drk $ */
|
||||
/*
|
||||
* COMPONENT_NAME: austext
|
||||
*
|
||||
* FUNCTIONS: r_chkfld
|
||||
* r_clropt
|
||||
* r_delrec
|
||||
* r_gfld
|
||||
* r_gmem
|
||||
* r_gset
|
||||
* r_pfld
|
||||
* r_pmem
|
||||
* r_pset
|
||||
* r_setopt
|
||||
* r_smem
|
||||
* r_tstopt
|
||||
*
|
||||
* ORIGINS: 157
|
||||
*
|
||||
* OBJECT CODE ONLY SOURCE MATERIALS
|
||||
*/
|
||||
/*---------------------------------------------------------------------------
|
||||
recfcns.c - db_VISTA Record Access/Manipulation Functions
|
||||
|
||||
Copyright (C) 1984, 1985, 1986 by Raima Corporation.
|
||||
---------------------------------------------------------------------------*/
|
||||
|
||||
/* ********************** EDIT HISTORY *******************************
|
||||
|
||||
SCR DATE INI DESCRIPTION
|
||||
----- --------- --- -----------------------------------------------------
|
||||
158 15-JUN-88 RSC passed new flag to key_bldcom.
|
||||
103 27-Jun-88 RSC Improve generation of single user version
|
||||
04-Aug-88 RTK MULTI_TASK changes
|
||||
310 10-Aug-88 RSC Cleanup function prototype.
|
||||
420 16-Aug-88 RTK Missing FAR pointer
|
||||
|
||||
*/
|
||||
#include <stdio.h>
|
||||
#include "vista.h"
|
||||
#include "dbtype.h"
|
||||
|
||||
#define FALSE 0
|
||||
#define TRUE 1
|
||||
|
||||
/* toggle for checking struct key modifications */
|
||||
static int struct_key_chk = 1;
|
||||
|
||||
/* Check a field for permission to change it
|
||||
*/
|
||||
r_chkfld(field, fld_ptr, rec, data )
|
||||
INT field; /* field_table entry number */
|
||||
FIELD_ENTRY FAR *fld_ptr; /* corresponds to field */
|
||||
char FAR *rec; /* pointer to record slot */
|
||||
CONST char FAR *data; /* pointer to data area containing field contents */
|
||||
{
|
||||
DB_ADDR dba;
|
||||
long fld;
|
||||
INT rn;
|
||||
char FAR *fptr, ckey[256];
|
||||
int i;
|
||||
FIELD_ENTRY FAR *sfld_ptr;
|
||||
RECORD_ENTRY FAR *rec_ptr;
|
||||
|
||||
bytecpy(&rn, rec, sizeof(INT));
|
||||
rn &= ~RLBMASK; /* mask off rlb */
|
||||
if ( rn != NUM2EXT(fld_ptr->fd_rec, rt_offset) )
|
||||
return( dberr(S_INVFLD) );
|
||||
|
||||
rec_ptr = &record_table[fld_ptr->fd_rec];
|
||||
fld = FLDMARK*rn + field - rec_ptr->rt_fields;
|
||||
|
||||
if ( fld_ptr->fd_type == COMKEY ) {
|
||||
|
||||
/* build compound key value. NOTE: cflag MUST be the same here as for
|
||||
the call to key_bldcom in recwrite, which calls this function. */
|
||||
fptr = rec + rec_ptr->rt_data;
|
||||
key_bldcom(field, fptr, ckey, FALSE);
|
||||
fptr = ckey;
|
||||
}
|
||||
else
|
||||
fptr = rec + fld_ptr->fd_ptr;
|
||||
|
||||
/* do nothing unless the new value is different */
|
||||
if (fldcmp(fld_ptr, data, fptr) == 0)
|
||||
return( db_status = S_OKAY );
|
||||
|
||||
/* if this is a unique key field, make sure the key does not already
|
||||
exist
|
||||
*/
|
||||
if ( fld_ptr->fd_key == UNIQUE ) {
|
||||
dba = curr_rec;
|
||||
/* If the key field is not optional, or optional and stored */
|
||||
if ((!(fld_ptr->fd_flags & OPTKEYMASK) || r_tstopt(fld_ptr, rec)) &&
|
||||
(d_keyfind(fld, data CURRTASK_PARM CURR_DB_PARM) == S_OKAY)) {
|
||||
/* another record is already using this key value */
|
||||
db_status = S_DUPLICATE;
|
||||
}
|
||||
curr_rec = dba;
|
||||
if ( db_status == S_DUPLICATE ) return( db_status );
|
||||
}
|
||||
/* if field is grouped, call r_chkfld for 1st entry of each sub-field */
|
||||
if ( fld_ptr->fd_type == GROUPED ) {
|
||||
for (i = field + 1, sfld_ptr = fld_ptr + 1;
|
||||
(i < size_fd) && (sfld_ptr->fd_flags & STRUCTFLD);
|
||||
++i, ++sfld_ptr) {
|
||||
fptr = (char *)data - (sfld_ptr->fd_ptr -
|
||||
record_table[sfld_ptr->fd_rec].rt_data);
|
||||
if (r_chkfld(i, sfld_ptr, rec, fptr) != S_OKAY)
|
||||
return( db_status );
|
||||
}
|
||||
}
|
||||
return( db_status = S_OKAY );
|
||||
}
|
||||
|
||||
|
||||
/* Delete the current record
|
||||
*/
|
||||
r_delrec( rt, db_addr )
|
||||
INT rt;
|
||||
DB_ADDR db_addr;
|
||||
{
|
||||
char FAR *rec; /* ptr to record slot */
|
||||
char FAR *fptr; /* field data ptr */
|
||||
char ckey[256]; /* compound key data */
|
||||
#ifndef NO_TIMESTAMP
|
||||
ULONG timestamp;
|
||||
#endif
|
||||
FILE_NO fno;
|
||||
F_ADDR rno;
|
||||
register int fld;
|
||||
RECORD_ENTRY FAR *rec_ptr;
|
||||
register FIELD_ENTRY FAR *fld_ptr;
|
||||
|
||||
if ( dio_read( db_addr, (char FAR * FAR *)&rec, PGHOLD) != S_OKAY )
|
||||
return( db_status );
|
||||
|
||||
rec_ptr = &record_table[rt];
|
||||
/* remove any key fields from the key files */
|
||||
for (fld = rec_ptr->rt_fields, fld_ptr = &field_table[fld];
|
||||
(fld < size_fd) && (fld_ptr->fd_rec == rt);
|
||||
++fld, ++fld_ptr) {
|
||||
if ( fld_ptr->fd_key != NOKEY ) {
|
||||
if ( fld_ptr->fd_type == COMKEY ) {
|
||||
key_bldcom(fld, rec + rec_ptr->rt_data, ckey, TRUE);
|
||||
fptr = ckey;
|
||||
}
|
||||
else {
|
||||
fptr = rec + fld_ptr->fd_ptr;
|
||||
}
|
||||
/* delete the key if it exists */
|
||||
if ((!(fld_ptr->fd_flags & OPTKEYMASK) || r_tstopt(fld_ptr, rec)) &&
|
||||
(key_delete(fld, fptr, db_addr) != S_OKAY))
|
||||
return( db_status );
|
||||
}
|
||||
}
|
||||
fno = NUM2INT((FILE_NO)((db_addr >> FILESHIFT) & FILEMASK), ft_offset);
|
||||
rno = ADDRMASK & db_addr;
|
||||
#ifndef NO_TIMESTAMP
|
||||
/* update timestamp, if necessary */
|
||||
if ( rec_ptr->rt_flags & TIMESTAMPED ) {
|
||||
timestamp = dio_pzgetts(fno);
|
||||
bytecpy( rec + RECCRTIME, ×tamp, sizeof(ULONG));
|
||||
bytecpy( rec + RECUPTIME, ×tamp, sizeof(ULONG));
|
||||
}
|
||||
#endif
|
||||
dio_write(db_addr, NULL, PGFREE);
|
||||
|
||||
/* place this record onto the delete chain */
|
||||
dio_pzdel(fno, rno);
|
||||
|
||||
return( db_status );
|
||||
}
|
||||
|
||||
|
||||
/* Get data field from record
|
||||
*/
|
||||
r_gfld(fld_ptr, rec, data )
|
||||
FIELD_ENTRY FAR *fld_ptr;
|
||||
char FAR *rec; /* pointer to record */
|
||||
char FAR *data; /* pointer to data area to contain field contents */
|
||||
{
|
||||
register int kt_lc; /* loop control */
|
||||
INT rn;
|
||||
register FIELD_ENTRY FAR *kfld_ptr;
|
||||
register KEY_ENTRY FAR *key_ptr;
|
||||
|
||||
bytecpy(&rn, rec, sizeof(INT));
|
||||
if ( rn < 0 )
|
||||
return( db_status = S_DELETED );
|
||||
|
||||
#ifndef SINGLE_USER
|
||||
if ( rn & RLBMASK ) {
|
||||
rn &= ~RLBMASK; /* mask off rlb */
|
||||
rlb_status = S_LOCKED;
|
||||
}
|
||||
else {
|
||||
rlb_status = S_UNLOCKED;
|
||||
}
|
||||
#endif
|
||||
#ifndef ONE_DB
|
||||
rn += curr_db_table->rt_offset;
|
||||
#endif
|
||||
|
||||
if ( fld_ptr->fd_rec != rn )
|
||||
return( dberr(S_INVFLD) );
|
||||
|
||||
if ( fld_ptr->fd_type == KEY ) {
|
||||
/* clear compound key data area */
|
||||
byteset(data, '\0', fld_ptr->fd_len);
|
||||
|
||||
/* copy each field of compound key to data area */
|
||||
for (kt_lc = size_kt - fld_ptr->fd_ptr,
|
||||
key_ptr = &key_table[fld_ptr->fd_ptr];
|
||||
(--kt_lc >= 0) && (&field_table[key_ptr->kt_key] == fld_ptr);
|
||||
++key_ptr) {
|
||||
kfld_ptr = &field_table[key_ptr->kt_field];
|
||||
bytecpy(data + key_ptr->kt_ptr, rec + kfld_ptr->fd_ptr,
|
||||
kfld_ptr->fd_len);
|
||||
}
|
||||
}
|
||||
else {
|
||||
bytecpy(data, rec + fld_ptr->fd_ptr, fld_ptr->fd_len);
|
||||
}
|
||||
return( db_status = S_OKAY );
|
||||
}
|
||||
|
||||
|
||||
/* Get member pointer from record
|
||||
*/
|
||||
r_gmem(set, rec, mem_addr )
|
||||
int set; /* set table entry number */
|
||||
char FAR *rec; /* pointer to record */
|
||||
char FAR *mem_addr; /* pointer to member pointer */
|
||||
{
|
||||
INT rt;
|
||||
register int mem, memtot;
|
||||
SET_ENTRY FAR *set_ptr;
|
||||
register MEMBER_ENTRY FAR *mem_ptr;
|
||||
|
||||
/* search member list of set for record */
|
||||
set_ptr = &set_table[set];
|
||||
bytecpy(&rt, rec, sizeof(INT));
|
||||
rt &= ~RLBMASK;
|
||||
for (mem = set_ptr->st_members, memtot = mem + set_ptr->st_memtot,
|
||||
mem_ptr = &member_table[mem];
|
||||
mem < memtot;
|
||||
++mem, ++mem_ptr) {
|
||||
if (NUM2EXT(mem_ptr->mt_record, rt_offset) == rt) {
|
||||
/* have found correct member record */
|
||||
bytecpy(mem_addr, rec + mem_ptr->mt_mem_ptr, MEMPSIZE);
|
||||
return( db_status = S_OKAY );
|
||||
}
|
||||
}
|
||||
/* this record is not member of set */
|
||||
return( dberr(S_INVMEM) );
|
||||
}
|
||||
|
||||
|
||||
/* Get set pointer from record
|
||||
*/
|
||||
r_gset(set, rec, setptr )
|
||||
int set; /* set table entry number */
|
||||
char FAR *rec; /* pointer to record */
|
||||
char FAR *setptr; /* pointer to set pointer */
|
||||
{
|
||||
INT rt;
|
||||
int len;
|
||||
SET_ENTRY FAR *set_ptr;
|
||||
|
||||
set_ptr = &set_table[set];
|
||||
bytecpy(&rt, rec, sizeof(INT));
|
||||
if (NUM2EXT(set_ptr->st_own_rt, rt_offset) == (rt & ~RLBMASK)) {
|
||||
#ifndef NO_TIMESTAMP
|
||||
if ( set_ptr->st_flags & TIMESTAMPED )
|
||||
len = SETPSIZE;
|
||||
else
|
||||
#endif
|
||||
len = SETPSIZE - sizeof(ULONG);
|
||||
bytecpy(setptr, rec + set_ptr->st_own_ptr, len);
|
||||
return( db_status = S_OKAY );
|
||||
}
|
||||
return( dberr(S_INVOWN) );
|
||||
}
|
||||
|
||||
|
||||
/* Put data field into record
|
||||
*/
|
||||
r_pfld(field, fld_ptr, rec, data, db_addr )
|
||||
INT field; /* field_table entry number */
|
||||
FIELD_ENTRY FAR *fld_ptr; /* corresponds to field */
|
||||
char FAR *rec; /* pointer to existing record */
|
||||
CONST char FAR *data; /* pointer to data area containing new field contents */
|
||||
DB_ADDR FAR *db_addr;
|
||||
{
|
||||
DB_ADDR mdba, odba, dba;
|
||||
int set, sn;
|
||||
char memp[MEMPSIZE];
|
||||
register char FAR *fptr;
|
||||
register CONST char FAR *tfptr;
|
||||
register int s, i, strfld;
|
||||
register FIELD_ENTRY FAR *sfld_ptr;
|
||||
register SORT_ENTRY FAR *srt_ptr;
|
||||
DB_ADDR FAR *co_ptr, FAR *cm_ptr;
|
||||
|
||||
db_status = S_OKAY;
|
||||
fptr = rec + fld_ptr->fd_ptr;
|
||||
|
||||
/* do nothing unless the new value is different */
|
||||
if (fldcmp(fld_ptr, fptr, data) == 0)
|
||||
return( db_status );
|
||||
|
||||
bytecpy(&dba, db_addr, DB_ADDR_SIZE);
|
||||
|
||||
/* if this is a key field, change the key file also */
|
||||
if ((fld_ptr->fd_key != NOKEY) &&
|
||||
(!(fld_ptr->fd_flags & OPTKEYMASK) || r_tstopt(fld_ptr, rec))) {
|
||||
/* delete the old key and insert the new one */
|
||||
if ( key_delete(field, fptr, dba) == S_OKAY ) {
|
||||
if ( key_insert( field, data, dba ) != S_OKAY )
|
||||
return( db_status );
|
||||
}
|
||||
else
|
||||
return( db_status == S_NOTFOUND? dberr(S_KEYERR): db_status );
|
||||
}
|
||||
/* if subfield of struct field, check to see if struct is a key */
|
||||
if ( struct_key_chk && fld_ptr->fd_flags & STRUCTFLD ) {
|
||||
for (strfld = field - 1, sfld_ptr = &field_table[strfld];
|
||||
sfld_ptr->fd_type != GROUPED;
|
||||
--strfld, --sfld_ptr)
|
||||
; /* find struct field */
|
||||
if ((sfld_ptr->fd_key != NOKEY) &&
|
||||
/* make sure it is stored */
|
||||
(!(sfld_ptr->fd_flags & OPTKEYMASK) || r_tstopt(sfld_ptr, rec))) {
|
||||
/* delete the old struct key */
|
||||
if (key_delete(strfld, rec + sfld_ptr->fd_ptr, dba) != S_OKAY)
|
||||
return( db_status );
|
||||
}
|
||||
else strfld = -1;
|
||||
}
|
||||
else strfld = -1;
|
||||
|
||||
/* copy data into record area */
|
||||
switch ( fld_ptr->fd_type ) {
|
||||
case CHARACTER:
|
||||
if ( fld_ptr->fd_dim[1] )
|
||||
bytecpy(fptr, data, fld_ptr->fd_len);
|
||||
else if ( fld_ptr->fd_dim[0] )
|
||||
strncpy(fptr, data, fld_ptr->fd_len);
|
||||
else
|
||||
*fptr = *data;
|
||||
break;
|
||||
case GROUPED:
|
||||
if ( ! fld_ptr->fd_dim[0] ) {
|
||||
/* non-arrayed structure */
|
||||
struct_key_chk = 0;
|
||||
for (i = field + 1, sfld_ptr = fld_ptr + 1;
|
||||
(i < size_fd) && (sfld_ptr->fd_flags & STRUCTFLD);
|
||||
++i, ++sfld_ptr) {
|
||||
tfptr = data + sfld_ptr->fd_ptr - fld_ptr->fd_ptr;
|
||||
if ( r_pfld(i, sfld_ptr, rec, tfptr, &dba) != S_OKAY )
|
||||
break;
|
||||
}
|
||||
struct_key_chk = 1;
|
||||
if ( db_status != S_OKAY ) return( db_status );
|
||||
break;
|
||||
}
|
||||
/* arrayed struct fall-thru to a full field copy */
|
||||
default:
|
||||
bytecpy(fptr, data, fld_ptr->fd_len);
|
||||
}
|
||||
/* if this field is part of an ordered set, reconnect */
|
||||
if (fld_ptr->fd_flags & SORTFLD) {
|
||||
for (s = 0, srt_ptr = sort_table; s < size_srt; ++s, ++srt_ptr) {
|
||||
if ( srt_ptr->se_fld == field ) {
|
||||
sn = srt_ptr->se_set;
|
||||
if ( r_gmem( sn, rec, memp ) != S_OKAY ) return( db_status );
|
||||
if ( ! null_dba(memp+MP_OWNER) ) {
|
||||
/* save currency */
|
||||
odba = *(co_ptr = &curr_own[sn]);
|
||||
mdba = *(cm_ptr = &curr_mem[sn]);
|
||||
|
||||
/* set current owner and member to sorted set */
|
||||
bytecpy(co_ptr, memp+MP_OWNER, DB_ADDR_SIZE);
|
||||
*cm_ptr = dba;
|
||||
|
||||
/* calculate set constant */
|
||||
set = NUM2EXT(sn + SETMARK, st_offset);
|
||||
|
||||
/* disconnect from prior order set and reconnect in new order */
|
||||
d_discon(set CURRTASK_PARM CURR_DB_PARM);
|
||||
d_connect(set CURRTASK_PARM CURR_DB_PARM);
|
||||
|
||||
/* reset currency */
|
||||
*co_ptr = odba;
|
||||
*cm_ptr = mdba;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if ( strfld >= 0 ) {
|
||||
/* insert the new struct key */
|
||||
if ( key_insert( strfld, rec + sfld_ptr->fd_ptr, dba ) != S_OKAY )
|
||||
return( db_status );
|
||||
}
|
||||
return( db_status );
|
||||
}
|
||||
|
||||
|
||||
/* Put member pointer into record
|
||||
*/
|
||||
r_pmem(set, rec, mem_addr )
|
||||
int set; /* set table entry number */
|
||||
char FAR *rec; /* pointer to record */
|
||||
char FAR *mem_addr; /* pointer to member pointer */
|
||||
{
|
||||
INT rt;
|
||||
register int mem, memtot;
|
||||
SET_ENTRY FAR *set_ptr;
|
||||
register MEMBER_ENTRY FAR *mem_ptr;
|
||||
|
||||
/* search member list of set for record */
|
||||
set_ptr = &set_table[set];
|
||||
bytecpy(&rt, rec, sizeof(INT));
|
||||
rt &= ~RLBMASK;
|
||||
for (mem = set_ptr->st_members, memtot = mem + set_ptr->st_memtot,
|
||||
mem_ptr = &member_table[mem];
|
||||
mem < memtot;
|
||||
++mem, ++mem_ptr) {
|
||||
if (NUM2EXT(mem_ptr->mt_record, rt_offset) == rt) {
|
||||
/* have found correct member record */
|
||||
bytecpy(rec + mem_ptr->mt_mem_ptr, mem_addr, MEMPSIZE);
|
||||
return( db_status = S_OKAY );
|
||||
}
|
||||
}
|
||||
/* this record is not member of set */
|
||||
return( dberr(S_INVMEM) );
|
||||
}
|
||||
|
||||
|
||||
/* Put set pointer into record
|
||||
*/
|
||||
r_pset(set, rec, setptr )
|
||||
int set; /* set table entry number */
|
||||
char FAR *rec; /* pointer to record */
|
||||
char FAR *setptr; /* pointer to set pointer */
|
||||
{
|
||||
INT rt;
|
||||
int len;
|
||||
SET_ENTRY FAR *set_ptr;
|
||||
|
||||
set_ptr = &set_table[set];
|
||||
bytecpy(&rt, rec, sizeof(INT));
|
||||
if (NUM2EXT(set_ptr->st_own_rt, rt_offset) == (rt & ~RLBMASK)) {
|
||||
#ifndef NO_TIMESTAMP
|
||||
if ( set_ptr->st_flags & TIMESTAMPED )
|
||||
len = SETPSIZE;
|
||||
else
|
||||
#endif
|
||||
len = SETPSIZE - sizeof(ULONG);
|
||||
bytecpy(rec + set_ptr->st_own_ptr, setptr, len);
|
||||
return( db_status = S_OKAY );
|
||||
}
|
||||
else {
|
||||
return( dberr(S_INVOWN) );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* Set the current set member from record
|
||||
*/
|
||||
r_smem( db_addr, set )
|
||||
DB_ADDR FAR *db_addr;
|
||||
INT set;
|
||||
{
|
||||
#ifndef NO_TIMESTAMP
|
||||
int nset;
|
||||
#endif
|
||||
char mem[MEMPSIZE], FAR *ptr;
|
||||
DB_ADDR dba;
|
||||
|
||||
bytecpy(&dba, db_addr, DB_ADDR_SIZE);
|
||||
|
||||
/* make sure record is owned */
|
||||
if ((dio_read(dba, (char FAR * FAR *)&ptr, NOPGHOLD) != S_OKAY) ||
|
||||
(r_gmem(set, ptr, mem) != S_OKAY))
|
||||
return( db_status );
|
||||
|
||||
if ( null_dba( mem+MP_OWNER ) ) return( dberr( S_NOTCON ) );
|
||||
|
||||
bytecpy( &curr_own[set], mem+MP_OWNER, DB_ADDR_SIZE );
|
||||
|
||||
/* ownership okay, set the member */
|
||||
curr_mem[set] = dba;
|
||||
#ifndef NO_TIMESTAMP
|
||||
nset = NUM2EXT(set + SETMARK, st_offset);
|
||||
/* set timestamps */
|
||||
if ( db_tsrecs ) {
|
||||
d_utsco( nset, &co_time[set] CURRTASK_PARM CURR_DB_PARM );
|
||||
d_utscm( nset, &cm_time[set] CURRTASK_PARM CURR_DB_PARM );
|
||||
}
|
||||
if ( db_tssets )
|
||||
d_utscs( nset, &cs_time[set] CURRTASK_PARM CURR_DB_PARM );
|
||||
#endif
|
||||
return( db_status = S_OKAY );
|
||||
}
|
||||
|
||||
/* Set the optional key field "stored" bit */
|
||||
r_setopt( fld_ptr, rec )
|
||||
FIELD_ENTRY FAR *fld_ptr; /* field table entry of optional key */
|
||||
char FAR *rec; /* Pointer to record */
|
||||
{
|
||||
int offset; /* offset to the bit map */
|
||||
int keyndx; /* index into bit map of this key */
|
||||
int byteno, bitno; /* position within bit map of this key */
|
||||
|
||||
/* calculate the position to the bit map */
|
||||
offset = (record_table[fld_ptr->fd_rec].rt_flags & TIMESTAMPED) ?
|
||||
(RECHDRSIZE + 2*sizeof(LONG)) : RECHDRSIZE;
|
||||
|
||||
/* extract the index into the bit map of this key */
|
||||
keyndx = (((fld_ptr->fd_flags & OPTKEYMASK) >> OPTKEYSHIFT) & OPTKEYNDX) - 1;
|
||||
if ( keyndx < 0 ) return( dberr(S_SYSERR) );
|
||||
|
||||
/* determine which byte, and which bit within the byte */
|
||||
byteno = keyndx/BITS_PER_BYTE;
|
||||
bitno = keyndx - byteno*BITS_PER_BYTE;
|
||||
|
||||
/* set the bit */
|
||||
rec[byteno + offset] |= 1 << (BITS_PER_BYTE - bitno - 1);
|
||||
|
||||
return( db_status = S_OKAY );
|
||||
}
|
||||
|
||||
/* Clear the optional key field "stored" bit */
|
||||
r_clropt( fld_ptr, rec )
|
||||
FIELD_ENTRY FAR *fld_ptr; /* Field table entry of optional key */
|
||||
char FAR *rec; /* Pointer to record */
|
||||
{
|
||||
int offset; /* offset to the bit map */
|
||||
int keyndx; /* index into bit map of this key */
|
||||
int byteno, bitno; /* position within bit map of this key */
|
||||
|
||||
/* calculate the position to the bit map */
|
||||
offset = (record_table[fld_ptr->fd_rec].rt_flags & TIMESTAMPED) ?
|
||||
(RECHDRSIZE + 2*sizeof(LONG)) : RECHDRSIZE;
|
||||
|
||||
/* extract the index into the bit map of this key */
|
||||
keyndx = (((fld_ptr->fd_flags & OPTKEYMASK) >> OPTKEYSHIFT) & OPTKEYNDX) - 1;
|
||||
if ( keyndx < 0 ) return( dberr(S_SYSERR) );
|
||||
|
||||
/* determine which byte, and which bit within the byte */
|
||||
byteno = keyndx / BITS_PER_BYTE;
|
||||
bitno = keyndx - byteno*BITS_PER_BYTE;
|
||||
|
||||
/* clear the bit */
|
||||
rec[byteno + offset] &= ~(1 << (BITS_PER_BYTE - bitno - 1));
|
||||
|
||||
return( S_OKAY );
|
||||
}
|
||||
|
||||
/* Test the optional key field "stored" bit */
|
||||
r_tstopt( fld_ptr, rec )
|
||||
FIELD_ENTRY FAR *fld_ptr; /* Field table entry of optional key */
|
||||
char FAR *rec; /* Pointer to record */
|
||||
{
|
||||
int offset; /* offset to the bit map */
|
||||
int keyndx; /* index into bit map of this key */
|
||||
int byteno, bitno; /* position within bit map of this key */
|
||||
|
||||
/* calculate the position to the bit map */
|
||||
offset = (record_table[fld_ptr->fd_rec].rt_flags & TIMESTAMPED) ?
|
||||
(RECHDRSIZE + 2*sizeof(LONG)) : RECHDRSIZE;
|
||||
|
||||
/* extract the index into the bit map of this key */
|
||||
keyndx = (((fld_ptr->fd_flags & OPTKEYMASK) >> OPTKEYSHIFT) & OPTKEYNDX) - 1;
|
||||
if ( keyndx < 0 ) return( dberr(S_SYSERR) );
|
||||
|
||||
/* determine which byte, and which bit within the byte */
|
||||
byteno = keyndx / BITS_PER_BYTE;
|
||||
bitno = keyndx - byteno*BITS_PER_BYTE;
|
||||
|
||||
/* extract the bit */
|
||||
if (rec[byteno + offset] & (1 << (BITS_PER_BYTE - bitno - 1)))
|
||||
return( db_status = S_DUPLICATE );
|
||||
return( db_status = S_OKAY );
|
||||
}
|
||||
/* vpp -nOS2 -dUNIX -nBSD -nVANILLA_BSD -nVMS -nMEMLOCK -nWINDOWS -nFAR_ALLOC -f/usr/users/master/config/nonwin recfcns.c */
|
||||
96
cde/lib/DtSearch/raima/recfrst.c
Normal file
96
cde/lib/DtSearch/raima/recfrst.c
Normal file
@@ -0,0 +1,96 @@
|
||||
/* $XConsortium: recfrst.c /main/2 1996/05/09 04:14:13 drk $ */
|
||||
/*
|
||||
* COMPONENT_NAME: austext
|
||||
*
|
||||
* FUNCTIONS: d_recfrst
|
||||
*
|
||||
* ORIGINS: 157
|
||||
*
|
||||
* OBJECT CODE ONLY SOURCE MATERIALS
|
||||
*/
|
||||
/* ********************** EDIT HISTORY *******************************
|
||||
|
||||
SCR DATE INI DESCRIPTION
|
||||
----- --------- --- -----------------------------------------------------
|
||||
101 21-Jun-88 RSC Saved type and computed dba into rn_type and rn_dba
|
||||
103 24-Jun-88 RSC Improve generation of single user version
|
||||
04-Aug-88 RTK MULTI_TASK changes
|
||||
18-Aug-88 RSC moved rn_type/dba to separate table
|
||||
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include "vista.h"
|
||||
#include "dbtype.h"
|
||||
|
||||
|
||||
/* Find first record of type
|
||||
*/
|
||||
d_recfrst( rec TASK_PARM DBN_PARM )
|
||||
int rec; /* record type/table entry */
|
||||
TASK_DECL
|
||||
DBN_DECL
|
||||
{
|
||||
INT rectype;
|
||||
FILE_NO ftype;
|
||||
DB_ADDR dba;
|
||||
char FAR *recptr;
|
||||
#ifndef SINGLE_USER
|
||||
int dbopen_sv;
|
||||
#endif
|
||||
F_ADDR rno, last;
|
||||
RECORD_ENTRY FAR *rec_ptr;
|
||||
|
||||
DB_ENTER(DB_ID TASK_ID LOCK_SET(RECORD_IO));
|
||||
|
||||
if (nrec_check(rec, &rec, (RECORD_ENTRY FAR * FAR *)&rec_ptr) != S_OKAY)
|
||||
RETURN( db_status );
|
||||
#ifndef ONE_DB
|
||||
rec -= curr_db_table->rt_offset;
|
||||
#endif
|
||||
|
||||
/* get the normalized number of file containing this record type */
|
||||
ftype = NUM2EXT(rec_ptr->rt_file, ft_offset);
|
||||
|
||||
if ( (last = dio_pznext(rec_ptr->rt_file)) <= 0 )
|
||||
RETURN( db_status );
|
||||
|
||||
rno = 1;
|
||||
do {
|
||||
/* make sure we haven't gone past the end of the file */
|
||||
if ( rno >= last ) RETURN( db_status = S_NOTFOUND );
|
||||
|
||||
/* create the database address to read */
|
||||
dba = ( (FILEMASK & ftype) << FILESHIFT ) | (ADDRMASK & rno);
|
||||
|
||||
/* set up to allow unlocked read */
|
||||
#ifndef SINGLE_USER
|
||||
dbopen_sv = dbopen;
|
||||
dbopen = 2;
|
||||
#endif
|
||||
|
||||
/* read the record */
|
||||
dio_read( dba, (char FAR * FAR *)&recptr, NOPGHOLD );
|
||||
#ifndef SINGLE_USER
|
||||
dbopen = dbopen_sv;
|
||||
#endif
|
||||
if ( db_status != S_OKAY )
|
||||
RETURN( db_status );
|
||||
|
||||
/* get the record type out of the record */
|
||||
bytecpy( &rectype, recptr, sizeof(INT) );
|
||||
#ifndef SINGLE_USER
|
||||
rectype &= ~RLBMASK;
|
||||
#endif
|
||||
|
||||
++rno;
|
||||
} while ( (int)rectype != rec );
|
||||
|
||||
/* set the current record and type */
|
||||
curr_rec = dba;
|
||||
RN_REF(rn_type) = rectype;
|
||||
RN_REF(rn_dba) = dba;
|
||||
|
||||
RETURN( db_status = S_OKAY );
|
||||
}
|
||||
/* vpp -nOS2 -dUNIX -nBSD -nVANILLA_BSD -nVMS -nMEMLOCK -nWINDOWS -nFAR_ALLOC -f/usr/users/master/config/nonwin recfrst.c */
|
||||
119
cde/lib/DtSearch/raima/reclast.c
Normal file
119
cde/lib/DtSearch/raima/reclast.c
Normal file
@@ -0,0 +1,119 @@
|
||||
/* $XConsortium: reclast.c /main/2 1996/05/09 04:14:30 drk $ */
|
||||
/*
|
||||
* COMPONENT_NAME: austext
|
||||
*
|
||||
* FUNCTIONS: d_reclast
|
||||
*
|
||||
* ORIGINS: 157
|
||||
*
|
||||
* OBJECT CODE ONLY SOURCE MATERIALS
|
||||
*/
|
||||
/*-----------------------------------------------------------------------
|
||||
|
||||
reclast.c - find last record occurance in database
|
||||
|
||||
reclast is used to setup a scan of a database by database number
|
||||
backwards, and is complementary to recfrst.
|
||||
|
||||
AUTHOR: R.S. Carlson
|
||||
DATE: 06-Jul-88
|
||||
PROJECT: db_VISTA 3.10
|
||||
|
||||
Copyright (C) 1988 by Raima Corporation
|
||||
|
||||
-----------------------------------------------------------------------*/
|
||||
|
||||
/* ********************** EDIT HISTORY *******************************
|
||||
|
||||
SCR DATE INI DESCRIPTION
|
||||
----- --------- --- -----------------------------------------------------
|
||||
351 06-Jul-88 RSC new function added to runtime
|
||||
04-Aug-88 RTK MULTI_TASK changes
|
||||
09-Aug-88 RSC rno-- needs to be outside ifndef SINGLE_USER
|
||||
18-Aug-88 RSC moved rn_type/dba to separate table
|
||||
|
||||
*/
|
||||
|
||||
|
||||
/* ********************** INCLUDE FILES ****************************** */
|
||||
|
||||
#include <stdio.h>
|
||||
#include "vista.h"
|
||||
#include "dbtype.h"
|
||||
|
||||
/* ********************** GLOBAL VARIABLE DECLARATIONS *************** */
|
||||
/* ********************** GLOBAL FUNCTION DECLARATIONS *************** */
|
||||
/* ********************** EXTERNAL VARIABLE DECLARATIONS ************* */
|
||||
/* ********************** EXTERNAL FUNCTION DECLARATIONS ************* */
|
||||
/* ********************** LOCAL VARIABLE DECLARATIONS **************** */
|
||||
/* ********************** LOCAL FUNCTION DECLARATIONS **************** */
|
||||
|
||||
/* ======================================================================
|
||||
d_reclast - find last record occurance in database
|
||||
*/
|
||||
int d_reclast( rec TASK_PARM DBN_PARM )
|
||||
int rec; /* record # to find last occurance of */
|
||||
TASK_DECL
|
||||
DBN_DECL /* optional database number */
|
||||
{
|
||||
/*
|
||||
RETURNS: db_status. Sets current record to last record, if found.
|
||||
ASSUMES: nothing.
|
||||
*/
|
||||
DB_ADDR dba; /* current database addr we're scanning */
|
||||
FILE_NO ftype; /* file desc for file holding rec */
|
||||
F_ADDR last; /* last slot in file */
|
||||
char FAR *recptr; /* record from database */
|
||||
RECORD_ENTRY FAR *rec_ptr; /* RECORD ENTRY for this record */
|
||||
INT rectype; /* record type from record */
|
||||
F_ADDR rno; /* current slot we're scanning */
|
||||
|
||||
#ifndef SINGLE_USER
|
||||
int dbopen_sv; /* saved copy of dbopen */
|
||||
#endif
|
||||
|
||||
DB_ENTER(DB_ID TASK_ID LOCK_SET(RECORD_IO));
|
||||
|
||||
/* validate and convert record number */
|
||||
if ( nrec_check(rec, &rec, (RECORD_ENTRY FAR * FAR *)&rec_ptr) != S_OKAY)
|
||||
RETURN( db_status );
|
||||
|
||||
/* get the last record # for this file */
|
||||
ftype = NUM2EXT(rec_ptr->rt_file, ft_offset);
|
||||
if ( (last = dio_pznext(rec_ptr->rt_file)) <= 0 )
|
||||
RETURN( db_status );
|
||||
|
||||
/* start at the end, working backwards, find a matching record */
|
||||
rno = last - 1;
|
||||
do {
|
||||
if ( rno < 1)
|
||||
RETURN ( db_status = S_NOTFOUND );
|
||||
|
||||
/* create the database address, and read this record */
|
||||
dba = ((FILEMASK & ftype) << FILESHIFT) | (ADDRMASK & rno);
|
||||
#ifndef SINGLE_USER
|
||||
dbopen_sv = dbopen;
|
||||
dbopen = 2; /* setup to allow unlocked read */
|
||||
#endif
|
||||
dio_read(dba, (char FAR * FAR *)&recptr, NOPGHOLD);
|
||||
#ifndef SINGLE_USER
|
||||
dbopen = dbopen_sv;
|
||||
#endif
|
||||
if ( db_status != S_OKAY )
|
||||
RETURN( db_status );
|
||||
|
||||
/* See if this record is of the type we're looking for */
|
||||
bytecpy(&rectype, recptr, sizeof(INT));
|
||||
#ifndef SINGLE_USER
|
||||
rectype &= ~((INT)RLBMASK); /* remove rlb */
|
||||
#endif
|
||||
rno--;
|
||||
} while ( (int)rectype != rec );
|
||||
|
||||
/* when we get here, we know a match was found */
|
||||
curr_rec = dba; /* set current record */
|
||||
RN_REF(rn_type) = rectype; /* setup for future recprev,recnext */
|
||||
RN_REF(rn_dba) = dba;
|
||||
RETURN( db_status = S_OKAY );
|
||||
}
|
||||
/* vpp -nOS2 -dUNIX -nBSD -nVANILLA_BSD -nVMS -nMEMLOCK -nWINDOWS -nFAR_ALLOC -f/usr/users/master/config/nonwin reclast.c */
|
||||
106
cde/lib/DtSearch/raima/recnext.c
Normal file
106
cde/lib/DtSearch/raima/recnext.c
Normal file
@@ -0,0 +1,106 @@
|
||||
/* $XConsortium: recnext.c /main/2 1996/05/09 04:14:47 drk $ */
|
||||
/*
|
||||
* COMPONENT_NAME: austext
|
||||
*
|
||||
* FUNCTIONS: d_recnext
|
||||
*
|
||||
* ORIGINS: 157
|
||||
*
|
||||
* OBJECT CODE ONLY SOURCE MATERIALS
|
||||
*/
|
||||
|
||||
/* ********************** EDIT HISTORY *******************************
|
||||
|
||||
SCR DATE INI DESCRIPTION
|
||||
----- --------- --- -----------------------------------------------------
|
||||
101 21-Jun-88 RSC Use rn_type and rn_dba instead of curr_rec
|
||||
103 24-Jun-88 RSC Improve generation of single user version
|
||||
04-Aug-88 RTK MULTI_TASK changes
|
||||
18-Aug-88 RSC moved rn_type/dba to separate table
|
||||
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include "vista.h"
|
||||
#include "dbtype.h"
|
||||
|
||||
|
||||
/* Find next record of type
|
||||
*/
|
||||
d_recnext(TASK_DBN_ONLY)
|
||||
TASK_DECL
|
||||
DBN_DECL
|
||||
{
|
||||
INT rectype;
|
||||
FILE_NO fno;
|
||||
FILE_NO ft;
|
||||
DB_ADDR dba;
|
||||
#ifndef SINGLE_USER
|
||||
int dbopen_sv;
|
||||
#endif
|
||||
int rec_ndx; /* Index into record table */
|
||||
RECORD_ENTRY FAR *rec_ptr; /* Pointer to record table */
|
||||
char FAR *recptr;
|
||||
F_ADDR rno, last;
|
||||
|
||||
DB_ENTER(DB_ID TASK_ID LOCK_SET(RECORD_IO));
|
||||
|
||||
/* look for the current record type */
|
||||
if ( RN_REF(rn_type) < 0 ) RETURN( dberr(S_NOTYPE) );
|
||||
|
||||
/* get the record number and file number from the current record */
|
||||
if (RN_REF(rn_dba)) {
|
||||
fno = (FILE_NO)((RN_REF(rn_dba) >> FILESHIFT) & FILEMASK);
|
||||
rno = RN_REF(rn_dba) & ADDRMASK;
|
||||
}
|
||||
else { /* No current rec - get fno from rn_type */
|
||||
nrec_check(RN_REF(rn_type) + RECMARK, &rec_ndx, (RECORD_ENTRY FAR * FAR *)&rec_ptr);
|
||||
fno = (FILE_NO)NUM2EXT(rec_ptr->rt_file, ft_offset);
|
||||
fno = (int)((fno >> FILESHIFT) & FILEMASK);
|
||||
rno = 1;
|
||||
}
|
||||
ft = NUM2INT( fno, ft_offset );
|
||||
|
||||
/* start looking at the next record number */
|
||||
if ( (last = dio_pznext(ft)) <= 0 )
|
||||
RETURN( db_status );
|
||||
|
||||
++rno;
|
||||
do {
|
||||
/* make sure we haven't gone past the end of the file */
|
||||
if ( rno >= last ) RETURN( db_status = S_NOTFOUND );
|
||||
|
||||
/* create the database address to read */
|
||||
dba = ( (FILEMASK & fno) << FILESHIFT ) | (ADDRMASK & rno);
|
||||
|
||||
/* set up to allow unlocked read */
|
||||
#ifndef SINGLE_USER
|
||||
dbopen_sv = dbopen;
|
||||
dbopen = 2;
|
||||
#endif
|
||||
|
||||
/* read the record */
|
||||
dio_read( dba, (char FAR * FAR *)&recptr, NOPGHOLD );
|
||||
#ifndef SINGLE_USER
|
||||
dbopen = dbopen_sv;
|
||||
#endif
|
||||
if ( db_status != S_OKAY )
|
||||
RETURN( db_status );
|
||||
|
||||
/* get the record type out of the record */
|
||||
bytecpy( &rectype, recptr, sizeof(INT) );
|
||||
#ifndef SINGLE_USER
|
||||
rectype &= ~RLBMASK;
|
||||
#endif
|
||||
|
||||
++rno;
|
||||
} while ( rectype != RN_REF(rn_type) );
|
||||
|
||||
/* set the current record */
|
||||
curr_rec = dba;
|
||||
RN_REF(rn_type) = rectype;
|
||||
RN_REF(rn_dba) = dba;
|
||||
|
||||
RETURN( db_status = S_OKAY );
|
||||
}
|
||||
/* vpp -nOS2 -dUNIX -nBSD -nVANILLA_BSD -nVMS -nMEMLOCK -nWINDOWS -nFAR_ALLOC -f/usr/users/master/config/nonwin recnext.c */
|
||||
126
cde/lib/DtSearch/raima/recprev.c
Normal file
126
cde/lib/DtSearch/raima/recprev.c
Normal file
@@ -0,0 +1,126 @@
|
||||
/* $XConsortium: recprev.c /main/2 1996/05/09 04:15:00 drk $ */
|
||||
/*
|
||||
* COMPONENT_NAME: austext
|
||||
*
|
||||
* FUNCTIONS: d_recprev
|
||||
*
|
||||
* ORIGINS: 157
|
||||
*
|
||||
* OBJECT CODE ONLY SOURCE MATERIALS
|
||||
*/
|
||||
/*-----------------------------------------------------------------------
|
||||
|
||||
recprev.c - scan database backwards via database address
|
||||
|
||||
d_recprev is used to scan the database backwards via the database address.
|
||||
It is the compliment to recnext. It is generally called after d_reclast.
|
||||
|
||||
AUTHOR: R.S. Carlson
|
||||
DATE: 06-Jul-88
|
||||
PROJECT: db_VISTA 3.10
|
||||
|
||||
Copyright (C) 1988 by Raima Corporation
|
||||
|
||||
-----------------------------------------------------------------------*/
|
||||
|
||||
/* ********************** EDIT HISTORY *******************************
|
||||
|
||||
SCR DATE INI DESCRIPTION
|
||||
----- --------- --- -----------------------------------------------------
|
||||
351 06-Jul-88 RSC added new function to runtime
|
||||
04-Aug-88 RTK MULTI_TASK changes
|
||||
18-Aug-88 RSC moved rn_type/dba to separate table.
|
||||
17-Oct-88 RSC changed return to RETURN
|
||||
|
||||
*/
|
||||
|
||||
|
||||
/* ********************** INCLUDE FILES ****************************** */
|
||||
|
||||
#include <stdio.h>
|
||||
#include "vista.h"
|
||||
#include "dbtype.h"
|
||||
|
||||
/* ********************** GLOBAL VARIABLE DECLARATIONS *************** */
|
||||
/* ********************** GLOBAL FUNCTION DECLARATIONS *************** */
|
||||
/* ********************** EXTERNAL VARIABLE DECLARATIONS ************* */
|
||||
/* ********************** EXTERNAL FUNCTION DECLARATIONS ************* */
|
||||
/* ********************** LOCAL VARIABLE DECLARATIONS **************** */
|
||||
/* ********************** LOCAL FUNCTION DECLARATIONS **************** */
|
||||
|
||||
/* ======================================================================
|
||||
d_recprev - find previous record via database address
|
||||
*/
|
||||
int d_recprev( TASK_DBN_ONLY )
|
||||
TASK_DECL
|
||||
DBN_DECL
|
||||
{
|
||||
/*
|
||||
RETURNS: db_status. Also sets current record to previous matched record.
|
||||
ASSUMES: nothing.
|
||||
*/
|
||||
DB_ADDR dba; /* current database addr we're scanning */
|
||||
FILE_NO fno; /* current file we're scanning */
|
||||
F_ADDR last; /* last slot in file */
|
||||
int rec_ndx; /* index of RECORD ENTRY (not used) */
|
||||
char FAR *recptr; /* record from database */
|
||||
RECORD_ENTRY FAR *rec_ptr; /* RECORD ENTRY for this record */
|
||||
INT rectype; /* record type from record */
|
||||
F_ADDR rno; /* current slot we're scanning */
|
||||
FILE_NO ft; /* normalized file */
|
||||
|
||||
#ifndef SINGLE_USER
|
||||
int dbopen_sv; /* saved copy of dbopen */
|
||||
#endif
|
||||
|
||||
DB_ENTER(DB_ID TASK_ID LOCK_SET(RECORD_IO));
|
||||
|
||||
/* setup current record and file number */
|
||||
if ( RN_REF(rn_type) < 0) RETURN( dberr(S_NOTYPE) );
|
||||
if ( RN_REF(rn_dba) ) {
|
||||
fno = (FILE_NO)((RN_REF(rn_dba) >> FILESHIFT) & FILEMASK);
|
||||
rno = RN_REF(rn_dba) & ADDRMASK;
|
||||
}
|
||||
else { /* no current rec, get fno from rn_type */
|
||||
nrec_check(RN_REF(rn_type) + RECMARK, &rec_ndx, (RECORD_ENTRY FAR * FAR *)&rec_ptr);
|
||||
fno = NUM2EXT(rec_ptr->rt_file, ft_offset);
|
||||
fno = (int)((fno >> FILESHIFT) & FILEMASK);
|
||||
|
||||
/* compute rno as last slot in file */
|
||||
if ( (last = dio_pznext(rec_ptr->rt_file)) <= 0 )
|
||||
RETURN( db_status );
|
||||
|
||||
rno = last;
|
||||
}
|
||||
ft = NUM2INT( fno, ft_offset );
|
||||
|
||||
/* scan backwards looking for a record of the same type */
|
||||
rno--;
|
||||
do {
|
||||
if (rno < 1) RETURN( db_status = S_NOTFOUND );
|
||||
dba = ((fno & FILEMASK) << FILESHIFT) | (rno & ADDRMASK);
|
||||
#ifndef SINGLE_USER
|
||||
dbopen_sv = dbopen;
|
||||
dbopen = 2; /* setup to allow for unlocked read */
|
||||
#endif
|
||||
dio_read(dba, (char FAR * FAR *)&recptr, NOPGHOLD);
|
||||
#ifndef SINGLE_USER
|
||||
dbopen = dbopen_sv;
|
||||
#endif
|
||||
if (db_status != S_OKAY) RETURN( db_status );
|
||||
|
||||
/* see if we've found a match */
|
||||
bytecpy(&rectype, recptr, sizeof(INT));
|
||||
#ifndef SINGLE_USER
|
||||
rectype &= ~((INT)RLBMASK);
|
||||
#endif
|
||||
rno--;
|
||||
} while ( rectype != RN_REF(rn_type) );
|
||||
|
||||
/* when we get here, we know a match was found */
|
||||
curr_rec = dba; /* set current record to match */
|
||||
RN_REF(rn_type) = rectype;
|
||||
RN_REF(rn_dba) = dba;
|
||||
RETURN( db_status = S_OKAY );
|
||||
}
|
||||
/* vpp -nOS2 -dUNIX -nBSD -nVANILLA_BSD -nVMS -nMEMLOCK -nWINDOWS -nFAR_ALLOC -f/usr/users/master/config/nonwin recprev.c */
|
||||
92
cde/lib/DtSearch/raima/recread.c
Normal file
92
cde/lib/DtSearch/raima/recread.c
Normal file
@@ -0,0 +1,92 @@
|
||||
/* $XConsortium: recread.c /main/2 1996/05/09 04:15:18 drk $ */
|
||||
/*
|
||||
* COMPONENT_NAME: austext
|
||||
*
|
||||
* FUNCTIONS: d_recread
|
||||
*
|
||||
* ORIGINS: 157
|
||||
*
|
||||
* OBJECT CODE ONLY SOURCE MATERIALS
|
||||
*/
|
||||
/*-----------------------------------------------------------------------
|
||||
recread.c -- db_VISTA current record read module.
|
||||
|
||||
(C) Copyright 1987 by Raima Corporation.
|
||||
-----------------------------------------------------------------------*/
|
||||
|
||||
/* ********************** EDIT HISTORY *******************************
|
||||
|
||||
SCR DATE INI DESCRIPTION
|
||||
----- --------- --- -----------------------------------------------------
|
||||
103 27-Jun-88 RSC Improve generation of single user version
|
||||
04-Aug-88 RTK MULTI_TASK changes
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include "vista.h"
|
||||
#include "dbtype.h"
|
||||
|
||||
|
||||
/* Read contents of current record
|
||||
*/
|
||||
d_recread(rec TASK_PARM DBN_PARM)
|
||||
char FAR *rec; /* ptr to record area */
|
||||
TASK_DECL
|
||||
DBN_DECL
|
||||
{
|
||||
INT rt; /* record type */
|
||||
DB_ADDR dba;
|
||||
#ifndef SINGLE_USER
|
||||
int dbopen_sv;
|
||||
#endif
|
||||
RECORD_ENTRY FAR *rec_ptr;
|
||||
|
||||
DB_ENTER(DB_ID TASK_ID LOCK_SET(RECORD_IO));
|
||||
|
||||
if ( ! dbopen ) RETURN( dberr(S_DBOPEN) );
|
||||
|
||||
/* Make sure we have a current record */
|
||||
if ( ! curr_rec )
|
||||
RETURN( dberr(S_NOCR) );
|
||||
|
||||
/* set up to allow unlocked read access */
|
||||
#ifndef SINGLE_USER
|
||||
dbopen_sv = dbopen;
|
||||
dbopen = 2;
|
||||
#endif
|
||||
|
||||
/* read current record */
|
||||
dio_read( curr_rec, (char FAR * FAR *)&crloc, NOPGHOLD);
|
||||
#ifndef SINGLE_USER
|
||||
dbopen = dbopen_sv;
|
||||
#endif
|
||||
if ( db_status != S_OKAY )
|
||||
RETURN( db_status );
|
||||
|
||||
/* copy record type from record */
|
||||
bytecpy(&rt, crloc, sizeof(INT));
|
||||
if ( rt < 0 )
|
||||
RETURN( db_status = S_DELETED );
|
||||
|
||||
#ifndef SINGLE_USER
|
||||
if ( rt & RLBMASK ) {
|
||||
rt &= ~RLBMASK; /* mask off rlb */
|
||||
rlb_status = S_LOCKED;
|
||||
}
|
||||
else {
|
||||
rlb_status = S_UNLOCKED;
|
||||
}
|
||||
#endif
|
||||
rec_ptr = &record_table[NUM2INT(rt, rt_offset)];
|
||||
|
||||
/* Copy db_addr from record and check with curr_rec */
|
||||
bytecpy(&dba, crloc+sizeof(INT), DB_ADDR_SIZE);
|
||||
if ( ADDRcmp(&dba, &curr_rec) != 0 )
|
||||
RETURN( dberr(S_INVADDR) );
|
||||
|
||||
/* Copy data from crloc into rec */
|
||||
bytecpy(rec, &crloc[rec_ptr->rt_data], rec_ptr->rt_len - rec_ptr->rt_data);
|
||||
|
||||
RETURN( db_status = S_OKAY );
|
||||
}
|
||||
/* vpp -nOS2 -dUNIX -nBSD -nVANILLA_BSD -nVMS -nMEMLOCK -nWINDOWS -nFAR_ALLOC -f/usr/users/master/config/nonwin recread.c */
|
||||
83
cde/lib/DtSearch/raima/recset.c
Normal file
83
cde/lib/DtSearch/raima/recset.c
Normal file
@@ -0,0 +1,83 @@
|
||||
/* $XConsortium: recset.c /main/2 1996/05/09 04:15:34 drk $ */
|
||||
/*
|
||||
* COMPONENT_NAME: austext
|
||||
*
|
||||
* FUNCTIONS: d_recset
|
||||
*
|
||||
* ORIGINS: 157
|
||||
*
|
||||
* OBJECT CODE ONLY SOURCE MATERIALS
|
||||
*/
|
||||
/*-----------------------------------------------------------------------
|
||||
|
||||
recset.c - set record type and database address to current.
|
||||
|
||||
This function sets the current record type and database address to the
|
||||
current record. It is used in conjunction with d_recnext to then scan
|
||||
forward from this point on.
|
||||
|
||||
AUTHOR: R.S. Carlson
|
||||
DATE: 21-Jun-88
|
||||
PROJECT: db_VISTA 3.10 enhancements
|
||||
|
||||
Copyright (C) 1988 by Raima Corporation
|
||||
|
||||
-----------------------------------------------------------------------*/
|
||||
|
||||
/* ********************** EDIT HISTORY *******************************
|
||||
|
||||
SCR DATE INI DESCRIPTION
|
||||
----- --------- --- -----------------------------------------------------
|
||||
04-Aug-88 RTK MULTI_TASK changes
|
||||
18-Aug-88 RSC moved rn_type/dba to separate table
|
||||
|
||||
*/
|
||||
|
||||
/* ********************** INCLUDE FILES ****************************** */
|
||||
|
||||
#include <stdio.h>
|
||||
#include "vista.h"
|
||||
#include "dbtype.h"
|
||||
|
||||
/* ********************** GLOBAL VARIABLE DECLARATIONS *************** */
|
||||
/* ********************** GLOBAL FUNCTION DECLARATIONS *************** */
|
||||
/* ********************** EXTERNAL VARIABLE DECLARATIONS ************* */
|
||||
/* ********************** EXTERNAL FUNCTION DECLARATIONS ************* */
|
||||
/* ********************** LOCAL VARIABLE DECLARATIONS **************** */
|
||||
/* ********************** LOCAL FUNCTION DECLARATIONS **************** */
|
||||
|
||||
/* ======================================================================
|
||||
set record type and database address to current
|
||||
*/
|
||||
int d_recset( rec TASK_PARM DBN_PARM )
|
||||
int rec; /* record type */
|
||||
TASK_DECL
|
||||
DBN_DECL
|
||||
{
|
||||
/*
|
||||
RETURNS: db_status return code.
|
||||
ASSUMES: nothing.
|
||||
*/
|
||||
FILE_NO rfile; /* file containing user specified rec */
|
||||
FILE_NO fno; /* file containing current record */
|
||||
int rec_ndx; /* Index into record table */
|
||||
RECORD_ENTRY FAR *rec_ptr; /* Pointer to record table */
|
||||
|
||||
DB_ENTER(DB_ID TASK_ID LOCK_SET(RECORD_NOIO));
|
||||
|
||||
/* Check rec parameter user passed */
|
||||
if (nrec_check(rec, &rec_ndx, (RECORD_ENTRY FAR * FAR *)&rec_ptr) != S_OKAY)
|
||||
RETURN( db_status );
|
||||
|
||||
/* Check to make sure current record is in this file */
|
||||
rfile = (FILE_NO)(NUM2EXT(rec_ptr->rt_file, ft_offset));
|
||||
fno = (FILE_NO)((curr_rec >> FILESHIFT) & FILEMASK);
|
||||
if (fno != rfile)
|
||||
RETURN( dberr (S_INVREC) );
|
||||
|
||||
/* Everything is okay - save the type and database address */
|
||||
RN_REF(rn_type) = rec - RECMARK;
|
||||
RN_REF(rn_dba) = curr_rec;
|
||||
RETURN( db_status = S_OKAY );
|
||||
}
|
||||
/* vpp -nOS2 -dUNIX -nBSD -nVANILLA_BSD -nVMS -nMEMLOCK -nWINDOWS -nFAR_ALLOC -f/usr/users/master/config/nonwin recset.c */
|
||||
72
cde/lib/DtSearch/raima/recstat.c
Normal file
72
cde/lib/DtSearch/raima/recstat.c
Normal file
@@ -0,0 +1,72 @@
|
||||
/* $XConsortium: recstat.c /main/2 1996/05/09 04:15:50 drk $ */
|
||||
/*
|
||||
* COMPONENT_NAME: austext
|
||||
*
|
||||
* FUNCTIONS: d_recstat
|
||||
*
|
||||
* ORIGINS: 157
|
||||
*
|
||||
* OBJECT CODE ONLY SOURCE MATERIALS
|
||||
*/
|
||||
/*-----------------------------------------------------------------------
|
||||
recstat.c -- db_VISTA record timestamp status check module.
|
||||
|
||||
(C) Copyright 1987 by Raima Corporation.
|
||||
-----------------------------------------------------------------------*/
|
||||
|
||||
/* ********************** EDIT HISTORY *******************************
|
||||
|
||||
SCR DATE INI DESCRIPTION
|
||||
----- --------- --- -----------------------------------------------------
|
||||
04-Aug-88 RTK MULTI_TASK changes
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include "vista.h"
|
||||
#include "dbtype.h"
|
||||
|
||||
|
||||
#ifndef NO_TIMESTAMP
|
||||
/* Test timestamp status of record
|
||||
*/
|
||||
d_recstat(dba, rts TASK_PARM)
|
||||
DB_ADDR dba;
|
||||
ULONG rts;
|
||||
TASK_DECL
|
||||
{
|
||||
INT rec;
|
||||
char FAR *ptr;
|
||||
ULONG cts, uts;
|
||||
|
||||
DB_ENTER(NO_DB_ID TASK_ID LOCK_SET(RECORD_IO));
|
||||
|
||||
if ((check_dba(dba) != S_OKAY) || (dio_read(dba, (char FAR * FAR *)&ptr, NOPGHOLD) != S_OKAY))
|
||||
RETURN( db_status );
|
||||
|
||||
/* get record id */
|
||||
bytecpy(&rec, ptr, sizeof(INT));
|
||||
if ( rec >= 0 ) {
|
||||
rec &= ~RLBMASK; /* mask off rlb */
|
||||
#ifndef ONE_DB
|
||||
rec += curr_db_table->rt_offset;
|
||||
#endif
|
||||
if ( record_table[rec].rt_flags & TIMESTAMPED ) {
|
||||
bytecpy(&cts, ptr + RECCRTIME, sizeof(ULONG));
|
||||
if ( cts > rts )
|
||||
db_status = S_DELETED;
|
||||
else {
|
||||
bytecpy(&uts, ptr + RECUPTIME, sizeof(ULONG));
|
||||
if ( uts > rts )
|
||||
db_status = S_UPDATED;
|
||||
}
|
||||
}
|
||||
else
|
||||
dberr(S_TIMESTAMP);
|
||||
}
|
||||
else
|
||||
db_status = S_DELETED;
|
||||
|
||||
RETURN( db_status );
|
||||
}
|
||||
#endif
|
||||
/* vpp -nOS2 -dUNIX -nBSD -nVANILLA_BSD -nVMS -nMEMLOCK -nWINDOWS -nFAR_ALLOC -f/usr/users/master/config/nonwin recstat.c */
|
||||
144
cde/lib/DtSearch/raima/recwrite.c
Normal file
144
cde/lib/DtSearch/raima/recwrite.c
Normal file
@@ -0,0 +1,144 @@
|
||||
/* $XConsortium: recwrite.c /main/2 1996/05/09 04:16:09 drk $ */
|
||||
/*
|
||||
* COMPONENT_NAME: austext
|
||||
*
|
||||
* FUNCTIONS: d_recwrite
|
||||
*
|
||||
* ORIGINS: 157
|
||||
*
|
||||
* OBJECT CODE ONLY SOURCE MATERIALS
|
||||
*/
|
||||
/*-----------------------------------------------------------------------
|
||||
recwrite.c -- db_VISTA current record write module.
|
||||
|
||||
(C) Copyright 1987 by Raima Corporation.
|
||||
-----------------------------------------------------------------------*/
|
||||
|
||||
/* ********************** EDIT HISTORY *******************************
|
||||
|
||||
SCR DATE INI DESCRIPTION
|
||||
----- --------- --- -----------------------------------------------------
|
||||
158 15-JUN-88 RSC passed new flag to key_bldcom
|
||||
04-Aug-88 RTK MULTI_TASK changes
|
||||
|
||||
*/
|
||||
#include <stdio.h>
|
||||
#include "vista.h"
|
||||
#include "dbtype.h"
|
||||
|
||||
|
||||
/* Write contents to current record
|
||||
*/
|
||||
d_recwrite(rec TASK_PARM DBN_PARM)
|
||||
CONST char FAR *rec; /* ptr to record area */
|
||||
TASK_DECL
|
||||
DBN_DECL
|
||||
{
|
||||
#ifndef NO_TIMESTAMP
|
||||
ULONG timestamp;
|
||||
#endif
|
||||
INT rt; /* record type */
|
||||
char FAR *fptr; /* field data pointer */
|
||||
char ckey[256]; /* current compound key data */
|
||||
char nkey[256]; /* new compound key data */
|
||||
int stat;
|
||||
register int fld;
|
||||
RECORD_ENTRY FAR *rec_ptr;
|
||||
register FIELD_ENTRY FAR *fld_ptr;
|
||||
|
||||
DB_ENTER(DB_ID TASK_ID LOCK_SET(SET_IO));
|
||||
|
||||
if ( ! dbopen ) RETURN( dberr(S_DBOPEN) );
|
||||
|
||||
/* Make sure we have a current record */
|
||||
if ( ! curr_rec )
|
||||
RETURN( dberr(S_NOCR) );
|
||||
|
||||
/* Read current record */
|
||||
if ( dio_read( curr_rec, (char FAR * FAR *)&crloc, PGHOLD) != S_OKAY )
|
||||
RETURN( db_status );
|
||||
|
||||
/* Copy record type from record */
|
||||
bytecpy(&rt, crloc, sizeof(INT));
|
||||
rt &= ~RLBMASK; /* mask off rlb */
|
||||
#ifndef ONE_DB
|
||||
rt += curr_db_table->rt_offset;
|
||||
#endif
|
||||
rec_ptr = &record_table[rt];
|
||||
|
||||
/* Check out each field before they are changed */
|
||||
for (fld = rec_ptr->rt_fields, fld_ptr = &field_table[fld];
|
||||
(fld < size_fd) && (fld_ptr->fd_rec == rt);
|
||||
++fld, ++fld_ptr) {
|
||||
|
||||
/* Build compound key for new data supplied by user. Note: cflag
|
||||
must be the same here as in the 1st key_bldcom for r_chkfld */
|
||||
if ( fld_ptr->fd_type == COMKEY ) {
|
||||
key_bldcom(fld, (char FAR *)rec, nkey, FALSE);
|
||||
fptr = nkey;
|
||||
}
|
||||
else
|
||||
fptr = (char FAR *)rec + fld_ptr->fd_ptr - rec_ptr->rt_data;
|
||||
|
||||
if ( ! (fld_ptr->fd_flags & STRUCTFLD) ) {
|
||||
if ( (stat = r_chkfld(fld, fld_ptr, crloc, fptr)) != S_OKAY ) {
|
||||
dio_release(curr_rec);
|
||||
RETURN( db_status = stat );
|
||||
}
|
||||
}
|
||||
}
|
||||
/* Copy data from rec into crloc */
|
||||
for (fld = (rt == size_rt-1) ? (size_fd - 1) :
|
||||
((rec_ptr + 1)->rt_fields - 1),
|
||||
fld_ptr = &field_table[fld];
|
||||
fld >= rec_ptr->rt_fields;
|
||||
--fld, --fld_ptr) {
|
||||
/* go backwards so comkeys are processed first */
|
||||
if ( fld_ptr->fd_type == COMKEY ) {
|
||||
/* build old and new keys */
|
||||
key_bldcom(fld, crloc + rec_ptr->rt_data, ckey, TRUE);
|
||||
key_bldcom(fld, (char FAR *)rec, nkey, TRUE);
|
||||
|
||||
/* make sure value has changed */
|
||||
if ((fldcmp(fld_ptr, ckey, nkey) != 0) &&
|
||||
/* if the key has been stored */
|
||||
(!(fld_ptr->fd_flags & OPTKEYMASK) || r_tstopt(fld_ptr, crloc))) {
|
||||
/* delete the old key */
|
||||
if ( key_delete(fld, ckey, curr_rec) == S_OKAY ) {
|
||||
/* insert the new one */
|
||||
if ( key_insert( fld, nkey, curr_rec ) != S_OKAY )
|
||||
RETURN( db_status );
|
||||
}
|
||||
else
|
||||
RETURN( db_status == S_NOTFOUND? dberr(S_KEYERR): db_status );
|
||||
}
|
||||
}
|
||||
else if ( ! (STRUCTFLD & fld_ptr->fd_flags) ) {
|
||||
/* ignore sub-fields of structures */
|
||||
if (r_pfld(fld, fld_ptr, crloc,
|
||||
rec + fld_ptr->fd_ptr - rec_ptr->rt_data,
|
||||
&curr_rec) != S_OKAY) {
|
||||
stat = db_status;
|
||||
dio_release(curr_rec);
|
||||
RETURN( db_status = stat );
|
||||
}
|
||||
}
|
||||
}
|
||||
#ifndef NO_TIMESTAMP
|
||||
/* check for timestamp */
|
||||
if ( rec_ptr->rt_flags & TIMESTAMPED ) {
|
||||
timestamp = dio_pzgetts(rec_ptr->rt_file);
|
||||
bytecpy( crloc + RECUPTIME, ×tamp, sizeof(LONG));
|
||||
}
|
||||
else
|
||||
timestamp = 0L;
|
||||
#endif
|
||||
/* write current record to page */
|
||||
dio_write(curr_rec, NULL, PGFREE);
|
||||
#ifndef NO_TIMESTAMP
|
||||
if (( db_status == S_OKAY ) && db_tsrecs )
|
||||
cr_time = timestamp;
|
||||
#endif
|
||||
RETURN( db_status );
|
||||
}
|
||||
/* vpp -nOS2 -dUNIX -nBSD -nVANILLA_BSD -nVMS -nMEMLOCK -nWINDOWS -nFAR_ALLOC -f/usr/users/master/config/nonwin recwrite.c */
|
||||
117
cde/lib/DtSearch/raima/renfile.c
Normal file
117
cde/lib/DtSearch/raima/renfile.c
Normal file
@@ -0,0 +1,117 @@
|
||||
/* $XConsortium: renfile.c /main/2 1996/05/09 04:16:22 drk $ */
|
||||
/*
|
||||
* COMPONENT_NAME: austext
|
||||
*
|
||||
* FUNCTIONS: d_renfile
|
||||
* renfiles
|
||||
*
|
||||
* ORIGINS: 157
|
||||
*
|
||||
* OBJECT CODE ONLY SOURCE MATERIALS
|
||||
*/
|
||||
/*-----------------------------------------------------------------------
|
||||
renfile - Database file rename functions
|
||||
|
||||
This file contains functions which perform dynamic
|
||||
db_VISTA database file renaming.
|
||||
|
||||
(C) Copyright 1986 by Raima Corp.
|
||||
-----------------------------------------------------------------------*/
|
||||
#include <stdio.h>
|
||||
#include "vista.h"
|
||||
#include "dbtype.h"
|
||||
|
||||
|
||||
/* Rename database file
|
||||
*/
|
||||
d_renfile(dbn, fno, fnm TASK_PARM)
|
||||
CONST char FAR *dbn; /* database containing file to be renamed */
|
||||
FILE_NO fno; /* file id number for file to be renamed */
|
||||
CONST char FAR *fnm; /* new file name */
|
||||
TASK_DECL
|
||||
{
|
||||
REN_ENTRY_P r;
|
||||
|
||||
DB_ENTER(NO_DB_ID TASK_ID LOCK_SET(LOCK_ALL));
|
||||
|
||||
if ( dbopen ) RETURN( dberr(S_DBOPEN) );
|
||||
|
||||
r.ptr = (REN_ENTRY FAR *)ALLOC(&r, sizeof(REN_ENTRY), "r");
|
||||
if ( r.ptr == NULL )
|
||||
RETURN( dberr(S_NOMEMORY) );
|
||||
ll_access(&ren_list);
|
||||
if ( ll_append(&ren_list, (CHAR_P FAR *)&r) != S_OKAY ) {
|
||||
RETURN( db_status );
|
||||
}
|
||||
r.ptr->Ren_db_name.ptr =
|
||||
ALLOC(&r.ptr->Ren_db_name, strlen(dbn)+1,"r.ptr->Ren_db_name");
|
||||
r.ptr->File_name.ptr =
|
||||
ALLOC(&r.ptr->File_name, strlen(fnm)+1,"r.ptr->File_name");
|
||||
if ( ! r.ptr->Ren_db_name.ptr || ! r.ptr->File_name.ptr )
|
||||
RETURN( dberr(S_NOMEMORY) );
|
||||
|
||||
strcpy(r.ptr->Ren_db_name.ptr, dbn);
|
||||
strcpy(r.ptr->File_name.ptr, fnm);
|
||||
r.ptr->file_no = fno;
|
||||
|
||||
MEM_UNLOCK(&r.ptr->Ren_db_name);
|
||||
MEM_UNLOCK(&r.ptr->File_name);
|
||||
ll_deaccess(&ren_list);
|
||||
|
||||
RETURN( db_status = S_OKAY );
|
||||
}
|
||||
|
||||
|
||||
/* Process renamed file table
|
||||
*/
|
||||
renfiles()
|
||||
{
|
||||
register int dbt_lc; /* loop control */
|
||||
REN_ENTRY_P FAR *rp;
|
||||
#ifndef ONE_DB
|
||||
DB_ENTRY FAR *db_ptr;
|
||||
#endif
|
||||
|
||||
if ( ll_access(&ren_list) ) {
|
||||
#ifndef ONE_DB
|
||||
db_ptr = curr_db_table; /* Have to save it because of macros */
|
||||
#endif
|
||||
while ((rp = (REN_ENTRY_P FAR *)ll_next(&ren_list)) != NULL) {
|
||||
MEM_LOCK(&rp->ptr->Ren_db_name);
|
||||
MEM_LOCK(&rp->ptr->File_name);
|
||||
#ifndef ONE_DB
|
||||
for (dbt_lc = no_of_dbs, curr_db_table = db_table;
|
||||
--dbt_lc >= 0; ++curr_db_table) {
|
||||
#endif
|
||||
if (strcmp(rp->ptr->Ren_db_name.ptr, DB_REF(db_name)) == 0) {
|
||||
if ( rp->ptr->file_no < 0 || rp->ptr->file_no >= DB_REF(Size_ft) ) {
|
||||
MEM_UNLOCK(&rp->ptr->Ren_db_name);
|
||||
MEM_UNLOCK(&rp->ptr->File_name);
|
||||
FREE(&rp->ptr->Ren_db_name);
|
||||
FREE(&rp->ptr->File_name);
|
||||
ll_deaccess(&ren_list);
|
||||
return( dberr(S_RENAME) );
|
||||
}
|
||||
strcpy(file_table[NUM2INT(rp->ptr->file_no, ft_offset)].ft_name,
|
||||
rp->ptr->File_name.ptr);
|
||||
#ifndef ONE_DB
|
||||
break;
|
||||
#endif
|
||||
}
|
||||
#ifndef ONE_DB
|
||||
}
|
||||
#endif
|
||||
MEM_UNLOCK(&rp->ptr->Ren_db_name);
|
||||
MEM_UNLOCK(&rp->ptr->File_name);
|
||||
FREE(&rp->ptr->Ren_db_name);
|
||||
FREE(&rp->ptr->File_name);
|
||||
}
|
||||
#ifndef ONE_DB
|
||||
curr_db_table = db_ptr;
|
||||
#endif
|
||||
}
|
||||
ll_deaccess(&ren_list);
|
||||
ll_free(&ren_list);
|
||||
return( db_status = S_OKAY );
|
||||
}
|
||||
/* vpp -nOS2 -dUNIX -nBSD -nVANILLA_BSD -nVMS -nMEMLOCK -nWINDOWS -nFAR_ALLOC -f/usr/users/master/config/nonwin renfile.c */
|
||||
113
cde/lib/DtSearch/raima/rwcurr.c
Normal file
113
cde/lib/DtSearch/raima/rwcurr.c
Normal file
@@ -0,0 +1,113 @@
|
||||
/* $XConsortium: rwcurr.c /main/2 1996/05/09 04:16:39 drk $ */
|
||||
/*
|
||||
* COMPONENT_NAME: austext
|
||||
*
|
||||
* FUNCTIONS: d_rdcurr
|
||||
* d_rerdcurr
|
||||
* d_wrcurr
|
||||
*
|
||||
* ORIGINS: 157
|
||||
*
|
||||
* OBJECT CODE ONLY SOURCE MATERIALS
|
||||
*/
|
||||
/*-----------------------------------------------------------------------
|
||||
rwcurr.c -- db_VISTA currency table save/restore module.
|
||||
|
||||
(C) Copyright 1987 by Raima Corporation.
|
||||
-----------------------------------------------------------------------*/
|
||||
|
||||
/* ********************** EDIT HISTORY *******************************
|
||||
|
||||
SCR DATE INI DESCRIPTION
|
||||
----- --------- --- -----------------------------------------------------
|
||||
04-Aug-88 RTK MULTI_TASK changes
|
||||
420 16-Aug-88 RTK Made function parameters consistent with existing code.
|
||||
09-Mar-89 WLW Non-windows version needed to do free() instead of FREE().
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include "vista.h"
|
||||
#include "dbtype.h"
|
||||
|
||||
static DB_ADDR_P Cb = POINTER_INIT();
|
||||
#define cb (Cb.ptr)
|
||||
|
||||
|
||||
/* Read currency table
|
||||
*/
|
||||
d_rdcurr(currbuff, currsize TASK_PARM)
|
||||
DB_ADDR **currbuff;
|
||||
int FAR *currsize;
|
||||
TASK_DECL
|
||||
{
|
||||
int cs;
|
||||
|
||||
DB_ENTER(NO_DB_ID TASK_ID LOCK_SET(SET_NOIO));
|
||||
|
||||
cs = 2*size_st + 1;
|
||||
#ifndef NO_TIMESTAMP
|
||||
if ( db_tsrecs ) cs *= 2;
|
||||
if ( db_tssets ) cs += size_st;
|
||||
#endif
|
||||
*currbuff = (DB_ADDR *)ALLOC(NULL, cs*sizeof(DB_ADDR), "currbuff");
|
||||
if ( *currbuff == NULL ) RETURN( dberr(S_NOMEMORY) );
|
||||
*currsize = cs * sizeof(DB_ADDR);
|
||||
RETURN( d_rerdcurr(currbuff TASK_PARM) );
|
||||
}
|
||||
|
||||
int d_rerdcurr(currbuff TASK_PARM)
|
||||
DB_ADDR **currbuff;
|
||||
TASK_DECL
|
||||
{
|
||||
DB_ADDR FAR *cb_ptr;
|
||||
|
||||
DB_ENTER(NO_DB_ID TASK_ID LOCK_SET(SET_NOIO));
|
||||
|
||||
*(cb_ptr = *currbuff) = curr_rec;
|
||||
bytecpy(++cb_ptr, curr_own, size_st*sizeof(*cb_ptr));
|
||||
bytecpy(cb_ptr += size_st, curr_mem, size_st*sizeof(*cb_ptr));
|
||||
#ifndef NO_TIMESTAMP
|
||||
if ( db_tsrecs ) {
|
||||
*(cb_ptr += size_st) = cr_time;
|
||||
bytecpy(++cb_ptr, co_time, size_st*sizeof(*cb_ptr));
|
||||
bytecpy(cb_ptr += size_st, cm_time, size_st*sizeof(*cb_ptr));
|
||||
}
|
||||
if ( db_tssets ) {
|
||||
bytecpy(cb_ptr + size_st, cs_time, size_st*sizeof(*cb_ptr));
|
||||
}
|
||||
#endif
|
||||
MEM_UNLOCK(currbuff);
|
||||
RETURN( db_status = S_OKAY );
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* Write currency table
|
||||
*/
|
||||
d_wrcurr(currbuff TASK_PARM)
|
||||
DB_ADDR *currbuff;
|
||||
TASK_DECL
|
||||
{
|
||||
DB_ADDR FAR *cb_ptr;
|
||||
|
||||
DB_ENTER(NO_DB_ID TASK_ID LOCK_SET(SET_NOIO));
|
||||
|
||||
if ( (cb_ptr = currbuff) != NULL) {
|
||||
curr_rec = *cb_ptr;
|
||||
bytecpy(curr_own, ++cb_ptr, size_st*sizeof(*cb_ptr));
|
||||
bytecpy(curr_mem, cb_ptr += size_st, size_st*sizeof(*cb_ptr));
|
||||
#ifndef NO_TIMESTAMP
|
||||
if ( db_tsrecs ) {
|
||||
cr_time = *(cb_ptr += size_st);
|
||||
bytecpy(co_time, ++cb_ptr, size_st*sizeof(*cb_ptr));
|
||||
bytecpy(cm_time, cb_ptr += size_st, size_st*sizeof(*cb_ptr));
|
||||
}
|
||||
if ( db_tssets ) {
|
||||
bytecpy(cs_time, cb_ptr + size_st, size_st*sizeof(*cb_ptr));
|
||||
}
|
||||
#endif
|
||||
}
|
||||
free(currbuff);
|
||||
RETURN( db_status = S_OKAY );
|
||||
}
|
||||
/* vpp -nOS2 -dUNIX -nBSD -nVANILLA_BSD -nVMS -nMEMLOCK -nWINDOWS -nFAR_ALLOC -f/usr/users/master/config/nonwin rwcurr.c */
|
||||
53
cde/lib/DtSearch/raima/setdb.c
Normal file
53
cde/lib/DtSearch/raima/setdb.c
Normal file
@@ -0,0 +1,53 @@
|
||||
/* $XConsortium: setdb.c /main/2 1996/05/09 04:16:53 drk $ */
|
||||
/*
|
||||
* COMPONENT_NAME: austext
|
||||
*
|
||||
* FUNCTIONS: d_setdb
|
||||
*
|
||||
* ORIGINS: 157
|
||||
*
|
||||
* OBJECT CODE ONLY SOURCE MATERIALS
|
||||
*/
|
||||
/*-----------------------------------------------------------------------
|
||||
setdb.c -- db_VISTA current database set module.
|
||||
|
||||
(C) Copyright 1987 by Raima Corporation.
|
||||
-----------------------------------------------------------------------*/
|
||||
|
||||
/* ********************** EDIT HISTORY *******************************
|
||||
|
||||
SCR DATE INI DESCRIPTION
|
||||
----- --------- --- -----------------------------------------------------
|
||||
04-Aug-88 RTK MULTI_TASK changes
|
||||
419 05-Oct-88 RSC also need to set curr_rn_table
|
||||
420 06-Dec-88 WLW Updated Curr_db_table when using setdb.
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include "vista.h"
|
||||
#include "dbtype.h"
|
||||
|
||||
#ifndef ONE_DB
|
||||
/* Set current database
|
||||
*/
|
||||
d_setdb(dbn TASK_PARM)
|
||||
int dbn; /* database number */
|
||||
TASK_DECL
|
||||
{
|
||||
DB_ENTER(DB_ID TASK_ID LOCK_SET(RECORD_NOIO));
|
||||
|
||||
/* For WINDOWS, all that needs to happen here is the dbn_check() which
|
||||
DB_ENTER results in */
|
||||
if ( dbn < 0 || dbn >= no_of_dbs )
|
||||
RETURN( dberr( S_INVDB ) );
|
||||
|
||||
setdb_on = TRUE;
|
||||
curr_db_table->curr_dbt_rec = curr_rec;
|
||||
curr_db_table = &db_table[curr_db = dbn];
|
||||
curr_rn_table = &rn_table[dbn]; /*[419]*/
|
||||
curr_rec = curr_db_table->curr_dbt_rec;
|
||||
|
||||
RETURN( db_status = S_OKAY );
|
||||
}
|
||||
#endif
|
||||
/* vpp -nOS2 -dUNIX -nBSD -nVANILLA_BSD -nVMS -nMEMLOCK -nWINDOWS -nFAR_ALLOC -f/usr/users/master/config/nonwin setdb.c */
|
||||
60
cde/lib/DtSearch/raima/setmm.c
Normal file
60
cde/lib/DtSearch/raima/setmm.c
Normal file
@@ -0,0 +1,60 @@
|
||||
/* $XConsortium: setmm.c /main/2 1996/05/09 04:17:09 drk $ */
|
||||
/*
|
||||
* COMPONENT_NAME: austext
|
||||
*
|
||||
* FUNCTIONS: d_setmm
|
||||
*
|
||||
* ORIGINS: 157
|
||||
*
|
||||
* OBJECT CODE ONLY SOURCE MATERIALS
|
||||
*/
|
||||
/*-----------------------------------------------------------------------
|
||||
setmm.c -- db_VISTA set member to member module.
|
||||
|
||||
(C) Copyright 1987 by Raima Corporation.
|
||||
-----------------------------------------------------------------------*/
|
||||
|
||||
/* ********************** EDIT HISTORY *******************************
|
||||
|
||||
SCR DATE INI DESCRIPTION
|
||||
----- --------- --- -----------------------------------------------------
|
||||
04-Aug-88 RTK MULTI_TASK changes
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include "vista.h"
|
||||
#include "dbtype.h"
|
||||
|
||||
/* Set current member to current member
|
||||
*/
|
||||
d_setmm(sett, sets TASK_PARM DBN_PARM)
|
||||
int sett; /* set table entry number of target member */
|
||||
int sets; /* set table entry number of source member */
|
||||
TASK_DECL
|
||||
DBN_DECL /* database number */
|
||||
{
|
||||
int cmtype; /* current member type */
|
||||
register int mem;
|
||||
SET_ENTRY FAR *set_ptr;
|
||||
register MEMBER_ENTRY FAR *mem_ptr;
|
||||
int memtot;
|
||||
|
||||
DB_ENTER(DB_ID TASK_ID LOCK_SET(SET_IO));
|
||||
|
||||
if ((d_cmtype(sets, &cmtype TASK_PARM DBN_PARM) != S_OKAY) ||
|
||||
(nset_check(sett, &sett, (SET_ENTRY FAR * FAR *)&set_ptr) != S_OKAY))
|
||||
RETURN( db_status );
|
||||
|
||||
cmtype += NUM2INT(-RECMARK, rt_offset);
|
||||
sets += NUM2INT(-SETMARK, st_offset);
|
||||
|
||||
for (mem = set_ptr->st_members, memtot = mem + set_ptr->st_memtot,
|
||||
mem_ptr = &member_table[mem];
|
||||
mem < memtot;
|
||||
++mem, ++mem_ptr) {
|
||||
if (mem_ptr->mt_record == cmtype)
|
||||
RETURN( r_smem(&curr_mem[sets], sett) );
|
||||
}
|
||||
RETURN( dberr( S_INVMEM ) );
|
||||
}
|
||||
/* vpp -nOS2 -dUNIX -nBSD -nVANILLA_BSD -nVMS -nMEMLOCK -nWINDOWS -nFAR_ALLOC -f/usr/users/master/config/nonwin setmm.c */
|
||||
58
cde/lib/DtSearch/raima/setmo.c
Normal file
58
cde/lib/DtSearch/raima/setmo.c
Normal file
@@ -0,0 +1,58 @@
|
||||
/* $XConsortium: setmo.c /main/2 1996/05/09 04:17:25 drk $ */
|
||||
/*
|
||||
* COMPONENT_NAME: austext
|
||||
*
|
||||
* FUNCTIONS: d_setmo
|
||||
*
|
||||
* ORIGINS: 157
|
||||
*
|
||||
* OBJECT CODE ONLY SOURCE MATERIALS
|
||||
*/
|
||||
/*-----------------------------------------------------------------------
|
||||
setmo.c -- db_VISTA set member to owner module.
|
||||
|
||||
(C) Copyright 1987 by Raima Corporation.
|
||||
-----------------------------------------------------------------------*/
|
||||
|
||||
/* ********************** EDIT HISTORY *******************************
|
||||
|
||||
SCR DATE INI DESCRIPTION
|
||||
----- --------- --- -----------------------------------------------------
|
||||
04-Aug-88 RTK MULTI_TASK changes
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include "vista.h"
|
||||
#include "dbtype.h"
|
||||
|
||||
/* Set current member to current owner
|
||||
*/
|
||||
d_setmo(setm, seto TASK_PARM DBN_PARM)
|
||||
int setm; /* set table entry number of member */
|
||||
int seto; /* set table entry number of owner */
|
||||
TASK_DECL
|
||||
DBN_DECL /* database number */
|
||||
{
|
||||
register int mem;
|
||||
SET_ENTRY FAR *setm_ptr, FAR *seto_ptr;
|
||||
register MEMBER_ENTRY FAR *mem_ptr;
|
||||
int memtot;
|
||||
|
||||
DB_ENTER(DB_ID TASK_ID LOCK_SET(SET_IO));
|
||||
|
||||
if ((nset_check(seto, &seto, (SET_ENTRY FAR * FAR *)&seto_ptr) != S_OKAY) ||
|
||||
(nset_check(setm, &setm, (SET_ENTRY FAR * FAR *)&setm_ptr) != S_OKAY))
|
||||
RETURN( db_status );
|
||||
|
||||
if (null_dba((char FAR *)&curr_own[seto])) RETURN( dberr(S_NOCO) );
|
||||
|
||||
for (mem = setm_ptr->st_members, memtot = mem + setm_ptr->st_memtot,
|
||||
mem_ptr = &member_table[mem];
|
||||
mem < memtot;
|
||||
++mem, ++mem_ptr) {
|
||||
if (mem_ptr->mt_record == seto_ptr->st_own_rt)
|
||||
RETURN( r_smem(&curr_own[seto], setm) );
|
||||
}
|
||||
RETURN( dberr( S_INVMEM ) );
|
||||
}
|
||||
/* vpp -nOS2 -dUNIX -nBSD -nVANILLA_BSD -nVMS -nMEMLOCK -nWINDOWS -nFAR_ALLOC -f/usr/users/master/config/nonwin setmo.c */
|
||||
62
cde/lib/DtSearch/raima/setmr.c
Normal file
62
cde/lib/DtSearch/raima/setmr.c
Normal file
@@ -0,0 +1,62 @@
|
||||
/* $XConsortium: setmr.c /main/2 1996/05/09 04:17:41 drk $ */
|
||||
/*
|
||||
* COMPONENT_NAME: austext
|
||||
*
|
||||
* FUNCTIONS: d_setmr
|
||||
*
|
||||
* ORIGINS: 157
|
||||
*
|
||||
* OBJECT CODE ONLY SOURCE MATERIALS
|
||||
*/
|
||||
/*-----------------------------------------------------------------------
|
||||
setmr.c -- db_VISTA set member to current record module.
|
||||
|
||||
(C) Copyright 1987 by Raima Corporation.
|
||||
-----------------------------------------------------------------------*/
|
||||
|
||||
/* ********************** EDIT HISTORY *******************************
|
||||
|
||||
SCR DATE INI DESCRIPTION
|
||||
----- --------- --- -----------------------------------------------------
|
||||
04-Aug-88 RTK MULTI_TASK changes
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include "vista.h"
|
||||
#include "dbtype.h"
|
||||
|
||||
/* Set current member to current record
|
||||
*/
|
||||
d_setmr(set TASK_PARM DBN_PARM)
|
||||
int set; /* set table entry number */
|
||||
TASK_DECL
|
||||
DBN_DECL /* database number */
|
||||
{
|
||||
int crtype; /* current record type */
|
||||
register int mem;
|
||||
SET_ENTRY FAR *set_ptr;
|
||||
register MEMBER_ENTRY FAR *mem_ptr;
|
||||
int memtot;
|
||||
|
||||
DB_ENTER(DB_ID TASK_ID LOCK_SET(SET_IO));
|
||||
|
||||
if (nset_check(set, &set, (SET_ENTRY FAR * FAR *)&set_ptr) != S_OKAY)
|
||||
RETURN( db_status );
|
||||
|
||||
if ( ! curr_rec )
|
||||
RETURN( dberr( S_NOCR ) );
|
||||
|
||||
if ( d_crtype(&crtype TASK_PARM DBN_PARM) != S_OKAY )
|
||||
RETURN( db_status );
|
||||
crtype += NUM2INT(-RECMARK, rt_offset);
|
||||
|
||||
for (mem = set_ptr->st_members, memtot = mem + set_ptr->st_memtot,
|
||||
mem_ptr = &member_table[mem];
|
||||
mem < memtot;
|
||||
++mem, ++mem_ptr) {
|
||||
if ( mem_ptr->mt_record == crtype )
|
||||
RETURN( r_smem( &curr_rec, set ) );
|
||||
}
|
||||
RETURN( dberr( S_INVMEM ) );
|
||||
}
|
||||
/* vpp -nOS2 -dUNIX -nBSD -nVANILLA_BSD -nVMS -nMEMLOCK -nWINDOWS -nFAR_ALLOC -f/usr/users/master/config/nonwin setmr.c */
|
||||
66
cde/lib/DtSearch/raima/setom.c
Normal file
66
cde/lib/DtSearch/raima/setom.c
Normal file
@@ -0,0 +1,66 @@
|
||||
/* $XConsortium: setom.c /main/2 1996/05/09 04:17:55 drk $ */
|
||||
/*
|
||||
* COMPONENT_NAME: austext
|
||||
*
|
||||
* FUNCTIONS: d_setom
|
||||
*
|
||||
* ORIGINS: 157
|
||||
*
|
||||
* OBJECT CODE ONLY SOURCE MATERIALS
|
||||
*/
|
||||
/*-----------------------------------------------------------------------
|
||||
setom.c -- db_VISTA set owner to member module.
|
||||
|
||||
(C) Copyright 1987 by Raima Corporation.
|
||||
-----------------------------------------------------------------------*/
|
||||
|
||||
/* ********************** EDIT HISTORY *******************************
|
||||
|
||||
SCR DATE INI DESCRIPTION
|
||||
----- --------- --- -----------------------------------------------------
|
||||
04-Aug-88 RTK MULTI_TASK changes
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include "vista.h"
|
||||
#include "dbtype.h"
|
||||
|
||||
|
||||
/* Set current owner to current member
|
||||
*/
|
||||
d_setom(nseto, nsetm TASK_PARM DBN_PARM)
|
||||
int nseto; /* set table entry number of owner */
|
||||
int nsetm; /* set table entry number of member */
|
||||
TASK_DECL
|
||||
DBN_DECL /* database number */
|
||||
{
|
||||
int seto, setm;
|
||||
int cmtype; /* current record type */
|
||||
SET_ENTRY FAR *set_ptr;
|
||||
|
||||
DB_ENTER(DB_ID TASK_ID LOCK_SET(SET_IO));
|
||||
|
||||
if ((d_cmtype(nsetm, &cmtype TASK_PARM DBN_PARM) != S_OKAY) ||
|
||||
(nset_check(nseto, &seto, (SET_ENTRY FAR * FAR *)&set_ptr) != S_OKAY))
|
||||
RETURN( db_status );
|
||||
cmtype += NUM2INT(-RECMARK, rt_offset);
|
||||
setm = NUM2INT(nsetm - SETMARK, st_offset);
|
||||
|
||||
if (set_ptr->st_own_rt != cmtype)
|
||||
RETURN( dberr( S_INVOWN ) );
|
||||
|
||||
curr_own[seto] = curr_mem[setm];
|
||||
curr_mem[seto] = NULL_DBA;
|
||||
#ifndef NO_TIMESTAMP
|
||||
/* set timestamps */
|
||||
if ( db_tsrecs ) {
|
||||
co_time[seto] = cm_time[setm];
|
||||
cm_time[seto] = 0L;
|
||||
}
|
||||
if ( db_tssets ) {
|
||||
d_utscs( nseto, &cs_time[seto] TASK_PARM DBN_PARM );
|
||||
}
|
||||
#endif
|
||||
RETURN( db_status );
|
||||
}
|
||||
/* vpp -nOS2 -dUNIX -nBSD -nVANILLA_BSD -nVMS -nMEMLOCK -nWINDOWS -nFAR_ALLOC -f/usr/users/master/config/nonwin setom.c */
|
||||
66
cde/lib/DtSearch/raima/setoo.c
Normal file
66
cde/lib/DtSearch/raima/setoo.c
Normal file
@@ -0,0 +1,66 @@
|
||||
/* $XConsortium: setoo.c /main/2 1996/05/09 04:18:11 drk $ */
|
||||
/*
|
||||
* COMPONENT_NAME: austext
|
||||
*
|
||||
* FUNCTIONS: d_setoo
|
||||
*
|
||||
* ORIGINS: 157
|
||||
*
|
||||
* OBJECT CODE ONLY SOURCE MATERIALS
|
||||
*/
|
||||
/*-----------------------------------------------------------------------
|
||||
setoo.c -- db_VISTA set owner to owner module.
|
||||
|
||||
(C) Copyright 1987 by Raima Corporation.
|
||||
-----------------------------------------------------------------------*/
|
||||
|
||||
/* ********************** EDIT HISTORY *******************************
|
||||
|
||||
SCR DATE INI DESCRIPTION
|
||||
----- --------- --- -----------------------------------------------------
|
||||
04-Aug-88 RTK MULTI_TASK changes
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include "vista.h"
|
||||
#include "dbtype.h"
|
||||
|
||||
|
||||
/* Set current owner to current owner
|
||||
*/
|
||||
d_setoo(nsett, nsets TASK_PARM DBN_PARM)
|
||||
int nsett; /* set table entry number of target owner */
|
||||
int nsets; /* set table entry number of source owner */
|
||||
TASK_DECL
|
||||
DBN_DECL /* database number */
|
||||
{
|
||||
int sett, sets;
|
||||
SET_ENTRY FAR *sett_ptr, FAR *sets_ptr;
|
||||
|
||||
DB_ENTER(DB_ID TASK_ID LOCK_SET(SET_IO));
|
||||
|
||||
if ((nset_check(nsett, &sett, (SET_ENTRY FAR * FAR *)&sett_ptr) != S_OKAY) ||
|
||||
(nset_check(nsets, &sets, (SET_ENTRY FAR * FAR *)&sets_ptr) != S_OKAY))
|
||||
RETURN( db_status );
|
||||
|
||||
if ( sett_ptr->st_own_rt != sets_ptr->st_own_rt )
|
||||
RETURN( dberr( S_INVOWN ) );
|
||||
|
||||
if (null_dba((char FAR *)&curr_own[sets]))
|
||||
RETURN( dberr(S_NOCO) );
|
||||
|
||||
curr_own[sett] = curr_own[sets];
|
||||
curr_mem[sett] = NULL_DBA;
|
||||
#ifndef NO_TIMESTAMP
|
||||
/* set timestamps */
|
||||
if ( db_tsrecs ) {
|
||||
co_time[sett] = co_time[sets];
|
||||
cm_time[sett] = 0L;
|
||||
}
|
||||
if ( db_tssets ) {
|
||||
d_utscs( nsett, &cs_time[sett] TASK_PARM DBN_PARM );
|
||||
}
|
||||
#endif
|
||||
RETURN( db_status = S_OKAY );
|
||||
}
|
||||
/* vpp -nOS2 -dUNIX -nBSD -nVANILLA_BSD -nVMS -nMEMLOCK -nWINDOWS -nFAR_ALLOC -f/usr/users/master/config/nonwin setoo.c */
|
||||
64
cde/lib/DtSearch/raima/setor.c
Normal file
64
cde/lib/DtSearch/raima/setor.c
Normal file
@@ -0,0 +1,64 @@
|
||||
/* $XConsortium: setor.c /main/2 1996/05/09 04:18:27 drk $ */
|
||||
/*
|
||||
* COMPONENT_NAME: austext
|
||||
*
|
||||
* FUNCTIONS: d_setor
|
||||
*
|
||||
* ORIGINS: 157
|
||||
*
|
||||
* OBJECT CODE ONLY SOURCE MATERIALS
|
||||
*/
|
||||
/*-----------------------------------------------------------------------
|
||||
setor.c -- db_VISTA set owner to current record module.
|
||||
|
||||
(C) Copyright 1987 by Raima Corporation.
|
||||
-----------------------------------------------------------------------*/
|
||||
|
||||
/* ********************** EDIT HISTORY *******************************
|
||||
|
||||
SCR DATE INI DESCRIPTION
|
||||
----- --------- --- -----------------------------------------------------
|
||||
04-Aug-88 RTK MULTI_TASK changes
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include "vista.h"
|
||||
#include "dbtype.h"
|
||||
|
||||
/* Set current owner to current record
|
||||
*/
|
||||
d_setor(nset TASK_PARM DBN_PARM)
|
||||
int nset; /* set number */
|
||||
TASK_DECL
|
||||
DBN_DECL /* database number */
|
||||
{
|
||||
int set;
|
||||
int crtype; /* current record type */
|
||||
SET_ENTRY FAR *set_ptr;
|
||||
|
||||
DB_ENTER(DB_ID TASK_ID LOCK_SET(SET_IO));
|
||||
|
||||
if ((nset_check(nset, &set, (SET_ENTRY FAR * FAR *)&set_ptr) != S_OKAY) ||
|
||||
(d_crtype(&crtype TASK_PARM DBN_PARM) != S_OKAY))
|
||||
RETURN( db_status );
|
||||
|
||||
crtype += NUM2INT(-RECMARK, rt_offset);
|
||||
|
||||
if ( set_ptr->st_own_rt != crtype )
|
||||
RETURN( dberr( S_INVOWN ) );
|
||||
|
||||
curr_own[set] = curr_rec;
|
||||
curr_mem[set] = NULL_DBA;
|
||||
#ifndef NO_TIMESTAMP
|
||||
/* set timestamps */
|
||||
if ( db_tsrecs ) {
|
||||
co_time[set] = cr_time;
|
||||
cm_time[set] = 0L;
|
||||
}
|
||||
if ( db_tssets ) {
|
||||
d_utscs( nset, &cs_time[set] TASK_PARM DBN_PARM );
|
||||
}
|
||||
#endif
|
||||
RETURN( db_status );
|
||||
}
|
||||
/* vpp -nOS2 -dUNIX -nBSD -nVANILLA_BSD -nVMS -nMEMLOCK -nWINDOWS -nFAR_ALLOC -f/usr/users/master/config/nonwin setor.c */
|
||||
53
cde/lib/DtSearch/raima/setrm.c
Normal file
53
cde/lib/DtSearch/raima/setrm.c
Normal file
@@ -0,0 +1,53 @@
|
||||
/* $XConsortium: setrm.c /main/2 1996/05/09 04:18:40 drk $ */
|
||||
/*
|
||||
* COMPONENT_NAME: austext
|
||||
*
|
||||
* FUNCTIONS: d_setrm
|
||||
*
|
||||
* ORIGINS: 157
|
||||
*
|
||||
* OBJECT CODE ONLY SOURCE MATERIALS
|
||||
*/
|
||||
/*-----------------------------------------------------------------------
|
||||
setrm.c -- db_VISTA set current record to member module.
|
||||
|
||||
(C) Copyright 1987 by Raima Corporation.
|
||||
-----------------------------------------------------------------------*/
|
||||
|
||||
/* ********************** EDIT HISTORY *******************************
|
||||
|
||||
SCR DATE INI DESCRIPTION
|
||||
----- --------- --- -----------------------------------------------------
|
||||
04-Aug-88 RTK MULTI_TASK changes
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include "vista.h"
|
||||
#include "dbtype.h"
|
||||
|
||||
/* Set current record to current member
|
||||
*/
|
||||
d_setrm(set TASK_PARM DBN_PARM)
|
||||
int set; /* set table entry number */
|
||||
TASK_DECL
|
||||
DBN_DECL /* database number */
|
||||
{
|
||||
SET_ENTRY FAR *set_ptr;
|
||||
|
||||
DB_ENTER(DB_ID TASK_ID LOCK_SET(SET_NOIO));
|
||||
|
||||
if (nset_check(set, &set, (SET_ENTRY FAR * FAR *)&set_ptr) != S_OKAY)
|
||||
RETURN( db_status );
|
||||
|
||||
if ( ! curr_mem[set] )
|
||||
RETURN( dberr( S_NOCM ) );
|
||||
|
||||
curr_rec = curr_mem[set];
|
||||
#ifndef NO_TIMESTAMP
|
||||
/* set timestamp */
|
||||
if ( db_tsrecs )
|
||||
cr_time = cm_time[set];
|
||||
#endif
|
||||
RETURN( db_status = S_OKAY );
|
||||
}
|
||||
/* vpp -nOS2 -dUNIX -nBSD -nVANILLA_BSD -nVMS -nMEMLOCK -nWINDOWS -nFAR_ALLOC -f/usr/users/master/config/nonwin setrm.c */
|
||||
53
cde/lib/DtSearch/raima/setro.c
Normal file
53
cde/lib/DtSearch/raima/setro.c
Normal file
@@ -0,0 +1,53 @@
|
||||
/* $XConsortium: setro.c /main/2 1996/05/09 04:18:54 drk $ */
|
||||
/*
|
||||
* COMPONENT_NAME: austext
|
||||
*
|
||||
* FUNCTIONS: d_setro
|
||||
*
|
||||
* ORIGINS: 157
|
||||
*
|
||||
* OBJECT CODE ONLY SOURCE MATERIALS
|
||||
*/
|
||||
/*-----------------------------------------------------------------------
|
||||
setro.c -- db_VISTA set current record to owner module.
|
||||
|
||||
(C) Copyright 1987 by Raima Corporation.
|
||||
-----------------------------------------------------------------------*/
|
||||
|
||||
/* ********************** EDIT HISTORY *******************************
|
||||
|
||||
SCR DATE INI DESCRIPTION
|
||||
----- --------- --- -----------------------------------------------------
|
||||
04-Aug-88 RTK MULTI_TASK changes
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include "vista.h"
|
||||
#include "dbtype.h"
|
||||
|
||||
/* Set current record to current owner
|
||||
*/
|
||||
d_setro(set TASK_PARM DBN_PARM)
|
||||
int set; /* set table entry number */
|
||||
TASK_DECL
|
||||
DBN_DECL /* database number */
|
||||
{
|
||||
SET_ENTRY FAR *set_ptr;
|
||||
|
||||
DB_ENTER(DB_ID TASK_ID LOCK_SET(SET_NOIO));
|
||||
|
||||
if (nset_check(set, &set, (SET_ENTRY FAR * FAR *)&set_ptr) != S_OKAY)
|
||||
RETURN( db_status );
|
||||
|
||||
if ( ! curr_own[set] )
|
||||
RETURN( dberr( S_NOCO ) );
|
||||
|
||||
curr_rec = curr_own[set];
|
||||
#ifndef NO_TIMESTAMP
|
||||
/* set timestamp */
|
||||
if ( db_tsrecs )
|
||||
cr_time = co_time[set];
|
||||
#endif
|
||||
RETURN( db_status = S_OKAY );
|
||||
}
|
||||
/* vpp -nOS2 -dUNIX -nBSD -nVANILLA_BSD -nVMS -nMEMLOCK -nWINDOWS -nFAR_ALLOC -f/usr/users/master/config/nonwin setro.c */
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user