*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/optimizer/plan/createplan.c,v 1.7 1997/01/10 20:17:56 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/optimizer/plan/createplan.c,v 1.8 1997/03/12 21:05:56 scrappy Exp $
*
*-------------------------------------------------------------------------
*/
if(temp == NULL)
elog(WARN,"scanrelid is empty");
else
- scan_relid = (Index)lfirst(temp); /* ??? who takes care of lnext? - ay */
+ scan_relid = (Index)lfirsti(temp); /* ??? who takes care of lnext? - ay */
scan_node = make_seqscan(tlist,
scan_clauses,
scan_relid,
is_funcclause((Node*)get_leftop((Expr*)clause)) &&
((Func*)((Expr*)get_leftop((Expr*)clause))->oper)->funcisindex){
Var *newvar =
- makeVar((Index)lfirst(index_path->parent->relids),
+ makeVar((Index)lfirsti(index_path->parent->relids),
1, /* func indices have one key */
((Func*)((Expr*)clause)->oper)->functype,
- (Index)lfirst(index_path->parent->relids),
+ (Index)lfirsti(index_path->parent->relids),
0);
return
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/optimizer/plan/initsplan.c,v 1.3 1997/02/20 02:53:26 vadim Exp $
+ * $Header: /cvsroot/pgsql/src/backend/optimizer/plan/initsplan.c,v 1.4 1997/03/12 21:05:59 scrappy Exp $
*
*-------------------------------------------------------------------------
*/
foreach (rel, join_relids)
{
- if ( (int)lfirst(rel) != (int)lfirst(join_relid) )
- other_rels = lappendi (other_rels, lfirst(rel));
+ if ( lfirsti(rel) != lfirsti(join_relid) )
+ other_rels = lappendi (other_rels, lfirsti(rel));
}
joininfo =
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/optimizer/util/plancat.c,v 1.3 1996/11/06 09:29:24 scrappy Exp $
+ * $Header: /cvsroot/pgsql/src/backend/optimizer/util/plancat.c,v 1.4 1997/03/12 21:06:14 scrappy Exp $
*
*-------------------------------------------------------------------------
*/
i = 0;
foreach(xopno, opnos) {
- opno_array[i++] = (int)lfirst(xopno);
+ opno_array[i++] = lfirsti(xopno);
}
i = 0;
foreach(xattno,attnos) {
- attno_array[i++] = (int)lfirst(xattno);
+ attno_array[i++] = lfirsti(xattno);
}
i = 0;
i = 0;
foreach(flag,flags) {
- flag_array[i++] = (int)lfirst(flag);
+ flag_array[i++] = lfirsti(flag);
}
IndexSelectivity(indid,
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/storage/ipc/Attic/s_lock.c,v 1.11 1997/02/14 04:16:43 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/storage/ipc/Attic/s_lock.c,v 1.12 1997/03/12 21:06:48 scrappy Exp $
*
*-------------------------------------------------------------------------
*/
* (see storage/ipc.h).
*/
-#if defined(alpha)
+#if defined(alpha) && !defined(linuxalpha)
void
S_LOCK(slock_t *lock)
#endif /* NEED_I386_TAS_ASM */
+#if defined(linuxalpha)
+
+int
+tas(slock_t *m)
+{
+ slock_t res;
+ __asm__(" ldq $0, %0 \n\
+ bne $0, already_set \n\
+ ldq_l $0, %0 \n\
+ bne $0, already_set \n\
+ or $31, 1, $0 \n\
+ stq_c $0, %0 \n\
+ beq $0, stqc_fail \n\
+ success: bis $31, $31, %1 \n\
+ mb \n\
+ jmp $31, end \n\
+ stqc_fail: or $31, 1, $0 \n\
+ already_set: bis $0, $0, %1 \n\
+ end: nop " : "=m" (*m), "=r" (res) :: "0" );
+ return(res);
+}
+
+void
+S_LOCK(slock_t *lock)
+{
+ while (tas(lock))
+ ;
+}
+
+void
+S_UNLOCK(slock_t *lock)
+{
+ __asm__("mb");
+ *lock = 0;
+}
+
+void
+S_INIT_LOCK(slock_t *lock)
+{
+ S_UNLOCK(lock);
+}
+
+#endif
+
#endif /* HAS_TEST_AND_SET */
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/storage/page/bufpage.c,v 1.5 1996/11/24 04:41:29 bryanh Exp $
+ * $Header: /cvsroot/pgsql/src/backend/storage/page/bufpage.c,v 1.6 1997/03/12 21:07:11 scrappy Exp $
*
*-------------------------------------------------------------------------
*/
Size size)
{
int i;
+ unsigned offset;
/* location is an index into the page... */
- location -= (int) phdr;
+ offset = (unsigned)(location - (char *)phdr);
for (i = PageGetMaxOffsetNumber((Page) phdr) - 1; i >= 0; i--) {
- if (phdr->pd_linp[i].lp_off <= (unsigned) location) {
+ if (phdr->pd_linp[i].lp_off <= offset) {
phdr->pd_linp[i].lp_off += size;
}
}
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/tcop/fastpath.c,v 1.3 1996/11/08 05:59:26 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/tcop/fastpath.c,v 1.4 1997/03/12 21:07:50 scrappy Exp $
*
* NOTES
* This cruft is the server side of PQfn.
pq_putnchar("G", 1);
if (retbyval) { /* by-value */
pq_putint(retlen, 4);
- pq_putint((int)retval, retlen);
+ pq_putint((int)(Datum)retval, retlen);
} else { /* by-reference ... */
if (retlen < 0) { /* ... varlena */
pq_putint(VARSIZE(retval) - VARHDRSZ, 4);
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/utils/adt/float.c,v 1.12 1997/02/19 20:10:49 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/utils/adt/float.c,v 1.13 1997/03/12 21:09:11 scrappy Exp $
*
*-------------------------------------------------------------------------
*/
#define FLOAT8_MAX DBL_MAX
#define FLOAT8_MIN DBL_MIN
+/*
+ * if FLOAT8_MIN and FLOAT8_MAX are the limits of the range a
+ * double can store, then how are we ever going to wind up
+ * with something stored in a double that is outside those
+ * limits? (and similarly for FLOAT4_{MIN,MAX}/float.)
+ * doesn't make sense to me, and it causes a
+ * floating point exception on linuxalpha, so UNSAFE_FLOATS
+ * it is.
+ * (maybe someone wanted to allow for values other than DBL_MIN/
+ * DBL_MAX for FLOAT8_MIN/FLOAT8_MAX?)
+ * --djm 12/12/96
+ * according to Richard Henderson this is a known bug in gcc on
+ * the Alpha. might as well leave the workaround in
+ * until the distributions are updated.
+ * --djm 12/16/96
+ */
+#if defined(linuxalpha) && !defined(UNSAFE_FLOATS)
+#define UNSAFE_FLOATS
+#endif
+
/*
check to see if a float4 val is outside of
the FLOAT4_MIN, FLOAT4_MAX bounds.
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/utils/adt/oid.c,v 1.4 1997/01/10 20:19:45 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/utils/adt/oid.c,v 1.5 1997/03/12 21:09:15 scrappy Exp $
*
*-------------------------------------------------------------------------
*/
return(NULL);
result = (Oid (*)[]) palloc(sizeof(Oid [8]));
if ((nums = sscanf(oidString, "%d%d%d%d%d%d%d%d",
- *result,
- *result + 1,
- *result + 2,
- *result + 3,
- *result + 4,
- *result + 5,
- *result + 6,
- *result + 7)) != 8) {
+ &(*result)[0],
+ &(*result)[1],
+ &(*result)[2],
+ &(*result)[3],
+ &(*result)[4],
+ &(*result)[5],
+ &(*result)[6],
+ &(*result)[7])) != 8) {
do
(*result)[nums++] = 0;
while (nums < 8);
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/utils/error/elog.c,v 1.12 1997/02/14 04:17:57 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/utils/error/elog.c,v 1.13 1997/03/12 21:10:53 scrappy Exp $
*
*-------------------------------------------------------------------------
*/
extern int errno, sys_nerr;
#if !defined(BSD44_derived) && \
!defined(bsdi) && \
- !defined(bsdi_2_1)
+ !defined(bsdi_2_1) && \
+ !defined(linuxalpha)
extern char *sys_errlist[];
#endif /* bsd derived */
#ifndef PG_STANDALONE
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/utils/error/Attic/exc.c,v 1.9 1996/12/27 13:13:58 vadim Exp $
+ * $Header: /cvsroot/pgsql/src/backend/utils/error/Attic/exc.c,v 1.10 1997/03/12 21:10:56 scrappy Exp $
*
* NOTE
* XXX this code needs improvement--check for state violations and
extern int sys_nerr;
#if !defined(BSD44_derived) && \
!defined(bsdi) && \
- !defined(bsdi_2_1)
+ !defined(bsdi_2_1) && \
+ !defined(linuxalpha)
extern char *sys_errlist[];
#endif /* ! bsd_derived */
*
* Copyright (c) 1994, Regents of the University of California
*
- * $Id: pg_list.h,v 1.3 1996/11/04 07:18:19 scrappy Exp $
+ * $Id: pg_list.h,v 1.4 1997/03/12 21:11:23 scrappy Exp $
*
*-------------------------------------------------------------------------
*/
*/
typedef struct List {
NodeTag type;
- void *elem;
+ union {
+ void *ptr_value;
+ int int_value;
+ } elem;
struct List *next;
} List;
* accessor macros
* ----------------
*/
-#define lfirst(l) ((l)->elem)
+
+/* anything that doesn't end in 'i' is assumed to be referring to the */
+/* pointer version of the list (where it makes a difference) */
+#define lfirst(l) ((l)->elem.ptr_value)
#define lnext(l) ((l)->next)
#define lsecond(l) (lfirst(lnext(l)))
+#define lfirsti(l) ((l)->elem.int_value)
+
/*
* foreach -
* a convenience macro which loops through the list
extern void *nth(int n, List *l);
extern void set_nth(List *l, int n, void *elem);
-/* hack for now */
-#define lconsi(i,l) lcons((void*)(int)i,l)
-#define lfirsti(l) ((int)lfirst(l))
-#define lappendi(l,i) lappend(l,(void*)i)
+List *lconsi(int datum, List *list);
+List *lappendi(List *list, int datum);
extern bool intMember(int, List *);
extern List *intAppend(List *list1, List *list2);
+extern int nthi(int n, List *l);
+
extern List *nreverse(List *);
extern List *set_difference(List *, List *);
extern List *set_differencei(List *, List *);
*
* Copyright (c) 1994, Regents of the University of California
*
- * $Id: ipc.h,v 1.15 1997/03/03 23:34:27 scrappy Exp $
+ * $Id: ipc.h,v 1.16 1997/03/12 21:12:27 scrappy Exp $
*
* NOTES
* This file is very architecture-specific. This stuff should actually
extern void S_UNLOCK(slock_t *lock);
extern void S_INIT_LOCK(slock_t *lock);
-#if defined(alpha) || \
+#if (defined(alpha) && !defined(linuxalpha)) || \
defined(hpux) || \
defined(irix5) || \
defined(nextstep)
*
* Copyright (c) 1994, Regents of the University of California
*
- * $Id: memutils.h,v 1.5 1997/03/04 05:32:26 scrappy Exp $
+ * $Id: memutils.h,v 1.6 1997/03/12 21:13:19 scrappy Exp $
*
* NOTES
* some of the information in this file will be moved to
*/
#if defined(sun) && ! defined(sparc)
#define LONGALIGN(LEN) SHORTALIGN(LEN)
-#elif defined (alpha)
+#elif defined (alpha) || defined(linuxalpha)
+ /* even though "long alignment" should really be on 8-byte boundaries
+ * for linuxalpha, we want the strictest alignment to be on 4-byte (int)
+ * boundaries, because otherwise things break when they try to use the
+ * FormData_pg_* structures. --djm 12/12/96
+ */
#define LONGALIGN(LEN)\
(((long)(LEN) + (sizeof (int) - 1)) & ~(sizeof (int) -1))
#else