diff options
author | Taco Hoekwater <taco@elvenkind.com> | 2009-07-31 10:01:12 +0000 |
---|---|---|
committer | Taco Hoekwater <taco@elvenkind.com> | 2009-07-31 10:01:12 +0000 |
commit | a01b30bda9effbf5b44c699ab49482e56a41038e (patch) | |
tree | facd07baab4e45c06c836dd926d7fc3aa6e2c1b1 /Build | |
parent | 03c92bbe61083ce86555a61af2cd0f7132847e29 (diff) |
the source of metapost 1.206
git-svn-id: svn://tug.org/texlive/trunk@14501 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build')
-rw-r--r-- | Build/source/texk/web2c/mplibdir/ChangeLog | 4 | ||||
-rw-r--r-- | Build/source/texk/web2c/mplibdir/mp.w | 27 |
2 files changed, 26 insertions, 5 deletions
diff --git a/Build/source/texk/web2c/mplibdir/ChangeLog b/Build/source/texk/web2c/mplibdir/ChangeLog index c3874ccc5f1..85111088747 100644 --- a/Build/source/texk/web2c/mplibdir/ChangeLog +++ b/Build/source/texk/web2c/mplibdir/ChangeLog @@ -1,3 +1,7 @@ +2009-07-31 Taco Hoekwater <taco@elvenkind.com> + + * Released version of MPLib 1.206 + 2009-07-20 Taco Hoekwater <taco@elvenkind.com> * mp.w: hotfix for a possible crash in lib mode diff --git a/Build/source/texk/web2c/mplibdir/mp.w b/Build/source/texk/web2c/mplibdir/mp.w index 81ddedfdb49..24e0e1ee4b1 100644 --- a/Build/source/texk/web2c/mplibdir/mp.w +++ b/Build/source/texk/web2c/mplibdir/mp.w @@ -1,4 +1,4 @@ - $Id: mp.w 1105 2009-07-18 09:15:07Z taco $ + $Id: mp.w 1111 2009-07-31 08:10:35Z taco $ % % Copyright 2008-2009 Taco Hoekwater. % @@ -89,13 +89,13 @@ 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.205" /* printed when \MP\ starts */ +@d default_banner "This is MetaPost, Version 1.206" /* printed when \MP\ starts */ @d true 1 @d false 0 @(mpmp.h@>= -#define metapost_version "1.205" -#define metapost_magic (('M'*256) + 'P')*65536 + 1205 +#define metapost_version "1.206" +#define metapost_magic (('M'*256) + 'P')*65536 + 1206 #define metapost_old_magic (('M'*256) + 'P')*65536 + 1080 @ The external library header for \MP\ is |mplib.h|. It contains a @@ -1828,14 +1828,31 @@ void mp_print (MP mp, const char *ss) { if (ss==NULL) return; mp_do_print(mp, ss,strlen(ss)); } + +@ This function is somewhat less trivial than expected +because it is not safe to directly print data in the +string pool since |mp_do_print()| can potentially reallocate +the whole lot. + +@<Basic print...@>= void mp_print_str (MP mp, str_number s) { pool_pointer j; /* current character code position */ + char *ss; /* a temporary C string */ + size_t len; /* its length */ if ( (s<0)||(s>mp->max_str_ptr) ) { mp_do_print(mp,"???",3); /* this can't happen */ @.???@> } j=mp->str_start[s]; - mp_do_print(mp, (char *)(mp->str_pool+j), (size_t)(str_stop(s)-j)); + len = (str_stop(s)-j); + ss = xmalloc(len+1, sizeof(char)); + if (len > 0) { + /* the man page doesnt say whether 0 is allowed */ + memcpy(ss,(char *)(mp->str_pool+j),len); + } + ss[len] = '\0'; + mp_do_print(mp, ss, len); + mp_xfree(ss); } |