Index: kit/CHANGELOG
diff -u kit/CHANGELOG:1.9 kit/CHANGELOG:removed
--- kit/CHANGELOG:1.9	Sat Sep  5 00:11:21 1998
+++ kit/CHANGELOG	Thu Feb 19 09:38:01 2009
@@ -1,51 +0,0 @@
-CHANGELOG for magicpoint
-$Id: CHANGELOG,v 1.9 1998/09/04 15:11:21 onoe Exp $
-
-Fri Sep  5 1998  onoe@sm.sony.co.jp
-	* handle key inputs from invoked terminal as pressed on Xserver,
-	  even if the Xserver is running on a remote host.
-
-Mon Aug 26 1998  itojun@iijlab.net
-	* new copyright. (BSDish copyright without clause 3)
-
-Mon Aug 25 1998  itojun@iijlab.net
-	* print.c: better x11/freetype/vflib -> postscript font mapping.
-
-Mon Aug 23 1998  kato@wide.ad.jp
-	* embedded image support (added mgpembed.pl and embed.c)
-
-Mon Aug 22 1998  itojun@iijlab.net
-	* added contrib/xmindpath, MindPath PocketPoint user-level driver.
-
-Fri Jul 10 11:57:59 JST 1998  itojun@iijlab.net
-	* cache gs-generated image file.
-	  Suggested by: luigi@FreeBSD.org
-
-Mon Jul  6 11:38:32 JST 1998  itojun@iijlab.net
-	* capable of handling GB2312 and KSC5601 encoding.
-	  they must be encoded by using iso-2022 like escape sequences.
-	  EUC-cn or EUC-kr does not work.
-	* -x option is added.
-
-Thu Jul  2 18:04:16 JST 1998  itojun@iijlab.net
-	* eliminate gsview.
-	* revamp "xfont" directive. (see SYNTAX for detail)
-
-Thu Jun 25 13:10:28 JST 1998  itojun@iijlab.net
-	* print.c: color postscript support by "mgp2ps -c".
-
-changes between 1.02a and 1.03a:
-	* To allow color name that has space inbetween ("dark blue"), 
-	  color name after directives SHOULD come with doublequote.
-	  Therefore,
-		%fore blue
-	  should be
-		%fore "blue"
-	  At this moment, doublequote can be ommitted for backward
-	  compatibility.  We may require to have doublequote in the future.
-	  Font names and other string parameter obeys the same rule.
-	* %image is now capable of rendering encapsulated postscript files
-	  (*.eps).
-		%image foo.eps
-	  should work fine.
-	  By using -X option, you can specify device name for ghostscript.
Index: kit/README.lang
diff -u kit/README.lang:1.6 kit/README.lang:1.7
--- kit/README.lang:1.6	Thu Mar 15 19:13:18 2001
+++ kit/README.lang	Wed Feb 18 19:44:30 2009
@@ -16,6 +16,9 @@
 
 	%charset "iso8859-1"
 
+Note that this directive can be used after %page directive, that is,
+you can't use %charset directive in preamble.
+
 In the future, we will add more encodings to charset directive, like
 "iso2022-jp", or "euc-jp"
 
Index: kit/ctlwords.pl
diff -u kit/ctlwords.pl:1.2 kit/ctlwords.pl:removed
--- kit/ctlwords.pl:1.2	Sat Sep  5 06:05:08 1998
+++ kit/ctlwords.pl	Thu Feb 19 09:38:01 2009
@@ -1,12 +0,0 @@
-#! /usr/bin/perl
-$counter = 0;	# 0 origin
-print "/* generated by ctlwords.awk. do not edit by hand. */\n";
-
-while (<>) {
-	next if (!/^\/\*CTL\*\//);
-	next if ($_ !~ /(CTL_[A-Z0-9]+)/);
-
-	$word = $1;
-	print "#define $word\t$counter\n";
-	$counter++;
-}
Index: kit/mgp.h
diff -u kit/mgp.h:1.146 kit/mgp.h:1.147
--- kit/mgp.h:1.146	Sat Jan 19 02:43:20 2008
+++ kit/mgp.h	Wed Feb 18 19:44:30 2009
@@ -26,7 +26,7 @@
  * SUCH DAMAGE.
  */
 /*
- * $Id: mgp.h,v 1.146 2008/01/18 17:43:20 nishida Exp $
+ * $Id: mgp.h,v 1.147 2009/02/18 10:44:30 nishida Exp $
  */
 
 #include <stdio.h>
@@ -507,7 +507,7 @@
 			float xzoom, yzoom;
 #ifdef USE_IMLIB
 			int zoomonclk;
-			ImlibImage *imimage;
+			Imlib_Image *imimage;
 #endif
 		} image;
 		struct {
Index: kit/contrib/mgp2html.pl.in
diff -u kit/contrib/mgp2html.pl.in:1.12 kit/contrib/mgp2html.pl.in:1.13
--- kit/contrib/mgp2html.pl.in:1.12	Mon Aug 30 17:20:15 1999
+++ kit/contrib/mgp2html.pl.in	Wed Feb 18 19:44:31 2009
@@ -2,7 +2,7 @@
 
 # mgp2html.pl
 # converts MagicPoint input file to simple dumb html file.
-# $Id: mgp2html.pl.in,v 1.12 1999/08/30 08:20:15 itojun Exp $
+# $Id: mgp2html.pl.in,v 1.13 2009/02/18 10:44:31 nishida Exp $
 #
 # Copyright (C) 1997 and 1998 WIDE Project.  All rights reserved.
 # 
@@ -79,10 +79,18 @@
 
 &prologue;
 while (<>) {
-	s/\n$//;
+	s/[\n\r]*$//; # trim CR and LF
+	s/</&lt;/g; # escape < as &lt;
 
 	$_ = '' if (/^#/o);
 
+	# multiline processing (lines ending with '\')
+	while ((/\\$/) && (not eof())) {
+		$_=substr($_,0,-1); # cuts last char (should be '\')
+		$_=$_.<>; # concatenate next line
+		s/[\n\r]*$//; # trim CR and LF
+	}
+
 	if ($_ eq '' || $_ =~ /^[^%]/) {
 		$line++;
 		$cont = 0 if ($cont == 2);
@@ -103,6 +111,8 @@
 		next;
 	}
 
+	$cont = 0 if ($cont == 2);
+	$cont = 2 if ($cont == 1);
 	&cmds($_);
 }
 &pageepilogue;
@@ -152,14 +162,15 @@
 			if (!$doimage) {
 				# don't use images
 			} elsif (scalar(@dir) == 2 || scalar(@dir) == 3) {
-				print "<IMG SRC=\"$dir[1]\" ALT=\"$dir[1]\">\n";
+				&output("<IMG SRC=\"$dir[1]\" ALT=\"$dir[1]\">\n");
 			} elsif (scalar(@dir) == 4) {
 				# interpretation wrong
-				print "<IMG SRC=\"$dir[1]\" WIDTH=$dir[3]% HEIGHT=$dir[3]% ALT=\"$dir[1]\">\n";
+				&output("<IMG SRC=\"$dir[1]\" WIDTH=$dir[3]% HEIGHT=$dir[3]% ALT=\"$dir[1]\">\n");
 			} elsif (scalar(@dir) >= 5) {
 				# interpretation wrong
-				print "<IMG SRC=\"$dir[1]\" WIDTH=$dir[3]% HEIGHT=$dir[4]% ALT=\"$dir[1]\">\n";
+				&output("<IMG SRC=\"$dir[1]\" WIDTH=$dir[3]% HEIGHT=$dir[4]% ALT=\"$dir[1]\">\n");
 			}
+			$endline = "<BR>\n";
 		} elsif ($dir[0] eq 'nodefault') {
 			$nodefault++;
 		} elsif ($dir[0] =~ /^(left|leftfill|right|center)$/) {
Index: kit/contrib/mgpnet.in
diff -u kit/contrib/mgpnet.in:1.4 kit/contrib/mgpnet.in:1.5
--- kit/contrib/mgpnet.in:1.4	Wed Aug 26 14:30:13 1998
+++ kit/contrib/mgpnet.in	Wed Feb 18 19:44:31 2009
@@ -27,7 +27,7 @@
 # OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 # SUCH DAMAGE.
 #
-# $Id: mgpnet.in,v 1.4 1998/08/26 05:30:13 itojun Exp $
+# $Id: mgpnet.in,v 1.5 2009/02/18 10:44:31 nishida Exp $
 #
 
 # configurations
@@ -150,19 +150,19 @@
 	vec($rin, fileno(S), 1) = 1;
 	vec($win, fileno(S), 1) = 1;
 	$ewin = $rin | $win;
-	print STDERR "waiting for connetion...\n" if ($debug);
+	print STDERR "waiting for connection...\n" if ($debug);
 	($nfound, $timeleft) = 
 		select($rout = $rin, $wout = $win, $eout = $ein, $seltimeout);
 	next if ($nfound <= 0);
 	if (vec($rout, fileno(S), 1)) {
-		print STDERR "accepting connetion...\n" if ($debug);
+		print STDERR "accepting connection...\n" if ($debug);
 		accept(NS, S) || do {
 			print STDERR "server: accept fail\n" if ($debug);
 			next;
 		};
 
 		$acceptstat++;
-		print STDERR "connetion accepted...\n" if ($debug);
+		print STDERR "connection accepted...\n" if ($debug);
 
 		$pid = fork;
 		if ($pid < 0) {
@@ -185,7 +185,7 @@
 	}
 }
 print STDERR "leaving MagicPoint Netserver...\n";
-print STDERR "accepted $acceptstat connetions so far.\n";
+print STDERR "accepted $acceptstat connections so far.\n";
 close(NS);
 close(S);
 unlink($imagefile);
Index: kit/image/gif.h
diff -u kit/image/gif.h:1.2 kit/image/gif.h:removed
--- kit/image/gif.h:1.2	Mon Dec 28 17:23:03 1998
+++ kit/image/gif.h	Thu Feb 19 09:38:01 2009
@@ -1,72 +0,0 @@
-/* gif.h:
- *
- * gifin.h
- * kirk johnson
- * november 1989
- * external interface to gifin.c
- *
- * Copyright 1989 Kirk L. Johnson (see the included file
- * "kljcpyrght.h" for complete copyright information)
- */
-
-/*
- * gifin return codes
- */
-#define GIFIN_SUCCESS       0   /* success */
-#define GIFIN_DONE          1   /* no more images */
-
-#define GIFIN_ERR_BAD_SD   -1   /* bad screen descriptor */
-#define GIFIN_ERR_BAD_SEP  -2   /* bad image separator */
-#define GIFIN_ERR_BAD_SIG  -3   /* bad signature */
-#define GIFIN_ERR_EOD      -4   /* unexpected end of raster data */
-#define GIFIN_ERR_EOF      -5   /* unexpected end of input stream */
-#define GIFIN_ERR_FAO      -6   /* file already open */
-#define GIFIN_ERR_IAO      -7   /* image already open */
-#define GIFIN_ERR_NFO      -8   /* no file open */
-#define GIFIN_ERR_NIO      -9   /* no image open */
-
-/*
- * colormap indices 
- */
-
-#define GIF_RED  0
-#define GIF_GRN  1
-#define GIF_BLU  2
-
-/*
- * typedef BYTE for convenience
- */
-
-typedef unsigned char BYTE;
-
-static int gifin_open_file();
-static int gifin_open_image();
-static int gifin_get_pixel();
-#if 0
-static int gifin_close_image();
-#endif
-static int gifin_close_file();
-static int gifin_load_cmap();
-static int gifin_skip_extension();
-static int gifin_read_data_block();
-static int gifin_push_string();
-static void gifin_add_string();
-static void gifin_fatal();
-
-/* #defines, typedefs, and such
- */
-
-#define GIF_SIG      "GIF87a"
-#define GIF_SIG_89   "GIF89a"
-#define GIF_SIG_LEN  6          /* GIF signature length */
-#define GIF_SD_SIZE  7          /* GIF screen descriptor size */
-#define GIF_ID_SIZE  9          /* GIF image descriptor size */
-
-#define GIF_SEPARATOR   ','     /* GIF image separator */
-#define GIF_EXTENSION   '!'     /* GIF extension block marker */
-#define GIF_TERMINATOR  ';'     /* GIF terminator */
-
-#define STAB_SIZE  4096         /* string table size */
-#define PSTK_SIZE  4096         /* pixel stack size */
-
-#define NULL_CODE  -1           /* string table null code */
Index: kit/image/imlib_loader.c
diff -u kit/image/imlib_loader.c:1.9 kit/image/imlib_loader.c:1.10
--- kit/image/imlib_loader.c:1.9	Sun Feb 15 20:35:19 2009
+++ kit/image/imlib_loader.c	Wed Feb 18 19:44:31 2009
@@ -40,8 +40,8 @@
 		/* dither for non-truecolor displays */
 		imlib_context_set_dither(1);
 		imlib_context_set_display(disp);
-		imlib_context_set_visual(DefaultVisual(display, DefaultScreen(display)));
-		imlib_context_set_colormap(DefaultColormap(display, DefaultScreen(display)));
+		imlib_context_set_visual(DefaultVisual(disp, DefaultScreen(disp)));
+		imlib_context_set_colormap(DefaultColormap(disp, DefaultScreen(disp)));
 	}
 	if ((im = search_imdata(fullname), image) == NULL) {
 		/* im = Imlib_load_image(id, fullname); */
@@ -123,7 +123,7 @@
 
 void regist_imdata(fullname, im, image)
 	char *fullname; 
-	ImlibImage *im;
+	Imlib_Image *im;
 	Image *image;
 {
 	strcpy(imfile[imnum], fullname);	
@@ -133,12 +133,16 @@
 }
 
 Pixmap pixmap_fromimimage(imimage, width, height)
-	ImlibImage *imimage;
+	Imlib_Image *imimage;
 	int width, height;
 {
 	static Pixmap pixmap;
+#if 0
 	Imlib_render(id, imimage, width, height);
 	pixmap = Imlib_move_image(id, imimage);
+#else
+	imlib_render_pixmaps_for_whole_image_at_size(&pixmap, NULL, width, height);
+#endif
 
 	return pixmap;
 }
@@ -169,8 +173,8 @@
 		ppage[i] = page;
 	} else {
 		for (i = 0; i < MAXPMAP; i ++) {
-			if (ppage[i] == page){
-				Imlib_free_pixmap(id, pmap[i]);
+			if (ppage[i] == page && pmap[i] != 0){
+				imlib_free_pixmap_and_mask(pmap[i]);
 				pmap[i] = 0;
 			}
 		}
Index: kit/sample/cloud.gif
Index: kit/sample/dad.gif
Index: kit/sample/dns-jp.mgp
diff -u kit/sample/dns-jp.mgp:1.5 kit/sample/dns-jp.mgp:removed
--- kit/sample/dns-jp.mgp:1.5	Fri Sep  4 21:33:18 1998
+++ kit/sample/dns-jp.mgp	Thu Feb 19 09:38:01 2009
@@ -1,130 +0,0 @@
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-%%
-%%	This file is automatically created from the file
-%%	main.pre modified at Fri Jan 23 14:31:24 1998
-%%
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-%%
-%include "default.mgp"
-%% "noop" cancels definitions in default.mgp
-%default 1 left, size 7, fore "light yellow", back "blue4", font "standard", ccolor "white", vgap 35
-%default 2 noop
-%default 3 fore "white", bar "gray70", vgap 10
-%default 4 noop
-%tab 1 noop
-%tab 2 noop
-%tab 3 noop
-%%%
-%page
-%nodefault
-%fore "red", back "blue4", size 9, vgap 15
-%center, fore "yellow", font "thick"
-%ccolor "white"
-
-
-
-Root DNS `M' $B$K$D$$$F(B
-
-%size 6, fore "red", font "thick"
-$B2CF#(B   $BO/(B
-
-%size 5, fore "white", font "standard"
-$BEl5~Bg3XBg7?7W;;5!%;%s%?!<(B
-
-
-%font "typewriter"
-kato@wide.ad.jp
-%font "standard"
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-%page
-
-%back "blue4"
-  $B7P0^(B (1)
-%fore "red", size 6, font "thick"
-   $B!y(B Root DNS
-%fore "white", size 5, font "standard"
-       $B!&(B $B#9Bf$G1?MQ(B
-%fore "white", size 5, font "standard"
-          $B!](B $B#8Bf$,(B US
-          $B!](B Stockholm $B$K#1Bf(B
-%fore "white", size 5, font "standard"
-       $B!&(B $B:GBg$G#1#3Bf(B
-%fore "white", size 5, font "standard"
-          $B!](B $B%Q%1%C%HD9$N@)Ls(B
-%fore "red", size 6, font "thick"
-   $B!y(B Root DNS $B$N1?MQ4p=`(B
-%fore "white", size 5, font "standard"
-       $B!&(B RFC 2010
-       $B!&(B gTLD $B$H$N4X78(B
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-%page
-
-%back "blue4"
-  $B7P0^(B (2)
-%fore "red", size 6, font "thick"
-   $B!y(B IEPG $B$G3HD%$r8!F$(B
-   $B!y(B $B%h!<%m%C%QCO0h(B
-%fore "white", size 5, font "standard"
-       $B!&(B LINX $B$K?7@_(B : 1997 $BG/(B 4 $B7n(B
-%fore "white", size 5, font "standard"
-          $B!](B RIPE/NCC $B$,4IM}(B
-          $B!](B `K'
-%fore "red", size 6, font "thick"
-   $B!y(B $B%"%8%"B@J?MNCO0h(B
-%fore "white", size 5, font "standard"
-       $B!&(B NSPIXP-2 $B!'(B 1997 $BG/(B 8 $B7n(B
-%fore "white", size 5, font "standard"
-          $B!](B WIDE $B$,4IM}(B
-          $B!](B `M'
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-%page
-
-%back "blue4"
-  `M'
-%fore "red", size 6, font "thick"
-   $B!y(B $B9=@.(B
-%fore "white", size 5, font "standard"
-       $B!&(B $B#2Bf$N(B PentiumPro 200MHz
-       $B!&(B Primary/Backup$B!"(B $B<+F0@Z$jBX$((B
-%fore "red", size 6, font "thick"
-   $B!y(B Root-only $B%5!<%P(B
-%fore "white", size 5, font "standard"
-       $B!&(B 
-%cont, font "typewriter"
-202.12.27.33
-%font "standard"
-       $B!&(B 400 $B!A(B 500 query/sec
-%fore "red", size 6, font "thick"
-   $B!y(B $B1?MQ4IM}(B
-%fore "white", size 5, font "standard"
-       $B!&(B WIDE $B$*$h$S(B ISP $BM-;V(B
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-%page
-
-%back "blue4"
-  $B$*4j$$(B
-%fore "red", size 6, font "thick"
-   $B!y(B $B:G?7$N(B root.cache $B$NF~$l49$((B
-%fore "white", size 5, font "standard"
-       $B!&(B 
-%cont, font "typewriter"
-1997082200
-%fore "red", size 6, font "thick"
-   $B!y(B Named $B$N99?7(B
-%fore "white", size 5, font "standard"
-       $B!&(B 4.9.6/8.8.1
-%fore "red", size 6, font "thick"
-   $B!y(B $BM7$P$J$$$G!'(B
-%fore "white", size 5, font "standard"
-       $B!&(B 
-%cont, font "typewriter"
-ping/traceroute
-%font "standard"
-       $B!&(B 
-%cont, font "typewriter"
-telnet/spray/...
-%fore "red", size 6, font "thick"
-   $B!y(B Thanks to
-%fore "white", size 5, font "standard"
-       $B!&(B $BF|K\(B Cisco/$BB?$/$N(B ISP
-       $B!&(B `M' $B4IM}%0%k!<%W(B
Index: kit/sample/mgp-old1.gif
Index: kit/sample/mgp-old2.gif
Index: kit/sample/mgp-old3.gif
Index: kit/sample/mgp1.gif
Index: kit/sample/mgp2.gif
Index: kit/sample/mgp3.gif
Index: kit/sample/v6header.gif
