pkgsrc/lang/cu-prolog/patches/patch-ab
2015-12-29 23:34:43 +00:00

53 lines
1.8 KiB
Text

$NetBSD: patch-ab,v 1.6 2015/12/29 23:34:45 dholland Exp $
Use sys/param.h to detect timing configuration.
XXX: don't use sys/param.h.
All the world's not a Sun.
Avoid illegal lvalue cast.
Support more systems when looking inside FILE.
--- include.h.orig 1995-01-27 08:38:48.000000000 +0100
+++ include.h 2007-10-13 14:34:37.000000000 +0200
@@ -21,6 +21,7 @@
#include <stdio.h>
#include <math.h>
+#include <sys/param.h>
/* CPUTIME : print CPU time for UNIX 4.2 BSD
* if your system has times() function #define CPUTIME 60
@@ -28,7 +29,11 @@
* else #define CPUTIME 0
*/
+#if (defined(BSD) && BSD >= 199306)
+#define CPUTIME 60
+#else
#define SUN4 1
+#endif
#define KANJI 1 /* 1: allow EUC Kanji for str functions */
/* Tee print macro */
@@ -133,10 +138,21 @@ struct term { /* atomic formula (liter
#define str_value(Term) ((Term)->tag.s_value)
#define filep_value(Term) ((Term)->tag.f_value)
#define head_of_list(Term) (((struct clause *)Term)->c_form)
-#define tail_of_list(Term) ((struct term *)((struct clause *)Term)->c_link)
+#define tail_of_list(Term) (*((struct term **)&(((struct clause *)Term)->c_link)))
+#if defined(__linux__)
+#define is_readable(FP) (!(FP->_flags & _IO_NO_READS))
+#define is_writable(FP) (!(FP->_flags & _IO_NO_WRITES))
+#elif defined(__DragonFly__)
+#define is_readable(FP) (((struct __FILE_public *)(FP))->_flags & __SRD)
+#define is_writable(FP) (((struct __FILE_public *)(FP))->_flags & __SWR)
+#elif (defined(BSD) && BSD >= 199306)
+#define is_readable(FP) (FP->_flags & __SRD)
+#define is_writable(FP) (FP->_flags & __SWR)
+#else
#define is_readable(FP) (FP->_flag & _IOREAD)
#define is_writable(FP) (FP->_flag & _IOWRT)
+#endif
#define is_functor(Term) ((Term)->type.ident > CONST_LIST_TYPE)
#define isconst_functor(Term) ((Term)->t_arity <= 0)