summaryrefslogtreecommitdiff
path: root/Build/source/texk/web2c/mpware
diff options
context:
space:
mode:
authorTaco Hoekwater <taco@elvenkind.com>2007-11-28 22:38:47 +0000
committerTaco Hoekwater <taco@elvenkind.com>2007-11-28 22:38:47 +0000
commit068f23e738bb4d158c6e5986cb24ea6bddcee0eb (patch)
treebde51f1a1de612c002e6d9eaac407fd789ea9a1f /Build/source/texk/web2c/mpware
parentefd2ea1905cc57421e4d5b3123797164601993a4 (diff)
MetaPost version 1.002
git-svn-id: svn://tug.org/texlive/trunk@5639 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build/source/texk/web2c/mpware')
-rw-r--r--Build/source/texk/web2c/mpware/dmp.c4
-rw-r--r--Build/source/texk/web2c/mpware/makempx.c2
-rw-r--r--Build/source/texk/web2c/mpware/mpto.c51
-rw-r--r--Build/source/texk/web2c/mpware/newer.c2
4 files changed, 35 insertions, 24 deletions
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);