#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 *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 */
#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 /**/
#include "dbxtrn.h"
typedef struct LOOKUP_ENTRY_S {
-#ifdef MULTI_TASK
- TASK *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 */
#define _STRING_H
#endif
#include "proto.h"
-#ifdef MULTI_TASK
-#ifdef NO_DT_COVER
-#include "dtcover.h"
-#endif
-#endif
#ifndef SINGLE_USER
/* record/set lock descriptor */
PAGE_ENTRY_P Dbpg_table = POINTER_INIT(); /* database page table */
static struct
{
-#ifdef MULTI_TASK
- TASK *task;
-#endif
FILE_NO file;
F_ADDR pageno;
int slot;
return( dberr(S_NOMEMORY) );
byteset(used_files, 0, (size_ft + 1)*sizeof(*used_files));
-#ifdef MULTI_TASK
- last_dblu.task = NULL;
-#endif
last_dblu.file = -1;
last_dblu.pageno = -1L;
last_dblu.slot = -1;
for (pg_no = 0; pg_no < pg_cnt; ++pg_no, ++lu_ptr, ++pg_ptr)
{
-#ifdef MULTI_TASK
- lu_ptr->task = NULL;
-#endif
lu_ptr->file = -1;
lu_ptr->pageno = -1L;
lu_ptr->pg_slot = pg_no;
int pgt_lc; /* loop control */
PAGE_ENTRY *pg_ptr;
-#ifdef MULTI_TASK
- if ( task_count > 1 ) {
- return;
- }
-#endif
MEM_UNLOCK(&db_global.Pgzero);
FREE(&db_global.Pgzero);
MEM_UNLOCK(&Used_files);
dio_findpg(s_file, 0L, NULL, NULL, &lu_ptr);
dio_findpg(e_file, 0L, NULL, NULL, &lu2_ptr);
-#ifdef MULTI_TASK
- last_dblu.task = NULL;
-#endif
last_dblu.file = -1;
last_dblu.pageno = -1L;
last_dblu.slot = -1;
while ((lu_ptr > db_lookup) && ((--lu_ptr)->file >= 0)) {
--lu2_ptr;
-#ifdef MULTI_TASK
- lu2_ptr->task = lu_ptr->task;
-#endif
lu2_ptr->file = lu_ptr->file;
lu2_ptr->pageno = lu_ptr->pageno;
/* exchange page slot numbers */
while (lu_ptr < lu2_ptr) {
-#ifdef MULTI_TASK
- lu_ptr->task = NULL;
-#endif
lu_ptr->file = -1;
lu_ptr->pageno = -1L;
pg_ptr = &dbpg_table[lu_ptr->pg_slot];
continue;
}
lu_ptr = &db_lookup[pg_ptr->lu_slot];
-#ifdef MULTI_TASK
- if ( lu_ptr->task != Currtask.v.ptr ) {
- continue;
- }
-#endif
#ifndef NO_TRANS
if ((dboptions & TRLOGGING) && trans_id && !trcommit && use_ovfl) {
/* flush to overflow/log file -- before tr commit */
PAGE_ENTRY * *xpg_ptr; /* pointer to page table entry for found page */
LOOKUP_ENTRY * *xlu_ptr;/* pointer to lookup table slot for found page*/
{
-#ifdef MULTI_TASK
- CHAR_P Tempbuff;
-#define tempbuff Tempbuff.ptr
-#endif
LOOKUP_ENTRY *lookup; /* = db_lookup or ix_lookup */
int pgtab_sz; /* = db_pgtab_sz or ix_pgtab_sz */
long cmp;
BOOLEAN db_cache; /* TRUE if currently using dbpg_table */
F_ADDR ovfl_addr;
#endif
-#ifdef MULTI_TASK
- INT pgsize;
-#endif
#ifdef NO_TRANS
/* check if desired page was last one */
-#ifdef MULTI_TASK
- if ((Currtask.v.ptr == last_dblu.task) && (file == last_dblu.file) && (page == last_dblu.pageno)) {
-#else
if ((file == last_dblu.file) && (page == last_dblu.pageno)) {
-#endif
if (xlu_ptr != NULL)
*xlu_ptr = &db_lookup[last_dblu.slot];
if (xpg_ptr != NULL)
#else /* NO_TRANS */
if (db_cache = (!pg_table || (pg_table == dbpg_table))) {
/* check if desired page was last one */
-#ifdef MULTI_TASK
- if ((Currtask.v.ptr == last_dblu.task) && (file == last_dblu.file) &&
- (page == last_dblu.pageno)) {
-#else
if ((file == last_dblu.file) && (page == last_dblu.pageno)) {
-#endif
if (xlu_ptr != NULL)
*xlu_ptr = &db_lookup[last_dblu.slot];
if (xpg_ptr != NULL)
u = pgtab_sz - 1;
while (u >= l) {
lu_ptr = &lookup[lu_slot = (l + u)/2];
-#ifdef MULTI_TASK
- if ((cmp = Currtask.v.ptr - lu_ptr->task) == 0)
-#endif
if ((cmp = file - lu_ptr->file) == 0)
cmp = page - lu_ptr->pageno;
if (cmp < 0)
#ifndef NO_TRANS
if (db_cache)
{
-#endif
-#ifdef MULTI_TASK
- last_dblu.task = lu_ptr->task;
#endif
last_dblu.file = lu_ptr->file;
last_dblu.pageno = lu_ptr->pageno;
#ifdef SINGLE_USER
if (!db_cache || (EXCL_OPEN() && !trans_id)) {
#else
-#ifdef MULTI_TASK
- MEM_LOCK(&replu_ptr->task->Excl_locks);
-#endif
if (!db_cache || ((EXCL_OPEN() ||
-#ifdef MULTI_TASK
- ( replu_ptr->task == Currtask.v.ptr ) ?
- excl_locks[lookup[pg_ptr->lu_slot].file] :
- replu_ptr->task->Excl_locks.ptr[replu_ptr->file]) &&
- !trans_id)) {
-#else
excl_locks[lookup[pg_ptr->lu_slot].file]) && !trans_id)) {
-#endif /* MULTI_TASK */
#endif /* SINGLE_USER */
/* ix page swapping occurs here */
dio_out(pg_ptr, replu_ptr, db_cache);
--no_modheld; /* must be in db cache */
if (o_write(pg_ptr, replu_ptr) != S_OKAY) return( db_status );
}
-#ifdef MULTI_TASK
- MEM_UNLOCK(&replu_ptr->task->Excl_locks);
-#endif
}
pg_ptr->ovfl_addr = ovfl_addr;
#endif /* NO_TRANS */
--replu_ptr;
}
}
-#ifdef MULTI_TASK
-
-#ifdef NO_TRANS
- pgsize = file_table[( lu_ptr->file > -1 ) ? lu_ptr->file : file].ft_pgsize;
-#else
- pgsize = ( db_cache )
- ? file_table[( lu_ptr->file > -1 ) ? lu_ptr->file : file].ft_pgsize
- : file_table[ov_file].ft_pgsize;
-#endif
- if ( ! pgsize ) {
- pgsize = page_size;
- }
- if ( pgsize != file_table[file].ft_pgsize ) {
- Tempbuff.ptr = NULL;
- tempbuff = ALLOC(&Tempbuff, file_table[file].ft_pgsize, "dbpgbuff");
- if ( ! tempbuff ) {
- return( dberr(S_NOMEMORY) );
- }
- if ( pg_ptr->buff ) {
- MEM_UNLOCK(&pg_ptr->Buff);
- FREE(&pg_ptr->Buff);
- }
- MEM_UNLOCK(&Tempbuff);
- pg_ptr->Buff = Tempbuff;
- }
-#endif /* MULTI_TASK */
-
-#ifdef MULTI_TASK
- lu_ptr->task = Currtask.v.ptr;
-#endif
lu_ptr->file = file;
lu_ptr->pageno = page;
lu_ptr->pg_slot = pg_slot;
if (xpg_ptr != NULL)
*xpg_ptr = pg_ptr;
#ifdef NO_TRANS
-#ifdef MULTI_TASK
- last_dblu.task = lu_ptr->task;
-#endif
last_dblu.file = lu_ptr->file;
last_dblu.pageno = lu_ptr->pageno;
last_dblu.slot = lu_slot;
dio_in(pg_ptr, lu_ptr);
#else
if (db_cache) {
-#ifdef MULTI_TASK
- last_dblu.task = lu_ptr->task;
-#endif
last_dblu.file = lu_ptr->file;
last_dblu.pageno = lu_ptr->pageno;
last_dblu.slot = lu_slot;
typedef struct {char *ptr; LOCK_DESC} CHAR_P;
typedef struct {DB_ADDR *ptr; LOCK_DESC} DB_ADDR_P;
-#ifdef MULTI_TASK
-typedef struct {struct TASK_S *ptr; LOCK_DESC} TASK_P;
-typedef struct {char *ptr; LOCK_DESC} QFAKE_P;
-typedef struct {
- TASK_P v;
- QFAKE_P q;
-} DB_TASK;
-#endif
/* Allow for function prototyping */
#define DBN_Dn /**/
#endif
-#ifdef MULTI_TASK
-#define TASK_DBN_D1 P1(DB_TASK) DBN_Dn
-#define TASK_D1 P1(DB_TASK)
-#define TASK_Di Pi(DB_TASK)
-#define TASK_PTR_D1 P1(DB_TASK *)
-#define TASK_PTR_Di Pi(DB_TASK *)
-#define CURRTASK_PARM , Currtask
-#define CURRTASK_ONLY Currtask
-#else
#define TASK_DBN_D1 DBN_D1
#define TASK_D1 P0
#define TASK_Di /**/
#define TASK_PTR_Di /**/
#define CURRTASK_PARM /**/
#define CURRTASK_ONLY /**/
-#endif
#define LOCK_D1 /**/
#define LOCK_Di /**/
#include "dproto.h"
-#ifdef MULTI_TASK
-#include "task.h"
-#endif
/* vpp -nOS2 -dUNIX -nBSD -nVANILLA_BSD -nVMS -nMEMLOCK -nWINDOWS -nFAR_ALLOC vista.h */