Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
70 changes: 2 additions & 68 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -292,59 +292,6 @@ AS_IF([test "x$with_api" = xwindows],
AM_CONDITIONAL([ONUNIX], [test "x$with_api" = xposix])
AM_CONDITIONAL([ONWINDOWS], [test "x$with_api" = xwindows])

# Check for data model
AC_CHECK_SIZEOF([char])
AC_CHECK_SIZEOF([short])
AC_CHECK_SIZEOF([int])
AC_CHECK_SIZEOF([long])
AC_CHECK_SIZEOF([long long])
AC_CHECK_SIZEOF([void *])
AC_CHECK_SIZEOF([off_t])

case $ac_cv_sizeof_char-$ac_cv_sizeof_short-$ac_cv_sizeof_int-$ac_cv_sizeof_long-$ac_cv_sizeof_long_long-$ac_cv_sizeof_void_p-$ac_cv_sizeof_off_t in
1-2-4-4-*-4-*)
# Most of today's 32 bit systems.
print_data_model="ILP32"
ac_cv_sizeof_WORD=$ac_cv_sizeof_short
ac_cv_sizeof_LONG=$ac_cv_sizeof_long
AC_DEFINE(ILP32, , [Compiling for ILP32 data model])
# We need INT64.
AS_IF([test $ac_cv_sizeof_long_long -ne 8],
[AC_MSG_FAILURE([64-bit integers are not available])])
;;
1-2-4-4-8-8-*)
# Microsoft Windows (X64/IA-64).
print_data_model="LLP64"
ac_cv_sizeof_WORD=$ac_cv_sizeof_int
ac_cv_sizeof_LONG=$ac_cv_sizeof_long_long
AC_DEFINE(LLP64, , [Compiling for LLP64 data model])
;;
1-2-4-8-*-8-*)
# Most Unix and Unix-like systems, e.g., Solaris, Linux and Mac OS X.
print_data_model="LP64"
ac_cv_sizeof_WORD=$ac_cv_sizeof_int
ac_cv_sizeof_LONG=$ac_cv_sizeof_long
AC_DEFINE(LP64, , [Compiling for LP64 data model])
;;
*)
AC_MSG_FAILURE([Cannot recognize the data model used in the compiler])
;;
esac
# Our basic assumption:
# sizeof(off_t) >= sizeof(LONG) >= sizeof(void *) >= sizeof(int)
# >= sizeof(WORD) >= sizeof(char) == 1.
flag=:
$flag && test $ac_cv_sizeof_off_t -lt $ac_cv_sizeof_LONG && flag=false
$flag && test $ac_cv_sizeof_LONG -lt $ac_cv_sizeof_void_p && flag=false
$flag && test $ac_cv_sizeof_void_p -lt $ac_cv_sizeof_int && flag=false
$flag && test $ac_cv_sizeof_int -lt $ac_cv_sizeof_WORD && flag=false
$flag && test $ac_cv_sizeof_WORD -lt $ac_cv_sizeof_char && flag=false
$flag && test $ac_cv_sizeof_char -ne 1 && flag=false
AS_IF([$flag], [], [AC_MSG_FAILURE([Basic assumption sizeof(off_t) >= sizeof(LONG) >= sizeof(void *) >= sizeof(int) >= sizeof(WORD) >= sizeof(char) == 1 does not hold.])])
# sizeof(off_t) <= 4 means files must <= 2 GB.
AS_IF([test $ac_cv_sizeof_off_t -le 4], [AC_MSG_WARN([Large files more than 2 GB are not supported])])
AC_MSG_NOTICE([The data model is $print_data_model])

# Check for gmp
AC_ARG_WITH([gmp],
[AS_HELP_STRING([--with-gmp@<:@=DIR@:>@],
Expand Down Expand Up @@ -975,15 +922,7 @@ if test "$my_test_COMPILEFLAGS" != set; then
# Use -march=native if available.
AX_CHECK_COMPILE_FLAG([-march=native],
[COMPILEFLAGS="$COMPILEFLAGS -march=native"],
[if test "x$print_data_model" = xILP32; then
if test "x$print_cpu" = xPentium; then
COMPILEFLAGS="$COMPILEFLAGS -march=i586"
elif test "x$print_cpu" = 'xPentium Pro'; then
COMPILEFLAGS="$COMPILEFLAGS -march=i686"
elif test "x$print_cpu" = xOpteron; then
COMPILEFLAGS="$COMPILEFLAGS -march=opteron"
fi
fi],
[],
[-Werror])
fi
# Profiling option.
Expand Down Expand Up @@ -1191,7 +1130,7 @@ manoutputdir=$(eval "echo $mandir")
manoutputdir=$(eval "echo $manoutputdir")
echo "FORM $VERSION"
echo
echo "Compiling for: $print_cpu $print_os ($print_data_model $print_api)"
echo "Compiling for: $print_cpu $print_os ($print_api)"
echo
echo "Optionally linked libraries:"
atleastone=no
Expand Down Expand Up @@ -1390,11 +1329,6 @@ fi
if test $atleastone = no; then
echo " <NONE>"
fi
if test $ac_cv_sizeof_off_t -le 4; then
echo
echo "***CAUTION*** Large files more than 2 GB will be"
echo "not supported."
fi
if test "x$thread_clock_ok" = xno; then
s="none"
if test "x$build_tform" = xyes && test "x$build_tvorm" = xyes; then
Expand Down
9 changes: 5 additions & 4 deletions sources/argument.c
Original file line number Diff line number Diff line change
Expand Up @@ -53,14 +53,15 @@
need to insert a different value (C->lhs[level][2]).
*/

WORD execarg(PHEAD WORD *term, WORD level)
int execarg(PHEAD WORD *term, WORD level)
{
GETBIDENTITY
WORD *t, *r, *m, *v;
WORD *start, *stop, *rstop, *r1, *r2 = 0, *r3 = 0, *r4, *r5, *r6, *r7, *r8, *r9;
WORD *mm, *mstop, *rnext, *rr, *factor, type, ngcd, nq;
CBUF *C = cbuf+AM.rbufnum, *CC = cbuf+AT.ebufnum;
WORD i, j, k, oldnumlhs = AR.Cnumlhs, count, action = 0, olddefer = AR.DeferFlag;
WORD i, j, k, oldnumlhs = AR.Cnumlhs, count, olddefer = AR.DeferFlag;
int action = 0;
WORD oldnumrhs = CC->numrhs, size, pow, jj;
LONG oldcpointer = CC->Pointer - CC->Buffer, oldppointer = AT.pWorkPointer, lp;
WORD *oldwork = AT.WorkPointer, *oldwork2, scale, renorm;
Expand Down Expand Up @@ -1766,7 +1767,7 @@ oneterm:;
#[ execterm :
*/

WORD execterm(PHEAD WORD *term, WORD level)
int execterm(PHEAD WORD *term, WORD level)
{
GETBIDENTITY
CBUF *C = cbuf+AM.rbufnum;
Expand Down Expand Up @@ -2534,7 +2535,7 @@ WORD FindArg(PHEAD WORD *a)
* If par == 1 it inserts in the cache defined with the FactorCache statement
*/

WORD InsertArg(PHEAD WORD *argin, WORD *argout,int par)
int InsertArg(PHEAD WORD *argin, WORD *argout,int par)
{
CBUF *C;
WORD *a, i, bufnum;
Expand Down
28 changes: 13 additions & 15 deletions sources/compiler.c
Original file line number Diff line number Diff line change
Expand Up @@ -267,32 +267,30 @@ LONG insubexpbuffers = 0;
subexpbuffers = (SUBBUF *)Malloc1(256*sizeof(SUBBUF),"subexpbuffers");\
topsubexpbuffers = subexpbuffers+256; } insubexpbuffers = 0; }

#if defined(ILP32)

#define PUTNUMBER128(t,n) { if ( n >= 16384 ) { \
#if BITSINWORD == 32
#define PUTNUMBER128(t,n) { if ( n >= 2097152 ) { \
*t++ = ((n/128)/128)/128; *t++ = ((n/128)/128)%128; *t++ = (n/128)%128; *t++ = n%128; } \
else if ( n >= 16384 ) { \
*t++ = n/(128*128); *t++ = (n/128)%128; *t++ = n%128; } \
else if ( n >= 128 ) { *t++ = n/128; *t++ = n%128; } \
else *t++ = n; }
#define PUTNUMBER100(t,n) { if ( n >= 10000 ) { \
#define PUTNUMBER100(t,n) { if ( n >= 1000000 ) { \
*t++ = ((n/100)/100)/100; *t++ = ((n/100)/100)%100; *t++ = (n/100)%100; *t++ = n%100; } \
else if ( n >= 10000 ) { \
*t++ = n/10000; *t++ = (n/100)%100; *t++ = n%100; } \
else if ( n >= 100 ) { *t++ = n/100; *t++ = n%100; } \
else *t++ = n; }

#elif ( defined(LLP64) || defined(LP64) )

#define PUTNUMBER128(t,n) { if ( n >= 2097152 ) { \
*t++ = ((n/128)/128)/128; *t++ = ((n/128)/128)%128; *t++ = (n/128)%128; *t++ = n%128; } \
else if ( n >= 16384 ) { \
#elif BITSINWORD == 16
#define PUTNUMBER128(t,n) { if ( n >= 16384 ) { \
*t++ = n/(128*128); *t++ = (n/128)%128; *t++ = n%128; } \
else if ( n >= 128 ) { *t++ = n/128; *t++ = n%128; } \
else *t++ = n; }
#define PUTNUMBER100(t,n) { if ( n >= 1000000 ) { \
*t++ = ((n/100)/100)/100; *t++ = ((n/100)/100)%100; *t++ = (n/100)%100; *t++ = n%100; } \
else if ( n >= 10000 ) { \
#define PUTNUMBER100(t,n) { if ( n >= 10000 ) { \
*t++ = n/10000; *t++ = (n/100)%100; *t++ = n%100; } \
else if ( n >= 100 ) { *t++ = n/100; *t++ = n%100; } \
else *t++ = n; }

#else
#error Only 64-bit and 32-bit platforms are supported.
#endif

/*
Expand Down Expand Up @@ -2243,7 +2241,7 @@ int CodeFactors(SBYTE *tokens)

WORD GenerateFactors(WORD n,WORD inc)
{
WORD subexp;
int subexp;
int i, error = 0;
SBYTE *s;
SBYTE *tokenbuffer = (SBYTE *)Malloc1(8*n*sizeof(SBYTE),"GenerateFactors");
Expand Down
Loading
Loading