summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTaco Hoekwater <taco@elvenkind.com>2013-06-16 15:56:16 +0000
committerTaco Hoekwater <taco@elvenkind.com>2013-06-16 15:56:16 +0000
commit38aedc4064c290616681545603cc445a0f2137c9 (patch)
tree1d85f68e3466a04963b5e8a073635a4b0ed87c1e
parente113e3c4cdeb7ff73ac9928a2032d5fef804a2bd (diff)
new metapost release (1.803) source files
git-svn-id: svn://tug.org/texlive/trunk@30833 c570f23f-e606-0410-a88d-b1316a301751
-rw-r--r--Build/source/texk/web2c/mplibdir/ChangeLog4
-rw-r--r--Build/source/texk/web2c/mplibdir/mp.w62
-rw-r--r--Build/source/texk/web2c/mplibdir/mpmathdouble.w16
-rw-r--r--Build/source/texk/web2c/mplibdir/mpost.w19
4 files changed, 48 insertions, 53 deletions
diff --git a/Build/source/texk/web2c/mplibdir/ChangeLog b/Build/source/texk/web2c/mplibdir/ChangeLog
index 1672e16bdc7..27734b2f8c9 100644
--- a/Build/source/texk/web2c/mplibdir/ChangeLog
+++ b/Build/source/texk/web2c/mplibdir/ChangeLog
@@ -1,3 +1,7 @@
+2013-06-16 Taco Hoekwater <taco@luatex.org>
+
+ Import metapost 1.803 (released version)
+
2013-05-22 Taco Hoekwater <taco@luatex.org>
* svgout.w: fix a problem with overly large characters in
diff --git a/Build/source/texk/web2c/mplibdir/mp.w b/Build/source/texk/web2c/mplibdir/mp.w
index 3d64ed40957..c35f547a1a2 100644
--- a/Build/source/texk/web2c/mplibdir/mp.w
+++ b/Build/source/texk/web2c/mplibdir/mp.w
@@ -1,4 +1,4 @@
-% $Id: mp.w 1901 2013-05-22 14:42:19Z taco $
+% $Id: mp.w 1918 2013-06-13 12:47:55Z taco $
%
% This file is part of MetaPost;
% the MetaPost program is in the public domain.
@@ -73,12 +73,12 @@ undergoes any modifications, so that it will be clear which version of
@^extensions to \MP@>
@^system dependencies@>
-@d default_banner "This is MetaPost, Version 1.802" /* printed when \MP\ starts */
+@d default_banner "This is MetaPost, Version 1.803" /* printed when \MP\ starts */
@d true 1
@d false 0
@<Metapost version header@>=
-#define metapost_version "1.802"
+#define metapost_version "1.803"
@ The external library header for \MP\ is |mplib.h|. It contains a
few typedefs and the header defintions for the externally used
@@ -516,8 +516,8 @@ MP mp_initialize (MP_options * opt) {
/* open the terminal for output */
t_open_out();
#if DEBUG
- setlinebuf(stdout);
- setlinebuf(mp->term_out);
+ setvbuf(stdout, (char *) NULL, _IONBF, 0);
+ setvbuf(mp->term_out, (char *) NULL, _IONBF, 0);
#endif
if (opt->math_mode == mp_math_scaled_mode) {
mp->math = mp_initialize_scaled_math(mp);
@@ -8330,8 +8330,8 @@ static void mp_curl_ratio (MP mp, mp_number *ret, mp_number gamma, mp_number a_t
@ @c
void mp_curl_ratio (MP mp, mp_number *ret, mp_number gamma_orig, mp_number a_tension, mp_number b_tension) {
mp_number alpha, beta, gamma, num, denom, ff; /* registers */
- mp_number n1;
- new_number (n1);
+ mp_number arg1;
+ new_number (arg1);
new_fraction (alpha);
new_fraction (beta);
new_fraction (gamma);
@@ -8342,49 +8342,33 @@ void mp_curl_ratio (MP mp, mp_number *ret, mp_number gamma_orig, mp_number a_ten
make_fraction (beta, unity_t, b_tension);
number_clone (gamma, gamma_orig);
if (number_lessequal(alpha, beta)) {
- mp_number arg1;
- new_number (arg1);
make_fraction (ff, alpha, beta);
number_clone (arg1, ff);
take_fraction (ff, arg1, arg1);
number_clone (arg1, gamma);
take_fraction (gamma, arg1, ff);
convert_fraction_to_scaled (beta);
- set_number_from_addition (arg1, alpha, three_t);
- number_substract (arg1, beta);
- take_fraction (denom, gamma, arg1);
- set_number_from_substraction (arg1, fraction_three_t, alpha);
- number_add (arg1, beta);
- take_fraction (num, gamma, arg1);
- free_number (arg1);
+ take_fraction (denom, gamma, alpha);
+ number_add (denom, three_t);
} else {
- mp_number arg1, r1;
- new_number (arg1);
- new_number (r1);
make_fraction (ff, beta, alpha);
number_clone (arg1, ff);
take_fraction (ff, arg1, arg1);
take_fraction (arg1, beta, ff);
convert_fraction_to_scaled (arg1);
- number_clone (beta, arg1);
- take_fraction (arg1, gamma, alpha);
- new_number (denom);
- {
- set_number_from_div (n1, ff, twelvebits_3);
- number_clone (denom, arg1);
- number_add (denom, n1);
- number_substract (denom, beta);
- }
- set_number_from_substraction (arg1, fraction_three_t, alpha);
- take_fraction (num, gamma, arg1);
- number_add (num, beta);
- free_number (arg1);
- free_number (r1);
- }
- number_clone (n1, denom);
- number_double (n1);
- number_double (n1); /* n1 = 4*denom */
- if (number_greaterequal(num, n1)) {
+ number_clone (beta, arg1);
+ take_fraction (denom, gamma, alpha);
+ set_number_from_div (arg1, ff, twelvebits_3);
+ number_add (denom, arg1);
+ }
+ number_substract (denom, beta);
+ set_number_from_substraction (arg1, fraction_three_t, alpha);
+ take_fraction (num, gamma, arg1);
+ number_add (num, beta);
+ number_clone (arg1, denom);
+ number_double (arg1);
+ number_double (arg1); /* arg1 = 4*denom */
+ if (number_greaterequal(num, arg1)) {
number_clone(*ret, fraction_four_t);
} else {
make_fraction (*ret, num, denom);
@@ -8395,7 +8379,7 @@ void mp_curl_ratio (MP mp, mp_number *ret, mp_number gamma_orig, mp_number a_ten
free_number (num);
free_number (denom);
free_number (ff);
- free_number (n1);
+ free_number (arg1);
}
diff --git a/Build/source/texk/web2c/mplibdir/mpmathdouble.w b/Build/source/texk/web2c/mplibdir/mpmathdouble.w
index 577c0b76263..41e4b7aa191 100644
--- a/Build/source/texk/web2c/mplibdir/mpmathdouble.w
+++ b/Build/source/texk/web2c/mplibdir/mpmathdouble.w
@@ -1,4 +1,4 @@
-% $Id: mpmathdouble.w 1892 2013-03-22 10:21:05Z taco $
+% $Id: mpmathdouble.w 1915 2013-06-13 10:17:31Z taco $
%
% This file is part of MetaPost;
% the MetaPost program is in the public domain.
@@ -17,13 +17,13 @@
@ Introduction.
@c
-#define _ISOC99_SOURCE /* to get the round() prototype */
#include <w2c/config.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include "mpmathdouble.h" /* internal header */
+#define ROUND(a) floor((a)+0.5)
@h
@ @c
@@ -402,11 +402,7 @@ void mp_number_fraction_to_scaled (mp_number *A) {
}
void mp_number_angle_to_scaled (mp_number *A) {
A->type = mp_scaled_type;
- if (A->data.dval >= 0) {
- A->data.dval = round(A->data.dval) / angle_multiplier;
- } else {
- A->data.dval = -((-round(A->data.dval))/ angle_multiplier);
- }
+ A->data.dval = ROUND(A->data.dval) / angle_multiplier;
}
void mp_number_scaled_to_fraction (mp_number *A) {
A->type = mp_fraction_type;
@@ -422,7 +418,7 @@ void mp_number_scaled_to_angle (mp_number *A) {
@c
int mp_number_to_scaled(mp_number A) {
- return (int)round(A.data.dval * 65536.0);
+ return (int)ROUND(A.data.dval * 65536.0);
}
int mp_number_to_int(mp_number A) {
return (int)(A.data.dval);
@@ -434,7 +430,7 @@ double mp_number_to_double(mp_number A) {
return A.data.dval;
}
int mp_number_odd(mp_number A) {
- return odd((int)round(A.data.dval * 65536.0));
+ return odd((int)ROUND(A.data.dval * 65536.0));
}
int mp_number_equal(mp_number A, mp_number B) {
return (A.data.dval==B.data.dval);
@@ -962,7 +958,7 @@ and truncation operations.
@ |round_unscaled| rounds a |scaled| and converts it to |int|
@c
int mp_round_unscaled(mp_number x_orig) {
- int x = (int)round(x_orig.data.dval);
+ int x = (int)ROUND(x_orig.data.dval);
return x;
}
diff --git a/Build/source/texk/web2c/mplibdir/mpost.w b/Build/source/texk/web2c/mplibdir/mpost.w
index 9d7096c6f4a..ae572e8bd41 100644
--- a/Build/source/texk/web2c/mplibdir/mpost.w
+++ b/Build/source/texk/web2c/mplibdir/mpost.w
@@ -1,4 +1,4 @@
-% $Id: mpost.w 1895 2013-03-27 11:17:17Z taco $
+% $Id: mpost.w 1916 2013-06-13 10:19:49Z taco $
%
% This file is part of MetaPost;
% the MetaPost program is in the public domain.
@@ -443,7 +443,7 @@ static int mpost_run_make_mpx (MP mp, char *mpname, char *mpxname) {
mpost_xfree(mpversion);
}
}
-
+
mpost_xfree (cnf_cmd);
return (int)(ret == 0);
}
@@ -1290,6 +1290,17 @@ extern __declspec(dllexport) int DLLPROC (int argc, char **argv);
@ Now this is really it: \MP\ starts and ends here.
@c
+static char *cleaned_invocation_name(char *arg)
+{
+ char *ret, *dot;
+ const char *start = xbasename(arg);
+ ret = xstrdup(start);
+ dot = strrchr(ret, '.');
+ if (dot != NULL) {
+ *dot = 0; /* chop */
+ }
+ return ret;
+}
int
#if defined(WIN32) && !defined(__MINGW32__) && defined(DLLPROC)
DLLPROC (int argc, char **argv)
@@ -1306,8 +1317,8 @@ main (int argc, char **argv)
options->ini_version = (int)false;
options->print_found_names = (int)true;
{
- const char *base = xbasename(argv[0]);
- if (!strcmp(base, "dvitomp") || !strcasecmp(base, "dvitomp.exe"))
+ const char *base = cleaned_invocation_name(argv[0]);
+ if (FILESTRCASEEQ(base, "dvitomp"))
dvitomp_only=1;
}
if (dvitomp_only) {