diff --git a/.github/workflows/buildRelease.yml b/.github/workflows/buildRelease.yml index 333bc596..13459fd4 100644 --- a/.github/workflows/buildRelease.yml +++ b/.github/workflows/buildRelease.yml @@ -107,7 +107,7 @@ jobs: echo "linux=true" >> $GITHUB_OUTPUT; echo "macos=true" >> $GITHUB_OUTPUT; echo "windows=true" >> $GITHUB_OUTPUT; - + ###################################################################################### @@ -123,7 +123,7 @@ jobs: steps: # Checkout the actions for this repo owner - name: Checkout Actions - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: repository: ${{ github.repository_owner }}/.github path: ./Actions_${{ github.sha }} @@ -157,7 +157,7 @@ jobs: steps: # Checkout the actions for this repo owner - name: Checkout Actions - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: repository: ${{ github.repository_owner }}/.github path: ./Actions_${{ github.sha }} @@ -165,7 +165,7 @@ jobs: # Checkout the branch - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 # Setup release tag - name: Setup Release Tag @@ -272,11 +272,11 @@ jobs: # Checkout the branch - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 # Checkout the actions for this repo owner - name: Checkout Actions - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: repository: ${{ github.repository_owner }}/.github path: ./Actions_${{ github.sha }} @@ -290,13 +290,13 @@ jobs: # Uninstall exisitng X11 stuff preconfigured on runner then install correct X11 dependencies - name: Unistall X components already on the runner run: | - brew uninstall --ignore-dependencies libxft - brew uninstall --ignore-dependencies libxrender - brew uninstall --ignore-dependencies libxext - brew uninstall --ignore-dependencies libx11 - brew uninstall --ignore-dependencies xorgproto - brew uninstall --ignore-dependencies libxdmcp - brew uninstall --ignore-dependencies libxau + brew uninstall --ignore-dependencies --force libxft + brew uninstall --ignore-dependencies --force libxrender + brew uninstall --ignore-dependencies --force libxext + brew uninstall --ignore-dependencies --force libx11 + brew uninstall --ignore-dependencies --force xorgproto + brew uninstall --ignore-dependencies --force libxdmcp + brew uninstall --ignore-dependencies --force libxau - name: Install X11 dependencies on MacOS env: @@ -324,7 +324,7 @@ jobs: export LDEARCH=aarch64-apple-darwin ./makeright init mkdir -p ../darwin.universal - exe=ldeinit + exe=ldeinit lipo -create \ -arch arm64 ../darwin.aarch64/${exe} \ -arch x86_64 ../darwin.x86_64/${exe} \ @@ -346,7 +346,7 @@ jobs: lipo ${exe} -output ../darwin.x86_64/${exe} -extract x86_64 lipo ${exe} -output ../darwin.aarch64/${exe} -extract arm64 cp -p ${exe} ../darwin.universal/${exe} - done + done # Create release tar for github. - name: Make release tar(s) @@ -369,7 +369,7 @@ jobs: # Push Release - name: Push the release uses: ncipollo/release-action@v1 - with: + with: allowUpdates: true artifacts: /tmp/release_tars/${{ steps.tag.outputs.release_tag }}-darwin.x86_64.tgz, @@ -383,7 +383,7 @@ jobs: # Windows: build for Windows-Cygwin via Docker build and use results to # create and push release assets to github - + windows: needs: [inputs, sentry] @@ -418,7 +418,7 @@ jobs: # Retrieve SDL2 and install in cygwin - name: Install SDL2 id: sdl2 - env: + env: GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} run: | gh release download 2.26.5 --repo interlisp/cygwin-sdl --pattern *.tgz --output .\cygwin\sdl2.tar.gz @@ -426,13 +426,13 @@ jobs: # Checkout the branch - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: path: cygwin\maiko # Checkout the actions for this repo owner - name: Checkout Actions - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: repository: ${{ github.repository_owner }}/.github path: ./Actions_${{ github.sha }} @@ -473,6 +473,80 @@ jobs: +###################################################################################### + + # Emscripten: build and push Maiko compiled for Emscripten (to run Maiko in browser) + + emscripten: + + needs: [inputs, sentry] + if: | + needs.inputs.outputs.linux == 'true' + && ( + needs.sentry.outputs.release_not_built == 'true' + || needs.inputs.outputs.force == 'true' + ) + + runs-on: ubuntu-latest + + steps: + + # Checkout the actions for this repo owner + - name: Checkout Actions + uses: actions/checkout@v4 + with: + repository: ${{ github.repository_owner }}/.github + path: ./Actions_${{ github.sha }} + - run: mv ./Actions_${{ github.sha }}/actions ../actions && rm -rf ./Actions_${{ github.sha }} + + # Install SDL2 + - name: Install SDL2 + run: | + export DEBIAN_FRONTEND=noninteractive + sudo -E apt-get install -y libsdl2-dev libsdl2-2.0-0 + + # Install Emscripten SDK + - name: Install Empscripten + working-directory: ../ + run: | + git clone https://github.com/emscripten-core/emsdk.git + cd emsdk + ./emsdk install latest + ./emsdk activate latest + CWD="$(pwd)" + echo "${CWD}" >> ${GITHUB_PATH} + echo "${CWD}/upstream/emscripten" >> ${GITHUB_PATH} + echo "${CWD}/upstream/emscripten/tools" >> ${GITHUB_PATH} + echo "${CWD}/node/$(ls -d node/*64bit | tail -1)/bin" >> ${GITHUB_PATH} + + # Checkout the maiko branch + - name: Checkout + uses: actions/checkout@v4 + + # Setup release tag + - name: Setup Release Tag + id: tag + uses: ./../actions/release-tag-action + + # Compile maiko using Emscripten (no load build) + - name: Compile Maiko using Emscripten + working-directory: ./bin + run: | + ./makeright wasm_nl + cd ../emscripten.wasm_nl + tar -c -z -f ../${{ steps.tag.outputs.release_tag }}-emscripten.tgz * + + # Push Release to github + - name: Push the release + uses: ncipollo/release-action@v1 + with: + allowUpdates: true + artifacts: ${{ steps.tag.outputs.release_tag }}-emscripten.tgz + tag: ${{ steps.tag.outputs.release_tag }} + draft: ${{ needs.inputs.outputs.draft }} + token: ${{ secrets.GITHUB_TOKEN }} + + ###################################################################################### # Use set-sentry-action to determine set the sentry that says this release has @@ -485,12 +559,12 @@ jobs: outputs: build_successful: ${{ steps.output.outputs.build_successful }} - needs: [inputs, sentry, linux, macos, windows] + needs: [inputs, sentry, linux, macos, windows, emscripten] steps: # Checkout the actions for this repo owner - name: Checkout Actions - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: repository: ${{ github.repository_owner }}/.github path: ./Actions_${{ github.sha }} diff --git a/.gitignore b/.gitignore index 0111213f..dd4fecfd 100644 --- a/.gitignore +++ b/.gitignore @@ -19,6 +19,10 @@ cmake-build-*/** *.x86_64-x/** *.x86_64-sdl/** *.x86_64/** +*.wasm/** +*.wasm-wasm/** +*.wasm_nl/** +*.wasm_nl-wasm_nl/** *.armv7l-x/** *.armv7l/** *.aarch64-x/** diff --git a/bin/config.guess b/bin/config.guess index 9aff91cf..f6d217a4 100755 --- a/bin/config.guess +++ b/bin/config.guess @@ -1,12 +1,14 @@ #! /bin/sh # Attempt to guess a canonical system name. -# Copyright 1992-2020 Free Software Foundation, Inc. +# Copyright 1992-2024 Free Software Foundation, Inc. -timestamp='2020-08-17' +# shellcheck disable=SC2006,SC2268 # see below for rationale + +timestamp='2024-01-01' # This file is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 3 of the License, or +# the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, but @@ -27,17 +29,25 @@ timestamp='2020-08-17' # Originally written by Per Bothner; maintained since 2000 by Ben Elliston. # # You can get the latest version of this script from: -# https://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess +# https://git.savannah.gnu.org/cgit/config.git/plain/config.guess # # Please send patches to . +# The "shellcheck disable" line above the timestamp inhibits complaints +# about features and limitations of the classic Bourne shell that were +# superseded or lifted in POSIX. However, this script identifies a wide +# variety of pre-POSIX systems that do not have POSIX shells at all, and +# even some reasonably current systems (Solaris 10 as case-in-point) still +# have a pre-POSIX /bin/sh. + + me=`echo "$0" | sed -e 's,.*/,,'` usage="\ Usage: $0 [OPTION] -Output the configuration name of the system \`$me' is run on. +Output the configuration name of the system '$me' is run on. Options: -h, --help print this help, then exit @@ -50,13 +60,13 @@ version="\ GNU config.guess ($timestamp) Originally written by Per Bothner. -Copyright 1992-2020 Free Software Foundation, Inc. +Copyright 1992-2024 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." help=" -Try \`$me --help' for more information." +Try '$me --help' for more information." # Parse command line while test $# -gt 0 ; do @@ -84,13 +94,16 @@ if test $# != 0; then exit 1 fi +# Just in case it came from the environment. +GUESS= + # CC_FOR_BUILD -- compiler used by this script. Note that the use of a # compiler to aid in system detection is discouraged as it requires # temporary files to be created and, as you can see below, it is a # headache to deal with in a portable fashion. -# Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still -# use `HOST_CC' if defined, but it is deprecated. +# Historically, 'CC_FOR_BUILD' used to be named 'HOST_CC'. We still +# use 'HOST_CC' if defined, but it is deprecated. # Portable tmp directory creation inspired by the Autoconf team. @@ -102,7 +115,7 @@ set_cc_for_build() { # prevent multiple calls if $tmp is already set test "$tmp" && return 0 : "${TMPDIR=/tmp}" - # shellcheck disable=SC2039 + # shellcheck disable=SC2039,SC3028 { tmp=`(umask 077 && mktemp -d "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } || { test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir "$tmp" 2>/dev/null) ; } || { tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir "$tmp" 2>/dev/null) && echo "Warning: creating insecure temp directory" >&2 ; } || @@ -112,7 +125,7 @@ set_cc_for_build() { ,,) echo "int x;" > "$dummy.c" for driver in cc gcc c89 c99 ; do if ($driver -c -o "$dummy.o" "$dummy.c") >/dev/null 2>&1 ; then - CC_FOR_BUILD="$driver" + CC_FOR_BUILD=$driver break fi done @@ -133,40 +146,57 @@ fi UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown -UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown +UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown -case "$UNAME_SYSTEM" in +case $UNAME_SYSTEM in Linux|GNU|GNU/*) - # If the system lacks a compiler, then just pick glibc. - # We could probably try harder. - LIBC=gnu + LIBC=unknown set_cc_for_build cat <<-EOF > "$dummy.c" + #if defined(__ANDROID__) + LIBC=android + #else #include #if defined(__UCLIBC__) LIBC=uclibc #elif defined(__dietlibc__) LIBC=dietlibc - #else + #elif defined(__GLIBC__) LIBC=gnu + #elif defined(__LLVM_LIBC__) + LIBC=llvm + #else + #include + /* First heuristic to detect musl libc. */ + #ifdef __DEFINED_va_list + LIBC=musl + #endif + #endif #endif EOF - eval "`$CC_FOR_BUILD -E "$dummy.c" 2>/dev/null | grep '^LIBC' | sed 's, ,,g'`" + cc_set_libc=`$CC_FOR_BUILD -E "$dummy.c" 2>/dev/null | grep '^LIBC' | sed 's, ,,g'` + eval "$cc_set_libc" - # If ldd exists, use it to detect musl libc. - if command -v ldd >/dev/null && \ - ldd --version 2>&1 | grep -q ^musl - then - LIBC=musl + # Second heuristic to detect musl libc. + if [ "$LIBC" = unknown ] && + command -v ldd >/dev/null && + ldd --version 2>&1 | grep -q ^musl; then + LIBC=musl + fi + + # If the system lacks a compiler, then just pick glibc. + # We could probably try harder. + if [ "$LIBC" = unknown ]; then + LIBC=gnu fi ;; esac # Note: order is significant - the case branches are not exclusive. -case "$UNAME_MACHINE:$UNAME_SYSTEM:$UNAME_RELEASE:$UNAME_VERSION" in +case $UNAME_MACHINE:$UNAME_SYSTEM:$UNAME_RELEASE:$UNAME_VERSION in *:NetBSD:*:*) # NetBSD (nbsd) targets should (where applicable) match one or # more of the tuples: *-*-netbsdelf*, *-*-netbsdaout*, @@ -178,12 +208,12 @@ case "$UNAME_MACHINE:$UNAME_SYSTEM:$UNAME_RELEASE:$UNAME_VERSION" in # # Note: NetBSD doesn't particularly care about the vendor # portion of the name. We always set it to "unknown". - sysctl="sysctl -n hw.machine_arch" UNAME_MACHINE_ARCH=`(uname -p 2>/dev/null || \ - "/sbin/$sysctl" 2>/dev/null || \ - "/usr/sbin/$sysctl" 2>/dev/null || \ + /sbin/sysctl -n hw.machine_arch 2>/dev/null || \ + /usr/sbin/sysctl -n hw.machine_arch 2>/dev/null || \ echo unknown)` - case "$UNAME_MACHINE_ARCH" in + case $UNAME_MACHINE_ARCH in + aarch64eb) machine=aarch64_be-unknown ;; armeb) machine=armeb-unknown ;; arm*) machine=arm-unknown ;; sh3el) machine=shl-unknown ;; @@ -192,13 +222,13 @@ case "$UNAME_MACHINE:$UNAME_SYSTEM:$UNAME_RELEASE:$UNAME_VERSION" in earmv*) arch=`echo "$UNAME_MACHINE_ARCH" | sed -e 's,^e\(armv[0-9]\).*$,\1,'` endian=`echo "$UNAME_MACHINE_ARCH" | sed -ne 's,^.*\(eb\)$,\1,p'` - machine="${arch}${endian}"-unknown + machine=${arch}${endian}-unknown ;; - *) machine="$UNAME_MACHINE_ARCH"-unknown ;; + *) machine=$UNAME_MACHINE_ARCH-unknown ;; esac # The Operating System including object format, if it has switched # to ELF recently (or will in the future) and ABI. - case "$UNAME_MACHINE_ARCH" in + case $UNAME_MACHINE_ARCH in earm*) os=netbsdelf ;; @@ -219,7 +249,7 @@ case "$UNAME_MACHINE:$UNAME_SYSTEM:$UNAME_RELEASE:$UNAME_VERSION" in ;; esac # Determine ABI tags. - case "$UNAME_MACHINE_ARCH" in + case $UNAME_MACHINE_ARCH in earm*) expr='s/^earmv[0-9]/-eabi/;s/eb$//' abi=`echo "$UNAME_MACHINE_ARCH" | sed -e "$expr"` @@ -230,7 +260,7 @@ case "$UNAME_MACHINE:$UNAME_SYSTEM:$UNAME_RELEASE:$UNAME_VERSION" in # thus, need a distinct triplet. However, they do not need # kernel version information, so it can be replaced with a # suitable tag, in the style of linux-gnu. - case "$UNAME_VERSION" in + case $UNAME_VERSION in Debian*) release='-gnu' ;; @@ -241,51 +271,57 @@ case "$UNAME_MACHINE:$UNAME_SYSTEM:$UNAME_RELEASE:$UNAME_VERSION" in # Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM: # contains redundant information, the shorter form: # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used. - echo "$machine-${os}${release}${abi-}" - exit ;; + GUESS=$machine-${os}${release}${abi-} + ;; *:Bitrig:*:*) UNAME_MACHINE_ARCH=`arch | sed 's/Bitrig.//'` - echo "$UNAME_MACHINE_ARCH"-unknown-bitrig"$UNAME_RELEASE" - exit ;; + GUESS=$UNAME_MACHINE_ARCH-unknown-bitrig$UNAME_RELEASE + ;; *:OpenBSD:*:*) UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'` - echo "$UNAME_MACHINE_ARCH"-unknown-openbsd"$UNAME_RELEASE" - exit ;; + GUESS=$UNAME_MACHINE_ARCH-unknown-openbsd$UNAME_RELEASE + ;; + *:SecBSD:*:*) + UNAME_MACHINE_ARCH=`arch | sed 's/SecBSD.//'` + GUESS=$UNAME_MACHINE_ARCH-unknown-secbsd$UNAME_RELEASE + ;; *:LibertyBSD:*:*) UNAME_MACHINE_ARCH=`arch | sed 's/^.*BSD\.//'` - echo "$UNAME_MACHINE_ARCH"-unknown-libertybsd"$UNAME_RELEASE" - exit ;; + GUESS=$UNAME_MACHINE_ARCH-unknown-libertybsd$UNAME_RELEASE + ;; *:MidnightBSD:*:*) - echo "$UNAME_MACHINE"-unknown-midnightbsd"$UNAME_RELEASE" - exit ;; + GUESS=$UNAME_MACHINE-unknown-midnightbsd$UNAME_RELEASE + ;; *:ekkoBSD:*:*) - echo "$UNAME_MACHINE"-unknown-ekkobsd"$UNAME_RELEASE" - exit ;; + GUESS=$UNAME_MACHINE-unknown-ekkobsd$UNAME_RELEASE + ;; *:SolidBSD:*:*) - echo "$UNAME_MACHINE"-unknown-solidbsd"$UNAME_RELEASE" - exit ;; + GUESS=$UNAME_MACHINE-unknown-solidbsd$UNAME_RELEASE + ;; *:OS108:*:*) - echo "$UNAME_MACHINE"-unknown-os108_"$UNAME_RELEASE" - exit ;; + GUESS=$UNAME_MACHINE-unknown-os108_$UNAME_RELEASE + ;; macppc:MirBSD:*:*) - echo powerpc-unknown-mirbsd"$UNAME_RELEASE" - exit ;; + GUESS=powerpc-unknown-mirbsd$UNAME_RELEASE + ;; *:MirBSD:*:*) - echo "$UNAME_MACHINE"-unknown-mirbsd"$UNAME_RELEASE" - exit ;; + GUESS=$UNAME_MACHINE-unknown-mirbsd$UNAME_RELEASE + ;; *:Sortix:*:*) - echo "$UNAME_MACHINE"-unknown-sortix - exit ;; + GUESS=$UNAME_MACHINE-unknown-sortix + ;; *:Twizzler:*:*) - echo "$UNAME_MACHINE"-unknown-twizzler - exit ;; + GUESS=$UNAME_MACHINE-unknown-twizzler + ;; *:Redox:*:*) - echo "$UNAME_MACHINE"-unknown-redox - exit ;; + GUESS=$UNAME_MACHINE-unknown-redox + ;; mips:OSF1:*.*) - echo mips-dec-osf1 - exit ;; + GUESS=mips-dec-osf1 + ;; alpha:OSF1:*:*) + # Reset EXIT trap before exiting to avoid spurious non-zero exit code. + trap '' 0 case $UNAME_RELEASE in *4.0) UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'` @@ -299,7 +335,7 @@ case "$UNAME_MACHINE:$UNAME_SYSTEM:$UNAME_RELEASE:$UNAME_VERSION" in # covers most systems running today. This code pipes the CPU # types through head -n 1, so we only detect the type of CPU 0. ALPHA_CPU_TYPE=`/usr/sbin/psrinfo -v | sed -n -e 's/^ The alpha \(.*\) processor.*$/\1/p' | head -n 1` - case "$ALPHA_CPU_TYPE" in + case $ALPHA_CPU_TYPE in "EV4 (21064)") UNAME_MACHINE=alpha ;; "EV4.5 (21064)") @@ -336,68 +372,69 @@ case "$UNAME_MACHINE:$UNAME_SYSTEM:$UNAME_RELEASE:$UNAME_VERSION" in # A Tn.n version is a released field test version. # A Xn.n version is an unreleased experimental baselevel. # 1.2 uses "1.2" for uname -r. - echo "$UNAME_MACHINE"-dec-osf"`echo "$UNAME_RELEASE" | sed -e 's/^[PVTX]//' | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz`" - # Reset EXIT trap before exiting to avoid spurious non-zero exit code. - exitcode=$? - trap '' 0 - exit $exitcode ;; + OSF_REL=`echo "$UNAME_RELEASE" | sed -e 's/^[PVTX]//' | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz` + GUESS=$UNAME_MACHINE-dec-osf$OSF_REL + ;; Amiga*:UNIX_System_V:4.0:*) - echo m68k-unknown-sysv4 - exit ;; + GUESS=m68k-unknown-sysv4 + ;; *:[Aa]miga[Oo][Ss]:*:*) - echo "$UNAME_MACHINE"-unknown-amigaos - exit ;; + GUESS=$UNAME_MACHINE-unknown-amigaos + ;; *:[Mm]orph[Oo][Ss]:*:*) - echo "$UNAME_MACHINE"-unknown-morphos - exit ;; + GUESS=$UNAME_MACHINE-unknown-morphos + ;; *:OS/390:*:*) - echo i370-ibm-openedition - exit ;; + GUESS=i370-ibm-openedition + ;; *:z/VM:*:*) - echo s390-ibm-zvmoe - exit ;; + GUESS=s390-ibm-zvmoe + ;; *:OS400:*:*) - echo powerpc-ibm-os400 - exit ;; + GUESS=powerpc-ibm-os400 + ;; arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*) - echo arm-acorn-riscix"$UNAME_RELEASE" - exit ;; + GUESS=arm-acorn-riscix$UNAME_RELEASE + ;; arm*:riscos:*:*|arm*:RISCOS:*:*) - echo arm-unknown-riscos - exit ;; + GUESS=arm-unknown-riscos + ;; SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*) - echo hppa1.1-hitachi-hiuxmpp - exit ;; + GUESS=hppa1.1-hitachi-hiuxmpp + ;; Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*) # akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE. - if test "`(/bin/universe) 2>/dev/null`" = att ; then - echo pyramid-pyramid-sysv3 - else - echo pyramid-pyramid-bsd - fi - exit ;; + case `(/bin/universe) 2>/dev/null` in + att) GUESS=pyramid-pyramid-sysv3 ;; + *) GUESS=pyramid-pyramid-bsd ;; + esac + ;; NILE*:*:*:dcosx) - echo pyramid-pyramid-svr4 - exit ;; + GUESS=pyramid-pyramid-svr4 + ;; DRS?6000:unix:4.0:6*) - echo sparc-icl-nx6 - exit ;; + GUESS=sparc-icl-nx6 + ;; DRS?6000:UNIX_SV:4.2*:7* | DRS?6000:isis:4.2*:7*) case `/usr/bin/uname -p` in - sparc) echo sparc-icl-nx7; exit ;; - esac ;; + sparc) GUESS=sparc-icl-nx7 ;; + esac + ;; s390x:SunOS:*:*) - echo "$UNAME_MACHINE"-ibm-solaris2"`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'`" - exit ;; + SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'` + GUESS=$UNAME_MACHINE-ibm-solaris2$SUN_REL + ;; sun4H:SunOS:5.*:*) - echo sparc-hal-solaris2"`echo "$UNAME_RELEASE"|sed -e 's/[^.]*//'`" - exit ;; + SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'` + GUESS=sparc-hal-solaris2$SUN_REL + ;; sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*) - echo sparc-sun-solaris2"`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'`" - exit ;; + SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'` + GUESS=sparc-sun-solaris2$SUN_REL + ;; i86pc:AuroraUX:5.*:* | i86xen:AuroraUX:5.*:*) - echo i386-pc-auroraux"$UNAME_RELEASE" - exit ;; + GUESS=i386-pc-auroraux$UNAME_RELEASE + ;; i86pc:SunOS:5.*:* | i86xen:SunOS:5.*:*) set_cc_for_build SUN_ARCH=i386 @@ -406,47 +443,50 @@ case "$UNAME_MACHINE:$UNAME_SYSTEM:$UNAME_RELEASE:$UNAME_VERSION" in # This test works for both compilers. if test "$CC_FOR_BUILD" != no_compiler_found; then if (echo '#ifdef __amd64'; echo IS_64BIT_ARCH; echo '#endif') | \ - (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \ + (CCOPTS="" $CC_FOR_BUILD -m64 -E - 2>/dev/null) | \ grep IS_64BIT_ARCH >/dev/null then SUN_ARCH=x86_64 fi fi - echo "$SUN_ARCH"-pc-solaris2"`echo "$UNAME_RELEASE"|sed -e 's/[^.]*//'`" - exit ;; + SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'` + GUESS=$SUN_ARCH-pc-solaris2$SUN_REL + ;; sun4*:SunOS:6*:*) # According to config.sub, this is the proper way to canonicalize # SunOS6. Hard to guess exactly what SunOS6 will be like, but # it's likely to be more like Solaris than SunOS4. - echo sparc-sun-solaris3"`echo "$UNAME_RELEASE"|sed -e 's/[^.]*//'`" - exit ;; + SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'` + GUESS=sparc-sun-solaris3$SUN_REL + ;; sun4*:SunOS:*:*) - case "`/usr/bin/arch -k`" in + case `/usr/bin/arch -k` in Series*|S4*) UNAME_RELEASE=`uname -v` ;; esac - # Japanese Language versions have a version number like `4.1.3-JL'. - echo sparc-sun-sunos"`echo "$UNAME_RELEASE"|sed -e 's/-/_/'`" - exit ;; + # Japanese Language versions have a version number like '4.1.3-JL'. + SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/-/_/'` + GUESS=sparc-sun-sunos$SUN_REL + ;; sun3*:SunOS:*:*) - echo m68k-sun-sunos"$UNAME_RELEASE" - exit ;; + GUESS=m68k-sun-sunos$UNAME_RELEASE + ;; sun*:*:4.2BSD:*) UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null` test "x$UNAME_RELEASE" = x && UNAME_RELEASE=3 - case "`/bin/arch`" in + case `/bin/arch` in sun3) - echo m68k-sun-sunos"$UNAME_RELEASE" + GUESS=m68k-sun-sunos$UNAME_RELEASE ;; sun4) - echo sparc-sun-sunos"$UNAME_RELEASE" + GUESS=sparc-sun-sunos$UNAME_RELEASE ;; esac - exit ;; + ;; aushp:SunOS:*:*) - echo sparc-auspex-sunos"$UNAME_RELEASE" - exit ;; + GUESS=sparc-auspex-sunos$UNAME_RELEASE + ;; # The situation for MiNT is a little confusing. The machine name # can be virtually everything (everything which is not # "atarist" or "atariste" at least should have a processor @@ -456,41 +496,41 @@ case "$UNAME_MACHINE:$UNAME_SYSTEM:$UNAME_RELEASE:$UNAME_VERSION" in # MiNT. But MiNT is downward compatible to TOS, so this should # be no problem. atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*) - echo m68k-atari-mint"$UNAME_RELEASE" - exit ;; + GUESS=m68k-atari-mint$UNAME_RELEASE + ;; atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*) - echo m68k-atari-mint"$UNAME_RELEASE" - exit ;; + GUESS=m68k-atari-mint$UNAME_RELEASE + ;; *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*) - echo m68k-atari-mint"$UNAME_RELEASE" - exit ;; + GUESS=m68k-atari-mint$UNAME_RELEASE + ;; milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*) - echo m68k-milan-mint"$UNAME_RELEASE" - exit ;; + GUESS=m68k-milan-mint$UNAME_RELEASE + ;; hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*) - echo m68k-hades-mint"$UNAME_RELEASE" - exit ;; + GUESS=m68k-hades-mint$UNAME_RELEASE + ;; *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*) - echo m68k-unknown-mint"$UNAME_RELEASE" - exit ;; + GUESS=m68k-unknown-mint$UNAME_RELEASE + ;; m68k:machten:*:*) - echo m68k-apple-machten"$UNAME_RELEASE" - exit ;; + GUESS=m68k-apple-machten$UNAME_RELEASE + ;; powerpc:machten:*:*) - echo powerpc-apple-machten"$UNAME_RELEASE" - exit ;; + GUESS=powerpc-apple-machten$UNAME_RELEASE + ;; RISC*:Mach:*:*) - echo mips-dec-mach_bsd4.3 - exit ;; + GUESS=mips-dec-mach_bsd4.3 + ;; RISC*:ULTRIX:*:*) - echo mips-dec-ultrix"$UNAME_RELEASE" - exit ;; + GUESS=mips-dec-ultrix$UNAME_RELEASE + ;; VAX*:ULTRIX*:*:*) - echo vax-dec-ultrix"$UNAME_RELEASE" - exit ;; + GUESS=vax-dec-ultrix$UNAME_RELEASE + ;; 2020:CLIX:*:* | 2430:CLIX:*:*) - echo clipper-intergraph-clix"$UNAME_RELEASE" - exit ;; + GUESS=clipper-intergraph-clix$UNAME_RELEASE + ;; mips:*:*:UMIPS | mips:*:*:RISCos) set_cc_for_build sed 's/^ //' << EOF > "$dummy.c" @@ -518,29 +558,29 @@ EOF dummyarg=`echo "$UNAME_RELEASE" | sed -n 's/\([0-9]*\).*/\1/p'` && SYSTEM_NAME=`"$dummy" "$dummyarg"` && { echo "$SYSTEM_NAME"; exit; } - echo mips-mips-riscos"$UNAME_RELEASE" - exit ;; + GUESS=mips-mips-riscos$UNAME_RELEASE + ;; Motorola:PowerMAX_OS:*:*) - echo powerpc-motorola-powermax - exit ;; + GUESS=powerpc-motorola-powermax + ;; Motorola:*:4.3:PL8-*) - echo powerpc-harris-powermax - exit ;; + GUESS=powerpc-harris-powermax + ;; Night_Hawk:*:*:PowerMAX_OS | Synergy:PowerMAX_OS:*:*) - echo powerpc-harris-powermax - exit ;; + GUESS=powerpc-harris-powermax + ;; Night_Hawk:Power_UNIX:*:*) - echo powerpc-harris-powerunix - exit ;; + GUESS=powerpc-harris-powerunix + ;; m88k:CX/UX:7*:*) - echo m88k-harris-cxux7 - exit ;; + GUESS=m88k-harris-cxux7 + ;; m88k:*:4*:R4*) - echo m88k-motorola-sysv4 - exit ;; + GUESS=m88k-motorola-sysv4 + ;; m88k:*:3*:R3*) - echo m88k-motorola-sysv3 - exit ;; + GUESS=m88k-motorola-sysv3 + ;; AViiON:dgux:*:*) # DG/UX returns AViiON for all architectures UNAME_PROCESSOR=`/usr/bin/uname -p` @@ -549,44 +589,45 @@ EOF if test "$TARGET_BINARY_INTERFACE"x = m88kdguxelfx || \ test "$TARGET_BINARY_INTERFACE"x = x then - echo m88k-dg-dgux"$UNAME_RELEASE" + GUESS=m88k-dg-dgux$UNAME_RELEASE else - echo m88k-dg-dguxbcs"$UNAME_RELEASE" + GUESS=m88k-dg-dguxbcs$UNAME_RELEASE fi else - echo i586-dg-dgux"$UNAME_RELEASE" + GUESS=i586-dg-dgux$UNAME_RELEASE fi - exit ;; + ;; M88*:DolphinOS:*:*) # DolphinOS (SVR3) - echo m88k-dolphin-sysv3 - exit ;; + GUESS=m88k-dolphin-sysv3 + ;; M88*:*:R3*:*) # Delta 88k system running SVR3 - echo m88k-motorola-sysv3 - exit ;; + GUESS=m88k-motorola-sysv3 + ;; XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3) - echo m88k-tektronix-sysv3 - exit ;; + GUESS=m88k-tektronix-sysv3 + ;; Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD) - echo m68k-tektronix-bsd - exit ;; + GUESS=m68k-tektronix-bsd + ;; *:IRIX*:*:*) - echo mips-sgi-irix"`echo "$UNAME_RELEASE"|sed -e 's/-/_/g'`" - exit ;; + IRIX_REL=`echo "$UNAME_RELEASE" | sed -e 's/-/_/g'` + GUESS=mips-sgi-irix$IRIX_REL + ;; ????????:AIX?:[12].1:2) # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX. - echo romp-ibm-aix # uname -m gives an 8 hex-code CPU id - exit ;; # Note that: echo "'`uname -s`'" gives 'AIX ' + GUESS=romp-ibm-aix # uname -m gives an 8 hex-code CPU id + ;; # Note that: echo "'`uname -s`'" gives 'AIX ' i*86:AIX:*:*) - echo i386-ibm-aix - exit ;; + GUESS=i386-ibm-aix + ;; ia64:AIX:*:*) if test -x /usr/bin/oslevel ; then IBM_REV=`/usr/bin/oslevel` else - IBM_REV="$UNAME_VERSION.$UNAME_RELEASE" + IBM_REV=$UNAME_VERSION.$UNAME_RELEASE fi - echo "$UNAME_MACHINE"-ibm-aix"$IBM_REV" - exit ;; + GUESS=$UNAME_MACHINE-ibm-aix$IBM_REV + ;; *:AIX:2:3) if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then set_cc_for_build @@ -603,16 +644,16 @@ EOF EOF if $CC_FOR_BUILD -o "$dummy" "$dummy.c" && SYSTEM_NAME=`"$dummy"` then - echo "$SYSTEM_NAME" + GUESS=$SYSTEM_NAME else - echo rs6000-ibm-aix3.2.5 + GUESS=rs6000-ibm-aix3.2.5 fi elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then - echo rs6000-ibm-aix3.2.4 + GUESS=rs6000-ibm-aix3.2.4 else - echo rs6000-ibm-aix3.2 + GUESS=rs6000-ibm-aix3.2 fi - exit ;; + ;; *:AIX:*:[4567]) IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'` if /usr/sbin/lsattr -El "$IBM_CPU_ID" | grep ' POWER' >/dev/null 2>&1; then @@ -621,48 +662,48 @@ EOF IBM_ARCH=powerpc fi if test -x /usr/bin/lslpp ; then - IBM_REV=`/usr/bin/lslpp -Lqc bos.rte.libc | + IBM_REV=`/usr/bin/lslpp -Lqc bos.rte.libc | \ awk -F: '{ print $3 }' | sed s/[0-9]*$/0/` else - IBM_REV="$UNAME_VERSION.$UNAME_RELEASE" + IBM_REV=$UNAME_VERSION.$UNAME_RELEASE fi - echo "$IBM_ARCH"-ibm-aix"$IBM_REV" - exit ;; + GUESS=$IBM_ARCH-ibm-aix$IBM_REV + ;; *:AIX:*:*) - echo rs6000-ibm-aix - exit ;; + GUESS=rs6000-ibm-aix + ;; ibmrt:4.4BSD:*|romp-ibm:4.4BSD:*) - echo romp-ibm-bsd4.4 - exit ;; + GUESS=romp-ibm-bsd4.4 + ;; ibmrt:*BSD:*|romp-ibm:BSD:*) # covers RT/PC BSD and - echo romp-ibm-bsd"$UNAME_RELEASE" # 4.3 with uname added to - exit ;; # report: romp-ibm BSD 4.3 + GUESS=romp-ibm-bsd$UNAME_RELEASE # 4.3 with uname added to + ;; # report: romp-ibm BSD 4.3 *:BOSX:*:*) - echo rs6000-bull-bosx - exit ;; + GUESS=rs6000-bull-bosx + ;; DPX/2?00:B.O.S.:*:*) - echo m68k-bull-sysv3 - exit ;; + GUESS=m68k-bull-sysv3 + ;; 9000/[34]??:4.3bsd:1.*:*) - echo m68k-hp-bsd - exit ;; + GUESS=m68k-hp-bsd + ;; hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*) - echo m68k-hp-bsd4.4 - exit ;; + GUESS=m68k-hp-bsd4.4 + ;; 9000/[34678]??:HP-UX:*:*) - HPUX_REV=`echo "$UNAME_RELEASE"|sed -e 's/[^.]*.[0B]*//'` - case "$UNAME_MACHINE" in + HPUX_REV=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*.[0B]*//'` + case $UNAME_MACHINE in 9000/31?) HP_ARCH=m68000 ;; 9000/[34]??) HP_ARCH=m68k ;; 9000/[678][0-9][0-9]) if test -x /usr/bin/getconf; then sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null` sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null` - case "$sc_cpu_version" in + case $sc_cpu_version in 523) HP_ARCH=hppa1.0 ;; # CPU_PA_RISC1_0 528) HP_ARCH=hppa1.1 ;; # CPU_PA_RISC1_1 532) # CPU_PA_RISC2_0 - case "$sc_kernel_bits" in + case $sc_kernel_bits in 32) HP_ARCH=hppa2.0n ;; 64) HP_ARCH=hppa2.0w ;; '') HP_ARCH=hppa2.0 ;; # HP-UX 10.20 @@ -729,12 +770,12 @@ EOF HP_ARCH=hppa64 fi fi - echo "$HP_ARCH"-hp-hpux"$HPUX_REV" - exit ;; + GUESS=$HP_ARCH-hp-hpux$HPUX_REV + ;; ia64:HP-UX:*:*) - HPUX_REV=`echo "$UNAME_RELEASE"|sed -e 's/[^.]*.[0B]*//'` - echo ia64-hp-hpux"$HPUX_REV" - exit ;; + HPUX_REV=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*.[0B]*//'` + GUESS=ia64-hp-hpux$HPUX_REV + ;; 3050*:HI-UX:*:*) set_cc_for_build sed 's/^ //' << EOF > "$dummy.c" @@ -764,36 +805,36 @@ EOF EOF $CC_FOR_BUILD -o "$dummy" "$dummy.c" && SYSTEM_NAME=`"$dummy"` && { echo "$SYSTEM_NAME"; exit; } - echo unknown-hitachi-hiuxwe2 - exit ;; + GUESS=unknown-hitachi-hiuxwe2 + ;; 9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:*) - echo hppa1.1-hp-bsd - exit ;; + GUESS=hppa1.1-hp-bsd + ;; 9000/8??:4.3bsd:*:*) - echo hppa1.0-hp-bsd - exit ;; + GUESS=hppa1.0-hp-bsd + ;; *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*) - echo hppa1.0-hp-mpeix - exit ;; + GUESS=hppa1.0-hp-mpeix + ;; hp7??:OSF1:*:* | hp8?[79]:OSF1:*:*) - echo hppa1.1-hp-osf - exit ;; + GUESS=hppa1.1-hp-osf + ;; hp8??:OSF1:*:*) - echo hppa1.0-hp-osf - exit ;; + GUESS=hppa1.0-hp-osf + ;; i*86:OSF1:*:*) if test -x /usr/sbin/sysversion ; then - echo "$UNAME_MACHINE"-unknown-osf1mk + GUESS=$UNAME_MACHINE-unknown-osf1mk else - echo "$UNAME_MACHINE"-unknown-osf1 + GUESS=$UNAME_MACHINE-unknown-osf1 fi - exit ;; + ;; parisc*:Lites*:*:*) - echo hppa1.1-hp-lites - exit ;; + GUESS=hppa1.1-hp-lites + ;; C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*) - echo c1-convex-bsd - exit ;; + GUESS=c1-convex-bsd + ;; C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*) if getsysinfo -f scalar_acc then echo c32-convex-bsd @@ -801,17 +842,18 @@ EOF fi exit ;; C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*) - echo c34-convex-bsd - exit ;; + GUESS=c34-convex-bsd + ;; C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*) - echo c38-convex-bsd - exit ;; + GUESS=c38-convex-bsd + ;; C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*) - echo c4-convex-bsd - exit ;; + GUESS=c4-convex-bsd + ;; CRAY*Y-MP:*:*:*) - echo ymp-cray-unicos"$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/' - exit ;; + CRAY_REL=`echo "$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'` + GUESS=ymp-cray-unicos$CRAY_REL + ;; CRAY*[A-Z]90:*:*:*) echo "$UNAME_MACHINE"-cray-unicos"$UNAME_RELEASE" \ | sed -e 's/CRAY.*\([A-Z]90\)/\1/' \ @@ -819,112 +861,153 @@ EOF -e 's/\.[^.]*$/.X/' exit ;; CRAY*TS:*:*:*) - echo t90-cray-unicos"$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/' - exit ;; + CRAY_REL=`echo "$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'` + GUESS=t90-cray-unicos$CRAY_REL + ;; CRAY*T3E:*:*:*) - echo alphaev5-cray-unicosmk"$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/' - exit ;; + CRAY_REL=`echo "$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'` + GUESS=alphaev5-cray-unicosmk$CRAY_REL + ;; CRAY*SV1:*:*:*) - echo sv1-cray-unicos"$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/' - exit ;; + CRAY_REL=`echo "$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'` + GUESS=sv1-cray-unicos$CRAY_REL + ;; *:UNICOS/mp:*:*) - echo craynv-cray-unicosmp"$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/' - exit ;; + CRAY_REL=`echo "$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'` + GUESS=craynv-cray-unicosmp$CRAY_REL + ;; F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*) FUJITSU_PROC=`uname -m | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz` FUJITSU_SYS=`uname -p | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/\///'` FUJITSU_REL=`echo "$UNAME_RELEASE" | sed -e 's/ /_/'` - echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" - exit ;; + GUESS=${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL} + ;; 5000:UNIX_System_V:4.*:*) FUJITSU_SYS=`uname -p | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/\///'` FUJITSU_REL=`echo "$UNAME_RELEASE" | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/ /_/'` - echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" - exit ;; + GUESS=sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL} + ;; i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*) - echo "$UNAME_MACHINE"-pc-bsdi"$UNAME_RELEASE" - exit ;; + GUESS=$UNAME_MACHINE-pc-bsdi$UNAME_RELEASE + ;; sparc*:BSD/OS:*:*) - echo sparc-unknown-bsdi"$UNAME_RELEASE" - exit ;; + GUESS=sparc-unknown-bsdi$UNAME_RELEASE + ;; *:BSD/OS:*:*) - echo "$UNAME_MACHINE"-unknown-bsdi"$UNAME_RELEASE" - exit ;; + GUESS=$UNAME_MACHINE-unknown-bsdi$UNAME_RELEASE + ;; arm:FreeBSD:*:*) UNAME_PROCESSOR=`uname -p` set_cc_for_build if echo __ARM_PCS_VFP | $CC_FOR_BUILD -E - 2>/dev/null \ | grep -q __ARM_PCS_VFP then - echo "${UNAME_PROCESSOR}"-unknown-freebsd"`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`"-gnueabi + FREEBSD_REL=`echo "$UNAME_RELEASE" | sed -e 's/[-(].*//'` + GUESS=$UNAME_PROCESSOR-unknown-freebsd$FREEBSD_REL-gnueabi else - echo "${UNAME_PROCESSOR}"-unknown-freebsd"`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`"-gnueabihf + FREEBSD_REL=`echo "$UNAME_RELEASE" | sed -e 's/[-(].*//'` + GUESS=$UNAME_PROCESSOR-unknown-freebsd$FREEBSD_REL-gnueabihf fi - exit ;; + ;; *:FreeBSD:*:*) - UNAME_PROCESSOR=`/usr/bin/uname -p` - case "$UNAME_PROCESSOR" in + UNAME_PROCESSOR=`uname -p` + case $UNAME_PROCESSOR in amd64) UNAME_PROCESSOR=x86_64 ;; i386) UNAME_PROCESSOR=i586 ;; esac - echo "$UNAME_PROCESSOR"-unknown-freebsd"`echo "$UNAME_RELEASE"|sed -e 's/[-(].*//'`" - exit ;; + FREEBSD_REL=`echo "$UNAME_RELEASE" | sed -e 's/[-(].*//'` + GUESS=$UNAME_PROCESSOR-unknown-freebsd$FREEBSD_REL + ;; i*:CYGWIN*:*) - echo "$UNAME_MACHINE"-pc-cygwin - exit ;; + GUESS=$UNAME_MACHINE-pc-cygwin + ;; *:MINGW64*:*) - echo "$UNAME_MACHINE"-pc-mingw64 - exit ;; + GUESS=$UNAME_MACHINE-pc-mingw64 + ;; *:MINGW*:*) - echo "$UNAME_MACHINE"-pc-mingw32 - exit ;; + GUESS=$UNAME_MACHINE-pc-mingw32 + ;; *:MSYS*:*) - echo "$UNAME_MACHINE"-pc-msys - exit ;; + GUESS=$UNAME_MACHINE-pc-msys + ;; i*:PW*:*) - echo "$UNAME_MACHINE"-pc-pw32 - exit ;; + GUESS=$UNAME_MACHINE-pc-pw32 + ;; + *:SerenityOS:*:*) + GUESS=$UNAME_MACHINE-pc-serenity + ;; *:Interix*:*) - case "$UNAME_MACHINE" in + case $UNAME_MACHINE in x86) - echo i586-pc-interix"$UNAME_RELEASE" - exit ;; + GUESS=i586-pc-interix$UNAME_RELEASE + ;; authenticamd | genuineintel | EM64T) - echo x86_64-unknown-interix"$UNAME_RELEASE" - exit ;; + GUESS=x86_64-unknown-interix$UNAME_RELEASE + ;; IA64) - echo ia64-unknown-interix"$UNAME_RELEASE" - exit ;; + GUESS=ia64-unknown-interix$UNAME_RELEASE + ;; esac ;; i*:UWIN*:*) - echo "$UNAME_MACHINE"-pc-uwin - exit ;; + GUESS=$UNAME_MACHINE-pc-uwin + ;; amd64:CYGWIN*:*:* | x86_64:CYGWIN*:*:*) - echo x86_64-pc-cygwin - exit ;; + GUESS=x86_64-pc-cygwin + ;; prep*:SunOS:5.*:*) - echo powerpcle-unknown-solaris2"`echo "$UNAME_RELEASE"|sed -e 's/[^.]*//'`" - exit ;; + SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'` + GUESS=powerpcle-unknown-solaris2$SUN_REL + ;; *:GNU:*:*) # the GNU system - echo "`echo "$UNAME_MACHINE"|sed -e 's,[-/].*$,,'`-unknown-$LIBC`echo "$UNAME_RELEASE"|sed -e 's,/.*$,,'`" - exit ;; + GNU_ARCH=`echo "$UNAME_MACHINE" | sed -e 's,[-/].*$,,'` + GNU_REL=`echo "$UNAME_RELEASE" | sed -e 's,/.*$,,'` + GUESS=$GNU_ARCH-unknown-$LIBC$GNU_REL + ;; *:GNU/*:*:*) # other systems with GNU libc and userland - echo "$UNAME_MACHINE-unknown-`echo "$UNAME_SYSTEM" | sed 's,^[^/]*/,,' | tr "[:upper:]" "[:lower:]"``echo "$UNAME_RELEASE"|sed -e 's/[-(].*//'`-$LIBC" - exit ;; + GNU_SYS=`echo "$UNAME_SYSTEM" | sed 's,^[^/]*/,,' | tr "[:upper:]" "[:lower:]"` + GNU_REL=`echo "$UNAME_RELEASE" | sed -e 's/[-(].*//'` + GUESS=$UNAME_MACHINE-unknown-$GNU_SYS$GNU_REL-$LIBC + ;; + x86_64:[Mm]anagarm:*:*|i?86:[Mm]anagarm:*:*) + GUESS="$UNAME_MACHINE-pc-managarm-mlibc" + ;; + *:[Mm]anagarm:*:*) + GUESS="$UNAME_MACHINE-unknown-managarm-mlibc" + ;; *:Minix:*:*) - echo "$UNAME_MACHINE"-unknown-minix - exit ;; + GUESS=$UNAME_MACHINE-unknown-minix + ;; aarch64:Linux:*:*) - echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" - exit ;; + set_cc_for_build + CPU=$UNAME_MACHINE + LIBCABI=$LIBC + if test "$CC_FOR_BUILD" != no_compiler_found; then + ABI=64 + sed 's/^ //' << EOF > "$dummy.c" + #ifdef __ARM_EABI__ + #ifdef __ARM_PCS_VFP + ABI=eabihf + #else + ABI=eabi + #endif + #endif +EOF + cc_set_abi=`$CC_FOR_BUILD -E "$dummy.c" 2>/dev/null | grep '^ABI' | sed 's, ,,g'` + eval "$cc_set_abi" + case $ABI in + eabi | eabihf) CPU=armv8l; LIBCABI=$LIBC$ABI ;; + esac + fi + GUESS=$CPU-unknown-linux-$LIBCABI + ;; aarch64_be:Linux:*:*) UNAME_MACHINE=aarch64_be - echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" - exit ;; + GUESS=$UNAME_MACHINE-unknown-linux-$LIBC + ;; alpha:Linux:*:*) case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' /proc/cpuinfo 2>/dev/null` in EV5) UNAME_MACHINE=alphaev5 ;; @@ -937,60 +1020,72 @@ EOF esac objdump --private-headers /bin/sh | grep -q ld.so.1 if test "$?" = 0 ; then LIBC=gnulibc1 ; fi - echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" - exit ;; - arc:Linux:*:* | arceb:Linux:*:*) - echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" - exit ;; + GUESS=$UNAME_MACHINE-unknown-linux-$LIBC + ;; + arc:Linux:*:* | arceb:Linux:*:* | arc32:Linux:*:* | arc64:Linux:*:*) + GUESS=$UNAME_MACHINE-unknown-linux-$LIBC + ;; arm*:Linux:*:*) set_cc_for_build if echo __ARM_EABI__ | $CC_FOR_BUILD -E - 2>/dev/null \ | grep -q __ARM_EABI__ then - echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" + GUESS=$UNAME_MACHINE-unknown-linux-$LIBC else if echo __ARM_PCS_VFP | $CC_FOR_BUILD -E - 2>/dev/null \ | grep -q __ARM_PCS_VFP then - echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"eabi + GUESS=$UNAME_MACHINE-unknown-linux-${LIBC}eabi else - echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"eabihf + GUESS=$UNAME_MACHINE-unknown-linux-${LIBC}eabihf fi fi - exit ;; + ;; avr32*:Linux:*:*) - echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" - exit ;; + GUESS=$UNAME_MACHINE-unknown-linux-$LIBC + ;; cris:Linux:*:*) - echo "$UNAME_MACHINE"-axis-linux-"$LIBC" - exit ;; + GUESS=$UNAME_MACHINE-axis-linux-$LIBC + ;; crisv32:Linux:*:*) - echo "$UNAME_MACHINE"-axis-linux-"$LIBC" - exit ;; + GUESS=$UNAME_MACHINE-axis-linux-$LIBC + ;; e2k:Linux:*:*) - echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" - exit ;; + GUESS=$UNAME_MACHINE-unknown-linux-$LIBC + ;; frv:Linux:*:*) - echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" - exit ;; + GUESS=$UNAME_MACHINE-unknown-linux-$LIBC + ;; hexagon:Linux:*:*) - echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" - exit ;; + GUESS=$UNAME_MACHINE-unknown-linux-$LIBC + ;; i*86:Linux:*:*) - echo "$UNAME_MACHINE"-pc-linux-"$LIBC" - exit ;; + GUESS=$UNAME_MACHINE-pc-linux-$LIBC + ;; ia64:Linux:*:*) - echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" - exit ;; + GUESS=$UNAME_MACHINE-unknown-linux-$LIBC + ;; k1om:Linux:*:*) - echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" - exit ;; + GUESS=$UNAME_MACHINE-unknown-linux-$LIBC + ;; + kvx:Linux:*:*) + GUESS=$UNAME_MACHINE-unknown-linux-$LIBC + ;; + kvx:cos:*:*) + GUESS=$UNAME_MACHINE-unknown-cos + ;; + kvx:mbr:*:*) + GUESS=$UNAME_MACHINE-unknown-mbr + ;; + loongarch32:Linux:*:* | loongarch64:Linux:*:*) + GUESS=$UNAME_MACHINE-unknown-linux-$LIBC + ;; m32r*:Linux:*:*) - echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" - exit ;; + GUESS=$UNAME_MACHINE-unknown-linux-$LIBC + ;; m68*:Linux:*:*) - echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" - exit ;; + GUESS=$UNAME_MACHINE-unknown-linux-$LIBC + ;; mips:Linux:*:* | mips64:Linux:*:*) set_cc_for_build IS_GLIBC=0 @@ -1035,123 +1130,135 @@ EOF #endif #endif EOF - eval "`$CC_FOR_BUILD -E "$dummy.c" 2>/dev/null | grep '^CPU\|^MIPS_ENDIAN\|^LIBCABI'`" + cc_set_vars=`$CC_FOR_BUILD -E "$dummy.c" 2>/dev/null | grep '^CPU\|^MIPS_ENDIAN\|^LIBCABI'` + eval "$cc_set_vars" test "x$CPU" != x && { echo "$CPU${MIPS_ENDIAN}-unknown-linux-$LIBCABI"; exit; } ;; mips64el:Linux:*:*) - echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" - exit ;; + GUESS=$UNAME_MACHINE-unknown-linux-$LIBC + ;; openrisc*:Linux:*:*) - echo or1k-unknown-linux-"$LIBC" - exit ;; + GUESS=or1k-unknown-linux-$LIBC + ;; or32:Linux:*:* | or1k*:Linux:*:*) - echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" - exit ;; + GUESS=$UNAME_MACHINE-unknown-linux-$LIBC + ;; padre:Linux:*:*) - echo sparc-unknown-linux-"$LIBC" - exit ;; + GUESS=sparc-unknown-linux-$LIBC + ;; parisc64:Linux:*:* | hppa64:Linux:*:*) - echo hppa64-unknown-linux-"$LIBC" - exit ;; + GUESS=hppa64-unknown-linux-$LIBC + ;; parisc:Linux:*:* | hppa:Linux:*:*) # Look for CPU level case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in - PA7*) echo hppa1.1-unknown-linux-"$LIBC" ;; - PA8*) echo hppa2.0-unknown-linux-"$LIBC" ;; - *) echo hppa-unknown-linux-"$LIBC" ;; + PA7*) GUESS=hppa1.1-unknown-linux-$LIBC ;; + PA8*) GUESS=hppa2.0-unknown-linux-$LIBC ;; + *) GUESS=hppa-unknown-linux-$LIBC ;; esac - exit ;; + ;; ppc64:Linux:*:*) - echo powerpc64-unknown-linux-"$LIBC" - exit ;; + GUESS=powerpc64-unknown-linux-$LIBC + ;; ppc:Linux:*:*) - echo powerpc-unknown-linux-"$LIBC" - exit ;; + GUESS=powerpc-unknown-linux-$LIBC + ;; ppc64le:Linux:*:*) - echo powerpc64le-unknown-linux-"$LIBC" - exit ;; + GUESS=powerpc64le-unknown-linux-$LIBC + ;; ppcle:Linux:*:*) - echo powerpcle-unknown-linux-"$LIBC" - exit ;; - riscv32:Linux:*:* | riscv64:Linux:*:*) - echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" - exit ;; + GUESS=powerpcle-unknown-linux-$LIBC + ;; + riscv32:Linux:*:* | riscv32be:Linux:*:* | riscv64:Linux:*:* | riscv64be:Linux:*:*) + GUESS=$UNAME_MACHINE-unknown-linux-$LIBC + ;; s390:Linux:*:* | s390x:Linux:*:*) - echo "$UNAME_MACHINE"-ibm-linux-"$LIBC" - exit ;; + GUESS=$UNAME_MACHINE-ibm-linux-$LIBC + ;; sh64*:Linux:*:*) - echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" - exit ;; + GUESS=$UNAME_MACHINE-unknown-linux-$LIBC + ;; sh*:Linux:*:*) - echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" - exit ;; + GUESS=$UNAME_MACHINE-unknown-linux-$LIBC + ;; sparc:Linux:*:* | sparc64:Linux:*:*) - echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" - exit ;; + GUESS=$UNAME_MACHINE-unknown-linux-$LIBC + ;; tile*:Linux:*:*) - echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" - exit ;; + GUESS=$UNAME_MACHINE-unknown-linux-$LIBC + ;; vax:Linux:*:*) - echo "$UNAME_MACHINE"-dec-linux-"$LIBC" - exit ;; + GUESS=$UNAME_MACHINE-dec-linux-$LIBC + ;; x86_64:Linux:*:*) set_cc_for_build + CPU=$UNAME_MACHINE LIBCABI=$LIBC if test "$CC_FOR_BUILD" != no_compiler_found; then - if (echo '#ifdef __ILP32__'; echo IS_X32; echo '#endif') | \ - (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \ - grep IS_X32 >/dev/null - then - LIBCABI="$LIBC"x32 - fi + ABI=64 + sed 's/^ //' << EOF > "$dummy.c" + #ifdef __i386__ + ABI=x86 + #else + #ifdef __ILP32__ + ABI=x32 + #endif + #endif +EOF + cc_set_abi=`$CC_FOR_BUILD -E "$dummy.c" 2>/dev/null | grep '^ABI' | sed 's, ,,g'` + eval "$cc_set_abi" + case $ABI in + x86) CPU=i686 ;; + x32) LIBCABI=${LIBC}x32 ;; + esac fi - echo "$UNAME_MACHINE"-pc-linux-"$LIBCABI" - exit ;; + GUESS=$CPU-pc-linux-$LIBCABI + ;; xtensa*:Linux:*:*) - echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" - exit ;; + GUESS=$UNAME_MACHINE-unknown-linux-$LIBC + ;; i*86:DYNIX/ptx:4*:*) # ptx 4.0 does uname -s correctly, with DYNIX/ptx in there. # earlier versions are messed up and put the nodename in both # sysname and nodename. - echo i386-sequent-sysv4 - exit ;; + GUESS=i386-sequent-sysv4 + ;; i*86:UNIX_SV:4.2MP:2.*) # Unixware is an offshoot of SVR4, but it has its own version # number series starting with 2... # I am not positive that other SVR4 systems won't match this, # I just have to hope. -- rms. # Use sysv4.2uw... so that sysv4* matches it. - echo "$UNAME_MACHINE"-pc-sysv4.2uw"$UNAME_VERSION" - exit ;; + GUESS=$UNAME_MACHINE-pc-sysv4.2uw$UNAME_VERSION + ;; i*86:OS/2:*:*) - # If we were able to find `uname', then EMX Unix compatibility + # If we were able to find 'uname', then EMX Unix compatibility # is probably installed. - echo "$UNAME_MACHINE"-pc-os2-emx - exit ;; + GUESS=$UNAME_MACHINE-pc-os2-emx + ;; i*86:XTS-300:*:STOP) - echo "$UNAME_MACHINE"-unknown-stop - exit ;; + GUESS=$UNAME_MACHINE-unknown-stop + ;; i*86:atheos:*:*) - echo "$UNAME_MACHINE"-unknown-atheos - exit ;; + GUESS=$UNAME_MACHINE-unknown-atheos + ;; i*86:syllable:*:*) - echo "$UNAME_MACHINE"-pc-syllable - exit ;; + GUESS=$UNAME_MACHINE-pc-syllable + ;; i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.[02]*:*) - echo i386-unknown-lynxos"$UNAME_RELEASE" - exit ;; + GUESS=i386-unknown-lynxos$UNAME_RELEASE + ;; i*86:*DOS:*:*) - echo "$UNAME_MACHINE"-pc-msdosdjgpp - exit ;; + GUESS=$UNAME_MACHINE-pc-msdosdjgpp + ;; i*86:*:4.*:*) UNAME_REL=`echo "$UNAME_RELEASE" | sed 's/\/MP$//'` if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then - echo "$UNAME_MACHINE"-univel-sysv"$UNAME_REL" + GUESS=$UNAME_MACHINE-univel-sysv$UNAME_REL else - echo "$UNAME_MACHINE"-pc-sysv"$UNAME_REL" + GUESS=$UNAME_MACHINE-pc-sysv$UNAME_REL fi - exit ;; + ;; i*86:*:5:[678]*) # UnixWare 7.x, OpenUNIX and OpenServer 6. case `/bin/uname -X | grep "^Machine"` in @@ -1159,12 +1266,12 @@ EOF *Pentium) UNAME_MACHINE=i586 ;; *Pent*|*Celeron) UNAME_MACHINE=i686 ;; esac - echo "$UNAME_MACHINE-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION}" - exit ;; + GUESS=$UNAME_MACHINE-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION} + ;; i*86:*:3.2:*) if test -f /usr/options/cb.name; then UNAME_REL=`sed -n 's/.*Version //p' /dev/null >/dev/null ; then UNAME_REL=`(/bin/uname -X|grep Release|sed -e 's/.*= //')` (/bin/uname -X|grep i80486 >/dev/null) && UNAME_MACHINE=i486 @@ -1174,11 +1281,11 @@ EOF && UNAME_MACHINE=i686 (/bin/uname -X|grep '^Machine.*Pentium Pro' >/dev/null) \ && UNAME_MACHINE=i686 - echo "$UNAME_MACHINE"-pc-sco"$UNAME_REL" + GUESS=$UNAME_MACHINE-pc-sco$UNAME_REL else - echo "$UNAME_MACHINE"-pc-sysv32 + GUESS=$UNAME_MACHINE-pc-sysv32 fi - exit ;; + ;; pc:*:*:*) # Left here for compatibility: # uname -m prints for DJGPP always 'pc', but it prints nothing about @@ -1186,31 +1293,31 @@ EOF # Note: whatever this is, it MUST be the same as what config.sub # prints for the "djgpp" host, or else GDB configure will decide that # this is a cross-build. - echo i586-pc-msdosdjgpp - exit ;; + GUESS=i586-pc-msdosdjgpp + ;; Intel:Mach:3*:*) - echo i386-pc-mach3 - exit ;; + GUESS=i386-pc-mach3 + ;; paragon:*:*:*) - echo i860-intel-osf1 - exit ;; + GUESS=i860-intel-osf1 + ;; i860:*:4.*:*) # i860-SVR4 if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then - echo i860-stardent-sysv"$UNAME_RELEASE" # Stardent Vistra i860-SVR4 + GUESS=i860-stardent-sysv$UNAME_RELEASE # Stardent Vistra i860-SVR4 else # Add other i860-SVR4 vendors below as they are discovered. - echo i860-unknown-sysv"$UNAME_RELEASE" # Unknown i860-SVR4 + GUESS=i860-unknown-sysv$UNAME_RELEASE # Unknown i860-SVR4 fi - exit ;; + ;; mini*:CTIX:SYS*5:*) # "miniframe" - echo m68010-convergent-sysv - exit ;; + GUESS=m68010-convergent-sysv + ;; mc68k:UNIX:SYSTEM5:3.51m) - echo m68k-convergent-sysv - exit ;; + GUESS=m68k-convergent-sysv + ;; M680?0:D-NIX:5.3:*) - echo m68k-diab-dnix - exit ;; + GUESS=m68k-diab-dnix + ;; M68*:*:R3V[5678]*:*) test -r /sysV68 && { echo 'm68k-motorola-sysv'; exit; } ;; 3[345]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4400:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0 | SDS2:*:4.0:3.0 | SHG2:*:4.0:3.0 | S7501*:*:4.0:3.0) @@ -1235,116 +1342,119 @@ EOF /bin/uname -p 2>/dev/null | /bin/grep pteron >/dev/null \ && { echo i586-ncr-sysv4.3"$OS_REL"; exit; } ;; m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*) - echo m68k-unknown-lynxos"$UNAME_RELEASE" - exit ;; + GUESS=m68k-unknown-lynxos$UNAME_RELEASE + ;; mc68030:UNIX_System_V:4.*:*) - echo m68k-atari-sysv4 - exit ;; + GUESS=m68k-atari-sysv4 + ;; TSUNAMI:LynxOS:2.*:*) - echo sparc-unknown-lynxos"$UNAME_RELEASE" - exit ;; + GUESS=sparc-unknown-lynxos$UNAME_RELEASE + ;; rs6000:LynxOS:2.*:*) - echo rs6000-unknown-lynxos"$UNAME_RELEASE" - exit ;; + GUESS=rs6000-unknown-lynxos$UNAME_RELEASE + ;; PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.[02]*:*) - echo powerpc-unknown-lynxos"$UNAME_RELEASE" - exit ;; + GUESS=powerpc-unknown-lynxos$UNAME_RELEASE + ;; SM[BE]S:UNIX_SV:*:*) - echo mips-dde-sysv"$UNAME_RELEASE" - exit ;; + GUESS=mips-dde-sysv$UNAME_RELEASE + ;; RM*:ReliantUNIX-*:*:*) - echo mips-sni-sysv4 - exit ;; + GUESS=mips-sni-sysv4 + ;; RM*:SINIX-*:*:*) - echo mips-sni-sysv4 - exit ;; + GUESS=mips-sni-sysv4 + ;; *:SINIX-*:*:*) if uname -p 2>/dev/null >/dev/null ; then UNAME_MACHINE=`(uname -p) 2>/dev/null` - echo "$UNAME_MACHINE"-sni-sysv4 + GUESS=$UNAME_MACHINE-sni-sysv4 else - echo ns32k-sni-sysv + GUESS=ns32k-sni-sysv fi - exit ;; - PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort + ;; + PENTIUM:*:4.0*:*) # Unisys 'ClearPath HMP IX 4000' SVR4/MP effort # says - echo i586-unisys-sysv4 - exit ;; + GUESS=i586-unisys-sysv4 + ;; *:UNIX_System_V:4*:FTX*) # From Gerald Hewes . # How about differentiating between stratus architectures? -djm - echo hppa1.1-stratus-sysv4 - exit ;; + GUESS=hppa1.1-stratus-sysv4 + ;; *:*:*:FTX*) # From seanf@swdc.stratus.com. - echo i860-stratus-sysv4 - exit ;; + GUESS=i860-stratus-sysv4 + ;; i*86:VOS:*:*) # From Paul.Green@stratus.com. - echo "$UNAME_MACHINE"-stratus-vos - exit ;; + GUESS=$UNAME_MACHINE-stratus-vos + ;; *:VOS:*:*) # From Paul.Green@stratus.com. - echo hppa1.1-stratus-vos - exit ;; + GUESS=hppa1.1-stratus-vos + ;; mc68*:A/UX:*:*) - echo m68k-apple-aux"$UNAME_RELEASE" - exit ;; + GUESS=m68k-apple-aux$UNAME_RELEASE + ;; news*:NEWS-OS:6*:*) - echo mips-sony-newsos6 - exit ;; + GUESS=mips-sony-newsos6 + ;; R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*) if test -d /usr/nec; then - echo mips-nec-sysv"$UNAME_RELEASE" + GUESS=mips-nec-sysv$UNAME_RELEASE else - echo mips-unknown-sysv"$UNAME_RELEASE" + GUESS=mips-unknown-sysv$UNAME_RELEASE fi - exit ;; + ;; BeBox:BeOS:*:*) # BeOS running on hardware made by Be, PPC only. - echo powerpc-be-beos - exit ;; + GUESS=powerpc-be-beos + ;; BeMac:BeOS:*:*) # BeOS running on Mac or Mac clone, PPC only. - echo powerpc-apple-beos - exit ;; + GUESS=powerpc-apple-beos + ;; BePC:BeOS:*:*) # BeOS running on Intel PC compatible. - echo i586-pc-beos - exit ;; + GUESS=i586-pc-beos + ;; BePC:Haiku:*:*) # Haiku running on Intel PC compatible. - echo i586-pc-haiku - exit ;; - x86_64:Haiku:*:*) - echo x86_64-unknown-haiku - exit ;; + GUESS=i586-pc-haiku + ;; + ppc:Haiku:*:*) # Haiku running on Apple PowerPC + GUESS=powerpc-apple-haiku + ;; + *:Haiku:*:*) # Haiku modern gcc (not bound by BeOS compat) + GUESS=$UNAME_MACHINE-unknown-haiku + ;; SX-4:SUPER-UX:*:*) - echo sx4-nec-superux"$UNAME_RELEASE" - exit ;; + GUESS=sx4-nec-superux$UNAME_RELEASE + ;; SX-5:SUPER-UX:*:*) - echo sx5-nec-superux"$UNAME_RELEASE" - exit ;; + GUESS=sx5-nec-superux$UNAME_RELEASE + ;; SX-6:SUPER-UX:*:*) - echo sx6-nec-superux"$UNAME_RELEASE" - exit ;; + GUESS=sx6-nec-superux$UNAME_RELEASE + ;; SX-7:SUPER-UX:*:*) - echo sx7-nec-superux"$UNAME_RELEASE" - exit ;; + GUESS=sx7-nec-superux$UNAME_RELEASE + ;; SX-8:SUPER-UX:*:*) - echo sx8-nec-superux"$UNAME_RELEASE" - exit ;; + GUESS=sx8-nec-superux$UNAME_RELEASE + ;; SX-8R:SUPER-UX:*:*) - echo sx8r-nec-superux"$UNAME_RELEASE" - exit ;; + GUESS=sx8r-nec-superux$UNAME_RELEASE + ;; SX-ACE:SUPER-UX:*:*) - echo sxace-nec-superux"$UNAME_RELEASE" - exit ;; + GUESS=sxace-nec-superux$UNAME_RELEASE + ;; Power*:Rhapsody:*:*) - echo powerpc-apple-rhapsody"$UNAME_RELEASE" - exit ;; + GUESS=powerpc-apple-rhapsody$UNAME_RELEASE + ;; *:Rhapsody:*:*) - echo "$UNAME_MACHINE"-apple-rhapsody"$UNAME_RELEASE" - exit ;; + GUESS=$UNAME_MACHINE-apple-rhapsody$UNAME_RELEASE + ;; arm64:Darwin:*:*) - echo aarch64-apple-darwin"$UNAME_RELEASE" - exit ;; + GUESS=aarch64-apple-darwin$UNAME_RELEASE + ;; *:Darwin:*:*) UNAME_PROCESSOR=`uname -p` case $UNAME_PROCESSOR in @@ -1380,109 +1490,122 @@ EOF # uname -m returns i386 or x86_64 UNAME_PROCESSOR=$UNAME_MACHINE fi - echo "$UNAME_PROCESSOR"-apple-darwin"$UNAME_RELEASE" - exit ;; + GUESS=$UNAME_PROCESSOR-apple-darwin$UNAME_RELEASE + ;; *:procnto*:*:* | *:QNX:[0123456789]*:*) UNAME_PROCESSOR=`uname -p` if test "$UNAME_PROCESSOR" = x86; then UNAME_PROCESSOR=i386 UNAME_MACHINE=pc fi - echo "$UNAME_PROCESSOR"-"$UNAME_MACHINE"-nto-qnx"$UNAME_RELEASE" - exit ;; + GUESS=$UNAME_PROCESSOR-$UNAME_MACHINE-nto-qnx$UNAME_RELEASE + ;; *:QNX:*:4*) - echo i386-pc-qnx - exit ;; + GUESS=i386-pc-qnx + ;; NEO-*:NONSTOP_KERNEL:*:*) - echo neo-tandem-nsk"$UNAME_RELEASE" - exit ;; + GUESS=neo-tandem-nsk$UNAME_RELEASE + ;; NSE-*:NONSTOP_KERNEL:*:*) - echo nse-tandem-nsk"$UNAME_RELEASE" - exit ;; + GUESS=nse-tandem-nsk$UNAME_RELEASE + ;; NSR-*:NONSTOP_KERNEL:*:*) - echo nsr-tandem-nsk"$UNAME_RELEASE" - exit ;; + GUESS=nsr-tandem-nsk$UNAME_RELEASE + ;; NSV-*:NONSTOP_KERNEL:*:*) - echo nsv-tandem-nsk"$UNAME_RELEASE" - exit ;; + GUESS=nsv-tandem-nsk$UNAME_RELEASE + ;; NSX-*:NONSTOP_KERNEL:*:*) - echo nsx-tandem-nsk"$UNAME_RELEASE" - exit ;; + GUESS=nsx-tandem-nsk$UNAME_RELEASE + ;; *:NonStop-UX:*:*) - echo mips-compaq-nonstopux - exit ;; + GUESS=mips-compaq-nonstopux + ;; BS2000:POSIX*:*:*) - echo bs2000-siemens-sysv - exit ;; + GUESS=bs2000-siemens-sysv + ;; DS/*:UNIX_System_V:*:*) - echo "$UNAME_MACHINE"-"$UNAME_SYSTEM"-"$UNAME_RELEASE" - exit ;; + GUESS=$UNAME_MACHINE-$UNAME_SYSTEM-$UNAME_RELEASE + ;; *:Plan9:*:*) # "uname -m" is not consistent, so use $cputype instead. 386 # is converted to i386 for consistency with other x86 # operating systems. - # shellcheck disable=SC2154 - if test "$cputype" = 386; then + if test "${cputype-}" = 386; then UNAME_MACHINE=i386 - else - UNAME_MACHINE="$cputype" + elif test "x${cputype-}" != x; then + UNAME_MACHINE=$cputype fi - echo "$UNAME_MACHINE"-unknown-plan9 - exit ;; + GUESS=$UNAME_MACHINE-unknown-plan9 + ;; *:TOPS-10:*:*) - echo pdp10-unknown-tops10 - exit ;; + GUESS=pdp10-unknown-tops10 + ;; *:TENEX:*:*) - echo pdp10-unknown-tenex - exit ;; + GUESS=pdp10-unknown-tenex + ;; KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*) - echo pdp10-dec-tops20 - exit ;; + GUESS=pdp10-dec-tops20 + ;; XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*) - echo pdp10-xkl-tops20 - exit ;; + GUESS=pdp10-xkl-tops20 + ;; *:TOPS-20:*:*) - echo pdp10-unknown-tops20 - exit ;; + GUESS=pdp10-unknown-tops20 + ;; *:ITS:*:*) - echo pdp10-unknown-its - exit ;; + GUESS=pdp10-unknown-its + ;; SEI:*:*:SEIUX) - echo mips-sei-seiux"$UNAME_RELEASE" - exit ;; + GUESS=mips-sei-seiux$UNAME_RELEASE + ;; *:DragonFly:*:*) - echo "$UNAME_MACHINE"-unknown-dragonfly"`echo "$UNAME_RELEASE"|sed -e 's/[-(].*//'`" - exit ;; + DRAGONFLY_REL=`echo "$UNAME_RELEASE" | sed -e 's/[-(].*//'` + GUESS=$UNAME_MACHINE-unknown-dragonfly$DRAGONFLY_REL + ;; *:*VMS:*:*) UNAME_MACHINE=`(uname -p) 2>/dev/null` - case "$UNAME_MACHINE" in - A*) echo alpha-dec-vms ; exit ;; - I*) echo ia64-dec-vms ; exit ;; - V*) echo vax-dec-vms ; exit ;; + case $UNAME_MACHINE in + A*) GUESS=alpha-dec-vms ;; + I*) GUESS=ia64-dec-vms ;; + V*) GUESS=vax-dec-vms ;; esac ;; *:XENIX:*:SysV) - echo i386-pc-xenix - exit ;; + GUESS=i386-pc-xenix + ;; i*86:skyos:*:*) - echo "$UNAME_MACHINE"-pc-skyos"`echo "$UNAME_RELEASE" | sed -e 's/ .*$//'`" - exit ;; + SKYOS_REL=`echo "$UNAME_RELEASE" | sed -e 's/ .*$//'` + GUESS=$UNAME_MACHINE-pc-skyos$SKYOS_REL + ;; i*86:rdos:*:*) - echo "$UNAME_MACHINE"-pc-rdos - exit ;; - i*86:AROS:*:*) - echo "$UNAME_MACHINE"-pc-aros - exit ;; + GUESS=$UNAME_MACHINE-pc-rdos + ;; + i*86:Fiwix:*:*) + GUESS=$UNAME_MACHINE-pc-fiwix + ;; + *:AROS:*:*) + GUESS=$UNAME_MACHINE-unknown-aros + ;; x86_64:VMkernel:*:*) - echo "$UNAME_MACHINE"-unknown-esx - exit ;; + GUESS=$UNAME_MACHINE-unknown-esx + ;; amd64:Isilon\ OneFS:*:*) - echo x86_64-unknown-onefs - exit ;; + GUESS=x86_64-unknown-onefs + ;; *:Unleashed:*:*) - echo "$UNAME_MACHINE"-unknown-unleashed"$UNAME_RELEASE" - exit ;; + GUESS=$UNAME_MACHINE-unknown-unleashed$UNAME_RELEASE + ;; + *:Ironclad:*:*) + GUESS=$UNAME_MACHINE-unknown-ironclad + ;; esac +# Do we have a guess based on uname results? +if test "x$GUESS" != x; then + echo "$GUESS" + exit +fi + # No uname command or uname output not recognized. set_cc_for_build cat > "$dummy.c" </dev/null && SYSTEM_NAME=`$dummy` && +$CC_FOR_BUILD -o "$dummy" "$dummy.c" 2>/dev/null && SYSTEM_NAME=`"$dummy"` && { echo "$SYSTEM_NAME"; exit; } # Apollos put the system type in the environment. @@ -1622,7 +1745,7 @@ test -d /usr/apollo && { echo "$ISP-apollo-$SYSTYPE"; exit; } echo "$0: unable to guess system type" >&2 -case "$UNAME_MACHINE:$UNAME_SYSTEM" in +case $UNAME_MACHINE:$UNAME_SYSTEM in mips:Linux | mips64:Linux) # If we got here on MIPS GNU/Linux, output extra information. cat >&2 <&2 <&2 + echo "Invalid configuration '$1': more than four components" >&2 exit 1 ;; *-*-*-*) @@ -134,7 +145,8 @@ case $1 in nto-qnx* | linux-* | uclinux-uclibc* \ | uclinux-gnu* | kfreebsd*-gnu* | knetbsd*-gnu* | netbsd*-gnu* \ | netbsd*-eabi* | kopensolaris*-gnu* | cloudabi*-eabi* \ - | storm-chaos* | os2-emx* | rtmk-nova*) + | storm-chaos* | os2-emx* | rtmk-nova* | managarm-* \ + | windows-* ) basic_machine=$field1 basic_os=$maybe_os ;; @@ -163,6 +175,10 @@ case $1 in basic_machine=$field1 basic_os=$field2 ;; + zephyr*) + basic_machine=$field1-unknown + basic_os=$field2 + ;; # Manufacturers dec* | mips* | sequent* | encore* | pc533* | sgi* | sony* \ | att* | 7300* | 3300* | delta* | motorola* | sun[234]* \ @@ -922,11 +938,13 @@ case $basic_machine in *-*) # shellcheck disable=SC2162 + saved_IFS=$IFS IFS="-" read cpu vendor <&2 + echo "Invalid configuration '$1': machine '$cpu-$vendor' not recognized" 1>&2 exit 1 ;; esac @@ -1278,34 +1287,45 @@ esac # Decode manufacturer-specific aliases for certain operating systems. -if test x$basic_os != x +if test x"$basic_os" != x then -# First recognize some ad-hoc caes, or perhaps split kernel-os, or else just +# First recognize some ad-hoc cases, or perhaps split kernel-os, or else just # set os. +obj= case $basic_os in gnu/linux*) kernel=linux - os=`echo $basic_os | sed -e 's|gnu/linux|gnu|'` + os=`echo "$basic_os" | sed -e 's|gnu/linux|gnu|'` + ;; + os2-emx) + kernel=os2 + os=`echo "$basic_os" | sed -e 's|os2-emx|emx|'` ;; nto-qnx*) kernel=nto - os=`echo $basic_os | sed -e 's|nto-qnx|qnx|'` + os=`echo "$basic_os" | sed -e 's|nto-qnx|qnx|'` ;; *-*) # shellcheck disable=SC2162 + saved_IFS=$IFS IFS="-" read kernel os <&2 + fi + ;; + *) + echo "Invalid configuration '$1': OS '$os' not recognized" 1>&2 + exit 1 + ;; +esac + +case $obj in + aout* | coff* | elf* | pe*) + ;; + '') + # empty is fine + ;; *) - echo Invalid configuration \`"$1"\': OS \`"$os"\' not recognized 1>&2 + echo "Invalid configuration '$1': Machine code format '$obj' not recognized" 1>&2 + exit 1 + ;; +esac + +# Here we handle the constraint that a (synthetic) cpu and os are +# valid only in combination with each other and nowhere else. +case $cpu-$os in + # The "javascript-unknown-ghcjs" triple is used by GHC; we + # accept it here in order to tolerate that, but reject any + # variations. + javascript-ghcjs) + ;; + javascript-* | *-ghcjs) + echo "Invalid configuration '$1': cpu '$cpu' is not valid with os '$os$obj'" 1>&2 exit 1 ;; esac # As a final step for OS-related things, validate the OS-kernel combination # (given a valid OS), if there is a kernel. -case $kernel-$os in - linux-gnu* | linux-dietlibc* | linux-android* | linux-newlib* | linux-musl* | linux-uclibc* ) +case $kernel-$os-$obj in + linux-gnu*- | linux-android*- | linux-dietlibc*- | linux-llvm*- \ + | linux-mlibc*- | linux-musl*- | linux-newlib*- \ + | linux-relibc*- | linux-uclibc*- ) + ;; + uclinux-uclibc*- ) + ;; + managarm-mlibc*- | managarm-kernel*- ) ;; - -dietlibc* | -newlib* | -musl* | -uclibc* ) + windows*-msvc*-) + ;; + -dietlibc*- | -llvm*- | -mlibc*- | -musl*- | -newlib*- | -relibc*- \ + | -uclibc*- ) # These are just libc implementations, not actual OSes, and thus # require a kernel. - echo "Invalid configuration \`$1': libc \`$os' needs explicit kernel." 1>&2 + echo "Invalid configuration '$1': libc '$os' needs explicit kernel." 1>&2 exit 1 ;; - kfreebsd*-gnu* | kopensolaris*-gnu*) + -kernel*- ) + echo "Invalid configuration '$1': '$os' needs explicit kernel." 1>&2 + exit 1 ;; - nto-qnx*) + *-kernel*- ) + echo "Invalid configuration '$1': '$kernel' does not support '$os'." 1>&2 + exit 1 + ;; + *-msvc*- ) + echo "Invalid configuration '$1': '$os' needs 'windows'." 1>&2 + exit 1 + ;; + kfreebsd*-gnu*- | kopensolaris*-gnu*-) + ;; + vxworks-simlinux- | vxworks-simwindows- | vxworks-spe-) + ;; + nto-qnx*-) ;; - *-eabi* | *-gnueabi*) + os2-emx-) ;; - -*) + *-eabi*- | *-gnueabi*-) + ;; + none--*) + # None (no kernel, i.e. freestanding / bare metal), + # can be paired with an machine code file format + ;; + -*-) # Blank kernel with real OS is always fine. ;; - *-*) - echo "Invalid configuration \`$1': Kernel \`$kernel' not known to work with OS \`$os'." 1>&2 + --*) + # Blank kernel and OS with real machine code file format is always fine. + ;; + *-*-*) + echo "Invalid configuration '$1': Kernel '$kernel' not known to work with OS '$os'." 1>&2 exit 1 ;; esac @@ -1840,7 +1960,7 @@ case $vendor in ;; esac -echo "$cpu-$vendor-${kernel:+$kernel-}$os" +echo "$cpu-$vendor${kernel:+-$kernel}${os:+-$os}${obj:+-$obj}" exit # Local variables: diff --git a/bin/makefile-emscripten.wasm-wasm b/bin/makefile-emscripten.wasm-wasm new file mode 100644 index 00000000..8d884231 --- /dev/null +++ b/bin/makefile-emscripten.wasm-wasm @@ -0,0 +1,34 @@ +# Options for Emscripten, WASM and SDL + +CC = emcc $(CLANG_CFLAGS) + +XFILES = $(OBJECTDIR)sdl.o + +XFLAGS = -DSDL -sUSE_SDL=2 + +# OPTFLAGS is normally -O2. +OPTFLAGS = -O2 +DFLAGS = $(XFLAGS) -DRELEASE=351 -DMAIKO_ENABLE_NETHUB + +MEDLEY?=../../medley +SYSOUT?=$(MEDLEY)/loadups/full.sysout + +LD = emcc +LDFLAGS = -sUSE_SDL=2 -sASYNCIFY -sALLOW_MEMORY_GROWTH -sEXIT_RUNTIME=1 \ + --preload-file $(SYSOUT)@medley/loadups/full.sysout \ + --preload-file $(MEDLEY)/loadups/whereis.hash@medley/loadups/whereis.hash \ + --preload-file $(MEDLEY)/greetfiles/MEDLEYDIR-INIT.LCOM@usr/local/lde/site-init.lisp \ + --preload-file $(MEDLEY)/docs/@medley/docs \ + --preload-file $(MEDLEY)/doctools/@medley/doctools \ + --preload-file $(MEDLEY)/greetfiles/@medley/greetfiles \ + --preload-file $(MEDLEY)/internal/@medley/internal \ + --preload-file $(MEDLEY)/sources/@medley/sources \ + --preload-file $(MEDLEY)/library/@medley/library \ + --preload-file $(MEDLEY)/lispusers/@medley/lispusers \ + --preload-file $(MEDLEY)/fonts/@medley/fonts + +LDELDFLAGS = + +OBJECTDIR = ../$(RELEASENAME)/ + +default : ../$(OSARCHNAME)/ldesdl.js diff --git a/bin/makefile-emscripten.wasm_nl-wasm_nl b/bin/makefile-emscripten.wasm_nl-wasm_nl new file mode 100644 index 00000000..b9f57364 --- /dev/null +++ b/bin/makefile-emscripten.wasm_nl-wasm_nl @@ -0,0 +1,23 @@ +# Options for Emscripten, WASM and SDL + +CC = emcc $(CLANG_CFLAGS) + +XFILES = $(OBJECTDIR)sdl.o + +XFLAGS = -DSDL -sUSE_SDL=2 + +# OPTFLAGS is normally -O2. +OPTFLAGS = -O2 +DFLAGS = $(XFLAGS) -DRELEASE=351 -DMAIKO_ENABLE_NETHUB + +MEDLEY?=../../medley +SYSOUT?=$(MEDLEY)/loadups/full.sysout + +LD = emcc +LDFLAGS = -sUSE_SDL=2 -sASYNCIFY -sALLOW_MEMORY_GROWTH -sEXIT_RUNTIME=1 -sFORCE_FILESYSTEM -sLZ4 + +LDELDFLAGS = + +OBJECTDIR = ../$(RELEASENAME)/ + +default : ../$(OSARCHNAME)/ldesdl.js diff --git a/bin/makefile-haiku.x86_64-sdl b/bin/makefile-haiku.x86_64-sdl new file mode 100644 index 00000000..1e68a871 --- /dev/null +++ b/bin/makefile-haiku.x86_64-sdl @@ -0,0 +1,19 @@ +# Options for Haiku, Intel x86_64 and SDL + +CC = gcc -m64 $(GCC_CFLAGS) +# CC = clang -m64 $(CLANG_CFLAGS) + +XFILES = $(OBJECTDIR)sdl.o + +XFLAGS = -DSDL + +# OPTFLAGS is normally -O2. +OPTFLAGS = -O2 -g3 +DFLAGS = $(XFLAGS) -DRELEASE=351 + +LDFLAGS = -lSDL2 -lnetwork +LDELDFLAGS = -lnetwork -lbsd + +OBJECTDIR = ../$(RELEASENAME)/ + +default : ../$(OSARCHNAME)/lde ../$(OSARCHNAME)/ldesdl diff --git a/bin/makeright b/bin/makeright index 27fcb1ae..87fc1fc6 100755 --- a/bin/makeright +++ b/bin/makeright @@ -88,6 +88,16 @@ case "$display" in sdl) releasename=${osversion}.${architecture}-${display} ldename=ldesdl ;; + wasm) osversion=emscripten + architecture=wasm + releasename=${osversion}.${architecture}-${display} + ldename=ldesdl.js + ;; + wasm_nl) osversion=emscripten + architecture=wasm_nl + releasename=${osversion}.${architecture}-${display} + ldename=ldesdl.js + ;; *) echo "display-option: $display is not supported." exit ;; diff --git a/bin/osversion b/bin/osversion index 19f6eaea..80bf6bdd 100755 --- a/bin/osversion +++ b/bin/osversion @@ -12,6 +12,7 @@ case "$os" in *-*-openbsd*) echo openbsd ;; *-*-freebsd*) echo freebsd ;; *-*-cygwin*) echo cygwin ;; + *-*-haiku*) echo haiku ;; esac ### Don't leave the variable set. unset os diff --git a/inc/adr68k.h b/inc/adr68k.h index 9799780b..42cae9c2 100644 --- a/inc/adr68k.h +++ b/inc/adr68k.h @@ -63,8 +63,8 @@ static inline DLword StackOffsetFromNative(void *SAddr) { /* Stack offsets are expressed as an offset in DLwords from the stack base */ ptrdiff_t hoffset = (DLword *)SAddr - Stackspace; - if (hoffset > 0xffff) { - printf("Stack offset is too large: 0x%tx\n", hoffset); + if (hoffset > 0xffff || hoffset < 0) { + printf("Stack offset is out of range: 0x%tx\n", hoffset); } return (DLword)hoffset; } diff --git a/inc/keyeventdefs.h b/inc/keyeventdefs.h index eafd012e..da5a6997 100644 --- a/inc/keyeventdefs.h +++ b/inc/keyeventdefs.h @@ -4,6 +4,7 @@ void process_io_events(void); void kb_trans(u_short keycode, u_short upflg); void taking_mouse_down(void); +void taking_mouse_up(int newx, int newy); void copy_cursor(int newx, int newy); void cursor_hidden_bitmap(int x, int y); #endif diff --git a/inc/maiko/platform.h b/inc/maiko/platform.h index 2fa747e9..725db07a 100644 --- a/inc/maiko/platform.h +++ b/inc/maiko/platform.h @@ -83,6 +83,19 @@ # define MAIKO_OS_DETECTED 1 #endif +#ifdef __EMSCRIPTEN__ +# define MAIKO_OS_LINUX 1 +# define MAIKO_OS_EMSCRIPTEN 1 +# define MAIKO_OS_NAME "Emscripten" +# define MAIKO_EMULATE_TIMER_INTERRUPTS 1 +# define MAIKO_EMULATE_ASYNC_INTERRUPTS 1 +# define MAIKO_OS_UNIX_LIKE 1 +# define MAIKO_OS_DETECTED +# define MAIKO_ARCH_NAME "WebAssembly" +# define MAIKO_ARCH_WORD_BITS 32 +# define MAIKO_ARCH_DETECTED 1 +#endif + /* __x86_64__: GNU C, __x86_64: Sun Studio, _M_AMD64: Visual Studio */ #if defined(__x86_64__) || defined(__x86_64) || defined(_M_AMD64) # define MAIKO_ARCH_X86_64 1 @@ -153,6 +166,12 @@ # define MAIKO_ARCH_DETECTED 1 #endif +#ifdef __HAIKU__ +# define MAIKO_OS_HAIKU 1 +# define MAIKO_OS_NAME "Haiku" +# define MAIKO_OS_UNIX_LIKE 1 +# define MAIKO_OS_DETECTED 1 +#endif /* Modern GNU C, Clang, Sun Studio provide __BYTE_ORDER__ * Older GNU C (ca. 4.0.1) provides __BIG_ENDIAN__/__LITTLE_ENDIAN__ */ diff --git a/inc/return.h b/inc/return.h index 90749fb4..e4930321 100644 --- a/inc/return.h +++ b/inc/return.h @@ -37,7 +37,7 @@ #define FastRetCALL \ do { \ /* Get IVar from Returnee's IVAR offset slot(BF) */ \ - IVar = NativeAligned2FromLAddr(STK_OFFSET | GETWORD((DLword *)CURRENTFX -1)); \ + IVar = NativeAligned2FromStackOffset(GETWORD((DLword *)CURRENTFX - 1)); \ /* Get FuncObj from Returnee's FNHEAD slot in FX */ \ FuncObj = (struct fnhead *)NativeAligned4FromLAddr(FX_FNHEADER); \ /* Get PC from Returnee's pc slot in FX */ \ @@ -47,7 +47,7 @@ #define FastRetCALL \ do { \ /* Get IVar from Returnee's IVAR offset slot(BF) */ \ - IVar = NativeAligned2FromLAddr(STK_OFFSET | GETWORD((DLword *)CURRENTFX -1)); \ + IVar = NativeAligned2FromStackOffset(GETWORD((DLword *)CURRENTFX - 1)); \ /* Get FuncObj from Returnee's FNHEAD slot in FX */ \ FuncObj = (struct fnhead *)NativeAligned4FromLAddr(FX_FNHEADER); \ /* Get PC from Returnee's pc slot in FX */ \ diff --git a/inc/stack.h b/inc/stack.h index f93be91d..721c15df 100644 --- a/inc/stack.h +++ b/inc/stack.h @@ -79,22 +79,22 @@ typedef struct fnhead { } FNHEAD; typedef struct frameex1 { - unsigned flags : 3; - unsigned fast : 1; - unsigned nil2 : 1; /* not used, prev: This frame treats N-func */ - unsigned incall : 1; - unsigned validnametable : 1; + unsigned short flags : 3; + unsigned short fast : 1; + unsigned short nil2 : 1; /* not used, prev: This frame treats N-func */ + unsigned short incall : 1; + unsigned short validnametable : 1; /* 0: look for FunctionHeader 1: look for NameTable on this FrameEx */ - unsigned nopush : 1; - unsigned usecount : 8; + unsigned short nopush : 1; + unsigned short usecount : 8; DLword alink; /* alink pointer (Low addr) */ #ifdef BIGVM LispPTR fnheader; /* pointer to FunctionHeader (Hi2 addr) */ #else DLword lofnheader; /* pointer to FunctionHeader (Low addr) */ - unsigned hi1fnheader : 8; /* pointer to FunctionHeader (Hi1 addr) */ - unsigned hi2fnheader : 8; /* pointer to FunctionHeader (Hi2 addr) */ + unsigned short hi1fnheader : 8; /* pointer to FunctionHeader (Hi1 addr) */ + unsigned short hi2fnheader : 8; /* pointer to FunctionHeader (Hi2 addr) */ #endif /* BIGVM */ DLword nextblock; /* pointer to FreeStackBlock */ DLword pc; /* Program counter */ @@ -102,23 +102,23 @@ typedef struct frameex1 { LispPTR nametable; /* ptr to NameTable of this FrameEx (Hi2 addr) */ #else DLword lonametable; /* ptr to NameTable of this FrameEx (Low addr) */ - unsigned hi1nametable : 8; /* ptr to NameTable of this FrameEx (Hi1 addr) */ - unsigned hi2nametable : 8; /* ptr to NameTable of this FrameEx (Hi2 addr) */ + unsigned short hi1nametable : 8; /* ptr to NameTable of this FrameEx (Hi1 addr) */ + unsigned short hi2nametable : 8; /* ptr to NameTable of this FrameEx (Hi2 addr) */ #endif /* BIGVM */ DLword blink; /* blink pointer (Low addr) */ DLword clink; /* clink pointer (Low addr) */ } FX; typedef struct frameex2 { - unsigned flags : 3; - unsigned fast : 1; - unsigned nil2 : 1; /* not used, prev: This frame treats N-func */ - unsigned incall : 1; - unsigned validnametable : 1; + unsigned short flags : 3; + unsigned short fast : 1; + unsigned short nil2 : 1; /* not used, prev: This frame treats N-func */ + unsigned short incall : 1; + unsigned short validnametable : 1; /* 0: look for FunctionHeader 1: look for NameTable on this FrameEx */ - unsigned nopush : 1; - unsigned usecount : 8; + unsigned short nopush : 1; + unsigned short usecount : 8; DLword alink; /* alink pointer (Low addr) */ LispPTR fnheader; /* pointer to FunctionHeader */ DLword nextblock; /* pointer to FreeStackBlock */ @@ -135,11 +135,11 @@ typedef struct fxblock { } FXBLOCK; typedef struct basic_frame { - unsigned flags : 3; - unsigned nil : 3; - unsigned residual : 1; - unsigned padding : 1; - unsigned usecnt : 8; + unsigned short flags : 3; + unsigned short nil : 3; + unsigned short residual : 1; + unsigned short padding : 1; + unsigned short usecnt : 8; DLword ivar; /* stk offset of IVARs for this frame ?? */ } Bframe; @@ -185,33 +185,33 @@ typedef struct fnhead { unsigned nil3 : 2; /* not used */ unsigned nil2 : 2; /* not used */ #endif /* BIGVM */ - unsigned argtype : 2; /* ?? */ - unsigned byteswapped : 1; /* code was reswapped. */ - unsigned nil4 : 1; /* not used, prev: native translated? */ - unsigned fvaroffset : 8; + unsigned short argtype : 2; /* ?? */ + unsigned short byteswapped : 1; /* code was reswapped. */ + unsigned short nil4 : 1; /* not used, prev: native translated? */ + unsigned short fvaroffset : 8; /* DLword offset from head of NameTable */ - unsigned nlocals : 8; /* ?? */ + unsigned short nlocals : 8; /* ?? */ DLword ntsize; /* size of NameTable */ /* NameTable of variable length is following with this structure. */ } FNHEAD; typedef struct frameex1 { DLword alink; /* alink pointer (Low addr) */ - unsigned usecount : 8; - unsigned nopush : 1; - unsigned validnametable : 1; + unsigned short usecount : 8; + unsigned short nopush : 1; + unsigned short validnametable : 1; /* 0: look for FunctionHeader 1: look for NameTable on this FrameEx */ - unsigned incall : 1; - unsigned nil2 : 1; /* not used, prev: This frame treats N-func */ - unsigned fast : 1; - unsigned flags : 3; /* hi word */ + unsigned short incall : 1; + unsigned short nil2 : 1; /* not used, prev: This frame treats N-func */ + unsigned short fast : 1; + unsigned short flags : 3; /* hi word */ #ifdef BIGVM LispPTR fnheader; /* pointer to FunctionHeader (Hi2 addr) */ #else - unsigned hi2fnheader : 8; /* pointer to FunctionHeader (Hi2 addr) */ - unsigned hi1fnheader : 8; /* pointer to FunctionHeader (Hi1 addr) */ + unsigned short hi2fnheader : 8; /* pointer to FunctionHeader (Hi2 addr) */ + unsigned short hi1fnheader : 8; /* pointer to FunctionHeader (Hi1 addr) */ DLword lofnheader; /* pointer to FunctionHeader (Low addr) */ #endif /* BIGVM */ @@ -221,8 +221,8 @@ typedef struct frameex1 { #ifdef BIGVM LispPTR nametable; /* pointer to NameTable of this FX (Hi2 addr) */ #else - unsigned hi2nametable : 8; /* pointer to NameTable of this FX (Hi2 addr) */ - unsigned hi1nametable : 8; /* pointer to NameTable of this FX (Hi1 addr) */ + unsigned short hi2nametable : 8; /* pointer to NameTable of this FX (Hi2 addr) */ + unsigned short hi1nametable : 8; /* pointer to NameTable of this FX (Hi1 addr) */ DLword lonametable; /* pointer to NameTable of this FX (Low addr) */ #endif /* BIGVM */ @@ -232,15 +232,15 @@ typedef struct frameex1 { typedef struct frameex2 { DLword alink; /* alink pointer (Low addr) */ - unsigned usecount : 8; - unsigned nopush : 1; - unsigned validnametable : 1; + unsigned short usecount : 8; + unsigned short nopush : 1; + unsigned short validnametable : 1; /* 0: look for FunctionHeader 1: look for NameTable on this FrameEx */ - unsigned incall : 1; - unsigned nil2 : 1; /* not used, prev: This frame treats N-func */ - unsigned fast : 1; - unsigned flags : 3; + unsigned short incall : 1; + unsigned short nil2 : 1; /* not used, prev: This frame treats N-func */ + unsigned short fast : 1; + unsigned short flags : 3; LispPTR fnheader; /* pointer to FunctionHeader (swapped) */ @@ -261,11 +261,11 @@ typedef struct fxblock { typedef struct basic_frame { DLword ivar; - unsigned usecnt : 8; - unsigned padding : 1; - unsigned residual : 1; - unsigned nil : 3; - unsigned flags : 3; + unsigned short usecnt : 8; + unsigned short padding : 1; + unsigned short residual : 1; + unsigned short nil : 3; + unsigned short flags : 3; } Bframe; diff --git a/src/bbtsub.c b/src/bbtsub.c index af07f147..e824b09d 100644 --- a/src/bbtsub.c +++ b/src/bbtsub.c @@ -1664,7 +1664,7 @@ void ccfuncall(unsigned int atom_index, int argnum, int bytenum) CURRENTFX->nextblock = (LAddrFromNative(CurrentStackPTR) & 0x0ffff) - (argnum << 1) + 4 /* +3 */; /* Setup IVar */ /* XXX: is it really only 2-byte aligned? */ - IVar = NativeAligned2FromLAddr((((LispPTR)(CURRENTFX->nextblock)) | STK_OFFSET)); + IVar = NativeAligned2FromStackOffset(CURRENTFX->nextblock); /* Set PC to the Next Instruction and save into FX */ CURRENTFX->pc = ((UNSIGNED)PC - (UNSIGNED)FuncObj) + bytenum; diff --git a/src/common.c b/src/common.c index 785941d2..06722d4f 100644 --- a/src/common.c +++ b/src/common.c @@ -64,14 +64,14 @@ LispPTR Uraid_mess = NIL; int error(const char *cp) { char *ptr; if (device_before_raid() < 0) { - fprintf(stderr, "Can't Enter URAID.\n"); + (void)fprintf(stderr, "Can't Enter URAID.\n"); exit(-1); } /* comm read */ URaid_errmess = cp; - fprintf(stderr, "\n*Error* %s\n", cp); + (void)fprintf(stderr, "\n*Error* %s\n", cp); fflush(stdin); - fprintf(stderr, "Enter the URaid\n"); + (void)fprintf(stderr, "Enter the URaid\n"); print(Uraid_mess); putchar('\n'); /* XXX: make sure output is flushed so we can see where we are */ diff --git a/src/dbgtool.c b/src/dbgtool.c index 70ee8f4b..3f0dad7c 100644 --- a/src/dbgtool.c +++ b/src/dbgtool.c @@ -303,14 +303,14 @@ int sf(struct frameex1 *fx_addr68k) { if (((fx_addr68k)->alink & 1) == 0) { /* FAST */ bf = (Bframe *)(((DLword *)fx_addr68k) - 2); } else { /* SLOW */ - bf = (Bframe *)NativeAligned4FromLAddr(((fx_addr68k)->blink + STK_OFFSET)); + bf = (Bframe *)NativeAligned4FromStackOffset((fx_addr68k)->blink); } /* Print IVARs */ printf("IVAR -------\n"); BT_morep; - ptr = NativeAligned2FromLAddr(STK_OFFSET + bf->ivar); + ptr = NativeAligned2FromStackOffset(bf->ivar); i = 0; while (ptr != (DLword *)bf) { ptrlo = ptr + 1; @@ -475,7 +475,7 @@ int sf(struct frameex1 *fx_addr68k) { i++; } if (fx_addr68k->alink == 11) /* for contextsw */ - next68k = (DLword *)NativeAligned2FromLAddr((fx_addr68k->nextblock + STK_OFFSET)); + next68k = NativeAligned2FromStackOffset(fx_addr68k->nextblock); else next68k = CurrentStackPTR; @@ -493,7 +493,7 @@ int sf(struct frameex1 *fx_addr68k) { return (-1); } - next68k = (DLword *)NativeAligned2FromLAddr((fx_addr68k->nextblock + STK_OFFSET)); + next68k = NativeAligned2FromStackOffset(fx_addr68k->nextblock); ptr = (DLword *)(fx_addr68k + 1); i = 0; diff --git a/src/dlpi.c b/src/dlpi.c index abeffd15..61b88abf 100644 --- a/src/dlpi.c +++ b/src/dlpi.c @@ -188,7 +188,7 @@ int setup_dlpi_dev(char *device) dlbindreq(fd, 0x0600, 0, DL_CLDLS, 0, 0); if (dlbindack(fd, buf) < 0) { - fprintf(stderr, "%s: dlbindack failed.\n", pname); + (void)fprintf(stderr, "%s: dlbindack failed.\n", pname); return (-1); } @@ -202,14 +202,14 @@ int setup_dlpi_dev(char *device) dlpromisconreq(fd, DL_PROMISC_SAP); if (dlokack(fd, buf) < 0) { - fprintf(stderr, "%s: DL_PROMISC_SAP failed.\n", pname); + (void)fprintf(stderr, "%s: DL_PROMISC_SAP failed.\n", pname); return (-1); } dlpromisconreq(fd, DL_PROMISC_MULTI); if (dlokack(fd, buf) < 0) { - fprintf(stderr, "%s: DL_PROMISC_MULTI failed.\n", pname); + (void)fprintf(stderr, "%s: DL_PROMISC_MULTI failed.\n", pname); return (-1); } @@ -329,8 +329,8 @@ int dlpi_devtype(int fd) case DL_FDDI: return (DLT_FDDI); #endif default: - fprintf(stderr, "%s: DLPI MACtype %ld unknown, ", pname, (long)dlp->info_ack.dl_mac_type); - fprintf(stderr, "assuming ethernet.\n"); + (void)fprintf(stderr, "%s: DLPI MACtype %ld unknown, ", pname, (long)dlp->info_ack.dl_mac_type); + (void)fprintf(stderr, "assuming ethernet.\n"); return (DLT_EN10MB); } } @@ -585,7 +585,7 @@ static int strgetmsg(int fd, struct strbuf *ctlp, struct strbuf *datap, int *fla /* * sigalrm - handle alarms. */ -static void sigalrm(int sig) { (void)fprintf(stderr, "dlpi: timeout\n"); } +static void sigalrm(int sig) { (void)(void)fprintf(stderr, "dlpi: timeout\n"); } /* * savestr - save string in dynamic memory. @@ -595,7 +595,7 @@ static char *savestr(char *s) char *t; if ((t = malloc(strlen(s) + 1)) == NULL) { - (void)fprintf(stderr, "%s: out of memory.\n", pname); + (void)(void)fprintf(stderr, "%s: out of memory.\n", pname); (void)exit(1); } diff --git a/src/dsk.c b/src/dsk.c index ff349d3e..516c0611 100644 --- a/src/dsk.c +++ b/src/dsk.c @@ -3053,10 +3053,8 @@ static int get_version_array(char *dir, char *file, FileName *varray, CurrentVAr FileName *svarray; DIR *dirp; struct dirent *dp; - /* Used in commented out code below: int rval; struct stat sbuf; - */ /* * First of all, prepare a lower cased file name for the case insensitive @@ -3066,20 +3064,14 @@ static int get_version_array(char *dir, char *file, FileName *varray, CurrentVAr separate_version(lcased_file, ver, 1); DOWNCASE(lcased_file); - /* - TIMEOUT(rval = stat(dir, &sbuf)); - if (rval == -1) { - *Lisp_errno = errno; - return(0); - } - */ - - /* - * If the cached version array is still valid, we can return immediately. - */ + TIMEOUT(rval = stat(dir, &sbuf)); + if (rval == -1) { + *Lisp_errno = errno; + return(0); + } /* - * Cache mechanism is not used now, because of the bug of Sun OS. + * Cache mechanism was not used because of a bug in Sun OS. * Sometimes just after unlinking a file on a directory, the st_mtime * of the directory does not change. This will make Maiko believe * cached version array is still valid, although it is already invalid. @@ -3087,9 +3079,15 @@ static int get_version_array(char *dir, char *file, FileName *varray, CurrentVAr */ /* - if ((sbuf.st_mtime == cache->mtime) && strcmp(dir, cache->path) == 0 - && strcmp(lcased_file, cache->file) == 0) return(1); - */ + * If the cached version array is still valid, we can return immediately. + */ + +#if 0 + /* there is a (different?) problem (#1661) with the caching - disable until it's solved */ + if ((sbuf.st_mtime == cache->mtime) && strcmp(dir, cache->path) == 0 + && strcmp(lcased_file, cache->file) == 0) return(1); +#endif + errno = 0; TIMEOUT0(dirp = opendir(dir)); if (dirp == NULL) { @@ -3140,11 +3138,9 @@ static int get_version_array(char *dir, char *file, FileName *varray, CurrentVAr /* * Update cache information. */ - /* - strcpy(cache->path, dir); - strcpy(cache->file, lcased_file); - cache->mtime = sbuf.st_mtime; - */ + strcpy(cache->path, dir); + strcpy(cache->file, lcased_file); + cache->mtime = sbuf.st_mtime; TIMEOUT(closedir(dirp)); return (1); #endif /* DOS */ diff --git a/src/dspif.c b/src/dspif.c index 808f8e3c..7f8ec498 100644 --- a/src/dspif.c +++ b/src/dspif.c @@ -59,8 +59,8 @@ void make_dsp_instance(DspInterface dsp, char *lispbitmap, int width_hint, int h } else if (VGA_p()) { VGA_init(dsp, 0, 0, 0, depth_hint); } else { /* Can't set *ANY* video mode! */ - (void)fprintf(stderr, "No portable graphics mode supported by this host.\n"); - (void)fprintf(stderr, "\n-Expected VESA or VGA.\n"); + (void)(void)fprintf(stderr, "No portable graphics mode supported by this host.\n"); + (void)(void)fprintf(stderr, "\n-Expected VESA or VGA.\n"); exit(1); } break; @@ -69,7 +69,7 @@ void make_dsp_instance(DspInterface dsp, char *lispbitmap, int width_hint, int h #elif XWINDOW /* lispbitmap is 0 when we call X_init the first time. */ if (X_init(dsp, 0, LispDisplayRequestedWidth, LispDisplayRequestedHeight, depth_hint) == NULL) { - fprintf(stderr, "Can't open display."); + (void)fprintf(stderr, "Can't open display."); exit(-1); } #endif /* DOS | XWINDOW */ @@ -87,7 +87,7 @@ void GenericReturnVoid(void *d) {(void)d; return; } void GenericPanic(void *d) { (void)d; TPRINT(("Enter GenericPanic\n")); - fprintf(stderr, "Panic! Call to uninitialized display slot!"); + (void)fprintf(stderr, "Panic! Call to uninitialized display slot!"); exit(0); } diff --git a/src/findkey.c b/src/findkey.c index 88d250a1..f456f36b 100644 --- a/src/findkey.c +++ b/src/findkey.c @@ -45,7 +45,7 @@ LispPTR N_OP_findkey(LispPTR tos, int byte) { #endif if (CURRENTFX->alink & 1) { /* slow case */ - find_end = (DLword *)NativeAligned2FromLAddr(STK_OFFSET | (CURRENTFX->blink - 4)); + find_end = NativeAligned2FromStackOffset(CURRENTFX->blink - 4); } else { /* Fast cae */ find_end = ((DLword *)CURRENTFX) - 2 - 4; } diff --git a/src/inet.c b/src/inet.c index 0231d3a9..1526a572 100644 --- a/src/inet.c +++ b/src/inet.c @@ -26,6 +26,7 @@ #include #include #include +/* if using inet_ntop you must #include */ #endif /* DOS */ #if (defined(OS5) || defined(__CYGWIN__)) && !defined(O_ASYNC) @@ -93,7 +94,8 @@ LispPTR subr_TCP_ops(int op, LispPTR nameConn, LispPTR proto, LispPTR length, Li LispStringToCString(nameConn, namestring, 100); host = gethostbyname(namestring); if (!host) return (NIL); - N_ARITH_SWITCH(ntohl(*(long *)host->h_addr)); + res = ntohl(*(in_addr_t *)host->h_addr); + N_ARITH_SWITCH(res); break; case TCPservicelookup: @@ -107,14 +109,20 @@ LispPTR subr_TCP_ops(int op, LispPTR nameConn, LispPTR proto, LispPTR length, Li addr_class = LispNumToCInt(nameConn); protocol = LispNumToCInt(proto); result = socket(addr_class, protocol, 0); +#ifndef MAIKO_OS_HAIKU fcntl(result, F_SETFL, fcntl(result, F_GETFL, 0) | O_ASYNC | O_NONBLOCK); +#else + fcntl(result, F_SETFL, fcntl(result, F_GETFL, 0) | O_NONBLOCK); +#endif +#ifdef F_SETOWN fcntl(result, F_SETOWN, getpid()); +#endif return (GetSmallp(result)); case TCPconnect: /* args: hostname or (fixp)address, socket# */ memset(&farend, 0, sizeof farend); N_GETNUMBER(nameConn, res, string_host); - farend.sin_addr.s_addr = htons(res); + farend.sin_addr.s_addr = htonl(res); goto host_ok; string_host: LispStringToCString(nameConn, namestring, 100); @@ -131,7 +139,9 @@ LispPTR subr_TCP_ops(int op, LispPTR nameConn, LispPTR proto, LispPTR length, Li return (NIL); } fcntl(result, F_SETFL, fcntl(result, F_GETFL, 0) | O_NONBLOCK); +#ifdef F_SETOWN fcntl(result, F_SETOWN, getpid()); +#endif return (GetSmallp(result)); @@ -197,13 +207,20 @@ LispPTR subr_TCP_ops(int op, LispPTR nameConn, LispPTR proto, LispPTR length, Li sigset_t signals; sigemptyset(&signals); +#ifndef MAIKO_OS_HAIKU sigaddset(&signals, SIGIO); - +#endif sigprocmask(SIG_BLOCK, &signals, NULL); +#ifndef MAIKO_OS_HAIKU fcntl(result, F_SETFL, fcntl(result, F_GETFL, 0) | O_ASYNC | O_NONBLOCK); - fcntl(result, F_SETOWN, getpid()); +#else + fcntl(result, F_SETFL, fcntl(result, F_GETFL, 0) | O_NONBLOCK); +#endif +#ifdef F_SETOWN + fcntl(result, F_SETOWN, getpid()); +#endif if (listen(result, 5) == -1) { perror("TCP Listen"); close(result); @@ -225,8 +242,9 @@ LispPTR subr_TCP_ops(int op, LispPTR nameConn, LispPTR proto, LispPTR length, Li return (NIL); } fcntl(result, F_SETFL, fcntl(result, F_GETFL, 0) | O_NONBLOCK); +#ifdef F_SETOWN fcntl(result, F_SETOWN, getpid()); - +#endif return (GetSmallp(result)); case INETpeername: /* socket#, buffer for name string */ @@ -259,9 +277,14 @@ LispPTR subr_TCP_ops(int op, LispPTR nameConn, LispPTR proto, LispPTR length, Li close(result); return (NIL); } +#ifndef MAIKO_OS_HAIKU fcntl(result, F_SETFL, fcntl(result, F_GETFL, 0) | O_ASYNC | O_NONBLOCK); +#else + fcntl(result, F_SETFL, fcntl(result, F_GETFL, 0) | O_NONBLOCK); +#endif +#ifdef F_SETOWN fcntl(result, F_SETOWN, getpid()); - +#endif FD_SET(result, &LispIOFds); /* so we get interrupts */ FD_SET(result, &LispReadFds); DBPRINT(("LispIOFds = %p\n", (void *)&LispIOFds)); diff --git a/src/initkbd.c b/src/initkbd.c index 39612f39..8a455280 100644 --- a/src/initkbd.c +++ b/src/initkbd.c @@ -375,8 +375,6 @@ static u_char *make_X_keymap(void) { table[xcode - 7] = code; } - XFree(mapping); /* No locking required? */ - #ifdef DEBUG printf("\n\n\tXGetKeyboardMapping table\n\n"); for (i = 0; i < codecount * symspercode; i += symspercode) { @@ -394,6 +392,8 @@ static u_char *make_X_keymap(void) { } #endif /* DEBUG */ + XFree(mapping); /* No locking required? */ + return (table); } diff --git a/src/initsout.c b/src/initsout.c index dc70e7af..aed42612 100644 --- a/src/initsout.c +++ b/src/initsout.c @@ -124,7 +124,7 @@ void init_ifpage(unsigned sysout_size) { new_lastvmem = (sysout_size * PAGES_IN_MBYTE) - 1; if ((!Storage_expanded) && (InterfacePage->dllastvmempage != new_lastvmem)) { - fprintf(stderr, "You can't expand VMEM\n"); + (void)fprintf(stderr, "You can't expand VMEM\n"); exit(-1); } else { /* Set value which will be set to \\LASTVMEMFILEPAGE in LISP */ InterfacePage->dllastvmempage = new_lastvmem; @@ -140,9 +140,9 @@ void init_ifpage(unsigned sysout_size) { #endif /* BIGVM */ /* unfortunately, Lisp only looks at a 16 bit serial number */ -#ifndef DOS +#if !defined(DOS) && !defined(MAIKO_OS_HAIKU) InterfacePage->serialnumber = 0xffff & gethostid(); -#endif /* DOS */ +#endif /* DOS MAIKO_OS_HAIKU */ /* get user name and stuff into vmem; this is the VMEM buffer; This is a BCPL string -- it starts with a length count. C strings diff --git a/src/lde.html b/src/lde.html new file mode 100644 index 00000000..d429eb41 --- /dev/null +++ b/src/lde.html @@ -0,0 +1,24 @@ + + + + + + + + + +
+ +
+ + + + diff --git a/src/ldeboot.c b/src/ldeboot.c index 6e189272..e850ee1f 100644 --- a/src/ldeboot.c +++ b/src/ldeboot.c @@ -93,7 +93,7 @@ int main(int argc, char *argv[]) { for (i = 1; i < argc; i++) { if ((strcmp(argv[i], "-d") == 0) || (strcmp(argv[i], "-display") == 0)) { if (i == argc - 1) { - fprintf(stderr, "Missing argument to -display option.\n"); + (void)fprintf(stderr, "Missing argument to -display option.\n"); exit(1); } displayName = argv[++i]; @@ -138,7 +138,7 @@ int main(int argc, char *argv[]) { filetorun = LDEX; goto run; } else { - fprintf(stderr, "Unable to open X11 display %s\n", + (void)fprintf(stderr, "Unable to open X11 display %s\n", displayName ? displayName : "from DISPLAY"); exit(1); } @@ -147,7 +147,7 @@ int main(int argc, char *argv[]) { #ifdef USESUNSCREEN if ((FrameBufferFd = open("/dev/fb", O_RDWR)) < 0) { - fprintf(stderr, "lde: can't open FrameBuffer\n"); + (void)fprintf(stderr, "lde: can't open FrameBuffer\n"); exit(1); } if (ioctl(FrameBufferFd, FBIOGTYPE, &my_screen) < 0) { @@ -187,7 +187,7 @@ int main(int argc, char *argv[]) { run: if (filetorun == NULL) { - fprintf(stderr, "Unable to determine what display program to run.\n"); + (void)fprintf(stderr, "Unable to determine what display program to run.\n"); exit(1); } @@ -201,6 +201,7 @@ int main(int argc, char *argv[]) { } else { /* copy up to and including the final "/" in the path */ dirsepp = stpncpy(filetorunpath, argv[0], dirsepp + 1 - argv[0]); + /* dirsepp now points to the trailing null in the copy */ strncpy(dirsepp, filetorun, PATH_MAX - (dirsepp - filetorunpath)); argv[0] = filetorunpath; diff --git a/src/ldsout.c b/src/ldsout.c index 5860a0a4..e9afd7ee 100644 --- a/src/ldsout.c +++ b/src/ldsout.c @@ -121,14 +121,14 @@ unsigned sysout_loader(const char *sysout_file_name, unsigned sys_size) { */ #ifndef NOVERSION if (ifpage.lversion < LVERSION) { - fprintf(stderr, "Lisp VM is too old for this emulator.\n"); - fprintf(stderr, "(version is %d, must be at least %d.)\n", ifpage.lversion, LVERSION); + (void)fprintf(stderr, "Lisp VM is too old for this emulator.\n"); + (void)fprintf(stderr, "(version is %d, must be at least %d.)\n", ifpage.lversion, LVERSION); exit(-1); } if (ifpage.minbversion > MINBVERSION) { - fprintf(stderr, "Emulator is too old for this Lisp VM.\n"); - fprintf(stderr, "(version is %d, must be at least %d.)\n", MINBVERSION, ifpage.minbversion); + (void)fprintf(stderr, "Emulator is too old for this Lisp VM.\n"); + (void)fprintf(stderr, "(version is %d, must be at least %d.)\n", MINBVERSION, ifpage.minbversion); exit(-1); } #endif /* NOVERSION */ @@ -157,9 +157,9 @@ unsigned sysout_loader(const char *sysout_file_name, unsigned sys_size) { /* Hence we have to observe the display protocol. */ VESA_errorexit(tmp); #else - fprintf(stderr, "sysout_loader: You can't specify the process size.\n"); - fprintf(stderr, "Because, secondary space is already used.\n"); - fprintf(stderr, "(size is %d, you specified %d.)\n", ifpage.process_size, sys_size); + (void)fprintf(stderr, "sysout_loader: You can't specify the process size.\n"); + (void)fprintf(stderr, "Because, secondary space is already used.\n"); + (void)fprintf(stderr, "(size is %d, you specified %d.)\n", ifpage.process_size, sys_size); exit(-1); #endif /* DOS */ } @@ -176,7 +176,7 @@ unsigned sysout_loader(const char *sysout_file_name, unsigned sys_size) { lispworld_scratch = mmap(0, sys_size * MBYTE, PROT_READ|PROT_WRITE, MAP_ANON | MAP_PRIVATE, -1, 0); if (lispworld_scratch == MAP_FAILED) { - fprintf(stderr, "sysout_loader: can't allocate Lisp %dMBytes VM \n", sys_size); + (void)fprintf(stderr, "sysout_loader: can't allocate Lisp %dMBytes VM \n", sys_size); exit(-1); } diff --git a/src/loopsops.c b/src/loopsops.c index 3544905f..90e2c1e7 100644 --- a/src/loopsops.c +++ b/src/loopsops.c @@ -26,7 +26,7 @@ #include "gcarraydefs.h" // for get_package_atom #include "gcdata.h" // for FRPLPTR #include "lispemul.h" // for LispPTR, state, CurrentStackPTR, NIL_PTR, NIL -#include "lispmap.h" // for S_POSITIVE, STK_OFFSET +#include "lispmap.h" // for S_POSITIVE #include "loopsopsdefs.h" // for lcfuncall, LCFetchMethod, LCFetchMethodOrHelp #include "lspglob.h" #include "lsptypes.h" // for GetDTD, GetTypeNumber, dtd, Listp, GETWORD @@ -358,7 +358,7 @@ LispPTR lcfuncall(unsigned int atom_index, int argnum, int bytenum) CURRENTFX->nextblock = (LAddrFromNative(CurrentStackPTR) & 0x0ffff) - (argnum << 1) + 4 /* +3 */; /* Setup IVar */ - IVar = NativeAligned2FromLAddr((((LispPTR)(CURRENTFX->nextblock)) | STK_OFFSET)); + IVar = NativeAligned2FromStackOffset(CURRENTFX->nextblock); /* Set PC to the Next Instruction and save into FX */ CURRENTFX->pc = ((UNSIGNED)PC - (UNSIGNED)FuncObj) + bytenum; diff --git a/src/main.c b/src/main.c index 4d231072..1d554dbe 100644 --- a/src/main.c +++ b/src/main.c @@ -364,7 +364,7 @@ int main(int argc, char *argv[]) } if (argv[i] && ((strcmp(argv[i], "-help") == 0) || (strcmp(argv[i], "-HELP") == 0))) { - fprintf(stderr, "%s%s", helpstring, nethubHelpstring); + (void)fprintf(stderr, "%s%s", helpstring, nethubHelpstring); exit(0); } @@ -387,7 +387,7 @@ int main(int argc, char *argv[]) } if (access(sysout_name, R_OK)) { perror("Couldn't find a sysout to run"); - fprintf(stderr, "%s%s", helpstring, nethubHelpstring); + (void)fprintf(stderr, "%s%s", helpstring, nethubHelpstring); exit(1); } /* OK, sysout name is now in sysout_name, and i is moved past a supplied name */ @@ -403,11 +403,11 @@ int main(int argc, char *argv[]) if (errno == 0 && tmpint > 0) { TIMER_INTERVAL = tmpint; } else { - fprintf(stderr, "Bad value for -t (integer > 0)\n"); + (void)fprintf(stderr, "Bad value for -t (integer > 0)\n"); exit(1); } } else { - fprintf(stderr, "Missing argument after -t\n"); + (void)fprintf(stderr, "Missing argument after -t\n"); exit(1); } } @@ -419,11 +419,11 @@ int main(int argc, char *argv[]) if (errno == 0 && tmpint > 0) { sysout_size = (unsigned)tmpint; } else { - fprintf(stderr, "Bad value for -m (integer > 0)\n"); + (void)fprintf(stderr, "Bad value for -m (integer > 0)\n"); exit(1); } } else { - fprintf(stderr, "Missing argument after -m\n"); + (void)fprintf(stderr, "Missing argument after -m\n"); exit(1); } } @@ -462,22 +462,22 @@ int main(int argc, char *argv[]) if (argc > ++i) { int read = sscanf(argv[i], "%dx%d", &width, &height); if(read != 2) { - fprintf(stderr, "Could not parse -sc argument %s\n", argv[i]); + (void)fprintf(stderr, "Could not parse -sc argument %s\n", argv[i]); exit(1); } } else { - fprintf(stderr, "Missing argument after -sc\n"); + (void)fprintf(stderr, "Missing argument after -sc\n"); exit(1); } } else if ((strcmp(argv[i], "-pixelscale") == 0) || (strcmp(argv[i], "-PIXELSCALE") == 0)) { if (argc > ++i) { int read = sscanf(argv[i], "%d", &pixelscale); if(read != 1) { - fprintf(stderr, "Could not parse -pixelscale argument %s\n", argv[i]); + (void)fprintf(stderr, "Could not parse -pixelscale argument %s\n", argv[i]); exit(1); } } else { - fprintf(stderr, "Missing argument after -pixelscale\n"); + (void)fprintf(stderr, "Missing argument after -pixelscale\n"); exit(1); } } else if ((strcmp(argv[i], "-t") == 0) || (strcmp(argv[i], "-T") == 0) @@ -485,7 +485,7 @@ int main(int argc, char *argv[]) if (argc > ++i) { windowtitle = argv[i]; } else { - fprintf(stderr, "Missing argument after -title\n"); + (void)fprintf(stderr, "Missing argument after -title\n"); exit(1); } } @@ -511,7 +511,7 @@ int main(int argc, char *argv[]) ether_host[4] = b4; ether_host[5] = b5; } else { - fprintf(stderr, "Missing or bogus -E argument\n"); + (void)fprintf(stderr, "Missing or bogus -E argument\n"); ether_fd = -1; exit(1); } @@ -524,7 +524,7 @@ int main(int argc, char *argv[]) if (argc > ++i) { setNethubHost(argv[i]); } else { - fprintf(stderr, "Missing argument after -nh-host\n"); + (void)fprintf(stderr, "Missing argument after -nh-host\n"); exit(1); } } @@ -535,11 +535,11 @@ int main(int argc, char *argv[]) if (errno == 0 && tmpint > 0) { setNethubPort(tmpint); } else { - fprintf(stderr, "Bad value for -nh-port\n"); + (void)fprintf(stderr, "Bad value for -nh-port\n"); exit(1); } } else { - fprintf(stderr, "Missing argument after -nh-port\n"); + (void)fprintf(stderr, "Missing argument after -nh-port\n"); exit(1); } } @@ -549,11 +549,11 @@ int main(int argc, char *argv[]) if (sscanf(argv[i], "%x-%x-%x-%x-%x-%x", &b0, &b1, &b2, &b3, &b4, &b5) == 6) { setNethubMac(b0, b1, b2, b3, b4, b5); } else { - fprintf(stderr, "Invalid argument for -nh-mac\n"); + (void)fprintf(stderr, "Invalid argument for -nh-mac\n"); exit(1); } } else { - fprintf(stderr, "Missing argument after -nh-mac\n"); + (void)fprintf(stderr, "Missing argument after -nh-mac\n"); exit(1); } } @@ -564,11 +564,11 @@ int main(int argc, char *argv[]) if (errno == 0 && tmpint >= 0) { setNethubLogLevel(tmpint); } else { - fprintf(stderr, "Bad value for -nh-loglevel\n"); + (void)fprintf(stderr, "Bad value for -nh-loglevel\n"); exit(1); } } else { - fprintf(stderr, "Missing argument after -nh-loglevel\n"); + (void)fprintf(stderr, "Missing argument after -nh-loglevel\n"); exit(1); } } @@ -582,11 +582,11 @@ int main(int argc, char *argv[]) if (errno == 0 && tmpint > 1000) { insnsCountdownForTimerAsyncEmulation = tmpint; } else { - fprintf(stderr, "Bad value for -intr-emu-insns (integer > 1000)\n"); + (void)fprintf(stderr, "Bad value for -intr-emu-insns (integer > 1000)\n"); exit(1); } } else { - fprintf(stderr, "Missing argument after -intr-emu-insns\n"); + (void)fprintf(stderr, "Missing argument after -intr-emu-insns\n"); exit(1); } } @@ -600,11 +600,11 @@ int main(int argc, char *argv[]) if (errno == 0 && tmpint > 0) { maxpages = (unsigned)tmpint; } else { - fprintf(stderr, "Bad value for -xpages (integer > 0)\n"); + (void)fprintf(stderr, "Bad value for -xpages (integer > 0)\n"); exit(1); } } else { - fprintf(stderr, "Missing argument after -xpages\n"); + (void)fprintf(stderr, "Missing argument after -xpages\n"); exit(1); } } @@ -615,9 +615,9 @@ int main(int argc, char *argv[]) probemouse(); /* See if the mouse is connected. */ #else if (getuid() != geteuid()) { - fprintf(stderr, "Effective user is not real user. Resetting uid\n"); + (void)fprintf(stderr, "Effective user is not real user. Resetting uid\n"); if (setuid(getuid()) == -1) { - fprintf(stderr, "Unable to reset user id to real user id\n"); + (void)fprintf(stderr, "Unable to reset user id to real user id\n"); exit(1); } } @@ -641,7 +641,7 @@ int main(int argc, char *argv[]) if (FindUnixPipes()) /* must call the routine to allocate storage, */ { /* in case we're re-starting a savevm w/open ptys */ - if (please_fork) fprintf(stderr, "Failed to find UNIXCOMM file handles; no processes\n"); + if (please_fork) (void)fprintf(stderr, "Failed to find UNIXCOMM file handles; no processes\n"); } #endif /* DOS */ @@ -665,7 +665,7 @@ int main(int argc, char *argv[]) /* file system directory enumeration stuff */ if (!init_finfo()) { - fprintf(stderr, "Cannot allocate internal data.\n"); + (void)fprintf(stderr, "Cannot allocate internal data.\n"); exit(1); } #ifdef RS232 @@ -727,9 +727,9 @@ void start_lisp(void) { TopOfStack = 0; Error_Exit = 0; - PVar = (DLword *)NativeAligned2FromLAddr(STK_OFFSET | InterfacePage->currentfxp) + FRAMESIZE; + PVar = NativeAligned2FromStackOffset(InterfacePage->currentfxp) + FRAMESIZE; - freeptr = next68k = NativeAligned2FromLAddr(STK_OFFSET | CURRENTFX->nextblock); + freeptr = next68k = NativeAligned2FromStackOffset(CURRENTFX->nextblock); if (GETWORD(next68k) != STK_FSB_WORD) error("Starting Lisp: Next stack block isn't free!"); diff --git a/src/perrno.c b/src/perrno.c index c7aa4c50..b2ed83fa 100644 --- a/src/perrno.c +++ b/src/perrno.c @@ -25,8 +25,8 @@ /************************************************************************/ void perrorn(char *s, int n) { - if (s != NULL && *s != '\0') { fprintf(stderr, "%s: ", s); } - fprintf(stderr, "%s\n", strerror(n)); + if (s != NULL && *s != '\0') { (void)fprintf(stderr, "%s: ", s); } + (void)fprintf(stderr, "%s\n", strerror(n)); } /************************************************************************/ @@ -42,7 +42,7 @@ void err_mess(char *from, int no) { int save_errno = errno; /* Save errno around OSMESSAGE_PRINT */ OSMESSAGE_PRINT({ - fprintf(stderr, "System call error: %s errno=%d ", from, no); + (void)fprintf(stderr, "System call error: %s errno=%d ", from, no); perror(""); }); diff --git a/src/rawcolor.c b/src/rawcolor.c index 9019c6df..8bb35a12 100644 --- a/src/rawcolor.c +++ b/src/rawcolor.c @@ -37,9 +37,11 @@ #include "gcarraydefs.h" #include "testtooldefs.h" +#include "lineblt8defs.h" #include "lsthandldefs.h" #include "car-cdrdefs.h" #include "keyeventdefs.h" +#include "rawcolordefs.h" #define IMIN(x, y) (((x) > (y)) ? (y) : (x)) #define IMAX(x, y) (((x) > (y)) ? (x) : (y)) @@ -72,6 +74,15 @@ LispPTR SLOWBLTCHAR_index; return; \ } +static void ColorizeFont8(BITMAP *sBM, DLword sXOffset, DLword sYOffset, + BITMAP *dBM, DLword dXOffset, DLword dYOffset, + DLword width, DLword height, u_char col0, u_char col1, + LispPTR sourcetype, LispPTR operation); +static void ColorizeFont8_BIGBM(BITMAP *sBM, DLword sXOffset, DLword sYOffset, + BIGBM *dBM, DLword dXOffset, DLword dYOffset, + DLword width, DLword height, u_char col0, u_char col1, + LispPTR sourcetype, LispPTR operation); + /***********************************************************/ /* C_slowbltchar @@ -302,7 +313,7 @@ void C_slowbltchar(LispPTR *args) u_int ColorizedFont8CACHE[MAXFONTHEIGHT / BITSPERNIBBLE * MAXFONTWIDTH / BITSPERNIBBLE]; -void ColorizeFont8(BITMAP *sBM, DLword sXOffset, DLword sYOffset, BITMAP *dBM, DLword dXOffset, DLword dYOffset, DLword width, DLword height, u_char col0, u_char col1, +static void ColorizeFont8(BITMAP *sBM, DLword sXOffset, DLword sYOffset, BITMAP *dBM, DLword dXOffset, DLword dYOffset, DLword width, DLword height, u_char col0, u_char col1, LispPTR sourcetype, LispPTR operation) { DLword *nbase; @@ -312,10 +323,10 @@ void ColorizeFont8(BITMAP *sBM, DLword sXOffset, DLword sYOffset, BITMAP *dBM, D sYOffset = sBM->bmheight - (sYOffset + height); dYOffset = dBM->bmheight - (dYOffset + height); - nbase = (DLword *)NativeAligned2FromLAddr(sBM->bmbase) + (sBM->bmrasterwidth * sYOffset); - (DLword *)dbase = (DLword *)NativeAligned2FromLAddr(dBM->bmbase) + (dBM->bmrasterwidth * dYOffset); + nbase = NativeAligned2FromLAddr(sBM->bmbase) + (sBM->bmrasterwidth * sYOffset); + dbase = (u_char *)NativeAligned2FromLAddr(dBM->bmbase) + (dBM->bmrasterwidth * dYOffset); for (i = 0, dbase += dXOffset; /* 8bpp */ - i < height; i++, nbase += sBM->bmrasterwidth, ((DLword *)dbase) += dBM->bmrasterwidth) { + i < height; i++, nbase += sBM->bmrasterwidth, dbase += dBM->bmrasterwidth * BYTESPER_DLWORD) { lineBlt8(nbase, (int)sXOffset, dbase, (int)width, col0, col1, sourcetype, operation); } /* for end */ @@ -332,7 +343,7 @@ void ColorizeFont8(BITMAP *sBM, DLword sXOffset, DLword sYOffset, BITMAP *dBM, D /* */ /************************************************************************/ -void ColorizeFont8_BIGBM(BITMAP *sBM, DLword sXOffset, DLword sYOffset, BIGBM *dBM, DLword dXOffset, DLword dYOffset, DLword width, DLword height, u_char col0, u_char col1, +static void ColorizeFont8_BIGBM(BITMAP *sBM, DLword sXOffset, DLword sYOffset, BIGBM *dBM, DLword dXOffset, DLword dYOffset, DLword width, DLword height, u_char col0, u_char col1, LispPTR sourcetype, LispPTR operation) { DLword *nbase; @@ -375,14 +386,13 @@ void ColorizeFont8_BIGBM(BITMAP *sBM, DLword sXOffset, DLword sYOffset, BIGBM *d dest_h = dest_fragbottom - (dest_fragtop + dest_yoffset); } /* end if */ - dbase = - (DLword *)NativeAligned2FromLAddr(dest_frag->bmbase) + (dest_frag->bmrasterwidth * dest_yoffset); - nbase = (DLword *)NativeAligned2FromLAddr(sBM->bmbase) + (sBM->bmrasterwidth * sYOffset); + dbase = (u_char *)NativeAligned2FromLAddr(dest_frag->bmbase) + (dest_frag->bmrasterwidth * dest_yoffset); + nbase = NativeAligned2FromLAddr(sBM->bmbase) + (sBM->bmrasterwidth * sYOffset); sYOffset += (DLword)dest_h; /* next src yoffset */ for (i = 0, dbase += dXOffset; i < dest_h; - i++, nbase += sBM->bmrasterwidth, ((DLword *)dbase) += dest_frag->bmrasterwidth) { + i++, nbase += sBM->bmrasterwidth, dbase += dest_frag->bmrasterwidth * BYTESPER_DLWORD) { lineBlt8(nbase, (int)sXOffset, dbase, (int)width, col0, col1, sourcetype, operation); } @@ -415,8 +425,8 @@ void newColorizeFont8(PILOTBBT *pbt, u_char backcolor, u_char forecolor, LispPTR u_char *dbase; int i; - nbase = (DLword *)NativeAligned2FromLAddr((pbt->pbtsourcehi << 16) | (pbt->pbtsourcelo)); - (DLword *)dbase = (DLword *)NativeAligned2FromLAddr((pbt->pbtdesthi << 16) | (pbt->pbtdestlo)); + nbase = NativeAligned2FromLAddr((pbt->pbtsourcehi << 16) | (pbt->pbtsourcelo)); + dbase = (u_char *)NativeAligned2FromLAddr((pbt->pbtdesthi << 16) | (pbt->pbtdestlo)); dbase += pbt->pbtdestbit; for (i = 0; i < pbt->pbtheight; i++, nbase += pbt->pbtsourcebpl / 16, dbase += pbt->pbtdestbpl / 8) { @@ -494,7 +504,7 @@ void Uncolorize_Bitmap(LispPTR args[]) if ((x & 0xF) != 0) *(d_base++) = word; - if (y != (s_height - 1)) { (DLword *)s_base += s_rasterwidth; } /* end if( y ) */ + if (y != (s_height - 1)) { s_base += s_rasterwidth * BYTESPER_DLWORD; } /* end if( y ) */ } /* end for( y ) */ @@ -532,11 +542,11 @@ LispPTR Colorize_Bitmap(LispPTR args[]) s_base = (DLword *)NativeAligned2FromLAddr(s_bitmap->bmbase) + s_bitmap->bmrasterwidth * (s_bitmap->bmheight - (s_bottom + height)); - (DLword *)d_base = (DLword *)NativeAligned2FromLAddr(d_bitmap->bmbase) + + d_base = (u_char *)NativeAligned2FromLAddr(d_bitmap->bmbase) + d_bitmap->bmrasterwidth * (d_bitmap->bmheight - (d_bottom + height)); for (i = 0, d_base += d_left; i < height; - i++, s_base += s_bitmap->bmrasterwidth, (DLword *)d_base += d_bitmap->bmrasterwidth) { + i++, s_base += s_bitmap->bmrasterwidth, d_base += d_bitmap->bmrasterwidth * BYTESPER_DLWORD) { lineBlt8(s_base, s_left, d_base, width, (u_char)color0, (u_char)color1, INPUT_atom, REPLACE_atom); diff --git a/src/return.c b/src/return.c index 0b8a23be..fe87cf6c 100644 --- a/src/return.c +++ b/src/return.c @@ -129,7 +129,7 @@ void contextsw(DLword fxnum, DLword bytenum, DLword flags) Midpunt(fxnum); /* exchanging FX */ - next68k = (DLword *)NativeAligned2FromLAddr(STK_OFFSET | CURRENTFX->nextblock); + next68k = NativeAligned2FromStackOffset(CURRENTFX->nextblock); if (GETWORD(next68k) != STK_FSB_WORD) error("contextsw(): MP9316"); freeptr = next68k; diff --git a/src/testtool.c b/src/testtool.c index 1f49fd0a..bf6b8a73 100644 --- a/src/testtool.c +++ b/src/testtool.c @@ -57,7 +57,7 @@ #include "gcarraydefs.h" // for aref1 #include "kprintdefs.h" // for print, prindatum #include "lispemul.h" // for DLword, LispPTR, DLbyte, state, T, ConsCell -#include "lispmap.h" // for STK_OFFSET, ATOMS_HI +#include "lispmap.h" // for ATOMS_HI #include "lspglob.h" // for Package_from_Index_word, Stackspace #include "lsptypes.h" // for GETWORD, dtd, GETBYTE, NEWSTRINGP, GetType... #include "mkatomdefs.h" // for compare_chars, make_atom @@ -852,7 +852,7 @@ void dump_bf(Bframe *bf) { if (BFRAMEPTR(bf)->residual) { goto printflags; } - ptr = NativeAligned2FromLAddr(STK_OFFSET + bf->ivar); + ptr = NativeAligned2FromStackOffset(bf->ivar); if ((((DLword *)bf - ptr) > 512) || (((UNSIGNED)ptr & 1) != 0)) { printf("\nInvalid basic frame"); return; @@ -910,7 +910,7 @@ void dump_fx(struct frameex1 *fx_addr68k) { /* should pay attention to the name table like RAID does */ - next68k = (DLword *)NativeAligned2FromLAddr((fx_addr68k->nextblock + STK_OFFSET)); + next68k = NativeAligned2FromStackOffset(fx_addr68k->nextblock); if (fx_addr68k == CURRENTFX) { next68k = CurrentStackPTR + 2; } if ((next68k < ptr) || (((UNSIGNED)next68k & 1) != 0)) { @@ -937,7 +937,7 @@ void dump_stackframe(struct frameex1 *fx_addr68k) { if ((fx_addr68k->alink & 1) == 0) { /* FAST */ bf = (Bframe *)(((DLword *)fx_addr68k) - 2); } else { /* SLOW */ - bf = (Bframe *)NativeAligned4FromLAddr((fx_addr68k->blink + STK_OFFSET)); + bf = (Bframe *)NativeAligned4FromStackOffset(fx_addr68k->blink); } dump_bf(bf); dump_fx((struct frameex1 *)fx_addr68k); @@ -1104,12 +1104,12 @@ void all_stack_dump(DLword start, DLword end, DLword silent) if (start == 0) start68k = Stackspace + InterfacePage->stackbase; else - start68k = NativeAligned2FromLAddr(STK_OFFSET | start); + start68k = NativeAligned2FromStackOffset(start); if (end == 0) end68k = Stackspace + InterfacePage->endofstack; else - end68k = NativeAligned2FromLAddr(STK_OFFSET | end); + end68k = NativeAligned2FromStackOffset(end); stkptr = (STKH *)start68k; @@ -1156,7 +1156,7 @@ void all_stack_dump(DLword start, DLword end, DLword silent) printf(" <-***current***"); size = EndSTKP - (DLword *)stkptr; } else { - size = NativeAligned2FromLAddr(STK_OFFSET | ((FX *)stkptr)->nextblock) - (DLword *)stkptr; + size = NativeAligned2FromStackOffset(((FX *)stkptr)->nextblock) - (DLword *)stkptr; } goto checksize; default: diff --git a/src/timer.c b/src/timer.c index 5d75bb2c..fed42f74 100644 --- a/src/timer.c +++ b/src/timer.c @@ -47,6 +47,10 @@ unsigned long tick_count = 0; /* approx 18 ticks per sec */ #include #endif /* DOS */ +#ifdef MAIKO_OS_HAIKU +#include +#endif + #if defined(USE_DLPI) #include extern int ether_fd; @@ -118,6 +122,19 @@ void update_miscstats(void) { MiscStats->diskiotime = 0; /* ?? not available ?? */ MiscStats->diskops = 0; MiscStats->secondstmp = MiscStats->secondsclock = (time(0) + UNIX_ALTO_TIME_DIFF); +#elif defined(MAIKO_OS_EMSCRIPTEN) + /* Emscripten does not provide getrusage() functionality */ + struct timeval timev; + + MiscStats->totaltime = gettime(0) - MiscStats->starttime; + MiscStats->swapwaittime = 0; + MiscStats->pagefaults = 0; + MiscStats->swapwrites = 0; + MiscStats->diskiotime = 0; + MiscStats->diskops = 0; + + gettimeofday(&timev, NULL); + MiscStats->secondstmp = MiscStats->secondsclock = (timev.tv_sec + UNIX_ALTO_TIME_DIFF); #else struct timeval timev; struct rusage ru; @@ -288,6 +305,10 @@ void subr_settime(LispPTR args[]) dosday.year = uxtime.tm_year; dosday.dayofweek = uxtime.tm_wday; _dos_setdate(&dosday); +#elif defined(MAIKO_OS_HAIKU) + (void)args[0]; +#elif defined(MAIKO_OS_EMSCRIPTEN) + (void)args[0]; #else struct timeval timev; timev.tv_sec = *((int *)NativeAligned4FromLAddr(args[0])) - UNIX_ALTO_TIME_DIFF; @@ -541,17 +562,19 @@ static void int_io_service(int sig) /************************************************************************/ static void int_io_init(void) { -#ifndef DOS +#if !defined(DOS) || !defined(MAIKO_OS_HAIKU) struct sigaction io_action; io_action.sa_handler = int_io_service; sigemptyset(&io_action.sa_mask); io_action.sa_flags = 0; +#ifndef MAIKO_OS_HAIKU if (sigaction(SIGIO, &io_action, NULL) == -1) { perror("sigaction: SIGIO"); } else { DBPRINT(("I/O interrupts enabled\n")); } +#endif #if defined(USE_DLPI) DBPRINT(("INIT ETHER: Doing I_SETSIG.\n")); @@ -563,7 +586,7 @@ static void int_io_init(void) { return; } #endif /* USE_DLPI */ -#endif /* DOS */ +#endif /* DOS MAIKO_OS_HAIKU */ } /************************************************************************/ @@ -585,7 +608,9 @@ void int_block(void) { sigset_t signals; sigemptyset(&signals); sigaddset(&signals, SIGVTALRM); +#ifndef MAIKO_OS_HAIKU sigaddset(&signals, SIGIO); +#endif sigaddset(&signals, SIGALRM); sigaddset(&signals, SIGXFSZ); #ifdef FLTINT @@ -613,7 +638,9 @@ void int_unblock(void) { sigset_t signals; sigemptyset(&signals); sigaddset(&signals, SIGVTALRM); +#ifndef MAIKO_OS_HAIKU sigaddset(&signals, SIGIO); +#endif sigaddset(&signals, SIGALRM); sigaddset(&signals, SIGXFSZ); #ifdef FLTINT diff --git a/src/tstsout.c b/src/tstsout.c index 2e9a0808..03b41156 100644 --- a/src/tstsout.c +++ b/src/tstsout.c @@ -73,7 +73,7 @@ void check_sysout(char *sysout_file_name, int verbose) { } void usage(char *prog) { - fprintf(stderr, "Usage: %s [-v] sysout-filename\n", prog); + (void)fprintf(stderr, "Usage: %s [-v] sysout-filename\n", prog); exit(-1); } diff --git a/src/tty.c b/src/tty.c index f00643fb..e628cfd5 100644 --- a/src/tty.c +++ b/src/tty.c @@ -51,7 +51,11 @@ void tty_open(void) if (TTY_Fd < 0) { if ((TTY_Fd = open(TTY_Dev, O_RDWR)) >= 0) { tcgetattr(TTY_Fd, &options); +#ifndef MAIKO_OS_HAIKU options.c_iflag &= ~(IMAXBEL|IXOFF|INPCK|BRKINT|PARMRK|ISTRIP|INLCR|IGNCR|ICRNL|IXON|IGNPAR); +#else + options.c_iflag &= ~(IXOFF|INPCK|BRKINT|PARMRK|ISTRIP|INLCR|IGNCR|ICRNL|IXON|IGNPAR); +#endif options.c_iflag |= IGNBRK; options.c_oflag &= ~OPOST; options.c_lflag &= ~(ECHO|ECHOE|ECHOK|ECHONL|ICANON|ISIG|IEXTEN|NOFLSH|TOSTOP); diff --git a/src/ufn.c b/src/ufn.c index 3f64be20..93eeff71 100644 --- a/src/ufn.c +++ b/src/ufn.c @@ -107,7 +107,7 @@ void ufn(DLword bytecode) (LAddrFromNative(CurrentStackPTR) & 0x0ffff) - (entry68k->arg_num << 1) + 2 /** +1 **/; /* Setup IVar */ - IVar = NativeAligned2FromLAddr((((LispPTR)(CURRENTFX->nextblock)) | STK_OFFSET)); + IVar = NativeAligned2FromStackOffset(CURRENTFX->nextblock); #ifdef LISPTRACE print(entry68k->atom_name); diff --git a/src/unixfork.c b/src/unixfork.c index 366495fc..1292a90f 100644 --- a/src/unixfork.c +++ b/src/unixfork.c @@ -219,7 +219,9 @@ int fork_Unix(void) { /* interrupts need to be blocked here so subprocess won't see them */ sigemptyset(&signals); sigaddset(&signals, SIGVTALRM); +#ifndef MAIKO_OS_HAIKU sigaddset(&signals, SIGIO); +#endif sigaddset(&signals, SIGALRM); sigaddset(&signals, SIGXFSZ); sigaddset(&signals, SIGFPE); @@ -234,19 +236,23 @@ int fork_Unix(void) { /* JRB - fork_Unix is now called in ldeboot; leave UnixPipe{In,Out} open and put their numbers in the environment so parent can find them */ /* JDS - NB that sprintf doesn't always return a string! */ - + /* NHB - if the return value of snprintf() is greater than or equal to the + * size argument, the string was too short and some of the printed + * characters were discarded. However we're printing numbers, so we know + * that the buffer is big enough + */ char tempstring[30]; - snprintf(tempstring, sizeof(tempstring), "%d", UnixToLisp[0]); + (void)snprintf(tempstring, sizeof(tempstring), "%d", UnixToLisp[0]); setenv("LDEPIPEIN", tempstring, 1); - snprintf(tempstring, sizeof(tempstring), "%d", LispToUnix[1]); + (void)snprintf(tempstring, sizeof(tempstring), "%d", LispToUnix[1]); setenv("LDEPIPEOUT", tempstring, 1); - snprintf(tempstring, sizeof(tempstring), "%ld", StartTime); + (void)snprintf(tempstring, sizeof(tempstring), "%ld", StartTime); setenv("LDESTARTTIME", tempstring, 1); - snprintf(tempstring, sizeof(tempstring), "%d", UnixPID); + (void)snprintf(tempstring, sizeof(tempstring), "%d", UnixPID); setenv("LDEUNIXPID", tempstring, 1); close(LispToUnix[0]); @@ -273,7 +279,7 @@ int fork_Unix(void) { DBPRINT(("Input packet wrong length: %zd", len)); exit(1); } - slot = IOBuf[3]; + slot = (int)IOBuf[3]; IOBuf[3] = 1; /* Start by signalling success in return-code */ switch (IOBuf[0]) { @@ -349,7 +355,7 @@ int fork_Unix(void) { perror("slave socket"); exit(1); } - sprintf(PipeName, "/tmp/LPU%ld-%d", StartTime, slot); + (void)snprintf(PipeName, sizeof(PipeName), "/tmp/LPU%ld-%d", StartTime, slot); memset(&addr, 0, sizeof(struct sockaddr_un)); addr.sun_family = AF_UNIX; strcpy(addr.sun_path, PipeName); diff --git a/src/uraid.c b/src/uraid.c index df9ecab9..abf2e492 100644 --- a/src/uraid.c +++ b/src/uraid.c @@ -776,7 +776,7 @@ LispPTR uraid_commands(void) { break; case 's': /* SHELL */ switch (vfork()) { - case -1: (void)fprintf(stderr, "uraid: Fork failed.\n"); exit(1); + case -1: (void)(void)fprintf(stderr, "uraid: Fork failed.\n"); exit(1); case 0: (void)execl("/bin/sh", "sh", "-i", NULL); exit(1); @@ -864,7 +864,9 @@ int device_before_raid(void) { #ifdef XWINDOW /* So X events still get recognized. */ sigemptyset(&signals); +#ifndef MAIKO_OS_HAIKU sigaddset(&signals, SIGIO); +#endif sigprocmask(SIG_UNBLOCK, &signals, NULL); #endif @@ -901,7 +903,7 @@ char *alloc_hideDISP(int size) { case SFS_NOTSWITCHABLE : if((retaddr =malloc(size)) ==0){ - fprintf(stderr,"can't alloc hide space\n"); + (void)fprintf(stderr,"can't alloc hide space\n"); } break; case 0 : @@ -925,7 +927,7 @@ char *alloc_hideDISP(int size) printf("Hidespace inside Lisp(4)\n"); } else if((retaddr=malloc(size)) ==0){ - fprintf(stderr,"can't alloc hide disp\n"); + (void)fprintf(stderr,"can't alloc hide disp\n"); } printf("Hidespace new\n"); break; diff --git a/src/uutils.c b/src/uutils.c index e3a58b29..e011229a 100644 --- a/src/uutils.c +++ b/src/uutils.c @@ -204,18 +204,10 @@ LispPTR unix_getparm(LispPTR *args) { #else envvalue = "mc68020"; #endif - + } else if (strcmp(envname, "OSNAME") == 0) { + envvalue = MAIKO_OS_NAME; } else if (strcmp(envname, "ARCH") == 0) { -#if defined(sparc) - envvalue = "sun4"; -#elif defined(DOS) - envvalue = "dos"; -#elif defined(MAIKO_OS_MACOS) - envvalue = "i386"; -#else - envvalue = "sun3"; -#endif - + envvalue = MAIKO_ARCH_NAME; } else if (strcmp(envname, "DISPLAY") == 0) { #if defined(XWINDOW) envvalue = "X"; @@ -239,10 +231,13 @@ LispPTR unix_getparm(LispPTR *args) { struct passwd *pwd; if ((pwd = getpwuid(getuid())) == NULL) return NIL; envvalue = pwd->pw_gecos; - } else if (strcmp(envname, "HOSTID") == 0) { + } +#ifndef MAIKO_OS_HAIKU + else if (strcmp(envname, "HOSTID") == 0) { snprintf(result, sizeof(result), "%lx", gethostid()); envvalue = result; } +#endif /* MAIKO_OS_HAIKU */ #endif /* DOS */ else return NIL; diff --git a/src/vesainit.c b/src/vesainit.c index 3c24827d..e531df28 100644 --- a/src/vesainit.c +++ b/src/vesainit.c @@ -235,7 +235,7 @@ void VESA_enter(DspInterface dsp) if (VESA_describemode(dsp->graphicsmode) != 0) { _setvideomode(_DEFAULTMODE); _clearscreen(_GCLEARSCREEN); - fprintf(stderr, "Can't set VESA mode %o.\n", dsp->graphicsmode); + (void)fprintf(stderr, "Can't set VESA mode %o.\n", dsp->graphicsmode); exit(0); } /* Get the segaddr. An addr. is a seg shifted 4 bits! */ @@ -326,7 +326,7 @@ VESA_errorexit(char *s, int errno) { _setvideomode(_DEFAULTMODE); _clearscreen(_GCLEARSCREEN); - fprintf(stderr, s); + (void)fprintf(stderr, s); fflush(stderr); exit(errno); } diff --git a/src/vgainit.c b/src/vgainit.c index b00cca4c..03619fdd 100644 --- a/src/vgainit.c +++ b/src/vgainit.c @@ -34,7 +34,7 @@ void VGA_setmax(DspInterface dsp) struct videoconfig vc; if (!_setvideomode(_MAXRESMODE)) { - fprintf(stderr, "Can't set graphics mode.\n"); + (void)fprintf(stderr, "Can't set graphics mode.\n"); exit(1); } _getvideoconfig(&vc); diff --git a/src/vmemsave.c b/src/vmemsave.c index 00c371bb..3ea6f09f 100644 --- a/src/vmemsave.c +++ b/src/vmemsave.c @@ -354,7 +354,7 @@ LispPTR vmem_save(char *sysout_file_name) TIMEOUT(sysout = open(sysout_file_name, O_WRONLY, 0666)); if (sysout == -1) { /* No file error skip return. */ - if (errno != 2) return (FILECANNOTOPEN); /* No such file error.*/ + if (errno != ENOENT) return (FILECANNOTOPEN); /* No such file error.*/ } else TIMEOUT(rval = close(sysout)); @@ -481,13 +481,13 @@ LispPTR vmem_save(char *sysout_file_name) TIMEOUT(rval = unlink(sysout_file_name)); if (rval == -1) { /* No file error skip return. */ - if (errno != 2) /* No such file error.*/ + if (errno != ENOENT) /* No such file error.*/ return (FILECANNOTOPEN); } TIMEOUT(rval = rename(tempname, sysout_file_name)); if (rval == -1) { - fprintf(stderr, "sysout is saved to temp file, %s.", tempname); + (void)fprintf(stderr, "sysout is saved to temp file, %s.", tempname); return (FILECANNOTWRITE); } diff --git a/src/xc.c b/src/xc.c index 51400420..907b16b2 100644 --- a/src/xc.c +++ b/src/xc.c @@ -20,6 +20,9 @@ /* */ /************************************************************************/ +#ifdef MAIKO_OS_EMSCRIPTEN +#include +#endif #include #include #include @@ -286,6 +289,9 @@ op_ufn : { Irq_Stk_End = 0; #if defined(MAIKO_EMULATE_ASYNC_INTERRUPTS) IO_Signalled = TRUE; +#endif +#ifdef MAIKO_OS_EMSCRIPTEN + emscripten_sleep(1); #endif pseudoTimerAsyncCountdown = insnsCountdownForTimerAsyncEmulation; } diff --git a/src/xinit.c b/src/xinit.c index 9278a2f8..e429d428 100644 --- a/src/xinit.c +++ b/src/xinit.c @@ -16,6 +16,7 @@ #include // for sig_atomic_t #include // for false, bool, true #include // for NULL +#include // for exit #include "adr68k.h" // for NativeAligned4FromLAddr #include "dbprint.h" // for TPRINT #include "devif.h" // for (anonymous), MRegion, DspInterface, OUTER_S... @@ -200,6 +201,27 @@ void Open_Display(DspInterface dsp) init_Xevent(dsp); /* Turn on the event reporting */ } /* end OpenDisplay */ +int X_FatalErrorHandler(Display *display) +{ + /* when the fatal error handler gets called it can do cleanup + * and either exit, or return. If it returns, the + * FatalErrorExitHandler will be called + */ + /* If we could do a SAVEVM in the interrupt context we would mark it + * as needed here. Returning will cause the FatalErrorExitHandler + * hook to be called. + */ + return 0; +} + +void X_FatalErrorExitHandler(Display *display, void *userdata) +{ + /* If we were invoking a SAVEVM/LOGOUT in the interrupt context we + * would not exit here, as the Lisp VM needs to continue to run + */ + exit(1); +} + /*********************************************************************/ /* */ /* X _ i n i t */ @@ -236,6 +258,10 @@ DspInterface X_init(DspInterface dsp, LispPTR lispbitmap, unsigned width_hint, u /* Try to open the X display. If this isn't possible, we just */ /* return FALSE. */ if ((dsp->display_id = XOpenDisplay(dsp->identifier)) == NULL) return (NULL); + + XSetIOErrorHandler(X_FatalErrorHandler); + XSetIOErrorExitHandler(dsp->display_id, X_FatalErrorExitHandler, NULL); + /* Load the dsp structure */ Xscreen = ScreenOfDisplay(dsp->display_id, DefaultScreen(dsp->display_id)); diff --git a/src/xmkicon.c b/src/xmkicon.c index ef313e83..20c4a485 100644 --- a/src/xmkicon.c +++ b/src/xmkicon.c @@ -136,8 +136,8 @@ Pixmap make_Xicon(DspInterface dsp) Lisp_icon_height); } else if (value == BitmapFileInvalid) - fprintf(stderr, "Iconpixmapfile %s contains invalid bitmap data\n", iconpixmapfile); + (void)fprintf(stderr, "Iconpixmapfile %s contains invalid bitmap data\n", iconpixmapfile); else if (value == BitmapNoMemory) - fprintf(stderr, "Not enough memory to allocate icon pixmap\n"); + (void)fprintf(stderr, "Not enough memory to allocate icon pixmap\n"); return (IconPixmap); } /* end make_Xicon */ diff --git a/src/xrdopt.c b/src/xrdopt.c index 55a1c3bd..8f1c3c5c 100644 --- a/src/xrdopt.c +++ b/src/xrdopt.c @@ -110,30 +110,30 @@ extern struct sockaddr_nit snit; void print_Xusage(const char *prog) { - fprintf(stderr, " %s options:\n", prog); - fprintf(stderr, " [-sysout] [] -path to the Medley image\n"); - fprintf(stderr, " -h[elp] -prints this text\n"); - fprintf(stderr, " -info -prints configuration info\n"); - fprintf(stderr, " -d[isplay] :.\n"); - fprintf(stderr, + (void)fprintf(stderr, " %s options:\n", prog); + (void)fprintf(stderr, " [-sysout] [] -path to the Medley image\n"); + (void)fprintf(stderr, " -h[elp] -prints this text\n"); + (void)fprintf(stderr, " -info -prints configuration info\n"); + (void)fprintf(stderr, " -d[isplay] :.\n"); + (void)fprintf(stderr, " -g[eometry] -size & placement for the medley window on your X " "screen\n"); - fprintf(stderr, + (void)fprintf(stderr, " -sc[reen] -size & placement for the medley display\n"); - fprintf(stderr, " -t[itle] -titlebar text for the window manager\n"); - fprintf(stderr, " -icontitle | -it -text for the medley icon\n"); - fprintf(stderr, " -iconbitmap | -ibm -bitmap for the medley icon\n"); - fprintf(stderr, + (void)fprintf(stderr, " -t[itle] -titlebar text for the window manager\n"); + (void)fprintf(stderr, " -icontitle | -it -text for the medley icon\n"); + (void)fprintf(stderr, " -iconbitmap | -ibm -bitmap for the medley icon\n"); + (void)fprintf(stderr, " -xsync -turn XSynchronize on. (default is off)\n\n"); #if defined(MAIKO_ENABLE_NETHUB) - fprintf(stderr,"\ + (void)fprintf(stderr,"\ -nh-host dodo-host Hostname for Dodo Nethub (no networking if missing)\n\ -nh-port port-number Port for Dodo Nethub (optional, default: 3333)\n\ -nh-mac XX-XX-XX-XX-XX-XX Machine-ID for Maiko-VM (optional, default: CA-FF-EE-12-34-56) \n\ -nh-loglevel level Loglevel for Dodo networking (0..2, optional, default: 0)\n\n"); #endif - fprintf(stderr, "Please refer to the manual for further information.\n\n"); - exit(0); + (void)fprintf(stderr, "Please refer to the manual for further information.\n\n"); + exit(EXIT_FAILURE); } /* end print_Xusage() */ /************************************************************************/ @@ -206,9 +206,9 @@ void read_Xoption(int *argc, char *argv[]) if (XrmGetResource(commandlineDB, "ldex.display", "Ldex.Display", str_type, &value) == True) { (void)strncpy(Display_Name, value.addr, value.size); } else if (getenv("DISPLAY") == (char *)NULL) { - fprintf(stderr, "Can't find a display. Either set the shell\n"); - fprintf(stderr, "variable DISPLAY to an appropriate display\n"); - fprintf(stderr, "or provide a -display argument.\n"); + (void)fprintf(stderr, "Can't find a display. Either set the shell\n"); + (void)fprintf(stderr, "variable DISPLAY to an appropriate display\n"); + (void)fprintf(stderr, "or provide a -display argument.\n"); print_Xusage(argv[0]); } else { envname = getenv("DISPLAY"); @@ -228,7 +228,7 @@ void read_Xoption(int *argc, char *argv[]) } XCloseDisplay(xdisplay); } else { - fprintf(stderr, "Open_Display: cannot connect to display %s.", XDisplayName(Display_Name)); + (void)fprintf(stderr, "Open_Display: cannot connect to display %s.", XDisplayName(Display_Name)); exit(-1); } @@ -248,7 +248,7 @@ void read_Xoption(int *argc, char *argv[]) (void)strncpy(sysout_name, value.addr, value.size); } if (sysout_name[0] == '\0') { - fprintf(stderr, "Couldn't find a sysout to run;\n"); + (void)fprintf(stderr, "Couldn't find a sysout to run;\n"); print_Xusage(argv[0]); } @@ -329,7 +329,7 @@ void read_Xoption(int *argc, char *argv[]) ether_host[4] = b4; ether_host[5] = b5; } else { - fprintf(stderr, "Missing or bogus -E argument\n"); + (void)fprintf(stderr, "Missing or bogus -E argument\n"); ether_fd = -1; exit(1); }