Commit of 3.99.0 version

This commit is contained in:
Erick Gallesio
2019-10-31 11:59:06 +01:00
parent 831a9f5c47
commit 5f74a25a3c
719 changed files with 81792 additions and 61853 deletions
+37
View File
@@ -0,0 +1,37 @@
#
# Makefile for the libstack library
#
# Copyright © 1997-1998 Erick Gallesio - I3S-CNRS/ESSI <eg@unice.fr>
#
# Permission to use, copy, and/or distribute this software and its
# documentation for any purpose and without fee is hereby granted, provided
# that both the above copyright notice and this permission notice appear in
# all copies and derived works. Fees for distribution or use of this
# software or derived works may only be charged with express written
# permission of the copyright holder.
# This software is provided ``as is'' without express or implied warranty.
#
# Author: Erick Gallesio [eg@unice.fr]
# Creation date: 27-Sep-1997 20:02
# Last file update: 1-Jan-1998 19:19
#
CFLAGS=@CFLAGS@
CC=@CC@
all: libstack.a
libstack.a: libstack.o libstack.h @LOW@
/bin/rm -f libstack.a
ar cqv libstack.a libstack.o @LOW@
@RANLIB@ libstack.a
test: testlib
./testlib | uniq -c
testlib: test.o libstack.a
$(CC) -o testlib test.o libstack.a
clean:
/bin/rm -f libstack.c lowstack.s lowstack.c *.o *~ config.* \
Makefile libstack.a testlib libstack.h
+71
View File
@@ -0,0 +1,71 @@
-- Author: Erick Gallesio [eg@unice.fr]
-- Creation date: 28-Sep-1997 18:27
-- Last file update: 14-Dec-1997 22:05
--
-- $Id: README 1.1 Sat, 03 Jan 1998 13:46:25 +0100 eg $
This directory contains code which deals with the stack. It is VERY
machine dependent and must be adapted for new architectures. In some
circumstances, part of the code must even be written in assembler.
The code contained in this directory defines a library called libstack
which is needed for STk FFI (Foreign Functions Interface). Basically,
this code allow to push argument on the stack (at least logically,
since first parameters of a function are often in registers) and call
the function when all the arguments have been pushed. The push
functions are typed and there is a function call for each type of
function result.
The types managed by the library as arguments are:
- char
- short (signed and unsigned)
- int (signed and unsigned)
- long (signed and unsigned)
- float
- double
- pointers (without type)
- strings
- booleans (seen as int in the C world)
The types returned which can be returned by a function called by the FFI can
be:
- char
- short (signed and unsigned)
- int (signed and unsigned)
- long (signed and unsigned)
- float
- double
- pointers ( pointer can point static or dynamic data)
- strings
- boolean
Array are not managed yet, since they don't seem very useful.
Structures are not managed by the library but their support would be
very useful. However, most of the C library don't use C struct as
parameters but rather pointers on C structures.
All the symbols exported by the library are prefixed by stk (for
"stack", not "STk" ;-)
This code has been tested on the following architectures/systems
I386 Linux 2.0 (ELF)
sun4x SunOS 4.1.x & SunOS 5.5.x
Alpha OSF1 V4.0
HP HP-UX B.10.20
MIPS32 IRIX 6.2
To port the library on another architecture, start for the
architecture which is the "nearest". You can compile a test program
with "make testlib". A simple and fast test is "./testlib | uniq -c".
Each function call must be preceded by the number 2.
If you port the library on another architecture, please send a
patch file by mail at eg@unice.fr. Thanks.
Vendored Executable
+855
View File
@@ -0,0 +1,855 @@
#! /bin/sh
# Guess values for system-dependent variables and create Makefiles.
# Generated automatically using autoconf version 2.7
# Copyright (C) 1992, 1993, 1994 Free Software Foundation, Inc.
#
# This configure script is free software; the Free Software Foundation
# gives unlimited permission to copy, distribute and modify it.
# Defaults:
ac_help=
ac_default_prefix=/usr/local
# Any additions from configure.in:
# Initialize some variables set by options.
# The variables have the same names as the options, with
# dashes changed to underlines.
build=NONE
cache_file=./config.cache
exec_prefix=NONE
host=NONE
no_create=
nonopt=NONE
no_recursion=
prefix=NONE
program_prefix=NONE
program_suffix=NONE
program_transform_name=s,x,x,
silent=
site=
srcdir=
target=NONE
verbose=
x_includes=NONE
x_libraries=NONE
bindir='${exec_prefix}/bin'
sbindir='${exec_prefix}/sbin'
libexecdir='${exec_prefix}/libexec'
datadir='${prefix}/share'
sysconfdir='${prefix}/etc'
sharedstatedir='${prefix}/com'
localstatedir='${prefix}/var'
libdir='${exec_prefix}/lib'
includedir='${prefix}/include'
oldincludedir='/usr/include'
infodir='${prefix}/info'
mandir='${prefix}/man'
# Initialize some other variables.
subdirs=
MFLAGS= MAKEFLAGS=
ac_prev=
for ac_option
do
# If the previous option needs an argument, assign it.
if test -n "$ac_prev"; then
eval "$ac_prev=\$ac_option"
ac_prev=
continue
fi
case "$ac_option" in
-*=*) ac_optarg=`echo "$ac_option" | sed 's/[-_a-zA-Z0-9]*=//'` ;;
*) ac_optarg= ;;
esac
# Accept the important Cygnus configure options, so we can diagnose typos.
case "$ac_option" in
-bindir | --bindir | --bindi | --bind | --bin | --bi)
ac_prev=bindir ;;
-bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*)
bindir="$ac_optarg" ;;
-build | --build | --buil | --bui | --bu)
ac_prev=build ;;
-build=* | --build=* | --buil=* | --bui=* | --bu=*)
build="$ac_optarg" ;;
-cache-file | --cache-file | --cache-fil | --cache-fi \
| --cache-f | --cache- | --cache | --cach | --cac | --ca | --c)
ac_prev=cache_file ;;
-cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \
| --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*)
cache_file="$ac_optarg" ;;
-datadir | --datadir | --datadi | --datad | --data | --dat | --da)
ac_prev=datadir ;;
-datadir=* | --datadir=* | --datadi=* | --datad=* | --data=* | --dat=* \
| --da=*)
datadir="$ac_optarg" ;;
-disable-* | --disable-*)
ac_feature=`echo $ac_option|sed -e 's/-*disable-//'`
# Reject names that are not valid shell variable names.
if test -n "`echo $ac_feature| sed 's/[-a-zA-Z0-9_]//g'`"; then
{ echo "configure: error: $ac_feature: invalid feature name" 1>&2; exit 1; }
fi
ac_feature=`echo $ac_feature| sed 's/-/_/g'`
eval "enable_${ac_feature}=no" ;;
-enable-* | --enable-*)
ac_feature=`echo $ac_option|sed -e 's/-*enable-//' -e 's/=.*//'`
# Reject names that are not valid shell variable names.
if test -n "`echo $ac_feature| sed 's/[-_a-zA-Z0-9]//g'`"; then
{ echo "configure: error: $ac_feature: invalid feature name" 1>&2; exit 1; }
fi
ac_feature=`echo $ac_feature| sed 's/-/_/g'`
case "$ac_option" in
*=*) ;;
*) ac_optarg=yes ;;
esac
eval "enable_${ac_feature}='$ac_optarg'" ;;
-exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \
| --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \
| --exec | --exe | --ex)
ac_prev=exec_prefix ;;
-exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \
| --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \
| --exec=* | --exe=* | --ex=*)
exec_prefix="$ac_optarg" ;;
-gas | --gas | --ga | --g)
# Obsolete; use --with-gas.
with_gas=yes ;;
-help | --help | --hel | --he)
# Omit some internal or obsolete options to make the list less imposing.
# This message is too long to be a string in the A/UX 3.1 sh.
cat << EOF
Usage: configure [options] [host]
Options: [defaults in brackets after descriptions]
Configuration:
--cache-file=FILE cache test results in FILE
--help print this message
--no-create do not create output files
--quiet, --silent do not print \`checking...' messages
--version print the version of autoconf that created configure
Directory and file names:
--prefix=PREFIX install architecture-independent files in PREFIX
[$ac_default_prefix]
--exec-prefix=EPREFIX install architecture-dependent files in EPREFIX
[same as prefix]
--bindir=DIR user executables in DIR [EPREFIX/bin]
--sbindir=DIR system admin executables in DIR [EPREFIX/sbin]
--libexecdir=DIR program executables in DIR [EPREFIX/libexec]
--datadir=DIR read-only architecture-independent data in DIR
[PREFIX/share]
--sysconfdir=DIR read-only single-machine data in DIR [PREFIX/etc]
--sharedstatedir=DIR modifiable architecture-independent data in DIR
[PREFIX/com]
--localstatedir=DIR modifiable single-machine data in DIR [PREFIX/var]
--libdir=DIR object code libraries in DIR [EPREFIX/lib]
--includedir=DIR C header files in DIR [PREFIX/include]
--oldincludedir=DIR C header files for non-gcc in DIR [/usr/include]
--infodir=DIR info documentation in DIR [PREFIX/info]
--mandir=DIR man documentation in DIR [PREFIX/man]
--srcdir=DIR find the sources in DIR [configure dir or ..]
--program-prefix=PREFIX prepend PREFIX to installed program names
--program-suffix=SUFFIX append SUFFIX to installed program names
--program-transform-name=PROGRAM
run sed PROGRAM on installed program names
EOF
cat << EOF
Host type:
--build=BUILD configure for building on BUILD [BUILD=HOST]
--host=HOST configure for HOST [guessed]
--target=TARGET configure for TARGET [TARGET=HOST]
Features and packages:
--disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no)
--enable-FEATURE[=ARG] include FEATURE [ARG=yes]
--with-PACKAGE[=ARG] use PACKAGE [ARG=yes]
--without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no)
--x-includes=DIR X include files are in DIR
--x-libraries=DIR X library files are in DIR
EOF
if test -n "$ac_help"; then
echo "--enable and --with options recognized:$ac_help"
fi
exit 0 ;;
-host | --host | --hos | --ho)
ac_prev=host ;;
-host=* | --host=* | --hos=* | --ho=*)
host="$ac_optarg" ;;
-includedir | --includedir | --includedi | --included | --include \
| --includ | --inclu | --incl | --inc)
ac_prev=includedir ;;
-includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \
| --includ=* | --inclu=* | --incl=* | --inc=*)
includedir="$ac_optarg" ;;
-infodir | --infodir | --infodi | --infod | --info | --inf)
ac_prev=infodir ;;
-infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*)
infodir="$ac_optarg" ;;
-libdir | --libdir | --libdi | --libd)
ac_prev=libdir ;;
-libdir=* | --libdir=* | --libdi=* | --libd=*)
libdir="$ac_optarg" ;;
-libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \
| --libexe | --libex | --libe)
ac_prev=libexecdir ;;
-libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \
| --libexe=* | --libex=* | --libe=*)
libexecdir="$ac_optarg" ;;
-localstatedir | --localstatedir | --localstatedi | --localstated \
| --localstate | --localstat | --localsta | --localst \
| --locals | --local | --loca | --loc | --lo)
ac_prev=localstatedir ;;
-localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \
| --localstate=* | --localstat=* | --localsta=* | --localst=* \
| --locals=* | --local=* | --loca=* | --loc=* | --lo=*)
localstatedir="$ac_optarg" ;;
-mandir | --mandir | --mandi | --mand | --man | --ma | --m)
ac_prev=mandir ;;
-mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*)
mandir="$ac_optarg" ;;
-nfp | --nfp | --nf)
# Obsolete; use --without-fp.
with_fp=no ;;
-no-create | --no-create | --no-creat | --no-crea | --no-cre \
| --no-cr | --no-c)
no_create=yes ;;
-no-recursion | --no-recursion | --no-recursio | --no-recursi \
| --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r)
no_recursion=yes ;;
-oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \
| --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \
| --oldin | --oldi | --old | --ol | --o)
ac_prev=oldincludedir ;;
-oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \
| --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \
| --oldin=* | --oldi=* | --old=* | --ol=* | --o=*)
oldincludedir="$ac_optarg" ;;
-prefix | --prefix | --prefi | --pref | --pre | --pr | --p)
ac_prev=prefix ;;
-prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*)
prefix="$ac_optarg" ;;
-program-prefix | --program-prefix | --program-prefi | --program-pref \
| --program-pre | --program-pr | --program-p)
ac_prev=program_prefix ;;
-program-prefix=* | --program-prefix=* | --program-prefi=* \
| --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*)
program_prefix="$ac_optarg" ;;
-program-suffix | --program-suffix | --program-suffi | --program-suff \
| --program-suf | --program-su | --program-s)
ac_prev=program_suffix ;;
-program-suffix=* | --program-suffix=* | --program-suffi=* \
| --program-suff=* | --program-suf=* | --program-su=* | --program-s=*)
program_suffix="$ac_optarg" ;;
-program-transform-name | --program-transform-name \
| --program-transform-nam | --program-transform-na \
| --program-transform-n | --program-transform- \
| --program-transform | --program-transfor \
| --program-transfo | --program-transf \
| --program-trans | --program-tran \
| --progr-tra | --program-tr | --program-t)
ac_prev=program_transform_name ;;
-program-transform-name=* | --program-transform-name=* \
| --program-transform-nam=* | --program-transform-na=* \
| --program-transform-n=* | --program-transform-=* \
| --program-transform=* | --program-transfor=* \
| --program-transfo=* | --program-transf=* \
| --program-trans=* | --program-tran=* \
| --progr-tra=* | --program-tr=* | --program-t=*)
program_transform_name="$ac_optarg" ;;
-q | -quiet | --quiet | --quie | --qui | --qu | --q \
| -silent | --silent | --silen | --sile | --sil)
silent=yes ;;
-sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb)
ac_prev=sbindir ;;
-sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \
| --sbi=* | --sb=*)
sbindir="$ac_optarg" ;;
-sharedstatedir | --sharedstatedir | --sharedstatedi \
| --sharedstated | --sharedstate | --sharedstat | --sharedsta \
| --sharedst | --shareds | --shared | --share | --shar \
| --sha | --sh)
ac_prev=sharedstatedir ;;
-sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \
| --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \
| --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \
| --sha=* | --sh=*)
sharedstatedir="$ac_optarg" ;;
-site | --site | --sit)
ac_prev=site ;;
-site=* | --site=* | --sit=*)
site="$ac_optarg" ;;
-srcdir | --srcdir | --srcdi | --srcd | --src | --sr)
ac_prev=srcdir ;;
-srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*)
srcdir="$ac_optarg" ;;
-sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \
| --syscon | --sysco | --sysc | --sys | --sy)
ac_prev=sysconfdir ;;
-sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \
| --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*)
sysconfdir="$ac_optarg" ;;
-target | --target | --targe | --targ | --tar | --ta | --t)
ac_prev=target ;;
-target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*)
target="$ac_optarg" ;;
-v | -verbose | --verbose | --verbos | --verbo | --verb)
verbose=yes ;;
-version | --version | --versio | --versi | --vers)
echo "configure generated by autoconf version 2.7"
exit 0 ;;
-with-* | --with-*)
ac_package=`echo $ac_option|sed -e 's/-*with-//' -e 's/=.*//'`
# Reject names that are not valid shell variable names.
if test -n "`echo $ac_package| sed 's/[-_a-zA-Z0-9]//g'`"; then
{ echo "configure: error: $ac_package: invalid package name" 1>&2; exit 1; }
fi
ac_package=`echo $ac_package| sed 's/-/_/g'`
case "$ac_option" in
*=*) ;;
*) ac_optarg=yes ;;
esac
eval "with_${ac_package}='$ac_optarg'" ;;
-without-* | --without-*)
ac_package=`echo $ac_option|sed -e 's/-*without-//'`
# Reject names that are not valid shell variable names.
if test -n "`echo $ac_package| sed 's/[-a-zA-Z0-9_]//g'`"; then
{ echo "configure: error: $ac_package: invalid package name" 1>&2; exit 1; }
fi
ac_package=`echo $ac_package| sed 's/-/_/g'`
eval "with_${ac_package}=no" ;;
--x)
# Obsolete; use --with-x.
with_x=yes ;;
-x-includes | --x-includes | --x-include | --x-includ | --x-inclu \
| --x-incl | --x-inc | --x-in | --x-i)
ac_prev=x_includes ;;
-x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \
| --x-incl=* | --x-inc=* | --x-in=* | --x-i=*)
x_includes="$ac_optarg" ;;
-x-libraries | --x-libraries | --x-librarie | --x-librari \
| --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l)
ac_prev=x_libraries ;;
-x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \
| --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*)
x_libraries="$ac_optarg" ;;
-*) { echo "configure: error: $ac_option: invalid option; use --help to show usage" 1>&2; exit 1; }
;;
*)
if test -n "`echo $ac_option| sed 's/[-a-z0-9.]//g'`"; then
echo "configure: warning: $ac_option: invalid host type" 1>&2
fi
if test "x$nonopt" != xNONE; then
{ echo "configure: error: can only configure for one host and one target at a time" 1>&2; exit 1; }
fi
nonopt="$ac_option"
;;
esac
done
if test -n "$ac_prev"; then
{ echo "configure: error: missing argument to --`echo $ac_prev | sed 's/_/-/g'`" 1>&2; exit 1; }
fi
trap 'rm -fr conftest* confdefs* core core.* *.core $ac_clean_files; exit 1' 1 2 15
# File descriptor usage:
# 0 standard input
# 1 file creation
# 2 errors and warnings
# 3 some systems may open it to /dev/tty
# 4 used on the Kubota Titan
# 6 checking for... messages and results
# 5 compiler messages saved in config.log
if test "$silent" = yes; then
exec 6>/dev/null
else
exec 6>&1
fi
exec 5>./config.log
echo "\
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.
" 1>&5
# Strip out --no-create and --no-recursion so they do not pile up.
# Also quote any args containing shell metacharacters.
ac_configure_args=
for ac_arg
do
case "$ac_arg" in
-no-create | --no-create | --no-creat | --no-crea | --no-cre \
| --no-cr | --no-c) ;;
-no-recursion | --no-recursion | --no-recursio | --no-recursi \
| --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) ;;
*" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?]*)
ac_configure_args="$ac_configure_args '$ac_arg'" ;;
*) ac_configure_args="$ac_configure_args $ac_arg" ;;
esac
done
# NLS nuisances.
# Only set LANG and LC_ALL to C if already set.
# These must not be set unconditionally because not all systems understand
# e.g. LANG=C (notably SCO).
if test "${LC_ALL+set}" = set; then LC_ALL=C; export LC_ALL; fi
if test "${LANG+set}" = set; then LANG=C; export LANG; fi
# confdefs.h avoids OS command line length limits that DEFS can exceed.
rm -rf conftest* confdefs.h
# AIX cpp loses on an empty file, so make sure it contains at least a newline.
echo > confdefs.h
# A filename unique to this package, relative to the directory that
# configure is in, which we can look for to find out if srcdir is correct.
ac_unique_file=libstack.h.in
# Find the source files, if location was not specified.
if test -z "$srcdir"; then
ac_srcdir_defaulted=yes
# Try the directory containing this script, then its parent.
ac_prog=$0
ac_confdir=`echo $ac_prog|sed 's%/[^/][^/]*$%%'`
test "x$ac_confdir" = "x$ac_prog" && ac_confdir=.
srcdir=$ac_confdir
if test ! -r $srcdir/$ac_unique_file; then
srcdir=..
fi
else
ac_srcdir_defaulted=no
fi
if test ! -r $srcdir/$ac_unique_file; then
if test "$ac_srcdir_defaulted" = yes; then
{ echo "configure: error: can not find sources in $ac_confdir or .." 1>&2; exit 1; }
else
{ echo "configure: error: can not find sources in $srcdir" 1>&2; exit 1; }
fi
fi
srcdir=`echo "${srcdir}" | sed 's%\([^/]\)/*$%\1%'`
# Prefer explicitly selected file to automatically selected ones.
if test -z "$CONFIG_SITE"; then
if test "x$prefix" != xNONE; then
CONFIG_SITE="$prefix/share/config.site $prefix/etc/config.site"
else
CONFIG_SITE="$ac_default_prefix/share/config.site $ac_default_prefix/etc/config.site"
fi
fi
for ac_site_file in $CONFIG_SITE; do
if test -r "$ac_site_file"; then
echo "loading site script $ac_site_file"
. "$ac_site_file"
fi
done
if test -r "$cache_file"; then
echo "loading cache $cache_file"
. $cache_file
else
echo "creating cache $cache_file"
> $cache_file
fi
ac_ext=c
# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
ac_cpp='echo $CPP $CPPFLAGS 1>&5;
$CPP $CPPFLAGS'
ac_compile='echo ${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5;
${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5 2>&5'
ac_link='echo ${CC-cc} -o conftest $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5;
${CC-cc} -o conftest $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5 2>&5'
if (echo "testing\c"; echo 1,2,3) | grep c >/dev/null; then
# Stardent Vistra SVR4 grep lacks -e, says ghazi@caip.rutgers.edu.
if (echo -n testing; echo 1,2,3) | sed s/-n/xn/ | grep xn >/dev/null; then
ac_n= ac_c='
' ac_t=' '
else
ac_n=-n ac_c= ac_t=
fi
else
ac_n= ac_c='\c' ac_t=
fi
# I have a lot of problems with cache. So ...
/bin/rm -f ./config.cache
# determine the kind of the machine which is running this script
machine=`uname -m`
# I hope that compatible ix86 chips (such as K6 or AMD) always return ix386
case $machine in
i?86) ARCH=I386;;
sun*) ARCH=SUN;;
alpha*) ARCH=ALPHA;;
?000/*) ARCH=HP;;
IP22) ARCH=MIPS32;;
*) ARCH="UNKNOWN_ARCH";;
esac
# Extract the first word of "gcc", so it can be a program name with args.
set dummy gcc; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
if test -n "$CC"; then
ac_cv_prog_CC="$CC" # Let the user override the test.
else
IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:"
for ac_dir in $PATH; do
test -z "$ac_dir" && ac_dir=.
if test -f $ac_dir/$ac_word; then
ac_cv_prog_CC="gcc"
break
fi
done
IFS="$ac_save_ifs"
test -z "$ac_cv_prog_CC" && ac_cv_prog_CC="cc"
fi
fi
CC="$ac_cv_prog_CC"
if test -n "$CC"; then
echo "$ac_t""$CC" 1>&6
else
echo "$ac_t""no" 1>&6
fi
echo $ac_n "checking whether we are using GNU C""... $ac_c" 1>&6
if eval "test \"`echo '$''{'ac_cv_prog_gcc'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.c <<EOF
#ifdef __GNUC__
yes;
#endif
EOF
if ${CC-cc} -E conftest.c 2>&5 | egrep yes >/dev/null 2>&1; then
ac_cv_prog_gcc=yes
else
ac_cv_prog_gcc=no
fi
fi
echo "$ac_t""$ac_cv_prog_gcc" 1>&6
if test $ac_cv_prog_gcc = yes; then
GCC=yes
if test "${CFLAGS+set}" != set; then
echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6
if eval "test \"`echo '$''{'ac_cv_prog_gcc_g'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
echo 'void f(){}' > conftest.c
if test -z "`${CC-cc} -g -c conftest.c 2>&1`"; then
ac_cv_prog_gcc_g=yes
else
ac_cv_prog_gcc_g=no
fi
rm -f conftest*
fi
echo "$ac_t""$ac_cv_prog_gcc_g" 1>&6
if test $ac_cv_prog_gcc_g = yes; then
CFLAGS="-g -O"
else
CFLAGS="-O"
fi
fi
else
GCC=
test "${CFLAGS+set}" = set || CFLAGS="-g"
fi
# Extract the first word of "ranlib", so it can be a program name with args.
set dummy ranlib; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
if test -n "$RANLIB"; then
ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test.
else
IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:"
for ac_dir in $PATH; do
test -z "$ac_dir" && ac_dir=.
if test -f $ac_dir/$ac_word; then
ac_cv_prog_RANLIB="ranlib"
break
fi
done
IFS="$ac_save_ifs"
test -z "$ac_cv_prog_RANLIB" && ac_cv_prog_RANLIB=":"
fi
fi
RANLIB="$ac_cv_prog_RANLIB"
if test -n "$RANLIB"; then
echo "$ac_t""$RANLIB" 1>&6
else
echo "$ac_t""no" 1>&6
fi
# The library is done with one header file (libstack.h) and two sources files
# If gcc is available, use the C source file otherwise, use the provided
# assembly language source file.
ln -s libstack-$ARCH.c libstack.c;
LOW=
if test -f lowstack-$ARCH.s
then
ln -s lowstack-$ARCH.s lowstack.s
LOW=lowstack.o
fi
echo "Stack library configuration"
echo " Machine type: " $ARCH
echo " Low level support: " $LOW
trap '' 1 2 15
cat > confcache <<\EOF
# This file is a shell script that caches the results of configure
# tests run on this system so they can be shared between configure
# scripts and configure runs. It is not useful on other systems.
# If it contains results you don't want to keep, you may remove or edit it.
#
# By default, configure uses ./config.cache as the cache file,
# creating it if it does not exist already. You can give configure
# the --cache-file=FILE option to use a different cache file; that is
# what configure does when it calls configure scripts in
# subdirectories, so they share the cache.
# Giving --cache-file=/dev/null disables caching, for debugging configure.
# config.status only pays attention to the cache file if you give it the
# --recheck option to rerun configure.
#
EOF
# Ultrix sh set writes to stderr and can't be redirected directly,
# and sets the high bit in the cache file unless we assign to the vars.
(set) 2>&1 |
sed -n "s/^\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\)=\(.*\)/\1=\${\1='\2'}/p" \
>> confcache
if cmp -s $cache_file confcache; then
:
else
if test -w $cache_file; then
echo "updating cache $cache_file"
cat confcache > $cache_file
else
echo "not updating unwritable cache $cache_file"
fi
fi
rm -f confcache
trap 'rm -fr conftest* confdefs* core core.* *.core $ac_clean_files; exit 1' 1 2 15
test "x$prefix" = xNONE && prefix=$ac_default_prefix
# Let make expand exec_prefix.
test "x$exec_prefix" = xNONE && exec_prefix='${prefix}'
# Any assignment to VPATH causes Sun make to only execute
# the first set of double-colon rules, so remove it if not needed.
# If there is a colon in the path, we need to keep it.
if test "x$srcdir" = x.; then
ac_vpsub='/^[ ]*VPATH[ ]*=[^:]*$/d'
fi
trap 'rm -f $CONFIG_STATUS conftest*; exit 1' 1 2 15
# Transform confdefs.h into DEFS.
# Protect against shell expansion while executing Makefile rules.
# Protect against Makefile macro expansion.
cat > conftest.defs <<\EOF
s%#define \([A-Za-z_][A-Za-z0-9_]*\) \(.*\)%-D\1=\2%g
s%[ `~#$^&*(){}\\|;'"<>?]%\\&%g
s%\[%\\&%g
s%\]%\\&%g
s%\$%$$%g
EOF
DEFS=`sed -f conftest.defs confdefs.h | tr '\012' ' '`
rm -f conftest.defs
# Without the "./", some shells look in PATH for config.status.
: ${CONFIG_STATUS=./config.status}
echo creating $CONFIG_STATUS
rm -f $CONFIG_STATUS
cat > $CONFIG_STATUS <<EOF
#! /bin/sh
# Generated automatically by configure.
# Run this file to recreate the current configuration.
# This directory was configured as follows,
# on host `(hostname || uname -n) 2>/dev/null | sed 1q`:
#
# $0 $ac_configure_args
#
# Compiler output produced by configure, useful for debugging
# configure, is in ./config.log if it exists.
ac_cs_usage="Usage: $CONFIG_STATUS [--recheck] [--version] [--help]"
for ac_option
do
case "\$ac_option" in
-recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r)
echo "running \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion"
exec \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion ;;
-version | --version | --versio | --versi | --vers | --ver | --ve | --v)
echo "$CONFIG_STATUS generated by autoconf version 2.7"
exit 0 ;;
-help | --help | --hel | --he | --h)
echo "\$ac_cs_usage"; exit 0 ;;
*) echo "\$ac_cs_usage"; exit 1 ;;
esac
done
ac_given_srcdir=$srcdir
trap 'rm -fr `echo "libstack.h Makefile" | sed "s/:[^ ]*//g"` conftest*; exit 1' 1 2 15
EOF
cat >> $CONFIG_STATUS <<EOF
# Protect against being on the right side of a sed subst in config.status.
sed 's/%@/@@/; s/@%/@@/; s/%g\$/@g/; /@g\$/s/[\\\\&%]/\\\\&/g;
s/@@/%@/; s/@@/@%/; s/@g\$/%g/' > conftest.subs <<\\CEOF
$ac_vpsub
$extrasub
s%@CFLAGS@%$CFLAGS%g
s%@CPPFLAGS@%$CPPFLAGS%g
s%@CXXFLAGS@%$CXXFLAGS%g
s%@DEFS@%$DEFS%g
s%@LDFLAGS@%$LDFLAGS%g
s%@LIBS@%$LIBS%g
s%@exec_prefix@%$exec_prefix%g
s%@prefix@%$prefix%g
s%@program_transform_name@%$program_transform_name%g
s%@bindir@%$bindir%g
s%@sbindir@%$sbindir%g
s%@libexecdir@%$libexecdir%g
s%@datadir@%$datadir%g
s%@sysconfdir@%$sysconfdir%g
s%@sharedstatedir@%$sharedstatedir%g
s%@localstatedir@%$localstatedir%g
s%@libdir@%$libdir%g
s%@includedir@%$includedir%g
s%@oldincludedir@%$oldincludedir%g
s%@infodir@%$infodir%g
s%@mandir@%$mandir%g
s%@CC@%$CC%g
s%@RANLIB@%$RANLIB%g
s%@ARCH@%$ARCH%g
s%@LOW@%$LOW%g
CEOF
EOF
cat >> $CONFIG_STATUS <<EOF
CONFIG_FILES=\${CONFIG_FILES-"libstack.h Makefile"}
EOF
cat >> $CONFIG_STATUS <<\EOF
for ac_file in .. $CONFIG_FILES; do if test "x$ac_file" != x..; then
# Support "outfile[:infile]", defaulting infile="outfile.in".
case "$ac_file" in
*:*) ac_file_in=`echo "$ac_file"|sed 's%.*:%%'`
ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;;
*) ac_file_in="${ac_file}.in" ;;
esac
# Adjust relative srcdir, etc. for subdirectories.
# Remove last slash and all that follows it. Not all systems have dirname.
ac_dir=`echo $ac_file|sed 's%/[^/][^/]*$%%'`
if test "$ac_dir" != "$ac_file" && test "$ac_dir" != .; then
# The file is in a subdirectory.
test ! -d "$ac_dir" && mkdir "$ac_dir"
ac_dir_suffix="/`echo $ac_dir|sed 's%^\./%%'`"
# A "../" for each directory in $ac_dir_suffix.
ac_dots=`echo $ac_dir_suffix|sed 's%/[^/]*%../%g'`
else
ac_dir_suffix= ac_dots=
fi
case "$ac_given_srcdir" in
.) srcdir=.
if test -z "$ac_dots"; then top_srcdir=.
else top_srcdir=`echo $ac_dots|sed 's%/$%%'`; fi ;;
/*) srcdir="$ac_given_srcdir$ac_dir_suffix"; top_srcdir="$ac_given_srcdir" ;;
*) # Relative path.
srcdir="$ac_dots$ac_given_srcdir$ac_dir_suffix"
top_srcdir="$ac_dots$ac_given_srcdir" ;;
esac
echo creating "$ac_file"
rm -f "$ac_file"
configure_input="Generated automatically from `echo $ac_file_in|sed 's%.*/%%'` by configure."
case "$ac_file" in
*Makefile*) ac_comsub="1i\\
# $configure_input" ;;
*) ac_comsub= ;;
esac
sed -e "$ac_comsub
s%@configure_input@%$configure_input%g
s%@srcdir@%$srcdir%g
s%@top_srcdir@%$top_srcdir%g
" -f conftest.subs $ac_given_srcdir/$ac_file_in > $ac_file
fi; done
rm -f conftest.subs
exit 0
EOF
chmod +x $CONFIG_STATUS
rm -fr confdefs* $ac_clean_files
test "$no_create" = yes || ${CONFIG_SHELL-/bin/sh} $CONFIG_STATUS || exit 1
+51
View File
@@ -0,0 +1,51 @@
dnl This file is an input file used by the GNU "autoconf" program to
dnl generate the file "configure", which is run during installation
dnl to configure the system for the local environment.
dnl
dnl Author: Erick Gallesio [eg@unice.fr]
dnl Creation date: 27-Sep-1997 20:02
dnl Last file update: 8-Apr-1998 10:54
AC_INIT(libstack.h.in)
# I have a lot of problems with cache. So ...
/bin/rm -f ./config.cache
# determine the kind of the machine which is running this script
machine=`uname -m`
# I hope that compatible ix86 chips (such as K6 or AMD) always return ix386
case $machine in
i?86) ARCH=I386;;
sun*) ARCH=SUN;;
alpha*) ARCH=ALPHA;;
?000/*) ARCH=HP;;
IP22) ARCH=MIPS32;;
*) ARCH="UNKNOWN_ARCH";;
esac
AC_PROG_CC
AC_PROG_RANLIB
# The library is done with one header file (libstack.h) and two sources files
# If gcc is available, use the C source file otherwise, use the provided
# assembly language source file.
ln -s libstack-$ARCH.c libstack.c;
LOW=
if test -f lowstack-$ARCH.s
then
ln -s lowstack-$ARCH.s lowstack.s
LOW=lowstack.o
fi
echo "Stack library configuration"
echo " Machine type: " $ARCH
echo " Low level support: " $LOW
AC_SUBST(ARCH)
AC_SUBST(LOW)
AC_OUTPUT(libstack.h Makefile)
+3
View File
@@ -0,0 +1,3 @@
#ifdef __GNUC__
yes;
#endif
+83
View File
@@ -0,0 +1,83 @@
/******************************************************************************
*
* l i b s t a c k - A L P H A . c
*
* Copyright © 1997 Erick Gallesio - I3S-CNRS/ESSI <eg@unice.fr>
*
*
* Permission to use, copy, and/or distribute this software and its
* documentation for any purpose and without fee is hereby granted, provided
* that both the above copyright notice and this permission notice appear in
* all copies and derived works. Fees for distribution or use of this
* software or derived works may only be charged with express written
* permission of the copyright holder.
* This software is provided ``as is'' without express or implied warranty.
*
* This software is a derivative work of other copyrighted softwares; the
* copyright notices of these softwares are placed in the file COPYRIGHTS
*
*
* Author: Erick Gallesio [eg@unice.fr]
* Creation date: 28-Sep-1997 17:30
* Last file update: 29-Sep-1997 12:35
*
******************************************************************************/
/*
The first 6 arguments are passed in registers $16-$21 for integers,
in registers $f16-$f21 for floats. From then on, everything is passed
on the stack.
Everything on the stack is word-aligned.
*/
#include "libstack.h"
fake_type stk_argv[MAX_EXTERNAL_PARAM];
int stk_argc = 0;
extern void stk_copy_float_registers(void);
int stk_push_float(float f)
{
if (stk_argc < 6) {
/* Value must goes in a register, store it as a double */
stk_argv[stk_argc++].d=(double)f;
return 0;
}
if (stk_argc < MAX_EXTERNAL_PARAM) {
/* Value will be stacked as a float */
stk_argv[stk_argc++].f[0]=f;
return 0;
}
return -1;
}
/* Since we do not know how much floats are passed (and where), we set all
* float registers before calling the function
*/
#define alpha_big_switch {stk_copy_float_registers(); big_switch;}
long stk_call_long(void *func)
{
long (*f)() = func;
alpha_big_switch;
}
double stk_call_double(void *func)
{
double (*f)() = func;
alpha_big_switch;
}
float stk_call_float(void *func)
{
float (*f)() = func;
alpha_big_switch;
}
+70
View File
@@ -0,0 +1,70 @@
/******************************************************************************
*
* l i b s t a c k - H P . c
*
* Copyright © 1997 Erick Gallesio - I3S-CNRS/ESSI <eg@unice.fr>
*
*
* Permission to use, copy, and/or distribute this software and its
* documentation for any purpose and without fee is hereby granted, provided
* that both the above copyright notice and this permission notice appear in
* all copies and derived works. Fees for distribution or use of this
* software or derived works may only be charged with express written
* permission of the copyright holder.
* This software is provided ``as is'' without express or implied warranty.
*
* This software is a derivative work of other copyrighted softwares; the
* copyright notices of these softwares are placed in the file COPYRIGHTS
*
*
* Author: Erick Gallesio [eg@unice.fr]
* Creation date: 29-Sep-1997 12:18
* Last file update: 29-Sep-1997 14:36
*
******************************************************************************/
#include "libstack.h"
/*
All arguments, except the first 4 words, are passed on the stack
with word alignment. Doubles take two words and force double
alignment.
The first 2 words are passed like this:
%r26 = first integer arg, %r25 = second integer arg, or
%r26 = high word of double arg, %r25 = low word of double arg.
Similarly for the next 2 words, passed in %r24 and %r23.
*/
fake_type stk_argv[MAX_EXTERNAL_PARAM];
int stk_argc = 0;
int stk_push_double(double d)
{
if (stk_argc & 1) /* align */ stk_argc++;
if ((stk_argc < MAX_EXTERNAL_PARAM-1)) {
stk_argv[stk_argc+1].d = d;
stk_argv[stk_argc].i[1]= stk_argv[stk_argc].i[0];
stk_argc +=2;
return 0;
}
return -1;
}
long stk_call_long(void *func)
{
long (*f)() = func;
big_switch;
}
double stk_call_double(void *func)
{
double (*f)() = func;
big_switch;
}
float stk_call_float(void *func)
{
float (*f)() = func;
big_switch;
}
+44
View File
@@ -0,0 +1,44 @@
/******************************************************************************
*
* l i b s t a c k - I 3 8 6 . c
*
* Copyright © 1997 Erick Gallesio - I3S-CNRS/ESSI <eg@unice.fr>
*
*
* Permission to use, copy, and/or distribute this software and its
* documentation for any purpose and without fee is hereby granted, provided
* that both the above copyright notice and this permission notice appear in
* all copies and derived works. Fees for distribution or use of this
* software or derived works may only be charged with express written
* permission of the copyright holder.
* This software is provided ``as is'' without express or implied warranty.
*
* This software is a derivative work of other copyrighted softwares; the
* copyright notices of these softwares are placed in the file COPYRIGHTS
*
*
* Author: Erick Gallesio [eg@unice.fr]
* Creation date: 28-Sep-1997 17:30
* Last file update: 28-Sep-1997 18:14
*
******************************************************************************/
/* All arguments are passed on the stack with word alignment. Doubles use 2 words */
#include "libstack.h"
fake_type stk_argv[MAX_EXTERNAL_PARAM];
int stk_argc = 0;
long stk_call_long(void *func)
{
long (*f)() = func;
big_switch;
}
double stk_call_double(void *func)
{
double (*f)() = func;
big_switch;
}
+99
View File
@@ -0,0 +1,99 @@
/******************************************************************************
*
* l i b s t a c k - M I P S . c
*
* Copyright © 1997 Erick Gallesio - I3S-CNRS/ESSI <eg@unice.fr>
*
*
* Permission to use, copy, and/or distribute this software and its
* documentation for any purpose and without fee is hereby granted, provided
* that both the above copyright notice and this permission notice appear in
* all copies and derived works. Fees for distribution or use of this
* software or derived works may only be charged with express written
* permission of the copyright holder.
* This software is provided ``as is'' without express or implied warranty.
*
* This software is a derivative work of other copyrighted softwares; the
* copyright notices of these softwares are placed in the file COPYRIGHTS
*
*
* Author: Erick Gallesio [eg@unice.fr]
* Creation date: 29-Sep-1997 14:56
* Last file update: 30-Sep-1997 13:17
*
******************************************************************************/
#include "libstack.h"
/*
Doubles are 2 words aligned on even boundaries.
If the first two args are floats or doubles, they are also passed in $f12
and $f14. But varargs functions will expect them in the integer registers
and we can't tell whether the function is varargs so we pass them both ways.
*/
fake_type stk_argv[MAX_EXTERNAL_PARAM];
int stk_argc = 0;
double stk_double_register1, stk_double_register2;
int stk_push_float(float f)
{
switch (stk_argc) {
case 0: stk_double_register1 = (double) f;
stk_argv[stk_argc++].f[1]=f;
return 0;
case 1: stk_double_register2 = (double) f;
stk_argv[stk_argc++].f[1]=f;
return 0;
default: if (stk_argc < MAX_EXTERNAL_PARAM) {
/* Value will be stacked as a float */
stk_argv[stk_argc++].f[0]=f;
return 0;
}
}
return -1;
}
int stk_push_double(double d)
{
if (stk_argc < 4) {
stk_double_register1 = stk_argv[stk_argc].d= d;
stk_argv[stk_argc+1].f[1]= stk_argv[stk_argc].f[0];
stk_argc += 2;
return 0;
}
else if (stk_argc < MAX_EXTERNAL_PARAM) {
/* Value will be stacked as a float */
stk_argv[stk_argc].d= d;
stk_argv[stk_argc+1].f[1]= stk_argv[stk_argc].f[0];
stk_argc += 2;
return 0;
}
return -1;
}
/* Since we do not know how much floats are passed (and where), we set all
* float registers before calling the function
*/
#define mips_big_switch {stk_copy_float_registers(); big_switch;}
long stk_call_long(void *func)
{
long (*f)() = func;
mips_big_switch;
}
double stk_call_double(void *func)
{
double (*f)() = func;
mips_big_switch;
}
float stk_call_float(void *func)
{
float (*f)() = func;
mips_big_switch;
}
+49
View File
@@ -0,0 +1,49 @@
/******************************************************************************
*
* l i b s t a c k - S U N . c
*
* Copyright © 1997 Erick Gallesio - I3S-CNRS/ESSI <eg@unice.fr>
*
*
* Permission to use, copy, and/or distribute this software and its
* documentation for any purpose and without fee is hereby granted, provided
* that both the above copyright notice and this permission notice appear in
* all copies and derived works. Fees for distribution or use of this
* software or derived works may only be charged with express written
* permission of the copyright holder.
* This software is provided ``as is'' without express or implied warranty.
*
* This software is a derivative work of other copyrighted softwares; the
* copyright notices of these softwares are placed in the file COPYRIGHTS
*
*
* Author: Erick Gallesio [eg@unice.fr]
* Creation date: 28-Sep-1997 17:30
* Last file update: 28-Sep-1997 18:28
*
******************************************************************************/
/* All arguments are passed on the stack with word alignment. Doubles use 2 words */
#include "libstack.h"
fake_type stk_argv[MAX_EXTERNAL_PARAM];
int stk_argc = 0;
long stk_call_long(void *func)
{
long (*f)() = func;
big_switch;
}
double stk_call_double(void *func)
{
double (*f)() = func;
big_switch;
}
float stk_call_float(void *func)
{
float (*f)() = func;
big_switch;
}
+28
View File
@@ -0,0 +1,28 @@
/******************************************************************************
*
* l i b s t a c k - U N K N O W N . c
*
* Copyright © 1997-1998 Erick Gallesio - I3S-CNRS/ESSI <eg@unice.fr>
*
*
* Permission to use, copy, and/or distribute this software and its
* documentation for any purpose and without fee is hereby granted, provided
* that both the above copyright notice and this permission notice appear in
* all copies and derived works. Fees for distribution or use of this
* software or derived works may only be charged with express written
* permission of the copyright holder.
* This software is provided ``as is'' without express or implied warranty.
*
* This software is a derivative work of other copyrighted softwares; the
* copyright notices of these softwares are placed in the file COPYRIGHTS
*
*
* Author: Erick Gallesio [eg@unice.fr]
* Creation date: 28-Sep-1997 17:30
* Last file update: 7-Apr-1998 23:14
*
******************************************************************************/
static char nothing = 0; /* because some C compiler refuse to compile empty files */
+203
View File
@@ -0,0 +1,203 @@
/******************************************************************************
*
* l i b s t a c k . h
*
* Copyright © 1997 Erick Gallesio - I3S-CNRS/ESSI <eg@unice.fr>
*
*
* Permission to use, copy, and/or distribute this software and its
* documentation for any purpose and without fee is hereby granted, provided
* that both the above copyright notice and this permission notice appear in
* all copies and derived works. Fees for distribution or use of this
* software or derived works may only be charged with express written
* permission of the copyright holder.
* This software is provided ``as is'' without express or implied warranty.
*
* This software is a derivative work of other copyrighted softwares; the
* copyright notices of these softwares are placed in the file COPYRIGHTS
*
*
* Author: Erick Gallesio [eg@unice.fr]
* Creation date: 28-Sep-1997 17:30
* Last file update: 7-Oct-1997 12:07
*
******************************************************************************/
/*
This code has been tested on the following architectures/systems
I386 Linux 2.0 (ELF)
sun4x SunOS 4.1.x & SunOS 5.5.x
Alpha OSF1 V4.0
HP HP-UX B.10.20
MIPS32 IRIX 6.2
*/
#define @ARCH@
#define PROCESSOR "@ARCH@"
#define MAX_EXTERNAL_PARAM 16 /* cannot be changed !!! */
typedef union {
double d;
float f[2];
int i[2];
long l;
} fake_type;
extern fake_type stk_argv[MAX_EXTERNAL_PARAM];
extern int stk_argc;
/* Macros for pushing arguments */
#define init_ext_call() stk_argc=0;
#define push_char push_int
#define push_short push_int
#define push_string push_ptr
#define push_int(x) ((stk_argc < MAX_EXTERNAL_PARAM)? \
(stk_argv[stk_argc++].i[0]=(int) (x),\
0) : \
-1)
#define push_long(x) ((stk_argc < MAX_EXTERNAL_PARAM)? \
(stk_argv[stk_argc++].l=(long) (x), \
0) : \
-1)
#if defined(SUN) || defined(I386)
# define push_float(x) ((stk_argc < MAX_EXTERNAL_PARAM)? \
(stk_argv[stk_argc++].f[0]=(float)(x),\
0) : \
-1)
# define push_double(x) ((stk_argc < MAX_EXTERNAL_PARAM-1)? \
(stk_argv[stk_argc].d =(double)(x), \
stk_argv[stk_argc+1].i[0]= \
stk_argv[stk_argc].i[1], \
stk_argc +=2, \
0) : \
-1)
# define push_ptr push_int
#endif
#if defined(HP)
# define push_float(x) ((stk_argc < MAX_EXTERNAL_PARAM)? \
(stk_argv[stk_argc++].f[0]=(float)(x),\
0) : \
-1)
# define push_double stk_push_double
# define push_ptr push_int
#endif
#if defined(ALPHA)
# define push_float stk_push_float
# define push_double(x) ((stk_argc < MAX_EXTERNAL_PARAM)? \
(stk_argv[stk_argc++].d=(double) (x),\
0) : \
-1)
# define push_ptr push_long
#endif
#if defined(MIPS32)
# define push_float stk_push_float
# define push_double stk_push_double
# define push_ptr push_long
#endif
/* Macros for calling functions */
#define call_ext_void call_ext_int
#define call_ext_char call_ext_int
#define call_ext_short call_ext_int
#define call_ext_int call_ext_long
#define call_ext_long(fct) stk_call_long(fct)
#if defined(I386)
# define call_ext_float call_ext_double
#endif
#if defined(SUN)||defined(ALPHA)||defined(HP)|| defined(MIPS32)
# define call_ext_float(fct) stk_call_float(fct)
#endif
#define call_ext_double(fct) stk_call_double(fct)
#if defined(ALPHA)
# define call_ext_ptr(x) ((void*) call_ext_long(x))
#else
# define call_ext_ptr(x) ((void*) call_ext_int(x))
#endif
#define call_ext_bool call_ext_char
#define call_ext_string call_ext_ptr
#ifdef MIPS32
# define get_argv(x) stk_argv[x].i[0]
#else
# define get_argv(x) stk_argv[x].l
#endif
/* Prototypes of stack functions. Some of them could be inexistent for a
* particular machine
*/
extern long stk_call_long (void *fct);
extern float stk_call_float (void *fct);
extern double stk_call_double(void *fct);
extern int stk_push_float(float f);
extern int stk_push_double(double d);
/* Utility macro */
#define big_switch \
switch (stk_argc) { \
case 0: return f(); \
case 1: return f(get_argv(0)); \
case 2: return f(get_argv(0), get_argv(1)); \
case 3: return f(get_argv(0), get_argv(1), get_argv(2)); \
case 4: return f(get_argv(0), get_argv(1), get_argv(2), get_argv(3)); \
case 5: return f(get_argv(0), get_argv(1), get_argv(2), get_argv(3), \
get_argv(4)); \
case 6: return f(get_argv(0), get_argv(1), get_argv(2), get_argv(3), \
get_argv(4), get_argv(5)); \
case 7: return f(get_argv(0), get_argv(1), get_argv(2), get_argv(3), \
get_argv(4), get_argv(5), get_argv(6)); \
case 8: return f(get_argv(0), get_argv(1), get_argv(2), get_argv(3), \
get_argv(4), get_argv(5), get_argv(6), get_argv(7)); \
case 9: return f(get_argv(0), get_argv(1), get_argv(2), get_argv(3), \
get_argv(4), get_argv(5), get_argv(6), get_argv(7), \
get_argv(8)); \
case 10: return f(get_argv(0), get_argv(1), get_argv(2), get_argv(3), \
get_argv(4), get_argv(5), get_argv(6), get_argv(7), \
get_argv(8), get_argv(9)); \
case 11: return f(get_argv(0), get_argv(1), get_argv(2), get_argv(3), \
get_argv(4), get_argv(5), get_argv(6), get_argv(7), \
get_argv(8), get_argv(9), get_argv(10)); \
case 12: return f(get_argv(0), get_argv(1), get_argv(2), get_argv(3), \
get_argv(4), get_argv(5), get_argv(6), get_argv(7), \
get_argv(8), get_argv(9), get_argv(10), get_argv(11)); \
case 13: return f(get_argv(0), get_argv(1), get_argv(2), get_argv(3), \
get_argv(4), get_argv(5), get_argv(6), get_argv(7), \
get_argv(8), get_argv(9), get_argv(10), get_argv(11), \
get_argv(12)); \
case 14: return f(get_argv(0), get_argv(1), get_argv(2), get_argv(3), \
get_argv(4), get_argv(5), get_argv(6), get_argv(7), \
get_argv(8), get_argv(9), get_argv(10), get_argv(11), \
get_argv(12), get_argv(13)); \
case 15: return f(get_argv(0), get_argv(1), get_argv(2), get_argv(3), \
get_argv(4), get_argv(5), get_argv(6), get_argv(7), \
get_argv(8), get_argv(9), get_argv(10), get_argv(11), \
get_argv(12), get_argv(13), get_argv(14)); \
case 16: return f(get_argv(0), get_argv(1), get_argv(2), get_argv(3), \
get_argv(4), get_argv(5), get_argv(6), get_argv(7), \
get_argv(8), get_argv(9), get_argv(10), get_argv(11), \
get_argv(12), get_argv(13), get_argv(14), get_argv(15)); \
}
+44
View File
@@ -0,0 +1,44 @@
/******************************************************************************
*
* l o w s t a c k - A L P H A . c
*
* Copyright © 1997 Erick Gallesio - I3S-CNRS/ESSI <eg@unice.fr>
*
*
* Permission to use, copy, and/or distribute this software and its
* documentation for any purpose and without fee is hereby granted, provided
* that both the above copyright notice and this permission notice appear in
* all copies and derived works. Fees for distribution or use of this
* software or derived works may only be charged with express written
* permission of the copyright holder.
* This software is provided ``as is'' without express or implied warranty.
*
* This software is a derivative work of other copyrighted softwares; the
* copyright notices of these softwares are placed in the file COPYRIGHTS
*
*
* Author: Erick Gallesio [eg@unice.fr]
* Creation date: 28-Sep-1997 17:30
* Last file update: 29-Sep-1997 11:29
*
******************************************************************************/
/*
The first 6 arguments are passed in registers $16-$21 for integers,
in registers $f16-$f21 for floats. From then on, everything is passed
on the stack.
Everything on the stack is word-aligned.
*/
#include "libstack.h"
void stk_copy_float_registers(void)
{
register double f0 asm ("$f16") = stk_argv[0].d;
register double f1 asm ("$f17") = stk_argv[1].d;
register double f2 asm ("$f18") = stk_argv[2].d;
register double f3 asm ("$f19") = stk_argv[3].d;
register double f4 asm ("$f20") = stk_argv[4].d;
register double f5 asm ("$f21") = stk_argv[5].d;
}
+35
View File
@@ -0,0 +1,35 @@
.set noreorder
.set volatile
.set noat
.text
.align 3
.globl stk_copy_float_registers
.ent stk_copy_float_registers
stk_copy_float_registers:
ldgp $29,0($27)
lda $30,-16($30)
.frame $15,16,$26,0
stq $26,0($30)
stq $15,8($30)
.mask 0x4008000,-16
bis $30,$30,$15
.prologue 1
lda $1,stk_argv
ldt $f16,0($1)
lda $1,stk_argv
ldt $f17,8($1)
lda $1,stk_argv
ldt $f18,16($1)
lda $1,stk_argv
ldt $f19,24($1)
lda $1,stk_argv
ldt $f20,32($1)
lda $1,stk_argv
ldt $f21,40($1)
$33:
bis $15,$15,$30
ldq $26,0($30)
ldq $15,8($30)
addq $30,16,$30
ret $31,($26),1
.end stk_copy_float_registers
+40
View File
@@ -0,0 +1,40 @@
/******************************************************************************
*
* l o w s t a c k - M I P S 3 2 . c
*
* Copyright © 1997 Erick Gallesio - I3S-CNRS/ESSI <eg@unice.fr>
*
*
* Permission to use, copy, and/or distribute this software and its
* documentation for any purpose and without fee is hereby granted, provided
* that both the above copyright notice and this permission notice appear in
* all copies and derived works. Fees for distribution or use of this
* software or derived works may only be charged with express written
* permission of the copyright holder.
* This software is provided ``as is'' without express or implied warranty.
*
* This software is a derivative work of other copyrighted softwares; the
* copyright notices of these softwares are placed in the file COPYRIGHTS
*
*
* Author: Erick Gallesio [eg@unice.fr]
* Creation date: 29-Sep-1997 15:10
* Last file update: 29-Sep-1997 17:56
*
******************************************************************************/
/*
Doubles are 2 words aligned on even boundaries.
If the first two args are floats or doubles, they are also passed in $f12
and $f14. But varargs functions will expect them in the integer registers
and we can't tell whether the function is varargs so we pass them both ways.
*/
extern double stk_double_register1, stk_double_register2;
void stk_copy_float_registers(void)
{
/* Values which must be passed as regsister are kept in globals */
register double f0 /* asm ("$f12") */ = stk_double_register1;
register double f1 /* asm ("$f14") */ = stk_double_register2;
}
+35
View File
@@ -0,0 +1,35 @@
.verstamp 7 10
.option pic2
.extern stk_argv 128
.text
.align 2
.file 2 "lowstack-MIPS32.c"
.globl stk_copy_float_registers
.loc 2 36
# 36 {
.ent stk_copy_float_registers 2
stk_copy_float_registers:
.option O1
.set noreorder
.cpload $25
.set reorder
subu $sp, 16
.frame $sp, 16, $31
.loc 2 36
.loc 2 37
# 37 register double f0 /* asm ("$f12") */ = stk_argv[0].d;
la $14, stk_argv
l.d $f12, 0($14)
.loc 2 38
# 38 register double f1 /* asm ("$f14") */ = stk_argv[1].d;
l.d $f14, 8($14)
.loc 2 43
# 39 #ifdef D0
# 40 register double f2 /* asm ("$f6") */ = stk_argv[2].d;
# 41 register double f3 /* asm ("$f7") */ = stk_argv[3].d;
# 42 #endif
# 43 }
.livereg 0x0000FF0E,0x00000FFF
addu $sp, 16
j $31
.end stk_copy_float_registers
+601
View File
@@ -0,0 +1,601 @@
#include <stdio.h>
#include "libstack.h"
#define MAX_DOUBLE 1.79769313486231470e+308
#define MAX_FLOAT ((float)3.40282346638528860e+38)
#define BIG_FLOAT ((float)3.4e+30)
void use_stack_void(a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11,a12,a13,a14,a15,a16,
b1,b2,b3,b4,b5,b6,b7,b8,b9,b10,b11,b12,b13,b14,b15,b16)
{
return;
}
float use_stack_float(a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11,a12,a13,a14,a15,a16,
b1,b2,b3,b4,b5,b6,b7,b8,b9,b10,b11,b12,b13,b14,b15,b16)
{
return 0.0;
}
double use_stack_double(a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11,a12,a13,a14,a15,a16,
b1,b2,b3,b4,b5,b6,b7,b8,b9,b10,b11,b12,b13,b14,b15,b16)
{
return 0.0;
}
void use_stack()
{
use_stack_void(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);
use_stack_float(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);
use_stack_double(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);
}
void f_void()
{
printf("void f(void):\n");
}
/******************************************************************************/
int f_int0()
{
int r=100;
printf("int f(void):");
return r;
}
int f_int1(int a)
{
int r=a+1;
printf("int f(int):(%d)", a);
return r;
}
int f_int2(int a, int b)
{
int r=a+b;
printf("int f(2*int):(%d,%d)",a,b);
return r;
}
int f_int4(int a, int b, int c, int d)
{
int r=a+b+c+d;
printf("int f(4*int):(%d,%d,%d,%d)",a,b,c,d);
return r;
}
int f_int8(int a, int b, int c, int d, int e, int f, int g, int h)
{
int r=a+b+c+d+e+f+g+h;
printf("int f(8*int):(%d,%d,%d,%d,%d,%d,%d,%d)",a,b,c,d,e,f,g,h);
return r;
}
int f_int16(int a, int b, int c, int d, int e, int f, int g, int h,
int i, int j, int k, int l, int m, int n, int o, int p)
{
int r=a+b+c+d+e+f+g+h+i+j+k+l+m+n+o+p;
printf("int f(16*int):(%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d)",
a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p);
return r;
}
/******************************************************************************/
long f_long0()
{
long r=100;
printf("long f(void):");
return r;
}
long f_long1(long a)
{
long r=a+1;
printf("long f(long):(%d)", a);
return r;
}
long f_long2(long a, long b)
{
long r=a+b;
printf("long f(2*long):(%d,%d)",a,b);
return r;
}
long f_long4(long a, long b, long c, long d)
{
long r=a+b+c+d;
printf("long f(4*long):(%d,%d,%d,%d)",a,b,c,d);
return r;
}
long f_long8(long a, long b, long c, long d, long e, long f, long g, long h)
{
long r=a+b+c+d+e+f+g+h;
printf("long f(8*long):(%d,%d,%d,%d,%d,%d,%d,%d)",a,b,c,d,e,f,g,h);
return r;
}
long f_long16(long a, long b, long c, long d, long e, long f, long g, long h,
long i, long j, long k, long l, long m, long n, long o, long p)
{
long r=a+b+c+d+e+f+g+h+i+j+k+l+m+n+o+p;
printf("long f(16*long):(%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d)",
a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p);
return r;
}
/******************************************************************************/
float f_float0()
{
float r=100;
printf("float f(void):");
return r;
}
float f_float1(float a)
{
float r=a+1;
printf("float f(float):(%5.2f)", a);
return r;
}
float f_float2(float a, float b)
{
float r=a+b;
printf("float f(2*float):(%5.2f,%5.2f)",a,b);
return r;
}
float f_float4(float a, float b, float c, float d)
{
float r=a+b+c+d;
printf("float f(4*float):(%5.2f,%5.2f,%5.2f,%5.2f)",a,b,c,d);
return r;
}
float f_float8(float a,float b,float c,float d,float e,float f,float g,
float h)
{
float r=a+b+c+d+e+f+g+h;
printf("float f(8*float):(%5.2f,%5.2f,%5.2f,%5.2f,%5.2f,%5.2f,%5.2f,%5.2f)",a,b,c,d,e,f,g,h);
return r;
}
float f_float8max(float a,float b,float c,float d,float e,float f,float g,
float h)
{
float r=a+b+c+d+e+f+g+h;
printf("float f(8*float -- max):(%5.2f,%5.2f,%5.2f,%5.2f,%5.2f,%5.2f,%5.2f,%5.2f)",a,b,c,d,e,f,g,h);
return r;
}
float f_float16(float a,float b,float c,float d,float e,float f,
float g,float h, float i,float j,float k,float l,
float m,float n,float o,float p)
{
float r=a+b+c+d+e+f+g+h+i+j+k+l+m+n+o+p;
printf("float f(16*float):(%5.2f,%5.2f,%5.2f,%5.2f,%5.2f,%5.2f,%5.2f,%5.2f,%5.2f,%5.2f,%5.2f,%5.2f,%5.2f,%5.2f,%5.2f,%5.2f)",
a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p);
return r;
}
/******************************************************************************/
double f_double0()
{
double r=100;
printf("double f(void):");
return r;
}
double f_double1(double a)
{
double r=a+1;
printf("double f(double):(%5.2f)", a);
return r;
}
double f_double2(double a, double b)
{
double r=a+b;
printf("double f(2*double):(%5.2f,%5.2f)",a,b);
return r;
}
double f_double4(double a, double b, double c, double d)
{
double r=a+b+c+d;
printf("double f(4*double):(%5.2f,%5.2f,%5.2f,%5.2f)",a,b,c,d);
return r;
}
double f_double8(double a,double b,double c,double d,double e,double f,double g,
double h)
{
double r=a+b+c+d+e+f+g+h;
printf("double f(8*double):(%5.2f,%5.2f,%5.2f,%5.2f,%5.2f,%5.2f,%5.2f,%5.2f)",a,b,c,d,e,f,g,h);
return r;
}
double f_double8max(double a,double b,double c,double d,double e,double f,double g,
double h)
{
double r=a+b+c+d+e+f+g+h;
printf("double f(8*double -- max):(%5.2f,%5.2f,%5.2f,%5.2f,%5.2f,%5.2f,%5.2f,%5.2f)",a,b,c,d,e,f,g,h);
return r;
}
/******************************************************************************/
int f_int_mixed(char a, short b, int c, long d, float e, double f, char *g, int *h)
{
int r=a+b+c+d+(int)e+(int)f+*h;
printf("int f(mixed types):('%c',%d,%d,%ld,%f,%lf,%s)",a,b,c,d,e,f,g);
*h = 1234;
return r;
}
float f_float_mixed(int a, float b, int c, float d)
{
float r=a+b+c+d;
printf("float f(mixed types):(%d,%f,%d,%f)",a,b,c,d);
return r;
}
float f_float_mixed2(int a, int b, float c, float d, int e)
{
float r=a+b+c+d;
printf("float f(mixed types):(%d,%d,%f,%f,%d)",a,b,c,d,e);
return r;
}
double f_double_mixed(char a, short b, int c, long d, float e, double f, char *g,
int *h)
{
double r=a+b+c+d+e+f+*h;
printf("int f(mixed types):('%c',%d,%d,%ld,%f,%lf,%s",a,b,c,d,e,f,g);
*h = 5678;
return r;
}
/******************************************************************************/
void void_test()
{
f_void();
use_stack();
init_ext_call();
call_ext_void(f_void);
}
void int_test()
{
int r;
r = f_int0(); printf("->%d\n",r);
r = 0; use_stack(); init_ext_call();
r = call_ext_int(f_int0); printf("->%d\n",r);
r = f_int1(1); printf("->%d\n",r);
r = 0; use_stack(); init_ext_call();
push_int(1);
r = call_ext_int(f_int1); printf("->%d\n",r);
r = f_int2(1,2); printf("->%d\n",r);
r = 0; use_stack(); init_ext_call();
push_int(1);
push_int(2);
r = call_ext_int(f_int2); printf("->%d\n",r);
r = f_int4(1,2,3,4); printf("->%d\n",r);
r = 0; use_stack(); init_ext_call();
push_int(1);
push_int(2);
push_int(3);
push_int(4);
r = call_ext_int(f_int4); printf("->%d\n",r);
r = f_int8(1,2,3,4,5,6,7,8); printf("->%d\n",r);
r = 0; use_stack(); init_ext_call();
push_int(1);
push_int(2);
push_int(3);
push_int(4);
push_int(5);
push_int(6);
push_int(7);
push_int(8);
r = call_ext_int(f_int8); printf("->%d\n",r);
r = f_int16(1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16); printf("->%d\n",r);
r = 0; use_stack(); init_ext_call();
push_int(1);
push_int(2);
push_int(3);
push_int(4);
push_int(5);
push_int(6);
push_int(7);
push_int(8);
push_int(9);
push_int(10);
push_int(11);
push_int(12);
push_int(13);
push_int(14);
push_int(15);
push_int(16);
r = call_ext_int(f_int16); printf("->%d\n",r);
}
void long_test()
{
long r;
long lg = 1000;
r = f_long0(); printf("->%d\n",r);
r = 0; use_stack(); init_ext_call();
r = call_ext_long(f_long0); printf("->%d\n",r);
r = f_long1(lg); printf("->%d\n",r);
r = 0; use_stack(); init_ext_call();
push_long(lg);
r = call_ext_long(f_long1); printf("->%d\n",r);
r = f_long2(lg,200); printf("->%d\n",r);
r = 0; use_stack(); init_ext_call();
push_long(lg);
push_long(200);
r = call_ext_long(f_long2); printf("->%d\n",r);
r = f_long4(lg,2,3,4); printf("->%d\n",r);
r = 0; use_stack(); init_ext_call();
push_long(lg);
push_long(2);
push_long(3);
push_long(4);
r = call_ext_long(f_long4); printf("->%d\n",r);
r = f_long8(lg,2,3,4,5,6,7,8); printf("->%d\n",r);
r = 0; use_stack(); init_ext_call();
push_long(lg);
push_long(2);
push_long(3);
push_long(4);
push_long(5);
push_long(6);
push_long(7);
push_long(8);
r = call_ext_long(f_long8); printf("->%d\n",r);
r = f_long16(lg,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16); printf("->%d\n",r);
r = 0; use_stack(); init_ext_call();
push_long(lg);
push_long(2);
push_long(3);
push_long(4);
push_long(5);
push_long(6);
push_long(7);
push_long(8);
push_long(9);
push_long(10);
push_long(11);
push_long(12);
push_long(13);
push_long(14);
push_long(15);
push_long(16);
r = call_ext_long(f_long16); printf("->%d\n",r);
}
void float_test()
{
float r;
r = f_float0(); printf("->%5.2f\n",r);
r = 0; use_stack(); init_ext_call();
r = call_ext_float(f_float0); printf("->%5.2f\n",r);
r = f_float1(1.0); printf("->%5.2f\n",r);
r = 0; use_stack(); init_ext_call();
push_float(1.0);
r = call_ext_float(f_float1); printf("->%5.2f\n",r);
r = f_float2(1,2); printf("->%5.2f\n",r);
r = 0; use_stack(); init_ext_call();
push_float(1);
push_float(2);
r = call_ext_float(f_float2); printf("->%5.2f\n",r);
r = f_float4(1,2,3,4); printf("->%5.2f\n",r);
r = 0; use_stack(); init_ext_call();
push_float(1);
push_float(2);
push_float(3);
push_float(4);
r = call_ext_float(f_float4); printf("->%5.2f\n",r);
r = f_float8(1,2,3,4,5,6,7,8); printf("->%5.2f\n",r);
r = 0; use_stack(); init_ext_call();
push_float(1);
push_float(2);
push_float(3);
push_float(4);
push_float(5);
push_float(6);
push_float(7);
push_float(8);
r = call_ext_float(f_float8); printf("->%5.2f\n",r);
r = f_float8max(BIG_FLOAT, BIG_FLOAT, BIG_FLOAT, BIG_FLOAT,
BIG_FLOAT, BIG_FLOAT, BIG_FLOAT, BIG_FLOAT);
printf("->%5.2f\n",r);
r = 0; use_stack(); init_ext_call();
push_float(BIG_FLOAT);
push_float(BIG_FLOAT);
push_float(BIG_FLOAT);
push_float(BIG_FLOAT);
push_float(BIG_FLOAT);
push_float(BIG_FLOAT);
push_float(BIG_FLOAT);
push_float(BIG_FLOAT);
r = call_ext_float(f_float8max); printf("->%5.2f\n",r);
r = f_float16(1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16); printf("->%5.2f\n",r);
r = 0; use_stack(); init_ext_call();
push_float(1);
push_float(2);
push_float(3);
push_float(4);
push_float(5);
push_float(6);
push_float(7);
push_float(8);
push_float(9);
push_float(10);
push_float(11);
push_float(12);
push_float(13);
push_float(14);
push_float(15);
push_float(16);
r = call_ext_float(f_float16); printf("->%5.2f\n",r);
}
void double_test()
{
double r;
r = f_double0(); printf("->%5.2f\n",r);
r = 0; use_stack(); init_ext_call();
r = call_ext_double(f_double0); printf("->%5.2f\n",r);
r = f_double1(1); printf("->%5.2f\n",r);
r = 0; use_stack(); init_ext_call();
push_double(1);
r = call_ext_double(f_double1); printf("->%5.2f\n",r);
r = f_double2(1,2); printf("->%5.2f\n",r);
r = 0; use_stack(); init_ext_call();
push_double(1);
push_double(2);
r = call_ext_double(f_double2); printf("->%5.2f\n",r);
r = f_double4(1,2,3,4); printf("->%5.2f\n",r);
r = 0; use_stack(); init_ext_call();
push_double(1);
push_double(2);
push_double(3);
push_double(4);
r = call_ext_double(f_double4); printf("->%5.2f\n",r);
r = f_double8(1,2,3,4,5,6,7,8); printf("->%5.2f\n",r);
r = 0; use_stack(); init_ext_call();
push_double(1);
push_double(2);
push_double(3);
push_double(4);
push_double(5);
push_double(6);
push_double(7);
push_double(8);
r = call_ext_double(f_double8); printf("->%5.2f\n",r);
}
void mixed_test()
{
{
int r;
int dumb = 1 ;
r = f_int_mixed('?',1,2,3,4.123456,5.123456789012345,"Hello, world",&dumb);
printf("->%d (%d)\n",r, dumb);
r = 0; dumb = 1; use_stack(); init_ext_call();
push_char('?');
push_short(1);
push_int(2);
push_long(3);
push_float(4.123456);
push_double(5.123456789012345);
push_string("Hello, world");
push_ptr(&dumb);
r = call_ext_int(f_int_mixed); printf("->%d (%d)\n",r, dumb);
}
{
float r;
r = f_float_mixed(1,2,3,4); printf("->%5.2f\n", r);
r = 0; use_stack(); init_ext_call();
push_int(1);
push_float(2);
push_int(3);
push_float(4);
r = call_ext_float(f_float_mixed); printf("->%5.2f\n", r);
r = f_float_mixed2(1,2,3,4,5); printf("->%5.2f\n", r);
r = 0; use_stack(); init_ext_call();
push_int(1);
push_int(2);
push_float(3);
push_float(4);
push_int(5);
r = call_ext_float(f_float_mixed2); printf("->%5.2f\n", r);
}
{
double r;
int dumb = 1;
r = f_double_mixed('?',1,2,3,4.123456,5.123456789012345,"Hello, world",&dumb);
printf("->%5.2lf (%d)\n",r, dumb);
r = 0; dumb = 1; use_stack(); init_ext_call();
push_char('?');
push_short(1);
push_int(2);
push_long(3);
push_float(4.123456);
push_double(5.123456789012345);
push_string("Hello, world");
push_ptr(&dumb);
r = call_ext_double(f_double_mixed); printf("->%5.2lf (%d)\n",r, dumb);
}
}
main()
{
printf("On this machine we have:\n");
printf("\tsizeof(char)\t= %d\n", sizeof(char));
printf("\tsizeof(short)\t= %d\n", sizeof(short));
printf("\tsizeof(int)\t= %d\n", sizeof(int));
printf("\tsizeof(long)\t= %d\n", sizeof(long));
printf("\tsizeof(float)\t= %d\n", sizeof(float));
printf("\tsizeof(double)\t= %d\n", sizeof(double));
printf("\tsizeof(void*)\t= %d\n", sizeof(void*));
void_test();
int_test();
long_test();
float_test();
double_test();
mixed_test();
}