Synthetic commit for incomplete tag R0_4_3

This commit is contained in:
cvs-fast-export 1996-11-01 08:15:40 +00:00
parent 988940561b
commit 6d4e57f490
269 changed files with 0 additions and 30220 deletions

View File

@ -1,8 +0,0 @@
AIX_P = exportlist.aix
exportlist.aix: $(OBJS)
$(RM) exportlist.aix
for f in $(OBJS); do \
/usr/ccs/bin/nm -B -e $$f | grep ' T [^ ][^ ]*$$' | \
sed -e 's/^.* T \.*\([^ ][^ ]*\)$$/\1/' >> exportlist.aix; \
done;

View File

@ -1,12 +0,0 @@
;;; Flags that control buffering policy.
;;; Copyright (c) 1993 by Olin Shivers.
;;; 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 #o100) ; _IOLBF
(none 4)) ; _IONBF

View File

@ -1,140 +0,0 @@
;;; Errno constant definitions.
;;; Copyright (c) 1993 by Olin Shivers.
;;; AIX version by Chipsy Sperber
(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 function call
(io 5) ; Input/output error
(nxio 6) ; No such device or address
; (2big 7) ; Arg list too long
(noexec 8) ; Exec format error
(badf 9) ; Bad file descriptor
(child 10) ; No child processes
(again 11) ; Resource temporarily unavailable
(nomem 12) ; Not enough space
(acces 13) ; Permission denied
(fault 14) ; Bad address
(notblk 15) ; Block device required
(busy 16) ; Resource busy
(exist 17) ; File exists
(xdev 18) ; Improper 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) ; Inappropriate I/O control operation
(xtbsy 26) ; Text file busy
(fbig 27) ; File too large
(nospc 28) ; No space left on device
(spipe 29) ; Invalid seek
(rofs 30) ; Read-only file system
(mlink 31) ; Too many links
(pipe 32) ; Broken pipe
;; POSIX:
;; math software
(dom 33) ; Domain error
(range 34) ; Result too large
(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) ; Resource deadlock avoided
(notready 46) ; Device not ready
(wrprotect 47) ; Write-protected media
(format 48) ; Unformatted media
(nolck 49) ; No locks available
;; non-blocking and interrupt i/o
(wouldblock 54) ; Operation would block
(inprogress 55) ; Operation now in progress
(already 56) ; Operation already in progress
;; ipc/network software
(notsock 57) ; Socket operation on non-socket
(destaddrreq 58) ; Destination address required
(msgsize 59) ; Message too long
(prototype 60) ; Protocol wrong type for socket
(noprotoopt 61) ; Protocol not available
(protonosupport 62) ; Protocol not supported
(socktnosupport 63) ; Socket type not supported
(opnotsupp 64) ; Operation not supported on socket
(pfnosupport 65) ; Protocol family not supported
(afnosupport 66) ; Address family not supported by protocol family
(addrinuse 67) ; Address already in use
(addrnotavail 68) ; Can't assign requested address
(netdown 69) ; Network is down
(netunreach 70) ; Network is unreachable
(netreset 71) ; Network dropped connection on reset
(connaborted 72) ; Software caused connection abort
(connreset 73) ; Connection reset by peer
(nobufs 74) ; No buffer space available
(isconn 75) ; Socket is already connected
(notconn 76) ; Socket is not connected
(shutdown 77) ; Can't send after socket shutdown
(timedout 78) ; Connection timed out
(connrefused 79) ; Connection refused
(hostdown 80) ; Host is down
(hostunreach 81) ; No route to host
(restart 82) ; restart the system call
;; quotas and limits
(proclim 83) ; Too many processes
(users 84) ; Too many users
(loop 85) ; Too many levels of symbolic links
(nametoolong 86) ; File name too long
(notempty 87) ; Directory not empty
(dquot 88) ; Disc quota exceeded
;; network file system
(remote 93) ; Item is not local to host
(nosys 109) ; Function not implemented POSIX
;; disk device driver
(media 110) ; media surface error
(soft 111) ; I/O completed, but needs relocation
;; security
(noattr 112) ; no attribute found
(sad 113) ; security authentication denied
(notrust 114) ; not a trusted program
;; BSD 4.3 RENO
(toomanyrefs 115) ; Too many references: can't splice
(ilseq 116) ; Invalid wide character
(canceled 117) ; asynchronous i/o cancelled
;; SVR4 STREAMS
(nosr 118) ; temp out of streams resources
(time 119) ; I_STR ioctl timed out
(badmsg 120) ; wrong message type at stream head
(proto 121) ; STREAMS protocol error
(nodata 122) ; no message ready at stream head
(nostr 123) ; fd is not a stream
(cloneme 82) ; this is the way we clone a stream
)

View File

@ -1,48 +0,0 @@
;;; Flags for open(2) and fcntl(2).
;;; Copyright (c) 1993 by Olin Shivers.
;;; AIX version by Chipsy Sperber
(define-enum-constants open
(read 0)
(write 1)
(read+write 2)
(append 8)
(create #x0100)
(exclusive #x0400)
(no-control-tty #x0800)
(nonblocking #x0004)
(truncate #x0200)
;;; Not POSIX.
(no-delay #x8000)
(sync #x0010))
(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-record-lock 5) ; F_GETLK
(set-record-lock-noblock 6) ; F_SETLK
(set-record-lock 7)) ; F_SETLKW
;;; 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
(write 2) ; F_WRLCK
(release 3)) ; F_UNLCK

View File

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

View File

@ -1,133 +0,0 @@
;;; Magic Numbers for Networking
;;; Copyright (c) 1994 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
;;; 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
(define message/eor #x8) ; data completes record
(define message/trunc #x10) ; data discarded before delivery
(define message/ctrunc #x20) ; control data lost before delivery
(define message/waitall #x40) ; wait for full request or error
;;; 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/use-privileged #x4000) ; allocate from privileged port area
;(define socket/cant-signal #x8000) ; prevent SIGPIPE on SS_CANTSENDMORE
(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 -- <netinet/in.h>
(define ip/options 1) ; set/get IP per-packet options
(define ip/include-header 2) ; int; header is included with data (raw)
(define ip/type-of-service 3) ; int; IP type of service and precedence
(define ip/time-to-live 4) ; int; IP time to live
(define ip/recvopt 5) ; bool; receive all IP options w/datagram
(define ip/recvret 6) ; bool; receive IP options for response
(define ip/recvdst 7) ; bool; receive IP dst addr w/datagram
(define ip/retopts 8) ; ip_opts; set/get IP per-packet options
;;; 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
; socket/use-privileged
; socket/cant-signal
ip/include-header
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
ip/type-of-service
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))

View File

@ -1,143 +0,0 @@
;;; Interfaces and packages for the machine specific parts of scsh.
;;; Copyright (c) 1994 by Olin Shivers.
;;; Copyright (c) 1994 by Brian D. Carlstrom.
;;; AIX version by Chipsy Sperber
(define-interface aix-fdflags-extras-interface
(export open/no-delay
open/sync))
(define-interface aix-errno-extras-interface
(export errno/nomsg
errno/idrm
errno/chrng
errno/l2nsync
errno/l3hlt
errno/l3rst
errno/lnrng
errno/unatch
errno/nocsi
errno/l2hlt
errno/notready
errno/wrprotect
errno/format
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/timedout
errno/connrefused
errno/hostdown
errno/hostunreach
errno/restart
errno/proclim
errno/users
errno/loop
errno/dquot
errno/remote
errno/media
errno/soft
errno/noattr
errno/sad
errno/notrust
errno/toomanyrefs
errno/ilseq
errno/canceled
errno/nosr
errno/time
errno/badmsg
errno/proto
errno/nodata
errno/nostr
errno/cloneme))
(define-interface aix-signals-extras-interface
(export signal/io
signal/xcpu
signal/xfsz
signal/msg
signal/winch
signal/pwr
signal/prof
signal/danger
signal/vtalrm
signal/migrate
signal/pre
signal/virt))
(define-interface aix-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/use-privileged
; socket/cant-signal
socket/send-buffer
socket/receive-buffer
socket/send-low-water
socket/receive-low-water
socket/send-timeout
socket/receive-timeout
socket/error
socket/type
ip/options
ip/include-header
ip/type-of-service
ip/time-to-live
ip/recvopt
ip/recvret
ip/recvdst
ip/retopts
tcp/no-delay
tcp/max-segment
message/eor
message/trunc
message/ctrunc
message/waitall
))
(define-interface aix-extras-interface
(compound-interface aix-errno-extras-interface
aix-fdflags-extras-interface
aix-network-extras-interface
aix-signals-extras-interface))
(define-interface aix-defs-interface
(compound-interface aix-extras-interface
sockets-network-interface
posix-errno-interface
posix-fdflags-interface
posix-signals-interface
signals-internals-interface))
(define-structure aix-defs aix-defs-interface
(open scheme bitwise defenum-package)
(files fdflags errno signals netconst))
(define-interface os-extras-interface aix-extras-interface)
(define os-dependent aix-defs)

View File

@ -1,51 +0,0 @@
;;; Signal constant definitions for AIX
;;; Copyright (c) 1994 by Olin Shivers.
;;; Copyright (c) 1994 by Brian D. Carlstrom.
;;; AIX version by Chipsy Sperber
;;POSIX only defined here.
(define-enum-constants signal
;; POSIX
(hup 1) ; hangup
(int 2) ; interrupt
(quit 3) ; quit
(ill 4) ; illegal instruction (not reset when caught)
(iot 5) ; IOT instruction
(abrt 6) ; used by abort, replace SIGIOT in the future
(fpe 8) ; floating point exception
(igemt 7) ; EMT intruction
(igfpe 8) ; floating point exception
(kill 9) ; kill (cannot be caught or ignored)
(bus 10) ; bus error (specification exception)
(segv 11) ; segmentation violation
(igsys 12) ; bad argument to system call
(pipe 13) ; write on a pipe with no one to read it
(alrm 14) ; alarm clock
(term 15) ; software termination signal from kill
(igurg 16) ; urgent contition on I/O channel
(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
(ttin 21) ; to readers pgrp upon background tty read
(ttou 22) ; like TTIN for output if (tp->t_local&LTOSTOP)
(io 23) ; I/O possible, or completed
(xcpu 24) ; cpu time limit exceeded (see setrlimit)
(xfsz 25) ; file size limit exceeded (see setrlimit)
(msg 27) ; input data is in the HFT ring buffer
(winch 28) ; window size changed
(pwr 29) ; power-fail restart
(usr1 30) ; user defined signal 1
(usr2 31) ; user defined signal 2
(prof 32) ; profiling time alarm (see setitimer)
(danger 33) ; system crash imminent; free up some page space
(vtalrm 34) ; virtual time alarm (see setitimer)
(migrate 35) ; migrate process (see TCF)
(pre 36) ; programming exception
(virt 37) ; AIX virtual time alarm
)

View File

@ -1,10 +0,0 @@
/* 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)->losigs=((hi)<<24)|(lo))
/* Not a procedure: */
#define split_sigset(mask, hip, lop) \
((*(hip)=(mask.losigs>>24)&0xff), \
(*(lop)=(mask.losigs&0xffffff)))

View File

@ -1,85 +0,0 @@
/* Copyright (c) 1994 by Olin Shivers.
** Copyright (c) 1994-1995 by Brian D. Carlstrom.
** AIX version by Chipsy Sperber
**
** 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 <sys/select.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->_cnt > 0 ? SCHTRUE : char_ready_fdes(fd);
}
void setfileno(FILE *fs, int fd)
{
fileno(fs) = fd;
}
int fbufcount(FILE* fs)
{
return(fs->_cnt);
}
/* Returns true if there is no buffered data in stream FS
** (or there is no buffering, period.)
*/
int ibuf_empty(FILE *fs) {return fs->_cnt <= 0;}
/* Returns true if the buffer in stream FS is full
** (or there is no buffering, period).
*/
int obuf_full(FILE *fs) {return fs->_cnt <= 0;}

View File

@ -1,13 +0,0 @@
/* 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);

View File

@ -1,4 +0,0 @@
#undef HAVE_DLOPEN
#undef HAVE_TZNAME
#define HAVE_TZNAME

View File

@ -1,8 +0,0 @@
;;; 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

View File

@ -1,38 +0,0 @@
/* 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

@ -1,216 +0,0 @@
;;; Constant definitions for tty control code (POSIX termios).
;;; Copyright (c) 1995 by Brian Carlstrom.
;;; Largely rehacked by Olin.
;;; These constants are for AIX 3.2.x,
;;; and are taken from /usr/include/sys/termio.h
;;; and /usr/include/sys/ttydev.h
;;; Non-standard (POSIX, SVR4, 4.3+BSD) things:
;;; - Some of the baud rates.
;;; Special Control Characters
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; Indices into the c_cc[] character array.
;;; Name Subscript Enabled by
;;; ---- --------- ----------
;;; POSIX
(define ttychar/eof 4) ; ^d icanon
(define ttychar/eol 5) ; icanon
(define ttychar/delete-char 2) ; ^? icanon
(define ttychar/delete-line 3) ; ^u icanon
(define ttychar/interrupt 0) ; ^c isig
(define ttychar/quit 1) ; ^\ isig
(define ttychar/suspend 9) ; ^z isig
(define ttychar/start 7) ; ^q ixon, ixoff
(define ttychar/stop 8) ; ^s ixon, ixoff
(define ttychar/min 4) ; !icanon ; Not exported
(define ttychar/time 5) ; !icanon ; Not exported
;;; SVR4 & 4.3+BSD
(define ttychar/delete-word 13) ; ^w icanon
(define ttychar/reprint 11) ; ^r icanon
(define ttychar/literal-next 14) ; ^v iexten
(define ttychar/discard 12) ; ^o iexten
(define ttychar/delayed-suspend 10) ; ^y isig
(define ttychar/eol2 6) ; icanon
;;; 4.3+BSD
(define ttychar/status #f) ; ^t icanon
;;; Length of control-char string -- *Not Exported*
(define num-ttychars 16)
;;; Magic "disable feature" tty character
(define disable-tty-char (ascii->char #xff)) ; _POSIX_VDISABLE
;;; Flags controllling input processing
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; POSIX
(define ttyin/ignore-break #x00001) ; ignbrk
(define ttyin/interrupt-on-break #x00002) ; brkint
(define ttyin/ignore-bad-parity-chars #x00004) ; ignpar
(define ttyin/mark-parity-errors #x00008) ; parmrk
(define ttyin/check-parity #x00010) ; inpck
(define ttyin/7bits #x00020) ; istrip
(define ttyin/nl->cr #x00040) ; inlcr
(define ttyin/ignore-cr #x00080) ; igncr
(define ttyin/cr->nl #x00100) ; icrnl
(define ttyin/output-flow-ctl #x00200) ; ixon
(define ttyin/input-flow-ctl #x00400) ; ixoff
;;; SVR4 & 4.3+BSD
(define ttyin/xon-any #x1000) ; ixany: Any char restarts after stop
(define ttyin/beep-on-overflow #x10000) ; imaxbel: queue full => ring bell
;;; SVR4
(define ttyin/lowercase #x800) ; iuclc: Map upper-case to lower case
;;; Flags controlling output processing
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; POSIX
(define ttyout/enable #o000001) ; opost: enable output processing
;;; SVR4 & 4.3+BSD
(define ttyout/nl->crnl #o000004) ; 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 #x000008) ; ocrnl
(define ttyout/fill-w/del #x000080) ; ofdel
(define ttyout/delay-w/fill-char #x000040) ; ofill
(define ttyout/uppercase #x000002) ; olcuc
(define ttyout/nl-does-cr #x000020) ; onlret
(define ttyout/no-col0-cr #x000010) ; onocr
;;; Newline delay
(define ttyout/nl-delay #x004000) ; mask (nldly)
(define ttyout/nl-delay0 #x000000)
(define ttyout/nl-delay1 #x004000) ; tty 37
;;; Horizontal-tab delay
(define ttyout/tab-delay #x000c00) ; mask (tabdly)
(define ttyout/tab-delay0 #x000000)
(define ttyout/tab-delay1 #x000400) ; tty 37
(define ttyout/tab-delay2 #x000800)
(define ttyout/tab-delayx #x000c00) ; Expand tabs (xtabs, tab3)
;;; Carriage-return delay
(define ttyout/cr-delay #x000300) ; mask (crdly)
(define ttyout/cr-delay0 #x000000)
(define ttyout/cr-delay1 #x000100) ; tn 300
(define ttyout/cr-delay2 #x000200) ; tty 37
(define ttyout/cr-delay3 #x000300) ; concept 100
;;; Vertical tab delay
(define ttyout/vtab-delay #x008000) ; mask (vtdly)
(define ttyout/vtab-delay0 #x000000)
(define ttyout/vtab-delay1 #x008000) ; tty 37
;;; Backspace delay
(define ttyout/bs-delay #x001000) ; mask (bsdly)
(define ttyout/bs-delay0 #x000000)
(define ttyout/bs-delay1 #x001000)
;;; Form-feed delay
(define ttyout/ff-delay #x002000) ; mask (ffdly)
(define ttyout/ff-delay0 #x000000)
(define ttyout/ff-delay1 #x002000)
(define ttyout/all-delay
(bitwise-ior (bitwise-ior (bitwise-ior ttyout/nl-delay ttyout/tab-delay)
(bitwise-ior ttyout/cr-delay ttyout/vtab-delay))
(bitwise-ior ttyout/bs-delay ttyout/ff-delay)))
;;; Control flags - hacking the serial-line.
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; POSIX
(define ttyc/char-size #x00030) ; csize: character size mask
(define ttyc/char-size5 #x00000) ; 5 bits (cs5)
(define ttyc/char-size6 #x00010) ; 6 bits (cs6)
(define ttyc/char-size7 #x00020) ; 7 bits (cs7)
(define ttyc/char-size8 #x00030) ; 8 bits (cs8)
(define ttyc/2-stop-bits #x00040) ; cstopb: Send 2 stop bits.
(define ttyc/enable-read #x00080) ; cread: Enable receiver.
(define ttyc/enable-parity #x00100) ; parenb
(define ttyc/odd-parity #x00200) ; parodd
(define ttyc/hup-on-close #x00400) ; hupcl: Hang up on last close.
(define ttyc/no-modem-sync #x00800) ; 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 #x010) ; echoe: Visually erase chars
(define ttyl/echo-delete-line #x020) ; echok: Echo nl after line kill
(define ttyl/echo #x008) ; echo: Enable echoing
(define ttyl/echo-nl #x040) ; echonl: Echo nl even if echo is off
(define ttyl/canonical #x002) ; icanon: Canonicalize input
(define ttyl/enable-signals #x001) ; isig: Enable ^c, ^z signalling
(define ttyl/extended #x00200000); iexten: Enable extensions
(define ttyl/ttou-signal #x10000) ; tostop: SIGTTOU on background output
(define ttyl/no-flush-on-interrupt #x80) ; noflsh
;;; SVR4 & 4.3+BSD
(define ttyl/visual-delete-line #x080000); echoke: visually erase a line-kill
(define ttyl/hardcopy-delete #x040000); echoprt: visual erase for hardcopy
(define ttyl/echo-ctl #x020000); echoctl: echo control chars as "^X"
(define ttyl/flush-output #x100000); flusho: output is being flushed
(define ttyl/reprint-unread-chars #x20000000); 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 #x4) ; 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) (14 . exta) (15 . extb)))
;;; tcflush() constants
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(define %flush-tty/input 0) ; TCIFLUSH
(define %flush-tty/output 1) ; TCOFLUSH
(define %flush-tty/both 2) ; TCIOFLUSH
;;; tcflow() constants
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(define %tcflow/start-out 1) ; TCOON
(define %tcflow/stop-out 0) ; TCOOFF
(define %tcflow/start-in 3) ; TCION
(define %tcflow/stop-in 2) ; TCIOFF
;;; tcsetattr() constants
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(define %set-tty-info/now 0) ; TCSANOW Make change immediately.
(define %set-tty-info/drain 1) ; TCSADRAIN Drain output, then change.
(define %set-tty-info/flush 2) ; TCSAFLUSH Drain output, flush input.

View File

@ -1,40 +0,0 @@
;;; Scsh routines for analysing exit codes returned by WAIT.
;;; Copyright (c) 1994 by Olin Shivers.
;;;
;;; 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 NeXTSTEP.
;;;
;;; 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 #xFF status))
(bitwise-and #xFF (arithmetic-shift status -8))))
;;; If the process was suspended, return the suspending signal, otw #f.
(define (status:stop-sig status)
(and (not (zero? (bitwise-and status #x40)))
(bitwise-and #x7F (arithmetic-shift status -8))))
;;; If the process terminated abnormally,
;;; return the terminating signal, otw #f.
(define (status:term-sig status)
(and (not (zero? (bitwise-and status #xFF))) ; Didn't exit.
(zero? (bitwise-and status #x40)) ; Not suspended.
(bitwise-and status #x7F)))
;;; 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

View File

@ -1,13 +0,0 @@
;;; Flags that control buffering policy.
;;; Copyright (c) 1993 by Olin Shivers.
;;; Copyright (c) 1995 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

View File

@ -1,133 +0,0 @@
;;; Errno constant definitions.
;;; Copyright (c) 1993 by Olin Shivers.
;;; Copyright (c) 1994 by Brian D. Carlstrom.
;;; These are the correct values for BSD4.4-Lite-based systems
;;; such as NetBSD 1.0 and FreeBSD 2.0.
(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 function call
(io 5) ; Input/output error
(nxio 6) ; No such device or address
; (2big 7) ; Arg list too long
(noexec 8) ; Exec format error
(badf 9) ; Bad file descriptor
(child 10) ; No child processes
;; BSD4.4-Lite
(deadlk 11) ; Resource deadlock avoided
;; POSIX:
(nomem 12) ; Not enough space
(acces 13) ; Permission denied
(fault 14) ; Bad address
;; BSD4.4-Lite
(notblk 15) ; Block device required
;; POSIX
(busy 16) ; Resource busy
(exist 17) ; File exists
(xdev 18) ; Improper 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) ; Inappropriate I/O control operation
;; BSD4.4-Lite
(txtbsy 26) ; Text file busy
;; POSIX
(fbig 27) ; File too large
(nospc 28) ; No space left on device
(spipe 29) ; Invalid seek
(rofs 30) ; Read-only file system
(mlink 31) ; Too many links
(pipe 32) ; Broken pipe
;; Strict ANSI
;; math software
(dom 33) ; Domain error
(range 34) ; Result too large
;; POSIX
(again 35) ; Resource temporarily unavaile (note overlap)
;; BSD4.4-Lite
;; non-blocking and interrupt i/o
(wouldblock 35) ; Operation would block
(inprogress 36) ; Operation now in progress
(already 37) ; Operation already in progress
;; ipc/network software
;; argument errors
(notsock 38) ; Socket operation on non-socket
(destaddrreq 39) ; Destination address required
(msgsize 40) ; Message too long
(prototype 41) ; Protocol wrong type for socket
(noprotoopt 42) ; Protocol not available
(protonosupport 43) ; Protocol not supported
(socktnosupport 44) ; Socket type not supported
(opnotsupp 45) ; Operation not supported on socket
(pfnosupport 46) ; Protocol family not supported
(afnosupport 47) ; Address family not supported by protocol family
(addrinuse 48) ; Address already in use
(addrnotavail 49) ; Can't assign requested address
;; operational errors
(netdown 50) ; Network is down
(netunreach 51) ; Network is unreachable
(netreset 52) ; Network dropped connection on reset
(connaborted 53) ; Software caused connection abort
(connreset 54) ; Connection reset by peer
(nobufs 55) ; No buffer space available
(isconn 56) ; Socket is already connected
(notconn 57) ; Socket is not connected
(shutdown 58) ; Can't send after socket shutdown
(toomanyrefs 59) ; Too many references: can't splice
(timedout 60) ; Connection timed out
(connrefused 61) ; Connection refused
(loop 62) ; Too many levels of symbolic links
;; POSIX:
(nametoolong 63) ; File name too long
;; BSD4.4-Lite
(hostdown 64) ; Host is down
(hostunreach 65) ; No route to host
;; POSIX:
(notempty 66) ; Directory not empty
;; BSD4.4-Lite
;; quotas & mush
(proclim 67) ; Too many processes
(users 68) ; Too many users
(dquot 69) ; Disc quota exceeded
;; Network File System
(stale 70) ; Stale NFS file handle
(remote 71) ; Too many levels of remote in path
(badrpc 72) ; RPC struct is bad
(rpcmismatch 73) ; RPC version wrong
(progunavail 74) ; RPC prog. not avail
(progmismatch 75) ; Program version wrong
(procunavail 76) ; Bad procedure for program
;; SystemV Record Locking
(nolck 77) ; No locks available
;; POSIX
(nosys 78) ; Function not implemented
;; BSD4.4-Lite
(ftype 79) ; Inappropriate file type or format
(auth 80) ; Authentication error
(needauth 81) ; Need authenticator
(last 81)) ; Must be equal largest errno

View File

@ -1,55 +0,0 @@
;;; Flags for open(2) and fcntl(2).
;;; Copyright (c) 1993 by Olin Shivers.
;;; Copyright (c) 1994 by Brian D. Carlstrom
(define-enum-constants open
;; POSIX
(read #x0000)
(write #x0001)
(read+write #x0002)
(nonblocking #x0004) ; no delay
(append #x0008) ; set append mode
;; BSD4.4-Lite
(shared-lock #x0010) ; open with shared file lock
(exclusive-lock #x0020) ; open with exclusive file lock
(async #x0040) ; signal pgrep when data ready
(fsync #x0080) ; synchronus writes
;; POSIX
(create #x0200) ; create if nonexistant
(truncate #x0400) ; truncate to zero length
(exclusive #x0800) ; error if already exists
(no-control-tty #x0000)) ; don't assign controlling terminal
(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-noblock 8) ; F_SETLK
(set-record-lock 9)) ; F_SETLKW
;;; 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

View File

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

View File

@ -1,139 +0,0 @@
;;; Magic Numbers for Networking
;;; Copyright (c) 1994 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
;;; 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
(define message/eor 8) ; data completes record
(define message/trunc #x10) ; data discarded before delivery
(define message/ctrunc #x20) ; control data lost before delivery
(define message/wait-all #x40) ; wait for full request or error
(define message/dont-wait #x80) ; this message should be nonblocking
;;; 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/reuse-port #x0200) ; allow local address & port reuse
;(define socket/use-privileged #x4000) ; allocate from privileged port area
;(define socket/cant-signal #x8000) ; prevent SIGPIPE on SS_CANTSENDMORE
(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 -- <netinet/in.h>
(define ip/options 1 ) ; buf/ip/opts; set/get ip options
(define ip/header-included 2 ) ; int; header is included with data
(define ip/type-of-service 3 ) ; int; ip type of service and preced.
(define ip/time-to-live 4 ) ; int; ip time to live
(define ip/receive-options 5 ) ; bool; receive all ip opts w/dgram
(define ip/response-options 6 ) ; bool; receive ip opts for response
(define ip/destination-address 7 ) ; bool; receive ip dst addr w/dgram
(define ip/ret-options 8 ) ; ip_opts; set/get ip options
(define ip/multicast-if 9 ) ; u_char; set/get ip multicast i/f
(define ip/multicast-ttl 10 ) ; u_char; set/get ip multicast ttl
(define ip/multicast-loop 11 ) ; u_char; set/get ip multicast loopback
(define ip/add-membership 12 ) ; ip_mreq; add an ip group membership
(define ip/drop-membership 13 ) ; ip_mreq; drop an ip group membership
;;; 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
socket/reuse-port ;BSD4.4-Lite
; socket/use-privileged
; socket/cant-signal
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))

View File

@ -1,137 +0,0 @@
;;; Interfaces and packages for the BSD4.4-Lite specific parts of scsh.
;;; Copyright (c) 1994 by Olin Shivers.
;;; Copyright (c) 1994 by Brian D. Carlstrom.
(define-interface bsd44lite-fdflags-extras-interface
(export open/shared-lock
open/exclusive-lock
open/async
open/fsync
fcntl/get-owner
fcntl/set-owner))
(define-interface bsd44lite-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/badrpc
errno/rpcmismatch
errno/progunavail
errno/progmismatch
errno/ftype
errno/auth
errno/needauth
errno/last))
(define-interface bsd44lite-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 bsd44lite-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/reuse-port ;bsd44lite
; socket/use-privileged
; socket/cant-signal
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 bsd44lite only
ip/options
ip/header-included
ip/type-of-service
ip/time-to-live
ip/receive-options
ip/response-options
ip/destination-address
ip/ret-options
ip/multicast-if
ip/multicast-ttl
ip/multicast-loop
ip/add-membership
ip/drop-membership
tcp/no-delay
tcp/max-segment
message/eor
message/trunc
message/ctrunc
message/wait-all
message/dont-wait))
(define-interface bsd44lite-extras-interface
(compound-interface bsd44lite-errno-extras-interface
bsd44lite-fdflags-extras-interface
bsd44lite-network-extras-interface
bsd44lite-signals-extras-interface))
(define-interface bsd44lite-defs-interface
(compound-interface bsd44lite-extras-interface
sockets-network-interface
posix-errno-interface
posix-fdflags-interface
posix-signals-interface
signals-internals-interface))
(define-structure bsd44lite-defs bsd44lite-defs-interface
(open scheme bitwise defenum-package)
(files fdflags errno signals netconst))
(define-interface os-extras-interface bsd44lite-extras-interface)
(define os-dependent bsd44lite-defs)

View File

@ -1,72 +0,0 @@
;;; Signal constant definitions for BSD4.4-Lite
;;; Copyright (c) 1994 by Olin Shivers.
;;; Copyright (c) 1994 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)
;; BSD4.4-Lite
(trap 5) ; trace trap (not reset when caught)
;; POSIX
(iot 6) ; IOT instruction
(abrt 6) ; used by abort, replace SIGIOT in the future
;; BSD4.4-Lite
(emt 7) ; EMT instruction
;; POSIX
(fpe 8) ; floating point exception
(kill 9) ; kill (cannot be caught or ignored)
;; BSD4.4-Lite
(bus 10) ; bus error
;; POSIX
(segv 11) ; segmentation violation
;; BSD4.4-Lite
(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
;; BSD4.4-Lite
(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
;; BSD4.4-Lite
(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)
;; BSD4.4-Lite
(io 23) ; input/output possible signal
(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.

View File

@ -1,129 +0,0 @@
/* 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
*/

View File

@ -1,4 +0,0 @@
/* Exports from signals1.c */
const int sig2int[];
const int max_sig;

View File

@ -1,10 +0,0 @@
/* 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)))

View File

@ -1,83 +0,0 @@
/* Copyright (c) 1994 by Olin Shivers.
** Copyright (c) 1994-1995 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)
{
fileno(fs) = 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;}

View File

@ -1,13 +0,0 @@
/* 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);

View File

View File

@ -1,8 +0,0 @@
;;; 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

View File

@ -1,38 +0,0 @@
/* 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

@ -1,220 +0,0 @@
;;; Constant definitions for tty control code (POSIX termios).
;;; Copyright (c) 1995 by Brian Carlstrom.
;;; Largely rehacked by Olin.
;;; Constants from NetBSD header files substituted by Bill Sommerfeld
;;; These constants are for NetBSD 1.1 pre-alpha
;;; and are taken from /usr/include/sys/termios.h. These should
;;; work with any BSD4.4-Lite derived system (such as FreeBSD).
;;; Non-standard (POSIX, SVR4, 4.3+BSD) things:
;;; - Some of the baud rates.
;;; Special Control Characters
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; Indices into the c_cc[] character array.
;;; Name Subscript Enabled by
;;; ---- --------- ----------
;;; POSIX
(define ttychar/eof 0) ; ^d icanon
(define ttychar/eol 1) ; icanon
(define ttychar/delete-char 3) ; ^? icanon
(define ttychar/delete-line 5) ; ^u icanon
(define ttychar/interrupt 8) ; ^c isig
(define ttychar/quit 9) ; ^\ isig
(define ttychar/suspend 10) ; ^z isig
(define ttychar/start 12) ; ^q ixon, ixoff
(define ttychar/stop 13) ; ^s ixon, ixoff
(define ttychar/min 16) ; !icanon ; Not exported
(define ttychar/time 17) ; !icanon ; Not exported
;;; SVR4 & 4.3+BSD
(define ttychar/eol2 2) ; icanon
(define ttychar/delete-word 4) ; ^w icanon
(define ttychar/reprint 6) ; ^r icanon
(define ttychar/delayed-suspend 11) ; ^y isig
(define ttychar/literal-next 14) ; ^v iexten
(define ttychar/discard 15) ; ^o iexten
;;; 4.3+BSD
(define ttychar/status 18) ; ^t icanon
;;; Length of control-char string -- *Not Exported*
(define num-ttychars 20)
;;; Magic "disable feature" tty character
(define disable-tty-char (ascii->char #xff)) ; _POSIX_VDISABLE
;;; Flags controllling input processing
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; POSIX
(define ttyin/ignore-break #x00001) ; ignbrk
(define ttyin/interrupt-on-break #x00002) ; brkint
(define ttyin/ignore-bad-parity-chars #x00004) ; ignpar
(define ttyin/mark-parity-errors #x00008) ; parmrk
(define ttyin/check-parity #x00010) ; inpck
(define ttyin/7bits #x00020) ; istrip
(define ttyin/nl->cr #x00040) ; inlcr
(define ttyin/ignore-cr #x00080) ; igncr
(define ttyin/cr->nl #x00100) ; icrnl
(define ttyin/output-flow-ctl #x00200) ; ixon
(define ttyin/input-flow-ctl #x00400) ; ixoff
;;; SVR4 & 4.3+BSD
(define ttyin/xon-any #x00800) ; ixany: Any char restarts after stop
(define ttyin/beep-on-overflow #x02000) ; imaxbel: queue full => ring bell
;;; SVR4
(define ttyin/lowercase #f) ; iuclc: Map upper-case to lower case
;;; Flags controlling output processing
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; POSIX
(define ttyout/enable #x000001) ; opost: enable output processing
;;; SVR4 & 4.3+BSD
(define ttyout/nl->crnl #x000002) ; onlcr: map nl to cr-nl
;;; 4.3+BSD
(define ttyout/discard-eot #x000008) ; onoeot
(define ttyout/expand-tabs #x000004) ; oxtabs (NOT xtabs)
;;; SVR4
(define ttyout/cr->nl #f) ; ocrnl
(define ttyout/fill-w/del #f) ; ofdel
(define ttyout/delay-w/fill-char #f) ; ofill
(define ttyout/uppercase #f) ; olcuc
(define ttyout/nl-does-cr #f) ; onlret
(define ttyout/no-col0-cr #f) ; onocr
;;; Newline delay
(define ttyout/nl-delay #f) ; mask (nldly)
(define ttyout/nl-delay0 #f)
(define ttyout/nl-delay1 #f) ; tty 37
;;; Horizontal-tab delay
(define ttyout/tab-delay #f) ; mask (tabdly)
(define ttyout/tab-delay0 #f)
(define ttyout/tab-delay1 #f) ; tty 37
(define ttyout/tab-delay2 #f)
(define ttyout/tab-delayx #f) ; Expand tabs (xtabs, tab3)
;;; Carriage-return delay
(define ttyout/cr-delay #f) ; mask (crdly)
(define ttyout/cr-delay0 #f)
(define ttyout/cr-delay1 #f) ; tn 300
(define ttyout/cr-delay2 #f) ; tty 37
(define ttyout/cr-delay3 #f) ; concept 100
;;; Vertical tab delay
(define ttyout/vtab-delay #f) ; mask (vtdly)
(define ttyout/vtab-delay0 #f)
(define ttyout/vtab-delay1 #f) ; tty 37
;;; Backspace delay
(define ttyout/bs-delay #f) ; mask (bsdly)
(define ttyout/bs-delay0 #f)
(define ttyout/bs-delay1 #f)
;;; Form-feed delay
(define ttyout/ff-delay #f) ; mask (ffdly)
(define ttyout/ff-delay0 #f)
(define ttyout/ff-delay1 #f)
(define ttyout/all-delay #f)
;;; Control flags - hacking the serial-line.
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; POSIX
(define ttyc/char-size #x00300) ; csize: character size mask
(define ttyc/char-size5 #x00000) ; 5 bits (cs5)
(define ttyc/char-size6 #x00100) ; 6 bits (cs6)
(define ttyc/char-size7 #x00200) ; 7 bits (cs7)
(define ttyc/char-size8 #x00300) ; 8 bits (cs8)
(define ttyc/2-stop-bits #x00400) ; cstopb: Send 2 stop bits.
(define ttyc/enable-read #x00800) ; cread: Enable receiver.
(define ttyc/enable-parity #x01000) ; parenb
(define ttyc/odd-parity #x02000) ; parodd
(define ttyc/hup-on-close #x04000) ; hupcl: Hang up on last close.
(define ttyc/no-modem-sync #x08000) ; clocal: Ignore modem lines.
;;; 4.3+BSD
(define ttyc/ignore-flags #x00001) ; cignore: ignore control flags
(define ttyc/CTS-output-flow-ctl #x00010000) ; ccts_oflow: CTS flow control of output
(define ttyc/RTS-input-flow-ctl #x00010000) ; crts_iflow: RTS flow control of input
(define ttyc/carrier-flow-ctl #x00100000) ; mdmbuf
;;; Local flags -- hacking the tty driver / user interface.
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; POSIX
(define ttyl/visual-delete #x00000002) ; echoe: Visually erase chars
(define ttyl/echo-delete-line #x00000004) ; echok: Echo nl after line kill
(define ttyl/echo #x00000008) ; echo: Enable echoing
(define ttyl/echo-nl #x00000010) ; echonl: Echo nl even if echo is off
(define ttyl/canonical #x00000100) ; icanon: Canonicalize input
(define ttyl/enable-signals #x00000080) ; isig: Enable ^c, ^z signalling
(define ttyl/extended #x00000400) ; iexten: Enable extensions
(define ttyl/ttou-signal #x00400000) ; tostop: SIGTTOU on background output
(define ttyl/no-flush-on-interrupt #x80000000) ; noflsh
;;; SVR4 & 4.3+BSD
(define ttyl/visual-delete-line #x00000001); echoke: visually erase a line-kill
(define ttyl/hardcopy-delete #x00000020); echoprt: visual erase for hardcopy
(define ttyl/echo-ctl #x00000040); echoctl: echo control chars as "^X"
(define ttyl/flush-output #x00800000); flusho: output is being flushed
(define ttyl/reprint-unread-chars #x20000000); pendin: retype pending input
;;; 4.3+BSD
(define ttyl/alt-delete-word #x00000200) ; altwerase
(define ttyl/no-kernel-status #x02000000) ; 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) (50 . 50) (75 . 75)
(110 . 110) (134 . 134) (150 . 150)
(200 . 200) (300 . 300) (600 . 600)
(1200 . 1200) (1800 . 1800) (2400 . 2400)
(4800 . 4800) (7200 . 7200) (9600 . 9600)
(14400 . 14400) (19200 . 19200) (28800 . 28800)
(38400 . 38400) (19200 . exta) (38400 . extb)
(57600 . 57600) (76800 . 76800) (115200 . 115200)
(230400 . 230400)))
;;; tcflush() constants
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(define %flush-tty/input 1) ; TCIFLUSH
(define %flush-tty/output 2) ; TCOFLUSH
(define %flush-tty/both 3) ; TCIOFLUSH
;;; tcflow() constants
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(define %tcflow/start-out 2) ; TCOON
(define %tcflow/stop-out 1) ; TCOOFF
(define %tcflow/start-in 4) ; TCION
(define %tcflow/stop-in 3) ; TCIOFF
;;; tcsetattr() constants
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(define %set-tty-info/now 0) ; TCSANOW Make change immediately.
(define %set-tty-info/drain 1) ; TCSADRAIN Drain output, then change.
(define %set-tty-info/flush 2) ; TCSAFLUSH Drain output, flush input.
(define %set-tty-info/soft #x10) ; flag: don't alter h.w. state

View File

@ -1,40 +0,0 @@
;;; Scsh routines for analysing exit codes returned by WAIT.
;;; Copyright (c) 1994 by Olin Shivers.
;;;
;;; 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 BSD4.4-Lite.
;;;
;;; 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

@ -1,4 +0,0 @@
CC="cc -Xa"
CFLAGS="-O"
LDFLAGS="-O -Wl,-Bexport"

View File

@ -1,12 +0,0 @@
;;; Flags that control buffering policy.
;;; Copyright (c) 1993 by Olin Shivers.
;;; 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 #o200) ; _IOLBF
(none 4)) ; _IONBF

View File

@ -1,195 +0,0 @@
;;; Errno constant definitions.
;;; Copyright (c) 1993 by Olin Shivers.
;;; These are the correct values for a Harris NightHawk running CX/UX
(define errno/2big 7) ; 2big is not a legit Scheme symbol. Lose, lose.
(define-enum-constants errno
(perm 1)
(noent 2)
(srch 3)
(intr 4)
(io 5)
(nxio 6)
; (2big 7)
(noexec 8)
(badf 9)
(child 10)
(again 11)
(nomem 12)
(acces 13)
(fault 14)
(notblk 15)
(busy 16)
(exist 17)
(xdev 18)
(nodev 19)
(notdir 20)
(isdir 21)
(inval 22)
(nfile 23)
(mfile 24)
(notty 25)
(fbig 27)
(nospc 28)
(spipe 29)
(rofs 30)
(mlink 31)
(pipe 32)
(dom 33)
(range 34)
(nomsg 35)
(idrm 36)
(deadlk 45)
(nolck 46)
(nametoolong 78)
(nosys 89)
(notempty 158)
(txtbsy 26)
(chrng 37)
(l2nsync 38)
(l3hlt 39)
(l3rst 40)
(lnrng 41)
(unatch 42)
(nocsi 43)
(l2hlt 44)
(bade 50)
(badr 51)
(xfull 52)
(noano 53)
(badrqc 54)
(badslt 55)
(deadlock 56)
(bfont 57)
(nostr 60)
(nodata 61)
(time 62)
(nosr 63)
(nonet 64)
(nopkg 65)
(remote 66)
(nolink 67)
(adv 68)
(srmnt 69)
(comm 70)
(proto 71)
(multihop 74)
(dotdot 76)
(badmsg 77)
(notuniq 80)
(badfd 81)
(remchg 82)
(libacc 83)
(libbad 84)
(libscn 85)
(libmax 86)
(libexec 87)
(loop 90)
(restart 91)
(inprogress 128)
(already 129)
(notsock 130)
(destaddrreq 131)
(msgsize 132)
(prototype 133)
(noprotoopt 134)
(protonosupport 135)
(socktnosupport 136)
(opnotsupp 137)
(pfnosupport 138)
(afnosupport 139)
(addrinuse 140)
(addrnotavail 141)
(netdown 142)
(netunreach 143)
(netreset 144)
(connaborted 145)
(connreset 146)
(nobufs 147)
(isconn 148)
(notconn 149)
(shutdown 150)
(toomanyrefs 151)
(timedout 152)
(connrefused 153)
(hostdown 156)
(hostunreach 157)
(proclim 159)
(users 160)
(dquot 161)
(stale 162)
(powerfail 163)
(chnrst 256)
(xlnerr 257)
(xnfst 258)
(xforbid 259)
(xcancel 260)
(xcollin 261)
(xnone 262)
(xaratt 263)
(xbadcom 264)
(xbadpac 265)
(xbadpar 266)
(xbadstate 267)
(xbadwin 268)
(xdwas 269)
(xexmax 270)
(xlncon 271)
(xlnop 272)
(xlobnd 273)
(xmulrq 274)
(xnatt 275)
(xnofac 276)
(xnres 277)
(xrdexcd 278)
(xtmout 279)
(xwover 280)
(xcaclr 281)
(xrange 282)
(lnkdwn 283)
(reopen 284)
(reclos 285)
(rtryex 286)
(lnkrst 287)
(lidle 288)
(idlestop 289)
(bufok 290)
(rembsy 293)
(xnoact 294)
(xbadfac 295)
(buflow 296)
(verr 297)
(xmit 298)
(vovrfl 299)
(badcmp 300)
(sdopen 301)
(sdkbuf 302)
(sdpu 303)
(sdaddr 304)
(sdfrsize 305)
(sdencode 306)
(pubuf 307)
(puappl 308)
(puludown 309)
(luinit 310)
(lupudown 311)
(lubuf 312)
(lupubad 313)
(iocancel 314)
(areq 315)
(nrlock 316)
(ndatreg 317)
(pagnv 318)
(badspace 319)
(regstale 320)
(norfmode 321)
(adstatavail 322)
(adnostatavail 323)
(adnotconfigured 324)
(adlinkstarted 325)
(strpipe 330)
(mtimers 340)
(fail 341)
(notsup 342))

View File

@ -1,21 +0,0 @@
;;; Flags for open(2) and fcntl(2).
;;; Copyright (c) 1993 by Olin Shivers.
(define-enum-constants open
(read 0)
(write 1)
(read+write 2)
(append 8)
(create #o00400)
(exclusive #o02000)
(no-control-tty #o04000)
(nonblocking #o00100)
(truncate #o01000)
;;; Not POSIX.
(no-delay #o0004)
(sync #o0020))
(define open/access-mask
(bitwise-ior open/read
(bitwise-ior open/write open/read+write)))

View File

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

View File

@ -1,121 +0,0 @@
;;; Magic Numbers for Networking
;;; Copyright (c) 1994 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
;;; 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/use-privileged #x4000) ; allocate from privileged port area
(define socket/cant-signal #x8000) ; prevent SIGPIPE on SS_CANTSENDMORE
(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 -- <netinet/in.h>
(define ip/options 1) ; set/get IP per-packet options
(define ip/time-to-live 2) ; set/get IP time-to-live value
;;; 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
socket/use-privileged
socket/cant-signal
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))

View File

@ -1,209 +0,0 @@
;;; Interfaces and packages for the machine specific parts of scsh.
;;; This is a specific to CX/UX
;;; Copyright (c) 1994 by Olin Shivers.
;;; Copyright (c) 1994 by Brian D. Carlstrom.
(define-interface cxux-fdflags-extras-interface
(export open/no-delay
open/sync))
(define-interface cxux-errno-extras-interface
(export errno/addrinuse
errno/addrnotavail
errno/adlinkstarted
errno/adnostatavail
errno/adnotconfigured
errno/adstatavail
errno/adv
errno/afnosupport
errno/already
errno/areq
errno/badcmp
errno/bade
errno/badfd
errno/badmsg
errno/badr
errno/badrqc
errno/badslt
errno/badspace
errno/bfont
errno/buflow
errno/bufok
errno/chnrst
errno/chrng
errno/comm
errno/connaborted
errno/connrefused
errno/connreset
errno/deadlock
errno/destaddrreq
errno/dotdot
errno/dquot
errno/fail
errno/hostdown
errno/hostunreach
errno/idlestop
errno/idrm
errno/inprogress
errno/iocancel
errno/isconn
errno/l2hlt
errno/l2nsync
errno/l3hlt
errno/l3rst
errno/libacc
errno/libbad
errno/libexec
errno/libmax
errno/libscn
errno/lidle
errno/lnkdwn
errno/lnkrst
errno/lnrng
errno/loop
errno/lubuf
errno/luinit
errno/lupubad
errno/lupudown
errno/msgsize
errno/mtimers
errno/multihop
errno/ndatreg
errno/netdown
errno/netreset
errno/netunreach
errno/noano
errno/nobufs
errno/nocsi
errno/nodata
errno/nolink
errno/nomsg
errno/nonet
errno/nopkg
errno/noprotoopt
errno/norfmode
errno/nosr
errno/nostr
errno/notblk
errno/notconn
errno/notsock
errno/notsup
errno/notuniq
errno/nrlock
errno/opnotsupp
errno/pagnv
errno/pfnosupport
errno/powerfail
errno/proclim
errno/proto
errno/protonosupport
errno/prototype
errno/puappl
errno/pubuf
errno/puludown
errno/reclos
errno/regstale
errno/rembsy
errno/remchg
errno/remote
errno/reopen
errno/restart
errno/rtryex
errno/sdaddr
errno/sdencode
errno/sdfrsize
errno/sdkbuf
errno/sdopen
errno/sdpu
errno/shutdown
errno/socktnosupport
errno/srmnt
errno/stale
errno/strpipe
errno/time
errno/timedout
errno/toomanyrefs
errno/txtbsy
errno/unatch
errno/users
errno/verr
errno/vovrfl
errno/xaratt
errno/xbadcom
errno/xbadfac
errno/xbadpac
errno/xbadpar
errno/xbadstate
errno/xbadwin
errno/xcaclr
errno/xcancel
errno/xcollin
errno/xdwas
errno/xexmax
errno/xforbid
errno/xfull
errno/xlncon
errno/xlnerr
errno/xlnop
errno/xlobnd
errno/xmit
errno/xmulrq
errno/xnatt
errno/xnfst
errno/xnoact
errno/xnofac
errno/xnone
errno/xnres
errno/xrange
errno/xrdexcd
errno/xtmout
errno/xwover))
(define-interface cxux-signals-extras-interface
(export signal/cld
signal/iot))
(define-interface cxux-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/use-privileged
socket/cant-signal
socket/send-buffer
socket/receive-buffer
socket/send-low-water
socket/receive-low-water
socket/send-timeout
socket/receive-timeout
socket/error
socket/type
ip/options
ip/time-to-live
tcp/no-delay
tcp/max-segment))
(define-interface cxux-extras-interface
(compound-interface cxux-errno-extras-interface
cxux-fdflags-extras-interface
cxux-network-extras-interface
cxux-signals-extras-interface))
(define-interface cxux-defs-interface
(compound-interface cxux-extras-interface
sockets-network-interface
posix-errno-interface
posix-fdflags-interface
posix-signals-interface))
(define-structure cxux-defs cxux-defs-interface
(open scheme bitwise defenum-package)
(files fdflags errno signals netconst))
(define-interface os-extras-interface cxux-extras-interface)
(define os-dependent cxux-defs)

View File

@ -1,30 +0,0 @@
;;; Signal constant definitions for "m88k-cxux"
;;; Copyright (c) 1994 by Olin Shivers.
;;; Copyright (c) 1994 by Brian D. Carlstrom.
;;POSIX only defined here.
(define-enum-constants signal
;; POSIX
(hup 1) ; hangup
(int 2) ; interrupt
(quit 3) ; quit
(ill 4) ; illegal instruction (not reset when caught)
(iot 6) ; IOT instruction
(abrt 6) ; used by abort, replace SIGIOT in the future
(fpe 8) ; floating point exception
(kill 9) ; kill (cannot be caught or ignored)
(segv 11) ; segmentation violation
(pipe 13) ; write on a pipe with no one to read it
(alrm 14) ; alarm clock
(term 15) ; software termination signal from kill
(stop 23) ; sendable stop signal not from tty
(tstp 24) ; stop signal from tty
(cont 25) ; continue a stopped process
(chld 18) ; to parent on child stop or exit
(ttin 26) ; to readers pgrp upon background tty read
(ttou 27) ; like TTIN for output if (tp->t_local&LTOSTOP)
;; User defined
(usr1 16) ; user defined signal 1
(usr2 17) ; user defined signal 2
)

View File

@ -1,70 +0,0 @@
/* Copyright (c) 1994 by Olin Shivers.
** Copyright (c) 1994-1995 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->_cnt > 0 ? SCHTRUE : char_ready_fdes(fd);
}
void setfileno(FILE *fs, int fd)
{
fileno(fs) = fd;
}
int fbufcount(FILE* fs)
{
return(fs->_cnt);
}

View File

@ -1,13 +0,0 @@
/* 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);

View File

@ -1,2 +0,0 @@
#undef HAVE_NLIST
#undef USCORE

View File

@ -1,8 +0,0 @@
;;; 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

View File

@ -1,38 +0,0 @@
/* 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

@ -1,40 +0,0 @@
;;; Scsh routines for analysing exit codes returned by WAIT.
;;; Copyright (c) 1994 by Olin Shivers.
;;;
;;; 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 NeXTSTEP.
;;;
;;; 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 #xFF status))
(bitwise-and #xFF (arithmetic-shift status -8))))
;;; If the process was suspended, return the suspending signal, otw #f.
(define (status:stop-sig status)
(and (not (zero? (bitwise-and status #x40)))
(bitwise-and #x7F (arithmetic-shift status -8))))
;;; If the process terminated abnormally,
;;; return the terminating signal, otw #f.
(define (status:term-sig status)
(and (not (zero? (bitwise-and status #xFF))) ; Didn't exit.
(zero? (bitwise-and status #x40)) ; Not suspended.
(bitwise-and status #x7F)))
;;; 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

@ -1,12 +0,0 @@
;;; Flags that control buffering policy.
;;; Copyright (c) 1993 by Olin Shivers.
;;; 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 #o200) ; _IOLBF
(none 4)) ; _IONBF

View File

@ -1,132 +0,0 @@
;;; Errno constant definitions.
;;; Copyright (c) 1993 by Olin Shivers.
;;; These are the correct values for my SparcStation.
(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 function call
(io 5) ; Input/output error
(nxio 6) ; No such device or address
; (2big 7) ; Arg list too long
(noexec 8) ; Exec format error
(badf 9) ; Bad file descriptor
(child 10) ; No child processes
(again 11) ; Resource temporarily unavailable
(nomem 12) ; Not enough space
(acces 13) ; Permission denied
(fault 14) ; Bad address
(notblk 15) ; Block device required
(busy 16) ; Resource busy
(exist 17) ; File exists
(xdev 18) ; Improper 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) ; Inappropriate I/O control operation
(xtbsy 26) ; Text file busy
(fbig 27) ; File too large
(nospc 28) ; No space left on device
(spipe 29) ; Invalid seek
(rofs 30) ; Read-only file system
(mlink 31) ; Too many links
(pipe 32) ; Broken pipe
;; POSIX:
;; math software
(dom 33) ; Domain error
(range 34) ; Result too large
;; non-blocking and interrupt i/o
(wouldblock 35) ; Operation would block
(inprogress 36) ; Operation now in progress
(already 37) ; Operation already in progress
;; ipc/network software
;; argument errors
(notsock 38) ; Socket operation on non-socket
(destaddrreq 39) ; Destination address required
(msgsize 40) ; Message too long
(prototype 41) ; Protocol wrong type for socket
(noprotoopt 42) ; Protocol not available
(protonosupport 43) ; Protocol not supported
(socktnosupport 44) ; Socket type not supported
(opnotsupp 45) ; Operation not supported on socket
(pfnosupport 46) ; Protocol family not supported
(afnosupport 47) ; Address family not supported by protocol family
(addrinuse 48) ; Address already in use
(addrnotavail 49) ; Can't assign requested address
;; operational errors
(netdown 50) ; Network is down
(netunreach 51) ; Network is unreachable
(netreset 52) ; Network dropped connection on reset
(connaborted 53) ; Software caused connection abort
(connreset 54) ; Connection reset by peer
(nobufs 55) ; No buffer space available
(isconn 56) ; Socket is already connected
(notconn 57) ; Socket is not connected
(shutdown 58) ; Can't send after socket shutdown
(toomanyrefs 59) ; Too many references: can't splice
(timedout 60) ; Connection timed out
(connrefused 61) ; Connection refused
(loop 62) ; Too many levels of symbolic links
;; POSIX:
(nametoolong 63) ; File name too long
;; should be rearranged
(hostdown 64) ; Host is down
(hostunreach 65) ; No route to host
;; POSIX:
(notempty 66) ; Directory not empty
;; quotas & mush
(proclim 67) ; Too many processes
(users 68) ; Too many users
(dquot 69) ; Disc quota exceeded
;; Network File System
(stale 70) ; Stale NFS file handle
(remote 71) ; Too many levels of remote in path
;; streams
(nostr 72) ; Device is not a stream
(time 73) ; Timer expired
(nosr 74) ; Out of streams resources
(nomsg 75) ; No message of desired type
(badmsg 76) ; Trying to read unreadable message
;; SystemV IPC
(idrm 77) ; Identifier removed
;; POSIX
;; SystemV Record Locking
(deadlk 78) ; Resource deadlock avoided
(nolck 79) ; No locks available
;; RFS
(nonet 80) ; Machine is not on the network
(rremote 81) ; Object is remote
(nolink 82) ; the link has been severed
(adv 83) ; advertise error
(srmnt 84) ; srmount error
(comm 85) ; Communication error on send
(proto 86) ; Protocol error
(multihop 87) ; multihop attempted
(dotdot 88) ; Cross mount point (not an error)
(remchg 89) ; Remote address changed
;; POSIX
(nosys 90)) ; function not implemented

View File

@ -1,47 +0,0 @@
;;; Flags for open(2) and fcntl(2).
;;; Copyright (c) 1993 by Olin Shivers.
(define-enum-constants open
(read 0)
(write 1)
(read+write 2)
(append 8)
(create #x0200)
(exclusive #x0800)
(no-control-tty #x8000)
(nonblocking #x4000)
(truncate #x0400)
;;; Not POSIX.
(no-delay 4)
(sync #x2000))
(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-record-lock 5) ; F_GETLK
(set-record-lock-noblock 6) ; F_SETLK
(set-record-lock 7)) ; F_SETLKW
;;; 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
(write 2) ; F_WRLCK
(release 3)) ; F_UNLCK

View File

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

View File

@ -1,121 +0,0 @@
;;; Magic Numbers for Networking
;;; Copyright (c) 1994 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
;;; 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/use-privileged #x4000) ; allocate from privileged port area
(define socket/cant-signal #x8000) ; prevent SIGPIPE on SS_CANTSENDMORE
(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 -- <netinet/in.h>
(define ip/options 1) ; set/get IP per-packet options
(define ip/time-to-live 2) ; set/get IP time-to-live value
;;; 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
socket/use-privileged
socket/cant-signal
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))

View File

@ -1,113 +0,0 @@
;;; Interfaces and packages for the machine specific parts of scsh.
;;; This is a generic version as a starting point, based on sunos.
;;; Copyright (c) 1994 by Olin Shivers.
;;; Copyright (c) 1994 by Brian D. Carlstrom.
(define-interface generic-fdflags-extras-interface
(export open/no-delay
open/sync))
(define-interface generic-errno-extras-interface
(export errno/addrinuse
errno/addrnotavail
errno/adv
errno/afnosupport
errno/already
errno/badmsg
errno/comm
errno/connaborted
errno/connrefused
errno/connreset
errno/destaddrreq
errno/dotdot
errno/dquot
errno/hostdown
errno/hostunreach
errno/idrm
errno/inprogress
errno/isconn
errno/loop
errno/msgsize
errno/multihop
errno/netdown
errno/netreset
errno/netunreach
errno/nobufs
errno/nolink
errno/nomsg
errno/nonet
errno/noprotoopt
errno/nosr
errno/nostr
errno/notblk
errno/notconn
errno/notsock
errno/opnotsupp
errno/pfnosupport
errno/proclim
errno/proto
errno/protonosupport
errno/prototype
errno/remchg
errno/remote
errno/rremote
errno/shutdown
errno/socktnosupport
errno/srmnt
errno/stale
errno/time
errno/timedout
errno/toomanyrefs
errno/users
errno/wouldblock
errno/xtbsy))
(define-interface generic-signals-extras-interface
(export signal/cld
signal/iot))
(define-interface generic-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/use-privileged
socket/cant-signal
socket/send-buffer
socket/receive-buffer
socket/send-low-water
socket/receive-low-water
socket/send-timeout
socket/receive-timeout
socket/error
socket/type
ip/options
ip/time-to-live
tcp/no-delay
tcp/max-segment))
(define-interface generic-extras-interface
(compound-interface generic-errno-extras-interface
generic-fdflags-extras-interface
generic-network-extras-interface
generic-signals-extras-interface))
(define-interface generic-defs-interface
(compound-interface generic-extras-interface
sockets-network-interface
posix-errno-interface
posix-fdflags-interface
posix-signals-interface
signals-internals-interface))
(define-structure generic-defs generic-defs-interface
(open scheme bitwise defenum-package)
(files fdflags errno signals netconst))
(define-interface os-extras-interface generic-extras-interface)
(define os-dependent generic-defs)

View File

@ -1,30 +0,0 @@
;;; Signal constant definitions for "generic"
;;; Copyright (c) 1994 by Olin Shivers.
;;; Copyright (c) 1994 by Brian D. Carlstrom.
;;POSIX only defined here.
(define-enum-constants signal
;; POSIX
(hup 1) ; hangup
(int 2) ; interrupt
(quit 3) ; quit
(ill 4) ; illegal instruction (not reset when caught)
(iot 6) ; IOT instruction
(abrt 6) ; used by abort, replace SIGIOT in the future
(fpe 8) ; floating point exception
(kill 9) ; kill (cannot be caught or ignored)
(segv 11) ; segmentation violation
(pipe 13) ; write on a pipe with no one to read it
(alrm 14) ; alarm clock
(term 15) ; software termination signal from kill
(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
(ttin 21) ; to readers pgrp upon background tty read
(ttou 22) ; like TTIN for output if (tp->t_local&LTOSTOP)
;; User defined
(usr1 30) ; user defined signal 1
(usr2 31) ; user defined signal 2
)

View File

@ -1,83 +0,0 @@
/* Copyright (c) 1994 by Olin Shivers.
** Copyright (c) 1994-1995 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->_cnt > 0 ? SCHTRUE : char_ready_fdes(fd);
}
void setfileno(FILE *fs, int fd)
{
fileno(fs) = fd;
}
int fbufcount(FILE* fs)
{
return(fs->_cnt);
}
/* Returns true if there is no buffered data in stream FS
** (or there is no buffering, period.)
*/
int ibuf_empty(FILE *fs) {return fs->_cnt <= 0;}
/* Returns true if the buffer in stream FS is full
** (or there is no buffering, period).
*/
int obuf_full(FILE *fs) {return fs->_cnt <= 0;}

View File

@ -1,13 +0,0 @@
/* 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);

View File

View File

@ -1,8 +0,0 @@
;;; 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

View File

@ -1,38 +0,0 @@
/* 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

@ -1,40 +0,0 @@
;;; Scsh routines for analysing exit codes returned by WAIT.
;;; Copyright (c) 1994 by Olin Shivers.
;;;
;;; 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 NeXTSTEP.
;;;
;;; 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 #xFF status))
(bitwise-and #xFF (arithmetic-shift status -8))))
;;; If the process was suspended, return the suspending signal, otw #f.
(define (status:stop-sig status)
(and (not (zero? (bitwise-and status #x40)))
(bitwise-and #x7F (arithmetic-shift status -8))))
;;; If the process terminated abnormally,
;;; return the terminating signal, otw #f.
(define (status:term-sig status)
(and (not (zero? (bitwise-and status #xFF))) ; Didn't exit.
(zero? (bitwise-and status #x40)) ; Not suspended.
(bitwise-and status #x7F)))
;;; 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

View File

@ -1,12 +0,0 @@
;;; Flags that control buffering policy.
;;; Copyright (c) 1993 by Olin Shivers.
;;; 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 #o200) ; _IOLBF
(none 4)) ; _IONBF

View File

@ -1,144 +0,0 @@
;;; HP-UX errno definitions. This file adapted from errno.h on an HP machine.
;;; Copyright (c) 1994 by Olin Shivers.
;;; NOTE: When the hp9000s500 symbol is set, errno.h defines ENOMSG to be 250
;;; instead of 35. What to do? We go with 35 in this file.
(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
(nomem 12) ; Not enough core
(acces 13) ; Permission denied
(fault 14) ; Bad address
(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) ; File table overflow
(mfile 24) ; Too many open files
(notty 25) ; Not a typewriter
(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
(deadlk 45) ; A deadlock would occur
(nolck 46) ; System record lock table was full
(ilseq 47) ; Illegal byte sequence
(notempty 247) ; Directory not empty
(nametoolong 248) ; File name too long
(nosys 251) ; Function not implemented
;; Things in XPG3 not in POSIX or ANSI C.
(notblk 15) ; Block device required
(txtbsy 26) ; Text file busy
(nomsg 35) ; No message of desired type
(idrm 36) ; Identifier removed
;; Things in AES not in XPG3, POSIX or ANSI C.
(loop 249) ; Too many levels of symbolic links
;; Things in HP-UX not in XPG3, POSIX or ANSI C.
;; The error numbers between 37 and 44 are not produced by HP-UX.
;; They will track whatever the UNIX(tm) system does in the future.
(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
(nonet 50) ; Machine is not on the network
(nodata 51) ; no data (for no delay io)
(time 52) ; timer expired
(nosr 53) ; out of streams resources
(nostr 54) ; Device not a stream
(nopkg 55) ; Package not installed
(nolink 57) ; the link has been severed
(adv 58) ; advertise error
(srmnt 59) ; srmount error
(comm 60) ; Communication error on send
(proto 61) ; Protocol error
(multihop 64) ; multihop attempted
(dotdot 66) ; Cross mount point (not really error)
(badmsg 67) ; trying to read unreadable message
(nosym 215) ; symbol does not exist in executable
(users 68) ; For Sun compatibilty, will not occur.
(dquot 69) ; Disc quota exceeded
(stale 70) ; Stale NFS file handle
(remote 71) ; Too many levels of remote in path
;; hp9000s500 only
(unexpect 99) ; Unexpected Error
;; hp9000s300, hp9000s800
;; ipc/network software
;; Argument errors
(notsock 216) ; Socket operation on non-socket
(destaddrreq 217) ; Destination address required
(msgsize 218) ; Message too long
(prototype 219) ; Protocol wrong type for socket
(noprotoopt 220) ; Protocol not available
(protonosupport 221) ; Protocol not supported
(socktnosupport 222) ; Socket type not supported
(opnotsupp 223) ; Operation not supported
(pfnosupport 224) ; Protocol family not supported
(afnosupport 225) ; Address family not supported by
; protocol family
(addrinuse 226) ; Address already in use
(addrnotavail 227) ; Can't assign requested address
;; operational errors
(netdown 228) ; Network is down
(netunreach 229) ; Network is unreachable
(netreset 230) ; Network dropped connection on reset
(connaborted 231) ; Software caused connection abort
(connreset 232) ; Connection reset by peer
(nobufs 233) ; No buffer space available
(isconn 234) ; Socket is already connected
(notconn 235) ; Socket is not connected
(shutdown 236) ; Can't send after socket shutdown
(toomanyrefs 237) ; Too many references: can't splice
(timedout 238) ; Connection timed out
(connrefused 239) ; Connection refused
;; hp9000s800 only
(refused errno/connrefused) ; Double define for NFS
(remoterelease 240) ; Remote peer released connection
(hostdown 241) ; Host is down
(hostunreach 242) ; No route to host
;; endif hp9000s300, hp9000s800
(already 244) ; Operation already in progress
(inprogress 245) ; Operation now in progress
(wouldblock 246) ; Operation would block
;; hp9000s500 only
; (nomsg 250) ; No message of desired type
)

View File

@ -1,47 +0,0 @@
;;; Flags for open(2) and fcntl(2).
;;; Copyright (c) 1993 by Olin Shivers.
(define-enum-constants open
;; POSIX
(read 0)
(write 1)
(read+write 2)
(nonblocking #o200000)
(append #o10)
(no-control-tty #o400000)
(create #o0400)
(truncate #o1000)
(exclusive #o2000)
;; NextStep
(sync #o100000)) ; Synchronous writes
(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-record-lock 5) ; F_GETLK
(set-record-lock-noblock 6) ; F_SETLK
(set-record-lock 7)) ; F_SETLKW
;;; 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
(write 2) ; F_WRLCK
(release 3)) ; F_UNLCK

View File

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

View File

@ -1,128 +0,0 @@
;;; Magic Numbers for Networking
;;; Copyright (c) 1994 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
;;; 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/use-privileged #x4000) ; allocate from privileged port area
;(define socket/cant-signal #x8000) ; prevent SIGPIPE on SS_CANTSENDMORE
(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
(define socket/send-avoid-copy #x1009) ; avoid copy on send
(define socket/receive-avoid-copy #x100a) ; avoid copy on rcv
;;; ip options -- <netinet/in.h>
(define ip/options 1) ; set/get IP per-packet options
(define ip/multicast-if 2) ; set/get ip multicast interface
(define ip/multicast-ttl 3) ; set/get ip multicast timetolive
(define ip/multicast-loop 4) ; set/get ip multicast loopback
(define ip/add-membership 5) ; add an ip group membership
(define ip/drop-membership 6) ; drop an ip group membership
(define ip/time-to-live 16) ; set/get IP time-to-live value
;;; 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
; socket/use-privileged
; socket/cant-signal
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))

View File

@ -1,65 +0,0 @@
;;; Interfaces and packages for the HP-UX specific parts of scsh.
;;; Copyright (c) 1994 by Olin Shivers.
(define-interface hpux-fdflags-extras-interface
(export open/sync))
(define-interface hpux-errno-extras-interface
(export errno/wouldblock))
(define-interface hpux-signals-extras-interface
(export))
(define-interface hpux-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/use-privileged
; socket/cant-signal
socket/send-buffer
socket/receive-buffer
socket/send-low-water
socket/receive-low-water
socket/send-timeout
socket/receive-timeout
socket/error
socket/type
socket/send-avoid-copy ;hpux
socket/receive-avoid-copy ;hpux
;; all options except ip/options & ip/time-to-live hpux specific
ip/options
ip/multicast-if
ip/multicast-ttl
ip/multicast-loop
ip/add-membership
ip/drop-membership
ip/time-to-live
tcp/no-delay
tcp/max-segment))
(define-interface hpux-extras-interface
(compound-interface hpux-errno-extras-interface
hpux-fdflags-extras-interface
hpux-network-extras-interface
hpux-signals-extras-interface))
(define-interface hpux-defs-interface
(compound-interface hpux-extras-interface
sockets-network-interface
posix-errno-interface
posix-fdflags-interface
posix-signals-interface
signals-internals-interface))
(define-structure hpux-defs hpux-defs-interface
(open scheme bitwise defenum-package)
(files fdflags errno signals netconst))
(define-interface os-extras-interface hpux-extras-interface)
(define os-dependent hpux-defs)

View File

@ -1,48 +0,0 @@
;;; Signal constant definitions for HP-UX
;;; Copyright (c) 1994 by Olin Shivers.
;;; Copyright (c) 1994 by Brian D. Carlstrom.
(define-enum-constants signal
(hup 1) ; floating point exception
(int 2) ; Interrupt
(quit 3) ; quit
(ill 4) ; Illegal instruction (not reset when caught)
(trap 5) ; trace trap (not reset when caught)
(abrt 6) ; Process abort signal
(iot signal/abrt) ; IOT instruction
(emt 7) ; EMT instruction
(fpe 8) ; Floating point exception
(kill 9) ; kill (cannot be caught of ignored)
(bus 10) ; bus error
(segv 11) ; Segmentation violation
(sys 12) ; bad argument to system call
(pipe 13) ; write on a pipe with no one to read it
(alrm 14) ; alarm clock
(term 15) ; Software termination signal from kill
(usr1 16) ; user defined signal 1
(usr2 17) ; user defined signal 2
(chld 18) ; Child process terminated or stopped
(cld signal/chld) ; death of a child
(pwr 19) ; power state indication
(vtalrm 20) ; virtual timer alarm
(prof 21) ; profiling timer alarm
(io 22) ; asynchronous I/O
(poll signal/io) ; for HP-UX hpstreams signal
(winch 23) ; window size change signal
(window signal/winch) ; added for compatibility reasons
(stop 24) ; Stop signal (cannot be caught or ignored)
(tstp 25) ; Interactive stop signal
(cont 26) ; Continue if stopped
(ttin 27) ; Read from control terminal attempted by a
; member of a background process group
(ttou 28) ; Write to control terminal attempted by a
; member of a background process group
(urg 29) ; urgent condition on IO channel
(lost 30) ; remote lock lost (NFS)
; Signal 31 is reserved for future use.
(dil 32)) ; DIL signal
(define signals-ignored-by-default
(list signal/chld signal/cont ; These are Posix.
signal/io signal/pwr signal/urg signal/winch)) ; These are HP-UX.

View File

@ -1,99 +0,0 @@
/* 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, /* 1: SIGHUP */
scshint_keyboard, /* 2: SIGINT */
scshint_quit, /* 3: SIGQUIT */
-1, /* 4: SIGILL */
-1, /* 5: SIGTRAP */
-1, /* 6: SIGABRT */
-1, /* 7: SIGEMT */
-1, /* 8: SIGFPE */
-1, /* 9: SIGKILL */
-1, /* 10: SIGBUS */
-1, /* 11: SIGSEGV */
-1, /* 12: SIGSYS */
-1, /* 13: SIGPIPE */
scshint_alarm, /* 14: SIGALRM */
scshint_term, /* 15: SIGTERM */
scshint_usr1, /* 16: SIGUSR1 */
scshint_usr2, /* 17: SIGUSR2 */
scshint_chld, /* 18: SIGCHLD */
scshint_pwr, /* 19: SIGPWR */
scshint_vtalrm, /* 20: SIGVTALRM */
scshint_prof, /* 21: SIGPROF */
scshint_io, /* 22: SIGIO */
scshint_winch, /* 23: SIGWINCH */
-1, /* 24: SIGSTOP */
scshint_tstp, /* 25: SIGTSTP */
scshint_cont, /* 26: SIGCONT */
-1, /* 27: SIGTTIN */ /* scshint_ttyin */
-1, /* 28: SIGTTOU */ /* scshint_ttyou */
scshint_urg, /* 29: SIGURG */
-1, /* 30: SIGLOST */
-1, /* 32: SIGDIL */
scshint_xcpu, /* 33: SIGXCPU */
scshint_xfsz /* 34: SIGXFSZ */
};
const int max_sig = 34; /* SIGXFSZ */
/*
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
scshint_alarm
scshint_chld
scshint_cont
scshint_hup
scshint_info
scshint_io
scshint_keyboard
scshint_memory_shortage
scshint_poll
scshint_prof
scshint_pwr
scshint_quit
scshint_term
scshint_tstp
scshint_urg
scshint_usr1
scshint_usr2
scshint_vtalrm
scshint_winch
scshint_xcpu
scshint_xfsz
*/

View File

@ -1,10 +0,0 @@
/* 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)->sigset[0]=((hi)<<24)|(lo))
/* Not a procedure: */
#define split_sigset(mask, hip, lop) \
((*(hip)=((mask).sigset[0]>>24)&0xff), \
(*(lop)=((mask).sigset[0]&0xffffff)))

View File

@ -1,84 +0,0 @@
/* Copyright (c) 1994 by Olin Shivers.
** Copyright (c) 1994-1995 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->_cnt > 0 ? SCHTRUE : char_ready_fdes(fd);
}
void setfileno(FILE *fs, int fd)
{
fs->__fileL = (fd & 0xFF);
fs->__fileH = ((fd>>8) & 0xFF);
}
int fbufcount(FILE* fs)
{
return(fs->_cnt);
}
/* Returns true if there is no buffered data in stream FS
** (or there is no buffering, period.)
*/
int ibuf_empty(FILE *fs) {return fs->_cnt <= 0;}
/* Returns true if the buffer in stream FS is full
** (or there is no buffering, period).
*/
int obuf_full(FILE *fs) {return fs->_cnt <= 0;}

View File

@ -1,13 +0,0 @@
/* 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);

View File

View File

@ -1,8 +0,0 @@
;;; 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

View File

@ -1,38 +0,0 @@
/* 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

@ -1,228 +0,0 @@
;;; Constant definitions for tty control code (POSIX termios).
;;; Copyright (c) 1995 by Brian Carlstrom.
;;; Largely rehacked by Olin.
;;; These constants are for HP-UX,
;;; and are taken from /usr/include/sys/termio.h.
;;; Non-standard (POSIX, SVR4, 4.3+BSD) things:
;;; - Some of the baud rates.
;;; Special Control Characters
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; Indices into the c_cc[] character array.
;;; Name Subscript Enabled by
;;; ---- --------- ----------
;;; POSIX
(define ttychar/eof 4) ; ^d icanon
(define ttychar/eol 5) ; icanon
(define ttychar/delete-char 2) ; ^? icanon
(define ttychar/delete-line 3) ; ^u icanon
(define ttychar/interrupt 0) ; ^c isig
(define ttychar/quit 1) ; ^\ isig
(define ttychar/suspend 13) ; ^z isig
(define ttychar/start 14) ; ^q ixon, ixoff
(define ttychar/stop 15) ; ^s ixon, ixoff
(define ttychar/min 11) ; !icanon ; Not exported
(define ttychar/time 12) ; !icanon ; Not exported
;;; SVR4 & 4.3+BSD
(define ttychar/delete-word #f) ; ^w icanon
(define ttychar/reprint #f) ; ^r icanon
(define ttychar/literal-next #f) ; ^v iexten
(define ttychar/discard #f) ; ^o iexten
(define ttychar/delayed-suspend #f) ; ^y isig
(define ttychar/eol2 #f) ; icanon
;;; 4.3+BSD
(define ttychar/status #f) ; ^t icanon
;;; Length of control-char string -- *Not Exported*
(define num-ttychars 16)
;;; Magic "disable feature" tty character
(define disable-tty-char (ascii->char #xff)) ; _POSIX_VDISABLE
;;; HP-UX brain death:
;;; HP-UX defines NCCS to be 16, then sneaks the DSUSP char (^y) in as
;;; a seventeenth char -- there's another non-standard NLDCC constant
;;; defined to be 1+16 that's used elsewhere. Since the scsh interface
;;; to tcsetattr() uses a char vec of size NCCS, you can't get at this
;;; hidden char. So we do not support the delayed-suspension char; sorry.
;;;
;;; If you are an HP-UX hacker, and know a way to fix this, let me know.
;;; 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 #o00010) ; 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 #o4000) ; ixany: Any char restarts after stop
(define ttyin/beep-on-overflow #f) ; imaxbel: queue full => ring bell
;;; SVR4
(define ttyin/lowercase #o1000) ; iuclc: Map upper-case to lower case
;;; Flags controlling output processing
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; POSIX
(define ttyout/enable #o000001) ; opost: enable output processing
;;; SVR4 & 4.3+BSD
(define ttyout/nl->crnl #o000004) ; 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 #o000010) ; ocrnl
(define ttyout/fill-w/del #o000200) ; ofdel
(define ttyout/delay-w/fill-char #o000100) ; ofill
(define ttyout/uppercase #o000002) ; olcuc
(define ttyout/nl-does-cr #o000040) ; onlret
(define ttyout/no-col0-cr #o000020) ; onocr
;;; Newline delay
(define ttyout/nl-delay #o000400) ; mask (nldly)
(define ttyout/nl-delay0 #o000000)
(define ttyout/nl-delay1 #o000400) ; tty 37
;;; Horizontal-tab delay
(define ttyout/tab-delay #o014000) ; mask (tabdly)
(define ttyout/tab-delay0 #o000000)
(define ttyout/tab-delay1 #o004000) ; tty 37
(define ttyout/tab-delay2 #o010000)
(define ttyout/tab-delayx #o014000) ; Expand tabs (xtabs, tab3)
;;; Carriage-return delay
(define ttyout/cr-delay #o003000) ; mask (crdly)
(define ttyout/cr-delay0 #o000000)
(define ttyout/cr-delay1 #o001000) ; tn 300
(define ttyout/cr-delay2 #o002000) ; tty 37
(define ttyout/cr-delay3 #o003000) ; concept 100
;;; Vertical tab delay
(define ttyout/vtab-delay #o040000) ; mask (vtdly)
(define ttyout/vtab-delay0 #o000000)
(define ttyout/vtab-delay1 #o040000) ; tty 37
;;; Backspace delay
(define ttyout/bs-delay #o020000) ; mask (bsdly)
(define ttyout/bs-delay0 #o000000)
(define ttyout/bs-delay1 #o020000)
;;; Form-feed delay
(define ttyout/ff-delay #o100000) ; mask (ffdly)
(define ttyout/ff-delay0 #o000000)
(define ttyout/ff-delay1 #o100000)
(define ttyout/all-delay
(bitwise-ior (bitwise-ior (bitwise-ior ttyout/nl-delay ttyout/tab-delay)
(bitwise-ior ttyout/cr-delay ttyout/vtab-delay))
(bitwise-ior ttyout/bs-delay ttyout/ff-delay)))
;;; Control flags - hacking the serial-line.
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; POSIX
(define ttyc/char-size #o00140) ; csize: character size mask
(define ttyc/char-size5 #o00000) ; 5 bits (cs5)
(define ttyc/char-size6 #o00040) ; 6 bits (cs6)
(define ttyc/char-size7 #o00100) ; 7 bits (cs7)
(define ttyc/char-size8 #o00140) ; 8 bits (cs8)
(define ttyc/2-stop-bits #o00200) ; cstopb: Send 2 stop bits.
(define ttyc/enable-read #o00400) ; cread: Enable receiver.
(define ttyc/enable-parity #o01000) ; parenb
(define ttyc/odd-parity #o02000) ; parodd
(define ttyc/hup-on-close #o04000) ; hupcl: Hang up on last close.
(define ttyc/no-modem-sync #o10000) ; 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 #o020) ; echoe: Visually erase chars
(define ttyl/echo-delete-line #o040) ; echok: Echo nl after line kill
(define ttyl/echo #o010) ; echo: Enable echoing
(define ttyl/echo-nl #o100) ; echonl: Echo nl even if echo is off
(define ttyl/canonical #o002) ; icanon: Canonicalize input
(define ttyl/enable-signals #o001) ; isig: Enable ^c, ^z signalling
(define ttyl/extended #o20000000000); iexten: Enable extensions
(define ttyl/ttou-signal #o10000000000); tostop: SIGTTOU on background output
(define ttyl/no-flush-on-interrupt #o200) ; noflsh
;;; SVR4 & 4.3+BSD
(define ttyl/visual-delete-line #f) ; echoke: visually erase a line-kill
(define ttyl/hardcopy-delete #f) ; echoprt: visual erase for hardcopy
(define ttyl/echo-ctl #f) ; echoctl: echo control chars as "^X"
(define ttyl/flush-output #f) ; 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 #o4) ; 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 . 900) (10 . 1200) (11 . 1800)
(12 . 2400) (13 . 3600) (14 . 4800)
(15 . 7200) (16 . 9600) (17 . 19200)
(18 . 38400) (19 . 57600) (20 . 115200)
(21 . 230400) (22 . 460800) ; 23-29 unused.
(30 . exta) (31 . extb)))
;;; tcflush() constants
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(define %flush-tty/input 0) ; TCIFLUSH
(define %flush-tty/output 1) ; TCOFLUSH
(define %flush-tty/both 2) ; TCIOFLUSH
;;; tcflow() constants
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(define %tcflow/start-out 1) ; TCOON
(define %tcflow/stop-out 0) ; TCOOFF
(define %tcflow/start-in 3) ; TCION
(define %tcflow/stop-in 2) ; TCIOFF
;;; tcsetattr() constants
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(define %set-tty-info/now 0) ; TCSANOW Make change immediately.
(define %set-tty-info/drain 1) ; TCSADRAIN Drain output, then change.
(define %set-tty-info/flush 2) ; TCSAFLUSH Drain output, flush input.

View File

@ -1,40 +0,0 @@
;;; Scsh routines for analysing exit codes returned by WAIT.
;;; Copyright (c) 1994 by Olin Shivers.
;;;
;;; 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 HPUX.
;;;
;;; 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 #xFF status))
(bitwise-and #xFF (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 #xFF))
(bitwise-and #xFF (arithmetic-shift status -8))))
;;; If the process terminated abnormally,
;;; return the terminating signal, otw #f.
(define (status:term-sig status)
(let ((low-byte (bitwise-and status #xFF)))
(and (not (= low-byte 0)) ; Didn't exit.
(not (= low-byte #x7F)) ; Not suspended.
(bitwise-and status #x7F))))
;;; 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

View File

@ -1,13 +0,0 @@
;;; Flags that control buffering policy.
;;; Copyright (c) 1993 by Olin Shivers.
;;; Copyright (c) 1995 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 #o100) ; _IOLBF
(none 4)) ; _IONBF

View File

@ -1,158 +0,0 @@
;;; Errno constant definitions.
;;; Copyright (c) 1993 by Olin Shivers.
;;; These are the correct values for my SparcStation.
(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 function call
(io 5) ; Input/output error
(nxio 6) ; No such device or address
; (2big 7) ; Arg list too long
(noexec 8) ; Exec format error
(badf 9) ; Bad file descriptor
(child 10) ; No child processes
(again 11) ; Resource temporarily unavailable
(nomem 12) ; Not enough space
(acces 13) ; Permission denied
(fault 14) ; Bad address
(notblk 15) ; Block device required
(busy 16) ; Resource busy
(exist 17) ; File exists
(xdev 18) ; Improper 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) ; Inappropriate I/O control operation
(xtbsy 26) ; Text file busy
(fbig 27) ; File too large
(nospc 28) ; No space left on device
(spipe 29) ; Invalid seek
(rofs 30) ; Read-only file system
(mlink 31) ; Too many links
(pipe 32) ; Broken pipe
;; POSIX:
;; math software
(dom 33) ; Domain error
(range 34) ; Result too large
;; SystemV IPC
(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
;; POSIX
;; SystemV Record Locking
(deadlk 45) ; Resource deadlock avoided
(nolck 46) ; No locks available
(bade 50) ; bad exchange descriptor
(badr 51) ; bad request descriptor
(xfull 52) ; message tables full
(noano 53) ; anode table overflow
(badrqc 54) ; bad request code
(badslt 55) ; invalid slot
(deadlock 56) ; file locking deadlock
(bfont 57) ; bad font file format
;; streams
(nostr 60) ; Device is not a stream
(time 62) ; Timer expired
(nosr 63) ; Out of streams resources
(nomsg 35) ; No message of desired type
(badmsg 77) ; Trying to read unreadable message
;; RFS
(nonet 64) ; Machine is not on the network
(rremote 66) ; 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
; (dotdot ) ; Cross mount point (not an error)
(notuniq 80) ; name not unique on network
(badfd 81) ; file descriptor in bad state
(remchg 82) ; Remote address changed
(libacc 83) ; can not 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 more shared libraries than system limit
(libexec 87) ; can not exec a shared library directly
(nosys 88) ; irix uses einval; posix wants enosys
;; POSIX
(nosys 88) ; function not implemented
;; non-blocking and interrupt i/o
(wouldblock 101) ; Operation would block
(inprogress 102) ; Operation now in progress
(already 103) ; Operation already in progress
;; ipc/network software
;; argument errors
(notsock 104) ; Socket operation on non-socket
(destaddrreq 105) ; Destination address required
(msgsize 106) ; Message too long
(prototype 107) ; Protocol wrong type for socket
(noprotoopt 108) ; Protocol not available
(protonosupport 109) ; Protocol not supported
(socktnosupport 110) ; Socket type not supported
(opnotsupp 111) ; Operation not supported on socket
(pfnosupport 112) ; Protocol family not supported
(afnosupport 113) ; Address family not supported by protocol family
(addrinuse 114) ; Address already in use
(addrnotavail 115) ; Can't assign requested address
;; operational errors
(netdown 116) ; Network is down
(netunreach 117) ; Network is unreachable
(netreset 118) ; Network dropped connection on reset
(connaborted 119) ; Software caused connection abort
(connreset 120) ; Connection reset by peer
(nobufs 121) ; No buffer space available
(isconn 122) ; Socket is already connected
(notconn 123) ; Socket is not connected
(shutdown 124) ; Can't send after socket shutdown
(toomanyrefs 125) ; Too many references: can't splice
(timedout 126) ; Connection timed out
(connrefused 127) ; Connection refused
(hostdown 128) ; Host is down
(hostunreach 129) ; No route to host
(loop 130) ; Too many levels of symbolic links
;; POSIX:
(nametoolong 131) ; File name too long
;; POSIX:
(notempty 132) ; Directory not empty
;; quotas & mush
; (proclim ) ; Too many processes
(users 133) ; Too many users
(dquot 134) ; Disc quota exceeded
;; Network File System
(stale 135) ; Stale NFS file handle
(remote 136) ; Too many levels of remote in path
)

View File

@ -1,47 +0,0 @@
;;; Flags for open(2) and fcntl(2).
;;; Copyright (c) 1993 by Olin Shivers.
(define-enum-constants open
(read 0)
(write 1)
(read+write 2)
(append 8)
(create #x100)
(exclusive #x400)
(no-control-tty #x800)
(nonblocking #x80)
(truncate #x200)
;;; Not POSIX.
(no-delay 4)
(sync #x10))
(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-record-lock 5) ; F_GETLK
(set-record-lock-noblock 6) ; F_SETLK
(set-record-lock 7)) ; F_SETLKW
;;; 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
(write 2) ; F_WRLCK
(release 3)) ; F_UNLCK

View File

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

View File

@ -1,126 +0,0 @@
;;; Magic Numbers for Networking
;;; Copyright (c) 1994 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 2) ; stream socket
(define socket-type/datagram 1) ; 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
;;; 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/reuse-port #x020) ; allow local address,port reuse
;(define socket/use-privileged #x4000) ; allocate from privileged port area
;(define socket/cant-signal #x8000) ; prevent SIGPIPE on SS_CANTSENDMORE
(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 -- <netinet/in.h>
(define ip/options 1) ; set/get IP per-packet options
(define ip/include-header 7) ; int; header is included with data (raw)
(define ip/type-of-service 8) ; int; ip type of service and precedence
(define ip/time-to-live 9) ; set/get IP time-to-live value
;;; 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
; socket/use-privileged
; socket/cant-signal
ip/include-header
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/type-of-service
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))

View File

@ -1,152 +0,0 @@
;;; Interfaces and packages for the machine specific parts of scsh.
;;; This is the IRIX version.
;;; Copyright (c) 1994 by Olin Shivers.
;;; Copyright (c) 1994 by Brian D. Carlstrom.
(define-interface irix-fdflags-extras-interface
(export open/no-delay
open/sync))
(define-interface irix-errno-extras-interface
(export errno/addrinuse
errno/addrnotavail
errno/adv
errno/afnosupport
errno/already
errno/badmsg
errno/comm
errno/connaborted
errno/connrefused
errno/connreset
errno/destaddrreq
; errno/dotdot
errno/dquot
errno/hostdown
errno/hostunreach
errno/idrm
errno/inprogress
errno/isconn
errno/loop
errno/msgsize
errno/multihop
errno/netdown
errno/netreset
errno/netunreach
errno/nobufs
errno/nolink
errno/nomsg
errno/nonet
errno/noprotoopt
errno/nosr
errno/nostr
errno/notblk
errno/notconn
errno/notsock
errno/opnotsupp
errno/pfnosupport
; errno/proclim
errno/proto
errno/protonosupport
errno/prototype
errno/remchg
errno/remote
errno/rremote
errno/shutdown
errno/socktnosupport
errno/srmnt
errno/stale
errno/time
errno/timedout
errno/toomanyrefs
errno/users
errno/wouldblock
errno/xtbsy
errno/chrng
errno/l2nsync
errno/l3hlt
errno/l3rst
errno/lnrng
errno/unatch
errno/nocsi
errno/l2hlt
errno/bade
errno/badr
errno/xfull
errno/noano
errno/badrqc
errno/badslt
errno/deadlock
errno/bfont
errno/libacc
errno/libbad
errno/libscn
errno/libmax
errno/libexec
))
(define-interface irix-signals-extras-interface
(export signal/cld
signal/iot
signal/pwr
signal/poll
signal/io
signal/urg
signal/winch
signal/vtalrm
signal/prof
signal/xcpu
signal/xfsz
))
(define-interface irix-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/reuse-port ;irix
; socket/use-privileged
; socket/cant-signal
socket/send-buffer
socket/receive-buffer
socket/send-low-water
socket/receive-low-water
socket/send-timeout
socket/receive-timeout
socket/error
socket/type
ip/options
ip/time-to-live
ip/include-header ;irix
ip/type-of-service ;irix
tcp/no-delay
tcp/max-segment))
(define-interface irix-extras-interface
(compound-interface irix-errno-extras-interface
irix-fdflags-extras-interface
irix-network-extras-interface
irix-signals-extras-interface))
(define-interface irix-defs-interface
(compound-interface irix-extras-interface
sockets-network-interface
posix-errno-interface
posix-fdflags-interface
posix-signals-interface
signals-internals-interface))
(define-structure irix-defs irix-defs-interface
(open scheme bitwise defenum-package)
(files fdflags errno signals netconst))
(define-interface os-extras-interface irix-extras-interface)
(define os-dependent irix-defs)

View File

@ -1,43 +0,0 @@
;;; Signal constant definitions for "irix"
;;; Copyright (c) 1994 by Olin Shivers.
;;; Copyright (c) 1994 by Brian D. Carlstrom.
;;POSIX only defined here.
(define-enum-constants signal
;; POSIX
(hup 1) ; hangup
(int 2) ; interrupt
(quit 3) ; quit
(ill 4) ; illegal instruction (not reset when caught)
(iot 6) ; IOT instruction
(abrt 6) ; used by abort, replace SIGIOT in the future
(fpe 8) ; floating point exception
(kill 9) ; kill (cannot be caught or ignored)
(bus 10) ; bus error
(segv 11) ; segmentation violation
(sys 12) ; bad argument to system call
(pipe 13) ; write on a pipe with no one to read it
(alrm 14) ; alarm clock
(term 15) ; software termination signal from kill
(stop 20) ; sendable stop signal not from tty
(tstp 21) ; stop signal from tty
(cont 28) ; continue a stopped process
(chld 18) ; to parent on child stop or exit
(cld 18) ; compat
(ttin 29) ; to readers pgrp upon background tty read
(ttou 30) ; like TTIN for output if (tp->t_local&LTOSTOP)
;; User defined
(usr1 16) ; user defined signal 1
(usr2 17) ; user defined signal 2
(pwr 19) ; power-fail restart
(poll 22) ; pollable event occurred
(io 23) ; input/output possible signal
(urg 24) ; urgent condition on io channel
(winch 25) ; window size changes
(vtalrm 26) ; virtual time alarm
(prof 27) ; profiling alarm
(xcpu 31) ; Cpu time limit exceeded
(xfsz 32) ; Filesize limit exceeded
)

View File

@ -1,10 +0,0 @@
/* 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)->sigbits[0]=((hi)<<24)|(lo))
/* Not a procedure: */
#define split_sigset(mask, hip, lop) \
((*(hip)=((mask).sigbits[0]>>24)&0xff), \
(*(lop)=((mask).sigbits[0]&0xffffff)))

View File

@ -1,83 +0,0 @@
/* Copyright (c) 1994 by Olin Shivers.
** Copyright (c) 1994-1995 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->_cnt > 0 ? SCHTRUE : char_ready_fdes(fd);
}
void setfileno(FILE *fs, int fd)
{
fileno(fs) = fd;
}
int fbufcount(FILE* fs)
{
return(fs->_cnt);
}
/* Returns true if there is no buffered data in stream FS
** (or there is no buffering, period.)
*/
int ibuf_empty(FILE *fs) {return fs->_cnt <= 0;}
/* Returns true if the buffer in stream FS is full
** (or there is no buffering, period).
*/
int obuf_full(FILE *fs) {return fs->_cnt <= 0;}

View File

@ -1,13 +0,0 @@
/* 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);

View File

View File

@ -1,8 +0,0 @@
;;; 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

View File

@ -1,38 +0,0 @@
/* 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

@ -1,216 +0,0 @@
;;; Constant definitions for tty control code (POSIX termios).
;;; Copyright (c) 1995 by Brian Carlstrom.
;;; Largely rehacked by Olin.
;;; These constants are for IRIX,
;;; and are taken from /usr/include/sys/termio.h
;;; and /usr/include/sys/termios.h
;;; and /usr/include/sys/ttydev.h (baud rates).
;;; Non-standard (POSIX, SVR4, 4.3+BSD) things:
;;; - Some of the baud rates.
;;; Special Control Characters
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; Indices into the c_cc[] character array.
;;; Name Subscript Enabled by
;;; ---- --------- ----------
;;; POSIX
(define ttychar/eof 4) ; ^d icanon
(define ttychar/eol 5) ; icanon
(define ttychar/delete-char 2) ; ^? icanon
(define ttychar/delete-line 3) ; ^u icanon
(define ttychar/interrupt 0) ; ^c isig
(define ttychar/quit 1) ; ^\ isig
(define ttychar/suspend 10) ; ^z isig
(define ttychar/start 8) ; ^q ixon, ixoff
(define ttychar/stop 9) ; ^s ixon, ixoff
(define ttychar/min 4) ; !icanon ; Not exported
(define ttychar/time 5) ; !icanon ; Not exported
;;; SVR4 & 4.3+BSD
(define ttychar/delete-word 14) ; ^w icanon
(define ttychar/reprint 12) ; ^r icanon
(define ttychar/literal-next 15) ; ^v iexten
(define ttychar/discard 13) ; ^o iexten
(define ttychar/delayed-suspend 11) ; ^y isig
(define ttychar/eol2 6) ; icanon
;;; 4.3+BSD
(define ttychar/status #f) ; ^t icanon
;;; Length of control-char string -- *Not Exported*
(define num-ttychars 23)
;;; Magic "disable feature" tty character
(define disable-tty-char (ascii->char #x00)) ; _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 #o00010) ; 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 #o4000) ; ixany: Any char restarts after stop
(define ttyin/beep-on-overflow #o20000) ; imaxbel: queue full => ring bell
;;; SVR4
(define ttyin/lowercase #o1000) ; iuclc: Map upper-case to lower case
;;; Flags controlling output processing
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; POSIX
(define ttyout/enable #o000001) ; opost: enable output processing
;;; SVR4 & 4.3+BSD
(define ttyout/nl->crnl #o000004) ; 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 #o000010) ; ocrnl
(define ttyout/fill-w/del #o000200) ; ofdel
(define ttyout/delay-w/fill-char #o000100) ; ofill
(define ttyout/uppercase #o000002) ; olcuc
(define ttyout/nl-does-cr #o000040) ; onlret
(define ttyout/no-col0-cr #o000020) ; onocr
;;; Newline delay
(define ttyout/nl-delay #o000400) ; mask (nldly)
(define ttyout/nl-delay0 #o000000)
(define ttyout/nl-delay1 #o000400) ; tty 37
;;; Horizontal-tab delay
(define ttyout/tab-delay #o014000) ; mask (tabdly)
(define ttyout/tab-delay0 #o000000)
(define ttyout/tab-delay1 #o004000) ; tty 37
(define ttyout/tab-delay2 #o010000)
(define ttyout/tab-delayx #o014000) ; Expand tabs (xtabs, tab3)
;;; Carriage-return delay
(define ttyout/cr-delay #o003000) ; mask (crdly)
(define ttyout/cr-delay0 #o000000)
(define ttyout/cr-delay1 #o001000) ; tn 300
(define ttyout/cr-delay2 #o002000) ; tty 37
(define ttyout/cr-delay3 #o003000) ; concept 100
;;; Vertical tab delay
(define ttyout/vtab-delay #o040000) ; mask (vtdly)
(define ttyout/vtab-delay0 #o000000)
(define ttyout/vtab-delay1 #o040000) ; tty 37
;;; Backspace delay
(define ttyout/bs-delay #o020000) ; mask (bsdly)
(define ttyout/bs-delay0 #o000000)
(define ttyout/bs-delay1 #o020000)
;;; Form-feed delay
(define ttyout/ff-delay #o100000) ; mask (ffdly)
(define ttyout/ff-delay0 #o000000)
(define ttyout/ff-delay1 #o100000)
(define ttyout/all-delay
(bitwise-ior (bitwise-ior (bitwise-ior ttyout/nl-delay ttyout/tab-delay)
(bitwise-ior ttyout/cr-delay ttyout/vtab-delay))
(bitwise-ior ttyout/bs-delay ttyout/ff-delay)))
;;; 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 #o020) ; echoe: Visually erase chars
(define ttyl/echo-delete-line #o040) ; echok: Echo nl after line kill
(define ttyl/echo #o010) ; echo: Enable echoing
(define ttyl/echo-nl #o100) ; echonl: Echo nl even if echo is off
(define ttyl/canonical #o002) ; icanon: Canonicalize input
(define ttyl/enable-signals #o001) ; isig: Enable ^c, ^z signalling
(define ttyl/extended #o400) ; iexten: Enable extensions
(define ttyl/ttou-signal #o100000) ; tostop: SIGTTOU on background output
(define ttyl/no-flush-on-interrupt #o200) ; noflsh
;;; SVR4 & 4.3+BSD
(define ttyl/visual-delete-line #o04000) ; echoke: visually erase a line-kill
(define ttyl/hardcopy-delete #o02000) ; echoprt: visual erase for hardcopy
(define ttyl/echo-ctl #o01000) ; echoctl: echo control chars as "^X"
(define ttyl/flush-output #o20000) ; flusho: output is being flushed
(define ttyl/reprint-unread-chars #o40000) ; 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 #o4) ; 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) (14 . exta) (15 . extb)))
;;; tcflush() constants
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(define %flush-tty/input 0) ; TCIFLUSH
(define %flush-tty/output 1) ; TCOFLUSH
(define %flush-tty/both 2) ; TCIOFLUSH
;;; tcflow() constants
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(define %tcflow/start-out 1) ; TCOON
(define %tcflow/stop-out 0) ; TCOOFF
(define %tcflow/start-in 3) ; TCION
(define %tcflow/stop-in 2) ; TCIOFF
;;; tcsetattr() constants
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(define %set-tty-info/now 0) ; TCSANOW Make change immediately.
(define %set-tty-info/drain 1) ; TCSADRAIN Drain output, then change.
(define %set-tty-info/flush 2) ; TCSAFLUSH Drain output, flush input.

View File

@ -1,40 +0,0 @@
;;; Scsh routines for analysing exit codes returned by WAIT.
;;; Copyright (c) 1994 by Olin Shivers.
;;;
;;; 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 IRIX.
;;;
;;; 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 (not (= (bitwise-and #xFF status) #x7F))
(zero? (bitwise-and #x7F status))
(bitwise-and #xFF (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 #xFF))
(bitwise-and #xFF (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 (bitwise-and status #xFF))) ; 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

@ -1,13 +0,0 @@
;;; Flags that control buffering policy.
;;; Copyright (c) 1993 by Olin Shivers.
;;; Copyright (c) 1995 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

View File

@ -1,139 +0,0 @@
;;; Errno constant definitions.
;;; Copyright (c) 1993 by Olin Shivers.
;;; Copyright (c) 1994 by Brian D. Carlstrom.
;;; These are the correct values for Linux systems.
(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

View File

@ -1,57 +0,0 @@
;;; Flags for open(2) and fcntl(2).
;;; Copyright (c) 1993 by Olin Shivers.
;;; Copyright (c) 1994 by Brian D. Carlstrom
(define-enum-constants open
;; POSIX
(read #x0000)
(write #x0001)
(read+write #x0002)
(nonblocking #x0800) ; no delay
(append #x0400) ; set append mode
;; Linux
(shared-lock #x0004) ; open with shared file lock
(exclusive-lock #x0008) ; open with exclusive file lock
(async #x2000) ; signal pgrep when data ready
(fsync #x1000) ; synchronus writes
;; POSIX
(create #x0040) ; create if nonexistant
(truncate #x0200) ; truncate to zero length
(exclusive #x0080) ; error if already exists
(no-control-tty #x0100)) ; don't assign controlling terminal
(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 9) ; F_GETOWN (Not POSIX)
(set-owner 8) ; F_SETOWN (Not POSIX)
(get-record-lock 5) ; F_GETLK
(set-record-lock-noblock 6) ; F_SETLK
(set-record-lock 7)) ; F_SETLKW
;;; 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 0) ; F_RDLCK
(release 2) ; F_UNLCK
(write 1)) ; F_WRLCK

View File

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

Some files were not shown because too many files have changed in this diff Show More