summaryrefslogtreecommitdiff
path: root/Build/source/texk/web2c
diff options
context:
space:
mode:
authorTaco Hoekwater <taco@elvenkind.com>2009-06-03 08:30:33 +0000
committerTaco Hoekwater <taco@elvenkind.com>2009-06-03 08:30:33 +0000
commitcfd31fe0d15b872cbd26a3c1c3e2b8747404a559 (patch)
treea0e759c177d7c0fb4582d37824859fe78da60133 /Build/source/texk/web2c
parent01ce7562594ab160acc272728ff69e2cb5818099 (diff)
this is the source for metapost 1.202
git-svn-id: svn://tug.org/texlive/trunk@13602 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build/source/texk/web2c')
-rw-r--r--Build/source/texk/web2c/mplibdir/ChangeLog4
-rw-r--r--Build/source/texk/web2c/mplibdir/mp.w78
-rwxr-xr-xBuild/source/texk/web2c/mplibdir/mptrap.test4
-rw-r--r--Build/source/texk/web2c/mplibdir/psout.w3
-rw-r--r--Build/source/texk/web2c/mplibdir/svgout.w12
5 files changed, 66 insertions, 35 deletions
diff --git a/Build/source/texk/web2c/mplibdir/ChangeLog b/Build/source/texk/web2c/mplibdir/ChangeLog
index a52b9ef27fd..29d5ce5b9cc 100644
--- a/Build/source/texk/web2c/mplibdir/ChangeLog
+++ b/Build/source/texk/web2c/mplibdir/ChangeLog
@@ -1,3 +1,7 @@
+2009-06-03 Taco Hoekwater <taco@elvenkind.com>
+
+ * Released version of MPLib 1.202
+
2009-05-30 Peter Breitenlohner <peb@mppmu.mpg.de>
* am/mplib.am (install-exec-hook, uninstall-hook):
diff --git a/Build/source/texk/web2c/mplibdir/mp.w b/Build/source/texk/web2c/mplibdir/mp.w
index cd3e5ee75c0..c493e6af553 100644
--- a/Build/source/texk/web2c/mplibdir/mp.w
+++ b/Build/source/texk/web2c/mplibdir/mp.w
@@ -1,4 +1,4 @@
-% $Id: mp.w 1061 2009-05-27 13:01:37Z taco $
+ $Id: mp.w 1084 2009-06-03 07:40:57Z 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.201" /* printed when \MP\ starts */
+@d default_banner "This is MetaPost, Version 1.202" /* printed when \MP\ starts */
@d true 1
@d false 0
@(mpmp.h@>=
-#define metapost_version "1.201"
-#define metapost_magic (('M'*256) + 'P')*65536 + 1201
+#define metapost_version "1.202"
+#define metapost_magic (('M'*256) + 'P')*65536 + 1202
#define metapost_old_magic (('M'*256) + 'P')*65536 + 1080
@ The external library header for \MP\ is |mplib.h|. It contains a
@@ -838,7 +838,7 @@ static void mp_reallocate_buffer(MP mp, size_t l) {
mp_confusion(mp,"buffer size"); /* can't happen (I hope) */
}
buffer = xmalloc((l+1),sizeof(ASCII_code));
- memcpy(buffer,mp->buffer,(mp->buf_size+1));
+ (void)memcpy(buffer,mp->buffer,(mp->buf_size+1));
xfree(mp->buffer);
mp->buffer = buffer ;
mp->buf_size = l;
@@ -876,7 +876,7 @@ static boolean mp_input_ln (MP mp, void *f ) {
mp_reallocate_buffer(mp,(mp->buf_size+(mp->buf_size>>2)));
}
}
- memcpy((mp->buffer+mp->first),s,size);
+ (void)memcpy((mp->buffer+mp->first),s,size);
}
free(s);
return true;
@@ -908,7 +908,7 @@ initialization.
mp->term_in = (mp->open_file)(mp,"terminal", "r", mp_filetype_terminal);
if (mp->command_line!=NULL) {
mp->last = strlen(mp->command_line);
- strncpy((char *)mp->buffer,mp->command_line,mp->last);
+ (void)memcpy((void *)mp->buffer,(void *)mp->command_line,mp->last);
xfree(mp->command_line);
} else {
mp->last = 0;
@@ -1114,7 +1114,7 @@ char * mp_str (MP mp, str_number ss) {
} else {
len = (size_t)length(ss);
s = xmalloc(len+1,sizeof(char));
- strncpy(s,(char *)(mp->str_pool+(mp->str_start[ss])),len);
+ (void)memcpy(s,(char *)(mp->str_pool+(mp->str_start[ss])),len);
s[len] = 0;
return (char *)s;
}
@@ -3153,8 +3153,12 @@ and truncation operations.
@<Internal library declarations@>=
#define mp_floor_scaled(M,i) ((i)&(-65536))
-#define mp_round_unscaled(M,i) (i>0 ? (((i/32768)+1)/2) : (((i/32768)-1)/2))
-#define mp_round_fraction(M,i) (i>0 ? (((i/2048)+1)/2) : (((i/2048)-1)/2))
+
+#define mp_round_unscaled(M,x) (x>=0100000 ? 1+((x-0100000) / 0200000) \
+ : ( x>=-0100000 ? 0 : -(1+((-(x+1)-0100000) / 0200000))))
+
+#define mp_round_fraction(M,x) (x>=2048 ? 1+((x-2048) / 4096) \
+ : ( x>=-2048 ? 0 : -(1+((-(x+1)-2048) / 4096))))
@* \[8] Algebraic and transcendental functions.
@@ -4501,7 +4505,7 @@ void mp_check_mem (MP mp,boolean print_locs ) {
if ( print_locs ) {
@<Print newly busy locations@>;
}
- memcpy(mp->was_free,mp->free, sizeof(char)*(mp->mem_end+1));
+ (void)memcpy(mp->was_free,mp->free, sizeof(char)*(mp->mem_end+1));
mp->was_mem_end=mp->mem_end;
mp->was_lo_max=mp->lo_mem_max;
mp->was_hi_min=mp->hi_mem_min;
@@ -4850,7 +4854,7 @@ static void mp_print_type (MP mp,quarterword t) ;
@ @<Basic printing procedures@>=
void mp_print_type (MP mp,quarterword t) {
switch (t) {
- case mp_vacuous:mp_print(mp, "mp_vacuous"); break;
+ case mp_vacuous:mp_print(mp, "vacuous"); break;
case mp_boolean_type:mp_print(mp, "boolean"); break;
case mp_unknown_boolean:mp_print(mp, "unknown boolean"); break;
case mp_string_type:mp_print(mp, "string"); break;
@@ -8815,6 +8819,8 @@ if ( arc>0 ) {
n = arc / (arc0 - arc);
arc = arc - n*(arc0 - arc);
if ( t_tot > (el_gordo / (n+1)) ) {
+ mp->arith_error = true;
+ check_arith;
return el_gordo;
}
t_tot = (n + 1)*t_tot;
@@ -16190,7 +16196,7 @@ boolean mp_more_name (MP mp, ASCII_code c) {
@d copy_pool_segment(A,B,C) {
A = xmalloc(C+1,sizeof(char));
- strncpy(A,(char *)(mp->str_pool+B),C);
+ (void)memcpy(A,(char *)(mp->str_pool+B),C);
A[C] = 0;}
@c
@@ -16325,7 +16331,9 @@ boolean mp_open_mem_file (MP mp) {
return true;
if (mp_xstrcmp(mp->mem_name, "plain")) {
wake_up_terminal;
- wterm_ln("Sorry, I can\'t find that mem file; will try PLAIN.");
+ wterm_ln("Sorry, I can\'t find the '");
+ wterm(mp->mem_name);
+ wterm("' mem file; will try 'plain'.");
@.Sorry, I can't find...@>
update_terminal;
/* now pull out all the stops: try for the system \.{plain} file */
@@ -16335,7 +16343,7 @@ boolean mp_open_mem_file (MP mp) {
return true;
}
wake_up_terminal;
- wterm_ln("I can\'t find the PLAIN mem file!\n");
+ wterm_ln("I can't find the 'plain' mem file!\n");
@.I can't find PLAIN...@>
@.plain@>
return false;
@@ -17132,7 +17140,7 @@ void mp_print_exp (MP mp,pointer p, quarterword verbosity) {
@ @<Print an abbreviated value of |v| with format depending on |t|@>=
switch (t) {
-case mp_vacuous:mp_print(mp, "mp_vacuous"); break;
+case mp_vacuous:mp_print(mp, "vacuous"); break;
case mp_boolean_type:
if ( v==true_code ) mp_print(mp, "true"); else mp_print(mp, "false");
break;
@@ -19390,7 +19398,7 @@ case black_part:
else mp_bad_unary(mp, c);
break;
case grey_part:
- if ( mp->cur_type==mp_known ) mp->cur_exp=value(c);
+ if ( mp->cur_type==mp_known ) ; /* mp->cur_exp=mp->cur_exp */
else if ( mp->cur_type==mp_picture_type ) {
if pict_color_type(mp_grey_model) mp_take_pict_part(mp, c);
else mp_bad_color_part(mp, c);
@@ -19986,7 +19994,7 @@ static scaled mp_turn_cycles_wrapper (MP mp,pointer c) {
} else {
nval = mp_new_turn_cycles(mp, c);
oval = mp_turn_cycles(mp, c);
- if ( nval!=oval ) {
+ if ( nval!=oval && mp->internal[mp_tracing_choices]>(2*unity)) {
saved_t_o=mp->internal[mp_tracing_online];
mp->internal[mp_tracing_online]=unity;
mp_begin_diagnostic(mp);
@@ -21184,12 +21192,15 @@ since the \ps\ output procedures will try to compensate for the transformation
we are applying to |mp_pen_p(q)|. Since this compensation is based on the square
root of the determinant, |sqdet| is the appropriate factor.
+We pass the mptrap test only if |dash_scale| is not adjusted, nowadays
+(backend is changed?)
+
@<Transform |mp_pen_p(q)|, making sure...@>=
if ( mp_pen_p(q)!=null ) {
sx=mp->tx; sy=mp->ty;
mp->tx=0; mp->ty=0;
mp_do_pen_trans(mp, mp_pen_p(q));
- if ( ((mp_type(q)==mp_stroked_code)&&(mp_dash_p(q)!=null)) )
+ if ( sqdet !=0 && ((mp_type(q)==mp_stroked_code)&&(mp_dash_p(q)!=null)) )
dash_scale(q)=mp_take_scaled(mp, dash_scale(q),sqdet);
if ( ! pen_is_elliptical(mp_pen_p(q)) )
if ( sgndet<0 )
@@ -21406,10 +21417,10 @@ static void mp_cat (MP mp,pointer p) {
}
mp->max_pool_ptr=needed;
}
- memcpy(mp->str_pool+mp->pool_ptr, mp->str_pool+mp->str_start[a],(size_t)k);
+ (void)memcpy(mp->str_pool+mp->pool_ptr, mp->str_pool+mp->str_start[a],(size_t)k);
mp->pool_ptr+=k;
k=length(b);
- memcpy(mp->str_pool+mp->pool_ptr, mp->str_pool+mp->str_start[b],(size_t)k);
+ (void)memcpy(mp->str_pool+mp->pool_ptr, mp->str_pool+mp->str_start[b],(size_t)k);
mp->pool_ptr+=k;
mp->cur_exp=mp_make_string(mp); delete_str_ref(b);
}
@@ -23669,7 +23680,9 @@ else if ( mp->cur_type==mp_cmykcolor_type )
else if ( mp->cur_type==mp_known )
@<Transfer a greyscale from the current expression to object~|cp|@>
else if ( mp->cur_exp==false_code )
- @<Transfer a noncolor from the current expression to object~|cp|@>;
+ @<Transfer a noncolor from the current expression to object~|cp|@>
+else if ( mp->cur_exp==true_code )
+ @<Transfer no color from the current expression to object~|cp|@>;
}
@ @<Transfer a rgbcolor from the current expression to object~|cp|@>=
@@ -23729,6 +23742,16 @@ grey_val(cp)=0;
mp_color_model(cp)=mp_no_model;
}
+@ @<Transfer no color from the current expression to object~|cp|@>=
+{
+cyan_val(cp)=0;
+magenta_val(cp)=0;
+yellow_val(cp)=0;
+black_val(cp)=0;
+grey_val(cp)=0;
+mp_color_model(cp)=mp_uninitialized_model;
+}
+
@ @<Make |cp| a colored object in object list~|p|@>=
{ cp=p;
while ( cp!=null ){
@@ -24955,12 +24978,13 @@ We may need to cancel skips that span more than 127 lig/kern steps.
@ The header could contain ASCII zeroes, so can't use |strdup|.
@<Store a list of header bytes@>=
+j--;
do {
if ( j>=mp->header_size ) {
size_t l = (size_t)(mp->header_size + (mp->header_size/4));
char *t = xmalloc(l,1);
memset(t,0,l);
- memcpy(t,mp->header_byte,(size_t)mp->header_size);
+ (void)memcpy(t,mp->header_byte,(size_t)mp->header_size);
xfree (mp->header_byte);
mp->header_byte = t;
mp->header_size = (int)l;
@@ -25890,7 +25914,11 @@ static char *mp_set_output_file_name (MP mp, integer c) {
mp_append_to_template(mp,f,mp_job_name);
break;
case 'c':
- mp_append_to_template(mp,f,mp_char_code);
+ if (mp->internal[mp_char_code]<0) {
+ mp_print(mp,"ps");
+ } else {
+ mp_append_to_template(mp,f,mp_char_code);
+ }
break;
case 'o':
mp_append_to_template(mp,f,mp_output_format);
@@ -25925,7 +25953,7 @@ static char *mp_set_output_file_name (MP mp, integer c) {
integer h = mp_compute_hash(mp, (char *)(mp->str_pool+frst),l);
pointer p=h+hash_base; /* we start searching here */
char *id = xmalloc(mp, (l+1));
- strncpy(id,(char *)(mp->str_pool+frst),l);
+ (void)memcpy(id,(char *)(mp->str_pool+frst),l);
*(id+l)=0;
while (true) {
if (text(p)>0 && length(text(p))==l &&
diff --git a/Build/source/texk/web2c/mplibdir/mptrap.test b/Build/source/texk/web2c/mplibdir/mptrap.test
index 20bf2cd0d8d..dca656a9615 100755
--- a/Build/source/texk/web2c/mplibdir/mptrap.test
+++ b/Build/source/texk/web2c/mplibdir/mptrap.test
@@ -42,12 +42,10 @@ mv trap.log mptrapin.log || exit 1
diff $testdir/mptrapin.log mptrapin.log
# Must run inimpost or font_name[null_font] is not initialized, leading to diffs.
-./mpost --progname=inimpost --jobname=trap <$testdir/mptrap2.in >mptrap.fot
+./mpost --progname=inimpost --jobname=trap --memname=trap <$testdir/mptrap2.in >mptrap.fot
## Here the test fails, but we just exit or 'make distcheck' would fail
-echo "WARNING: $0 failed"; exit 0
-
mv trap.log mptrap.log || exit 1
mv trap.tfm mptrap.tfm || exit 1
diff $testdir/mptrap.fot mptrap.fot
diff --git a/Build/source/texk/web2c/mplibdir/psout.w b/Build/source/texk/web2c/mplibdir/psout.w
index 9981a81dd0b..a5e0420ca57 100644
--- a/Build/source/texk/web2c/mplibdir/psout.w
+++ b/Build/source/texk/web2c/mplibdir/psout.w
@@ -1,4 +1,4 @@
-% $Id: psout.w 1051 2009-05-25 08:31:54Z taco $
+% $Id: psout.w 1084 2009-06-03 07:40:57Z taco $
%
% Copyright 2008-2009 Taco Hoekwater.
%
@@ -2022,6 +2022,7 @@ static boolean str_suffix (const char *begin_buf, const char *end_buf,
size_t last_ptr_index;
last_ptr_index = (size_t)(mp->ps->T##_ptr - mp->ps->T##_array);
mp->ps->T##_limit *= 2;
+ mp->ps->T##_limit += s;
if ((size_t)(mp->ps->T##_ptr - mp->ps->T##_array + (n)) > mp->ps->T##_limit)
mp->ps->T##_limit = (size_t)(mp->ps->T##_ptr - mp->ps->T##_array + (n));
mp->ps->T##_array = mp_xrealloc(mp,mp->ps->T##_array,mp->ps->T##_limit, sizeof(T##_entry));
diff --git a/Build/source/texk/web2c/mplibdir/svgout.w b/Build/source/texk/web2c/mplibdir/svgout.w
index 948085a44fd..035734da53e 100644
--- a/Build/source/texk/web2c/mplibdir/svgout.w
+++ b/Build/source/texk/web2c/mplibdir/svgout.w
@@ -800,12 +800,11 @@ void mp_svg_print_glyph_defs (MP mp, mp_edge_object *h) {
mp_ps_font *f = NULL;
mp_edge_object *ch;
p = h->body;
- while ( p!=NULL ) {
- l = gr_text_l(p);
+ while ( p!=NULL ) {
if ((gr_type(p) == mp_text_code) &&
(gr_font_n(p)!=null_font) &&
- (l>0) ) {
- char *s = gr_text_p(p);
+ ((l = gr_text_l(p))>0) ) {
+ unsigned char *s = (unsigned char *)gr_text_p(p);
while (l-->0) {
do_mark(gr_font_n(p), *s);
s++;
@@ -899,13 +898,14 @@ static void mp_svg_text_out (MP mp, mp_text_object *p, int prologues) ;
@ @c
void mp_svg_text_out (MP mp, mp_text_object *p, int prologues) {
- char *s, *fname;
+ char *fname;
+ unsigned char *s;
int k; /* a character */
int l; /* string length */
boolean transformed ;
scaled ds; /* design size and scale factor for a text node */
fname = mp->font_ps_name[gr_font_n(p)];
- s = gr_text_p(p);
+ s = (unsigned char *)gr_text_p(p);
l = gr_text_l(p);
transformed=(gr_txx_val(p)!=unity)||(gr_tyy_val(p)!=unity)||
(gr_txy_val(p)!=0)||(gr_tyx_val(p)!=0);