Updated version to 0.5.2

Incorporated Windows NT support via cygwin32
This commit is contained in:
bdc 1999-06-21 04:35:42 +00:00
parent 54ca902c67
commit 17695ee207
66 changed files with 1348 additions and 250 deletions

View File

@ -7,6 +7,7 @@ srcdir = @srcdir@
VPATH = @srcdir@
CC = @CC@
DEFS = @DEFS@
EXEEXT = @EXEEXT@
LIBS = @LIBS@
#DBOPEN = @DBOPEN@
CFLAGS = @CFLAGS@
@ -173,7 +174,7 @@ scsh/time1.o scsh/time.o: scsh/time1.h
scsh/tty1.o scsh/tty.o: scsh/tty1.h
scsh/syscalls.o: scsh/syscalls1.h scsh/dirstuff1.h scsh/fdports1.h \
scsh/select1.h scsh/userinfo1.h
scsh/select1.h scsh/userinfo1.h
scsh/sighandlers1.o scsh/sighandlers.o: scsh/sighandlers1.h
@ -182,7 +183,27 @@ include $(srcdir)/scsh/machine/Makefile.inc
#.include "$(srcdir)/scsh/machine/Makefile.inc"
$(VM): main.o $(OBJS) $(AIX_P)
$(CC) $(LDFLAGS) $(LDFLAGS_AIX) -o $@ main.o $(OBJS) $(LIBS)
if [ ! "$${OSTYPE}" = "cygwin32" ] ; then \
$(CC) $(LDFLAGS) $(LDFLAGS_AIX) -o $@ main.o $(OBJS) $(LIBS); \
else \
dlltool \
--export-all-symbols \
--output-def $@.def \
main.o $(OBJS); \
$(CC) -s -Wl,--base-file,$@.base -o $@ main.o $(OBJS); \
dlltool \
--dllname $@ \
--input-def $@.def \
--base-file $@.base \
--output-exp $@.exp; \
$(CC) -s -Wl,--base-file,$@.base,$@.exp -o $@ main.o $(OBJS); \
dlltool \
--dllname $@ \
--input-def $@.def \
--base-file $@.base \
--output-exp $@.exp; \
$(CC) -Wl,$@.exp -o $@ main.o $(OBJS); \
fi
$(LIBCIG): main.o $(OBJS)
# $(CC) -r -o $@ main.o $(OBJS)
@ -265,7 +286,7 @@ install-dirs:
mkdir $(LIB)/vm
install-vm: $(VM)
$(INSTALL_PROGRAM) $(VM) $(LIB)/
$(INSTALL_PROGRAM) $(VM)$(EXEEXT) $(LIB)/
install-image: $(IMAGE)
$(INSTALL_DATA) $(IMAGE) $(LIB)/
@ -322,7 +343,7 @@ configure: configure.in
cd $(srcdir); autoconf
clean: clean-cig clean-scsh
-rm -f $(VM) *.o TAGS $(IMAGE) *.tmp script $(MANPAGE) \
-rm -f $(VM)$(EXEEXT) *.o TAGS $(IMAGE) *.tmp script $(MANPAGE) \
link/*.image debug/*.image debug/*.debug mini mini-heap.c
clean-cig:
@ -330,8 +351,10 @@ clean-cig:
distclean: clean
$(RM) Makefile sysdep.h config.status config.log config.cache \
scsh/machine scsh/regexp/Makefile scsh/endian.scm \
exportlist.aix
scsh/machine scsh/regexp/Makefile \
scsh/endian.scm scsh/static.scm \
exportlist.aix
$(RM) a.exe $(VM).base $(VM).def $(VM).exp
-find . -name '*~' -o -name '#*' -o -name core -exec rm {} \;
man: $(MANPAGE)
@ -391,8 +414,8 @@ inc:
# try "touch filenames.make" and hope for the best.
PACKAGES=packages.scm rts-packages.scm alt-packages.scm \
comp-packages.scm initial-packages.scm link-packages.scm \
more-packages.scm filenames.scm
comp-packages.scm initial-packages.scm link-packages.scm \
more-packages.scm filenames.scm
filenames.make: $(PACKAGES)
$(MAKE) $(VM) PACKAGES=
@ -409,9 +432,9 @@ link/linker.image: $(linker-files) alt/init-defpackage.scm
(echo ,batch; echo ,bench on; \
echo ,open signals handle features; \
echo ,open bitwise ascii code-vectors record; \
echo ,load $(linker-files); \
echo ,load $(linker-files); \
echo ,load alt/init-defpackage.scm; \
echo ,dump link/linker.image) \
echo ,dump link/linker.image) \
| $(LINKER_RUNNABLE)
# Or, to bootstrap from Lucid Common Lisp: (last tested with
@ -485,9 +508,9 @@ mini-heap.c: debug/mini1.image
| ./$(VM) -o ./$(VM) -h 3000000 -i $(IMAGE)
debug/mini1.image: $(VM) debug/mini.image
echo "(write-image \"debug/mini1.image\" \
(usual-resumer (lambda (args) \
(command-processor #f args))) \
\"foo\")" \
(usual-resumer (lambda (args) \
(command-processor #f args))) \
\"foo\")" \
| ./$(VM) -i debug/mini.image
# --------------------
@ -498,7 +521,7 @@ scheme48.h: vm/arch.scm vm/data.scm link/generate-c-header.scm
echo ,load-package big-scheme; echo ,open big-scheme; \
echo ,load link/generate-c-header.scm; \
echo \(make-c-header-file \"$@\" \
\"$(srcdir)/vm/arch.scm\" \"$(srcdir)/vm/data.scm\"\)) \
\"$(srcdir)/vm/arch.scm\" \"$(srcdir)/vm/data.scm\"\)) \
| $(RUNNABLE) -s-
#scheme48vm.c: $(vm-files)
@ -545,8 +568,8 @@ $(CIG).image: $(IMAGE) $(VM) $(srcdir)/cig/cig.scm $(srcdir)/cig/libcig.scm
echo ",dump /tmp/cig \"(CIG Preloaded -bri)\"") \
| ./$(VM) -o ./$(VM) -i ./$(IMAGE)
$(srcdir)/cig/image2script $(LIB)/$(VM) \
-o $(LIB)/$(VM) \
</tmp/cig > $(CIG).image
-o $(LIB)/$(VM) \
</tmp/cig > $(CIG).image
-chmod +x $(CIG).image
$(RM) /tmp/cig
@ -610,16 +633,16 @@ SCHEME =scsh/awk.scm \
# Bogus, but it makes the scm->c->o two-ply dependency work.
# Explicitly giving the .o/.c dependency also makes it go.
############################################################
cig/libcig.c: cig/libcig.scm
scsh/flock.c: scsh/flock.scm
cig/libcig.c: cig/libcig.scm
scsh/flock.c: scsh/flock.scm
scsh/jcontrol2.c: scsh/jcontrol2.scm
scsh/network.c: scsh/network.scm
scsh/rdelim.c: scsh/rdelim.scm
scsh/re.c: scsh/re.scm
scsh/network.c: scsh/network.scm
scsh/rdelim.c: scsh/rdelim.scm
scsh/re.c: scsh/re.scm
scsh/select.c: scsh/select.scm
scsh/syscalls.c: scsh/syscalls.scm
scsh/tty.c: scsh/tty.scm
scsh/time.c: scsh/time.scm
scsh/tty.c: scsh/tty.scm
scsh/time.c: scsh/time.scm
scsh/scsh: scsh/scsh-tramp.c
$(CC) -o $@ $(CPPFLAGS) $(CFLAGS) \
@ -665,17 +688,18 @@ scsh/regexp/libregexp.a:
scsh/scsh.vm: $(LIBSCSH) $(VM) scsh/scsh.image
./$(VM) -o ./$(VM) -h 8000000 -i scsh/scsh.image \
-lm ./vm/ps-interface.scm \
-lm ./vm/interfaces.scm \
-lm ./vm/package-defs.scm \
-lm ./vm/s48-package-defs.scm \
-dm -m static-heaps -e static-heap-linker \
-s scsh/static.scm \
-i scsh/scsh.image -o $@
-lm ./vm/ps-interface.scm \
-lm ./vm/interfaces.scm \
-lm ./vm/package-defs.scm \
-lm ./vm/s48-package-defs.scm \
-dm -m static-heaps -e static-heap-linker \
-s scsh/static.scm \
-i scsh/scsh.image -o $@
install-scsh: scsh
$(RM) $(bindir)/$(RUNNABLE)
$(INSTALL_PROGRAM) $(srcdir)/scsh/scsh $(bindir)/$(RUNNABLE)
$(RM) $(bindir)/$(RUNNABLE)$(EXEEXT)
$(INSTALL_PROGRAM) $(srcdir)/scsh/scsh$(EXEEXT) \
$(bindir)/$(RUNNABLE)$(EXEEXT)
$(INSTALL_PROGRAM) $(srcdir)/scsh/scsh.image $(LIB)/scsh.image
$(INSTALL_PROGRAM) $(srcdir)/$(LIBSCSH) $(libdir)/$(LIBSCSH)
$(RANLIB) $(libdir)/$(LIBSCSH)
@ -683,6 +707,6 @@ install-scsh: scsh
do $(INSTALL_DATA) $$f $(LIB)/scsh/; done
clean-scsh:
$(RM) scsh/*.o scsh/regexp/*.o scsh/machine/*.o scsh/*.image scsh/scsh
$(RM) $(LIBSCSH) scsh/scsh.vm
$(RM) scsh/*.o scsh/regexp/*.o scsh/machine/*.o scsh/*.image
$(RM) $(LIBSCSH) scsh/scsh$(EXEEXT) scsh/scsh.vm
-cd scsh/regexp; $(MAKE) clean

View File

@ -1,4 +1,4 @@
We are pleased to release scsh version 0.5.1 to celebrate Flag Day.
We are pleased to release scsh version 0.5.2 to celebrate Independence Day.
The new release has many bug fixes, improvements and new features.
The text below gives a general description of scsh, instructions for

View File

@ -15,14 +15,14 @@
# cp ~/scsh/RELEASE /zu/bdc/ftp/scsh/RELEASE
# rm /zu/bdc/ftp/scsh/README~
#
VERSION=-0.5.1
VERSION=-0.5.2
FTPDIR=${HOME}/ftp/scsh
#FTPDIR=${HOME}/ftp/users/bdc
FTPDIR=${HOME}/ftp/users/bdc
CVSROOT=/sw/scsh
CVSROOT=/projects/express/scsh-cvs
export CVSROOT
TMPSPACE=/dl/bdc
TMPSPACE=${HOME}/tmp
#-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
umask 002
# go to temp space
@ -54,7 +54,7 @@ tar czvf ${FTPDIR}/scsh${VERSION}.tar.gz scsh${VERSION}/
# fix symlink
if [ $VERSION != "" ] ; then
echo Symlinking
rm ${FTPDIR}/scsh.tar.gz
rm -f ${FTPDIR}/scsh.tar.gz
ln -s scsh${VERSION}.tar.gz ${FTPDIR}/scsh.tar.gz
else
echo No VERSION therefore no symlink needed
@ -66,7 +66,7 @@ rm -r scsh${VERSION}
# split binary up
echo Spliting tarball
rm -r ${FTPDIR}/split
rm -rf ${FTPDIR}/split
mkdir ${FTPDIR}/split
cd ${FTPDIR}/split
split -b 100k ../scsh${VERSION}.tar.gz scsh${VERSION}.tar.gz-x

View File

@ -1,6 +1,6 @@
#!/bin/sh
cd /dl/bdc
tar xzvf /zu/bdc/ftp/users/bdc/scsh.tar.gz
cd scsh-0.5.1
cd scsh-0.5.2
./configure
make

View File

@ -14,8 +14,11 @@ elif [ $# -gt 0 ] ; then
else echo '#!'$binary -i
fi
exec cat
if [ ! "${OSTYPE}" = "cygwin32" ] ; then
exec cat
else
exec /mksnt/cat
fi
# This program reads an S48 image from stdin and turns it into
# an executable by prepending a #! prefix. The vm and its

View File

@ -4,6 +4,7 @@
*/
#include "libcig.h"
#include <errno.h>
#include <string.h>
#include <stddef.h>
#include <stdio.h>
@ -42,7 +43,6 @@ char *scheme2c_strcpy(scheme_value sstr)
{
char *result;
int slen;
extern int errno;
slen = STRING_LENGTH(sstr);
result = Malloc(char, slen+1);

13
configure vendored
View File

@ -1158,6 +1158,12 @@ EOF
;;
## NT - cygwin32
*-*-cygwin32* )
dir=cygwin32
EXEEXT=".exe"
;;
## Generic Configuration
* )
dir=generic
@ -1168,7 +1174,7 @@ EOF
;;
esac
/bin/rm -f $srcdir/scsh/machine
rm -f $srcdir/scsh/machine
ln -s $srcdir/$dir $srcdir/scsh/machine
echo $ac_n "checking for -lm""... $ac_c" 1>&6
@ -1620,7 +1626,7 @@ else
fi
echo "$ac_t""$CPP" 1>&6
for ac_hdr in libgen.h sys/timeb.h posix/time.h sys/select.h nlist.h
for ac_hdr in libgen.h sys/timeb.h posix/time.h sys/select.h nlist.h sys/un.h
do
ac_safe=`echo "$ac_hdr" | tr './\055' '___'`
echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
@ -1870,7 +1876,7 @@ else
echo "main(){int i=1;}
fnord(){int i=23; int ltuae=42;}" > conftest.c
${CC} conftest.c > /dev/null
${CC} -o a.out conftest.c > /dev/null
if (nm a.out | grep _fnord) > /dev/null; then
s48_cv_uscore=yes
else
@ -2242,6 +2248,7 @@ s%@INSTALL_DATA@%$INSTALL_DATA%g
s%@RANLIB@%$RANLIB%g
s%@CPP@%$CPP%g
s%@AIX_P@%$AIX_P%g
s%@EXEEXT@%$EXEEXT%g
s%@AR@%$AR%g
s%@CFLAGS1@%$CFLAGS1%g
s%@ENDIAN@%$ENDIAN%g

View File

@ -78,7 +78,7 @@ AC_DEFUN(S48_USCORE, [
AC_CACHE_VAL(s48_cv_uscore,[
echo "main(){int i=1;}
fnord(){int i=23; int ltuae=42;}" > conftest.c
${CC} conftest.c > /dev/null
${CC} -o a.out conftest.c > /dev/null
if (nm a.out | grep _fnord) > /dev/null; then
s48_cv_uscore=yes
else
@ -170,7 +170,7 @@ AC_DEFUN(SCSH_LINUX_ELF, [
AC_MSG_CHECKING(for Linux using ELF)
AC_CACHE_VAL(scsh_cv_linux_elf,[
touch conftest.c
if ${CC} -v conftest.c 2>&1 | grep -q __ELF__ ; then
if ${CC} -v -o a.out conftest.c 2>&1 | grep -q __ELF__ ; then
scsh_cv_linux_elf=yes
else
scsh_cv_linux_elf=no
@ -319,6 +319,12 @@ case "$host" in
AC_DEFINE(HAVE_NLIST)
;;
## NT - cygwin32
*-*-cygwin32* )
dir=cygwin32
EXEEXT=".exe"
;;
## Generic Configuration
* )
dir=generic
@ -329,7 +335,7 @@ case "$host" in
;;
esac
/bin/rm -f $srcdir/scsh/machine
rm -f $srcdir/scsh/machine
ln -s $srcdir/$dir $srcdir/scsh/machine
AC_CHECK_LIB(m, sqrt)
@ -345,6 +351,7 @@ dnl AC_CHECK_LIB(mld, main)
AC_RETSIGTYPE
AC_HAVE_HEADERS(libgen.h sys/timeb.h posix/time.h sys/select.h nlist.h)
AC_HAVE_HEADERS(sys/un.h)
AC_HAVE_FUNCS(strerror)
AC_HAVE_FUNCS(dlopen gettimeofday ftime nlist select setitimer sigaction)
AC_HAVE_FUNCS(socket chroot)
@ -366,6 +373,7 @@ AC_SUBST(AR)
AC_SUBST(CC)
AC_SUBST(CFLAGS)
AC_SUBST(CFLAGS1)
AC_SUBST(EXEEXT)
AC_SUBST(ENDIAN)
AC_SUBST(LDFLAGS)
AC_SUBST(LDFLAGS_AIX)

View File

@ -362,7 +362,7 @@ really_dynamic_load( char *reloc_info_file, char *output_file, char *user_args )
free(command);
/* open the output file */
output_file_desc = fopen(output_file, "r");
output_file_desc = fopen(output_file, "rb");
if (output_file_desc == NULL ) {
fprintf(stderr, "unable to open output file\n");
abort_load(NULL, NULL, output_file);

View File

@ -105,7 +105,7 @@ extended_vm (long key, scheme_value value)
FILE *new_stream;
if (pstream == NULL) return UNDEFINED;
new_stream = fdopen(fd, key == 24 ? "r" : "w");
new_stream = fdopen(fd, key == 24 ? "rb" : "wb");
if (new_stream == NULL) return UNDEFINED;
fclose(*pstream);
*pstream = new_stream;

View File

@ -181,7 +181,7 @@ char **process_meta_arg(char **av)
if( !*av ) return NULL;
fname = *av;
script = fopen(fname, "r");
script = fopen(fname, "rb");
if( !script ) return NULL;
/* Skip line 1. */

View File

@ -2680,7 +2680,7 @@ long Tinterpret()
goto extract_string;
extract_string_return_0:
spec_167X = extract_string_return_value;
port_168X = ps_open(spec_167X, "w");
port_168X = ps_open(spec_167X, "wb");
if ((NULL == port_168X)) {
merged_arg0K0 = 0;
merged_arg1K1 = arg3_164X;
@ -3712,7 +3712,7 @@ long Tinterpret()
goto extract_string;
extract_string_return_1:
spec_341X = extract_string_return_value;
arg2K0 = (ps_open(spec_341X, "w"));
arg2K0 = (ps_open(spec_341X, "wb"));
goto L21208;}
else {
merged_arg1K0 = filename_340X;
@ -3720,7 +3720,7 @@ long Tinterpret()
goto extract_string;
extract_string_return_2:
spec_342X = extract_string_return_value;
arg2K0 = (ps_open(spec_342X, "r"));
arg2K0 = (ps_open(spec_342X, "rb"));
goto L21208;}}}
L21413: {
if ((1 == (RSvalS))) {
@ -6684,7 +6684,7 @@ long read_image(unsigned char *filename_764X, long startup_space_765X)
long new_hp_792X;
long delta_793X;
{port_766X = ps_open(filename_764X, "r");
{port_766X = ps_open(filename_764X, "rb");
if ((NULL == port_766X)) {
TTerror("Can't open heap image file", 0, 0, 0, 0);
goto L10206;}
@ -6867,7 +6867,7 @@ long check_image_header(unsigned char *filename_794X)
FILE * out_803X;
unsigned char Kchar_804X;
{port_795X = ps_open(filename_794X, "r");
{port_795X = ps_open(filename_794X, "rb");
if ((NULL == port_795X)) {
out_796X = Scurrent_output_portS;
fputs("Can't open heap image file", out_796X);

View File

@ -11,8 +11,6 @@
#include "cstuff.h"
extern int errno;
/* stub used to return TRUE when scheme checks for Berkeley dbm */
int db_check()
{

View File

13
scsh/cygwin32/bufpol.scm Normal file
View File

@ -0,0 +1,13 @@
;;; Flags that control buffering policy.
;;; Copyright (c) 1993 by Olin Shivers.
;;; Copyright (c) 1999 by Brian D. Carlstrom.
;;; These are for the SET-PORT-BUFFERING procedure, essentially a Scheme
;;; analog of the setbuf(3S) stdio call. We use the actual stdio values.
;;; These constants are not likely to change from stdio lib to stdio lib,
;;; but you need to check when you do a port.
(define-enum-constants bufpol
(block 0) ; _IOFBF
(line 1) ; _IOLBF
(none 2)) ; _IONBF

127
scsh/cygwin32/errno.scm Normal file
View File

@ -0,0 +1,127 @@
;;; Errno constant definitions.
;;; Copyright (c) 1993 by Olin Shivers.
;;; Copyright (c) 1999 by Brian D. Carlstrom.
;;; These are the correct values for Cygwin32
(define errno/2big 7) ; 2big is not a legit Scheme symbol. Lose, lose.
(define-enum-constants errno
(perm 1) ; Not super-user
(noent 2) ; No such file or directory
(srch 3) ; No such process
(intr 4) ; Interrupted system call
(io 5) ; I/O error
(nxio 6) ; No such device or address
; (2big 7) ; Arg list too long
(noexec 8) ; Exec format error
(badf 9) ; Bad file number
(child 10) ; No children
(again 11) ; No more processes
(wouldblock 11) ; EAGAIN again
(nomem 12) ; Not enough core
(acces 13) ; Permission denied
(fault 14) ; Bad address
(notblk 15) ; Block device required
(busy 16) ; Mount device busy
(exist 17) ; File exists
(xdev 18) ; Cross-device link
(nodev 19) ; No such device
(notdir 20) ; Not a directory
(isdir 21) ; Is a directory
(inval 22) ; Invalid argument
(nfile 23) ; Too many open files in system
(mfile 24) ; Too many open files
(notty 25) ; Not a typewriter
(txtbsy 26) ; Text file busy
(fbig 27) ; File too large
(nospc 28) ; No space left on device
(spipe 29) ; Illegal seek
(rofs 30) ; Read only file system
(mlink 31) ; Too many links
(pipe 32) ; Broken pipe
(dom 33) ; Math arg out of domain of func
(range 34) ; Math result not representable
(nomsg 35) ; No message of desired type
(idrm 36) ; Identifier removed
(chrng 37) ; Channel number out of range
(l2nsync 38) ; Level 2 not synchronized
(l3hlt 39) ; Level 3 halted
(l3rst 40) ; Level 3 reset
(lnrng 41) ; Link number out of range
(unatch 42) ; Protocol driver not attached
(nocsi 43) ; No CSI structure available
(l2hlt 44) ; Level 2 halted
(deadlk 45) ; Deadlock condition
(nolck 46) ; No record locks available
(bade 50) ; Invalid exchange
(badr 51) ; Invalid request descriptor
(xfull 52) ; Exchange full
(noano 53) ; No anode
(badrqc 54) ; Invalid request code
(badslt 55) ; Invalid slot
(deadlock 56) ; File locking deadlock error
(bfont 57) ; Bad font file fmt
(nostr 60) ; Device not a stream
(nodata 61) ; No data (for no delay io)
(time 62) ; Timer expired
(nosr 63) ; Out of streams resources
(nonet 64) ; Machine is not on the network
(nopkg 65) ; Package not installed
(remote 66) ; The object is remote
(nolink 67) ; The link has been severed
(adv 68) ; Advertise error
(srmnt 69) ; Srmount error
(comm 70) ; Communication error on send
(proto 71) ; Protocol error
(multihop 74) ; Multihop attempted
(lbin 75) ; Inode is remote (not really error)
(dotdot 76) ; Cross mount point (not really error)
(badmsg 77) ; Trying to read unreadable message
(notuniq 80) ; Given log. name not unique
(badfd 81) ; f.d. invalid for this operation
(remchg 82) ; Remote address changed
(libacc 83) ; Can't access a needed shared lib
(libbad 84) ; Accessing a corrupted shared lib
(libscn 85) ; .lib section in a.out corrupted
(libmax 86) ; Attempting to link in too many libs
(libexec 87) ; Attempting to exec a shared library
(nosys 88) ; Function not implemented
(nmfile 89) ; No more files
(notempty 90) ; Directory not empty
(nametoolong 91) ; File or path name too long
(loop 92) ; Too many symbolic links
(opnotsupp 95) ; Operation not supported on transport endpoint
(pfnosupport 96) ; Protocol family not supported
(connreset 104) ; Connection reset by peer
(nobufs 105) ; No buffer space available
(afnosupport 106) ;
(prototype 107) ;
(notsock 108) ;
(noprotoopt 109) ;
(shutdown 110) ;
(connrefused 111) ; Connection refused
(addrinuse 112) ; Address already in use
(connaborted 113) ; Connection aborted
(netunreach 114) ;
(netdown 115) ;
(timedout 116) ;
(hostdown 117) ;
(hostunreach 118) ;
(inprogress 119) ;
(already 120) ;
(destaddrreq 121) ;
(msgsize 122) ;
(protonosupport 123) ;
(socktnosupport 124) ;
(addrnotavail 125) ;
(netreset 126) ;
(isconn 127) ;
(notconn 128) ;
(toomanyrefs 129) ;
(proclim 130) ;
(users 131) ;
(dquot 132) ;
(stale 133) ;
(notsup 134) ;
(last 134)) ; Must be equal largest errno

77
scsh/cygwin32/fdflags.scm Normal file
View File

@ -0,0 +1,77 @@
;;; Flags for open(2) and fcntl(2).
;;; Copyright (c) 1993 by Olin Shivers.
;;; Copyright (c) 1999 by Brian D. Carlstrom
(define-enum-constants open
;; POSIX
(read #x0000)
(write #x0001)
(read+write #x0002)
;; Cygwin32
(ndelay #x0004) ; non blocking I/O (4.2 style)
;; POSIX
(append #x0008) ; set append mode
;; Cygwin32
(mark #x0010) ; internal; mark during gc()
(defer #x0020) ; internal; defer for next gc pass
(async #x0040) ; signal pgrep when data ready
(shared-lock #x0080) ; open with shared file lock
(exclusive-lock #x0100) ; open with exclusive file lock
;; POSIX
(create #x0200) ; create if nonexistant
(truncate #x0400) ; truncate to zero length
(exclusive #x0800) ; error if already exists
;; Cygwin32
(non-blocking #x1000) ; non blocking I/O (sys5 style)
(fsync #x2000) ; synchronus writes
;; POSIX
(non-blocking #x4000) ; non blocking I/O (POSIX style)
(no-control-tty #x8000) ; don't assign controlling terminal
;; Cygwin32
(binary #x10000)
(text #x20000)
(noinherit #x40000))
(define open/access-mask
(bitwise-ior open/read
(bitwise-ior open/write open/read+write)))
;;; fcntl() commands
(define-enum-constants fcntl
(dup-fdes 0) ; F_DUPFD
(get-fdes-flags 1) ; F_GETFD
(set-fdes-flags 2) ; F_SETFD
(get-status-flags 3) ; F_GETFL
(set-status-flags 4) ; F_SETFL
(get-owner 5) ; F_GETOWN (Not POSIX)
(set-owner 6) ; F_SETOWN (Not POSIX)
(get-record-lock 7) ; F_GETLK
(set-record-lock-no-block 8) ; F_SETLK
(set-record-lock 9) ; F_SETLKW
(remote-get-lock 10) ; F_RGETLK (Not POSIX)
(remote-set-lock-no-block 11) ; F_RSETLK (Not POSIX)
(convert 12) ; F_CNVT (Not POSIX)
(remote-get-lock 13)) ; F_RSETLKW (Not POSIX)
;;; fcntl fdes-flags (F_GETFD)
(define fdflags/close-on-exec 1)
;;; fcntl status-flags (F_GETFL)
;;; Mostly, these are OPEN/... flags, like OPEN/APPEND.
;;; (define fdstatus/... ...)
;;; fcntl lock values.
(define-enum-constants lock
(read 1) ; F_RDLCK
(release 2) ; F_UNLCK
(write 3) ; F_WRLCK
(release-remote 4)) ; F_UNLKSYS (Not POSIX)

3
scsh/cygwin32/libansi.c Normal file
View File

@ -0,0 +1,3 @@
/* OS-dependent support for what is supposed to be the standard ANSI C Library.
** Copyright (c) 1999 by Brian D. Carlstrom.
*/

125
scsh/cygwin32/netconst.scm Normal file
View File

@ -0,0 +1,125 @@
;;; Magic Numbers for Networking
;;; Copyright (c) 1999 by Brian D. Carlstrom.
;;; magic numbers not from header file
;;; but from man page
;;; why can't unix make up its mind
(define shutdown/receives 0)
(define shutdown/sends 1)
(define shutdown/sends+receives 2)
;;;-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
;;; BELOW THIS POINT ARE BITS FROM:
;;; <sys/socket.h>
;;; <sys/un.h>
;;; <netinet/in.h>
;;; <netinet/tcp.h>
;;; <netdb.h>
;;;-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
;;; ADDRESS FAMILIES -- <sys/socket.h>
(define address-family/unspecified 0) ; unspecified
(define address-family/unix 1) ; local to host (pipes, portals)
(define address-family/internet 2) ; internetwork: UDP, TCP, etc.
;;; SOCKET TYPES -- <sys/socket.h>
(define socket-type/stream 1) ; stream socket
(define socket-type/datagram 2) ; datagram socket
(define socket-type/raw 3) ; raw-protocol interface
(define socket-type/rdm 4) ; reliably-delivered message
(define socket-type/seqpacket 5) ; sequenced packet stream
(define socket-type/packet 10) ; CYGWIN specific
;;; PROTOCOL FAMILIES -- <sys/socket.h>
(define protocol-family/unspecified 0) ; unspecified
(define protocol-family/unix 1) ; local to host (pipes, portals)
(define protocol-family/internet 2) ; internetwork: UDP, TCP, etc.
;;; Well know addresses -- <netinet/in.h>
(define internet-address/any #x00000000)
(define internet-address/loopback #x7f000001)
(define internet-address/broadcast #xffffffff) ; must be masked
;;; errors from host lookup -- <netdb.h>
(define herror/host-not-found 1) ;Authoritative Answer Host not found
(define herror/try-again 2) ;Non-Authoritive Host not found, or SERVERFAIL
(define herror/no-recovery 3) ;Non recoverable errors, FORMERR, REFUSED, NOTIMP
(define herror/no-data 4) ;Valid name, no data record of requested type
(define herror/no-address herror/no-data) ;no address, look for MX record
;;; flags for send/recv -- <sys/socket.h>
(define message/out-of-band 1) ; process out-of-band data
(define message/peek 2) ; peek at incoming message
(define message/dont-route 4) ; send without using routing tables
;;; protocol level for socket options -- <sys/socket.h>
(define level/socket #xffff) ; SOL_SOCKET: options for socket level
;;; socket options -- <sys/socket.h>
(define socket/debug #x0001) ; turn on debugging info recording
(define socket/accept-connect #x0002) ; socket has had listen()
(define socket/reuse-address #x0004) ; allow local address reuse
(define socket/keep-alive #x0008) ; keep connections alive
(define socket/dont-route #x0010) ; just use interface addresses
(define socket/broadcast #x0020) ; permit sending of broadcast msgs
(define socket/use-loop-back #x0040) ; bypass hardware when possible
(define socket/linger #x0080) ; linger on close if data present
(define socket/oob-inline #x0100) ; leave received OOB data in line
(define socket/send-buffer #x1001) ; send buffer size
(define socket/receive-buffer #x1002) ; receive buffer size
(define socket/send-low-water #x1003) ; send low-water mark
(define socket/receive-low-water #x1004) ; receive low-water mark
(define socket/send-timeout #x1005) ; send timeout
(define socket/receive-timeout #x1006) ; receive timeout
(define socket/error #x1007) ; get error status and clear
(define socket/type #x1008) ; get socket type
;;; ip options -- <cygwin/socket.h>
(define ip/options 1 ) ; buf/ip/opts; set/get ip options
(define ip/multicast-if 2 ) ; u_char; set/get ip multicast i/f
(define ip/multicast-ttl 3 ) ; u_char; set/get ip multicast ttl
(define ip/multicast-loop 4 ) ; u_char; set/get ip multicast loopback
(define ip/add-membership 5 ) ; ip_mreq; add an ip group membership
(define ip/drop-membership 6 ) ; ip_mreq; drop an ip group membership
(define ip/time-to-live 7 ) ; int; ip time to live
(define ip/type-of-service 8 ) ; int; ip type of service and preced.
(define ip/dont-fragment 9 ) ;
;;; tcp options -- <netinet/tcp.h>
(define tcp/no-delay #x01) ; don't delay send to coalesce packets
(define tcp/max-segment #x02) ; set maximum segment size
;;; -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
;;; OPTION SETS FOR SOCKET-OPTION AND SET-SOCKET-OPTION
;;; Boolean Options
(define options/boolean
(list socket/debug
socket/accept-connect
socket/reuse-address
socket/keep-alive
socket/dont-route
socket/broadcast
socket/use-loop-back
socket/oob-inline
tcp/no-delay))
;;; Integer Options
(define options/value
(list socket/send-buffer
socket/receive-buffer
socket/send-low-water
socket/receive-low-water
socket/error
socket/type
ip/time-to-live
tcp/max-segment))
;;; #f or Positive Integer
(define options/linger
(list socket/linger))
;;; Real Number
(define options/timeout
(list socket/send-timeout
socket/receive-timeout))

117
scsh/cygwin32/packages.scm Normal file
View File

@ -0,0 +1,117 @@
;;; Interfaces and packages for the Cygwin32 specific parts of scsh.
;;; Copyright (c) 1994 by Olin Shivers.
;;; Copyright (c) 1999 by Brian D. Carlstrom.
(define-interface cygwin32-fdflags-extras-interface
(export open/shared-lock
open/exclusive-lock
open/async
open/fsync
fcntl/get-owner
fcntl/set-owner))
(define-interface cygwin32-errno-extras-interface
(export errno/notblk
errno/txtbsy
errno/wouldblock
errno/inprogress
errno/already
errno/notsock
errno/destaddrreq
errno/msgsize
errno/prototype
errno/noprotoopt
errno/protonosupport
errno/socktnosupport
errno/opnotsupp
errno/pfnosupport
errno/afnosupport
errno/addrinuse
errno/addrnotavail
errno/netdown
errno/netunreach
errno/netreset
errno/connaborted
errno/connreset
errno/nobufs
errno/isconn
errno/notconn
errno/shutdown
errno/toomanyrefs
errno/timedout
errno/connrefused
errno/loop
errno/hostdown
errno/hostunreach
errno/proclim
errno/users
errno/dquot
errno/stale
errno/remote
errno/last))
(define-interface cygwin32-signals-extras-interface
(export signal/trap
signal/emt
signal/bus
signal/sys
signal/urg
signal/cld
signal/io
signal/xcpu
signal/xfsz
signal/vtalrm
signal/prof
signal/winch
signal/info))
(define-interface cygwin32-network-extras-interface
(export socket/debug
socket/accept-connect
socket/reuse-address
socket/keep-alive
socket/dont-route
socket/broadcast
socket/use-loop-back
socket/linger
socket/oob-inline
socket/send-buffer
socket/receive-buffer
socket/send-low-water
socket/receive-low-water
socket/send-timeout
socket/receive-timeout
socket/error
socket/type
;;; all ip/* but ip/options and ip/time-to-live cygwin32 only
ip/options
ip/type-of-service
ip/time-to-live
ip/multicast-if
ip/multicast-ttl
ip/multicast-loop
ip/add-membership
ip/drop-membership
tcp/no-delay
tcp/max-segment))
(define-interface cygwin32-extras-interface
(compound-interface cygwin32-errno-extras-interface
cygwin32-fdflags-extras-interface
cygwin32-network-extras-interface
cygwin32-signals-extras-interface))
(define-interface cygwin32-defs-interface
(compound-interface cygwin32-extras-interface
sockets-network-interface
posix-errno-interface
posix-fdflags-interface
posix-signals-interface
signals-internals-interface))
(define-structure cygwin32-defs cygwin32-defs-interface
(open scheme bitwise defenum-package)
(files fdflags errno signals netconst))
(define-interface os-extras-interface cygwin32-extras-interface)
(define os-dependent cygwin32-defs)

73
scsh/cygwin32/signals.scm Normal file
View File

@ -0,0 +1,73 @@
;;; Signal constant definitions for Cygwin32
;;; Copyright (c) 1994 by Olin Shivers.
;;; Copyright (c) 1999 by Brian D. Carlstrom.
(define-enum-constants signal
;; POSIX
(hup 1) ; hangup
(int 2) ; interrupt
(quit 3) ; quit
(ill 4) ; illegal instruction (not reset when caught)
;; Cygwin32
(trap 5) ; trace trap (not reset when caught)
;; POSIX
(iot 6) ; IOT instruction
(abrt 6) ; used by abort, replace SIGIOT in the future
;; Cygwin32
(emt 7) ; EMT instruction
;; POSIX
(fpe 8) ; floating point exception
(kill 9) ; kill (cannot be caught or ignored)
;; Cygwin32
(bus 10) ; bus error
;; POSIX
(segv 11) ; segmentation violation
;; Cygwin32
(sys 12) ; bad argument to system call
;; POSIX
(pipe 13) ; write on a pipe with no one to read it
(alrm 14) ; alarm clock
(term 15) ; software termination signal from kill
;; Cygwin32
(urg 16) ; urgent condition on IO channel
;; POSIX
(stop 17) ; sendable stop signal not from tty
(tstp 18) ; stop signal from tty
(cont 19) ; continue a stopped process
(chld 20) ; to parent on child stop or exit
;; Cygwin32
(cld 20) ; System V name for SIGCHLD
;; POSIX
(ttin 21) ; to readers pgrp upon background tty read
(ttou 22) ; like TTIN for output if (tp->t_local&LTOSTOP)
;; Cygwin32
(io 23) ; input/output possible signal
(poll 23) ; System V name for SIGIO
(xcpu 24) ; exceeded CPU time limit
(xfsz 25) ; exceeded file size limit
(vtalrm 26) ; virtual time alarm
(prof 27) ; profiling time alarm
(winch 28) ; window changed
(info 29) ; information request
;; User defined
(usr1 30) ; user defined signal 1
(usr2 31) ; user defined signal 2
)
(define signals-ignored-by-default
(list signal/chld signal/cont ; These are Posix.
signal/info signal/io signal/urg signal/winch)) ; These are BSD.

129
scsh/cygwin32/signals1.c Normal file
View File

@ -0,0 +1,129 @@
/* Need to turn off synchronous error signals (SIGPIPE, SIGSYS). */
#include "../scsh_aux.h"
/* Make sure our exports match up w/the implementation: */
#include "../signals1.h"
/* This table converts Unix signal numbers to S48/scsh interrupt numbers.
** If the signal doesn't have an interrupt number, the entry is -1.
** (Only asynchronous signals have interrupt numbers.)
**
** Note that we bake into this table the integer values of the signals --
** i.e., we assume that SIGHUP=1, SIGALRM=15, etc. So this definition is
** very system-dependent.
*/
const int sig2int[] = {
-1, /* 0 is not a signal */
scshint_hup, /* SIGHUP */
scshint_keyboard, /* SIGINT */
scshint_quit, /* SIGQUIT */
-1, /* SIGILL */
-1, /* SIGTRAP */
-1, /* SIGABRT & SIGIOT */
-1, /* SIGEMT */
-1, /* SIGFPE */
-1, /* SIGKILL */
-1, /* SIGBUS */
-1, /* SIGSEGV */
-1, /* SIGSYS */
-1, /* SIGPIPE */
scshint_alarm, /* SIGALRM */
scshint_term, /* SIGTERM */
scshint_urg, /* SIGURG */
-1, /* SIGSTOP */
scshint_tstp, /* SIGTSTP */
scshint_cont, /* SIGCONT */
scshint_chld, /* SIGCHLD */
-1, /* scshint_ttyin, /* SIGTTIN */
-1, /* scshint_ttou, /* SIGTTOU */
scshint_io, /* SIGIO */
scshint_xcpu, /* SIGXCPU */
scshint_xfsz, /* SIGXFSZ */
scshint_vtalrm, /* SIGVTALRM */
scshint_prof, /* SIGPROF */
scshint_winch, /* SIGWINCH */
scshint_info, /* SIGINFO */
scshint_usr1, /* SIGUSR1 */
scshint_usr2 /* SIGUSR2 */
};
const int max_sig = 31; /* SIGUSR2 */
/*
scshint_alarm
scshint_keyboard
scshint_memory_shortage
scshint_chld
scshint_cont
scshint_hup
scshint_quit
scshint_term
scshint_tstp
scshint_usr1
scshint_usr2
scshint_info
scshint_io
scshint_poll
scshint_prof
scshint_pwr
scshint_urg
scshint_vtalrm
scshint_winch
scshint_xcpu
scshint_xfsz
SIGALRM
SIGCHLD
SIGCONT
SIGHUP
SIGINFO
SIGINT
SIGIO
SIGPROF
SIGQUIT
SIGTERM
SIGTSTP
SIGTTIN
SIGTTOU
SIGURG
SIGUSR1
SIGUSR2
SIGVTALRM
SIGWINCH
SIGXCPU
SIGXFSZ
SIGHUP 1
SIGINT 2
SIGQUIT 3
SIGILL 4
SIGTRAP 5
SIGABRT 6
SIGIOT SIGABRT
SIGEMT 7
SIGFPE 8
SIGKILL 9
SIGBUS 10
SIGSEGV 11
SIGSYS 12
SIGPIPE 13
SIGALRM 14
SIGTERM 15
SIGURG 16
SIGSTOP 17
SIGTSTP 18
SIGCONT 19
SIGCHLD 20
SIGTTIN 21
SIGTTOU 22
SIGIO 23
SIGXCPU 24
SIGXFSZ 25
SIGVTALRM 26
SIGPROF 27
SIGWINCH 28
SIGINFO 29
SIGUSR1 30
SIGUSR2 31
*/

10
scsh/cygwin32/sigset.h Normal file
View File

@ -0,0 +1,10 @@
/* Convert between a lo24/hi integer-pair bitset and a sigset_t value.
** These macros are OS-dependent, and must be defined per-OS.
*/
#define make_sigset(maskp, hi, lo) (*maskp=((hi)<<24)|(lo))
/* Not a procedure: */
#define split_sigset(mask, hip, lop) \
((*(hip)=(mask>>24)&0xff), \
(*(lop)=(mask&0xffffff)))

90
scsh/cygwin32/stdio_dep.c Normal file
View File

@ -0,0 +1,90 @@
/* Copyright (c) 1994 by Olin Shivers.
** Copyright (c) 1994-1999 by Brian D. Carlstrom.
**
** This file implements the char-ready? procedure for file descriptors
** and Scsh's fdports. It is not Posix, so it must be implemented for
** each OS to which scsh is ported.
**
** This version assumes two things:
** - the existence of select to tell if there is data
** available for the file descriptor.
** - the existence of the _cnt field in the stdio FILE struct, telling
** if there is any buffered input in the struct.
**
** Most Unixes have these things, so this file should work for them.
** However, Your Mileage May Vary.
**
** You could also replace the select() with a iotctl(FIONREAD) call, if you
** had one but not the other.
** -Olin&Brian
*/
#include <sys/types.h>
#include <sys/time.h>
#include <stdio.h>
#include <unistd.h>
#include "libcig.h"
#include <errno.h>
#include "stdio_dep.h" /* Make sure the .h interface agrees with the code. */
/* These two procs return #t if data ready, #f data not ready,
** and errno if error.
*/
scheme_value char_ready_fdes(int fd)
{
fd_set readfds;
struct timeval timeout;
int result;
FD_ZERO(&readfds);
FD_SET(fd,&readfds);
timeout.tv_sec=0;
timeout.tv_usec=0;
result=select(fd+1, &readfds, NULL, NULL, &timeout);
if(result == -1 )
return(ENTER_FIXNUM(errno));
if(result)
return(SCHTRUE);
return(SCHFALSE);
}
scheme_value stream_char_readyp(FILE *f)
{
int fd = fileno(f);
return f->_r > 0 ? SCHTRUE : char_ready_fdes(fd);
}
void setfileno(FILE *fs, int fd)
{
fs->_file = fd;
}
int fbufcount(FILE* fs)
{
return(fs->_r);
}
/* Returns true if there is no buffered data in stream FS
** (or there is no buffering, period.)
*/
int ibuf_empty(FILE *fs) {return fs->_r <= 0;}
/* Returns true if the buffer in stream FS is full
** (or there is no buffering, period).
*/
int obuf_full(FILE *fs) {return fs->_w <= 0;}
/* Cygwin doesn't yet implement these system calls */
struct netent *getnetbyaddr (long x, int y) {return NULL;}
struct netent *getnetbyname (const char *x) {return NULL;}
int fchown(int x, uid_t y, gid_t z) {return 0;}
int mkfifo(char *__path, mode_t __mode) {return 0;}

13
scsh/cygwin32/stdio_dep.h Normal file
View File

@ -0,0 +1,13 @@
/* Exports from stdio_dep.h. */
scheme_value char_ready_fdes(int fd);
scheme_value stream_char_readyp(FILE *f);
void setfileno(FILE *fs, int fd);
int fbufcount(FILE* fs);
int ibuf_empty(FILE *fs);
int obuf_full(FILE *fs);

6
scsh/cygwin32/sysdep.h Normal file
View File

@ -0,0 +1,6 @@
/* Cygwin seems to have TZNAME but they forgot to define it */
#define HAVE_TZNAME
#define tzname _tzname
/* Cygwin's adds _'s but making configure.in know about dlltool seemed evil */
#define DLSYM_ADDS_USCORE

View File

@ -0,0 +1,8 @@
;;; OS-dependent time stuff
;;; Copyright (c) 1995 by Olin Shivers.
;;; This suffices for BSD systems with the gettimeofday()
;;; microsecond-resolution timer.
(define (ticks/sec) 1000000) ; usec

38
scsh/cygwin32/time_dep1.c Normal file
View File

@ -0,0 +1,38 @@
/* OS-dependent support for fine-grained timer.
** Copyright (c) 1995 by Olin Shivers.
**
** We return the current time in seconds and sub-second "ticks" where the
** number of ticks/second is OS dependent (and is defined in time_dep.scm).
** This definition works on any BSD Unix with the gettimeofday()
** microsecond-resolution timer.
*/
#include <errno.h>
#include <sys/time.h>
#include "scheme48.h"
#include "../time1.h"
/* Sux because it's dependent on 32-bitness. */
#define hi8(i) (((i)>>24) & 0xff)
#define lo24(i) ((i) & 0xffffff)
#define comp8_24(hi, lo) (((hi)<<24) + (lo))
scheme_value time_plus_ticks(int *hi_secs, int *lo_secs,
int *hi_ticks, int *lo_ticks)
{
struct timeval t;
struct timezone tz;
if( gettimeofday(&t, &tz) ) return ENTER_FIXNUM(errno);
{ long int secs = t.tv_sec;
long int ticks = t.tv_usec;
*hi_secs = hi8(secs);
*lo_secs = lo24(secs);
*hi_ticks = hi8(ticks);
*lo_ticks = lo24(ticks);
}
return SCHFALSE;
}

View File

@ -0,0 +1,212 @@
;;; Constant definitions for tty control code (POSIX termios).
;;; Copyright (c) 1999 by Brian Carlstrom.
;;; Special Control Characters
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; Indices into the c_cc[] character array.
;;; Name Subscript Enabled by
;;; ---- --------- ----------
;;; POSIX
(define ttychar/eof 4) ; ^d icanon
(define ttychar/eol 2) ; icanon
(define ttychar/delete-char 5) ; ^? icanon
(define ttychar/delete-line 7) ; ^u icanon
(define ttychar/interrupt 6) ; ^c isig
(define ttychar/quit 10) ; ^\ isig
(define ttychar/suspend 14) ; ^z isig
(define ttychar/start 12) ; ^q ixon, ixoff
(define ttychar/stop 13) ; ^s ixon, ixoff
(define ttychar/min 9) ; !icanon ; Not exported
(define ttychar/time 16) ; !icanon ; Not exported
;;; SVR4 & 4.3+BSD
(define ttychar/eol2 3) ; icanon
(define ttychar/delete-word 17) ; ^w icanon
(define ttychar/reprint 11) ; ^r icanon
(define ttychar/delayed-suspend #f) ; ^y isig
(define ttychar/literal-next 8) ; ^v iexten
(define ttychar/discard 1) ; ^o iexten
;;; 4.3+BSD
(define ttychar/status #f) ; ^t icanon
;;; Cygwin32
(define ttychar/swtc 15) ; ???
;;; Length of control-char string -- *Not Exported*
(define num-ttychars 18)
;;; Magic "disable feature" tty character
(define disable-tty-char (ascii->char #xff)) ; _POSIX_VDISABLE
;;; Flags controllling input processing
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; POSIX
(define ttyin/ignore-break #o00001) ; ignbrk
(define ttyin/interrupt-on-break #o00002) ; brkint
(define ttyin/ignore-bad-parity-chars #o00004) ; ignpar
(define ttyin/mark-parity-errors #o200000) ; parmrk
(define ttyin/check-parity #o00020) ; inpck
(define ttyin/7bits #o00040) ; istrip
(define ttyin/nl->cr #o00100) ; inlcr
(define ttyin/ignore-cr #o00200) ; igncr
(define ttyin/cr->nl #o00400) ; icrnl
(define ttyin/output-flow-ctl #o02000) ; ixon
(define ttyin/input-flow-ctl #o10000) ; ixoff
;;; SVR4 & 4.3+BSD
(define ttyin/xon-any #o100000) ; ixany: Any char restarts after stop
(define ttyin/beep-on-overflow #o00010) ; imaxbel: queue full => ring bell
;;; SVR4
(define ttyin/lowercase #o40000) ; iuclc: Map upper-case to lower case
;;; Flags controlling output processing
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; POSIX
(define ttyout/enable #o0001) ; opost: enable output processing
;;; SVR4 & 4.3+BSD
(define ttyout/nl->crnl #o0010) ; onlcr: map nl to cr-nl
;;; 4.3+BSD
(define ttyout/discard-eot #f) ; onoeot
(define ttyout/expand-tabs #f) ; oxtabs (NOT xtabs)
;;; SVR4
(define ttyout/cr->nl #o0004) ; ocrnl
(define ttyout/fill-w/del #o100000) ; ofdel
(define ttyout/delay-w/fill-char #o0100) ; ofill
(define ttyout/uppercase #o0002) ; olcuc
(define ttyout/nl-does-cr #o0040) ; onlret
(define ttyout/no-col0-cr #o0020) ; onocr
;;; Newline delay
(define ttyout/nl-delay #o1000) ; mask (nldly)
(define ttyout/nl-delay0 #o0000)
(define ttyout/nl-delay1 #o1000) ; tty 37
;;; Horizontal-tab delay
(define ttyout/tab-delay #o14000) ; mask (tabdly)
(define ttyout/tab-delay0 #o00000)
(define ttyout/tab-delay1 #o04000) ; tty 37
(define ttyout/tab-delay2 #o01000)
(define ttyout/tab-delayx #o14000) ; Expand tabs (xtabs, tab3)
;;; Carriage-return delay
(define ttyout/cr-delay #o600) ; mask (crdly)
(define ttyout/cr-delay0 #o000)
(define ttyout/cr-delay1 #o200) ; tn 300
(define ttyout/cr-delay2 #o400) ; tty 37
(define ttyout/cr-delay3 #o600) ; concept 100
;;; Vertical tab delay
(define ttyout/vtab-delay #o20000) ; mask (vtdly)
(define ttyout/vtab-delay0 #o00000)
(define ttyout/vtab-delay1 #o20000) ; tty 37
;;; Backspace delay
(define ttyout/bs-delay #o2000) ; mask (bsdly)
(define ttyout/bs-delay0 #o0000)
(define ttyout/bs-delay1 #o2000)
;;; Form-feed delay
(define ttyout/ff-delay #o40000) ; mask (ffdly)
(define ttyout/ff-delay0 #o00000)
(define ttyout/ff-delay1 #o40000)
(define ttyout/all-delay #f)
;;; Control flags - hacking the serial-line.
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; POSIX
(define ttyc/char-size #o00060) ; csize: character size mask
(define ttyc/char-size5 #o00000) ; 5 bits (cs5)
(define ttyc/char-size6 #o00020) ; 6 bits (cs6)
(define ttyc/char-size7 #o00040) ; 7 bits (cs7)
(define ttyc/char-size8 #o00060) ; 8 bits (cs8)
(define ttyc/2-stop-bits #o00100) ; cstopb: Send 2 stop bits.
(define ttyc/enable-read #o00200) ; cread: Enable receiver.
(define ttyc/enable-parity #o00400) ; parenb
(define ttyc/odd-parity #o01000) ; parodd
(define ttyc/hup-on-close #o02000) ; hupcl: Hang up on last close.
(define ttyc/no-modem-sync #o04000) ; clocal: Ignore modem lines.
;;; 4.3+BSD
(define ttyc/ignore-flags #f) ; cignore: ignore control flags
(define ttyc/CTS-output-flow-ctl #f) ; ccts_oflow: CTS flow control of output
(define ttyc/RTS-input-flow-ctl #f) ; crts_iflow: RTS flow control of input
(define ttyc/carrier-flow-ctl #f) ; mdmbuf
;;; Local flags -- hacking the tty driver / user interface.
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; POSIX
(define ttyl/visual-delete #x0008) ; echoe: Visually erase chars
(define ttyl/echo-delete-line #x0010) ; echok: Echo nl after line kill
(define ttyl/echo #x0004) ; echo: Enable echoing
(define ttyl/echo-nl #x0020) ; echonl: Echo nl even if echo is off
(define ttyl/canonical #x0002) ; icanon: Canonicalize input
(define ttyl/enable-signals #x0001) ; isig: Enable ^c, ^z signalling
(define ttyl/extended #x0100) ; iexten: Enable extensions
(define ttyl/ttou-signal #x0080) ; tostop: SIGTTOU on background output
(define ttyl/no-flush-on-interrupt #x0040) ; noflsh
;;; SVR4 & 4.3+BSD
(define ttyl/visual-delete-line #x0400); echoke: visually erase a line-kill
(define ttyl/hardcopy-delete #f); echoprt: visual erase for hardcopy
(define ttyl/echo-ctl #x0800); echoctl: echo control chars as "^X"
(define ttyl/flush-output #x0200); flusho: output is being flushed
(define ttyl/reprint-unread-chars #f); pendin: retype pending input
;;; 4.3+BSD
(define ttyl/alt-delete-word #f) ; altwerase
(define ttyl/no-kernel-status #f) ; nokerninfo: no kernel status on ^T
;;; SVR4
(define ttyl/case-map #f) ; xcase: canonical upper/lower presentation
;;; Vector of (speed . code) pairs.
(define baud-rates '#((0 . 0) (1 . 50) (2 . 75)
(3 . 110) (4 . 134) (5 . 150)
(6 . 200) (7 . 300) (8 . 600)
(9 . 1200) (10 . 1800) (11 . 2400)
(12 . 4800) (13 . 9600) (14 . 19200)
(15 . 38400) (16 . 57600) (17 .115200)))
;;; tcflush() constants
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(define %flush-tty/input 0) ; TCIFLUSH
(define %flush-tty/output 1) ; TCOFLUSH
(define %flush-tty/both 2) ; TCIOFLUSH
(define %flush-tty/flush 3) ; TCFLSH
;;; tcflow() constants
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(define %tcflow/stop-out 0) ; TCOOFF
(define %tcflow/start-out 1) ; TCOON
(define %tcflow/stop-in 2) ; TCIOFF
(define %tcflow/start-in 3) ; TCION
;;; tcsetattr() constants
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(define %set-tty-info/flush 1) ; TCSAFLUSH Drain output, flush input.
(define %set-tty-info/now 2) ; TCSANOW Make change immediately.
(define %set-tty-info/drain 3) ; TCSADRAIN Drain output, then change.
(define %set-tty-info/dflush 4) ; TCSADFLUSH

View File

@ -0,0 +1,41 @@
;;; Scsh routines for analysing exit codes returned by WAIT.
;;; Copyright (c) 1994 by Olin Shivers.
;;; Copyright (c) 1999 by Brian D. Carlstrom.
;;;
;;; To port these to a new OS, consult /usr/include/sys/wait.h,
;;; and check the WIFEXITED, WEXITSTATUS, WIFSTOPPED, WSTOPSIG,
;;; WIFSIGNALED, and WTERMSIG macros for the magic fields they use.
;;; These definitions are for Cygwin32
;;;
;;; I could have done a portable version by making C calls for this,
;;; but it's such overkill.
;;; If process terminated normally, return the exit code, otw #f.
(define (status:exit-val status)
(and (zero? (bitwise-and #x7F status))
(arithmetic-shift status -8)))
;;; If the process was suspended, return the suspending signal, otw #f.
(define (status:stop-sig status)
(and (= #x7F (bitwise-and status #x7F))
(arithmetic-shift status -8)))
;;; If the process terminated abnormally,
;;; return the terminating signal, otw #f.
(define (status:term-sig status)
(let ((termsig (bitwise-and status #x7F)))
(and (not (zero? termsig)) ; Didn't exit.
(not (= #x7F)) ; Not suspended.
termsig)))
;;; Flags.
(define wait/poll 1) ; Don't hang if nothing to wait for.
(define wait/stopped-children 2) ; Report on suspended subprocs, too.

View File

@ -2,6 +2,7 @@
** automatically generated by cig.
*/
#include <errno.h>
#include <stdio.h>
#include <stdlib.h> /* For malloc. */
#include "libcig.h"
@ -10,8 +11,6 @@
#include <limits.h>
#include "/usr/local/include/db.h"
extern int errno;
#define errno_or_false(x) (((x) == -1) ? ENTER_FIXNUM(errno) : SCHFALSE)
scheme_value df_db_open(long nargs, scheme_value *args)

View File

@ -71,11 +71,10 @@
(foreign-source
"#include <sys/types.h>"
"#include <errno.h>"
"#include <limits.h>"
"#include \"/usr/local/include/db.h\""
""
"extern int errno;"
""
"#define errno_or_false(x) (((x) == -1) ? ENTER_FIXNUM(errno) : SCHFALSE)"
"" "")

View File

@ -2,6 +2,7 @@
** automatically generated by cig.
*/
#include <errno.h>
#include <stdio.h>
#include <stdlib.h> /* For malloc. */
#include "libcig.h"
@ -11,8 +12,6 @@
#include <ndbm.h>
#include <db.h>
extern int errno;
#define errno_or_false(x) (((x) == -1) ? ENTER_FIXNUM(errno) : SCHFALSE)
scheme_value df_db_check(long nargs, scheme_value *args)

View File

@ -89,12 +89,11 @@
(foreign-source
"#include <sys/types.h>"
"#include <errno.h>"
"#include <limits.h>"
"#include <ndbm.h>"
"#include <db.h>"
""
"extern int errno;"
""
"#define errno_or_false(x) (((x) == -1) ? ENTER_FIXNUM(errno) : SCHFALSE)"
"" "")

View File

@ -5,14 +5,13 @@
/* Common dbm access routines */
#include <errno.h>
#include <stdio.h>
#include <errno.h>
#include <ndbm.h>
#include "cstuff.h"
extern int errno;
int database_delete(DBM *db, scheme_value key)
{
datum work_key;

View File

@ -5,6 +5,7 @@
#include <sys/types.h>
#include <stdio.h>
#include <dirent.h>
#include <errno.h>
#include <stdlib.h>
#include <string.h>
@ -14,8 +15,6 @@
/* Make sure our exports match up w/the implementation: */
#include "dirstuff1.h"
extern int errno;
/* Linked list of malloc'd entries. */
struct scm_dirent_struct
{ char *fname; /* File name */

View File

@ -21,6 +21,7 @@
*/
#include "sysdep.h"
#include <stdio.h>
#include <errno.h>
#include <fcntl.h>
#include <unistd.h>
#include <stdlib.h>
@ -33,8 +34,6 @@
/* Make sure our exports match up w/the implementation: */
#include "fdports1.h"
extern int errno;
/* Maps fd's to FILE*'s. */
static FILE *fstar_cache[NUM_FDPORTS] = {NULL};

View File

@ -8,10 +8,9 @@
#include <sys/types.h>
#include <unistd.h>
#include <errno.h>
#include <fcntl.h>
extern int errno;
/* Make sure foreign-function stubs interface to the C funs correctly: */
#include "flock1.h"

View File

@ -11,10 +11,9 @@
(foreign-source
"#include <sys/types.h>"
"#include <unistd.h>"
"#include <errno.h>"
"#include <fcntl.h>"
""
"extern int errno;"
""
"/* Make sure foreign-function stubs interface to the C funs correctly: */"
"#include \"flock1.h\""
""

View File

@ -1,12 +1,11 @@
/* This code is all obsolete & should be thrown away. 8/23/96 Olin. */
#include <errno.h>
#include <unistd.h>
#include <sys/types.h>
#include <signal.h>
#include "cstuff.h"
extern int errno;
/* Hack the blocked-signal mask.
*******************************************************************************
*/

View File

@ -2,6 +2,7 @@
** automatically generated by cig.
*/
#include <errno.h>
#include <stdio.h>
#include <stdlib.h> /* For malloc. */
#include "libcig.h"
@ -10,8 +11,6 @@
#include <sys/types.h>
#include <unistd.h>
extern int errno;
#define errno_or_false(x) (((x) == -1) ? ENTER_FIXNUM(errno) : SCHFALSE)
scheme_value df_set_procmask(long nargs, scheme_value *args)

View File

@ -6,8 +6,7 @@
"#include <sys/signal.h>"
"#include <sys/types.h>"
"#include <unistd.h>"
""
"extern int errno;"
"#include <errno.h>"
""
"#define errno_or_false(x) (((x) == -1) ? ENTER_FIXNUM(errno) : SCHFALSE)"
"" "")

View File

@ -7,133 +7,120 @@
(define errno/2big 7) ; 2big is not a legit Scheme symbol. Lose, lose.
(define-enum-constants errno
;; POSIX:
(perm 1 ); Operation Not Permitted
(noent 2 ); No Such File Or Directory
(srch 3 ); No Such Process
(intr 4 ); Interrupted System Call
(io 5 ); I/O Error
(nxio 6 ); No Such Device Or Address
(2big 7 ); Arg List Too Long
(noexec 8 ); Exec Format Error
(badf 9 ); Bad File Number
(child 10 ); No Child Processes
(again 11 ); Try Again
(nomem 12 ); Out Of Memory
(acces 13 ); Permission Denied
(fault 14 ); Bad Address
(notblk 15 ); Block Device Required
(busy 16 ); Device Or Resource Busy
(exist 17 ); File Exists
(xdev 18 ); Cross-Device Link
(nodev 19 ); No Such Device
(notdir 20 ); Not A Directory
(isdir 21 ); Is A Directory
(inval 22 ); Invalid Argument
(nfile 23 ); File Table Overflow
(mfile 24 ); Too Many Open Files
(notty 25 ); Not A Typewriter
(txtbsy 26 ); Text File Busy
(fbig 27 ); File Too Large
(nospc 28 ); No Space Left On Device
(spipe 29 ); Illegal Seek
(rofs 30 ); Read-Only File System
(mlink 31 ); Too Many Links
(pipe 32 ); Broken Pipe
(dom 33 ); Math Argument Out Of Domain Of Func
(range 34 ); Math Result Not Representable
(deadlk 35 ); Resource Deadlock Would Occur
(nametoolong 36 ); File Name Too Long
(nolck 37 ); No Record Locks Available
(nosys 38 ); Function Not Implemented
(notempty 39 ); Directory Not Empty
(loop 40 ); Too Many Symbolic Links Encountered
(wouldblock 11 ); Operation Would Block
(nomsg 42 ); No Message Of Desired Type
(idrm 43 ); Identifier Removed
(chrng 44 ); Channel Number Out Of Range
(l2nsync 45 ); Level 2 Not Synchronized
(l3hlt 46 ); Level 3 Halted
(l3rst 47 ); Level 3 Reset
(lnrng 48 ); Link Number Out Of Range
(unatch 49 ); Protocol Driver Not Attached
(nocsi 50 ); No Csi Structure Available
(l2hlt 51 ); Level 2 Halted
(bade 52 ); Invalid Exchange
(badr 53 ); Invalid Request Descriptor
(xfull 54 ); Exchange Full
(noano 55 ); No Anode
(badrqc 56 ); Invalid Request Code
(badslt 57 ); Invalid Slot
(deadlock 58 ); File Locking Deadlock Error
(bfont 59 ); Bad Font File Format
(nostr 60 ); Device Not A Stream
(nodata 61 ); No Data Available
(time 62 ); Timer Expired
(nosr 63 ); Out Of Streams Resources
(nonet 64 ); Machine Is Not On The Network
(nopkg 65 ); Package Not Installed
(remote 66 ); Object Is Remote
(nolink 67 ); Link Has Been Severed
(adv 68 ); Advertise Error
(srmnt 69 ); Srmount Error
(comm 70 ); Communication Error On Send
(proto 71 ); Protocol Error
(multihop 72 ); Multihop Attempted
(dotdot 73 ); Rfs Specific Error
(badmsg 74 ); Not A Data Message
(overflow 75 ); Value Too Large For Defined Data Type
(notuniq 76 ); Name Not Unique On Network
(badfd 77 ); File Descriptor In Bad State
(remchg 78 ); Remote Address Changed
(libacc 79 ); Can Not Access A Needed Shared Library
(libbad 80 ); Accessing A Corrupted Shared Library
(libscn 81 ); .Lib Section In A.Out Corrupted
(libmax 82 ); Attempting To Link In Too Many Shared Libraries
(libexec 83 ); Cannot Exec A Shared Library Directly
(ilseq 84 ); Illegal Byte Sequence
(restart 85 ); Interrupted System Call Should Be Restarted
(strpipe 86 ); Streams Pipe Error
(users 87 ); Too Many Users
(notsock 88 ); Socket Operation On Non-Socket
(destaddrreq 89 ); Destination Address Required
(msgsize 90 ); Message Too Long
(prototype 91 ); Protocol Wrong Type For Socket
(noprotoopt 92 ); Protocol Not Available
(protonosupport 93 ); Protocol Not Supported
(socktnosupport 94 ); Socket Type Not Supported
(opnotsupp 95 ); Operation Not Supported On Transport Endpoint
(pfnosupport 96 ); Protocol Family Not Supported
(afnosupport 97 ); Address Family Not Supported By Protocol
(addrinuse 98 ); Address Already In Use
(addrnotavail 99 ); Cannot Assign Requested Address
(netdown 100 ); Network Is Down
(netunreach 101 ); Network Is Unreachable
(netreset 102 ); Network Dropped Connection Because Of Reset
(connaborted 103 ); Software Caused Connection Abort
(connreset 104 ); Connection Reset By Peer
(nobufs 105 ); No Buffer Space Available
(isconn 106 ); Transport Endpoint Is Already Connected
(notconn 107 ); Transport Endpoint Is Not Connected
(shutdown 108 ); Cannot Send After Transport Endpoint Shutdown
(toomanyrefs 109 ); Too Many References: Cannot Splice
(timedout 110 ); Connection Timed Out
(connrefused 111 ); Connection Refused
(hostdown 112 ); Host Is Down
(hostunreach 113 ); No Route To Host
(already 114 ); Operation Already In Progress
(inprogress 115 ); Operation Now In Progress
(stale 116 ); Stale Nfs File Handle
(uclean 117 ); Structure Needs Cleaning
(notnam 118 ); Not A Xenix Named Type File
(navail 119 ); No Xenix Semaphores Available
(isnam 120 ); Is A Named Type File
(remoteio 121 ); Remote I/O Error
(dquot 122 ); Quota Exceeded
; Should Never Be Seen By User Programs
(restartsys 512)
(restartnointr 513)
(restartnohand 514) ; Restart If No Handler..
(noioctlcmd 515)) ; No Ioctl Command
(perm 1) ; Not super-user
(noent 2) ; No such file or directory
(srch 3) ; No such process
(intr 4) ; Interrupted system call
(io 5) ; I/O error
(nxio 6) ; No such device or address
(2big 7) ; Arg list too long
(noexec 8) ; Exec format error
(badf 9) ; Bad file number
(child 10) ; No children
(again 11) ; No more processes
(wouldblock 11) ; EAGAIN again
(nomem 12) ; Not enough core
(acces 13) ; Permission denied
(fault 14) ; Bad address
(notblk 15) ; Block device required
(busy 16) ; Mount device busy
(exist 17) ; File exists
(xdev 18) ; Cross-device link
(nodev 19) ; No such device
(notdir 20) ; Not a directory
(isdir 21) ; Is a directory
(inval 22) ; Invalid argument
(nfile 23) ; Too many open files in system
(mfile 24) ; Too many open files
(notty 25) ; Not a typewriter
(txtbsy 26) ; Text file busy
(fbig 27) ; File too large
(nospc 28) ; No space left on device
(spipe 29) ; Illegal seek
(rofs 30) ; Read only file system
(mlink 31) ; Too many links
(pipe 32) ; Broken pipe
(dom 33) ; Math arg out of domain of func
(range 34) ; Math result not representable
(nomsg 35) ; No message of desired type
(idrm 36) ; Identifier removed
(chrng 37) ; Channel number out of range
(l2nsync 38) ; Level 2 not synchronized
(l3hlt 39) ; Level 3 halted
(l3rst 40) ; Level 3 reset
(lnrng 41) ; Link number out of range
(unatch 42) ; Protocol driver not attached
(nocsi 43) ; No CSI structure available
(l2hlt 44) ; Level 2 halted
(deadlk 45) ; Deadlock condition
(nolck 46) ; No record locks available
(bade 50) ; Invalid exchange
(badr 51) ; Invalid request descriptor
(xfull 52) ; Exchange full
(noano 53) ; No anode
(badrqc 54) ; Invalid request code
(badslt 55) ; Invalid slot
(deadlock 56) ; File locking deadlock error
(bfont 57) ; Bad font file fmt
(nostr 60) ; Device not a stream
(nodata 61) ; No data (for no delay io)
(time 62) ; Timer expired
(nosr 63) ; Out of streams resources
(nonet 64) ; Machine is not on the network
(nopkg 65) ; Package not installed
(remote 66) ; The object is remote
(nolink 67) ; The link has been severed
(adv 68) ; Advertise error
(srmnt 69) ; Srmount error
(comm 70) ; Communication error on send
(proto 71) ; Protocol error
(multihop 74) ; Multihop attempted
(lbin 75) ; Inode is remote (not really error)
(dotdot 76) ; Cross mount point (not really error)
(badmsg 77) ; Trying to read unreadable message
(notuniq 80) ; Given log. name not unique
(badfd 81) ; f.d. invalid for this operation
(remchg 82) ; Remote address changed
(libacc 83) ; Can't access a needed shared lib
(libbad 84) ; Accessing a corrupted shared lib
(libscn 85) ; .lib section in a.out corrupted
(libmax 86) ; Attempting to link in too many libs
(libexec 87) ; Attempting to exec a shared library
(nosys 88) ; Function not implemented
(nmfile 89) ; No more files
(notempty 90) ; Directory not empty
(nametoolong 91) ; File or path name too long
(loop 92) ; Too many symbolic links
(opnotsupp 95) ; Operation not supported on transport endpoint
(pfnosupport 96) ; Protocol family not supported
(connreset 104) ; Connection reset by peer
(nobufs 105) ; No buffer space available
(afnosupport 106) ;
(prototype 107) ;
(notsock 108) ;
(noprotoopt 109) ;
(shutdown 110) ;
(connrefused 111) ; Connection refused
(addrinuse 112) ; Address already in use
(connaborted 113) ; Connection aborted
(netunreach 114) ;
(netdown 115) ;
(timedout 116) ;
(hostdown 117) ;
(hostunreach 118) ;
(inprogress 119) ;
(already 120) ;
(destaddrreq 121) ;
(msgsize 122) ;
(protonosupport 123) ;
(socktnosupport 124) ;
(addrnotavail 125) ;
(netreset 126) ;
(isconn 127) ;
(notconn 128) ;
(toomanyrefs 129) ;
(proclim 130) ;
(users 131) ;
(dquot 132) ;
(stale 133) ;
(notsup 134)) ;

View File

@ -1 +1 @@
5.1
5.2

View File

@ -2,14 +2,13 @@
** automatically generated by cig.
*/
#include <errno.h>
#include <stdio.h>
#include <stdlib.h> /* For malloc. */
#include "libcig.h"
#include <ndbm.h>
extern int errno;
#define errno_or_false(x) (((x) == -1) ? ENTER_FIXNUM(errno) : SCHFALSE)
/* stub used to return FALSE when scheme checks for Berkeley dbm */

View File

@ -66,10 +66,9 @@
;;; Scheme48 implementation.
(foreign-source
"#include <errno.h>"
"#include <ndbm.h>"
""
"extern int errno;"
""
"#define errno_or_false(x) (((x) == -1) ? ENTER_FIXNUM(errno) : SCHFALSE)"
"" "")

View File

@ -11,8 +11,6 @@
#include "cstuff.h"
extern int errno;
int database_close (DBM *db)
{
dbm_close(db);

View File

@ -11,8 +11,6 @@
#include "cstuff.h"
extern int errno;
/* stub used to return FALSE when scheme checks for Berkeley dbm */
int db_check()
{

View File

@ -8,11 +8,11 @@
#include <sys/types.h>
#include <sys/socket.h>
#include <errno.h>
/* Make sure foreign-function stubs interface to the C funs correctly: */
#include "network1.h"
extern int errno;
extern int h_errno;
#define errno_on_zero_or_false(x) ((x) ? SCHFALSE : ENTER_FIXNUM(errno))

View File

@ -7,11 +7,11 @@
(foreign-source
"#include <sys/types.h>"
"#include <sys/socket.h>"
"#include <errno.h>"
""
"/* Make sure foreign-function stubs interface to the C funs correctly: */"
"#include \"network1.h\""
""
"extern int errno;"
"extern int h_errno;"
""
"#define errno_on_zero_or_false(x) ((x) ? SCHFALSE : ENTER_FIXNUM(errno))"

View File

@ -9,7 +9,9 @@
#include <sys/types.h>
#include <sys/time.h>
#include <sys/socket.h>
#ifdef HAVE_SYS_UN_H
#include <sys/un.h>
#endif
#include <errno.h>
#include <netdb.h>
#include <netinet/in.h>
@ -33,6 +35,7 @@ int scheme_bind(int sockfd, int family, scheme_value scheme_name)
{
switch(family)
{
#ifdef HAVE_SYS_UN_H
case AF_UNIX:
{
struct sockaddr_un name;
@ -48,6 +51,7 @@ int scheme_bind(int sockfd, int family, scheme_value scheme_name)
return(bind(sockfd,(struct sockaddr *)&name,sizeof(name)));
break;
}
#endif
case AF_INET:
{
struct sockaddr_in name;
@ -70,6 +74,7 @@ int scheme_connect(int sockfd, int family, scheme_value scheme_name)
{
switch(family)
{
#ifdef HAVE_SYS_UN_H
case AF_UNIX:
{
struct sockaddr_un name;
@ -85,6 +90,7 @@ int scheme_connect(int sockfd, int family, scheme_value scheme_name)
return(connect(sockfd,(struct sockaddr *)&name,sizeof(name)));
break;
}
#endif
case AF_INET:
{
struct sockaddr_in name;
@ -111,6 +117,7 @@ int scheme_accept(int sockfd, int family, scheme_value scheme_name)
{
switch(family)
{
#ifdef HAVE_SYS_UN_H
case AF_UNIX:
{
struct sockaddr_un name;
@ -123,7 +130,8 @@ int scheme_accept(int sockfd, int family, scheme_value scheme_name)
return(newsockfd);
break;
}
case AF_INET:
#endif
case AF_INET:
{
struct sockaddr_in name;
int namelen=sizeof(name);
@ -254,6 +262,7 @@ int send_substring(int s,
{
return send(s, StrByte(buf,start), end-start, flags);
}
#ifdef HAVE_SYS_UN_H
case AF_UNIX:
{
struct sockaddr_un name;
@ -272,7 +281,8 @@ int send_substring(int s,
(struct sockaddr *)&name, sizeof(name)));
break;
}
case AF_INET:
#endif
case AF_INET:
{
struct sockaddr_in name;
u_long addr=GET_LONG(scheme_name,0);

View File

@ -12,7 +12,7 @@
(define scsh-major-version 0)
(define scsh-minor-version 5)
(define scsh-version-string "0.5.1")
(define scsh-version-string "0.5.2")
;;; A scsh starter takes the command line args, parses them,
;;; initialises the scsh system, and either starts up a repl loop

View File

@ -17,6 +17,7 @@
"EOF inside block comment -- #! missing a closing !#")
(lp (cond ((char=? c look-for) (+ state 1))
((char=? c #\newline) 1)
((char=? c cr) state)
(else 0))))))))
(case state
((0) (advance-if #\newline))

View File

@ -1,3 +1,3 @@
(define scsh-major-version 0)
(define scsh-minor-version 5)
(define scsh-version-string "0.5.1")
(define scsh-version-string "0.5.2")

View File

@ -24,7 +24,6 @@
/* the traditional sleazy max non-function. */
#define max(a,b) (((a) > (b)) ? (a) : (b))
extern int errno;
extern FILE *fdes2fstar(int fd);
static void or2_fdset(fd_set *x, fd_set *y, int max_elt);

View File

@ -6,7 +6,7 @@
#include <stdlib.h> /* For malloc. */
#include "libcig.h"
extern int errno;
#include <errno.h>
/* Make sure foreign-function stubs interface to the C funs correctly: */
#include "sighandlers1.h"

View File

@ -31,7 +31,7 @@
;;; Must define WITH-INTERRUPTS* and WITH-INTERRUPTS.
(foreign-source
"extern int errno;"
"#include <errno.h>"
""
"/* Make sure foreign-function stubs interface to the C funs correctly: */"
"#include \"sighandlers1.h\""

View File

@ -3,6 +3,7 @@
** operate.
*/
#include <errno.h>
#include <unistd.h>
#include <sys/types.h>
#include <signal.h>
@ -17,8 +18,6 @@
*/
#include "signals1.h"
extern int errno;
extern scheme_value Spending_interruptsS, Sinterrupt_handlersS;
/* Translate Unix signal numbers to S48 interrupt numbers. */

View File

@ -12,6 +12,7 @@
#include <sys/time.h>
#include <fcntl.h> /* for O_RDWR */
#include <sys/stat.h>
#include <errno.h>
#include <netdb.h>
#include <pwd.h>
#include <unistd.h>
@ -23,8 +24,6 @@
#include "syscalls1.h"
#include "userinfo1.h"
extern int errno;
#define errno_on_zero_or_false(x) ((x) ? SCHFALSE : ENTER_FIXNUM(errno))
#define errno_or_false(x) (((x) == -1) ? ENTER_FIXNUM(errno) : SCHFALSE)
#define False_on_zero(x) ((x) ? ENTER_FIXNUM(x) : SCHFALSE)
@ -368,7 +367,7 @@ scheme_value df_chown(long nargs, scheme_value *args)
scheme_value df_fchown(long nargs, scheme_value *args)
{
extern int fchown(int , uid_t , gid_t );
scheme_value ret1;
int r1;

View File

@ -12,6 +12,7 @@
"#include <sys/time.h>"
"#include <fcntl.h> /* for O_RDWR */" ; ???
"#include <sys/stat.h>"
"#include <errno.h>"
"#include <netdb.h>"
"#include <pwd.h>"
"#include <unistd.h>"
@ -23,8 +24,6 @@
"#include \"syscalls1.h\""
"#include \"userinfo1.h\""
""
"extern int errno;"
""
"#define errno_on_zero_or_false(x) ((x) ? SCHFALSE : ENTER_FIXNUM(errno))"
"#define errno_or_false(x) (((x) == -1) ? ENTER_FIXNUM(errno) : SCHFALSE)"
"#define False_on_zero(x) ((x) ? ENTER_FIXNUM(x) : SCHFALSE)" ; Not a function.
@ -301,7 +300,7 @@
(to-scheme integer errno_or_false))
(define-foreign set-fdes-uid&gid/errno
(fchown (integer fd) (uid_t uid) (gid_t gid))
(fchown (integer fd) (uid_t uid) (gid_t gid)) no-declare ; for NT Cygwin
(to-scheme integer errno_or_false))
(define-errno-syscall (set-file-owner thing uid)

View File

@ -38,7 +38,6 @@
/* Make sure our exports match up w/the implementation: */
#include "syscalls1.h"
extern int errno;
extern char **environ;
/* Sux because it's dependent on 32-bitness. */

View File

@ -9,13 +9,12 @@
#include <sys/types.h>
#include <unistd.h>
#include <errno.h>
#include <termios.h>
/* Make sure foreign-function stubs interface to the C funs correctly: */
#include "tty1.h"
extern int errno;
#define errno_or_false(x) (((x) == -1) ? ENTER_FIXNUM(errno) : SCHFALSE)
#define errno_on_zero_or_false(x) ((x) ? SCHFALSE : ENTER_FIXNUM(errno))
scheme_value df_scheme_tcgetattr(long nargs, scheme_value *args)

View File

@ -17,13 +17,12 @@
"#include <sys/types.h>"
""
"#include <unistd.h>"
"#include <errno.h>"
"#include <termios.h>"
""
"/* Make sure foreign-function stubs interface to the C funs correctly: */"
"#include \"tty1.h\""
""
"extern int errno;"
""
"#define errno_or_false(x) (((x) == -1) ? ENTER_FIXNUM(errno) : SCHFALSE)"
"#define errno_on_zero_or_false(x) ((x) ? SCHFALSE : ENTER_FIXNUM(errno))"
"" )

View File

@ -11,6 +11,7 @@
* Re-written by Olin.
*/
#include <errno.h>
#include <unistd.h>
#include <stdio.h> /* ctermid decl */
#include <termios.h>
@ -26,8 +27,6 @@
#include "tty1.h" /* Make sure the .h interface agrees with the code. */
extern int errno;
/*****************************************************************************/
int scheme_tcgetattr(int fd, char *control_chars,

View File

@ -83,6 +83,9 @@
/* Define if fd_set and friends need sys/select.h */
#undef HAVE_SYS_SELECT_H
/* Define if we have Unix IPC domains support for sockets */
#undef HAVE_SYS_UN_H
#if !defined(HAVE_SIGACTION)
struct sigaction {
void (*sa_handler)();

5
unix.c
View File

@ -195,11 +195,10 @@ char_ready_p( FILE* stream )
#elif defined(__linux__)
if (stream->_IO_read_ptr < stream->_IO_read_end)
return 1;
#elif defined(BSD) && (BSD >= 199306)
#elif (defined(BSD) && (BSD >= 199306)) || defined(__CYGWIN32__)
if (stream->_r)
return 1;
#else
/* Add new cases here AND SEND THEM TO scheme-48@martigny.ai.mit.edu
SO THAT THEY CAN GO INTO THE NEXT RELEASE! (That means you, Olin.)
It's generally pretty easy to figure out what to put here by
@ -217,7 +216,9 @@ char_ready_p( FILE* stream )
{ fd_set readfds;
FD_ZERO(&readfds);
FD_SET(fileno(stream), &readfds);
#ifndef __CYGWIN32__
timerclear(&timeout);
#endif
return select1(FD_SETSIZE, &readfds, NULL, NULL, &timeout);
}
#else /* No select() - but there will generally be some other way to do this.*/