From 69f95dbc06d3ed17fd8fb685a890be5593786a06 Mon Sep 17 00:00:00 2001 From: Taco Hoekwater Date: Wed, 23 Apr 2014 07:11:49 +0000 Subject: metapost 1.902, fixing a crash git-svn-id: svn://tug.org/texlive/trunk@33637 c570f23f-e606-0410-a88d-b1316a301751 --- Build/source/texk/web2c/mplibdir/ChangeLog | 4 +++ Build/source/texk/web2c/mplibdir/mp.w | 6 ++-- Build/source/texk/web2c/mplibdir/psout.w | 50 +++++++++--------------------- 3 files changed, 22 insertions(+), 38 deletions(-) (limited to 'Build') diff --git a/Build/source/texk/web2c/mplibdir/ChangeLog b/Build/source/texk/web2c/mplibdir/ChangeLog index 9a164988904..83d7ee90aa2 100644 --- a/Build/source/texk/web2c/mplibdir/ChangeLog +++ b/Build/source/texk/web2c/mplibdir/ChangeLog @@ -1,3 +1,7 @@ +2014-04-23 Taco Hoekwater + + Import metapost 1.902 + 2014-04-09 Taco Hoekwater Import metapost 1.901 diff --git a/Build/source/texk/web2c/mplibdir/mp.w b/Build/source/texk/web2c/mplibdir/mp.w index d9a0158e459..3ac2bdff0c4 100644 --- a/Build/source/texk/web2c/mplibdir/mp.w +++ b/Build/source/texk/web2c/mplibdir/mp.w @@ -1,4 +1,4 @@ -% $Id: mp.w 1997 2014-04-09 07:36:31Z taco $ +% $Id: mp.w 2009 2014-04-23 07:09:51Z 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.901" /* printed when \MP\ starts */ +@d default_banner "This is MetaPost, Version 1.902" /* printed when \MP\ starts */ @d true 1 @d false 0 @= -#define metapost_version "1.901" +#define metapost_version "1.902" @ The external library header for \MP\ is |mplib.h|. It contains a few typedefs and the header defintions for the externally used diff --git a/Build/source/texk/web2c/mplibdir/psout.w b/Build/source/texk/web2c/mplibdir/psout.w index 7728a675c8f..9ed61aac1b4 100644 --- a/Build/source/texk/web2c/mplibdir/psout.w +++ b/Build/source/texk/web2c/mplibdir/psout.w @@ -1,4 +1,4 @@ -% $Id: psout.w 1996 2014-04-09 07:23:33Z taco $ +% $Id: psout.w 2009 2014-04-23 07:09:51Z taco $ % This file is part of MetaPost; % the MetaPost program is in the public domain. % See the code in mpost.w for more info. @@ -5648,21 +5648,13 @@ if ( (gr_right_x(pp)==gr_x_coord(pp)) && (gr_left_y(pp)==gr_y_coord(pp)) ) { wx = fabs(gr_left_x(pp) - gr_x_coord(pp)); wy = fabs(gr_right_y(pp) - gr_y_coord(pp)); } else { - mp_number arg1, arg2, ret; - new_number(ret); - new_number(arg1); - new_number(arg2); - mp_set_number_from_double (&arg1, gr_left_x(pp)-gr_x_coord(pp)); - mp_set_number_from_double (&arg2, gr_right_x(pp)-gr_x_coord(pp)); - mp_pyth_add(mp, &ret, arg1, arg2); - wx = mp_number_to_double(ret); - mp_set_number_from_double (&arg1, gr_left_y(pp)-gr_y_coord(pp)); - mp_set_number_from_double (&arg2, gr_right_y(pp)-gr_y_coord(pp)); - mp_pyth_add(mp, &ret, arg1, arg2); - wy = mp_number_to_double(ret); - free_number(ret); - free_number(arg1); - free_number(arg2); + double a, b; + a = gr_left_x(pp)-gr_x_coord(pp); + b = gr_right_x(pp)-gr_x_coord(pp); + wx = sqrt(a*a + b*b); + a = gr_left_y(pp)-gr_y_coord(pp); + b = gr_right_y(pp)-gr_y_coord(pp); + wy = sqrt(a*a + b*b); } @ The path is considered ``essentially horizontal'' if its range of @@ -5977,12 +5969,6 @@ static double mp_gr_choose_scale (MP mp, mp_graphic_object *p) ; /* |p| should point to a text node */ double a,b,c,d,ad,bc; /* temporary values */ double r; - mp_number arg1, arg2, ret, ret1, ret2; - new_number(ret); - new_number(ret1); - new_number(ret2); - new_number(arg1); - new_number(arg2); a=gr_txx_val(p); b=gr_txy_val(p); c=gr_tyx_val(p); @@ -5993,19 +5979,13 @@ static double mp_gr_choose_scale (MP mp, mp_graphic_object *p) ; if ( d<0 ) negate(d); ad=(a-d)/2.0; bc=(b-c)/2.0; - mp_set_number_from_double(&arg1, (d+ad)); - mp_set_number_from_double(&arg2, ad); - mp_pyth_add(mp, &ret1, arg1, arg2); - mp_set_number_from_double(&arg1, (c+bc)); - mp_set_number_from_double(&arg2, bc); - mp_pyth_add(mp, &ret2, arg1, arg2); - mp_pyth_add(mp, &ret, ret1, ret2); - r = mp_number_to_double(ret); - free_number (ret); - free_number (ret1); - free_number (ret2); - free_number (arg1); - free_number (arg2); + a = (d+ad); + b = ad; + d = sqrt(a*a + b*b); + a = (c+bc); + b = bc; + c = sqrt(a*a + b*b); + r = sqrt(c*c + d*d); return r; } -- cgit v1.2.3