*** empty log message ***
This commit is contained in:
parent
a84e466c05
commit
946798634a
|
@ -311,7 +311,7 @@ clean: clean-scsh
|
|||
|
||||
distclean: clean
|
||||
$(RM) Makefile sysdep.h config.status config.log config.cache \
|
||||
scsh/machine scsh/regexp/Makefile scsh/network.scm
|
||||
scsh/machine scsh/regexp/Makefile scsh/endian.scm
|
||||
|
||||
man: $(MANPAGE)
|
||||
|
||||
|
@ -537,6 +537,7 @@ scsh: cig scsh/scsh scsh/scsh.image
|
|||
SCHEME =scsh/awk.scm \
|
||||
scsh/char-set.scm \
|
||||
scsh/defrec.scm \
|
||||
scsh/endian.scm \
|
||||
scsh/enumconst.scm \
|
||||
scsh/fdports.scm \
|
||||
scsh/fileinfo.scm \
|
||||
|
|
|
@ -325,4 +325,4 @@ AC_SUBST(ENDIAN)
|
|||
AC_SUBST(LDFLAGS)
|
||||
AC_SUBST(LDFLAGS_AIX)
|
||||
|
||||
AC_OUTPUT(Makefile scsh/regexp/Makefile scsh/network.scm)
|
||||
AC_OUTPUT(Makefile scsh/regexp/Makefile scsh/endian.scm)
|
||||
|
|
|
@ -0,0 +1,36 @@
|
|||
;;; Endian routines for the Scheme Shell
|
||||
;;; Copyright (c) 1995 by Brian D. Carlstrom.
|
||||
|
||||
;; Big Endian - Motorola, Sparc, HPPA, etc
|
||||
(define (net-to-host-32-big num32)
|
||||
(and (<= 0 num32 #xffffffff)
|
||||
num32))
|
||||
|
||||
(define (net-to-host-16-big num16)
|
||||
(and (<= 0 num16 #xffffffff)
|
||||
num16))
|
||||
|
||||
;; Little Endian - Intel, Vax, Alpha
|
||||
(define (net-to-host-32-little num32)
|
||||
(and (<= 0 num32 #xffffffff)
|
||||
(let* ((num24 (arithmetic-shift num32 -8))
|
||||
(num16 (arithmetic-shift num24 -8))
|
||||
(num08 (arithmetic-shift num16 -8))
|
||||
(byte0 (bitwise-and #b11111111 num08))
|
||||
(byte1 (bitwise-and #b11111111 num16))
|
||||
(byte2 (bitwise-and #b11111111 num24))
|
||||
(byte3 (bitwise-and #b11111111 num32)))
|
||||
(+ (arithmetic-shift byte3 24)
|
||||
|
||||
(define (net-to-host-16-little num16)
|
||||
(and (<= 0 num16 #xffffffff)
|
||||
(let* ((num08 (arithmetic-shift num16 -8))
|
||||
(byte0 (bitwise-and #b11111111 num08))
|
||||
(byte1 (bitwise-and #b11111111 num16))
|
||||
(+ (arithmetic-shift byte1 8)
|
||||
byte0))))
|
||||
|
||||
(define net-to-host-32 net-to-host-32-@ENDIAN@)
|
||||
(define net-to-host-16 net-to-host-16-@ENDIAN@)
|
||||
(define host-to-net-32 host-to-net-32-@ENDIAN@)
|
||||
(define host-to-net-16 host-to-net-16-@ENDIAN@)
|
|
@ -935,43 +935,6 @@
|
|||
(C char**) ; alias list
|
||||
integer) ; protocol number
|
||||
|
||||
;;;-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
|
||||
;;; Endian Conversion routines
|
||||
;;;-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
|
||||
;; Big Endian - Motorola, Sparc, HPPA, etc
|
||||
(define (net-to-host-32-big num32)
|
||||
(and (<= 0 num32 #xffffffff)
|
||||
num32))
|
||||
|
||||
(define (net-to-host-16-big num16)
|
||||
(and (<= 0 num16 #xffffffff)
|
||||
num16))
|
||||
|
||||
;; Little Endian - Intel, Vax, Alpha
|
||||
(define (net-to-host-32-little num32)
|
||||
(and (<= 0 num32 #xffffffff)
|
||||
(let* ((num24 (arithmetic-shift num32 -8))
|
||||
(num16 (arithmetic-shift num24 -8))
|
||||
(num08 (arithmetic-shift num16 -8))
|
||||
(byte0 (bitwise-and #b11111111 num08))
|
||||
(byte1 (bitwise-and #b11111111 num16))
|
||||
(byte2 (bitwise-and #b11111111 num24))
|
||||
(byte3 (bitwise-and #b11111111 num32)))
|
||||
(+ (arithmetic-shift byte3 24)
|
||||
|
||||
(define (net-to-host-16-little num16)
|
||||
(and (<= 0 num16 #xffffffff)
|
||||
(let* ((num08 (arithmetic-shift num16 -8))
|
||||
(byte0 (bitwise-and #b11111111 num08))
|
||||
(byte1 (bitwise-and #b11111111 num16))
|
||||
(+ (arithmetic-shift byte1 8)
|
||||
byte0))))
|
||||
|
||||
(define net-to-host-32 net-to-host-32-@ENDIAN@)
|
||||
(define net-to-host-16 net-to-host-16-@ENDIAN@)
|
||||
(define host-to-net-32 host-to-net-32-@ENDIAN@)
|
||||
(define host-to-net-16 host-to-net-16-@ENDIAN@)
|
||||
|
||||
;;;-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
|
||||
;;; Lowlevel junk
|
||||
;;;-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
|
||||
|
|
Loading…
Reference in New Issue