mgp-snap-20190520.tar.gz (last upstream version) mgp-1.13a.20190520
authormirabilos <t.glaser@tarent.de>
Wed, 22 May 2019 18:54:14 +0000 (20:54 +0200)
committermirabilos <mirabilos@evolvis.org>
Wed, 22 May 2019 18:54:14 +0000 (20:54 +0200)
upstream’s dead now; last change was 20180604

17 files changed:
Imakefile.in
bigarrow [new file with mode: 0644]
bigarrow1 [new file with mode: 0644]
configure
configure.in
contrib/Imakefile.in [moved from contrib/Imakefile with 91% similarity]
contrib/xwintoppm/Imakefile.in [moved from contrib/xwintoppm/Imakefile with 95% similarity]
draw.c
globals.c
grammar.y
image/imlib_loader.c
js.c [new file with mode: 0644]
mgp.h
parse.c
plist.c
sample/Imakefile.in
scanner.l

index 4e0f58c..9dbcc06 100644 (file)
@@ -1,4 +1,4 @@
-# $Id: Imakefile.in,v 1.54 2007/12/03 09:08:40 nishida Exp $
+# $Id: Imakefile.in,v 1.56 2009/05/04 07:36:47 nishida Exp $
 
 @SET_MAKE@
 srcdir=        @srcdir@
@@ -10,7 +10,11 @@ TPOBJS=      mgp.o draw.o parse.o plist.o globals.o x11.o font.o background.o \
        scanner.o grammar.o postscript.o tfont.o embed.o unimap.o mng.o m17n.o
 PROBJS=        print.o parse.o globals.o x11dummy.o scanner.o grammar.o postscript.o \
        embed.o 
+JSOBJS=        js.o parse.o globals.o x11dummy.o scanner.o grammar.o postscript.o \
+       embed.o 
 LIBOBJS=       @LIBOBJS@
+DESTDIR=@prefix@
+BINDIR=/bin/
 OBJS=  ${TPOBJ} ${PROBJS} ${LIBOBJS}
 LIBS=  $(srcdir)/image/libmgpimage.a
 AWK=   @AWK@
@@ -40,6 +44,7 @@ DependTarget()
 
 NormalProgramTarget(mgp,$(TPOBJS) $(LIBOBJS), $(LIBS) $(EXTRA_DEPLIBS), NullParameter,$(XLIB))
 NormalProgramTarget(mgp2ps,$(PROBJS) $(LIBOBJS), $(LIBS) $(EXTRA_DEPLIBS), NullParameter,$(XLIB))
+NormalProgramTarget(mgp2js,$(JSOBJS) $(LIBOBJS), $(LIBS) $(EXTRA_DEPLIBS), NullParameter,$(XLIB))
 
 InstallProgram(mgp,$(BINDIR))
 InstallProgram(mgp2ps,$(BINDIR))
diff --git a/bigarrow b/bigarrow
new file mode 100644 (file)
index 0000000..1acbff3
--- /dev/null
+++ b/bigarrow
@@ -0,0 +1,27 @@
+#define bigarrow_width 48
+#define bigarrow_height 48
+static unsigned char bigarrow_bits[] = {
+   0xff, 0xff, 0xff, 0xff, 0x0f, 0x00, 0xff, 0xff, 0xff, 0xff, 0x07, 0x00,
+   0xff, 0xff, 0xff, 0xff, 0x03, 0x00, 0xff, 0xff, 0xff, 0xff, 0x01, 0x00,
+   0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0xff, 0xff, 0xff, 0x7f, 0x00, 0x00,
+   0xff, 0xff, 0xff, 0x3f, 0x00, 0x00, 0xff, 0xff, 0xff, 0x1f, 0x00, 0x00,
+   0xff, 0xff, 0xff, 0x0f, 0x00, 0x00, 0xff, 0xff, 0xff, 0x07, 0x00, 0x00,
+   0xff, 0xff, 0xff, 0x03, 0x00, 0x00, 0xff, 0xff, 0xff, 0x01, 0x00, 0x00,
+   0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0x01, 0x00, 0x00,
+   0xff, 0xff, 0xff, 0x03, 0x00, 0x00, 0xff, 0xff, 0xff, 0x07, 0x00, 0x00,
+   0xff, 0xff, 0xff, 0x0f, 0x00, 0x00, 0xff, 0xff, 0xff, 0x1f, 0x00, 0x00,
+   0xff, 0xff, 0xff, 0x3f, 0x00, 0x00, 0xff, 0xff, 0xff, 0x7f, 0x00, 0x00,
+   0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0x01, 0x00,
+   0xff, 0xff, 0xff, 0xff, 0x03, 0x00, 0xff, 0xff, 0xff, 0xff, 0x07, 0x00,
+   0xff, 0xef, 0xff, 0xff, 0x0f, 0x00, 0xff, 0xc7, 0xff, 0xff, 0x1f, 0x00,
+   0xff, 0x83, 0xff, 0xff, 0x3f, 0x00, 0xff, 0x01, 0xff, 0xff, 0x7f, 0x00,
+   0xff, 0x00, 0xfe, 0xff, 0xff, 0x00, 0x7f, 0x00, 0xfc, 0xff, 0xff, 0x01,
+   0x3f, 0x00, 0xf8, 0xff, 0xff, 0x03, 0x1f, 0x00, 0xf0, 0xff, 0xff, 0x07,
+   0x0f, 0x00, 0xe0, 0xff, 0xff, 0x0f, 0x07, 0x00, 0xc0, 0xff, 0xff, 0x1f,
+   0x03, 0x00, 0x80, 0xff, 0xff, 0x3f, 0x01, 0x00, 0x00, 0xff, 0xff, 0x7f,
+   0x00, 0x00, 0x00, 0xfe, 0xff, 0xff, 0x00, 0x00, 0x00, 0xfc, 0xff, 0xff,
+   0x00, 0x00, 0x00, 0xf8, 0xff, 0x7f, 0x00, 0x00, 0x00, 0xf0, 0xff, 0x3f,
+   0x00, 0x00, 0x00, 0xe0, 0xff, 0x1f, 0x00, 0x00, 0x00, 0xc0, 0xff, 0x0f,
+   0x00, 0x00, 0x00, 0x80, 0xff, 0x07, 0x00, 0x00, 0x00, 0x00, 0xff, 0x03,
+   0x00, 0x00, 0x00, 0x00, 0xfe, 0x01, 0x00, 0x00, 0x00, 0x00, 0xfc, 0x00,
+   0x00, 0x00, 0x00, 0x00, 0x78, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0x00};
diff --git a/bigarrow1 b/bigarrow1
new file mode 100644 (file)
index 0000000..e3cb49b
--- /dev/null
+++ b/bigarrow1
@@ -0,0 +1,29 @@
+#define bigarrow1_width 48
+#define bigarrow1_height 48
+#define bigarrow1_x_hot 1
+#define bigarrow1_y_hot 1
+static unsigned char bigarrow1_bits[] = {
+   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfe, 0xff, 0xff, 0xff, 0x03, 0x00,
+   0xfe, 0xff, 0xff, 0xff, 0x01, 0x00, 0xfe, 0xff, 0xff, 0xff, 0x00, 0x00,
+   0xfe, 0xff, 0xff, 0x7f, 0x00, 0x00, 0xfe, 0xff, 0xff, 0x3f, 0x00, 0x00,
+   0xfe, 0xff, 0xff, 0x1f, 0x00, 0x00, 0xfe, 0xff, 0xff, 0x0f, 0x00, 0x00,
+   0xfe, 0xff, 0xff, 0x07, 0x00, 0x00, 0xfe, 0xff, 0xff, 0x03, 0x00, 0x00,
+   0xfe, 0xff, 0xff, 0x01, 0x00, 0x00, 0xfe, 0xff, 0xff, 0x00, 0x00, 0x00,
+   0xfe, 0xff, 0x7f, 0x00, 0x00, 0x00, 0xfe, 0xff, 0xff, 0x00, 0x00, 0x00,
+   0xfe, 0xff, 0xff, 0x01, 0x00, 0x00, 0xfe, 0xff, 0xff, 0x03, 0x00, 0x00,
+   0xfe, 0xff, 0xff, 0x07, 0x00, 0x00, 0xfe, 0xff, 0xff, 0x0f, 0x00, 0x00,
+   0xfe, 0xff, 0xff, 0x1f, 0x00, 0x00, 0xfe, 0xff, 0xff, 0x3f, 0x00, 0x00,
+   0xfe, 0xff, 0xff, 0x7f, 0x00, 0x00, 0xfe, 0xff, 0xff, 0xff, 0x00, 0x00,
+   0xfe, 0xff, 0xff, 0xff, 0x01, 0x00, 0xfe, 0xef, 0xff, 0xff, 0x03, 0x00,
+   0xfe, 0xc7, 0xff, 0xff, 0x07, 0x00, 0xfe, 0x83, 0xff, 0xff, 0x0f, 0x00,
+   0xfe, 0x01, 0xff, 0xff, 0x1f, 0x00, 0xfe, 0x00, 0xfe, 0xff, 0x3f, 0x00,
+   0x7e, 0x00, 0xfc, 0xff, 0x7f, 0x00, 0x3e, 0x00, 0xf8, 0xff, 0xff, 0x00,
+   0x1e, 0x00, 0xf0, 0xff, 0xff, 0x01, 0x0e, 0x00, 0xe0, 0xff, 0xff, 0x03,
+   0x06, 0x00, 0xc0, 0xff, 0xff, 0x07, 0x02, 0x00, 0x80, 0xff, 0xff, 0x0f,
+   0x00, 0x00, 0x00, 0xff, 0xff, 0x1f, 0x00, 0x00, 0x00, 0xfe, 0xff, 0x3f,
+   0x00, 0x00, 0x00, 0xfc, 0xff, 0x7f, 0x00, 0x00, 0x00, 0xf8, 0xff, 0x7f,
+   0x00, 0x00, 0x00, 0xf0, 0xff, 0x3f, 0x00, 0x00, 0x00, 0xe0, 0xff, 0x1f,
+   0x00, 0x00, 0x00, 0xc0, 0xff, 0x0f, 0x00, 0x00, 0x00, 0x80, 0xff, 0x07,
+   0x00, 0x00, 0x00, 0x00, 0xff, 0x03, 0x00, 0x00, 0x00, 0x00, 0xfe, 0x01,
+   0x00, 0x00, 0x00, 0x00, 0xfc, 0x00, 0x00, 0x00, 0x00, 0x00, 0x78, 0x00,
+   0x00, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
index 6a0fbc8..1d74b37 100755 (executable)
--- a/configure
+++ b/configure
@@ -3551,6 +3551,10 @@ done
 test -n "$mgp_cv_path_gunzip" || mgp_cv_path_gunzip="no"
 
 
+if test "X$prefix" = "XNONE"; then
+    $prefix = ac_default_prefix
+fi
+
 OPTFLAGS=
 
 DEPLIBS=
@@ -7442,7 +7446,7 @@ fi
 mgp_keywords=`$mgp_cv_path_perl $srcdir/keywords.pl $srcdir/globals.c`
 
 
-ac_config_files="$ac_config_files Imakefile image/Imakefile sample/Imakefile contrib/mgp2html.pl contrib/mgp2latex.pl contrib/mgpnet mgpembed.pl"
+ac_config_files="$ac_config_files Imakefile image/Imakefile sample/Imakefile contrib/Imakefile contrib/xwintoppm/Imakefile contrib/mgp2html.pl contrib/mgp2latex.pl contrib/mgpnet mgpembed.pl"
 
 cat >confcache <<\_ACEOF
 # This file is a shell script that caches the results of configure
@@ -8014,6 +8018,8 @@ do
     "Imakefile") CONFIG_FILES="$CONFIG_FILES Imakefile" ;;
     "image/Imakefile") CONFIG_FILES="$CONFIG_FILES image/Imakefile" ;;
     "sample/Imakefile") CONFIG_FILES="$CONFIG_FILES sample/Imakefile" ;;
+    "contrib/Imakefile") CONFIG_FILES="$CONFIG_FILES contrib/Imakefile" ;;
+    "contrib/xwintoppm/Imakefile") CONFIG_FILES="$CONFIG_FILES contrib/xwintoppm/Imakefile" ;;
     "contrib/mgp2html.pl") CONFIG_FILES="$CONFIG_FILES contrib/mgp2html.pl" ;;
     "contrib/mgp2latex.pl") CONFIG_FILES="$CONFIG_FILES contrib/mgp2latex.pl" ;;
     "contrib/mgpnet") CONFIG_FILES="$CONFIG_FILES contrib/mgpnet" ;;
index 9e30565..d9fec44 100644 (file)
@@ -3,7 +3,7 @@ dnl This 'configure' and 'Imakefile.in' are written to be directory
 dnl independent (using srcdir), however, xmkmf and Imake.tmpl do not
 dnl allow us to switch compilation directory.
 dnl
-dnl $Id: configure.in,v 1.105 2009/02/15 11:35:19 nishida Exp $
+dnl $Id: configure.in,v 1.106 2009/05/04 07:36:47 nishida Exp $
 AC_INIT(image/imagetypes.c)
 
 dnl Checks for programs.
@@ -25,6 +25,10 @@ AC_SUBST(mgp_cv_path_gzip)
 AC_PATH_PROGS(mgp_cv_path_uudecode, uudecode, no)
 AC_PATH_PROGS(mgp_cv_path_gunzip, gunzip, no)
 
+if test "X$prefix" = "XNONE"; then
+    $prefix = ac_default_prefix
+fi
+
 OPTFLAGS=
 AC_SUBST(OPTFLAGS)
 DEPLIBS=
@@ -510,7 +514,7 @@ dnl keyword substitution.
 mgp_keywords=`$mgp_cv_path_perl $srcdir/keywords.pl $srcdir/globals.c`
 AC_SUBST(mgp_keywords)
  
-AC_OUTPUT(Imakefile image/Imakefile sample/Imakefile
+AC_OUTPUT(Imakefile image/Imakefile sample/Imakefile contrib/Imakefile contrib/xwintoppm/Imakefile
        contrib/mgp2html.pl contrib/mgp2latex.pl contrib/mgpnet mgpembed.pl)
 
 /bin/rm -f Makefile image/Makefile
similarity index 91%
rename from contrib/Imakefile
rename to contrib/Imakefile.in
index 37c5047..cba8948 100644 (file)
@@ -1,7 +1,9 @@
 #define IHaveSubdirs
 #define PassCDebugFlags
 
-SUBDIRS=       xwintoppm
+DESTDIR=@prefix@
+BINDIR=/bin/
+SUBDIRS=xwintoppm
 
 MakeSubdirs($(SUBDIRS))
 
similarity index 95%
rename from contrib/xwintoppm/Imakefile
rename to contrib/xwintoppm/Imakefile.in
index 6e80215..43a4886 100644 (file)
@@ -1,5 +1,7 @@
 XCOMM $XConsortium: Imakefile /main/9 1996/01/14 16:53:10 kaleb $
 #if defined(ImakeConfigRelease) && ImakeConfigRelease >= 6
+DESTDIR=@prefix@
+BINDIR=/bin/
 /* obeys original xwd */
         DEPLIBS = $(DEPXMULIB) $(DEPXLIB)
 LOCAL_LIBRARIES = $(XMULIB) $(XLIB)
diff --git a/draw.c b/draw.c
index 3f27a6a..4b65038 100644 (file)
--- a/draw.c
+++ b/draw.c
@@ -26,7 +26,7 @@
  * SUCH DAMAGE.
  */
 /*
- * $Id: draw.c,v 1.246 2009/02/15 11:35:19 nishida Exp $
+ * $Id: draw.c,v 1.250 2012/10/14 18:25:10 nishida Exp $
  */
 
 #include "mgp.h"
@@ -898,6 +898,7 @@ process_direc(state, seenpause)
 
        case CTL_NOOP:
        case CTL_NODEF:
+       case CTL_TITLE:
                break;
 
        case CTL_XFONT:
@@ -3505,7 +3506,7 @@ image_load_ps(state, filename, numcolor, ximagesize, yimagesize, backflag, zoomf
        if (strncmp(p, ".gscache", sizeof(".gscache") - 1) != 0)
                unlink(imagefile);
 
-       if (!backflag)
+       if (!backflag && numcolor >= 0)
                image_setcolor(state);
 }
 
@@ -5318,6 +5319,7 @@ xft_draw_fragment(state, p, len, registry, charset16)
                        return p;
                }
 
+#ifndef USE_XFT2
                for (i = 2; i < len; i ++){
                        XftTextExtents8(display, xft_font, (XftChar8 *)p, len -i, &extents);
                        if (state->width - state->leftfillpos / 2 - state->linewidth >= extents.xOff){
@@ -5334,6 +5336,12 @@ xft_draw_fragment(state, p, len, registry, charset16)
                        return p +len;
                } else 
                        return NULL;
+#else
+               draw_line_end(state); 
+               draw_line_start(state);
+               state->linewidth = state->leftfillpos;
+               return p;
+#endif
        }
 
 nofolding:
@@ -5471,12 +5479,12 @@ xft_setfont(xfontarg, csize, registry)
                    XFT_FAMILY, XftTypeString, font,
                    XFT_ENCODING, XftTypeString, registry,
                    XFT_STYLE, XftTypeString, style,
-                   XFT_PIXEL_SIZE, XftTypeDouble, (float)csize, 0);
+                   XFT_PIXEL_SIZE, XftTypeDouble, (float)csize, NULL);
        } else {
                xftfont = XftFontOpen(display, screen,
                    XFT_FAMILY, XftTypeString, font,
                    XFT_ENCODING, XftTypeString, registry,
-                   XFT_PIXEL_SIZE, XftTypeDouble, (float)csize, 0);
+                   XFT_PIXEL_SIZE, XftTypeDouble, (float)csize, NULL);
        }
        if (xftfont == 0) {
                free(xfont);
@@ -5602,7 +5610,7 @@ zoomin_zimage(id)
                h = w * xyratio+1;
                x = zx[id] + xstep * i;
                y = zy[id] + ystep * i;
-               pixmap = pixmap_fromimimage(zimage[id], w, h); 
+               pixmap = pixmap_fromimimage(zimage[id], w, h, window); 
                manage_pixmap(pixmap, 1, zpage[id]);
                if (i > 0) clear_region(id, i-1, i, 0); 
                XCopyArea(display, pixmap, window, gcfore, 0,0, w, h, x, y); 
@@ -5633,7 +5641,7 @@ zoomout_zimage(id)
                h = w * xyratio+1;
                x = zx[id] + xstep * i;
                y = zy[id] + ystep * i;
-               pixmap = pixmap_fromimimage(zimage[id], w, h); 
+               pixmap = pixmap_fromimimage(zimage[id], w, h, window); 
                manage_pixmap(pixmap, 1, zpage[id]);
                if (i < ratio) clear_region(id, i+1, i, 0);
                XCopyArea(display, pixmap, window, gcfore, 0, 0, w, h, x, y); 
index 3b9cf80..a8df58a 100644 (file)
--- a/globals.c
+++ b/globals.c
@@ -26,7 +26,7 @@
  * SUCH DAMAGE.
  */
 /*
- * $Id: globals.c,v 1.52 2007/11/24 17:47:28 nishida Exp $
+ * $Id: globals.c,v 1.53 2010/05/03 22:28:00 nishida Exp $
  */
 
 #include "mgp.h"
@@ -162,5 +162,6 @@ const struct ctl_words ctl_words[] = {
 /*CTL*/        { CTL_SUB,              T_VOID, "sub", 3 },
 /*CTL*/        { CTL_SETSUP,           T_INT,  "setsup", 6 },
 /*CTL*/        { CTL_M17N,             T_STR2, "m17n", 4 },
+/*CTL*/        { CTL_TITLE,            T_STR,  "title", 5 },
        { 0, 0, NULL, 0 },
 };
index 32e075f..63b95de 100644 (file)
--- a/grammar.y
+++ b/grammar.y
@@ -27,7 +27,7 @@
  * SUCH DAMAGE.
  */
 /*
- * $Id: grammar.y,v 1.50 2008/01/18 17:43:20 nishida Exp $
+ * $Id: grammar.y,v 1.51 2010/05/03 22:28:00 nishida Exp $
  */
 /*
  * partly derived from lbl libpcap source code, which has the following
@@ -788,6 +788,7 @@ pcap_parse()
 %token KW_OPAQUE
 %token KW_SUP KW_SUB KW_SETSUP
 %token KW_M17N
+%token KW_TITLE
 
 %type <ct> toplevel
 %type <ct> line defaultline tabline shellline deffontline
@@ -1037,6 +1038,7 @@ cmd:        KW_NOOP       { $$ = gen_void(CTL_NOOP); }
 #endif
                        }
        | KW_FONT STR   { $$ = gen_str(CTL_FONT, $2); }
+       | KW_TITLE STR  { $$ = gen_str(CTL_TITLE, $2); }
        | KW_TEXT STR   { $$ = gen_str(CTL_TEXT, $2); } /*easter egg*/
        | KW_CHARSET STR        { $$ = gen_str(CTL_CHARSET, $2); }
        | KW_AREA NUM NUM { $$ = gen_area($2, $3, -1, -1); }
index 866633f..20950c0 100644 (file)
@@ -132,15 +132,18 @@ void regist_imdata(fullname, im, image)
        imnum ++;
 }
 
-Pixmap pixmap_fromimimage(imimage, width, height)
+Pixmap pixmap_fromimimage(imimage, width, height, window)
        Imlib_Image *imimage;
        int width, height;
+       Window window; 
 {
-       static Pixmap pixmap;
+       static Pixmap pixmap; 
 #if 0
        Imlib_render(id, imimage, width, height);
        pixmap = Imlib_move_image(id, imimage);
 #else
+       imlib_context_set_image (imimage);
+       imlib_context_set_drawable (window);
        imlib_render_pixmaps_for_whole_image_at_size(&pixmap, NULL, width, height);
 #endif
 
diff --git a/js.c b/js.c
new file mode 100644 (file)
index 0000000..8df882b
--- /dev/null
+++ b/js.c
@@ -0,0 +1,389 @@
+/*
+ * Copyright (C) 1997 and 1998 WIDE Project.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the project nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLER
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+/*
+ * $Id: js.c,v 1.1 2009/02/24 09:36:15 nishida Exp $
+ */
+/*
+ * Paper size selection code is based on psutil.c by Angus J. C. Duggan
+ */
+
+#include "mgp.h"
+
+/*------------------------------------------------------------*/
+
+int
+main(argc, argv)
+       int argc;
+       char **argv;
+{
+       u_int opt;
+       extern char *optarg;
+       extern int optind;
+       char *progname;
+       static char pathbuf[MAXPATHLEN];
+
+       progname = argv[0];
+
+       while ((opt = getopt(argc, argv, "mciVrf:x:y:p:e:X:Ptg:")) != -1) {
+               switch (opt) {
+#if 0
+               case 'm':         /* Added by Arnd Schmitter 23.07.2004 */
+                 PauseMode=1;
+                 break;
+               case 'c':
+                       colorps++;
+                       break;
+
+               case 'i':
+                       painticon++;
+                       break;
+
+               case 'f':
+                       strcpy(outputfile, optarg);
+                       break;
+
+               case 'r':
+                       reverse = 1;
+                       break;
+
+               case 'V':
+                       mgp_flag |= FL_VERBOSE;
+                       break;
+
+               case 'x':
+                       paper_xmargin = atoi(optarg);
+                       break;
+
+               case 'y':
+                       paper_ymargin = atoi(optarg);
+                       break;
+
+               case 'p':
+                       paper = findpaper(optarg);
+                       if (!paper) {
+                               fprintf(stderr,
+"Paper size '%s' not recognised. Using %s instead.\n",
+                                       optarg, DEFAULT_PAPER_SIZE);
+                               paper = findpaper(DEFAULT_PAPER_SIZE);
+                       }
+                       break;
+
+               case 'e':
+                       for (encoding = &encodings[0];
+                            encoding->name;
+                            encoding++) {
+                               if (strcmp(encoding->name, optarg) == 0)
+                                       break;
+                       }
+                       if (!encoding->name) {
+                               fprintf(stderr, "unknown encoding %s\n", optarg);
+                               exit(1);
+                       }
+                       break;
+
+               case 'P':
+                       parse_debug++;
+                       break;
+
+               case 't':
+#ifdef FREETYPE
+                       usetfont = 1;
+#else
+                       fprintf(stderr, "you can't use this function with this version\n");
+                       exit(-1);
+#endif
+                       break;
+
+       case 'X':
+                       if (strcmp(optarg, "freetype") == 0)
+                               mgp_flag |= FL_NOFREETYPE;
+                       else {
+                               fprintf(stderr, "unknown rendering engine %s\n", optarg);
+                       }
+                       break;
+
+               case 'g':
+                       gaplevel = atoi(optarg);
+                       break;
+
+               default:
+                       print_usage(progname);
+                       /*NOTREACHED*/
+               }
+#endif
+       }
+
+       argc -= optind;
+       argv += optind;
+
+#if 0
+       if (argc != 1) {
+               print_usage(progname);
+               /*NOTREACHED*/
+       }
+#endif
+
+       mgp_fname = argv[0];
+
+//     init_win1(NULL);
+       load_file(mgp_fname);
+//     init_win2();
+       fore = 0UL;
+       back = (1UL << depth) - 1;
+//     print_out();
+
+       exit(0);
+}
+
+static struct fontmap *
+findfont(ctrl, lang, font)
+       int ctrl;
+       int lang;
+       char *font;
+{
+       struct fontmap *p, *q;
+       char *star;
+
+       if (!font[0])
+               return NULL;
+
+#ifdef FREETYPE
+       if (mgp_flag & FL_NOFREETYPE && ctrl == CTL_TFONT)
+               return NULL;
+       if (lang == ASCII && usetfont)
+               if ((p = findttfont(ctrl, lang, font))) goto found;
+#endif
+
+       for (p = fontmap; 0 <= p->ctrl; p++) {
+               if (p->ctrl != ctrl || p->lang != lang)
+                       continue;
+               star = strchr(p->font, '*');
+               if (!star && strcmp(p->font, font) == 0)
+                       goto found;
+               if (star && strncmp(p->font, font, star - p->font) == 0)
+               {
+                       if(strcmp(font,"k14")==0)
+                               goto found;
+                       if(ctrl ==CTL_PSFONT)
+                               fprintf(stderr,"PSFONT: %s  not found\n",font);  
+                       goto found;
+               }
+       }
+       return NULL;
+
+found:
+       if (p->fontid)
+               return p;
+
+       p->fontid = ++maxfontid;
+
+       if (mgp_flag & FL_VERBOSE) {
+               char fonttype;
+
+               switch (ctrl) {
+#ifdef FREETYPE
+               case CTL_TFONT: fonttype = 't'; break;
+#endif
+#ifdef VFLIB
+               case CTL_VFONT: fonttype = 'v'; break;
+#endif
+#if 0
+               case CTL_XFONT: fonttype = 'x'; break;
+#endif
+               case CTL_XFONT2: fonttype = 'x'; break;
+               
+               case CTL_PSFONT: fonttype = 'p'; break;
+               default:        fonttype = '?'; break;
+               }
+               fprintf(fp, "%% %cfont \"%s\" seen, mapped to ps font \"%s\"\n",
+                       fonttype, font, p->psfont);
+               if (strcmp(font, p->font) != 0) {
+                       fprintf(fp, "%%\t(wildcard match against \"%s\")\n",
+                               p->font);
+               }
+       }
+       /* use the same font index for same PS font names */
+       for (q = fontmap; 0 <= q->ctrl; q++) {
+               if (strcmp(p->psfont, q->psfont) == 0)
+                       q->fontid = maxfontid;
+       }
+
+       return p;
+}
+
+static char *
+fontstring(font)
+       struct fontmap *font;
+{
+       static char fontname[10];
+
+       sprintf(fontname, "F%03d", font->fontid);
+       return fontname;
+}
+
+static void
+loadfont(font, name)
+       struct fontmap *font;
+       char *name;
+{
+       if (!font) {
+               fprintf(stderr, "unable to find proper font for %s\n", name);
+               exit(1);
+       }
+
+       if (font->loaded)
+               return;
+
+       /* define font calling sequence */
+       if (mgp_flag & FL_VERBOSE) {
+               fprintf(fp, "%% loading font \"%s\" for %s\n",
+                       font->psfont, font->font);
+       }
+       if (font->lang == ASCII && encoding) {
+               /*
+                * Symbol font does not need latin1-encoding
+                */
+               if (strcmp(font->psfont, "Symbol") == 0) {
+                       fprintf(fp,
+                               "/%s%s\n"
+                               "       /%s findfont\n"
+                               "               dup length dict begin\n"
+                               "               {1 index /FID ne {def} {pop "
+                               "pop} ifelse} forall\n"
+                               "       currentdict end\n"
+                               "definefont pop\n",
+                               fontstring(font), "t", font->psfont);
+               } else {
+                       fprintf(fp,
+"/%s%s\n"
+"      /%s findfont\n"
+"              dup length dict begin\n"
+"              {1 index /FID ne {def} {pop pop} ifelse} forall\n"
+"              /Encoding %s def\n"
+"      currentdict end\n"
+"definefont pop\n",
+                       fontstring(font), "t", font->psfont, encoding->defstr);
+               }
+
+               fprintf(fp, "/%s {/%s%s findfont exch scalefont setfont} def\n",
+                       fontstring(font), fontstring(font), "t");
+       } else {
+               fprintf(fp, "/%s {/%s findfont exch scalefont setfont} def\n",
+                       fontstring(font), font->psfont);
+       }
+       font->loaded = 1;
+}
+
+void
+cleanup(int sig)
+{
+       /* dummy */
+}
+
+#ifdef FREETYPE
+/* 
+       get fontname from ttffile for ttfps 
+ */
+static struct fontmap *
+findttfont(ctrl, lang, font)
+       int ctrl;
+       int lang;
+       char *font;
+{
+       TT_Error        error;
+       TT_Face         face; 
+       TT_Face_Properties      properties;
+       u_short         platform, encoding, language, id;
+       u_short         string_len;
+       struct          fontmap *pfont;
+       char            *string;
+       char            pathname[256];
+       int                     i, n, found = 0;
+       static TT_Engine        engine;
+       static int      initdone = 0, findex = 0; 
+       static struct fontmap   **loadedfont;
+
+       if (!font) return NULL;
+
+       /* already registed? */
+       for (i = 0; i < findex; i ++){
+               if (!strcmp(font, loadedfont[i]->font)) 
+                       return loadedfont[i];
+       }
+
+       if (!initdone){
+               /* Initialize engine */
+               if ((error = TT_Init_FreeType(&engine))){
+                       fprintf(stderr, "Error while initializing engine, code = %d.\n",
+                               (int)error);
+                               exit(-1);
+               }
+               initdone ++;
+       }
+       error = TT_Open_Face(engine, font, &face);
+       if (error) {
+               /* add freetypefontdir and try again */
+               snprintf(pathname, sizeof(pathname), "%s/%s", freetypefontdir, font);
+               error = TT_Open_Face(engine, pathname, &face);
+               if (error) return NULL;
+       }
+
+       TT_Get_Face_Properties(face, &properties);
+       n = properties.num_Names;
+       for (i = 0; i < n; i++) {
+               TT_Get_Name_ID(face, i, &platform, &encoding, &language, &id);
+               TT_Get_Name_String(face, i, &string, &string_len);
+               /* this check may be weak.. */
+               if (*string && id == 6){
+                       found = 1;
+                       break;
+               }
+       }
+       if (!found) return NULL;
+
+       /* create fontmap */
+       pfont = (struct fontmap *)malloc(sizeof(struct fontmap));
+       pfont->ctrl = ctrl;
+       pfont->lang = lang;
+       pfont->font = font;
+       pfont->psfont = strdup(string);
+       pfont->fontid = 0;
+       pfont->loaded = 0;
+
+       /* regist loaded font */
+       if (!findex)
+               loadedfont = (struct fontmap **)malloc(sizeof(struct fontmap *));
+       else
+               loadedfont = (struct fontmap **)realloc(loadedfont, 
+                                                               sizeof(struct fontmap *) * (findex +1));
+       loadedfont[findex++] = pfont;
+
+       return pfont;
+}
+#endif /* FREETYPE */
+
diff --git a/mgp.h b/mgp.h
index 4d41e17..065b8e8 100644 (file)
--- a/mgp.h
+++ b/mgp.h
@@ -26,7 +26,7 @@
  * SUCH DAMAGE.
  */
 /*
- * $Id: mgp.h,v 1.147 2009/02/18 10:44:30 nishida Exp $
+ * $Id: mgp.h,v 1.148 2010/05/03 22:28:00 nishida Exp $
  */
 
 #include <stdio.h>
@@ -400,6 +400,7 @@ struct page_attribute {
        u_int pg_b_numcolor;    /* background gradation number of colors */
        u_int pg_b_dir;         /* background gradation deg */
        u_int pg_text;          /* this page is text only */
+       char *pg_title_str;     /* a title has been defined */
 };
 extern struct page_attribute page_attribute[MAXPAGE];
 
diff --git a/parse.c b/parse.c
index 3610990..9f146a9 100644 (file)
--- a/parse.c
+++ b/parse.c
@@ -26,7 +26,7 @@
  * SUCH DAMAGE.
  */
 /*
- * $Id: parse.c,v 1.103 2007/11/24 17:35:28 nishida Exp $
+ * $Id: parse.c,v 1.104 2010/05/03 22:28:00 nishida Exp $
  */
 
 #include "mgp.h"
@@ -636,6 +636,10 @@ command:
                                        page_attribute[*page].pg_flag
                                                |= PGFLAG_NODEF;
                                        break;
+                               case CTL_TITLE:
+                                       page_attribute[*page].pg_title_str =
+                                               strdup( cp->ctc_value); 
+                                       break;
                                case CTL_CONT:
                                        ct++;
                                        break;
diff --git a/plist.c b/plist.c
index 8540ddc..fd25477 100644 (file)
--- a/plist.c
+++ b/plist.c
@@ -26,7 +26,7 @@
  * SUCH DAMAGE.
  */
 /*
- * $Id: plist.c,v 1.23 2003/05/19 07:29:45 nishida Exp $
+ * $Id: plist.c,v 1.24 2010/05/03 22:28:00 nishida Exp $
  */
 
 #include "mgp.h"
@@ -171,6 +171,10 @@ page_title(page)
        char *p;
        struct ctrl *cp;
 
+       if( page_attribute[page].pg_title_str && 
+               *page_attribute[page].pg_title_str) {
+               return page_attribute[page].pg_title_str ;
+       } else {
        p = "";
        for (l = 0; l <= page_attribute[page].pg_linenum; l++) {
                cp = page_control[page][l];
@@ -188,6 +192,7 @@ page_title(page)
                p++;
 
        return p;
+       }
 }
 
 void
index a1c928d..ac3902e 100644 (file)
@@ -1,3 +1,5 @@
+DESTDIR=@prefix@
+LIBDIR=/lib
 InstallNonExecFile(default.mgp,$(LIBDIR)/mgp)
 InstallNonExecFile(mgp1.jpg,$(LIBDIR)/mgp)
 InstallNonExecFile(mgp2.jpg,$(LIBDIR)/mgp)
index de279b2..aa06bb0 100644 (file)
--- a/scanner.l
+++ b/scanner.l
@@ -27,7 +27,7 @@
  * SUCH DAMAGE.
  */
 /*
- * $Id: scanner.l,v 1.28 2007/11/24 17:47:28 nishida Exp $
+ * $Id: scanner.l,v 1.29 2010/05/03 22:28:00 nishida Exp $
  */
 /*
  * partly derived from lbl libpcap source code, which has the following
@@ -172,6 +172,7 @@ XSTR        [\240-\377]*
 (SETSUP|setsup)        return KW_SETSUP;
 (M17N|m17n)    return KW_M17N;
 (PSFONT|psfont) return KW_PSFONT;
+(TITLE|title)          return KW_TITLE;
 
 [ \n\t]                ;
 ","            return COMMA;