diff options
author | Akira Kakuto <kakuto@fuk.kindai.ac.jp> | 2014-01-06 14:44:38 +0000 |
---|---|---|
committer | Akira Kakuto <kakuto@fuk.kindai.ac.jp> | 2014-01-06 14:44:38 +0000 |
commit | c31f47d7025fbd5c796c81a1cb83bac8ca0ebedf (patch) | |
tree | 23af122b5e157684b2af3e2402a1490039daf446 /Build/source/texk/web2c | |
parent | 9f244d9f9a8aff3da16d30dedddba4aa3fa594ea (diff) |
Bug fixes by Taco in MetaPost
git-svn-id: svn://tug.org/texlive/trunk@32592 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build/source/texk/web2c')
-rw-r--r-- | Build/source/texk/web2c/mplibdir/ChangeLog | 4 | ||||
-rw-r--r-- | Build/source/texk/web2c/mplibdir/mp.w | 12 | ||||
-rw-r--r-- | Build/source/texk/web2c/mplibdir/mpmathdouble.w | 6 |
3 files changed, 14 insertions, 8 deletions
diff --git a/Build/source/texk/web2c/mplibdir/ChangeLog b/Build/source/texk/web2c/mplibdir/ChangeLog index 2269aff5da1..79fd8b4324f 100644 --- a/Build/source/texk/web2c/mplibdir/ChangeLog +++ b/Build/source/texk/web2c/mplibdir/ChangeLog @@ -1,3 +1,7 @@ +2014-01-06 Akira Kakuto <kakuto@fuk.kindai.ac.jp> + + * mp.w, mpmathdouble.w: Bug fixes by Taco, imported from MetaPost trunk. + 2013-09-23 Akira Kakuto <kakuto@fuk.kindai.ac.jp> * mp.w: A bug is fixed by Taco. diff --git a/Build/source/texk/web2c/mplibdir/mp.w b/Build/source/texk/web2c/mplibdir/mp.w index fa13715619d..ebd6897e38d 100644 --- a/Build/source/texk/web2c/mplibdir/mp.w +++ b/Build/source/texk/web2c/mplibdir/mp.w @@ -1,4 +1,4 @@ -% $Id: mp.w 1924 2013-09-20 15:02:58Z taco $ +% $Id: mp.w 1928 2013-12-16 09:08:23Z taco $ % % This file is part of MetaPost; % the MetaPost program is in the public domain. @@ -309,6 +309,7 @@ typedef enum { mp_decimal_type } mp_number_type; typedef union { + void *num; double dval; int val; } mp_number_store; @@ -20784,9 +20785,10 @@ boolean mp_open_mem_name (MP mp) { s = xrealloc (s, l + 5, 1); strcat (s, ".mp"); } + s = (mp->find_file) (mp, s, "r", mp_filetype_program); + xfree(mp->name_of_file); + mp->name_of_file = xstrdup(s); mp->mem_file = (mp->open_file) (mp, s, "r", mp_filetype_program); - xfree (mp->name_of_file); - mp->name_of_file = xstrdup (s); free (s); if (mp->mem_file) return true; @@ -30066,7 +30068,7 @@ void mp_do_new_internal (MP mp) { set_equiv (cur_sym(), mp->int_ptr); if (internal_name (mp->int_ptr) != NULL) xfree (internal_name (mp->int_ptr)); - set_internal_name (mp->int_ptr, + set_internal_name (mp->int_ptr, mp_xstrdup (mp, mp_str (mp, text (cur_sym())))); if (the_type == mp_string_type) { set_internal_string (mp->int_ptr, mp_rts(mp,"")); @@ -33905,7 +33907,7 @@ struct mp_edge_object *mp_gr_export (MP mp, mp_edge_header_node h) { { mp_text_node p0 = (mp_text_node)p; tt = (mp_text_object *) hq; - gr_text_p (tt) = mp_xstrdup (mp, mp_str (mp, mp_text_p (p))); + gr_text_p (tt) = mp_xstrldup (mp, mp_str (mp, mp_text_p (p)),mp_text_p (p)->len); gr_text_l (tt) = (size_t) mp_text_p (p)->len; gr_font_n (tt) = (unsigned int) mp_font_n (p); gr_font_name (tt) = mp_xstrdup (mp, mp->font_name[mp_font_n (p)]); diff --git a/Build/source/texk/web2c/mplibdir/mpmathdouble.w b/Build/source/texk/web2c/mplibdir/mpmathdouble.w index 41e4b7aa191..acff5ce8401 100644 --- a/Build/source/texk/web2c/mplibdir/mpmathdouble.w +++ b/Build/source/texk/web2c/mplibdir/mpmathdouble.w @@ -1,4 +1,4 @@ -% $Id: mpmathdouble.w 1915 2013-06-13 10:17:31Z taco $ +% $Id: mpmathdouble.w 1929 2014-01-02 09:53:51Z taco $ % % This file is part of MetaPost; % the MetaPost program is in the public domain. @@ -402,7 +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; - A->data.dval = ROUND(A->data.dval) / angle_multiplier; + A->data.dval = A->data.dval / angle_multiplier; } void mp_number_scaled_to_fraction (mp_number *A) { A->type = mp_fraction_type; @@ -481,7 +481,7 @@ char * mp_double_number_tostring (MP mp, mp_number n) { static char set[64]; int l = 0; char *ret = mp_xmalloc(mp, 64, 1); - snprintf(set, 64, "%32.16g", n.data.dval); + snprintf(set, 64, "%32.15g", n.data.dval); /* 16 is too much */ while (set[l] == ' ') l++; strcpy(ret, set+l); return ret; |