ING_DB
This commit is contained in:
parent
91e38cb9dd
commit
60146eec23
|
|
@ -0,0 +1,142 @@
|
|||
# include <stdio.h>
|
||||
/* Flag MSDOS is predefined in MSDOS */
|
||||
# ifdef MSDOS
|
||||
# include "../h/gen.h"
|
||||
# else
|
||||
# include "../conf/gen.h"
|
||||
# endif
|
||||
# ifdef MSDOS
|
||||
# include "../h/ingres.h"
|
||||
# include "../h/aux#.h"
|
||||
# else
|
||||
# include "../h/dbs.h"
|
||||
# include "../h/aux.h"
|
||||
# endif
|
||||
# include "../h/access.h"
|
||||
# include "../h/symbol.h"
|
||||
# include "../h/catalog.h"
|
||||
# include "../h/lock.h"
|
||||
|
||||
# define AMX_TRACE
|
||||
# define AM_TRACE
|
||||
|
||||
# ifdef MSDOS
|
||||
# define AAam_addbuf acc_addbuf
|
||||
# define AAam_clearkeys clearkeys
|
||||
# define AAam_delete delete
|
||||
# define AAam_exit acc_close
|
||||
# define AAam_flush_rel flush_rel
|
||||
# define AAam_get get
|
||||
# define AAam_insert insert
|
||||
# define AAam_replace replace
|
||||
# define AAam_setkey setkey
|
||||
# define AAam_start acc_init
|
||||
# define AAbequal bequal
|
||||
# define AAbmove(s,d,l) memcpy(d,s,l)
|
||||
# define AAcc_head Acc_head
|
||||
# define AAccerror Accerror
|
||||
# define AAdatabase Database
|
||||
# define AAdbname Dbname
|
||||
# define AAdbpath Dbpath
|
||||
# define AAdmin Admin
|
||||
# define AAdparam paramd
|
||||
# define AAdumptid dumptid
|
||||
# define AAerrfn errfilen
|
||||
# define AAget_tuple get_tuple
|
||||
# define AAgetequal getequal
|
||||
# define AAgetpage get_page
|
||||
# define AAicompare icompare
|
||||
# define AAndxsearch ndxsearch
|
||||
# define AApageflush pageflush
|
||||
# define AApath Pathname
|
||||
# define AApratt printatt
|
||||
# define AAprkey prkey
|
||||
# define AAprtup printup
|
||||
# define AAput_tuple put_tuple
|
||||
# define AArelclose closer
|
||||
# define AArelopen openr
|
||||
# define AAresetacc resetacc
|
||||
# define AArhash rhash
|
||||
# define AAsetcsl setcsl
|
||||
# define AAsetdbl setdbl
|
||||
# define AAsetpgl setpgl
|
||||
# define AAsetrll setrll
|
||||
# define AAstuff_page stuff_page
|
||||
# define AAtTfp tTfp
|
||||
# define AAunlall unlall
|
||||
# define AAunlcs unlcs
|
||||
# define AAunldb unldb
|
||||
# define AAunlpg unlpg
|
||||
# define AAunlrl unlrl
|
||||
# define AAusercode Usercode
|
||||
# define RELROPEN(fp) ((fp + 1) * 5)
|
||||
# define RELWOPEN(fp) ((fp + 1) * -5)
|
||||
# define attribute domain
|
||||
extern char *AAdatabase;
|
||||
extern char *memcpy();
|
||||
typedef struct accbuf ACCBUF;
|
||||
# else
|
||||
extern char *AAbmove();
|
||||
# endif
|
||||
|
||||
# ifndef bitset
|
||||
# define bitset(b, s) ((b) & (s))
|
||||
# define clrbit(b, s) ((s) &= ~(b))
|
||||
# endif
|
||||
|
||||
# define DB_SHARE 0010
|
||||
|
||||
# define AP_EQ 0001
|
||||
# define AP_LT 0002
|
||||
# define AP_LE 0004
|
||||
# define AP_NE 0010
|
||||
# define AP_GT 0020
|
||||
# define AP_GE 0040
|
||||
# define AP_P1 0100
|
||||
# define AP_P2 0200
|
||||
|
||||
# ifdef EBCDIC
|
||||
# define LAST_CHAR 0377
|
||||
# else
|
||||
# define LAST_CHAR 0177
|
||||
# endif
|
||||
|
||||
# define AA_rel AA_0
|
||||
# define AA_att AA_1
|
||||
# define AA_ind AA_2
|
||||
|
||||
struct descxx
|
||||
{
|
||||
DESC xx_desc;
|
||||
struct descxx *xx_next;
|
||||
struct descxx *xx_index;
|
||||
char *xx_indom;
|
||||
struct descxx *xx_ta;
|
||||
char xx_refresh;
|
||||
char xx_excl;
|
||||
short xx_locks;
|
||||
};
|
||||
typedef struct descxx DESCXX;
|
||||
|
||||
extern struct descxx *AA_DESC;
|
||||
extern struct descxx *AA_TA; /* begin of transaction */
|
||||
extern struct descxx *AA_TE; /* end of transaction */
|
||||
extern int AA_NOLOCKS;
|
||||
extern int AA_LOCKS;
|
||||
extern int AA_PAT;
|
||||
extern DESC *AA_0; /* relation */
|
||||
extern DESC *AA_1; /* attribute */
|
||||
extern DESC *AA_2; /* indexes */
|
||||
extern int AA;
|
||||
extern long AA_LOW;
|
||||
extern long AA_HIGH;
|
||||
extern long AA_TID;
|
||||
extern char *AA_STUP;
|
||||
extern char *AAdbpath;
|
||||
extern int errno;
|
||||
|
||||
/* UPDATE globals */
|
||||
extern struct descxx *AAp_desc; /* global primary description */
|
||||
extern char *AAold_tuple; /* global primary tuple pointer */
|
||||
extern char AA_SET_ALL_KEYS[];
|
||||
extern long AAdaemon;
|
||||
|
|
@ -0,0 +1,295 @@
|
|||
# include "AA_liba.h"
|
||||
|
||||
/* FIND with AP_FULLKEY on HASH */
|
||||
AAhash(d, lowtid, hightid, key)
|
||||
register DESCXX *d;
|
||||
register struct tup_id *lowtid;
|
||||
register long *hightid;
|
||||
char *key;
|
||||
{
|
||||
long pageid;
|
||||
extern long AArhash();
|
||||
|
||||
# ifdef AMX_TRACE
|
||||
AAtTfp(23, 0,
|
||||
# ifdef MSDOS
|
||||
"hash\t\t`%.10s' (%d)\n",
|
||||
# else
|
||||
"hash\t\t`%.14s' (%d)\n",
|
||||
# endif
|
||||
d->xx_desc.reldum.relid, AA_PAT);
|
||||
# endif
|
||||
errno = 0;
|
||||
|
||||
if (AA_PAT)
|
||||
{
|
||||
/* found a pattern in key */
|
||||
AAbmove(&AA_LOW, lowtid, sizeof *lowtid);
|
||||
*hightid = AA_HIGH;
|
||||
}
|
||||
else
|
||||
{
|
||||
pageid = AArhash(d, key);
|
||||
AAstuff_page(lowtid, &pageid);
|
||||
lowtid->line_id = SCANTID;
|
||||
*hightid = *((long *) lowtid);
|
||||
}
|
||||
|
||||
# ifdef AM_TRACE
|
||||
AAtTfp(23, 10, "##AM_RHASH\n");
|
||||
if (AAtTfp(23, 11, "##\t\toldkey"))
|
||||
AAprkey(d, key);
|
||||
if (AAtTfp(23, 12, "##\t\tlo_"))
|
||||
AAdumptid(lowtid);
|
||||
if (AAtTfp(23, 13, "##\t\thi_"))
|
||||
AAdumptid(hightid);
|
||||
# endif
|
||||
|
||||
}
|
||||
|
||||
|
||||
/* FIND with AP_FULLKEY on ISAM */
|
||||
AAisam(d, lowtid, hightid, given, key)
|
||||
register DESCXX *d;
|
||||
register long *lowtid;
|
||||
register long *hightid;
|
||||
register char *given;
|
||||
register char *key;
|
||||
{
|
||||
# ifdef AMX_TRACE
|
||||
AAtTfp(24, 0,
|
||||
# ifdef MSDOS
|
||||
"isam\t\t`%.10s' (%d)\n",
|
||||
# else
|
||||
"isam\t\t`%.14s' (%d)\n",
|
||||
# endif
|
||||
d->xx_desc.reldum.relid, AA_PAT);
|
||||
# endif
|
||||
errno = 0;
|
||||
|
||||
if (AA_PAT)
|
||||
{
|
||||
/* found a pattern in key */
|
||||
AAlisam(d, lowtid, given, key);
|
||||
AAhisam(d, hightid, given, key);
|
||||
}
|
||||
else
|
||||
{
|
||||
AA = AAndxsearch(d, lowtid, key, -1, 1);
|
||||
|
||||
# ifdef AM_TRACE
|
||||
AAtTfp(24, 10, "##AM_=_SEARCH\t%d\n", AA);
|
||||
if (AAtTfp(24, 11, "##\t\toldkey"))
|
||||
AAprkey(d, key);
|
||||
if (AAtTfp(24, 12, "##\t\tnew"))
|
||||
AAdumptid(lowtid);
|
||||
# endif
|
||||
|
||||
if (AA)
|
||||
AAerror(8, d->xx_desc.reldum.relid);
|
||||
*hightid = *lowtid;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* FIND with AP_LOWKEY or AP_RANGEKEY on ISAM */
|
||||
AAlisam(d, tid, given, lowkey, highkey)
|
||||
register DESCXX *d;
|
||||
long *tid;
|
||||
char *given;
|
||||
char *lowkey;
|
||||
char *highkey;
|
||||
{
|
||||
register int i;
|
||||
register char *dom;
|
||||
register int len;
|
||||
register int g;
|
||||
register char *k;
|
||||
register char *t;
|
||||
struct accessparam ap;
|
||||
char tuple[MAXTUP];
|
||||
|
||||
# ifdef AMX_TRACE
|
||||
AAtTfp(25, 0,
|
||||
# ifdef MSDOS
|
||||
"low isam\t`%.10s' (%d)\n",
|
||||
# else
|
||||
"low isam\t`%.14s' (%d)\n",
|
||||
# endif
|
||||
d->xx_desc.reldum.relid, AA_PAT);
|
||||
# endif
|
||||
errno = 0;
|
||||
|
||||
/* clear out key conditions */
|
||||
for (i = d->xx_desc.reldum.relatts; i; --i)
|
||||
d->xx_desc.relgiven[i] = 0;
|
||||
|
||||
AAdparam(d, &ap);
|
||||
dom = ap.keydno;
|
||||
|
||||
while (i = *dom++)
|
||||
{
|
||||
if (bitset(AP_EQ | AP_GT, g = given[i - 1]))
|
||||
{
|
||||
d->xx_desc.relgiven[i] = AP_GT;
|
||||
len = d->xx_desc.reloff[i];
|
||||
k = len + (bitset(AP_LT, g)? highkey: lowkey);
|
||||
t = len + tuple;
|
||||
len = ctou(d->xx_desc.relfrml[i]);
|
||||
if (bitset(bitset(AP_LT, g)? AP_P2: AP_P1, g))
|
||||
AApatmove(k, t, len, -1);
|
||||
else
|
||||
AAbmove(k, t, len);
|
||||
}
|
||||
}
|
||||
|
||||
AA = AAndxsearch(d, tid, tuple, -1, 0);
|
||||
|
||||
# ifdef AM_TRACE
|
||||
AAtTfp(25, 10, "##AM_<_SEARCH\t%d\n", AA);
|
||||
if (AAtTfp(25, 11, "##\t\toldkey"))
|
||||
AAprkey(d, tuple);
|
||||
if (AAtTfp(25, 12, "##\t\tlo_"))
|
||||
AAdumptid(tid);
|
||||
# endif
|
||||
|
||||
if (AA)
|
||||
AAerror(9, d->xx_desc.reldum.relid);
|
||||
|
||||
/* restore key conditions */
|
||||
AAbmove(given, &d->xx_desc.relgiven[1], d->xx_desc.reldum.relatts);
|
||||
}
|
||||
|
||||
|
||||
/* FIND with AP_HIGHKEY or AP_RANGEKEY on ISAM */
|
||||
AAhisam(d, tid, given, key)
|
||||
register DESCXX *d;
|
||||
long *tid;
|
||||
char *given;
|
||||
char *key;
|
||||
{
|
||||
register int i;
|
||||
register char *dom;
|
||||
register int len;
|
||||
register int g;
|
||||
register char *k;
|
||||
register char *t;
|
||||
struct accessparam ap;
|
||||
char tuple[MAXTUP];
|
||||
|
||||
# ifdef AMX_TRACE
|
||||
AAtTfp(26, 0,
|
||||
# ifdef MSDOS
|
||||
"high isam\t`%.10s' (%d)\n",
|
||||
# else
|
||||
"high isam\t`%.14s' (%d)\n",
|
||||
# endif
|
||||
d->xx_desc.reldum.relid, AA_PAT);
|
||||
# endif
|
||||
errno = 0;
|
||||
|
||||
/* clear out key conditions */
|
||||
for (i = d->xx_desc.reldum.relatts; i; --i)
|
||||
d->xx_desc.relgiven[i] = 0;
|
||||
|
||||
AAdparam(d, &ap);
|
||||
dom = ap.keydno;
|
||||
|
||||
while (i = *dom++)
|
||||
{
|
||||
if (bitset(AP_EQ | AP_LT, g = given[i - 1]))
|
||||
{
|
||||
d->xx_desc.relgiven[i] = AP_LT;
|
||||
len = d->xx_desc.reloff[i];
|
||||
k = len + key;
|
||||
t = len + tuple;
|
||||
len = ctou(d->xx_desc.relfrml[i]);
|
||||
if (bitset(AP_P1, g))
|
||||
AApatmove(k, t, len, 1);
|
||||
else
|
||||
AAbmove(k, t, len);
|
||||
}
|
||||
}
|
||||
|
||||
AA = AAndxsearch(d, tid, tuple, 1, 0);
|
||||
|
||||
# ifdef AM_TRACE
|
||||
AAtTfp(26, 10, "##AM_>_SEARCH\t%d\n", AA);
|
||||
if (AAtTfp(26, 11, "##\t\toldkey"))
|
||||
AAprkey(d, tuple);
|
||||
if (AAtTfp(26, 13, "##\t\thi_"))
|
||||
AAdumptid(tid);
|
||||
# endif
|
||||
|
||||
if (AA)
|
||||
AAerror(10, d->xx_desc.reldum.relid);
|
||||
|
||||
/* restore key conditions */
|
||||
AAbmove(given, &d->xx_desc.relgiven[1], d->xx_desc.reldum.relatts);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
** AApatmove -- copy a symbol to a new buffer area.
|
||||
**
|
||||
** AApatmove checks the symbol for
|
||||
** pattern matching characters.
|
||||
**
|
||||
** Note that PAT_RBRAC need not be checked for
|
||||
** since it is not a pattern matching char unless
|
||||
** PAT_LBRAC appears before it.
|
||||
**
|
||||
** If op is opLTLE then add a pad character
|
||||
** whose value is the largest possible char
|
||||
** value.
|
||||
**
|
||||
** If any ranges of characters are found,
|
||||
** then the lowest/highest char is taken from
|
||||
** range.
|
||||
*/
|
||||
static AApatmove(key, tuple, len, op)
|
||||
register char *key;
|
||||
char *tuple;
|
||||
register int len;
|
||||
int op; /* op: LE = +1 */
|
||||
/* GE = -1 */
|
||||
{
|
||||
register int c;
|
||||
register int newc;
|
||||
register char *tup;
|
||||
|
||||
tup = tuple;
|
||||
tuple += len;
|
||||
|
||||
while (len--)
|
||||
{
|
||||
/* copy chars processing ANY, ONE or LBRAC chars if any */
|
||||
if ((c = *key++) == PAT_ANY || c == PAT_ONE)
|
||||
break;
|
||||
|
||||
if (c == PAT_LBRAC)
|
||||
{
|
||||
/* if string is empty, ignore it */
|
||||
if (!len--)
|
||||
break;
|
||||
|
||||
if ((c = *key++) == PAT_RBRAC)
|
||||
continue; /* empty [] */
|
||||
|
||||
while (len-- && ((newc = *key++) != PAT_RBRAC))
|
||||
{
|
||||
/* ignore '-' */
|
||||
if (newc == '-')
|
||||
continue;
|
||||
|
||||
/* check for char larger/smaller than 'c' */
|
||||
if (op * (newc - c) > 0)
|
||||
c = newc;
|
||||
}
|
||||
}
|
||||
|
||||
*tup++ = c; /* copy next char */
|
||||
}
|
||||
while (tup < tuple)
|
||||
*tup++ = (op > 0)? LAST_CHAR: 0;
|
||||
}
|
||||
|
|
@ -0,0 +1,250 @@
|
|||
# include "AA_liba.h"
|
||||
|
||||
|
||||
int AA_PAT; /* pattern matching flag */
|
||||
|
||||
AAclearkeys(d, rel)
|
||||
register DESCXX *d;
|
||||
register char *rel;
|
||||
{
|
||||
# ifdef AMX_TRACE
|
||||
AAtTfp(27, 0,
|
||||
# ifdef MSDOS
|
||||
"clear keys\t`%.10s'\n",
|
||||
# else
|
||||
"clear keys\t`%.14s'\n",
|
||||
# endif
|
||||
rel);
|
||||
# endif
|
||||
|
||||
AA_PAT = 0;
|
||||
errno = 0;
|
||||
|
||||
if (!d)
|
||||
AAerror(106, rel);
|
||||
|
||||
AAam_clearkeys(d);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
** hunts through a string and converts the pattern matching
|
||||
** characters and replaces with the corresponding cntrl chars
|
||||
**
|
||||
** Searches a string up to a null byte for one of the pattern
|
||||
** matching characters '*', '?', '[', and ']'. It then converts
|
||||
** these characters to their internal control character equivalents.
|
||||
*/
|
||||
AAsetpat(d, key, val, dom, cond)
|
||||
register DESCXX *d;
|
||||
char *key;
|
||||
register char *val;
|
||||
register int dom;
|
||||
int cond;
|
||||
{
|
||||
register char *v;
|
||||
register int pat;
|
||||
register int c;
|
||||
char val_buf[MAXFIELD];
|
||||
|
||||
# ifdef AMX_TRACE
|
||||
AAtTfp(28, 0,
|
||||
# ifdef MSDOS
|
||||
"set pattern\t`%.10s' dom %d cond 0%o\n",
|
||||
# else
|
||||
"set pattern\t`%.14s' dom %d cond 0%o\n",
|
||||
# endif
|
||||
d->xx_desc.reldum.relid, dom, cond);
|
||||
# endif
|
||||
|
||||
for (pat = 0, v = val_buf; *val; val++)
|
||||
{
|
||||
if (*val == '\\')
|
||||
{
|
||||
*v++ = *++val;
|
||||
continue;
|
||||
}
|
||||
switch (*val)
|
||||
{
|
||||
case '*':
|
||||
*v++ = PAT_ANY;
|
||||
goto pat_found;
|
||||
|
||||
case '?':
|
||||
*v++ = PAT_ONE;
|
||||
goto pat_found;
|
||||
|
||||
case '[':
|
||||
*v++ = PAT_LBRAC;
|
||||
goto pat_found;
|
||||
|
||||
case ']':
|
||||
*v++ = PAT_RBRAC;
|
||||
pat_found:
|
||||
pat++;
|
||||
continue;
|
||||
}
|
||||
if (((c = *val & LAST_CHAR) < ' ' && c != '\n' && c != '\t') || c == LAST_CHAR)
|
||||
c = ' '; /* convert to blank */
|
||||
*v++ = c;
|
||||
}
|
||||
*v = 0;
|
||||
|
||||
AAsetkey(d, key, val_buf, dom, cond);
|
||||
|
||||
if (!pat)
|
||||
return;
|
||||
|
||||
if ((pat = d->xx_desc.relxtra[dom]) && (!AA_PAT || AA_PAT > pat))
|
||||
AA_PAT = pat;
|
||||
|
||||
switch (cond)
|
||||
{
|
||||
case AP_NE:
|
||||
if (bitset(AP_GT, cond))
|
||||
goto set_p2;
|
||||
/* fall through */
|
||||
|
||||
case AP_GT:
|
||||
case AP_GT | AP_GE:
|
||||
if (bitset(AP_LT, cond))
|
||||
{
|
||||
set_p2:
|
||||
d->xx_desc.relgiven[dom] |= AP_P2;
|
||||
# ifdef AM_TRACE
|
||||
goto all_set;
|
||||
# else
|
||||
return;
|
||||
# endif
|
||||
}
|
||||
}
|
||||
/* all others */
|
||||
d->xx_desc.relgiven[dom] |= AP_P1;
|
||||
|
||||
# ifdef AM_TRACE
|
||||
all_set:
|
||||
AAtTfp(28, 10, "##AM_SETPAT\tnewcond 0%o\n", d->xx_desc.relgiven[dom]);
|
||||
# endif
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
** Searches a string up to a null byte for one of the pattern
|
||||
** matching characters PAT_ANY, PAT_ONE, PAT_LBRAC, and PAT_RBRAC.
|
||||
*/
|
||||
AAsetind(d, key, val, dom, cond)
|
||||
register DESCXX *d;
|
||||
char *key;
|
||||
char *val;
|
||||
register int dom;
|
||||
int cond;
|
||||
{
|
||||
register char *v;
|
||||
register int len;
|
||||
register int c;
|
||||
register int pat;
|
||||
|
||||
# ifdef AMX_TRACE
|
||||
AAtTfp(36, 0,
|
||||
# ifdef MSDOS
|
||||
"set index key\t`%.10s' dom %d cond 0%o\n",
|
||||
# else
|
||||
"set index key\t`%.14s' dom %d cond 0%o\n",
|
||||
# endif
|
||||
d->xx_desc.reldum.relid, dom, cond);
|
||||
# endif
|
||||
|
||||
pat = 0;
|
||||
if (d->xx_desc.relfrmt[dom] == CHAR)
|
||||
{
|
||||
len = ctou(d->xx_desc.relfrml[dom]);
|
||||
for (v = val; len; --len)
|
||||
if ((c = *v++) == PAT_ANY || c == PAT_ONE || c == PAT_LBRAC || c == PAT_RBRAC)
|
||||
pat++;
|
||||
}
|
||||
|
||||
AAsetkey(d, key, val, dom, cond);
|
||||
|
||||
if (!pat)
|
||||
return;
|
||||
|
||||
if ((pat = d->xx_desc.relxtra[dom]) && (!AA_PAT || AA_PAT > pat))
|
||||
AA_PAT = pat;
|
||||
|
||||
switch (cond)
|
||||
{
|
||||
case AP_NE:
|
||||
if (bitset(AP_GT, cond))
|
||||
goto set_p2;
|
||||
/* fall through */
|
||||
|
||||
case AP_GT:
|
||||
case AP_GT | AP_GE:
|
||||
if (bitset(AP_LT, cond))
|
||||
{
|
||||
set_p2:
|
||||
d->xx_desc.relgiven[dom] |= AP_P2;
|
||||
# ifdef AM_TRACE
|
||||
goto all_set;
|
||||
# else
|
||||
return;
|
||||
# endif
|
||||
}
|
||||
}
|
||||
/* all others */
|
||||
d->xx_desc.relgiven[dom] |= AP_P1;
|
||||
|
||||
# ifdef AM_TRACE
|
||||
all_set:
|
||||
AAtTfp(36, 10, "##AM_SETIND\tnewcond 0%o\n", d->xx_desc.relgiven[dom]);
|
||||
# endif
|
||||
}
|
||||
|
||||
|
||||
AAsetkey(d, key, val, dom, cond)
|
||||
register DESCXX *d;
|
||||
char *key;
|
||||
char *val;
|
||||
register int dom;
|
||||
int cond;
|
||||
{
|
||||
if (dom <= 0 || dom > d->xx_desc.reldum.relatts)
|
||||
{
|
||||
AA = dom;
|
||||
AAerror(13, d->xx_desc.reldum.relid);
|
||||
}
|
||||
|
||||
# ifdef AMX_TRACE
|
||||
AAtTfp(21, 0,
|
||||
# ifdef MSDOS
|
||||
"set key val\t`%.10s' dom %d cond 0%o\n",
|
||||
# else
|
||||
"set key val\t`%.14s' dom %d cond 0%o\n",
|
||||
# endif
|
||||
d->xx_desc.reldum.relid, dom, cond);
|
||||
# endif
|
||||
|
||||
switch (cond)
|
||||
{
|
||||
case AP_EQ:
|
||||
case AP_LT:
|
||||
case AP_LT | AP_LE:
|
||||
case AP_GT:
|
||||
case AP_GT | AP_GE:
|
||||
case AP_NE:
|
||||
cond |= d->xx_desc.relgiven[dom];
|
||||
AAam_setkey(d, key, val, dom);
|
||||
d->xx_desc.relgiven[dom] = cond;
|
||||
|
||||
# ifdef AM_TRACE
|
||||
AAtTfp(21, 10, "##AM_SETKEY\tnewcond 0%o\n", cond);
|
||||
if (AAtTfp(21, 11, "##\t\tnewkey"))
|
||||
AAprkey(d, key);
|
||||
# endif
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
AA = cond;
|
||||
AAerror(14, d->xx_desc.reldum.relid);
|
||||
}
|
||||
|
|
@ -0,0 +1,112 @@
|
|||
# include <stdio.h>
|
||||
# include "gen.h"
|
||||
# include "../h/version.h"
|
||||
|
||||
char IIversion[] = VERSION;
|
||||
|
||||
# define AAbmove IIbmove
|
||||
# define AAztack IIconcatv
|
||||
# define AA_iocv IIitos
|
||||
# define AApath IIPathname
|
||||
# define AAerrfn IIerrfilen
|
||||
# define AA_ERRFN II_ERRFN
|
||||
# define AAversion IIversion
|
||||
|
||||
# include "../gutil/errfilen.c"
|
||||
# include "../h/pipes.h"
|
||||
# include "IIglobals.h"
|
||||
|
||||
# ifdef EBCDIC
|
||||
# define LAST_CHAR 0377
|
||||
# else
|
||||
# define LAST_CHAR 0177
|
||||
# endif
|
||||
|
||||
/*
|
||||
** IIP_ERR
|
||||
**
|
||||
** This routine processes an IIerror call for printout.This involves doing
|
||||
** a lookup in the .../sys/etc/error? files, where ? is the thous-
|
||||
** ands digit of the error number. The associated error message
|
||||
** then goes through parameter substitution and is printed.
|
||||
**
|
||||
** In the current version, the error message is just printed.
|
||||
*/
|
||||
char *IIp_err(err_num, argc, argv)
|
||||
int err_num;
|
||||
int argc;
|
||||
char **argv;
|
||||
{
|
||||
register char *p;
|
||||
register int c;
|
||||
register FILE *iop;
|
||||
short i;
|
||||
char buf[100];
|
||||
extern char *IIerrfilen();
|
||||
|
||||
/* open the appropriate error file */
|
||||
p = IIerrfilen(err_num / 1000);
|
||||
|
||||
# ifdef xETR2
|
||||
if (IIdebug > 1)
|
||||
printf("P_ERR: file \"%s\"\n", p);
|
||||
# endif
|
||||
|
||||
if (!(iop = fopen(p, "r")))
|
||||
return ((char *) 0);
|
||||
|
||||
/* read in the code and check for correct */
|
||||
for ( ; ; )
|
||||
{
|
||||
p = buf;
|
||||
while ((c = getc(iop)) != '\t')
|
||||
{
|
||||
if (c <= 0)
|
||||
{
|
||||
fclose(iop);
|
||||
return ((char *) 0);
|
||||
}
|
||||
*p++ = c;
|
||||
}
|
||||
*p = 0;
|
||||
if (IIatoi(buf, &i))
|
||||
goto error;
|
||||
if (i != err_num)
|
||||
{
|
||||
while ((c = getc(iop)) != ERRDELIM)
|
||||
if (c <= 0)
|
||||
{
|
||||
error:
|
||||
IIsyserr("P_ERR: Formatfehler im file %d", err_num);
|
||||
}
|
||||
getc(iop); /* throw out the newline */
|
||||
continue;
|
||||
}
|
||||
|
||||
/* got the correct line, print it doing parameter substitution */
|
||||
printf("%d: ", err_num);
|
||||
for ( ; ; )
|
||||
{
|
||||
c = getc(iop);
|
||||
if (c <= 0 || c == ERRDELIM)
|
||||
{
|
||||
putchar('\n');
|
||||
fclose(iop);
|
||||
return ((char *) 1);
|
||||
}
|
||||
if (c == '%')
|
||||
{
|
||||
c = getc(iop);
|
||||
for (p = argv[c - '0']; c = *p; p++)
|
||||
{
|
||||
if (c < ' ' || c >= LAST_CHAR)
|
||||
printf("\\0%o", c);
|
||||
else
|
||||
putchar(c);
|
||||
}
|
||||
continue;
|
||||
}
|
||||
putchar(c);
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue