Index: Build/source/texk/web2c/mplibdir/mp.w =================================================================== --- Build/source/texk/web2c/mplibdir/mp.w (revision 30927) +++ Build/source/texk/web2c/mplibdir/mp.w (revision 30928) @@ -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 @@ @^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 @= -#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 @@ /* 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 @@ @ @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 @@ 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 (beta, arg1); + take_fraction (denom, gamma, alpha); + set_number_from_div (arg1, ff, twelvebits_3); + number_add (denom, arg1); } - number_clone (n1, denom); - number_double (n1); - number_double (n1); /* n1 = 4*denom */ - if (number_greaterequal(num, n1)) { + 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 @@ free_number (num); free_number (denom); free_number (ff); - free_number (n1); + free_number (arg1); } Index: Build/source/texk/web2c/mplibdir/mpmathdouble.w =================================================================== --- Build/source/texk/web2c/mplibdir/mpmathdouble.w (revision 30927) +++ Build/source/texk/web2c/mplibdir/mpmathdouble.w (revision 30928) @@ -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 #include #include #include #include #include "mpmathdouble.h" /* internal header */ +#define ROUND(a) floor((a)+0.5) @h @ @c @@ -402,11 +402,7 @@ } 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 @@ @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 @@ 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 @@ @ |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; } Index: Build/source/texk/web2c/mplibdir/ChangeLog =================================================================== --- Build/source/texk/web2c/mplibdir/ChangeLog (revision 30927) +++ Build/source/texk/web2c/mplibdir/ChangeLog (revision 30928) @@ -1,3 +1,7 @@ +2013-06-16 Taco Hoekwater + + Import metapost 1.803 (released version) + 2013-05-22 Taco Hoekwater * svgout.w: fix a problem with overly large characters in Index: Build/source/texk/web2c/mplibdir/mpost.w =================================================================== --- Build/source/texk/web2c/mplibdir/mpost.w (revision 30927) +++ Build/source/texk/web2c/mplibdir/mpost.w (revision 30928) @@ -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 @@ mpost_xfree(mpversion); } } - + mpost_xfree (cnf_cmd); return (int)(ret == 0); } @@ -1290,6 +1290,17 @@ @ 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 @@ 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) {