From 3bd11c5b320d265b89c965f63f57018ef818b876 Mon Sep 17 00:00:00 2001 From: Taco Hoekwater Date: Tue, 5 Apr 2011 14:13:11 +0000 Subject: Update to metapost 1.503 git-svn-id: svn://tug.org/texlive/trunk@21975 c570f23f-e606-0410-a88d-b1316a301751 --- Build/source/texk/web2c/Makefile.in | 62 +- Build/source/texk/web2c/aclocal.m4 | 107 - Build/source/texk/web2c/configure | 62 +- Build/source/texk/web2c/man/ChangeLog | 4 + Build/source/texk/web2c/man/mpost.man | 29 +- Build/source/texk/web2c/mplibdir/ChangeLog | 8 + Build/source/texk/web2c/mplibdir/am/libmplib.am | 16 +- Build/source/texk/web2c/mplibdir/avl.c | 63 +- Build/source/texk/web2c/mplibdir/lmplib.c | 65 +- Build/source/texk/web2c/mplibdir/memio.w | 514 - Build/source/texk/web2c/mplibdir/mp.w | 35154 +++++++++++-------- Build/source/texk/web2c/mplibdir/mpmath.w | 1226 + Build/source/texk/web2c/mplibdir/mpost.w | 67 +- Build/source/texk/web2c/mplibdir/mptrap.test | 26 +- Build/source/texk/web2c/mplibdir/mpxout.w | 19 +- Build/source/texk/web2c/mplibdir/psout.w | 467 +- Build/source/texk/web2c/mplibdir/svgout.w | 71 +- Build/source/texk/web2c/mplibdir/tfmin.w | 21 +- Build/source/texk/web2c/web2c/configure | 7 +- Master/texmf-dist/doc/metapost/base/mpboxes.pdf | Bin 371620 -> 371601 bytes Master/texmf-dist/doc/metapost/base/mpgraph.pdf | Bin 467533 -> 467471 bytes Master/texmf-dist/doc/metapost/base/mpintro.pdf | Bin 234860 -> 234688 bytes Master/texmf-dist/doc/metapost/base/mplibapi.pdf | Bin 0 -> 243123 bytes Master/texmf-dist/doc/metapost/base/mpman.pdf | Bin 858284 -> 895061 bytes .../doc/metapost/base/source-manual/Makefile | 30 +- .../doc/metapost/base/source-manual/README | 6 +- .../doc/metapost/base/source-manual/TODO | 41 +- .../doc/metapost/base/source-manual/charts.mp | 120 + .../doc/metapost/base/source-manual/mp.1 | 289 - .../doc/metapost/base/source-manual/mpboxes.bib | 1 - .../base/source-manual/mpman-app-legacy.tex | 686 +- .../base/source-manual/mpman-app-optab.tex | 10 +- .../base/source-manual/mpman-app-refman.tex | 351 +- .../metapost/base/source-manual/mpman-charts.mp | 210 + .../doc/metapost/base/source-manual/mpman.bib | 19 +- .../doc/metapost/base/source-manual/mpman.mp | 48 - .../doc/metapost/base/source-manual/mpman.tex | 1363 +- Master/texmf-dist/metapost/base/mfplain.mp | 2 + .../texmf-dist/tex/generic/metapost/mpsproof.tex | 266 +- Master/tlpkg/tlpsrc/metapost.tlpsrc | 2 - 40 files changed, 23531 insertions(+), 17901 deletions(-) delete mode 100644 Build/source/texk/web2c/mplibdir/memio.w create mode 100644 Build/source/texk/web2c/mplibdir/mpmath.w create mode 100644 Master/texmf-dist/doc/metapost/base/mplibapi.pdf create mode 100644 Master/texmf-dist/doc/metapost/base/source-manual/charts.mp delete mode 100644 Master/texmf-dist/doc/metapost/base/source-manual/mp.1 create mode 100644 Master/texmf-dist/doc/metapost/base/source-manual/mpman-charts.mp diff --git a/Build/source/texk/web2c/Makefile.in b/Build/source/texk/web2c/Makefile.in index 7daa434a33b..969e9d3dfdf 100644 --- a/Build/source/texk/web2c/Makefile.in +++ b/Build/source/texk/web2c/Makefile.in @@ -438,11 +438,11 @@ libmf_a_OBJECTS = $(nodist_libmf_a_OBJECTS) libmplib_a_AR = $(AR) $(ARFLAGS) libmplib_a_LIBADD = am_libmplib_a_OBJECTS = libmplib_a-avl.$(OBJEXT) -am__objects_2 = libmplib_a-memio.$(OBJEXT) -am__objects_3 = libmplib_a-mp.$(OBJEXT) -am__objects_4 = libmplib_a-psout.$(OBJEXT) -am__objects_5 = libmplib_a-svgout.$(OBJEXT) -am__objects_6 = libmplib_a-tfmin.$(OBJEXT) +am__objects_2 = libmplib_a-mp.$(OBJEXT) +am__objects_3 = libmplib_a-psout.$(OBJEXT) +am__objects_4 = libmplib_a-svgout.$(OBJEXT) +am__objects_5 = libmplib_a-tfmin.$(OBJEXT) +am__objects_6 = libmplib_a-mpmath.$(OBJEXT) nodist_libmplib_a_OBJECTS = $(am__objects_2) $(am__objects_3) \ $(am__objects_4) $(am__objects_5) $(am__objects_6) libmplib_a_OBJECTS = $(am_libmplib_a_OBJECTS) \ @@ -1442,10 +1442,10 @@ DISTCLEANFILES = $(EXTRA_LIBRARIES) tangle.c tangle.h tangle.p \ mf-final.ch mf-web2c mf.p mf.pool mf-tangle \ $(nodist_mpost_SOURCES) mpxout-tangle mptrap.diffs ptmr.mpx \ tests/xptmr.mpx tests/xstory.mpx $(nodist_libmplib_a_SOURCES) \ - memio-tangle mp-tangle psout-tangle svgout-tangle tfmin-tangle \ - $(nodist_etex_SOURCES) etex.web etex.ch etex-web2c etex.p \ - etex.pool etex-tangle etrip.diffs $(pweb_programs:=.c) \ - $(pweb_programs:=.h) $(pweb_programs:=.p) \ + mpmath-tangle mp-tangle psout-tangle svgout-tangle \ + tfmin-tangle $(nodist_etex_SOURCES) etex.web etex.ch \ + etex-web2c etex.p etex.pool etex-tangle etrip.diffs \ + $(pweb_programs:=.c) $(pweb_programs:=.h) $(pweb_programs:=.p) \ $(pweb_programs:=-web2c) $(pweb_programs:=.web) \ $(nodist_ptex_SOURCES) ptex.web ptex.ch ptex-web2c ptex.p \ ptex.pool ptex-tangle tests/nissya_bib.* tests/xexampl.aux \ @@ -1632,14 +1632,14 @@ mpost_web = mplibdir/mpost.w mplibdir/mpxout.w mp_tests = mplibdir/dvitomp.test mplibdir/mptrap.test libmplib_a_CPPFLAGS = $(AM_CPPFLAGS) -I$(srcdir)/mplibdir libmplib_a_SOURCES = mplibdir/avl.h mplibdir/avl.c -nodist_libmplib_a_SOURCES = $(memio_c_h) $(mp_c_h) $(psout_c_h) $(svgout_c_h) $(tfmin_c_h) -memio_c_h = memio.c mpmemio.h +nodist_libmplib_a_SOURCES = $(mp_c_h) $(psout_c_h) $(svgout_c_h) $(tfmin_c_h) $(mpmath_c_h) mp_c_h = mp.c mplib.h mpmp.h psout_c_h = mppsout.h psout.c mplibps.h svgout_c_h = mplibsvg.h mpsvgout.h svgout.c +mpmath_c_h = mpmath.h mpmath.c tfmin_c_h = mptfmin.h tfmin.c libmplib_web = mplibdir/mp.w mplibdir/psout.w mplibdir/svgout.w \ - mplibdir/memio.w mplibdir/tfmin.w + mplibdir/mpmath.w mplibdir/tfmin.w etex_CPPFLAGS = $(AM_CPPFLAGS) $(am__append_74) # With --enable-ipc, e-TeX may need to link with -lsocket. @@ -3096,8 +3096,8 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libluatex_a-writetype2.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libmd5_a-md5.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libmplib_a-avl.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libmplib_a-memio.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libmplib_a-mp.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libmplib_a-mpmath.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libmplib_a-psout.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libmplib_a-svgout.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libmplib_a-tfmin.Po@am__quote@ @@ -6453,20 +6453,6 @@ libmplib_a-avl.obj: mplibdir/avl.c @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libmplib_a_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libmplib_a-avl.obj `if test -f 'mplibdir/avl.c'; then $(CYGPATH_W) 'mplibdir/avl.c'; else $(CYGPATH_W) '$(srcdir)/mplibdir/avl.c'; fi` -libmplib_a-memio.o: memio.c -@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libmplib_a_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libmplib_a-memio.o -MD -MP -MF $(DEPDIR)/libmplib_a-memio.Tpo -c -o libmplib_a-memio.o `test -f 'memio.c' || echo '$(srcdir)/'`memio.c -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libmplib_a-memio.Tpo $(DEPDIR)/libmplib_a-memio.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='memio.c' object='libmplib_a-memio.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libmplib_a_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libmplib_a-memio.o `test -f 'memio.c' || echo '$(srcdir)/'`memio.c - -libmplib_a-memio.obj: memio.c -@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libmplib_a_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libmplib_a-memio.obj -MD -MP -MF $(DEPDIR)/libmplib_a-memio.Tpo -c -o libmplib_a-memio.obj `if test -f 'memio.c'; then $(CYGPATH_W) 'memio.c'; else $(CYGPATH_W) '$(srcdir)/memio.c'; fi` -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libmplib_a-memio.Tpo $(DEPDIR)/libmplib_a-memio.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='memio.c' object='libmplib_a-memio.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libmplib_a_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libmplib_a-memio.obj `if test -f 'memio.c'; then $(CYGPATH_W) 'memio.c'; else $(CYGPATH_W) '$(srcdir)/memio.c'; fi` - libmplib_a-mp.o: mp.c @am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libmplib_a_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libmplib_a-mp.o -MD -MP -MF $(DEPDIR)/libmplib_a-mp.Tpo -c -o libmplib_a-mp.o `test -f 'mp.c' || echo '$(srcdir)/'`mp.c @am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libmplib_a-mp.Tpo $(DEPDIR)/libmplib_a-mp.Po @@ -6523,6 +6509,20 @@ libmplib_a-tfmin.obj: tfmin.c @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libmplib_a_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libmplib_a-tfmin.obj `if test -f 'tfmin.c'; then $(CYGPATH_W) 'tfmin.c'; else $(CYGPATH_W) '$(srcdir)/tfmin.c'; fi` +libmplib_a-mpmath.o: mpmath.c +@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libmplib_a_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libmplib_a-mpmath.o -MD -MP -MF $(DEPDIR)/libmplib_a-mpmath.Tpo -c -o libmplib_a-mpmath.o `test -f 'mpmath.c' || echo '$(srcdir)/'`mpmath.c +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libmplib_a-mpmath.Tpo $(DEPDIR)/libmplib_a-mpmath.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='mpmath.c' object='libmplib_a-mpmath.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libmplib_a_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libmplib_a-mpmath.o `test -f 'mpmath.c' || echo '$(srcdir)/'`mpmath.c + +libmplib_a-mpmath.obj: mpmath.c +@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libmplib_a_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libmplib_a-mpmath.obj -MD -MP -MF $(DEPDIR)/libmplib_a-mpmath.Tpo -c -o libmplib_a-mpmath.obj `if test -f 'mpmath.c'; then $(CYGPATH_W) 'mpmath.c'; else $(CYGPATH_W) '$(srcdir)/mpmath.c'; fi` +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libmplib_a-mpmath.Tpo $(DEPDIR)/libmplib_a-mpmath.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='mpmath.c' object='libmplib_a-mpmath.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libmplib_a_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libmplib_a-mpmath.obj `if test -f 'mpmath.c'; then $(CYGPATH_W) 'mpmath.c'; else $(CYGPATH_W) '$(srcdir)/mpmath.c'; fi` + libpdftex_a-avl.o: pdftexdir/avl.c @am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libpdftex_a_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libpdftex_a-avl.o -MD -MP -MF $(DEPDIR)/libpdftex_a-avl.Tpo -c -o libpdftex_a-avl.o `test -f 'pdftexdir/avl.c' || echo '$(srcdir)/'`pdftexdir/avl.c @am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libpdftex_a-avl.Tpo $(DEPDIR)/libpdftex_a-avl.Po @@ -9031,10 +9031,10 @@ mptrap-clean: rm -f trap.149 trap.150 trap.151 trap.197 trap.200 rm -f mptrap.pl -$(memio_c_h): memio-tangle - @$(mp_ctangle_sh) memio -memio-tangle: ctangle$(EXEEXT) mplibdir/memio.w tangle-sh - @$(mp_ctangle_sh) memio +$(mpmath_c_h): mpmath-tangle + @$(mp_ctangle_sh) mpmath +mpmath-tangle: ctangle$(EXEEXT) mplibdir/mpmath.w tangle-sh + @$(mp_ctangle_sh) mpmath $(mp_c_h): mp-tangle @$(mp_ctangle_sh) mp diff --git a/Build/source/texk/web2c/aclocal.m4 b/Build/source/texk/web2c/aclocal.m4 index 8d89b6d7a1a..09487015963 100644 --- a/Build/source/texk/web2c/aclocal.m4 +++ b/Build/source/texk/web2c/aclocal.m4 @@ -19,113 +19,6 @@ You have another version of autoconf. It may work, but is not guaranteed to. If you have problems, you may need to regenerate the build system entirely. To do so, use the procedure documented by the package, typically `autoreconf'.])]) -# longlong.m4 serial 14 -dnl Copyright (C) 1999-2007, 2009-2010 Free Software Foundation, Inc. -dnl This file is free software; the Free Software Foundation -dnl gives unlimited permission to copy and/or distribute it, -dnl with or without modifications, as long as this notice is preserved. - -dnl From Paul Eggert. - -# Define HAVE_LONG_LONG_INT if 'long long int' works. -# This fixes a bug in Autoconf 2.61, but can be removed once we -# assume 2.62 everywhere. - -# Note: If the type 'long long int' exists but is only 32 bits large -# (as on some very old compilers), HAVE_LONG_LONG_INT will not be -# defined. In this case you can treat 'long long int' like 'long int'. - -AC_DEFUN([AC_TYPE_LONG_LONG_INT], -[ - AC_CACHE_CHECK([for long long int], [ac_cv_type_long_long_int], - [AC_LINK_IFELSE( - [_AC_TYPE_LONG_LONG_SNIPPET], - [dnl This catches a bug in Tandem NonStop Kernel (OSS) cc -O circa 2004. - dnl If cross compiling, assume the bug isn't important, since - dnl nobody cross compiles for this platform as far as we know. - AC_RUN_IFELSE( - [AC_LANG_PROGRAM( - [[@%:@include - @%:@ifndef LLONG_MAX - @%:@ define HALF \ - (1LL << (sizeof (long long int) * CHAR_BIT - 2)) - @%:@ define LLONG_MAX (HALF - 1 + HALF) - @%:@endif]], - [[long long int n = 1; - int i; - for (i = 0; ; i++) - { - long long int m = n << i; - if (m >> i != n) - return 1; - if (LLONG_MAX / 2 < m) - break; - } - return 0;]])], - [ac_cv_type_long_long_int=yes], - [ac_cv_type_long_long_int=no], - [ac_cv_type_long_long_int=yes])], - [ac_cv_type_long_long_int=no])]) - if test $ac_cv_type_long_long_int = yes; then - AC_DEFINE([HAVE_LONG_LONG_INT], [1], - [Define to 1 if the system has the type `long long int'.]) - fi -]) - -# Define HAVE_UNSIGNED_LONG_LONG_INT if 'unsigned long long int' works. -# This fixes a bug in Autoconf 2.61, but can be removed once we -# assume 2.62 everywhere. - -# Note: If the type 'unsigned long long int' exists but is only 32 bits -# large (as on some very old compilers), AC_TYPE_UNSIGNED_LONG_LONG_INT -# will not be defined. In this case you can treat 'unsigned long long int' -# like 'unsigned long int'. - -AC_DEFUN([AC_TYPE_UNSIGNED_LONG_LONG_INT], -[ - AC_CACHE_CHECK([for unsigned long long int], - [ac_cv_type_unsigned_long_long_int], - [AC_LINK_IFELSE( - [_AC_TYPE_LONG_LONG_SNIPPET], - [ac_cv_type_unsigned_long_long_int=yes], - [ac_cv_type_unsigned_long_long_int=no])]) - if test $ac_cv_type_unsigned_long_long_int = yes; then - AC_DEFINE([HAVE_UNSIGNED_LONG_LONG_INT], [1], - [Define to 1 if the system has the type `unsigned long long int'.]) - fi -]) - -# Expands to a C program that can be used to test for simultaneous support -# of 'long long' and 'unsigned long long'. We don't want to say that -# 'long long' is available if 'unsigned long long' is not, or vice versa, -# because too many programs rely on the symmetry between signed and unsigned -# integer types (excluding 'bool'). -AC_DEFUN([_AC_TYPE_LONG_LONG_SNIPPET], -[ - AC_LANG_PROGRAM( - [[/* For now, do not test the preprocessor; as of 2007 there are too many - implementations with broken preprocessors. Perhaps this can - be revisited in 2012. In the meantime, code should not expect - #if to work with literals wider than 32 bits. */ - /* Test literals. */ - long long int ll = 9223372036854775807ll; - long long int nll = -9223372036854775807LL; - unsigned long long int ull = 18446744073709551615ULL; - /* Test constant expressions. */ - typedef int a[((-9223372036854775807LL < 0 && 0 < 9223372036854775807ll) - ? 1 : -1)]; - typedef int b[(18446744073709551615ULL <= (unsigned long long int) -1 - ? 1 : -1)]; - int i = 63;]], - [[/* Test availability of runtime routines for shift and division. */ - long long int llmax = 9223372036854775807ll; - unsigned long long int ullmax = 18446744073709551615ull; - return ((ll << 63) | (ll >> 63) | (ll < i) | (ll > i) - | (llmax / ll) | (llmax % ll) - | (ull << 63) | (ull >> 63) | (ull << i) | (ull >> i) - | (ullmax / ull) | (ullmax % ull));]]) -]) - # Copyright (C) 2002, 2003, 2005, 2006, 2007, 2008 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation diff --git a/Build/source/texk/web2c/configure b/Build/source/texk/web2c/configure index 2883b30e7d7..e8265523727 100755 --- a/Build/source/texk/web2c/configure +++ b/Build/source/texk/web2c/configure @@ -883,7 +883,6 @@ with_sysroot enable_libtool_lock enable_largefile enable_compiler_warnings -with_gnu_ld enable_cxx_runtime_hack enable_libtool_hack with_banner_add @@ -944,19 +943,12 @@ LDFLAGS LIBS CPPFLAGS CPP -CPPFLAGS CXX CXXFLAGS -LDFLAGS -LIBS -CPPFLAGS CCC CXXCPP OBJCXX OBJCXXFLAGS -LDFLAGS -LIBS -OBJCXX XMKMF YACC YFLAGS' @@ -19760,18 +19752,18 @@ else /* end confdefs.h. */ /* For now, do not test the preprocessor; as of 2007 there are too many - implementations with broken preprocessors. Perhaps this can - be revisited in 2012. In the meantime, code should not expect - #if to work with literals wider than 32 bits. */ + implementations with broken preprocessors. Perhaps this can + be revisited in 2012. In the meantime, code should not expect + #if to work with literals wider than 32 bits. */ /* Test literals. */ long long int ll = 9223372036854775807ll; long long int nll = -9223372036854775807LL; unsigned long long int ull = 18446744073709551615ULL; /* Test constant expressions. */ typedef int a[((-9223372036854775807LL < 0 && 0 < 9223372036854775807ll) - ? 1 : -1)]; + ? 1 : -1)]; typedef int b[(18446744073709551615ULL <= (unsigned long long int) -1 - ? 1 : -1)]; + ? 1 : -1)]; int i = 63; int main () @@ -19780,40 +19772,40 @@ main () long long int llmax = 9223372036854775807ll; unsigned long long int ullmax = 18446744073709551615ull; return ((ll << 63) | (ll >> 63) | (ll < i) | (ll > i) - | (llmax / ll) | (llmax % ll) - | (ull << 63) | (ull >> 63) | (ull << i) | (ull >> i) - | (ullmax / ull) | (ullmax % ull)); + | (llmax / ll) | (llmax % ll) + | (ull << 63) | (ull >> 63) | (ull << i) | (ull >> i) + | (ullmax / ull) | (ullmax % ull)); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : - if test "$cross_compiling" = yes; then : + if test "$cross_compiling" = yes; then : ac_cv_type_long_long_int=yes else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include - #ifndef LLONG_MAX - # define HALF \ - (1LL << (sizeof (long long int) * CHAR_BIT - 2)) - # define LLONG_MAX (HALF - 1 + HALF) - #endif + #ifndef LLONG_MAX + # define HALF \ + (1LL << (sizeof (long long int) * CHAR_BIT - 2)) + # define LLONG_MAX (HALF - 1 + HALF) + #endif int main () { long long int n = 1; - int i; - for (i = 0; ; i++) - { - long long int m = n << i; - if (m >> i != n) - return 1; - if (LLONG_MAX / 2 < m) - break; - } - return 0; + int i; + for (i = 0; ; i++) + { + long long int m = n << i; + if (m >> i != n) + return 1; + if (LLONG_MAX / 2 < m) + break; + } + return 0; ; return 0; } @@ -23340,9 +23332,9 @@ esac cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 # Files that config.status was made for. -config_files="$ac_config_files" -config_headers="$ac_config_headers" -config_commands="$ac_config_commands" +config_files="`echo $ac_config_files`" +config_headers="`echo $ac_config_headers`" +config_commands="`echo $ac_config_commands`" _ACEOF diff --git a/Build/source/texk/web2c/man/ChangeLog b/Build/source/texk/web2c/man/ChangeLog index de8ed048821..b7ec50f1b14 100644 --- a/Build/source/texk/web2c/man/ChangeLog +++ b/Build/source/texk/web2c/man/ChangeLog @@ -1,3 +1,7 @@ +2011-04-05 Taco Hoekwater + + * mpost.man: update to version 1.503 + 2011-03-01 Peter Breitenlohner * aleph.man, etex.man, luatex.man, mf.man, pdftex.man, diff --git a/Build/source/texk/web2c/man/mpost.man b/Build/source/texk/web2c/man/mpost.man index 71b939e33ee..98fd294546f 100644 --- a/Build/source/texk/web2c/man/mpost.man +++ b/Build/source/texk/web2c/man/mpost.man @@ -1,4 +1,4 @@ -.TH MPOST 1 "14 May 2010" "MetaPost 1.201" +.TH MPOST 1 "5 April 2011" "MetaPost 1.503" .\"===================================================================== .de URL \\$2 \(laURL: \\$1 \(ra\\$3 @@ -44,19 +44,17 @@ or .BR troff (1) commands and accessing features of PostScript not found in \*(MF. .PP -Like \*(TX and \*(MF, \*(MP is normally used with a large body of -precompiled macros. When the -.B --ini -option is given, it can be used to precompile macros into a -.I .mem -file. When called without that option, \*(MP will use its executable name as -the name of the mem to use. For example, when called as +\*(MP is normally used with some preloaded macros, and it +will use its executable name as the name of the preload +file to use. For example, when called as .B mpost the -.I mpost -mem is used, which is identical to the -.I plain -mem. +.I mpost.mp +file is used, which is identical to +.I plain.mp. +When the +.B --ini +option is given, preloading does not happen. .PP The .I commands @@ -96,14 +94,11 @@ output commands or \*(MF's online display mechanism. .\"===================================================================== .SH FILES .TP -.I *.mem -Predigested \*(MP mem files. -.TP .I plain.mp -The standard mem file. +The standard preload file. .TP .I mfplain.mp -The \*(MF-compatible mem file. +The \*(MF-compatible preload file. .TP .I $TEXMFMAIN/metapost/base/*.mp The standard \*(MP macros included in the original distribution. diff --git a/Build/source/texk/web2c/mplibdir/ChangeLog b/Build/source/texk/web2c/mplibdir/ChangeLog index 953844b6b43..2b711ba0ee9 100644 --- a/Build/source/texk/web2c/mplibdir/ChangeLog +++ b/Build/source/texk/web2c/mplibdir/ChangeLog @@ -1,3 +1,11 @@ +2011-04-05 Taco Hoekwater + + * Import of MetaPost 1.503, updating the .w files as well + as lmplib.c and avl.c, and adding mpmath.w and removing memio.w + * am/libmplib.am: add support for mpmath.w, remove memio.w + * mptrap.test: remove the second part as metapost no longer + uses .mem files at all + 2011-03-28 Peter Breitenlohner * am/libmplib.am: Use AM_CFLAGS instead of libmplib_a_CFLAGS. diff --git a/Build/source/texk/web2c/mplibdir/am/libmplib.am b/Build/source/texk/web2c/mplibdir/am/libmplib.am index f6a12646074..c4e32f2f602 100644 --- a/Build/source/texk/web2c/mplibdir/am/libmplib.am +++ b/Build/source/texk/web2c/mplibdir/am/libmplib.am @@ -11,17 +11,17 @@ libmplib_a_CPPFLAGS = $(AM_CPPFLAGS) -I$(srcdir)/mplibdir ## libmplib C sources libmplib_a_SOURCES = mplibdir/avl.h mplibdir/avl.c -nodist_libmplib_a_SOURCES = $(memio_c_h) $(mp_c_h) $(psout_c_h) $(svgout_c_h) $(tfmin_c_h) -memio_c_h = memio.c mpmemio.h +nodist_libmplib_a_SOURCES = $(mp_c_h) $(psout_c_h) $(svgout_c_h) $(tfmin_c_h) $(mpmath_c_h) mp_c_h = mp.c mplib.h mpmp.h psout_c_h = mppsout.h psout.c mplibps.h svgout_c_h = mplibsvg.h mpsvgout.h svgout.c +mpmath_c_h = mpmath.h mpmath.c tfmin_c_h = mptfmin.h tfmin.c -$(memio_c_h): memio-tangle - @$(mp_ctangle_sh) memio -memio-tangle: ctangle$(EXEEXT) mplibdir/memio.w tangle-sh - @$(mp_ctangle_sh) memio +$(mpmath_c_h): mpmath-tangle + @$(mp_ctangle_sh) mpmath +mpmath-tangle: ctangle$(EXEEXT) mplibdir/mpmath.w tangle-sh + @$(mp_ctangle_sh) mpmath $(mp_c_h): mp-tangle @$(mp_ctangle_sh) mp @@ -45,14 +45,14 @@ tfmin-tangle: ctangle$(EXEEXT) mplibdir/tfmin.w tangle-sh ## libmplib CWeb sources libmplib_web = mplibdir/mp.w mplibdir/psout.w mplibdir/svgout.w -libmplib_web += mplibdir/memio.w mplibdir/tfmin.w +libmplib_web += mplibdir/mpmath.w mplibdir/tfmin.w $(libmplib_a_OBJECTS): $(nodist_libmplib_a_SOURCES) EXTRA_DIST += $(libmplib_web) DISTCLEANFILES += $(nodist_libmplib_a_SOURCES) \ - memio-tangle mp-tangle psout-tangle svgout-tangle tfmin-tangle + mpmath-tangle mp-tangle psout-tangle svgout-tangle tfmin-tangle ## only used by luaTeX EXTRA_DIST += mplibdir/lmplib.c diff --git a/Build/source/texk/web2c/mplibdir/avl.c b/Build/source/texk/web2c/mplibdir/avl.c index 1062de9d568..de3c63322ad 100644 --- a/Build/source/texk/web2c/mplibdir/avl.c +++ b/Build/source/texk/web2c/mplibdir/avl.c @@ -14,7 +14,7 @@ const void * avl_default_item_copy (const void *item) { - return item; + return (const void *) item; } void * @@ -574,13 +574,13 @@ node_find_index (avl_size_t idx, avl_tree t) if (idx == t->count) return node_last (a); - while ((c = idx - get_rank (a)) != 0) + while ((c = (int)(idx - get_rank (a))) != 0) { if (c < 0) a = sub_left (a); else { - idx = c; + idx = (avl_size_t)c; a = sub_right (a); } } @@ -601,7 +601,7 @@ rebalance_ins (avl_node * a, int dir, avl_tree t) while (1) { - incr_rank (a, !dir); + incr_rank (a, (rbal_t)(!dir)); if (get_bal (a)) break; set_skew (a, dir); @@ -748,7 +748,7 @@ rebalance_ins (avl_node * a, int dir, avl_tree t) while ((p = a->up) != NULL) { - incr_rank (p, (a == sub_left (p))); + incr_rank (p, (rbal_t)(a == sub_left (p))); a = p; } @@ -766,8 +766,9 @@ static avl_code_t rebalance_del (avl_node * p, avl_tree t, void **backup) { avl_node **r, *a, *c; - int dir, bal; - dir = 0; /* for -W */ + rbal_t bal; + int dir = 0; + a = p->up; if (a == NULL) r = &t->root; @@ -819,7 +820,7 @@ rebalance_del (avl_node * p, avl_tree t, void **backup) if (a == NULL) return 2; - decr_rank (a, !dir); + decr_rank (a, (rbal_t)(!dir)); bal = get_bal (a); if (0 == dir) @@ -990,7 +991,7 @@ rebalance_del (avl_node * p, avl_tree t, void **backup) /* Finish adjusting ranks */ while ((p = a->up) != NULL) { - decr_rank (p, (a == sub_left (p))); + decr_rank (p, (rbal_t)(a == sub_left (p))); a = p; } @@ -1255,8 +1256,8 @@ avl_ins (void *item, avl_tree t, avl_bool_t allow_duplicates) #endif avl_compare_func cmp = t->compare; avl_node **r, *a; - int dir; - dir = 0; /* for -W */ + int dir = 0; + for (r = &t->root, a = NULL; *r != NULL; r = &a->sub[dir = dir > 0]) { a = *r; @@ -1298,7 +1299,7 @@ static avl_code_t node_del_first (avl_tree t, struct ptr_handler *h) { avl_node *p, *a, *c; - int bal; + rbal_t bal; p = node_first (t->root); a = p->up; @@ -1412,7 +1413,7 @@ node_del_last (avl_tree t, struct ptr_handler *h) { avl_node *p, *a, *c; - int bal; + rbal_t bal; p = node_last (t->root); a = p->up; @@ -1528,7 +1529,7 @@ join_left (avl_node * p, avl_node ** r0, avl_node * r1, int delta, int n) while (*r != NULL) { a = *r; - n -= get_rank (a); + n -= (int)get_rank (a); r = &sub_right (a); } } @@ -1537,8 +1538,8 @@ join_left (avl_node * p, avl_node ** r0, avl_node * r1, int delta, int n) while (delta < -1) { a = *r; - delta += is_lskew (a) + 1; - n -= get_rank (a); + delta += (int)(is_lskew (a) + 1); + n -= (int)get_rank (a); r = &sub_right (a); } r1->up = p; @@ -1645,7 +1646,7 @@ join_right (avl_node * p, avl_node * r0, avl_node ** r1, int delta, int n) while (*r != NULL) { a = *r; - incr_rank (a, n); + incr_rank (a, (rbal_t)n); r = &sub_left (a); } n = 1; @@ -1655,8 +1656,8 @@ join_right (avl_node * p, avl_node * r0, avl_node ** r1, int delta, int n) while (delta > +1) { a = *r; - delta -= is_rskew (a) + 1; - incr_rank (a, n); + delta -= (int)(is_rskew (a) + 1); + incr_rank (a, (rbal_t)n); r = &sub_left (a); } r0->up = p; @@ -1819,7 +1820,7 @@ avl_ins_index (void *item, avl_size_t idx, avl_tree t) else if (idx == t->count) { return - join_left (p, &t->root, (avl_node *) NULL, /*delta= */ 0, t->count); + join_left (p, &t->root, (avl_node *) NULL, /*delta= */ 0, (int)t->count); } else { @@ -1897,14 +1898,14 @@ avl_cat (avl_tree t0, avl_tree t1) if (node_del_first (t1, &h) == 2) --delta; (void) join_left ((avl_node *) h.ptr, &t0->root, t1->root, delta, - t0->count + 1); + (int)(t0->count + 1)); } else { if (node_del_last (t0, &h) == 2) ++delta; (void) join_right ((avl_node *) h.ptr, t0->root, &t1->root, delta, - t0->count + 1); + (int)(t0->count + 1)); t0->root = t1->root; } @@ -1941,7 +1942,7 @@ avl_split (const void *item, avl_tree t, avl_tree t0, avl_tree t1) /* invariant: [na]= size of tree rooted at [a] plus one */ - for (a = t->root, na = t->count + 1, k = 0;;) + for (a = t->root, na = (int)(t->count + 1), k = 0;;) { d_ = Item_Compare (cmp, t, item, get_item (a)); CMPERR_CHECK__SPLIT (t->param); @@ -1952,9 +1953,9 @@ avl_split (const void *item, avl_tree t, avl_tree t0, avl_tree t1) return 0; an[k++] = na; if (d_) - na -= get_rank (a); + na -= (int)get_rank (a); else - na = get_rank (a); + na = (int)get_rank (a); a = p; } @@ -1988,7 +1989,7 @@ avl_split (const void *item, avl_tree t, avl_tree t0, avl_tree t1) h[0] = ha - (is_rskew (a) ? 2 : 1); h[1] = ha - (is_lskew (a) ? 2 : 1); n[0] = get_rank (a); /* size of r[0] plus one */ - n[1] = na - n[0]; /* size of r[1] plus one */ + n[1] = (avl_size_t)na - n[0]; /* size of r[1] plus one */ for (p = a->up, d_ = a != sub_left (p);;) { @@ -2002,7 +2003,7 @@ avl_split (const void *item, avl_tree t, avl_tree t0, avl_tree t1) ha += (is_rskew (a) ? 2 : 1); h[1] = ha - (is_lskew (a) ? 2 : 1); nn = n[1]; - n[1] += an[k - 1] - get_rank (a); + n[1] += (avl_size_t)(an[k - 1] - (int)get_rank (a)); if (p != NULL) d_ = a != sub_left (p); rbal (a) = 0; @@ -2013,14 +2014,14 @@ avl_split (const void *item, avl_tree t, avl_tree t0, avl_tree t1) r[1] = sub_right (a); if (r[1] != NULL) r[1]->up = NULL; - h[1] += (2 == join_right (a, rr, r + 1, h[1] - hh, nn)); + h[1] += (2 == join_right (a, rr, r + 1, h[1] - hh, (int)nn)); } else { h[1] = hh + (2 == join_left (a, r + 1, sub_right (a), h[1] - hh, - nn)); + (int)nn)); } } else @@ -2040,13 +2041,13 @@ avl_split (const void *item, avl_tree t, avl_tree t0, avl_tree t1) r[0] = sub_left (a); if (r[0] != NULL) r[0]->up = NULL; - h[0] += (2 == join_left (a, r, rr, hh - h[0], nn)); + h[0] += (2 == join_left (a, r, rr, hh - h[0], (int)nn)); } else { h[0] = hh + (2 == - join_right (a, sub_left (a), r, hh - h[0], nn)); + join_right (a, sub_left (a), r, hh - h[0], (int)nn)); } } diff --git a/Build/source/texk/web2c/mplibdir/lmplib.c b/Build/source/texk/web2c/mplibdir/lmplib.c index a155e705af0..80f7284fc8b 100644 --- a/Build/source/texk/web2c/mplibdir/lmplib.c +++ b/Build/source/texk/web2c/mplibdir/lmplib.c @@ -20,7 +20,9 @@ #include #include #include +#ifdef HAVE_UNISTD_H #include +#endif #include /* temporary */ #ifndef pdfTeX @@ -56,7 +58,7 @@ int luaopen_mplib(lua_State * L); /* forward */ #define mplib_init_S(a) do { \ lua_pushliteral(L,#a); \ - mplib_##a##_ptr = lua_tostring(L,-1); \ + mplib_##a##_ptr = lua_tostring(L,-1); \ mplib_##a##_index = luaL_ref (L,LUA_REGISTRYINDEX); \ } while (0) @@ -238,7 +240,7 @@ static char *mplib_find_file(MP mp, const char *fname, const char *fmode, int ft lua_getfield(L, LUA_REGISTRYINDEX, "mplib_file_finder"); if (lua_isfunction(L, -1)) { char *s = NULL; - const char *x = NULL; + const char *x = NULL; lua_pushstring(L, fname); lua_pushstring(L, fmode); if (ftype >= mp_filetype_text) { @@ -247,8 +249,7 @@ static char *mplib_find_file(MP mp, const char *fname, const char *fmode, int ft lua_pushstring(L, mplib_filetype_names[ftype]); } if (lua_pcall(L, 3, 1, 0) != 0) { - fprintf(stdout, "Error in mp.find_file: %s\n", - lua_tostring(L, -1)); + fprintf(stdout, "Error in mp.find_file: %s\n", lua_tostring(L, -1)); return NULL; } x = lua_tostring(L, -1); @@ -307,18 +308,6 @@ static int mplib_new(lua_State * L) options->max_print_line = (int)lua_tointeger(L, -1); if (options->max_print_line<60) options->max_print_line = 60; break; - case P_MAIN_MEMORY: - options->main_memory = (int)lua_tointeger(L, -1); - break; - case P_HASH_SIZE: - options->hash_size = (unsigned)lua_tointeger(L, -1); - break; - case P_PARAM_SIZE: - options->param_size = (int)lua_tointeger(L, -1); - break; - case P_IN_OPEN: - options->max_in_open = (int)lua_tointeger(L, -1); - break; case P_RANDOM_SEED: options->random_seed = (int)lua_tointeger(L, -1); break; @@ -386,16 +375,16 @@ static int mplib_wrapresults(lua_State * L, mp_run_data *res, int status) { lua_checkstack(L, 5); lua_newtable(L); - if (res->term_out.size != 0) { - lua_pushstring(L, res->term_out.data); + if (res->term_out.used != 0) { + lua_pushlstring(L, res->term_out.data, res->term_out.used); lua_setfield(L, -2, "term"); } - if (res->error_out.size != 0) { - lua_pushstring(L, res->error_out.data); + if (res->error_out.used != 0) { + lua_pushlstring(L, res->error_out.data, res->error_out.used); lua_setfield(L, -2, "error"); } - if (res->log_out.size != 0) { - lua_pushstring(L, res->log_out.data); + if (res->log_out.used != 0) { + lua_pushlstring(L, res->log_out.data, res->log_out.used); lua_setfield(L, -2, "log"); } if (res->edges != NULL) { @@ -433,7 +422,7 @@ static int mplib_execute(lua_State * L) char *s = xstrdup(lua_tolstring(L, 2, &l)); int h = mp_execute(*mp_ptr, s, l); mp_run_data *res = mp_rundata(*mp_ptr); - xfree(s); + free(s); return mplib_wrapresults(L, res, h); } else { lua_pushnil(L); @@ -469,7 +458,7 @@ static int mplib_char_dimension(lua_State * L, int t) } else { lua_pushnumber(L,(lua_Number)mp_get_char_dimension(*mp_ptr,fname,charnum,t)); } - xfree(fname); + free(fname); } else { lua_pushnumber(L, (lua_Number)0); } @@ -721,10 +710,10 @@ static int mplib_gr_tostring(lua_State * L) static double eps = 0.0001; -static double coord_range_x (mp_knot *h, double dz) { +static double coord_range_x (mp_knot h, double dz) { double z; double zlo = 0.0, zhi = 0.0; - mp_knot *f = h; + mp_knot f = h; while (h != NULL) { z = (double)h->x_coord; if (z < zlo) zlo = z; else if (z > zhi) zhi = z; @@ -739,10 +728,10 @@ static double coord_range_x (mp_knot *h, double dz) { return (zhi - zlo <= dz ? aspect_bound : aspect_default); } -static double coord_range_y (mp_knot *h, double dz) { +static double coord_range_y (mp_knot h, double dz) { double z; double zlo = 0.0, zhi = 0.0; - mp_knot *f = h; + mp_knot f = h; while (h != NULL) { z = (double)h->y_coord; if (z < zlo) zlo = z; else if (z > zhi) zhi = z; @@ -764,7 +753,7 @@ static int mplib_gr_peninfo(lua_State * L) { double rx = 1.0, sx = 0.0, sy = 0.0, ry = 1.0, tx = 0.0, ty = 0.0; double divider = 1.0; double width = 1.0; - mp_knot *p = NULL, *path = NULL; + mp_knot p = NULL, path = NULL; struct mp_graphic_object **hh = is_gr_object(L, -1); if (!*hh) { lua_pushnil(L); @@ -877,9 +866,9 @@ static int mplib_gr_fields(lua_State * L) #define MPLIB_PATH 0 #define MPLIB_PEN 1 -static void mplib_push_path(lua_State * L, struct mp_knot *h, int is_pen) +static void mplib_push_path(lua_State * L, struct mp_knot_data *h, int is_pen) { - struct mp_knot *p; /* for scanning the path */ + struct mp_knot_data *p; /* for scanning the path */ int i = 1; p = h; if (p != NULL) { @@ -887,14 +876,14 @@ static void mplib_push_path(lua_State * L, struct mp_knot *h, int is_pen) do { lua_createtable(L, 0, 6); if (!is_pen) { - if (p->left_type != mp_explicit) { + if (p->data.types.left_type != mp_explicit) { mplib_push_S(left_type); - lua_pushstring(L, knot_type_enum[p->left_type]); + lua_pushstring(L, knot_type_enum[p->data.types.left_type]); lua_rawset(L, -3); } - if (p->right_type != mp_explicit) { + if (p->data.types.right_type != mp_explicit) { mplib_push_S(right_type); - lua_pushstring(L, knot_type_enum[p->right_type]); + lua_pushstring(L, knot_type_enum[p->data.types.right_type]); lua_rawset(L, -3); } } @@ -918,7 +907,7 @@ static void mplib_push_path(lua_State * L, struct mp_knot *h, int is_pen) lua_rawset(L, -3); lua_rawseti(L, -2, i); i++; - if (p->right_type == mp_endpoint) { + if (p->data.types.right_type == mp_endpoint) { return; } p = p->next; @@ -931,9 +920,9 @@ static void mplib_push_path(lua_State * L, struct mp_knot *h, int is_pen) /* this assumes that the top of the stack is a table or nil already in the case */ -static void mplib_push_pentype(lua_State * L, struct mp_knot *h) +static void mplib_push_pentype(lua_State * L, mp_knot h) { - struct mp_knot *p; /* for scanning the path */ + mp_knot p; /* for scanning the path */ p = h; if (p == NULL) { /* do nothing */ diff --git a/Build/source/texk/web2c/mplibdir/memio.w b/Build/source/texk/web2c/mplibdir/memio.w deleted file mode 100644 index 2c85ae10282..00000000000 --- a/Build/source/texk/web2c/mplibdir/memio.w +++ /dev/null @@ -1,514 +0,0 @@ -% $Id: psout.w 616 2008-07-09 14:05:55Z taco $ -% -% Copyright 2008-2009 Taco Hoekwater. -% -% This program is free software: you can redistribute it and/or modify -% it under the terms of the GNU Lesser General Public License as published by -% the Free Software Foundation, either version 3 of the License, or -% (at your option) any later version. -% -% This program is distributed in the hope that it will be useful, -% but WITHOUT ANY WARRANTY; without even the implied warranty of -% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -% GNU Lesser General Public License for more details. -% -% You should have received a copy of the GNU Lesser General Public License -% along with this program. If not, see . -% -% TeX is a trademark of the American Mathematical Society. -% METAFONT is a trademark of Addison-Wesley Publishing Company. -% PostScript is a trademark of Adobe Systems Incorporated. - -% Here is TeX material that gets inserted after \input webmac - -\font\tenlogo=logo10 % font used for the METAFONT logo -\def\MP{{\tenlogo META}\-{\tenlogo POST}} -\def\title{MetaPost MEM reading and writing} -\def\topofcontents{\hsize 5.5in - \vglue -30pt plus 1fil minus 1.5in - \def\?##1]{\hbox to 1in{\hfil##1.\ }} - } -\def\botofcontents{\vskip 0pt plus 1fil minus 1.5in} -\pdfoutput=1 -\pageno=3 - -@ As usual, need true and false. - -@d true 1 -@d false 0 -@d null 0 /* the null pointer */ -@d incr(A) (A)=(A)+1 /* increase a variable by unity */ -@d decr(A) (A)=(A)-1 /* decrease a variable by unity */ -@d qo(A) (A) /* to read eight bits from a quarterword */ -@d qi(A) (quarterword)(A) /* to store eight bits in a quarterword */ -@d max_quarterword 0x3FFF /* largest allowable value in a |quarterword| */ -@d max_halfword 0xFFFFFFF /* largest allowable value in a |halfword| */ -@d max_str_ref 127 /* ``infinite'' number of references */ - - -@c -#include -#include -#include -#include -#include "mplib.h" -#include "mpmp.h" -static void swap_items (char *p, int nitems, size_t size); -/* If we have these macros, use them, as they provide a better guide to - the endianess when cross-compiling. */ -#if defined (BYTE_ORDER) && defined (BIG_ENDIAN) && defined (LITTLE_ENDIAN) -#ifdef WORDS_BIGENDIAN -#undef WORDS_BIGENDIAN -#endif -#if BYTE_ORDER == BIG_ENDIAN -#define WORDS_BIGENDIAN -#endif -#endif -/* More of the same, but now NeXT-specific. */ -#ifdef NeXT -#ifdef WORDS_BIGENDIAN -#undef WORDS_BIGENDIAN -#endif -#ifdef __BIG_ENDIAN__ -#define WORDS_BIGENDIAN -#endif -#endif -#include "mpmemio.h" /* internal header */ - -@ @(mpmemio.h@>= -extern void mp_store_mem_file (MP mp); - -@ @c void mp_store_mem_file (MP mp) { - integer k; /* all-purpose index */ - pointer p,q; /* all-purpose pointers */ - integer x; /* something to dump */ - four_quarters w; /* four ASCII codes */ - memory_word WW; - @; - @; - @; - @; - @; - @; - @; -} - -@ Corresponding to the procedure that dumps a mem file, we also have a function -that reads~one~in. The function returns |false| if the dumped mem is -incompatible with the present \MP\ table sizes, etc. - -@d too_small(A) { wake_up_terminal; - wterm_ln("---! Must increase the "); wterm((A)); -@.Must increase the x@> - goto OFF_BASE; - } - -@(mpmemio.h@>= -extern boolean mp_load_mem_file (MP mp); - -@ @c -boolean mp_load_mem_file (MP mp) { - integer k; /* all-purpose index */ - pointer p,q; /* all-purpose pointers */ - integer x; /* something undumped */ - str_number s; /* some temporary string */ - four_quarters w; /* four ASCII codes */ - memory_word WW; - @; - @; - @; - @; - return true; /* it worked! */ -OFF_BASE: - wake_up_terminal; - wterm_ln("(Fatal mem file error; I'm stymied)\n"); -@.Fatal mem file error@> - return false; -} - -@ If we want mem files to be shareable between different endianness architectures, -we have to swap some of the items so that everything turns out right. -Code borrowed from |texmfmp.c|. - -Make the NITEMS items pointed at by P, each of size SIZE, be the - opposite-endianness of whatever they are now. */ - -@d SWAP(x, y) temp = (x); (x) = (y); (y) = temp - -@c -static void -swap_items (char *p, int nitems, size_t size) -{ - char temp; -#if !defined (WORDS_BIGENDIAN) - /* Since `size' does not change, we can write a while loop for each - case, and avoid testing `size' for each time. */ - switch (size) - { - /* 16-byte items happen on the DEC Alpha machine when we are not - doing sharable memory dumps. */ - case 16: - while (nitems--) - { - SWAP (p[0], p[15]); - SWAP (p[1], p[14]); - SWAP (p[2], p[13]); - SWAP (p[3], p[12]); - SWAP (p[4], p[11]); - SWAP (p[5], p[10]); - SWAP (p[6], p[9]); - SWAP (p[7], p[8]); - p += size; - } - break; - - case 8: - while (nitems--) - { - SWAP (p[0], p[7]); - SWAP (p[1], p[6]); - SWAP (p[2], p[5]); - SWAP (p[3], p[4]); - p += size; - } - break; - - case 4: - while (nitems--) - { - SWAP (p[0], p[3]); - SWAP (p[1], p[2]); - p += size; - } - break; - - case 2: - while (nitems--) - { - SWAP (p[0], p[1]); - p += size; - } - break; - - case 1: - /* Nothing to do. */ - break; - - default: - fprintf (stderr, "Can't swap a %d-byte item for (un)dumping", (int)size); - exit(1); - } -#endif -} - -@ Mem files consist of |memory_word| items, and we use the following -macros to dump words of different types: - -@d dump_wd(A) { WW=(A); swap_items((char *)&WW,1,sizeof(WW)); (mp->write_binary_file)(mp,mp->mem_file,&WW,sizeof(WW)); } -@d dump_int(A) { int cint=(A); swap_items((char *)&cint,1,sizeof(cint)); (mp->write_binary_file)(mp,mp->mem_file,&cint,sizeof(cint)); } -@d dump_hh(A) { WW.hh=(A); swap_items((char *)&WW,1,sizeof(WW)); (mp->write_binary_file)(mp,mp->mem_file,&WW,sizeof(WW)); } -@d dump_qqqq(A) { WW.qqqq=(A); swap_items((char *)&WW,1,sizeof(WW)); (mp->write_binary_file)(mp,mp->mem_file,&WW,sizeof(WW)); } -@d dump_string(A) { dump_int((int)(strlen(A)+1)); - (mp->write_binary_file)(mp,mp->mem_file,A,strlen(A)+1); } - -@ The inverse macros are slightly more complicated, since we need to check -the range of the values we are reading in. We say `|undump(a)(b)(x)|' to -read an integer value |x| that is supposed to be in the range |a<=x<=b|. - -@d mgeti(A) do { - size_t wanted = sizeof(A); - void *A_ptr = &A; - (mp->read_binary_file)(mp, mp->mem_file,&A_ptr,&wanted); - if (wanted!=sizeof(A)) goto OFF_BASE; - swap_items(A_ptr,1,wanted); -} while (0) - -@d mgetw(A) do { - size_t wanted = sizeof(A); - void *A_ptr = &A; - (mp->read_binary_file)(mp, mp->mem_file,&A_ptr,&wanted); - if (wanted!=sizeof(A)) goto OFF_BASE; - swap_items(A_ptr,1,wanted); -} while (0) - -@d undump_wd(A) { mgetw(WW); A=WW; } -@d undump_int(A) { int cint; mgeti(cint); A=cint; } -@d undump_hh(A) { mgetw(WW); A=WW.hh; } -@d undump_qqqq(A) { mgetw(WW); A=WW.qqqq; } -@d undump_strings(A,B,C) { - undump_int(x); if ( (x<(A)) || (x>(B)) ) goto OFF_BASE; else C=str(x); } -@d undump(A,B,C) { undump_int(x); - if ( (x<(A)) || (x>(int)(B)) ) goto OFF_BASE; else C=x; } -@d undump_size(A,B,C,D) { undump_int(x); - if (x<(A)) goto OFF_BASE; - if (x>(B)) too_small((C)); else D=x; } -@d undump_string(A) { - size_t the_wanted; - void *the_string; - integer XX=0; - undump_int(XX); - the_wanted = (size_t)XX; - the_string = mp_xmalloc(mp,(size_t)XX,1); - (mp->read_binary_file)(mp,mp->mem_file,&the_string,&the_wanted); - A = (char *)the_string; - if (the_wanted!=(size_t)XX) goto OFF_BASE; -} - -@ The next few sections of the program should make it clear how we use the -dump/undump macros. - -@= -x = metapost_magic; dump_int(x); -dump_int(mp->mem_top); -dump_int((integer)mp->hash_size); -dump_int(mp->hash_prime) -dump_int(mp->param_size); -dump_int(mp->max_in_open); - -@ Sections of a \.{WEB} program that are ``commented out'' still contribute -strings to the string pool; therefore \.{INIMP} and \MP\ will have -the same strings. (And it is, of course, a good thing that they do.) -@.WEB@> -@^string pool@> - -@(mpmemio.h@>= -extern int mp_undump_constants (MP mp); - -@ @c -int mp_undump_constants (MP mp) { - integer x; - undump_int(x); - if (x!=metapost_magic) return x; - undump_int(x); mp->mem_top = x; - undump_int(x); mp->hash_size = (unsigned)x; - undump_int(x); mp->hash_prime = x; - undump_int(x); mp->param_size = x; - undump_int(x); mp->max_in_open = x; - return metapost_magic; - OFF_BASE: - return -1; -} - -@ We do string pool compaction to avoid dumping unused strings. - -@d dump_four_ASCII - w.b0=qi(mp->str_pool[k]); w.b1=qi(mp->str_pool[k+1]); - w.b2=qi(mp->str_pool[k+2]); w.b3=qi(mp->str_pool[k+3]); - dump_qqqq(w) - -@= -mp_do_compaction(mp, mp->pool_size); -dump_int(mp->pool_ptr); -dump_int(mp->max_str_ptr); -dump_int(mp->str_ptr); -k=0; -while ( (mp->next_str[k]==k+1) && (k<=mp->max_str_ptr) ) - k++; -dump_int(k); -while ( k<=mp->max_str_ptr ) { - dump_int(mp->next_str[k]); incr(k); -} -k=0; -while (1) { - dump_int(mp->str_start[k]); /* TODO: valgrind warning here */ - if ( k==mp->str_ptr ) { - break; - } else { - k=mp->next_str[k]; - } -} -k=0; -while (k+4pool_ptr ) { - dump_four_ASCII; k=k+4; -} -k=mp->pool_ptr-4; dump_four_ASCII; -mp_print_ln(mp); mp_print(mp, "at most "); mp_print_int(mp, mp->max_str_ptr); -mp_print(mp, " strings of total length "); -mp_print_int(mp, mp->pool_ptr) - -@ @d undump_four_ASCII - undump_qqqq(w); - mp->str_pool[k]=(ASCII_code)qo(w.b0); mp->str_pool[k+1]=(ASCII_code)qo(w.b1); - mp->str_pool[k+2]=(ASCII_code)qo(w.b2); mp->str_pool[k+3]=(ASCII_code)qo(w.b3) - -@= -undump_int(mp->pool_ptr); -mp_reallocate_pool(mp, mp->pool_ptr) ; -undump_int(mp->max_str_ptr); -mp_reallocate_strings (mp,mp->max_str_ptr) ; -undump(0,mp->max_str_ptr,mp->str_ptr); -undump(0,mp->max_str_ptr+1,s); -for (k=0;k<=s-1;k++) - mp->next_str[k]=k+1; -for (k=s;k<=mp->max_str_ptr;k++) - undump(s+1,mp->max_str_ptr+1,mp->next_str[k]); -mp->fixed_str_use=0; -k=0; -while (1) { - undump(0,mp->pool_ptr,mp->str_start[k]); - if ( k==mp->str_ptr ) break; - mp->str_ref[k]=max_str_ref; - incr(mp->fixed_str_use); - mp->last_fixed_str=k; k=mp->next_str[k]; -} -k=0; -while ( k+4pool_ptr ) { - undump_four_ASCII; k=k+4; -} -k=mp->pool_ptr-4; undump_four_ASCII; -mp->init_str_use=mp->fixed_str_use; mp->init_pool_ptr=mp->pool_ptr; -mp->max_pool_ptr=mp->pool_ptr; -mp->strs_used_up=mp->fixed_str_use; -mp->pool_in_use=mp->str_start[mp->str_ptr]; mp->strs_in_use=mp->fixed_str_use; -mp->max_pl_used=mp->pool_in_use; mp->max_strs_used=mp->strs_in_use; -mp->pact_count=0; mp->pact_chars=0; mp->pact_strs=0; - -@ By sorting the list of available spaces in the variable-size portion of -|mem|, we are usually able to get by without having to dump very much -of the dynamic memory. - -We recompute |var_used| and |dyn_used|, so that \.{INIMP} dumps valid -information even when it has not been gathering statistics. - -@= -mp_sort_avail(mp); mp->var_used=0; -dump_int(mp->lo_mem_max); dump_int(mp->rover); -p=0; q=mp->rover; x=0; -do { - for (k=p;k<= q+1;k++) - dump_wd(mp->mem[k]); - x=x+q+2-p; mp->var_used=mp->var_used+q-p; - p=q+node_size(q); q=rmp_link(q); -} while (q!=mp->rover); -mp->var_used=mp->var_used+mp->lo_mem_max-p; -mp->dyn_used=mp->mem_end+1-mp->hi_mem_min; -for (k=p;k<= mp->lo_mem_max;k++ ) - dump_wd(mp->mem[k]); -x=x+mp->lo_mem_max+1-p; -dump_int(mp->hi_mem_min); dump_int(mp->avail); -for (k=mp->hi_mem_min;k<=mp->mem_end;k++ ) - dump_wd(mp->mem[k]); -x=x+mp->mem_end+1-mp->hi_mem_min; -p=mp->avail; -while ( p!=null ) { - decr(mp->dyn_used); p=mp_link(p); -} -dump_int(mp->var_used); dump_int(mp->dyn_used); -mp_print_ln(mp); mp_print_int(mp, x); -mp_print(mp, " memory locations dumped; current usage is "); -mp_print_int(mp, mp->var_used); mp_print_char(mp, xord('&')); mp_print_int(mp, mp->dyn_used) - -@ @= -undump(lo_mem_stat_max+1000,hi_mem_stat_min-1,mp->lo_mem_max); -undump(lo_mem_stat_max+1,mp->lo_mem_max,mp->rover); -p=0; q=mp->rover; -do { - for (k=p;k<= q+1; k++) - undump_wd(mp->mem[k]); - p=q+node_size(q); - if ( (p>mp->lo_mem_max)||((q>=rmp_link(q))&&(rmp_link(q)!=mp->rover)) ) - goto OFF_BASE; - q=rmp_link(q); -} while (q!=mp->rover); -for (k=p;k<=mp->lo_mem_max;k++ ) - undump_wd(mp->mem[k]); -undump(mp->lo_mem_max+1,hi_mem_stat_min,mp->hi_mem_min); -undump(null,mp->mem_top,mp->avail); mp->mem_end=mp->mem_top; -mp->last_pending=spec_head; -for (k=mp->hi_mem_min;k<= mp->mem_end;k++) - undump_wd(mp->mem[k]); -undump_int(mp->var_used); undump_int(mp->dyn_used) - -@ A different scheme is used to compress the hash table, since its lower region -is usually sparse. When |text(p)<>0| for |p<=hash_used|, we output three -words: |p|, |hash[p]|, and |eqtb[p]|. The hash table is, of course, densely -packed for |p>=hash_used|, so the remaining entries are output in~a~block. - -@= -dump_int(mp->hash_used); -mp->st_count=frozen_inaccessible-1-mp->hash_used; -for (p=1;p<=mp->hash_used;p++) { - if ( text(p)!=0 ) { - dump_int(p); dump_hh(mp->hash[p]); dump_hh(mp->eqtb[p]); incr(mp->st_count); - } -} -for (p=mp->hash_used+1;p<=(int)hash_end;p++) { - dump_hh(mp->hash[p]); dump_hh(mp->eqtb[p]); -} -dump_int(mp->st_count); -mp_print_ln(mp); mp_print_int(mp, mp->st_count); mp_print(mp, " symbolic tokens") - -@ @= -undump(1,frozen_inaccessible,mp->hash_used); -p=0; -do { - undump(p+1,mp->hash_used,p); - undump_hh(mp->hash[p]); undump_hh(mp->eqtb[p]); -} while (p!=mp->hash_used); -for (p=mp->hash_used+1;p<=(int)hash_end;p++ ) { - undump_hh(mp->hash[p]); undump_hh(mp->eqtb[p]); -} -undump_int(mp->st_count) - -@ We have already printed a lot of statistics, so we set |mp_tracing_stats:=0| -to prevent them appearing again. - -@= -dump_int(mp->max_internal); -dump_int(mp->int_ptr); -for (k=1;k<= mp->int_ptr;k++ ) { - dump_int(mp->internal[k]); - dump_int(mp->int_type[k]); - dump_string(mp->int_name[k]); -} -dump_int(mp->start_sym); -dump_int(mp->interaction); -dump_string(mp->mem_ident); -dump_int(mp->bg_loc); dump_int(mp->eg_loc); dump_int(mp->serial_no); dump_int(69073); -mp->internal[mp_tracing_stats]=0 - -@ @= -undump_int(x); -if (x>mp->max_internal) mp_grow_internals(mp,x); -undump_int(mp->int_ptr); -for (k=1;k<= mp->int_ptr;k++) { - undump_int(mp->internal[k]); - undump_int(mp->int_type[k]); - undump_string(mp->int_name[k]); -} -undump(0,frozen_inaccessible,mp->start_sym); -if (mp->interaction==mp_unspecified_mode) { - undump(mp_unspecified_mode,mp_error_stop_mode,mp->interaction); -} else { - undump(mp_unspecified_mode,mp_error_stop_mode,x); -} -undump_string(mp->mem_ident); -undump(1,hash_end,mp->bg_loc); -undump(1,hash_end,mp->eg_loc); -undump_int(mp->serial_no); -undump_int(x); -if (x!=69073) goto OFF_BASE - -@ @= -{ - char *tmp = mp_xmalloc(mp,11,1); - mp_xfree(mp->mem_ident); - mp->mem_ident = mp_xmalloc(mp,256,1); - mp_snprintf(tmp,11,"%04d.%02d.%02d", - (int)mp_round_unscaled(mp, mp->internal[mp_year]), - (int)mp_round_unscaled(mp, mp->internal[mp_month]), - (int)mp_round_unscaled(mp, mp->internal[mp_day])); - mp_snprintf(mp->mem_ident,256," (mem=%s %s)",mp->job_name, tmp); - mp_xfree(tmp); - mp_pack_job_name(mp, ".mem"); - while (! mp_w_open_out(mp, &mp->mem_file) ) - mp_prompt_file_name(mp, "mem file name", ".mem"); - mp_print_nl(mp, "Beginning to dump on file "); -@.Beginning to dump...@> - mp_print(mp, mp->name_of_file); - mp_print_nl(mp, mp->mem_ident); -} - -@ @= -(mp->close_file)(mp,mp->mem_file) diff --git a/Build/source/texk/web2c/mplibdir/mp.w b/Build/source/texk/web2c/mplibdir/mp.w index a5a58af697e..ae88e33eb47 100644 --- a/Build/source/texk/web2c/mplibdir/mp.w +++ b/Build/source/texk/web2c/mplibdir/mp.w @@ -1,4 +1,4 @@ -% $Id: mp.w 1242 2010-05-31 08:18:21Z taco $ +% $Id: mp.w 1429 2010-10-21 13:59:22Z taco $ % % Copyright 2008-2009 Taco Hoekwater. % @@ -30,7 +30,6 @@ \font\logos=logosl10 \def\MF{{\tenlogo META}\-{\tenlogo FONT}} \def\MP{{\tenlogo META}\-{\tenlogo POST}} -\def\[#1]{\ignorespaces} % left over from pascal web \def\<#1>{$\langle#1\rangle$} \def\section{\mathhexbox278} \let\swap=\leftrightarrow @@ -44,7 +43,7 @@ \pdfoutput=1 \pageno=3 -@* \[1] Introduction. +@* Introduction. This is \MP\ by John Hobby, a graphics-language processor based on D. E. Knuth's \MF. @@ -89,14 +88,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.211" /* printed when \MP\ starts */ +@d default_banner "This is MetaPost, Version 1.503" /* printed when \MP\ starts */ @d true 1 @d false 0 @(mpmp.h@>= -#define metapost_version "1.211" -#define metapost_magic (('M'*256) + 'P')*65536 + 1211 -#define metapost_old_magic (('M'*256) + 'P')*65536 + 1080 +#define metapost_version "1.503" @ The external library header for \MP\ is |mplib.h|. It contains a few typedefs and the header defintions for the externally used @@ -107,12 +104,13 @@ The most important of the typedefs is the definition of the structure large |MP_instance| structure. @(mplib.h@>= -typedef struct MP_instance * MP; -@ +typedef struct MP_instance *MP; +@; typedef struct MP_options { @