From 95b8881908aace933729d5242f4ce6e4d031360a Mon Sep 17 00:00:00 2001 From: Gary Houston Date: Wed, 7 Aug 1996 09:46:41 +0000 Subject: [PATCH] portability fixes for header inclusion etc. --- libguile/ChangeLog | 50 +++++++++++++++++++++++++++++++++++++++++ libguile/Makefile.in | 20 ++--------------- libguile/__scm.h | 17 ++++++++------ libguile/async.c | 3 +++ libguile/configure | 2 +- libguile/configure.in | 2 +- libguile/error.c | 3 +++ libguile/feature.c | 3 +++ libguile/fports.c | 10 ++++----- libguile/gc.c | 4 ++-- libguile/genio.c | 3 +++ libguile/init.c | 6 +++++ libguile/ioext.c | 7 +++++- libguile/mallocs.c | 4 ++-- libguile/ports.c | 5 ++++- libguile/posix.c | 9 ++++---- libguile/ramap.h | 4 ++-- libguile/read.c | 10 ++++----- libguile/scmconfig.h.in | 3 +++ libguile/simpos.c | 4 ++++ libguile/socket.c | 6 ++++- libguile/strings.h | 4 ++++ libguile/strports.c | 4 ++++ libguile/struct.c | 4 ++++ libguile/symbols.c | 4 ++++ libguile/unif.c | 1 + libguile/vports.c | 4 ++++ 27 files changed, 144 insertions(+), 52 deletions(-) diff --git a/libguile/ChangeLog b/libguile/ChangeLog index 008b289d8..ba7005fb7 100644 --- a/libguile/ChangeLog +++ b/libguile/ChangeLog @@ -1,3 +1,53 @@ +Wed Aug 7 06:28:42 1996 Gary Houston + + * Fixes motivated by Petr Adamek : + + * unif.c: include ramap.h. + + * read.c (endif): case_insensative_p renamed case_insensitive_p. + + * ramap.h: rename scm_array_copy prototypes to scm_array_copy_x. + + * ports.c: include sys/ioctl.h. + + * scmconfig.h.in: add HAVE_SYS_IOCTL_H. + + * configure.in: check for sys/ioctl.h. + + * ports.c: include not "malloc.h". + + * mallocs.c: include not "malloc.h", likewise for unistd.h. + + * fports.c: remove ttyname and tmpnam declarations. + + * posix.c: fewer ttyname declarations. + + * fports.c: include not "string.h". + + * init.c, ioext.c: include string.h and unistd.h. + + * gc.c: include not "malloc.h", likewise for unistd.h. + + * async.c, strings.h, strports.c, struct.c, symbols.c, feature.c, genio.c, simpos.c, vports.c: + include string.h. + + * socket.c, fdsocket.c: include string.h only if HAVE_STRING_H. + + * fdsocket.c (getsockopt, setsockopt): change type of optlen from + scm_sizet to int. + (scm_addr_buffer_size): change type from scm_sizet to int. + (accept, getsockname, getpeername, recvfrom): change type of tmp_size + from scm_sizet to int. + + * error.c: include unistd.h. + + * __scm.h: (SCM_SYSMISSING): another version in case ENOSYS isn't + defined. + + * Makefile.in: remove references to .hd, .cd suffix and __scm.hd. + + * __scm.hd, def.sed: deleted. + Tue Aug 6 14:49:08 1996 Jim Blandy Changes for NeXT, suggested by Robert Brown. diff --git a/libguile/Makefile.in b/libguile/Makefile.in index 0b2171909..389ca285c 100644 --- a/libguile/Makefile.in +++ b/libguile/Makefile.in @@ -144,7 +144,7 @@ libobjs= alist.o \ $(extras) -uninstalled_h_files= _scm.h __scm.hd +uninstalled_h_files= _scm.h installed_h_files= __scm.h \ alist.h \ @@ -365,21 +365,7 @@ manifest = $(ancillary) $(c_sources) .SUFFIXES: -.SUFFIXES: .o .c .h .ps .dvi .info .texinfo .scm .cd .x .hd - -.cd.c: - ( echo "/* DO NOT EDIT --- AUTO-GENERATED --- DO NOT EDIT */" > $@ \ - && echo -n "#line 1" \" \ - && echo $<\" | sed -e "s,^.*/,," >> $@ \ - && sed -f $(srcdir)/def.sed $< >> $@) \ - || rm -f $@ - -.hd.h: - ( echo "/* DO NOT EDIT --- AUTO-GENERATED --- DO NOT EDIT */" > $@ \ - && echo -n "#line 1" \" >> $@ \ - && echo $<\" | sed -e "s,^.*/,," >> $@ \ - && sed -f $(srcdir)/def.sed $< >> $@) \ - || rm -f $@ +.SUFFIXES: .o .c .h .ps .dvi .info .texinfo .scm .x .c.x: if test ! -escmconfig.h ; then \ @@ -477,8 +463,6 @@ depends: rm $(gen_c_files) rm scmconfig.h -$(srcdir)/__scm.h: __scm.hd - ### alist.o : alist.c _scm.h libguile.h __scm.h tags.h smob.h params.h alist.h append.h \ arbiters.h async.h boolean.h chars.h continuations.h dynwind.h eq.h error.h \ diff --git a/libguile/__scm.h b/libguile/__scm.h index ec870b78a..e5c7e3f16 100644 --- a/libguile/__scm.h +++ b/libguile/__scm.h @@ -1,5 +1,3 @@ -/* DO NOT EDIT --- AUTO-GENERATED --- DO NOT EDIT */ -#line 1 "__scm.hd" /* classes: h_files */ #ifndef __SCMH @@ -180,7 +178,6 @@ typedef unsigned long ulong_long; # endif /* ndef _CRAY1 */ #endif /* ndef vms */ - /* James Clark came up with this neat one instruction fix for * continuations on the SPARC. It flushes the register windows so * that all the state of the process is contained in the stack. @@ -285,6 +282,7 @@ extern unsigned int scm_async_clock; if (!(_cond)) \ goto _label #endif + #define SCM_SYSERROR(_subr) \ scm_everr (SCM_UNDEFINED, SCM_EOL, SCM_UNDEFINED, \ strerror (errno), _subr) @@ -295,10 +293,15 @@ extern unsigned int scm_async_clock; scm_makfrom0str (_subr), \ SCM_UNDEFINED)); */ -#define SCM_SYSMISSING(_subr) \ - scm_everr (SCM_UNDEFINED, SCM_EOL, SCM_UNDEFINED, \ - strerror (ENOSYS), _subr) - +#ifdef ENOSYS +# define SCM_SYSMISSING(_subr) \ + scm_everr (SCM_UNDEFINED, SCM_EOL, SCM_UNDEFINED, \ + strerror (ENOSYS), _subr) +#else +# define SCM_SYSMISSING(_subr) \ + scm_everr (SCM_UNDEFINED, SCM_EOL, SCM_UNDEFINED, \ + "missing function, even ENOSYS is missing", _subr) +#endif #define SCM_ARGn 0 #define SCM_ARG1 1 #define SCM_ARG2 2 diff --git a/libguile/async.c b/libguile/async.c index 7a942270e..2658ca3d3 100644 --- a/libguile/async.c +++ b/libguile/async.c @@ -44,6 +44,9 @@ #include #include "_scm.h" +#ifdef HAVE_STRING_H +#include +#endif #ifdef HAVE_UNISTD_H #include #endif diff --git a/libguile/configure b/libguile/configure index 842aeb93d..862c1825a 100755 --- a/libguile/configure +++ b/libguile/configure @@ -1210,7 +1210,7 @@ EOF fi -for ac_hdr in libc.h limits.h malloc.h memory.h string.h sys/select.h sys/time.h sys/timeb.h sys/times.h sys/types.h time.h unistd.h +for ac_hdr in libc.h limits.h malloc.h memory.h string.h sys/ioctl.h sys/select.h sys/time.h sys/timeb.h sys/times.h sys/types.h time.h unistd.h do ac_safe=`echo "$ac_hdr" | tr './\055' '___'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 diff --git a/libguile/configure.in b/libguile/configure.in index efcd678b8..92fa3f2d4 100644 --- a/libguile/configure.in +++ b/libguile/configure.in @@ -20,7 +20,7 @@ AC_HEADER_STDC AC_HEADER_DIRENT AC_HEADER_TIME AC_HEADER_SYS_WAIT -AC_CHECK_HEADERS(libc.h limits.h malloc.h memory.h string.h sys/select.h sys/time.h sys/timeb.h sys/times.h sys/types.h time.h unistd.h) +AC_CHECK_HEADERS(libc.h limits.h malloc.h memory.h string.h sys/ioctl.h sys/select.h sys/time.h sys/timeb.h sys/times.h sys/types.h time.h unistd.h) AC_TYPE_GETGROUPS AC_TYPE_SIGNAL diff --git a/libguile/error.c b/libguile/error.c index c16612513..ba51e8bc1 100644 --- a/libguile/error.c +++ b/libguile/error.c @@ -43,6 +43,9 @@ #include #include "_scm.h" +#ifdef HAVE_UNISTD_H +#include +#endif diff --git a/libguile/feature.c b/libguile/feature.c index b4622b7e9..2a0916cd7 100644 --- a/libguile/feature.c +++ b/libguile/feature.c @@ -43,6 +43,9 @@ #include #include "_scm.h" +#ifdef HAVE_STRING_H +#include +#endif SCM *scm_loc_features; diff --git a/libguile/fports.c b/libguile/fports.c index 34264a7bc..fbd5eb443 100644 --- a/libguile/fports.c +++ b/libguile/fports.c @@ -42,22 +42,20 @@ #include #include "_scm.h" + +#ifdef HAVE_STRING_H +#include +#endif #ifdef HAVE_UNISTD_H #include #else -char *ttyname (); -char *tmpnam (); scm_sizet fwrite (); #endif -#ifdef HAVE_STRING_H -#include "string.h" -#endif #ifdef __IBMC__ #include #include -#define ttyname(x) "CON:" #else #ifndef MSDOS #ifndef ultrix diff --git a/libguile/gc.c b/libguile/gc.c index 26e718158..80427a8ca 100644 --- a/libguile/gc.c +++ b/libguile/gc.c @@ -43,11 +43,11 @@ #include "_scm.h" #ifdef HAVE_MALLOC_H -#include "malloc.h" +#include #endif #ifdef HAVE_UNISTD_H -#include "unistd.h" +#include #endif diff --git a/libguile/genio.c b/libguile/genio.c index 6bc082536..5e43d04c3 100644 --- a/libguile/genio.c +++ b/libguile/genio.c @@ -43,6 +43,9 @@ #include #include "_scm.h" +#ifdef HAVE_STRING_H +#include +#endif diff --git a/libguile/init.c b/libguile/init.c index 2f65c15f6..32bc50908 100644 --- a/libguile/init.c +++ b/libguile/init.c @@ -43,6 +43,12 @@ #include #include "_scm.h" +#ifdef HAVE_STRING_H +#include +#endif +#ifdef HAVE_UNISTD_H +#include +#endif #ifdef __STDC__ diff --git a/libguile/ioext.c b/libguile/ioext.c index 4dea9f754..a873eb3bc 100644 --- a/libguile/ioext.c +++ b/libguile/ioext.c @@ -42,10 +42,15 @@ #include -#include #include "fd.h" #include "_scm.h" +#ifdef HAVE_STRING_H +#include +#endif +#ifdef HAVE_UNISTD_H +#include +#endif SCM_PROC (s_sys_ftell, "ftell", 1, 0, 0, scm_sys_ftell); diff --git a/libguile/mallocs.c b/libguile/mallocs.c index 27f1a791c..0f3022ed6 100644 --- a/libguile/mallocs.c +++ b/libguile/mallocs.c @@ -23,10 +23,10 @@ #include "_scm.h" #include "mallocs.h" #ifdef HAVE_MALLOC_H -#include "malloc.h" +#include #endif #ifdef HAVE_UNISTD_H -#include "unistd.h" +#include #endif diff --git a/libguile/ports.c b/libguile/ports.c index b57155227..63acf17eb 100644 --- a/libguile/ports.c +++ b/libguile/ports.c @@ -44,13 +44,16 @@ #ifdef HAVE_MALLOC_H -#include "malloc.h" +#include #endif #ifdef HAVE_UNISTD_H #include #endif +#ifdef HAVE_SYS_IOCTL_H +#include +#endif diff --git a/libguile/posix.c b/libguile/posix.c index 3636a500a..08b2ac527 100644 --- a/libguile/posix.c +++ b/libguile/posix.c @@ -61,6 +61,10 @@ #ifdef HAVE_UNISTD_H #include +#else +#ifndef ttyname +extern char *ttyname(); +#endif #endif #ifdef HAVE_SYS_SELECT_H @@ -102,7 +106,6 @@ #endif /* no FD_SET */ -extern char *ttyname (); extern FILE *popen (); extern char ** environ; @@ -602,10 +605,6 @@ scm_setsid () return SCM_UNSPECIFIED; } -#ifndef ttyname -extern char * ttyname(); -#endif - SCM_PROC (s_ttyname, "ttyname", 1, 0, 0, scm_ttyname); #ifdef __STDC__ SCM diff --git a/libguile/ramap.h b/libguile/ramap.h index a198f59ee..cb0ccd450 100644 --- a/libguile/ramap.h +++ b/libguile/ramap.h @@ -52,7 +52,7 @@ extern int scm_ra_matchp (SCM ra0, SCM ras); extern int scm_ramapc (int (*cproc) (), SCM data, SCM ra0, SCM lra, char *what); extern int scm_array_fill_int (SCM ra, SCM fill, SCM ignore); extern SCM scm_array_fill_x (SCM ra, SCM fill); -extern SCM scm_array_copy (SCM src, SCM dst); +extern SCM scm_array_copy_x (SCM src, SCM dst); extern int scm_ra_eqp (SCM ra0, SCM ras); extern int scm_ra_lessp (SCM ra0, SCM ras); extern int scm_ra_leqp (SCM ra0, SCM ras); @@ -75,7 +75,7 @@ extern int scm_ra_matchp (); extern int scm_ramapc (); extern int scm_array_fill_int (); extern SCM scm_array_fill_x (); -extern SCM scm_array_copy (); +extern SCM scm_array_copy_x (); extern int scm_ra_eqp (); extern int scm_ra_lessp (); extern int scm_ra_leqp (); diff --git a/libguile/read.c b/libguile/read.c index 1340fc1f4..e25cd4031 100644 --- a/libguile/read.c +++ b/libguile/read.c @@ -54,12 +54,12 @@ SCM_PROC (s_read, "read", 0, 3, 0, scm_read); #ifdef __STDC__ SCM -scm_read (SCM port, SCM case_insensative_p, SCM sharp) +scm_read (SCM port, SCM case_insensitive_p, SCM sharp) #else SCM -scm_read (port, case_insensative_p, sharp) +scm_read (port, case_insensitive_p, sharp) SCM port; - SCM case_insensative_p; + SCM case_insensitive_p; SCM sharp; #endif { @@ -72,9 +72,9 @@ scm_read (port, case_insensative_p, sharp) else SCM_ASSERT (SCM_NIMP (port) && SCM_OPINPORTP (port), port, SCM_ARG1, s_read); - case_i = (SCM_UNBNDP (case_insensative_p) + case_i = (SCM_UNBNDP (case_insensitive_p) ? default_case_i - : (case_insensative_p == SCM_BOOL_F)); + : (case_insensitive_p == SCM_BOOL_F)); if (SCM_UNBNDP (sharp)) sharp = SCM_BOOL_F; diff --git a/libguile/scmconfig.h.in b/libguile/scmconfig.h.in index f8de4b905..07703d591 100644 --- a/libguile/scmconfig.h.in +++ b/libguile/scmconfig.h.in @@ -176,6 +176,9 @@ /* Define if you have the header file. */ #undef HAVE_SYS_TYPES_H +/* Define if you have the header file. */ +#undef HAVE_SYS_IOCTL_H + /* Define if you have the header file. */ #undef HAVE_TIME_H diff --git a/libguile/simpos.c b/libguile/simpos.c index a29cb304a..970c6a004 100644 --- a/libguile/simpos.c +++ b/libguile/simpos.c @@ -42,6 +42,10 @@ #include #include "_scm.h" + +#ifdef HAVE_STRING_H +#include +#endif #ifdef HAVE_UNISTD_H #include #endif diff --git a/libguile/socket.c b/libguile/socket.c index cea6b5360..2c3c5714b 100644 --- a/libguile/socket.c +++ b/libguile/socket.c @@ -8,8 +8,12 @@ #include -#include #include "_scm.h" + +#ifdef HAVE_STRING_H +#include +#endif + #include #include #include diff --git a/libguile/strings.h b/libguile/strings.h index 6615e2330..852945752 100644 --- a/libguile/strings.h +++ b/libguile/strings.h @@ -46,6 +46,10 @@ #include "__scm.h" +#ifdef HAVE_STRING_H +#include +#endif + #define SCM_STRINGP(x) (SCM_TYP7S(x)==scm_tc7_string) diff --git a/libguile/strports.c b/libguile/strports.c index 1ba808a51..29ef1d310 100644 --- a/libguile/strports.c +++ b/libguile/strports.c @@ -43,6 +43,10 @@ #include #include "_scm.h" +#ifdef HAVE_STRING_H +#include +#endif + /* {Ports - string ports} diff --git a/libguile/struct.c b/libguile/struct.c index 265c7d4fd..a15c5508e 100644 --- a/libguile/struct.c +++ b/libguile/struct.c @@ -43,6 +43,10 @@ #include #include "_scm.h" +#ifdef HAVE_STRING_H +#include +#endif + static SCM required_vtable_fields = SCM_BOOL_F; diff --git a/libguile/symbols.c b/libguile/symbols.c index 4a6dd6065..78c819399 100644 --- a/libguile/symbols.c +++ b/libguile/symbols.c @@ -43,6 +43,10 @@ #include #include "_scm.h" +#ifdef HAVE_STRING_H +#include +#endif + diff --git a/libguile/unif.c b/libguile/unif.c index ed0e17c5c..796991546 100644 --- a/libguile/unif.c +++ b/libguile/unif.c @@ -42,6 +42,7 @@ #include #include "_scm.h" +#include "ramap.h" /* The set of uniform scm_vector types is: diff --git a/libguile/vports.c b/libguile/vports.c index dbb67cbfe..dfe6e13b1 100644 --- a/libguile/vports.c +++ b/libguile/vports.c @@ -43,6 +43,10 @@ #include #include "_scm.h" +#ifdef HAVE_STRING_H +#include +#endif + /* {Ports - soft ports} -- 2.20.1