summaryrefslogtreecommitdiff
path: root/Build/source/texk
diff options
context:
space:
mode:
authorJonathan Kew <jfkthame@googlemail.com>2008-06-03 11:57:25 +0000
committerJonathan Kew <jfkthame@googlemail.com>2008-06-03 11:57:25 +0000
commitc8bef80b5b52f1ab4733c7e5ea2095ca1692fb84 (patch)
treedcf59a2a386877cb8359348886036285ddc80966 /Build/source/texk
parent294fe331a768b101f3b0b3d7f91171ab8900152d (diff)
avoid fabsf, fmaxf in synctex code for portability
git-svn-id: svn://tug.org/texlive/trunk@8516 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build/source/texk')
-rw-r--r--Build/source/texk/web2c/c-auto.in3
-rwxr-xr-xBuild/source/texk/web2c/configure3
-rw-r--r--Build/source/texk/web2c/configure.in2
-rw-r--r--Build/source/texk/web2c/synctex/synctex_main.c13
-rw-r--r--Build/source/texk/web2c/synctex/synctex_parser.c6
5 files changed, 19 insertions, 8 deletions
diff --git a/Build/source/texk/web2c/c-auto.in b/Build/source/texk/web2c/c-auto.in
index 3813e384d16..367ac190934 100644
--- a/Build/source/texk/web2c/c-auto.in
+++ b/Build/source/texk/web2c/c-auto.in
@@ -40,6 +40,9 @@
/* Define if you have Carbon */
#undef HAVE_CARBON
+/* Define to 1 if you have the `fmax' function. */
+#undef HAVE_FMAX
+
/* Define to 1 if you have the <ft2build.h> header file. */
#undef HAVE_FT2BUILD_H
diff --git a/Build/source/texk/web2c/configure b/Build/source/texk/web2c/configure
index c1685cd3016..3844d907ef7 100755
--- a/Build/source/texk/web2c/configure
+++ b/Build/source/texk/web2c/configure
@@ -4231,7 +4231,8 @@ done
-for ac_func in strerror gettimeofday ftime mkstemp mktemp setlocale strlcat strlcpy
+
+for ac_func in strerror gettimeofday ftime mkstemp mktemp setlocale strlcat strlcpy fmax
do
as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
{ $as_echo "$as_me:$LINENO: checking for $ac_func" >&5
diff --git a/Build/source/texk/web2c/configure.in b/Build/source/texk/web2c/configure.in
index 030dfb3f3ae..0899b6c4c83 100644
--- a/Build/source/texk/web2c/configure.in
+++ b/Build/source/texk/web2c/configure.in
@@ -41,7 +41,7 @@ case $LEX in
esac
AC_PROG_RANLIB
AC_CHECK_HEADERS(sys/time.h sys/timeb.h locale.h)
-AC_CHECK_FUNCS(strerror gettimeofday ftime mkstemp mktemp setlocale strlcat strlcpy)
+AC_CHECK_FUNCS(strerror gettimeofday ftime mkstemp mktemp setlocale strlcat strlcpy fmax)
AC_TYPE_SIGNAL
diff --git a/Build/source/texk/web2c/synctex/synctex_main.c b/Build/source/texk/web2c/synctex/synctex_main.c
index c031b2f4bdb..76d1fe8f9d7 100644
--- a/Build/source/texk/web2c/synctex/synctex_main.c
+++ b/Build/source/texk/web2c/synctex/synctex_main.c
@@ -37,6 +37,8 @@ This file is named "synctex_main.c".
This is the command line interface to the synctex_parser.c.
*/
+# include "web2c/c-auto.h" /* for inline && HAVE_xxx */
+
# include <stdlib.h>
# include <stdio.h>
# include <string.h>
@@ -54,6 +56,10 @@ This is the command line interface to the synctex_parser.c.
#ifndef HAVE_STRLCPY
#define strlcpy(dst, src, size) strcpy((dst), (src))
#endif
+#ifndef HAVE_FMAX
+#define fmax my_fmax
+inline static double my_fmax(double x, double y) { return (x < y) ? y : x; }
+#endif
#define SYNCTEX_DEBUG 0
@@ -357,7 +363,6 @@ proceed:
viewer = where+strlen(KEY);\
continue;\
}
- #define SYNCTEX_MAX(A,B) ({ __typeof__(A) __a = (A); __typeof__(B) __b = (B); __a < __b ? __b : __a; })
TEST("&{output}","%s",synctex_scanner_get_output(scanner));
TEST("&{page}", "%i",synctex_node_page(node)-1);
TEST("&{page+1}","%i",synctex_node_page(node));
@@ -365,8 +370,8 @@ proceed:
TEST("&{y}", "%f",synctex_node_visible_v(node));
TEST("&{h}", "%f",synctex_node_box_visible_h(node));
TEST("&{v}", "%f",synctex_node_box_visible_v(node)+synctex_node_box_visible_depth(node));
- TEST("&{width}", "%f",fabsf(synctex_node_box_visible_width(node)));
- TEST("&{height}","%f",SYNCTEX_MAX((synctex_node_box_visible_height(node)+synctex_node_box_visible_depth(node)),1));
+ TEST("&{width}", "%f",fabs(synctex_node_box_visible_width(node)));
+ TEST("&{height}","%f",fmax(synctex_node_box_visible_height(node)+synctex_node_box_visible_depth(node),1));
TEST("&{before}","%s",(before && strlen(before)<SYNCTEX_STR_SIZE?before:""));
TEST("&{offset}","%i",offset);
TEST("&{middle}","%s",(middle && strlen(middle)<SYNCTEX_STR_SIZE?middle:""));
@@ -379,7 +384,7 @@ proceed:
synctex_help_view("Memory copy problem");
free(buffer);
return -1;
- }\
+ }
printf("SyncTeX: Executing\n%s\n",buffer);
status = system(buffer);
free(buffer);
diff --git a/Build/source/texk/web2c/synctex/synctex_parser.c b/Build/source/texk/web2c/synctex/synctex_parser.c
index 57717ca7279..187c13d25cb 100644
--- a/Build/source/texk/web2c/synctex/synctex_parser.c
+++ b/Build/source/texk/web2c/synctex/synctex_parser.c
@@ -33,6 +33,8 @@ authorization from the copyright holder.
*/
+#include "web2c/c-auto.h" /* for inline && HAVE_xxx */
+
#include "stddef.h"
#include "stdio.h"
#include "stdlib.h"
@@ -43,7 +45,7 @@ authorization from the copyright holder.
#include "errno.h"
#ifdef HAVE_LOCALE_H
-#include "locale.h"
+#include <locale.h>
#endif
/* This custom malloc functions initializes to 0 the newly allocated memory. */
@@ -3031,7 +3033,7 @@ we_are_done:
do {
switch((node->class)->type) {
default:
- candidate = fabsf(synctex_node_visible_h(node)-h);
+ candidate = fabs(synctex_node_visible_h(node)-h);
if(candidate<best) {
best = candidate;
best_node = node;