mirror of
https://gitlab.com/embeddable-common-lisp/ecl.git
synced 2026-03-11 07:20:29 -07:00
Merge branch 'openbsd-file_cnt' into 'develop'
openbsd: implement FILE_CNT() on opaque FILE See merge request embeddable-common-lisp/ecl!354
This commit is contained in:
commit
3f2ad992e6
5 changed files with 55 additions and 19 deletions
23
src/aclocal.m4
vendored
23
src/aclocal.m4
vendored
|
|
@ -153,9 +153,10 @@ ECL_NEWLINE=LF
|
|||
### 1.5) Can we guess how many characters are available for reading from
|
||||
### the FILE structure?
|
||||
### 0 = no
|
||||
### 1 = (f)->_IO_read_end - (f)->_IO_read_ptr
|
||||
### 2 = (f)->_r
|
||||
### 3 = (f)->_cnt
|
||||
### 1 = __freadahead((f))
|
||||
### 2 = (f)->_IO_read_end - (f)->_IO_read_ptr
|
||||
### 3 = (f)->_r
|
||||
### 4 = (f)->_cnt
|
||||
ECL_FILE_CNT=0
|
||||
|
||||
###
|
||||
|
|
@ -626,21 +627,29 @@ AC_DEFUN(ECL_FILE_STRUCTURE,[
|
|||
AC_SUBST(ECL_FILE_CNT)
|
||||
if test -z "${ECL_FILE_CNT}"; then
|
||||
ECL_FILE_CNT=0
|
||||
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <stdio.h>]], [[
|
||||
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
|
||||
#include <stdio.h>
|
||||
#include <stdio_ext.h>
|
||||
]], [[
|
||||
FILE *f = fopen("conftestval","w");
|
||||
if ((f)->_IO_read_end - (f)->_IO_read_ptr)
|
||||
if (__freadahead((f)))
|
||||
return 1;
|
||||
]])],[ECL_FILE_CNT=1],[])
|
||||
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <stdio.h>]], [[
|
||||
FILE *f = fopen("conftestval","w");
|
||||
if ((f)->_r)
|
||||
if ((f)->_IO_read_end - (f)->_IO_read_ptr)
|
||||
return 1;
|
||||
]])],[ECL_FILE_CNT=2],[])
|
||||
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <stdio.h>]], [[
|
||||
FILE *f = fopen("conftestval","w");
|
||||
if ((f)->_cnt)
|
||||
if ((f)->_r)
|
||||
return 1;
|
||||
]])],[ECL_FILE_CNT=3],[])
|
||||
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <stdio.h>]], [[
|
||||
FILE *f = fopen("conftestval","w");
|
||||
if ((f)->_cnt)
|
||||
return 1;
|
||||
]])],[ECL_FILE_CNT=4],[])
|
||||
fi
|
||||
])
|
||||
|
||||
|
|
|
|||
39
src/configure
vendored
39
src/configure
vendored
|
|
@ -5886,9 +5886,10 @@ ECL_NEWLINE=LF
|
|||
### 1.5) Can we guess how many characters are available for reading from
|
||||
### the FILE structure?
|
||||
### 0 = no
|
||||
### 1 = (f)->_IO_read_end - (f)->_IO_read_ptr
|
||||
### 2 = (f)->_r
|
||||
### 3 = (f)->_cnt
|
||||
### 1 = __freadahead((f))
|
||||
### 2 = (f)->_IO_read_end - (f)->_IO_read_ptr
|
||||
### 3 = (f)->_r
|
||||
### 4 = (f)->_cnt
|
||||
ECL_FILE_CNT=0
|
||||
|
||||
###
|
||||
|
|
@ -9251,13 +9252,16 @@ if test -z "${ECL_FILE_CNT}"; then
|
|||
ECL_FILE_CNT=0
|
||||
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
|
||||
/* end confdefs.h. */
|
||||
#include <stdio.h>
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdio_ext.h>
|
||||
|
||||
int
|
||||
main (void)
|
||||
{
|
||||
|
||||
FILE *f = fopen("conftestval","w");
|
||||
if ((f)->_IO_read_end - (f)->_IO_read_ptr)
|
||||
if (__freadahead((f)))
|
||||
return 1;
|
||||
|
||||
;
|
||||
|
|
@ -9277,7 +9281,7 @@ main (void)
|
|||
{
|
||||
|
||||
FILE *f = fopen("conftestval","w");
|
||||
if ((f)->_r)
|
||||
if ((f)->_IO_read_end - (f)->_IO_read_ptr)
|
||||
return 1;
|
||||
|
||||
;
|
||||
|
|
@ -9297,7 +9301,7 @@ main (void)
|
|||
{
|
||||
|
||||
FILE *f = fopen("conftestval","w");
|
||||
if ((f)->_cnt)
|
||||
if ((f)->_r)
|
||||
return 1;
|
||||
|
||||
;
|
||||
|
|
@ -9309,6 +9313,26 @@ then :
|
|||
ECL_FILE_CNT=3
|
||||
fi
|
||||
rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext
|
||||
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
|
||||
/* end confdefs.h. */
|
||||
#include <stdio.h>
|
||||
int
|
||||
main (void)
|
||||
{
|
||||
|
||||
FILE *f = fopen("conftestval","w");
|
||||
if ((f)->_cnt)
|
||||
return 1;
|
||||
|
||||
;
|
||||
return 0;
|
||||
}
|
||||
_ACEOF
|
||||
if ac_fn_c_try_compile "$LINENO"
|
||||
then :
|
||||
ECL_FILE_CNT=4
|
||||
fi
|
||||
rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext
|
||||
fi
|
||||
|
||||
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for code to detect FP exceptions" >&5
|
||||
|
|
@ -12810,4 +12834,3 @@ fi
|
|||
|
||||
|
||||
for i in $srcdir/c/*/; do mkdir -p c/`basename $i`; done
|
||||
|
||||
|
|
|
|||
|
|
@ -176,12 +176,16 @@
|
|||
|
||||
#undef FILE_CNT
|
||||
#if @ECL_FILE_CNT@ == 1
|
||||
# define FILE_CNT(fp) ((fp)->_IO_read_end - (fp)->_IO_read_ptr)
|
||||
# include <stdio_ext.h>
|
||||
# define FILE_CNT(fp) (__freadahead((fp)))
|
||||
#endif
|
||||
#if @ECL_FILE_CNT@ == 2
|
||||
# define FILE_CNT(fp) ((fp)->_r)
|
||||
# define FILE_CNT(fp) ((fp)->_IO_read_end - (fp)->_IO_read_ptr)
|
||||
#endif
|
||||
#if @ECL_FILE_CNT@ == 3
|
||||
# define FILE_CNT(fp) ((fp)->_r)
|
||||
#endif
|
||||
#if @ECL_FILE_CNT@ == 4
|
||||
# define FILE_CNT(fp) ((fp)->_cnt)
|
||||
#endif
|
||||
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ CL_LONG_BITS=32
|
|||
ECL_STACK_DIR=down
|
||||
ECL_BIGENDIAN=no
|
||||
ECL_NEWLINE=LF
|
||||
ECL_FILE_CNT=1
|
||||
ECL_FILE_CNT=2
|
||||
ECL_STDINT_HEADER="#include <stdint.h>"
|
||||
ECL_UINT8_T=uint8_t
|
||||
ECL_UINT16_T=uint16_t
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ CL_LONG_BITS=64
|
|||
ECL_STACK_DIR=down
|
||||
ECL_BIGENDIAN=no
|
||||
ECL_NEWLINE=LF
|
||||
ECL_FILE_CNT=1
|
||||
ECL_FILE_CNT=2
|
||||
ECL_STDINT_HEADER="#include <stdint.h>"
|
||||
ECL_UINT8_T=uint8_t
|
||||
ECL_UINT16_T=uint16_t
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue