Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Merge branch 'maint'

* maint:
  Configure now assumed normal doubles
  Bumped version nr
  bumped revision
  make list_suffix/1 and list_prefix/1 handle erl_parse() cons sequences
  modernized and cleaned up edoc documentation
  removed obsolete @spec annotations and fixed some -spec and -type annotations
  preserve line numbers when reverting representation
  updated author e-mail
  removed CVS keywords from source files
  Revise the autoconf tests for double middle endianness.
  Add test for floating-point output to float_SUITE.
  Unbreak floating point on middle-endian machines.
  Add support for NULL value in odbc:param_query

Conflicts:
	xcomp/README.md
  • Loading branch information...
commit 7bb7e63fbada714655f0860a2d1daacbdc0d4712 2 parents 0176b2a + 0342137
Lukas Larsson garazdawi authored

Showing 32 changed files with 1,376 additions and 1,298 deletions. Show diff stats Hide diff stats

  1. +4 0 HOWTO/INSTALL-CROSS.md
  2. +106 0 aclocal.m4
  3. +106 0 erts/aclocal.m4
  4. +1 0  erts/configure.in
  5. +10 0 erts/emulator/beam/erl_bits.c
  6. +7 2 erts/emulator/test/float_SUITE.erl
  7. +106 0 lib/erl_interface/aclocal.m4
  8. +106 0 lib/odbc/aclocal.m4
  9. +44 16 lib/odbc/c_src/odbcserver.c
  10. +1 1  lib/odbc/c_src/odbcserver.h
  11. +2 6 lib/odbc/src/odbc.appup.src
  12. +18 13 lib/odbc/src/odbc.erl
  13. +1 1  lib/odbc/vsn.mk
  14. +5 1 lib/syntax_tools/doc/overview.edoc
  15. +1 3 lib/syntax_tools/src/epp_dodger.erl
  16. +1 1  lib/syntax_tools/src/erl_comment_scan.erl
  17. +1 3 lib/syntax_tools/src/erl_prettypr.erl
  18. +1 3 lib/syntax_tools/src/erl_recomment.erl
  19. +689 1,234 lib/syntax_tools/src/erl_syntax.erl
  20. +1 3 lib/syntax_tools/src/erl_syntax_lib.erl
  21. +1 3 lib/syntax_tools/src/erl_tidy.erl
  22. +1 3 lib/syntax_tools/src/igor.erl
  23. +1 3 lib/syntax_tools/src/prettypr.erl
  24. +1 1  lib/syntax_tools/vsn.mk
  25. +106 0 lib/wx/aclocal.m4
  26. +9 0 xcomp/erl-xcomp-TileraMDE2.0-tilepro.conf
  27. +9 0 xcomp/erl-xcomp-avr32-atmel-linux-gnu.conf
  28. +9 0 xcomp/erl-xcomp-mips-linux.conf
  29. +1 1  xcomp/erl-xcomp-vars.sh
  30. +9 0 xcomp/erl-xcomp-vxworks_ppc32.conf
  31. +9 0 xcomp/erl-xcomp-x86_64-saf-linux-gnu.conf
  32. +9 0 xcomp/erl-xcomp.conf.template
4 HOWTO/INSTALL-CROSS.md
Source Rendered
@@ -461,6 +461,10 @@ When a variable has been set, no warning will be issued.
461 461 automatically detected, but not always. If not automatically detected,
462 462 `configure` will fail unless this variable is set. Since no default
463 463 value is used, `configure` will try to figure this out automatically.
  464 +
  465 +* `erl_xcomp_double_middle` - `yes|no`. Defaults to `no`.
  466 + If `yes`, the target system must have doubles in "middle-endian" format. If
  467 + `no`, it has "regular" endianness.
464 468
465 469 * `erl_xcomp_clock_gettime_cpu_time` - `yes|no`. Defaults to `no`. If `yes`,
466 470 the target system must have a working `clock_gettime()` implementation
106 aclocal.m4
@@ -59,6 +59,7 @@ AC_ARG_VAR(erl_xcomp_isysroot, [Absolute cross system root include path (only us
59 59
60 60 dnl Cross compilation variables
61 61 AC_ARG_VAR(erl_xcomp_bigendian, [big endian system: yes|no (only used when cross compiling)])
  62 +AC_ARG_VAR(erl_xcomp_double_middle_endian, [double-middle-endian system: yes|no (only used when cross compiling)])
62 63 AC_ARG_VAR(erl_xcomp_linux_clock_gettime_correction, [clock_gettime() can be used for time correction: yes|no (only used when cross compiling)])
63 64 AC_ARG_VAR(erl_xcomp_linux_nptl, [have Native POSIX Thread Library: yes|no (only used when cross compiling)])
64 65 AC_ARG_VAR(erl_xcomp_linux_usable_sigusrx, [SIGUSR1 and SIGUSR2 can be used: yes|no (only used when cross compiling)])
@@ -606,6 +607,103 @@ ifelse([$5], , , [$5
606 607 fi
607 608 ])
608 609
  610 +dnl ----------------------------------------------------------------------
  611 +dnl
  612 +dnl AC_DOUBLE_MIDDLE_ENDIAN
  613 +dnl
  614 +dnl Checks whether doubles are represented in "middle-endian" format.
  615 +dnl Sets ac_cv_double_middle_endian={no,yes,unknown} accordingly,
  616 +dnl as well as DOUBLE_MIDDLE_ENDIAN.
  617 +dnl
  618 +dnl
  619 +
  620 +AC_DEFUN([AC_C_DOUBLE_MIDDLE_ENDIAN],
  621 +[AC_CACHE_CHECK(whether double word ordering is middle-endian, ac_cv_c_double_middle_endian,
  622 +[# It does not; compile a test program.
  623 +AC_RUN_IFELSE(
  624 +[AC_LANG_SOURCE([[#include <stdlib.h>
  625 +
  626 +int
  627 +main(void)
  628 +{
  629 + int i = 0;
  630 + int zero = 0;
  631 + int bigendian;
  632 + int zero_index = 0;
  633 +
  634 + union
  635 + {
  636 + long int l;
  637 + char c[sizeof (long int)];
  638 + } u;
  639 +
  640 + /* we'll use the one with 32-bit words */
  641 + union
  642 + {
  643 + double d;
  644 + unsigned int c[2];
  645 + } vint;
  646 +
  647 + union
  648 + {
  649 + double d;
  650 + unsigned long c[2];
  651 + } vlong;
  652 +
  653 + union
  654 + {
  655 + double d;
  656 + unsigned short c[2];
  657 + } vshort;
  658 +
  659 +
  660 + /* Are we little or big endian? From Harbison&Steele. */
  661 + u.l = 1;
  662 + bigendian = (u.c[sizeof (long int) - 1] == 1);
  663 +
  664 + zero_index = bigendian ? 1 : 0;
  665 +
  666 + vint.d = 1.0;
  667 + vlong.d = 1.0;
  668 + vshort.d = 1.0;
  669 +
  670 + if (sizeof(unsigned int) == 4)
  671 + {
  672 + if (vint.c[zero_index] != 0)
  673 + zero = 1;
  674 + }
  675 + else if (sizeof(unsigned long) == 4)
  676 + {
  677 + if (vlong.c[zero_index] != 0)
  678 + zero = 1;
  679 + }
  680 + else if (sizeof(unsigned short) == 4)
  681 + {
  682 + if (vshort.c[zero_index] != 0)
  683 + zero = 1;
  684 + }
  685 +
  686 + exit (zero);
  687 +}
  688 +]])],
  689 + [ac_cv_c_double_middle_endian=no],
  690 + [ac_cv_c_double_middle_endian=yes],
  691 + [ac_cv_c_double_middle=unknown])])
  692 +case $ac_cv_c_double_middle_endian in
  693 + yes)
  694 + m4_default([$1],
  695 + [AC_DEFINE([DOUBLE_MIDDLE_ENDIAN], 1,
  696 + [Define to 1 if your processor stores the words in a double in
  697 + middle-endian format (like some ARMs).])]) ;;
  698 + no)
  699 + $2 ;;
  700 + *)
  701 + m4_default([$3],
  702 + [AC_MSG_WARN([unknown double endianness
  703 +presetting ac_cv_c_double_middle_endian=no (or yes) will help])]) ;;
  704 +esac
  705 +])# AC_C_DOUBLE_MIDDLE_ENDIAN
  706 +
609 707
610 708 dnl ----------------------------------------------------------------------
611 709 dnl
@@ -1337,6 +1435,14 @@ if test "$ac_cv_c_bigendian" = "yes"; then
1337 1435 AC_DEFINE(ETHR_BIGENDIAN, 1, [Define if bigendian])
1338 1436 fi
1339 1437
  1438 +case X$erl_xcomp_double_middle_endian in
  1439 + X) ;;
  1440 + Xyes|Xno|Xunknown) ac_cv_c_double_middle_endian=$erl_xcomp_double_middle_endian;;
  1441 + *) AC_MSG_ERROR([Bad erl_xcomp_double_middle_endian value: $erl_xcomp_double_middle_endian]);;
  1442 +esac
  1443 +
  1444 +AC_C_DOUBLE_MIDDLE_ENDIAN
  1445 +
1340 1446 AC_ARG_ENABLE(native-ethr-impls,
1341 1447 AS_HELP_STRING([--disable-native-ethr-impls],
1342 1448 [disable native ethread implementations]),
106 erts/aclocal.m4
@@ -59,6 +59,7 @@ AC_ARG_VAR(erl_xcomp_isysroot, [Absolute cross system root include path (only us
59 59
60 60 dnl Cross compilation variables
61 61 AC_ARG_VAR(erl_xcomp_bigendian, [big endian system: yes|no (only used when cross compiling)])
  62 +AC_ARG_VAR(erl_xcomp_double_middle_endian, [double-middle-endian system: yes|no (only used when cross compiling)])
62 63 AC_ARG_VAR(erl_xcomp_linux_clock_gettime_correction, [clock_gettime() can be used for time correction: yes|no (only used when cross compiling)])
63 64 AC_ARG_VAR(erl_xcomp_linux_nptl, [have Native POSIX Thread Library: yes|no (only used when cross compiling)])
64 65 AC_ARG_VAR(erl_xcomp_linux_usable_sigusrx, [SIGUSR1 and SIGUSR2 can be used: yes|no (only used when cross compiling)])
@@ -606,6 +607,103 @@ ifelse([$5], , , [$5
606 607 fi
607 608 ])
608 609
  610 +dnl ----------------------------------------------------------------------
  611 +dnl
  612 +dnl AC_DOUBLE_MIDDLE_ENDIAN
  613 +dnl
  614 +dnl Checks whether doubles are represented in "middle-endian" format.
  615 +dnl Sets ac_cv_double_middle_endian={no,yes,unknown} accordingly,
  616 +dnl as well as DOUBLE_MIDDLE_ENDIAN.
  617 +dnl
  618 +dnl
  619 +
  620 +AC_DEFUN([AC_C_DOUBLE_MIDDLE_ENDIAN],
  621 +[AC_CACHE_CHECK(whether double word ordering is middle-endian, ac_cv_c_double_middle_endian,
  622 +[# It does not; compile a test program.
  623 +AC_RUN_IFELSE(
  624 +[AC_LANG_SOURCE([[#include <stdlib.h>
  625 +
  626 +int
  627 +main(void)
  628 +{
  629 + int i = 0;
  630 + int zero = 0;
  631 + int bigendian;
  632 + int zero_index = 0;
  633 +
  634 + union
  635 + {
  636 + long int l;
  637 + char c[sizeof (long int)];
  638 + } u;
  639 +
  640 + /* we'll use the one with 32-bit words */
  641 + union
  642 + {
  643 + double d;
  644 + unsigned int c[2];
  645 + } vint;
  646 +
  647 + union
  648 + {
  649 + double d;
  650 + unsigned long c[2];
  651 + } vlong;
  652 +
  653 + union
  654 + {
  655 + double d;
  656 + unsigned short c[2];
  657 + } vshort;
  658 +
  659 +
  660 + /* Are we little or big endian? From Harbison&Steele. */
  661 + u.l = 1;
  662 + bigendian = (u.c[sizeof (long int) - 1] == 1);
  663 +
  664 + zero_index = bigendian ? 1 : 0;
  665 +
  666 + vint.d = 1.0;
  667 + vlong.d = 1.0;
  668 + vshort.d = 1.0;
  669 +
  670 + if (sizeof(unsigned int) == 4)
  671 + {
  672 + if (vint.c[zero_index] != 0)
  673 + zero = 1;
  674 + }
  675 + else if (sizeof(unsigned long) == 4)
  676 + {
  677 + if (vlong.c[zero_index] != 0)
  678 + zero = 1;
  679 + }
  680 + else if (sizeof(unsigned short) == 4)
  681 + {
  682 + if (vshort.c[zero_index] != 0)
  683 + zero = 1;
  684 + }
  685 +
  686 + exit (zero);
  687 +}
  688 +]])],
  689 + [ac_cv_c_double_middle_endian=no],
  690 + [ac_cv_c_double_middle_endian=yes],
  691 + [ac_cv_c_double_middle=unknown])])
  692 +case $ac_cv_c_double_middle_endian in
  693 + yes)
  694 + m4_default([$1],
  695 + [AC_DEFINE([DOUBLE_MIDDLE_ENDIAN], 1,
  696 + [Define to 1 if your processor stores the words in a double in
  697 + middle-endian format (like some ARMs).])]) ;;
  698 + no)
  699 + $2 ;;
  700 + *)
  701 + m4_default([$3],
  702 + [AC_MSG_WARN([unknown double endianness
  703 +presetting ac_cv_c_double_middle_endian=no (or yes) will help])]) ;;
  704 +esac
  705 +])# AC_C_DOUBLE_MIDDLE_ENDIAN
  706 +
609 707
610 708 dnl ----------------------------------------------------------------------
611 709 dnl
@@ -1337,6 +1435,14 @@ if test "$ac_cv_c_bigendian" = "yes"; then
1337 1435 AC_DEFINE(ETHR_BIGENDIAN, 1, [Define if bigendian])
1338 1436 fi
1339 1437
  1438 +case X$erl_xcomp_double_middle_endian in
  1439 + X) ;;
  1440 + Xyes|Xno|Xunknown) ac_cv_c_double_middle_endian=$erl_xcomp_double_middle_endian;;
  1441 + *) AC_MSG_ERROR([Bad erl_xcomp_double_middle_endian value: $erl_xcomp_double_middle_endian]);;
  1442 +esac
  1443 +
  1444 +AC_C_DOUBLE_MIDDLE_ENDIAN
  1445 +
1340 1446 AC_ARG_ENABLE(native-ethr-impls,
1341 1447 AS_HELP_STRING([--disable-native-ethr-impls],
1342 1448 [disable native ethread implementations]),
1  erts/configure.in
@@ -1730,6 +1730,7 @@ case X$erl_xcomp_bigendian in
1730 1730 esac
1731 1731
1732 1732 AC_C_BIGENDIAN
  1733 +AC_C_DOUBLE_MIDDLE_ENDIAN
1733 1734
1734 1735 dnl fdatasync syscall (Unix only)
1735 1736 AC_CHECK_FUNCS([fdatasync])
10 erts/emulator/beam/erl_bits.c
@@ -1005,8 +1005,13 @@ erts_new_bs_put_float(Process *c_p, Eterm arg, Uint num_bits, int flags)
1005 1005
1006 1006 if (is_float(arg)) {
1007 1007 FloatDef *fdp = (FloatDef*)(float_val(arg) + 1);
  1008 +#ifdef DOUBLE_MIDDLE_ENDIAN
  1009 + a = fdp->fw[1];
  1010 + b = fdp->fw[0];
  1011 +#else
1008 1012 a = fdp->fw[0];
1009 1013 b = fdp->fw[1];
  1014 +#endif
1010 1015 } else if (is_small(arg)) {
1011 1016 u.f64 = (double) signed_val(arg);
1012 1017 a = u.i32[0];
@@ -1015,8 +1020,13 @@ erts_new_bs_put_float(Process *c_p, Eterm arg, Uint num_bits, int flags)
1015 1020 if (big_to_double(arg, &u.f64) < 0) {
1016 1021 return 0;
1017 1022 }
  1023 +#ifdef DOUBLE_MIDDLE_ENDIAN
  1024 + a = u.i32[1];
  1025 + b = u.i32[0];
  1026 +#else
1018 1027 a = u.i32[0];
1019 1028 b = u.i32[1];
  1029 +#endif
1020 1030 } else {
1021 1031 return 0;
1022 1032 }
9 erts/emulator/test/float_SUITE.erl
@@ -25,7 +25,7 @@
25 25 init_per_group/2,end_per_group/2,
26 26 init_per_testcase/2,end_per_testcase/2,
27 27 fpe/1,fp_drv/1,fp_drv_thread/1,denormalized/1,match/1,
28   - bad_float_unpack/1,cmp_zero/1, cmp_integer/1, cmp_bignum/1]).
  28 + bad_float_unpack/1, write/1, cmp_zero/1, cmp_integer/1, cmp_bignum/1]).
29 29 -export([otp_7178/1]).
30 30 -export([hidden_inf/1]).
31 31
@@ -42,7 +42,7 @@ suite() -> [{ct_hooks,[ts_install_cth]}].
42 42
43 43 all() ->
44 44 [fpe, fp_drv, fp_drv_thread, otp_7178, denormalized,
45   - match, bad_float_unpack, {group, comparison}
  45 + match, bad_float_unpack, write, {group, comparison}
46 46 ,hidden_inf
47 47 ].
48 48
@@ -190,6 +190,11 @@ bad_float_unpack(Config) when is_list(Config) ->
190 190 bad_float_unpack_match(<<F:64/float>>) -> F;
191 191 bad_float_unpack_match(<<I:64/integer-signed>>) -> I.
192 192
  193 +%% Exposes endianness issues.
  194 +
  195 +write(Config) when is_list(Config) ->
  196 + "1.0" = io_lib:write(1.0).
  197 +
193 198 cmp_zero(_Config) ->
194 199 cmp(0.5e-323,0).
195 200
106 lib/erl_interface/aclocal.m4
@@ -59,6 +59,7 @@ AC_ARG_VAR(erl_xcomp_isysroot, [Absolute cross system root include path (only us
59 59
60 60 dnl Cross compilation variables
61 61 AC_ARG_VAR(erl_xcomp_bigendian, [big endian system: yes|no (only used when cross compiling)])
  62 +AC_ARG_VAR(erl_xcomp_double_middle_endian, [double-middle-endian system: yes|no (only used when cross compiling)])
62 63 AC_ARG_VAR(erl_xcomp_linux_clock_gettime_correction, [clock_gettime() can be used for time correction: yes|no (only used when cross compiling)])
63 64 AC_ARG_VAR(erl_xcomp_linux_nptl, [have Native POSIX Thread Library: yes|no (only used when cross compiling)])
64 65 AC_ARG_VAR(erl_xcomp_linux_usable_sigusrx, [SIGUSR1 and SIGUSR2 can be used: yes|no (only used when cross compiling)])
@@ -606,6 +607,103 @@ ifelse([$5], , , [$5
606 607 fi
607 608 ])
608 609
  610 +dnl ----------------------------------------------------------------------
  611 +dnl
  612 +dnl AC_DOUBLE_MIDDLE_ENDIAN
  613 +dnl
  614 +dnl Checks whether doubles are represented in "middle-endian" format.
  615 +dnl Sets ac_cv_double_middle_endian={no,yes,unknown} accordingly,
  616 +dnl as well as DOUBLE_MIDDLE_ENDIAN.
  617 +dnl
  618 +dnl
  619 +
  620 +AC_DEFUN([AC_C_DOUBLE_MIDDLE_ENDIAN],
  621 +[AC_CACHE_CHECK(whether double word ordering is middle-endian, ac_cv_c_double_middle_endian,
  622 +[# It does not; compile a test program.
  623 +AC_RUN_IFELSE(
  624 +[AC_LANG_SOURCE([[#include <stdlib.h>
  625 +
  626 +int
  627 +main(void)
  628 +{
  629 + int i = 0;
  630 + int zero = 0;
  631 + int bigendian;
  632 + int zero_index = 0;
  633 +
  634 + union
  635 + {
  636 + long int l;
  637 + char c[sizeof (long int)];
  638 + } u;
  639 +
  640 + /* we'll use the one with 32-bit words */
  641 + union
  642 + {
  643 + double d;
  644 + unsigned int c[2];
  645 + } vint;
  646 +
  647 + union
  648 + {
  649 + double d;
  650 + unsigned long c[2];
  651 + } vlong;
  652 +
  653 + union
  654 + {
  655 + double d;
  656 + unsigned short c[2];
  657 + } vshort;
  658 +
  659 +
  660 + /* Are we little or big endian? From Harbison&Steele. */
  661 + u.l = 1;
  662 + bigendian = (u.c[sizeof (long int) - 1] == 1);
  663 +
  664 + zero_index = bigendian ? 1 : 0;
  665 +
  666 + vint.d = 1.0;
  667 + vlong.d = 1.0;
  668 + vshort.d = 1.0;
  669 +
  670 + if (sizeof(unsigned int) == 4)
  671 + {
  672 + if (vint.c[zero_index] != 0)
  673 + zero = 1;
  674 + }
  675 + else if (sizeof(unsigned long) == 4)
  676 + {
  677 + if (vlong.c[zero_index] != 0)
  678 + zero = 1;
  679 + }
  680 + else if (sizeof(unsigned short) == 4)
  681 + {
  682 + if (vshort.c[zero_index] != 0)
  683 + zero = 1;
  684 + }
  685 +
  686 + exit (zero);
  687 +}
  688 +]])],
  689 + [ac_cv_c_double_middle_endian=no],
  690 + [ac_cv_c_double_middle_endian=yes],
  691 + [ac_cv_c_double_middle=unknown])])
  692 +case $ac_cv_c_double_middle_endian in
  693 + yes)
  694 + m4_default([$1],
  695 + [AC_DEFINE([DOUBLE_MIDDLE_ENDIAN], 1,
  696 + [Define to 1 if your processor stores the words in a double in
  697 + middle-endian format (like some ARMs).])]) ;;
  698 + no)
  699 + $2 ;;
  700 + *)
  701 + m4_default([$3],
  702 + [AC_MSG_WARN([unknown double endianness
  703 +presetting ac_cv_c_double_middle_endian=no (or yes) will help])]) ;;
  704 +esac
  705 +])# AC_C_DOUBLE_MIDDLE_ENDIAN
  706 +
609 707
610 708 dnl ----------------------------------------------------------------------
611 709 dnl
@@ -1337,6 +1435,14 @@ if test "$ac_cv_c_bigendian" = "yes"; then
1337 1435 AC_DEFINE(ETHR_BIGENDIAN, 1, [Define if bigendian])
1338 1436 fi
1339 1437
  1438 +case X$erl_xcomp_double_middle_endian in
  1439 + X) ;;
  1440 + Xyes|Xno|Xunknown) ac_cv_c_double_middle_endian=$erl_xcomp_double_middle_endian;;
  1441 + *) AC_MSG_ERROR([Bad erl_xcomp_double_middle_endian value: $erl_xcomp_double_middle_endian]);;
  1442 +esac
  1443 +
  1444 +AC_C_DOUBLE_MIDDLE_ENDIAN
  1445 +
1340 1446 AC_ARG_ENABLE(native-ethr-impls,
1341 1447 AS_HELP_STRING([--disable-native-ethr-impls],
1342 1448 [disable native ethread implementations]),
106 lib/odbc/aclocal.m4
@@ -59,6 +59,7 @@ AC_ARG_VAR(erl_xcomp_isysroot, [Absolute cross system root include path (only us
59 59
60 60 dnl Cross compilation variables
61 61 AC_ARG_VAR(erl_xcomp_bigendian, [big endian system: yes|no (only used when cross compiling)])
  62 +AC_ARG_VAR(erl_xcomp_double_middle_endian, [double-middle-endian system: yes|no (only used when cross compiling)])
62 63 AC_ARG_VAR(erl_xcomp_linux_clock_gettime_correction, [clock_gettime() can be used for time correction: yes|no (only used when cross compiling)])
63 64 AC_ARG_VAR(erl_xcomp_linux_nptl, [have Native POSIX Thread Library: yes|no (only used when cross compiling)])
64 65 AC_ARG_VAR(erl_xcomp_linux_usable_sigusrx, [SIGUSR1 and SIGUSR2 can be used: yes|no (only used when cross compiling)])
@@ -606,6 +607,103 @@ ifelse([$5], , , [$5
606 607 fi
607 608 ])
608 609
  610 +dnl ----------------------------------------------------------------------
  611 +dnl
  612 +dnl AC_DOUBLE_MIDDLE_ENDIAN
  613 +dnl
  614 +dnl Checks whether doubles are represented in "middle-endian" format.
  615 +dnl Sets ac_cv_double_middle_endian={no,yes,unknown} accordingly,
  616 +dnl as well as DOUBLE_MIDDLE_ENDIAN.
  617 +dnl
  618 +dnl
  619 +
  620 +AC_DEFUN([AC_C_DOUBLE_MIDDLE_ENDIAN],
  621 +[AC_CACHE_CHECK(whether double word ordering is middle-endian, ac_cv_c_double_middle_endian,
  622 +[# It does not; compile a test program.
  623 +AC_RUN_IFELSE(
  624 +[AC_LANG_SOURCE([[#include <stdlib.h>
  625 +
  626 +int
  627 +main(void)
  628 +{
  629 + int i = 0;
  630 + int zero = 0;
  631 + int bigendian;
  632 + int zero_index = 0;
  633 +
  634 + union
  635 + {
  636 + long int l;
  637 + char c[sizeof (long int)];
  638 + } u;
  639 +
  640 + /* we'll use the one with 32-bit words */
  641 + union
  642 + {
  643 + double d;
  644 + unsigned int c[2];
  645 + } vint;
  646 +
  647 + union
  648 + {
  649 + double d;
  650 + unsigned long c[2];
  651 + } vlong;
  652 +
  653 + union
  654 + {
  655 + double d;
  656 + unsigned short c[2];
  657 + } vshort;
  658 +
  659 +
  660 + /* Are we little or big endian? From Harbison&Steele. */
  661 + u.l = 1;
  662 + bigendian = (u.c[sizeof (long int) - 1] == 1);
  663 +
  664 + zero_index = bigendian ? 1 : 0;
  665 +
  666 + vint.d = 1.0;
  667 + vlong.d = 1.0;
  668 + vshort.d = 1.0;
  669 +
  670 + if (sizeof(unsigned int) == 4)
  671 + {
  672 + if (vint.c[zero_index] != 0)
  673 + zero = 1;
  674 + }
  675 + else if (sizeof(unsigned long) == 4)
  676 + {
  677 + if (vlong.c[zero_index] != 0)
  678 + zero = 1;
  679 + }
  680 + else if (sizeof(unsigned short) == 4)
  681 + {
  682 + if (vshort.c[zero_index] != 0)
  683 + zero = 1;
  684 + }
  685 +
  686 + exit (zero);
  687 +}
  688 +]])],
  689 + [ac_cv_c_double_middle_endian=no],
  690 + [ac_cv_c_double_middle_endian=yes],
  691 + [ac_cv_c_double_middle=unknown])])
  692 +case $ac_cv_c_double_middle_endian in
  693 + yes)
  694 + m4_default([$1],
  695 + [AC_DEFINE([DOUBLE_MIDDLE_ENDIAN], 1,
  696 + [Define to 1 if your processor stores the words in a double in
  697 + middle-endian format (like some ARMs).])]) ;;
  698 + no)
  699 + $2 ;;
  700 + *)
  701 + m4_default([$3],
  702 + [AC_MSG_WARN([unknown double endianness
  703 +presetting ac_cv_c_double_middle_endian=no (or yes) will help])]) ;;
  704 +esac
  705 +])# AC_C_DOUBLE_MIDDLE_ENDIAN
  706 +
609 707
610 708 dnl ----------------------------------------------------------------------
611 709 dnl
@@ -1337,6 +1435,14 @@ if test "$ac_cv_c_bigendian" = "yes"; then
1337 1435 AC_DEFINE(ETHR_BIGENDIAN, 1, [Define if bigendian])
1338 1436 fi
1339 1437
  1438 +case X$erl_xcomp_double_middle_endian in
  1439 + X) ;;
  1440 + Xyes|Xno|Xunknown) ac_cv_c_double_middle_endian=$erl_xcomp_double_middle_endian;;
  1441 + *) AC_MSG_ERROR([Bad erl_xcomp_double_middle_endian value: $erl_xcomp_double_middle_endian]);;
  1442 +esac
  1443 +
  1444 +AC_C_DOUBLE_MIDDLE_ENDIAN
  1445 +
1340 1446 AC_ARG_ENABLE(native-ethr-impls,
1341 1447 AS_HELP_STRING([--disable-native-ethr-impls],
1342 1448 [disable native ethread implementations]),
60 lib/odbc/c_src/odbcserver.c
@@ -176,7 +176,7 @@ static void encode_column_dyn(db_column column, int column_nr,
176 176 static void encode_data_type(SQLSMALLINT sql_type, SQLINTEGER size,
177 177 SQLSMALLINT decimal_digits, db_state *state);
178 178 static Boolean decode_params(db_state *state, byte *buffer, int *index, param_array **params,
179   - int i, int j);
  179 + int i, int j, int num_param_values);
180 180
181 181 /*------------- Erlang port communication functions ----------------------*/
182 182
@@ -212,6 +212,7 @@ static db_column * alloc_column_buffer(int n);
212 212 static void free_column_buffer(db_column **columns, int n);
213 213 static void free_params(param_array **params, int cols);
214 214 static void clean_state(db_state *state);
  215 +static SQLLEN* alloc_strlen_indptr(int n, int val);
215 216
216 217 /* ------------- Init/map/bind/retrive functions -------------------------*/
217 218
@@ -1157,7 +1158,7 @@ static db_result_msg encode_out_params(db_state *state,
1157 1158 break;
1158 1159 case SQL_C_BIT:
1159 1160 ei_x_encode_atom(&dynamic_buffer(state),
1160   - ((Boolean*)values)[j]==TRUE?"true":"false");
  1161 + ((byte*)values)[j]==TRUE?"true":"false");
1161 1162 break;
1162 1163 default:
1163 1164 ei_x_encode_atom(&dynamic_buffer(state), "error");
@@ -1579,37 +1580,48 @@ static void encode_data_type(SQLSMALLINT sql_type, SQLINTEGER size,
1579 1580 }
1580 1581
1581 1582 static Boolean decode_params(db_state *state, byte *buffer, int *index, param_array **params,
1582   - int i, int j)
  1583 + int i, int j, int num_param_values)
1583 1584 {
1584 1585 int erl_type, size;
1585 1586 long bin_size, l64;
1586 1587 long val;
1587 1588 param_array* param;
1588 1589 TIMESTAMP_STRUCT* ts;
  1590 + char atomarray[MAXATOMLEN+1];
1589 1591
1590 1592 ei_get_type(buffer, index, &erl_type, &size);
1591 1593 param = &(*params)[i];
1592 1594
  1595 + if(erl_type == ERL_ATOM_EXT) {
  1596 + ei_decode_atom(buffer, index, atomarray);
  1597 + if(strncmp(atomarray, "null", 4) == 0 ) {
  1598 + param->offset += param->type.len;
  1599 +
  1600 + if(!param->type.strlen_or_indptr_array)
  1601 + param->type.strlen_or_indptr_array = alloc_strlen_indptr(num_param_values, param->type.len);
  1602 +
  1603 + param->type.strlen_or_indptr_array[j] = SQL_NULL_DATA;
  1604 + return TRUE;
  1605 + }
  1606 + }
  1607 +
1593 1608 switch (param->type.c) {
1594 1609 case SQL_C_CHAR:
1595 1610 if (binary_strings(state)) {
1596 1611 ei_decode_binary(buffer, index,
1597 1612 &(param->values.string[param->offset]), &bin_size);
1598 1613 param->offset += param->type.len;
1599   - param->type.strlen_or_indptr_array[j] = SQL_NTS;
1600 1614 } else {
1601 1615 if(erl_type != ERL_STRING_EXT) {
1602 1616 return FALSE;
1603 1617 }
1604 1618 ei_decode_string(buffer, index, &(param->values.string[param->offset]));
1605 1619 param->offset += param->type.len;
1606   - param->type.strlen_or_indptr_array[j] = SQL_NTS;
1607 1620 }
1608 1621 break;
1609 1622 case SQL_C_WCHAR:
1610 1623 ei_decode_binary(buffer, index, &(param->values.string[param->offset]), &bin_size);
1611 1624 param->offset += param->type.len;
1612   - param->type.strlen_or_indptr_array[j] = SQL_NTS;
1613 1625 break;
1614 1626 case SQL_C_TYPE_TIMESTAMP:
1615 1627 ts = (TIMESTAMP_STRUCT*) param->values.string;
@@ -1661,9 +1673,13 @@ static Boolean decode_params(db_state *state, byte *buffer, int *index, param_ar
1661 1673 if((erl_type != ERL_ATOM_EXT)) {
1662 1674 return FALSE;
1663 1675 }
1664   - ei_decode_boolean(buffer, index, &(param->values.bool[j]));
  1676 + if (strncmp((char*)atomarray,"true",4) == 0)
  1677 + param->values.bool[j] = TRUE;
  1678 + else if (strncmp((char*)atomarray,"false",5) == 0)
  1679 + param->values.bool[j] = FALSE;
  1680 + else
  1681 + return -1;
1665 1682 break;
1666   -
1667 1683 default:
1668 1684 return FALSE;
1669 1685 }
@@ -2014,6 +2030,18 @@ static void clean_state(db_state *state)
2014 2030 nr_of_columns(state) = 0;
2015 2031 }
2016 2032
  2033 +/* Allocates and fill with default value StrLen_or_IndPtr array */
  2034 +static SQLLEN* alloc_strlen_indptr(int n, int val)
  2035 +{
  2036 + int i;
  2037 + SQLLEN* arr = (SQLLEN*)safe_malloc(n * sizeof(SQLLEN));
  2038 +
  2039 + for( i=0; i < n; ++i )
  2040 + arr[i] = val;
  2041 +
  2042 + return arr;
  2043 +}
  2044 +
2017 2045 /* ------------- Init/map/bind/retrive functions ------------------------*/
2018 2046
2019 2047 /* Prepare the state for a connection */
@@ -2118,7 +2146,7 @@ static void init_param_column(param_array *params, byte *buffer, int *index,
2118 2146 (double *)safe_malloc(num_param_values * params->type.len);
2119 2147 } else if(params->type.c == SQL_C_CHAR) {
2120 2148 params->type.strlen_or_indptr_array
2121   - = (SQLLEN*)safe_malloc(num_param_values * sizeof(SQLINTEGER));
  2149 + = alloc_strlen_indptr(num_param_values, SQL_NTS);
2122 2150 params->values.string =
2123 2151 (byte *)safe_malloc(num_param_values *
2124 2152 sizeof(byte)* params->type.len);
@@ -2136,8 +2164,8 @@ static void init_param_column(param_array *params, byte *buffer, int *index,
2136 2164 params->type.len = length+1;
2137 2165 params->type.c = SQL_C_CHAR;
2138 2166 params->type.col_size = (SQLUINTEGER)length;
2139   - params->type.strlen_or_indptr_array =
2140   - (SQLLEN*)safe_malloc(num_param_values * sizeof(SQLINTEGER));
  2167 + params->type.strlen_or_indptr_array
  2168 + = alloc_strlen_indptr(num_param_values, SQL_NTS);
2141 2169 params->values.string =
2142 2170 (byte *)safe_malloc(num_param_values *
2143 2171 sizeof(byte)* params->type.len);
@@ -2159,8 +2187,8 @@ static void init_param_column(param_array *params, byte *buffer, int *index,
2159 2187 params->type.len = (length+1)*sizeof(SQLWCHAR);
2160 2188 params->type.c = SQL_C_WCHAR;
2161 2189 params->type.col_size = (SQLUINTEGER)length;
2162   - params->type.strlen_or_indptr_array =
2163   - (SQLLEN*)safe_malloc(num_param_values * sizeof(SQLINTEGER));
  2190 + params->type.strlen_or_indptr_array
  2191 + = alloc_strlen_indptr(num_param_values, SQL_NTS);
2164 2192 params->values.string =
2165 2193 (byte *)safe_malloc(num_param_values * sizeof(byte) * params->type.len);
2166 2194
@@ -2201,10 +2229,10 @@ static void init_param_column(param_array *params, byte *buffer, int *index,
2201 2229 case USER_BOOLEAN:
2202 2230 params->type.sql = SQL_BIT;
2203 2231 params->type.c = SQL_C_BIT;
2204   - params->type.len = sizeof(Boolean);
  2232 + params->type.len = sizeof(byte);
2205 2233 params->type.col_size = params->type.len;
2206 2234 params->values.bool =
2207   - (Boolean *)safe_malloc(num_param_values * params->type.len);
  2235 + (byte *)safe_malloc(num_param_values * params->type.len);
2208 2236 break;
2209 2237 }
2210 2238 params->offset = 0;
@@ -2411,7 +2439,7 @@ static param_array * bind_parameter_arrays(byte *buffer, int *index,
2411 2439 }
2412 2440
2413 2441 for (j = 0; j < num_param_values; j++) {
2414   - if(!decode_params(state, buffer, index, &params, i, j)) {
  2442 + if(!decode_params(state, buffer, index, &params, i, j, num_param_values)) {
2415 2443 /* An input parameter was not of the expected type */
2416 2444 free_params(&params, i);
2417 2445 return params;
2  lib/odbc/c_src/odbcserver.h
@@ -156,7 +156,7 @@ typedef struct {
156 156 byte *string;
157 157 SQLINTEGER *integer;
158 158 double *floating;
159   - Boolean *bool;
  159 + byte *bool;
160 160 }values;
161 161 } param_array;
162 162
8 lib/odbc/src/odbc.appup.src
... ... @@ -1,12 +1,8 @@
1 1 %% -*- erlang -*-
2 2 {"%VSN%",
3 3 [
4   - {"2.10.11", [{restart_application, odbc}]},
5   - {"2.10.10", [{restart_application, odbc}]},
6   - {"2.10.9", [{restart_application, odbc}]}
  4 + {<<"2\\.*">>, [{restart_application, odbc}]}
7 5 ],
8 6 [
9   - {"2.10.11", [{restart_application, odbc}]},
10   - {"2.10.10", [{restart_application, odbc}]},
11   - {"2.10.9", [{restart_application, odbc}]}
  7 + {<<"2\\.*">>, [{restart_application, odbc}]}
12 8 ]}.
31 lib/odbc/src/odbc.erl
@@ -755,7 +755,10 @@ handle_info({'DOWN', _Ref, _Type, _Process, shutdown}, State) ->
755 755 handle_info({'DOWN', _Ref, _Type, Process, Reason}, State) ->
756 756 {stop, {stopped, {'EXIT', Process, Reason}},
757 757 State#state{reply_to = undefined}};
758   -
  758 +
  759 +handle_info({tcp_closed, Socket}, State = #state{odbc_socket=Socket,
  760 + state = disconnecting}) ->
  761 + {stop, normal, State};
759 762 %---------------------------------------------------------------------------
760 763 %% Catch all - throws away unknown messages (This could happen by "accident"
761 764 %% so we do not want to crash, but we make a log entry as it is an
@@ -942,9 +945,11 @@ fix_params({sql_bit, InOut, Values}) ->
942 945 fix_params({'sql_timestamp', InOut, Values}) ->
943 946 NewValues =
944 947 case (catch
945   - lists:map(fun({{Year,Month,Day},{Hour,Minute,Second}}) ->
946   - {Year,Month,Day,Hour,Minute,Second}
947   - end, Values)) of
  948 + lists:map(
  949 + fun({{Year,Month,Day},{Hour,Minute,Second}}) ->
  950 + {Year,Month,Day,Hour,Minute,Second};
  951 + (null) -> null
  952 + end, Values)) of
948 953 Result ->
949 954 Result
950 955 end,
@@ -960,15 +965,15 @@ fix_inout(out) ->
960 965 fix_inout(inout) ->
961 966 ?INOUT.
962 967
963   -string_terminate([Value| _ ] = Values) when is_list(Value)->
964   - case (catch
965   - lists:map(fun(Str) -> Str ++ [?STR_TERMINATOR] end, Values)) of
966   - Result ->
967   - Result
968   - end;
969   -string_terminate([Value| _ ] = Values) when is_binary(Value)->
970   - case (catch
971   - lists:map(fun(B) -> <<B/binary,0:16>> end, Values)) of
  968 +string_terminate(Values) ->
  969 + case (catch lists:map(fun string_terminate_value/1, Values)) of
972 970 Result ->
973 971 Result
974 972 end.
  973 +
  974 +string_terminate_value(String) when is_list(String) ->
  975 + String ++ [?STR_TERMINATOR];
  976 +string_terminate_value(Binary) when is_binary(Binary) ->
  977 + <<Binary/binary,0:16>>;
  978 +string_terminate_value(null) ->
  979 + null.
2  lib/odbc/vsn.mk
... ... @@ -1 +1 @@
1   -ODBC_VSN = 2.10.12
  1 +ODBC_VSN = 2.10.13
6 lib/syntax_tools/doc/overview.edoc
... ... @@ -1,5 +1,9 @@
  1 + -*- html -*-
1 2
2   -@author Richard Carlsson <richardc@it.uu.se>
  3 + Syntax Tools overview page
  4 +
  5 +
  6 +@author Richard Carlsson <carlsson.richard@gmail.com>
3 7 @copyright 1997-2004 Richard Carlsson
4 8 @version {@version}
5 9 @title Erlang Syntax Tools
4 lib/syntax_tools/src/epp_dodger.erl
@@ -14,10 +14,8 @@
14 14 %% Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
15 15 %% USA
16 16 %%
17   -%% $Id$
18   -%%
19 17 %% @copyright 2001-2006 Richard Carlsson
20   -%% @author Richard Carlsson <richardc@it.uu.se>
  18 +%% @author Richard Carlsson <carlsson.richard@gmail.com>
21 19 %% @end
22 20 %% =====================================================================
23 21
2  lib/syntax_tools/src/erl_comment_scan.erl
@@ -16,7 +16,7 @@
16 16 %%
17 17 %% =====================================================================
18 18 %% @copyright 1997-2006 Richard Carlsson
19   -%% @author Richard Carlsson <richardc@it.uu.se>
  19 +%% @author Richard Carlsson <carlsson.richard@gmail.com>
20 20 %% @end
21 21 %% =====================================================================
22 22
4 lib/syntax_tools/src/erl_prettypr.erl
@@ -14,10 +14,8 @@
14 14 %% Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
15 15 %% USA
16 16 %%
17   -%% $Id$
18   -%%
19 17 %% @copyright 1997-2006 Richard Carlsson
20   -%% @author Richard Carlsson <richardc@it.uu.se>
  18 +%% @author Richard Carlsson <carlsson.richard@gmail.com>
21 19 %% @end
22 20 %% =====================================================================
23 21
4 lib/syntax_tools/src/erl_recomment.erl
@@ -14,10 +14,8 @@
14 14 %% Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
15 15 %% USA
16 16 %%
17   -%% $Id$
18   -%%
19 17 %% @copyright 1997-2006 Richard Carlsson
20   -%% @author Richard Carlsson <richardc@it.uu.se>
  18 +%% @author Richard Carlsson <carlsson.richard@gmail.com>
21 19 %% @end
22 20 %% =====================================================================
23 21
1,923 lib/syntax_tools/src/erl_syntax.erl
689 additions, 1,234 deletions not shown
4 lib/syntax_tools/src/erl_syntax_lib.erl
@@ -14,10 +14,8 @@
14 14 %% Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
15 15 %% USA
16 16 %%
17   -%% $Id$
18   -%%
19 17 %% @copyright 1997-2006 Richard Carlsson
20   -%% @author Richard Carlsson <richardc@it.uu.se>
  18 +%% @author Richard Carlsson <carlsson.richard@gmail.com>
21 19 %% @end
22 20 %% =====================================================================
23 21
4 lib/syntax_tools/src/erl_tidy.erl
@@ -14,10 +14,8 @@
14 14 %% Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
15 15 %% USA
16 16 %%
17   -%% $Id$
18   -%%
19 17 %% @copyright 1999-2006 Richard Carlsson
20   -%% @author Richard Carlsson <richardc@it.uu.se>
  18 +%% @author Richard Carlsson <carlsson.richard@gmail.com>
21 19 %% @end
22 20 %% =====================================================================
23 21
4 lib/syntax_tools/src/igor.erl
@@ -14,10 +14,8 @@
14 14 %% Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
15 15 %% USA
16 16 %%
17   -%% $Id$
18   -%%
19 17 %% @copyright 1998-2006 Richard Carlsson
20   -%% @author Richard Carlsson <richardc@it.uu.se>
  18 +%% @author Richard Carlsson <carlsson.richard@gmail.com>
21 19 %% @end
22 20 %% =====================================================================
23 21
4 lib/syntax_tools/src/prettypr.erl
@@ -14,10 +14,8 @@
14 14 %% Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
15 15 %% USA
16 16 %%
17   -%% $Id$
18   -%%
19 17 %% @copyright 2000-2006 Richard Carlsson
20   -%% @author Richard Carlsson <richardc@it.uu.se>
  18 +%% @author Richard Carlsson <carlsson.richard@gmail.com>
21 19 %% @end
22 20 %% =====================================================================
23 21
2  lib/syntax_tools/vsn.mk
... ... @@ -1 +1 @@
1   -SYNTAX_TOOLS_VSN = 1.6.8
  1 +SYNTAX_TOOLS_VSN = 1.6.9
106 lib/wx/aclocal.m4
@@ -59,6 +59,7 @@ AC_ARG_VAR(erl_xcomp_isysroot, [Absolute cross system root include path (only us
59 59
60 60 dnl Cross compilation variables
61 61 AC_ARG_VAR(erl_xcomp_bigendian, [big endian system: yes|no (only used when cross compiling)])
  62 +AC_ARG_VAR(erl_xcomp_double_middle_endian, [double-middle-endian system: yes|no (only used when cross compiling)])
62 63 AC_ARG_VAR(erl_xcomp_linux_clock_gettime_correction, [clock_gettime() can be used for time correction: yes|no (only used when cross compiling)])
63 64 AC_ARG_VAR(erl_xcomp_linux_nptl, [have Native POSIX Thread Library: yes|no (only used when cross compiling)])
64 65 AC_ARG_VAR(erl_xcomp_linux_usable_sigusrx, [SIGUSR1 and SIGUSR2 can be used: yes|no (only used when cross compiling)])
@@ -606,6 +607,103 @@ ifelse([$5], , , [$5
606 607 fi
607 608 ])
608 609
  610 +dnl ----------------------------------------------------------------------
  611 +dnl
  612 +dnl AC_DOUBLE_MIDDLE_ENDIAN
  613 +dnl
  614 +dnl Checks whether doubles are represented in "middle-endian" format.
  615 +dnl Sets ac_cv_double_middle_endian={no,yes,unknown} accordingly,
  616 +dnl as well as DOUBLE_MIDDLE_ENDIAN.
  617 +dnl
  618 +dnl
  619 +
  620 +AC_DEFUN([AC_C_DOUBLE_MIDDLE_ENDIAN],
  621 +[AC_CACHE_CHECK(whether double word ordering is middle-endian, ac_cv_c_double_middle_endian,
  622 +[# It does not; compile a test program.
  623 +AC_RUN_IFELSE(
  624 +[AC_LANG_SOURCE([[#include <stdlib.h>
  625 +
  626 +int
  627 +main(void)
  628 +{
  629 + int i = 0;
  630 + int zero = 0;
  631 + int bigendian;
  632 + int zero_index = 0;
  633 +
  634 + union
  635 + {
  636 + long int l;
  637 + char c[sizeof (long int)];
  638 + } u;
  639 +
  640 + /* we'll use the one with 32-bit words */
  641 + union
  642 + {
  643 + double d;
  644 + unsigned int c[2];
  645 + } vint;
  646 +
  647 + union
  648 + {
  649 + double d;
  650 + unsigned long c[2];
  651 + } vlong;
  652 +
  653 + union
  654 + {
  655 + double d;
  656 + unsigned short c[2];
  657 + } vshort;
  658 +
  659 +
  660 + /* Are we little or big endian? From Harbison&Steele. */
  661 + u.l = 1;
  662 + bigendian = (u.c[sizeof (long int) - 1] == 1);
  663 +
  664 + zero_index = bigendian ? 1 : 0;
  665 +
  666 + vint.d = 1.0;
  667 + vlong.d = 1.0;
  668 + vshort.d = 1.0;
  669 +
  670 + if (sizeof(unsigned int) == 4)
  671 + {
  672 + if (vint.c[zero_index] != 0)
  673 + zero = 1;
  674 + }
  675 + else if (sizeof(unsigned long) == 4)
  676 + {
  677 + if (vlong.c[zero_index] != 0)
  678 + zero = 1;
  679 + }
  680 + else if (sizeof(unsigned short) == 4)
  681 + {
  682 + if (vshort.c[zero_index] != 0)
  683 + zero = 1;
  684 + }
  685 +
  686 + exit (zero);
  687 +}
  688 +]])],
  689 + [ac_cv_c_double_middle_endian=no],
  690 + [ac_cv_c_double_middle_endian=yes],
  691 + [ac_cv_c_double_middle=unknown])])
  692 +case $ac_cv_c_double_middle_endian in
  693 + yes)
  694 + m4_default([$1],
  695 + [AC_DEFINE([DOUBLE_MIDDLE_ENDIAN], 1,
  696 + [Define to 1 if your processor stores the words in a double in
  697 + middle-endian format (like some ARMs).])]) ;;
  698 + no)
  699 + $2 ;;
  700 + *)
  701 + m4_default([$3],
  702 + [AC_MSG_WARN([unknown double endianness
  703 +presetting ac_cv_c_double_middle_endian=no (or yes) will help])]) ;;
  704 +esac
  705 +])# AC_C_DOUBLE_MIDDLE_ENDIAN
  706 +
609 707
610 708 dnl ----------------------------------------------------------------------
611 709 dnl
@@ -1337,6 +1435,14 @@ if test "$ac_cv_c_bigendian" = "yes"; then
1337 1435 AC_DEFINE(ETHR_BIGENDIAN, 1, [Define if bigendian])
1338 1436 fi
1339 1437
  1438 +case X$erl_xcomp_double_middle_endian in
  1439 + X) ;;
  1440 + Xyes|Xno|Xunknown) ac_cv_c_double_middle_endian=$erl_xcomp_double_middle_endian;;
  1441 + *) AC_MSG_ERROR([Bad erl_xcomp_double_middle_endian value: $erl_xcomp_double_middle_endian]);;
  1442 +esac
  1443 +
  1444 +AC_C_DOUBLE_MIDDLE_ENDIAN
  1445 +
1340 1446 AC_ARG_ENABLE(native-ethr-impls,
1341 1447 AS_HELP_STRING([--disable-native-ethr-impls],
1342 1448 [disable native ethread implementations]),
9 xcomp/erl-xcomp-TileraMDE2.0-tilepro.conf
@@ -187,6 +187,15 @@ erl_xcomp_sysroot="$TILERA_ROOT/tile"
187 187 # value is used, `configure' will try to figure this out automatically.
188 188 #erl_xcomp_bigendian=
189 189
  190 +# * `erl_xcomp_double_middle_endian` - `yes|no`. No default. If `yes`, the
  191 +# target system must have doubles in "middle-endian" format. If
  192 +# `no`, it has "regular" endianness. This can often be automatically
  193 +# detected, but not always. If not automatically detected,
  194 +# `configure` will fail unless this variable is set. Since no
  195 +# default value is used, `configure` will try to figure this out
  196 +# automatically.
  197 +#erl_xcomp_double_middle_endian
  198 +
190 199 # * `erl_xcomp_clock_gettime_cpu_time' - `yes|no'. Defaults to `no'. If `yes',
191 200 # the target system must have a working `clock_gettime()' implementation
192 201 # that can be used for retrieving process CPU time.
9 xcomp/erl-xcomp-avr32-atmel-linux-gnu.conf
@@ -190,6 +190,15 @@ erl_xcomp_sysroot="$ATMEL_SYSROOT_AVR32"
190 190 # value is used, `configure' will try to figure this out automatically.
191 191 #erl_xcomp_bigendian=
192 192
  193 +# * `erl_xcomp_double_middle_endian` - `yes|no`. No default. If `yes`, the
  194 +# target system must have doubles in "middle-endian" format. If
  195 +# `no`, it has "regular" endianness. This can often be automatically
  196 +# detected, but not always. If not automatically detected,
  197 +# `configure` will fail unless this variable is set. Since no
  198 +# default value is used, `configure` will try to figure this out
  199 +# automatically.
  200 +#erl_xcomp_double_middle_endian
  201 +
193 202 # * `erl_xcomp_clock_gettime_cpu_time' - `yes|no'. Defaults to `no'. If `yes',
194 203 # the target system must have a working `clock_gettime()' implementation
195 204 # that can be used for retrieving process CPU time.
9 xcomp/erl-xcomp-mips-linux.conf
@@ -187,6 +187,15 @@ CFLAGS=-Os
187 187 # value is used, `configure' will try to figure this out automatically.
188 188 #erl_xcomp_bigendian=
189 189
  190 +# * `erl_xcomp_double_middle_endian` - `yes|no`. No default. If `yes`, the
  191 +# target system must have doubles in "middle-endian" format. If
  192 +# `no`, it has "regular" endianness. This can often be automatically
  193 +# detected, but not always. If not automatically detected,
  194 +# `configure` will fail unless this variable is set. Since no
  195 +# default value is used, `configure` will try to figure this out
  196 +# automatically.
  197 +#erl_xcomp_double_middle_endian
  198 +
190 199 # * `erl_xcomp_clock_gettime_cpu_time' - `yes|no'. Defaults to `no'. If `yes',
191 200 # the target system must have a working `clock_gettime()' implementation
192 201 # that can be used for retrieving process CPU time.
2  xcomp/erl-xcomp-vars.sh
@@ -26,4 +26,4 @@
26 26 # and precious variables in $ERL_TOP/erts/aclocal.m4.
27 27 #
28 28
29   -erl_xcomp_vars="erl_xcomp_sysroot erl_xcomp_isysroot erl_xcomp_bigendian erl_xcomp_linux_clock_gettime_correction erl_xcomp_linux_nptl erl_xcomp_linux_usable_sigusrx erl_xcomp_linux_usable_sigaltstack erl_xcomp_poll erl_xcomp_kqueue erl_xcomp_putenv_copy erl_xcomp_reliable_fpe erl_xcomp_getaddrinfo erl_xcomp_gethrvtime_procfs_ioctl erl_xcomp_clock_gettime_cpu_time erl_xcomp_after_morecore_hook erl_xcomp_dlsym_brk_wrappers"
  29 +erl_xcomp_vars="erl_xcomp_sysroot erl_xcomp_isysroot erl_xcomp_bigendian erl_xcomp_double_middle_endian erl_xcomp_linux_clock_gettime_correction erl_xcomp_linux_nptl erl_xcomp_linux_usable_sigusrx erl_xcomp_linux_usable_sigaltstack erl_xcomp_poll erl_xcomp_kqueue erl_xcomp_putenv_copy erl_xcomp_reliable_fpe erl_xcomp_getaddrinfo erl_xcomp_gethrvtime_procfs_ioctl erl_xcomp_clock_gettime_cpu_time erl_xcomp_after_morecore_hook erl_xcomp_dlsym_brk_wrappers"
9 xcomp/erl-xcomp-vxworks_ppc32.conf
@@ -187,6 +187,15 @@ AR="$WIND_BASE/gnu/3.4.4-vxworks-6.3/$WIND_HOST_TYPE/bin/arppc"
187 187 # value is used, `configure' will try to figure this out automatically.
188 188 erl_xcomp_bigendian=yes
189 189
  190 +# * `erl_xcomp_double_middle_endian` - `yes|no`. No default. If `yes`, the
  191 +# target system must have doubles in "middle-endian" format. If
  192 +# `no`, it has "regular" endianness. This can often be automatically
  193 +# detected, but not always. If not automatically detected,
  194 +# `configure` will fail unless this variable is set. Since no
  195 +# default value is used, `configure` will try to figure this out
  196 +# automatically.