diff options
Diffstat (limited to 'Build/source/texk/web2c')
-rw-r--r-- | Build/source/texk/web2c/dvitomp.ch | 8 | ||||
-rw-r--r-- | Build/source/texk/web2c/dvitomp.web | 2 | ||||
-rw-r--r-- | Build/source/texk/web2c/lib/texmfmp.c | 4 | ||||
-rw-r--r-- | Build/source/texk/web2c/metapost.mk | 22 | ||||
-rw-r--r-- | Build/source/texk/web2c/mp.web | 204 | ||||
-rw-r--r-- | Build/source/texk/web2c/mpdir/Makefile.in | 4 | ||||
-rw-r--r-- | Build/source/texk/web2c/mpdir/mp.defines | 2 | ||||
-rw-r--r-- | Build/source/texk/web2c/mpdir/mplib.h | 4 | ||||
-rw-r--r-- | Build/source/texk/web2c/mpdir/turningnumber.c | 113 | ||||
-rw-r--r-- | Build/source/texk/web2c/mpdir/writefont.c | 11 | ||||
-rw-r--r-- | Build/source/texk/web2c/mpware/dmp.c | 4 | ||||
-rw-r--r-- | Build/source/texk/web2c/mpware/makempx.c | 2 | ||||
-rw-r--r-- | Build/source/texk/web2c/mpware/mpto.c | 51 | ||||
-rw-r--r-- | Build/source/texk/web2c/mpware/newer.c | 2 |
14 files changed, 324 insertions, 109 deletions
diff --git a/Build/source/texk/web2c/dvitomp.ch b/Build/source/texk/web2c/dvitomp.ch index c30adbbaeca..ca7eac60830 100644 --- a/Build/source/texk/web2c/dvitomp.ch +++ b/Build/source/texk/web2c/dvitomp.ch @@ -26,12 +26,12 @@ @z @x [1] Duplicate banner line for use in |print_version_and_exit|. -@d banner=='% Written by DVItoMP, Version 0.992' +@d banner=='% Written by DVItoMP, Version 1.002' {the first line of the output file} @y -@d banner=='% Written by DVItoMP, Version 0.992/color' +@d banner=='% Written by DVItoMP, Version 1.002/color' {the first line of the output file} -@d term_banner=='This is DVItoMP, Version 0.992/color' +@d term_banner=='This is DVItoMP, Version 1.002/color' {the same in the usual format, as it would be shown on a terminal} @z @@ -442,7 +442,7 @@ begin usage_help (DVITOMP_HELP, nil); end else if argument_is ('version') then begin - print_version_and_exit (term_banner, 'AT&T Bell Laboraties', 'John Hobby.', nil); + print_version_and_exit (term_banner, 'AT&T Bell Laboraties', 'John Hobby.'); end; {Else it was a flag; |getopt| has already done the assignment.} until getopt_return_val = -1; diff --git a/Build/source/texk/web2c/dvitomp.web b/Build/source/texk/web2c/dvitomp.web index 01c76c6b72a..85b4dfc732c 100644 --- a/Build/source/texk/web2c/dvitomp.web +++ b/Build/source/texk/web2c/dvitomp.web @@ -65,7 +65,7 @@ an ``\.{MPX}'' file. The |banner| string defined here should be changed whenever \.{DVItoMP} gets modified. -@d banner=='% Written by DVItoMP, Version 0.992' +@d banner=='% Written by DVItoMP, Version 1.002' {the first line of the output file} @ This program is written in standard \PASCAL, except where it is necessary diff --git a/Build/source/texk/web2c/lib/texmfmp.c b/Build/source/texk/web2c/lib/texmfmp.c index 8a2cc4896d9..b33882f7c5a 100644 --- a/Build/source/texk/web2c/lib/texmfmp.c +++ b/Build/source/texk/web2c/lib/texmfmp.c @@ -88,9 +88,9 @@ #define edit_var "MFEDIT" #endif /* MF */ #ifdef MP -#define BANNER "This is MetaPost, Version 0.993" +#define BANNER "This is MetaPost, Version 1.002" #define COPYRIGHT_HOLDER "AT&T Bell Laboratories" -#define AUTHOR "John Hobby" +#define AUTHOR "John Hobby.\nCurrent maintainer of MetaPost: Taco Hoekwater" #define PROGRAM_HELP MPHELP #define BUG_ADDRESS "tex-k@mail.tug.org" #define DUMP_VAR MPmemdefault diff --git a/Build/source/texk/web2c/metapost.mk b/Build/source/texk/web2c/metapost.mk index 0f3b9f164f1..da28a13ca49 100644 --- a/Build/source/texk/web2c/metapost.mk +++ b/Build/source/texk/web2c/metapost.mk @@ -1,5 +1,5 @@ # Makefile fragment for MetaPost. -# $Id: metapost.mk,v 1.2 2005/07/25 10:03:53 olaf Exp $ +# $Id: metapost.mk,v 1.15 2005/07/04 07:51:41 taco Exp $ # # Public domain. # @@ -20,21 +20,19 @@ mpware_sources = mpware/dmp.c mpware/makempx.in mpware/mpto.c mpware/newer.c mp_c = mpini.c mp0.c mp1.c mp2.c mp_o = mpini.o mp0.o mp1.o mp2.o mpextra.o loadpool.o -# this will break cross-compiles, but i dont know how to fix. -# -- Taco loadpool.c: mp.pool $(mpostdir)/makecpool - ./$(mpostdir)/makecpool mp.pool mpdir/mplib.h > loadpool.c - + $(native)/$(mpostdir)/makecpool mp.pool mpdir/mplib.h > loadpool.c +# mpostlibsdep also includes makecpool mpost: $(mp_o) $(mpostlibsdep) $(kpathsea_link) $(mp_o) $(mpostlibs) $(LOADLIBES) -$(mp_c) mpcoerce.h mpd.h: mp.p $(web2c_texmf) $(srcdir)/$(mpostdir)/mp.defines web2c/cvtmf1.sed web2c/cvtmf2.sed +$(mp_c) mpcoerce.h mpd.h: mp.p $(web2c_texmf) $(srcdir)/$(mpostdir)/mp.defines web2c/cvtmf1.sed web2c/cvtmf2.sed $(web2c) mp mpextra.c: lib/texmfmp.c sed s/TEX-OR-MF-OR-MP/mp/ $(srcdir)/lib/texmfmp.c >$@ -mp.p mp.pool: tangle mp.web mp.ch - $(tangle) mp.web mp.ch +mp.p mp.pool: tie tangle mp.web mp.ch + $(tangle) $(srcdir)/mp.web $(srcdir)/mp.ch check: mpost-check -mpost-check: mptrap mpost.mem $(mpware_programs) +mpost-check: mptrap mpost.mem $(mpware) ./mpost --progname=mpost '&./mpost \tracingstats:=1; end.' TEXMFCNF=../kpathsea \ MAKEMPX_BINDIR=`pwd`:`pwd`/mpware MPXCOMMAND=mpware/makempx \ @@ -96,9 +94,13 @@ mptrap-clean: # mpware # We put mpware (written directly in C) in a subdirectory. +$(mpware): $(mpware_programs) + $(mpware_programs): $(mpware_sources) - cd mpware && $(MAKE) $(common_makeargs) + cd $(mpware) && $(MAKE) $(common_makeargs) install-programs: install-mpware-programs install-mpware-programs: $(mpware_programs) cd $(mpware) && $(MAKE) $(install_makeargs) install-exec + +mp-programs: $(metapost) $(mpware) diff --git a/Build/source/texk/web2c/mp.web b/Build/source/texk/web2c/mp.web index 8f8ef7eb6c8..26dc205e7fa 100644 --- a/Build/source/texk/web2c/mp.web +++ b/Build/source/texk/web2c/mp.web @@ -97,8 +97,8 @@ undergoes any modifications, so that it will be clear which version of @^extensions to \MP@> @^system dependencies@> -@d banner=='This is MetaPost, Version 0.993' {printed when \MP\ starts} -@d metapost_version=="0.993" +@d banner=='This is MetaPost, Version 1.002' {printed when \MP\ starts} +@d metapost_version=="1.002" @ Different \PASCAL s have slightly different conventions, and the present @!@:PASCAL H}{\ph@> @@ -17088,10 +17088,7 @@ if p<>null then found:pict_length:=n; end; -@ The turning number is computed only with respect to a triangular pen whose -@:turning_number_}{\&{turningnumber} primitive@> -vertices are $(0,1)$ and $(\pm{1\over2},0)$. The choice of pen isn't supposed -to matter but rounding error could make a difference if the path has a cusp. +@ Implement |turningnumber| @<Additional cases of unary...@>= turning_op:if cur_type=pair_type then flush_cur_exp(0) @@ -17099,9 +17096,100 @@ turning_op:if cur_type=pair_type then flush_cur_exp(0) else if left_type(cur_exp)=endpoint then flush_cur_exp(0) {not a cyclic path} else begin - flush_cur_exp(turn_cycles(cur_exp)); + flush_cur_exp(turn_cycles_wrapper(cur_exp)); end; +@ The function |an_angle| returns the value of the |angle| primitive, or $0$ if the +argument is |origin|. + +@<Declare unary action...@>= +function an_angle (@!xpar,@!ypar:scaled):angle; +begin + if (not ((xpar=0) and (ypar=0))) then + an_angle := n_arg(xpar,ypar) + else + an_angle := 0; +end; + +@ The actual turning number is (for the moment) computed in a C function +that receives eight integers corresponding to the four controlling points, +and returns a single angle. Besides those, we have to account for discrete +moves at the actual points. + +@d p_nextnext==link(link(p)) +@d p_next==link(p) + +@d seven_twenty_deg==@'5500000000 {$720\cdot2^{20}$, represents $720^\circ$} + +@<Declare unary action...@>= +function new_turn_cycles (@!c:pointer):scaled; +label exit; +var @!res,ang:angle; { the angles of intermediate results } +@!turns:scaled; { the turn counter } +@!p:pointer; { for running around the path } +@!xp,yp:integer; { coordinates of next point } +@!x,y:integer; { helper coordinates } +@!in_angle,out_angle:angle; { helper angles} +@!old_setting:0..max_selector; {saved |selector| setting} +begin +res:=0; +turns:= 0; +p:=c; +old_setting := selector; selector:=term_only; +if internal[tracing_commands]>unity then begin + begin_diagnostic; + print_nl(""); + end_diagnostic(false); +end; +repeat + xp := x_coord(p_next); yp := y_coord(p_next); + ang := bezier_slope(x_coord(p), y_coord(p), right_x(p), right_y(p), + left_x(p_next), left_y(p_next), xp, yp, internal[tracing_commands]); + if ang>seven_twenty_deg then begin + print_err("Strange path"); + error; + new_turn_cycles := 0; + return; + end; + res := res + ang; + if res > one_eighty_deg then begin + res := res - three_sixty_deg; + turns := turns + unity; + end; + if res <= -one_eighty_deg then begin + res := res + three_sixty_deg; + turns := turns - unity; + end; + { incoming angle at next point } + x := left_x(p_next); y := left_y(p_next); + if (xp=x)and(yp=y) then begin x := right_x(p); y := right_y(p); end; + if (xp=x)and(yp=y) then begin x := x_coord(p); y := y_coord(p); end; + in_angle := an_angle(xp - x, yp - y); + { outgoing angle at next point } + x := right_x(p_next); y := right_y(p_next); + if (xp=x)and(yp=y) then begin x := left_x(p_nextnext); y := left_y(p_nextnext); end; + if (xp=x)and(yp=y) then begin x := x_coord(p_nextnext); y := y_coord(p_nextnext); end; + out_angle := an_angle(x - xp, y- yp); + ang := (out_angle - in_angle); + reduce_angle(ang); + if ang<>0 then begin + res := res + ang; + if res >= one_eighty_deg then begin + res := res - three_sixty_deg; + turns := turns + unity; + end; + if res <= -one_eighty_deg then begin + res := res + three_sixty_deg; + turns := turns - unity; + end; + end; + p := link(p); +until p=c; +new_turn_cycles := turns; +exit: +selector:=old_setting; +end; + @ This code is based on Bogus\l{}av Jackowski's |emergency_turningnumber| macro, with some minor changes by Taco @@ -17130,19 +17218,6 @@ the old code was not always correct either, and worse, it sometimes failed for w paths as well. All known bugs that were triggered by the original code no longer occur with this code, and it runs roughly 3 times as fast because the algorithm is much simpler. -@ The macro |Angle()| returns the value of the |angle| primitive, or $0$ if the argument is -|origin|. Converting that calling convention to web code gives the |an_angle| function. - -@<Declare unary action...@>= -function an_angle (@!xpar,@!ypar:scaled):angle; -begin - if (not ((xpar=0) and (ypar=0))) then - an_angle := n_arg(xpar,ypar) - else - an_angle := 0; -end; - - @ It is possible to overflow the return value of the |turn_cycles| function when the path is sufficiently long and winding, but I am not going to bother testing for that. In any case, it would only return @@ -17163,29 +17238,50 @@ var @!res,ang:angle; { the angles of intermediate results } @!turns:scaled; { the turn counter } @!p:pointer; { for running around the path } begin res:=0; turns:= 0; p:=c; -if ((link(p) = p) or (link(link(p)) = p)) then - if an_angle (x_coord(p) - right_x(p), y_coord(p) - right_y(p)) >= 0 then - turn_cycles := unity - else - turn_cycles := -unity -else begin - repeat - ang := an_angle (x_coord(p_to) - x_coord(p_here), y_coord(p_to) - y_coord(p_here)) - - an_angle (x_coord(p_here) - x_coord(p_from), y_coord(p_here) - y_coord(p_from)); - reduce_angle(ang); - res := res + ang; - if res >= three_sixty_deg then begin - res := res - three_sixty_deg; - turns := turns + unity; - end; - if res <= -three_sixty_deg then begin - res := res + three_sixty_deg; - turns := turns - unity; - end; - p := link(p); - until p=c; - turn_cycles := turns; +repeat + ang := an_angle (x_coord(p_to) - x_coord(p_here), y_coord(p_to) - y_coord(p_here)) + - an_angle (x_coord(p_here) - x_coord(p_from), y_coord(p_here) - y_coord(p_from)); + reduce_angle(ang); + res := res + ang; + if res >= three_sixty_deg then begin + res := res - three_sixty_deg; + turns := turns + unity; + end; + if res <= -three_sixty_deg then begin + res := res + three_sixty_deg; + turns := turns - unity; + end; + p := link(p); +until p=c; +turn_cycles := turns; end; + +@ @<Declare unary action...@>= +function turn_cycles_wrapper (@!c:pointer):scaled; + var nval,oval:scaled; + saved_t_o:scaled; {tracing\_online saved } +begin + if (link(c)=c)or(link(link(c))=c) then + if an_angle (x_coord(c) - right_x(c), y_coord(c) - right_y(c)) > 0 then + turn_cycles_wrapper := unity + else + turn_cycles_wrapper := -unity + else begin + nval := new_turn_cycles(c); + oval := turn_cycles(c); + if nval<>oval then begin + saved_t_o:=internal[tracing_online]; + internal[tracing_online]:=unity; + begin_diagnostic; + print_nl ("Warning: the turningnumber algorithms do not agree. The current computed value is "); + print_scaled(nval); + print(", but the 'connect-the-dots' algorithm returned "); + print_scaled(oval); + end_diagnostic(false); + internal[tracing_online]:=saved_t_o; + end; + turn_cycles_wrapper := nval; + end; end; @ @<Declare unary action...@>= @@ -21649,6 +21745,7 @@ This routine issues a warning message if the user has asked for it. procedure lost_warning(@!f:font_number;@!k:pool_pointer); begin if internal[tracing_lost_chars]>0 then begin begin_diagnostic; + if selector=log_only then incr(selector); print_nl("Missing character: There is no "); @.Missing character@> print(so(str_pool[k])); print(" in font "); @@ -21786,8 +21883,7 @@ function new_dummy_font: font_number; begin new_dummy_font := read_font_info("dummy"); end; - -@x +@# function round_xn_over_d(@!x:scaled; @!n,@!d:integer):scaled; var positive:boolean; {was |x>=0|?} @!t,@!u,@!v:nonnegative_integer; {intermediate quantities} @@ -22395,9 +22491,9 @@ begin (gs_colormodel<>cmyk_model) then begin if color_model(p)=uninitialized_model then begin - gs_red:=unity; - gs_green:=unity; - gs_blue:=unity; + gs_red:=0; + gs_green:=0; + gs_blue:=0; gs_black:=unity;@/ end else begin @@ -22649,14 +22745,14 @@ if internal[mpprocset]=0 then begin else begin if fill_also then print_nl("B") else print_ln; if (txy<>0)or(tyx<>0) then - begin {print_ln;} + begin print(" ["); ps_pair_out(txx,tyx); ps_pair_out(txy,tyy);@/ ps_print("0 0] t"); end else if (txx<>unity)or(tyy<>unity) then - begin {print_ln;} + begin ps_pair_out(txx,tyy); print(" s"); end; @@ -22673,7 +22769,7 @@ tyx:=left_y(p);@/ txy:=right_x(p); tyy:=right_y(p); if (x_coord(p)<>0)or(y_coord(p)<>0) then - begin print_ln; print_cmd("gsave ","q "); + begin print_nl(""); print_cmd("gsave ","q "); ps_pair_out(x_coord(p),y_coord(p)); ps_print("translate ");@/ txx:=txx-x_coord(p); @@ -23046,9 +23142,7 @@ end @ @<Print any pending specials@>= t:=link(spec_head); while t<>null do - begin if length(value(t))<=emergency_line_length then print(value(t)) - else overflow("output line length",emergency_line_length); -@:MetaPost capacity exceeded output line length}{\quad output line length@> + begin print(value(t)); print_ln; t:=link(t); end; @@ -23202,7 +23296,7 @@ begin end else begin begin_diagnostic; - {selector:=term_and_log;} + if selector=log_only then incr(selector); print_err("Warning: font "); print(font_name[f]); print(" cannot be found in any fontmapfile!"); @@ -23696,11 +23790,13 @@ if ldf<>null_font then begin end; end; if internal[mpprocset]>0 then begin + print_nl("%%BeginResource: procset mpost"); if (internal[prologues]>0)and(ldf<>null_font) then print("/bd{bind def}bind def/fshow {exch findfont exch scalefont setfont show}bd") else print_nl("/bd{bind def}bind def"); @<Print the procset@>; + print_nl("%%EndResource"); print_ln; end; end diff --git a/Build/source/texk/web2c/mpdir/Makefile.in b/Build/source/texk/web2c/mpdir/Makefile.in index c6abb102f2d..5b1cbc6893c 100644 --- a/Build/source/texk/web2c/mpdir/Makefile.in +++ b/Build/source/texk/web2c/mpdir/Makefile.in @@ -14,7 +14,7 @@ CXX = @CXX@ XCPPFLAGS=-I.. -I$(srcdir)/.. -I../.. -I$(srcdir)/../.. -OBJS = mapfile.o avl.o avlstuff.o utils.o writeenc.o writet1.o writefont.o +OBJS = mapfile.o avl.o avlstuff.o utils.o writeenc.o writet1.o writefont.o turningnumber.o all: libmpost.a makecpool @@ -34,7 +34,7 @@ clean:: depend: rm -f $(OBJS) XXCFLAGS=-MM XCFLAGS=-MM $(MAKE) -k $(OBJS) | \ - grep -v "^$(CC)\|$(CXX)\|$(AR)\|make\|klibtool" | \ + grep -v "^$(CC)\|$(CXX)\|$(AR)\|make" | \ sed 's: [^ ]*/\.\./libs/[^ ]*::g' > $(srcdir)/depend.mk kpse_include mpdir/depend.mk diff --git a/Build/source/texk/web2c/mpdir/mp.defines b/Build/source/texk/web2c/mpdir/mp.defines index 90f196b1ff5..7af554a389a 100644 --- a/Build/source/texk/web2c/mpdir/mp.defines +++ b/Build/source/texk/web2c/mpdir/mp.defines @@ -54,4 +54,4 @@ $Id$ { function from turningnumber.c } -@define function bezierslope();
\ No newline at end of file +@define function bezierslope(); diff --git a/Build/source/texk/web2c/mpdir/mplib.h b/Build/source/texk/web2c/mpdir/mplib.h index 363836a994d..232956dbff7 100644 --- a/Build/source/texk/web2c/mpdir/mplib.h +++ b/Build/source/texk/web2c/mpdir/mplib.h @@ -297,4 +297,8 @@ extern void writezip (boolean); extern void avlputobj (integer, integer); extern integer avlfindobj (integer, integer, integer); +/* turningnumber.c */ + +extern angle bezierslope(integer,integer,integer,integer,integer,integer,integer,integer,int); + #endif /* MPOSTLIB */ diff --git a/Build/source/texk/web2c/mpdir/turningnumber.c b/Build/source/texk/web2c/mpdir/turningnumber.c new file mode 100644 index 00000000000..bfb7d9133d2 --- /dev/null +++ b/Build/source/texk/web2c/mpdir/turningnumber.c @@ -0,0 +1,113 @@ +/* $Id$ */ + +#include "mplib.h" + +#define bezier_error (720<<20)+1 + +#define sign(v) ((v)>0 ? 1 : ((v)<0 ? -1 : 0 )) + +#define print_roots(a) { if (debuglevel>(65536*2)) \ + fprintf(stdout,"bezierslope(): %s, i=%f, o=%f, angle=%f\n", \ + (a),in,out,res); } + +#define out ((double)(xo>>20)) +#define mid ((double)(xm>>20)) +#define in ((double)(xi>>20)) + +#define divisor (256*256) + +#define double2angle(a) (int)floor(a*256.0*256.0*16.0) + +angle +bezierslope(integer AX,integer AY,integer BX,integer BY, + integer CX,integer CY,integer DX,integer DY, int debuglevel) { + double a, b, c; + integer deltax,deltay; + double ax,ay,bx,by,cx,cy,dx,dy; + + angle xi = 0, xo = 0, xm = 0; + double res = 0; + + ax=AX/divisor; ay=AY/divisor; + bx=BX/divisor; by=BY/divisor; + cx=CX/divisor; cy=CY/divisor; + dx=DX/divisor; dy=DY/divisor; + + deltax = (BX-AX); deltay = (BY-AY); + if (deltax==0 && deltay == 0) { deltax=(CX-AX); deltay=(CY-AY); } + if (deltax==0 && deltay == 0) { deltax=(DX-AX); deltay=(DY-AY); } + xi = anangle(deltax,deltay); + + deltax = (CX-BX); deltay = (CY-BY); + xm = anangle(deltax,deltay); + + deltax = (DX-CX); deltay = (DY-CY); + if (deltax==0 && deltay == 0) { deltax=(DX-BX); deltay=(DY-BY); } + if (deltax==0 && deltay == 0) { deltax=(DX-AX); deltay=(DY-AY); } + xo = anangle(deltax,deltay); + + a = (bx-ax)*(cy-by) - (cx-bx)*(by-ay); /* a = (bp-ap)x(cp-bp); */ + b = (bx-ax)*(dy-cy) - (by-ay)*(dx-cx);; /* b = (bp-ap)x(dp-cp);*/ + c = (cx-bx)*(dy-cy) - (dx-cx)*(cy-by); /* c = (cp-bp)x(dp-cp);*/ + + if (debuglevel>(65536*2)) { + fprintf(stdout, + "bezierslope(): (%.2f,%.2f),(%.2f,%.2f),(%.2f,%.2f),(%.2f,%.2f)\n", + ax,ay,bx,by,cx,cy,dx,dy); + fprintf(stdout,"bezierslope(): a,b,c,b^2,4ac: (%.2f,%.2f,%.2f,%.2f,%.2f)\n",a,b,c,b*b,4*a*c); + } + + if ((a==0)&&(c==0)) { + res = (b==0 ? 0 : (out-in)); + print_roots("no roots (a)"); + } else if ((a==0)||(c==0)) { + if ((sign(b) == sign(a)) || (sign(b) == sign(c))) { + res = out-in; /* ? */ + if (res<-180.0) + res += 360.0; + else if (res>180.0) + res -= 360.0; + print_roots("no roots (b)"); + } else { + res = out-in; /* ? */ + print_roots("one root (a)"); + } + } else if ((sign(a)*sign(c))<0) { + res = out-in; /* ? */ + if (res<-180.0) + res += 360.0; + else if (res>180.0) + res -= 360.0; + print_roots("one root (b)"); + } else { + if (sign(a) == sign(b)) { + res = out-in; /* ? */ + if (res<-180.0) + res += 360.0; + else if (res>180.0) + res -= 360.0; + print_roots("no roots (d)"); + } else { + if ((b*b) == (4*a*c)) { + res = bezier_error; + /* print_roots("double root"); *//* cusp */ + } else if ((b*b) < (4*a*c)) { + res = out-in; /* ? */ + if (res<=0.0 &&res>-180.0) + res += 360.0; + else if (res>=0.0 && res<180.0) + res -= 360.0; + print_roots("no roots (e)"); + } else { + res = out-in; + if (res<-180.0) + res += 360.0; + else if (res>180.0) + res -= 360.0; + print_roots("two roots"); /* two inflections */ + } + } + } + return double2angle(res); +} + diff --git a/Build/source/texk/web2c/mpdir/writefont.c b/Build/source/texk/web2c/mpdir/writefont.c index e88b4dbab7d..899b42b54a2 100644 --- a/Build/source/texk/web2c/mpdir/writefont.c +++ b/Build/source/texk/web2c/mpdir/writefont.c @@ -184,17 +184,6 @@ void mpfontencodings (int lastfnum, int encodings_only) { if (encodings_only || (!is_subsetted (fm))) { e = fm->encoding; write_enc (NULL, e, 0); - } - } - } - } - } - for (f=nullfont+1;f<=lastfnum;f++) { - if (fontsizes[f]!=0 && hasfmentry (f)) { - fm = (fm_entry *) mpfontmap[f]; - if (fm != NULL && (fm->ps_name != NULL)) { - if (is_reencoded (fm)) { - if (encodings_only || (!is_subsetted (fm))) { /* clear for next run */ e->objnum = 0; } diff --git a/Build/source/texk/web2c/mpware/dmp.c b/Build/source/texk/web2c/mpware/dmp.c index cf876f8aa91..9d8e4a21cef 100644 --- a/Build/source/texk/web2c/mpware/dmp.c +++ b/Build/source/texk/web2c/mpware/dmp.c @@ -23,8 +23,8 @@ * gets modified. */ -char *banner = "% Written by DMP, Version 0.992"; /* first line of output */ -char *term_banner = "This is DMP, Version 0.992"; +char *banner = "% Written by DMP, Version 1.002"; /* first line of output */ +char *term_banner = "This is DMP, Version 1.002"; #include <stdio.h> #include <stdlib.h> diff --git a/Build/source/texk/web2c/mpware/makempx.c b/Build/source/texk/web2c/mpware/makempx.c index 34eaa6895a5..a04aaacc405 100644 --- a/Build/source/texk/web2c/mpware/makempx.c +++ b/Build/source/texk/web2c/mpware/makempx.c @@ -95,7 +95,7 @@ #define GETCWD getcwd #endif -#define version "0.993" +#define version "1.002" #define ERRLOG "mpxerr.log" #define TEXERR "mpxerr.tex" diff --git a/Build/source/texk/web2c/mpware/mpto.c b/Build/source/texk/web2c/mpware/mpto.c index 27d687493bd..593dc1a43cd 100644 --- a/Build/source/texk/web2c/mpware/mpto.c +++ b/Build/source/texk/web2c/mpware/mpto.c @@ -25,9 +25,7 @@ #include <stdio.h> #include <stdlib.h> -#ifdef WIN32 #include <string.h> -#endif /* MetaPost itself has a configurable max line length, but we can afford to @@ -49,7 +47,7 @@ char *tex_pretex1 = "\\gdef\\mpxshipout{\\shipout\\hbox\\bgroup%\n" " \\ht0=0pt \\dp0=0pt \\box0 \\egroup}\n" "\\mpxshipout%% line %d %s\n"; char *tex_pretex = "\\mpxshipout%% line %d %s\n"; -char *tex_posttex = "\\stopmpxshipout\n"; +char *tex_posttex = "\n\\stopmpxshipout\n"; char *tex_preverb1 = ""; /* if very first instance */ char *tex_preverb = "%% line %d %s\n"; /* all other instances */ char *tex_postverb = "%\n"; @@ -122,7 +120,7 @@ getline(void) /* Return nonzero if a prefix of string s matches the null-terminated string t - * and the next character is not a letter of an underscore. + * and the next character is not a letter or an underscore. */ int match_str(char *s, char *t) @@ -300,23 +298,14 @@ copytex(void) { char *s; /* where a string to print stops */ char c; - - while (*aa == ' ' || *aa == '\t') - aa++; - if (*aa == 0) - if ((aa = getline()) == NULL) - err("btex section does not end"); + char *res = NULL; do { if (*aa == 0) - if ((aa = getline()) == NULL) - err("btex section does not end"); - else - printf("\n"); + if ((aa = getline()) == NULL) + err("btex section does not end"); + if (getbta(aa) && *tt == 'e') { - s = tt - 1; - while (s >= bb && (*s == ' ' || *s == '\t')) - s--; - s++; + s = tt; } else { if (*tt == 'b') err("btex in TeX mode"); @@ -326,9 +315,31 @@ copytex(void) } c = *s; *s = 0; - printf("%s", bb); + if (res==NULL) { + res = malloc(strlen(bb)+2); + if (res==NULL) + err("memory allocation failure"); + res = strncpy(res,bb,(strlen(bb)+1)); + } else { + res = realloc(res,strlen(res)+strlen(bb)+2); + if (res==NULL) + err("memory allocation failure"); + res = strncat(res,bb, strlen(bb)); + } + if (c == '\0') + res = strncat(res, "\n", 1); *s = c; } while (*tt != 'e'); + /* whitespace at the end */ + for (s = res + strlen(res) - 1; + s >= res && (*s == ' ' || *s == '\t' || *s == '\r' || *s == '\n'); s--); + *(++s) = '\0'; + /* whitespace at the start */ + for (s = res; + s < (res + strlen(res)) && (*s == ' ' || *s == '\t' || *s == '\r' + || *s == '\n'); s++); + printf("%s%%",s); + free(res); } @@ -386,7 +397,7 @@ main(int argc, char **argv) exit(0); } else if (argc > 1 && (strcmp(argv[1], "--version") == 0 || strcmp(argv[1], "-version") == 0)) { - printf("mpto 0.992\n\ + printf("mpto 1.002\n\ This program is in the public domain.\n\ Primary author of mpto: John Hobby.\n\ Current maintainer: Taco Hoekwater.\n"); diff --git a/Build/source/texk/web2c/mpware/newer.c b/Build/source/texk/web2c/mpware/newer.c index a19d646b9f9..951575cfb75 100644 --- a/Build/source/texk/web2c/mpware/newer.c +++ b/Build/source/texk/web2c/mpware/newer.c @@ -87,7 +87,7 @@ main(int argc, char **argv) } else if (strcmp(argv[1], "-version") == 0 || strcmp(argv[1], "--version") == 0) { - fputs("newer 0.992\n\ + fputs("newer 1.002\n\ This program is in the public domain.\n\ Primary author of newer: John Hobby.\n\ Current maintainer: Taco Hoekwater.\n", stdout); |