Filewatcher File Search
FTP Search
  
Directory (beta)
  
Content Search (beta)
   
pkg://MagicPoint-1.09a-9.src.rpm:820329/magicpoint-1.09a.tar.gz  info  downloads

magicpoint-1.09a/ 40755   2007      0           0  7354522475  12136 5ustar  kazuwheelmagicpoint-1.09a/contrib/ 40755   2007      0           0  7354522472  13573 5ustar  kazuwheelmagicpoint-1.09a/contrib/mgp-el/ 40755   2007      0           0  7354522471  14753 5ustar  kazuwheelmagicpoint-1.09a/contrib/mgp-el/COPYING100644   2007      0       43110  6712076767  16133 0ustar  kazuwheel		    GNU GENERAL PUBLIC LICENSE
		       Version 2, June 1991

 Copyright (C) 1989, 1991 Free Software Foundation, Inc.
     59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 Everyone is permitted to copy and distribute verbatim copies
 of this license document, but changing it is not allowed.

			    Preamble

  The licenses for most software are designed to take away your
freedom to share and change it.  By contrast, the GNU General Public
License is intended to guarantee your freedom to share and change free
software--to make sure the software is free for all its users.  This
General Public License applies to most of the Free Software
Foundation's software and to any other program whose authors commit to
using it.  (Some other Free Software Foundation software is covered by
the GNU Library General Public License instead.)  You can apply it to
your programs, too.

  When we speak of free software, we are referring to freedom, not
price.  Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
this service if you wish), that you receive source code or can get it
if you want it, that you can change the software or use pieces of it
in new free programs; and that you know you can do these things.

  To protect your rights, we need to make restrictions that forbid
anyone to deny you these rights or to ask you to surrender the rights.
These restrictions translate to certain responsibilities for you if you
distribute copies of the software, or if you modify it.

  For example, if you distribute copies of such a program, whether
gratis or for a fee, you must give the recipients all the rights that
you have.  You must make sure that they, too, receive or can get the
source code.  And you must show them these terms so they know their
rights.

  We protect your rights with two steps: (1) copyright the software, and
(2) offer you this license which gives you legal permission to copy,
distribute and/or modify the software.

  Also, for each author's protection and ours, we want to make certain
that everyone understands that there is no warranty for this free
software.  If the software is modified by someone else and passed on, we
want its recipients to know that what they have is not the original, so
that any problems introduced by others will not reflect on the original
authors' reputations.

  Finally, any free program is threatened constantly by software
patents.  We wish to avoid the danger that redistributors of a free
program will individually obtain patent licenses, in effect making the
program proprietary.  To prevent this, we have made it clear that any
patent must be licensed for everyone's free use or not licensed at all.

  The precise terms and conditions for copying, distribution and
modification follow.

		    GNU GENERAL PUBLIC LICENSE
   TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION

  0. This License applies to any program or other work which contains
a notice placed by the copyright holder saying it may be distributed
under the terms of this General Public License.  The "Program", below,
refers to any such program or work, and a "work based on the Program"
means either the Program or any derivative work under copyright law:
that is to say, a work containing the Program or a portion of it,
either verbatim or with modifications and/or translated into another
language.  (Hereinafter, translation is included without limitation in
the term "modification".)  Each licensee is addressed as "you".

Activities other than copying, distribution and modification are not
covered by this License; they are outside its scope.  The act of
running the Program is not restricted, and the output from the Program
is covered only if its contents constitute a work based on the
Program (independent of having been made by running the Program).
Whether that is true depends on what the Program does.

  1. You may copy and distribute verbatim copies of the Program's
source code as you receive it, in any medium, provided that you
conspicuously and appropriately publish on each copy an appropriate
copyright notice and disclaimer of warranty; keep intact all the
notices that refer to this License and to the absence of any warranty;
and give any other recipients of the Program a copy of this License
along with the Program.

You may charge a fee for the physical act of transferring a copy, and
you may at your option offer warranty protection in exchange for a fee.

  2. You may modify your copy or copies of the Program or any portion
of it, thus forming a work based on the Program, and copy and
distribute such modifications or work under the terms of Section 1
above, provided that you also meet all of these conditions:

    a) You must cause the modified files to carry prominent notices
    stating that you changed the files and the date of any change.

    b) You must cause any work that you distribute or publish, that in
    whole or in part contains or is derived from the Program or any
    part thereof, to be licensed as a whole at no charge to all third
    parties under the terms of this License.

    c) If the modified program normally reads commands interactively
    when run, you must cause it, when started running for such
    interactive use in the most ordinary way, to print or display an
    announcement including an appropriate copyright notice and a
    notice that there is no warranty (or else, saying that you provide
    a warranty) and that users may redistribute the program under
    these conditions, and telling the user how to view a copy of this
    License.  (Exception: if the Program itself is interactive but
    does not normally print such an announcement, your work based on
    the Program is not required to print an announcement.)

These requirements apply to the modified work as a whole.  If
identifiable sections of that work are not derived from the Program,
and can be reasonably considered independent and separate works in
themselves, then this License, and its terms, do not apply to those
sections when you distribute them as separate works.  But when you
distribute the same sections as part of a whole which is a work based
on the Program, the distribution of the whole must be on the terms of
this License, whose permissions for other licensees extend to the
entire whole, and thus to each and every part regardless of who wrote it.

Thus, it is not the intent of this section to claim rights or contest
your rights to work written entirely by you; rather, the intent is to
exercise the right to control the distribution of derivative or
collective works based on the Program.

In addition, mere aggregation of another work not based on the Program
with the Program (or with a work based on the Program) on a volume of
a storage or distribution medium does not bring the other work under
the scope of this License.

  3. You may copy and distribute the Program (or a work based on it,
under Section 2) in object code or executable form under the terms of
Sections 1 and 2 above provided that you also do one of the following:

    a) Accompany it with the complete corresponding machine-readable
    source code, which must be distributed under the terms of Sections
    1 and 2 above on a medium customarily used for software interchange; or,

    b) Accompany it with a written offer, valid for at least three
    years, to give any third party, for a charge no more than your
    cost of physically performing source distribution, a complete
    machine-readable copy of the corresponding source code, to be
    distributed under the terms of Sections 1 and 2 above on a medium
    customarily used for software interchange; or,

    c) Accompany it with the information you received as to the offer
    to distribute corresponding source code.  (This alternative is
    allowed only for noncommercial distribution and only if you
    received the program in object code or executable form with such
    an offer, in accord with Subsection b above.)

The source code for a work means the preferred form of the work for
making modifications to it.  For an executable work, complete source
code means all the source code for all modules it contains, plus any
associated interface definition files, plus the scripts used to
control compilation and installation of the executable.  However, as a
special exception, the source code distributed need not include
anything that is normally distributed (in either source or binary
form) with the major components (compiler, kernel, and so on) of the
operating system on which the executable runs, unless that component
itself accompanies the executable.

If distribution of executable or object code is made by offering
access to copy from a designated place, then offering equivalent
access to copy the source code from the same place counts as
distribution of the source code, even though third parties are not
compelled to copy the source along with the object code.

  4. You may not copy, modify, sublicense, or distribute the Program
except as expressly provided under this License.  Any attempt
otherwise to copy, modify, sublicense or distribute the Program is
void, and will automatically terminate your rights under this License.
However, parties who have received copies, or rights, from you under
this License will not have their licenses terminated so long as such
parties remain in full compliance.

  5. You are not required to accept this License, since you have not
signed it.  However, nothing else grants you permission to modify or
distribute the Program or its derivative works.  These actions are
prohibited by law if you do not accept this License.  Therefore, by
modifying or distributing the Program (or any work based on the
Program), you indicate your acceptance of this License to do so, and
all its terms and conditions for copying, distributing or modifying
the Program or works based on it.

  6. Each time you redistribute the Program (or any work based on the
Program), the recipient automatically receives a license from the
original licensor to copy, distribute or modify the Program subject to
these terms and conditions.  You may not impose any further
restrictions on the recipients' exercise of the rights granted herein.
You are not responsible for enforcing compliance by third parties to
this License.

  7. If, as a consequence of a court judgment or allegation of patent
infringement or for any other reason (not limited to patent issues),
conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License.  If you cannot
distribute so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you
may not distribute the Program at all.  For example, if a patent
license would not permit royalty-free redistribution of the Program by
all those who receive copies directly or indirectly through you, then
the only way you could satisfy both it and this License would be to
refrain entirely from distribution of the Program.

If any portion of this section is held invalid or unenforceable under
any particular circumstance, the balance of the section is intended to
apply and the section as a whole is intended to apply in other
circumstances.

It is not the purpose of this section to induce you to infringe any
patents or other property right claims or to contest validity of any
such claims; this section has the sole purpose of protecting the
integrity of the free software distribution system, which is
implemented by public license practices.  Many people have made
generous contributions to the wide range of software distributed
through that system in reliance on consistent application of that
system; it is up to the author/donor to decide if he or she is willing
to distribute software through any other system and a licensee cannot
impose that choice.

This section is intended to make thoroughly clear what is believed to
be a consequence of the rest of this License.

  8. If the distribution and/or use of the Program is restricted in
certain countries either by patents or by copyrighted interfaces, the
original copyright holder who places the Program under this License
may add an explicit geographical distribution limitation excluding
those countries, so that distribution is permitted only in or among
countries not thus excluded.  In such case, this License incorporates
the limitation as if written in the body of this License.

  9. The Free Software Foundation may publish revised and/or new versions
of the General Public License from time to time.  Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.

Each version is given a distinguishing version number.  If the Program
specifies a version number of this License which applies to it and "any
later version", you have the option of following the terms and conditions
either of that version or of any later version published by the Free
Software Foundation.  If the Program does not specify a version number of
this License, you may choose any version ever published by the Free Software
Foundation.

  10. If you wish to incorporate parts of the Program into other free
programs whose distribution conditions are different, write to the author
to ask for permission.  For software which is copyrighted by the Free
Software Foundation, write to the Free Software Foundation; we sometimes
make exceptions for this.  Our decision will be guided by the two goals
of preserving the free status of all derivatives of our free software and
of promoting the sharing and reuse of software generally.

			    NO WARRANTY

  11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW.  EXCEPT WHEN
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.  THE ENTIRE RISK AS
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU.  SHOULD THE
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
REPAIR OR CORRECTION.

  12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGES.

		     END OF TERMS AND CONDITIONS

	    How to Apply These Terms to Your New Programs

  If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.

  To do so, attach the following notices to the program.  It is safest
to attach them to the start of each source file to most effectively
convey the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.

    <one line to give the program's name and a brief idea of what it does.>
    Copyright (C) <year>  <name of author>

    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation; either version 2 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 General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program; if not, write to the Free Software
    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA


Also add information on how to contact you by electronic and paper mail.

If the program is interactive, make it output a short notice like this
when it starts in an interactive mode:

    Gnomovision version 69, Copyright (C) year  name of author
    Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
    This is free software, and you are welcome to redistribute it
    under certain conditions; type `show c' for details.

The hypothetical commands `show w' and `show c' should show the appropriate
parts of the General Public License.  Of course, the commands you use may
be called something other than `show w' and `show c'; they could even be
mouse-clicks or menu items--whatever suits your program.

You should also get your employer (if you work as a programmer) or your
school, if any, to sign a "copyright disclaimer" for the program, if
necessary.  Here is a sample; alter the names:

  Yoyodyne, Inc., hereby disclaims all copyright interest in the program
  `Gnomovision' (which makes passes at compilers) written by James Hacker.

  <signature of Ty Coon>, 1 April 1989
  Ty Coon, President of Vice

This General Public License does not permit incorporating your program into
proprietary programs.  If your program is a subroutine library, you may
consider it more useful to permit linking proprietary applications with the
library.  If this is what you want to do, use the GNU Library General
Public License instead of this License.
magicpoint-1.09a/contrib/mgp-el/README100644   2007      0        1545  6712076770  15740 0ustar  kazuwheel### mgp.el Ver.0.90 -- convert Magic Point file to LaTeX2e

0. CONTENTS

	o README -- This file.
	o mgp.el -- Emacs Lisp program to convert mgp file to LaTeX2e.
	o mgp.sty -- Stype file to be used with the generated LaTeX2e file.
	o sample.mgp -- Same as distributed with Magic Point.
	o sample.tex -- LaTeX2e file generated by mgp.el from sample.mgp


1. INSTALLATION

1.1 At first you need Emacs Ver.20.X or Mule Ver.2.3.

1.2 Byte compile mgp.el by Emacs or mule, and copy mgp.el and mgp.elc
to a directory that is in `load-path' of your Emacs.  The directory
/usr/local/share/emacs/site-lisp/ is a good candidate.

1.3 Copy mgp.sty to a directory that your LaTeX system can find.


2. USAGE

2.1 Read your XXX.mpg file into Emacs buffer, and do:
	M-x mgp-entex-buffer RET
Then the file XXX.tex is generated.

2.2 Process the generated XXX.tex by your LaTeX system.
magicpoint-1.09a/contrib/mgp-el/mgp.el100644   2007      0       52130  6712076770  16201 0ustar  kazuwheel;;; mgp.el --- Magic Point tool
;;; Copyright (C) 1999 Electrotechnical Lab., JAPAN

;; Author: K.Handa <handa@etl.go.jp>
;; Created: 1999/04/28
;; Keywords: mgp, Magic Point

;; This file is not part of GNU Emacs, but the same permissions apply.
;;
;; GNU Emacs is free software; you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation; either version 2, or (at your option)
;; any later version.
;;
;; GNU Emacs 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 General Public License for more details.
;;
;; You should have received a copy of the GNU General Public License
;; along with GNU Emacs; see the file COPYING.  If not, write to the
;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
;; Boston, MA 02111-1307, USA.

;;; Code:

(eval-and-compile

(or mule-version
    (error "This program requires Mule feature"))

;; For compatibility between Mule 2.3 and Emacs 20.

(defun mgp-buffer-file-coding-system ()
  (if (boundp 'buffer-file-coding-system)
      (symbol-value 'buffer-file-coding-system)
    (symbol-value 'file-coding-system)))

(or (fboundp 'set-buffer-file-coding-system)
    (defalias 'set-buffer-file-coding-system 'set-file-coding-system))

(or (fboundp 'coding-system-base)
    (defun coding-system-base (coding)
      (cond ((memq coding '(*ctext* *iso-8859-1*)) 'latin-1)
	    ((eq coding '*iso-8859-2*) 'latin-2)
	    ((eq coding '*iso-8859-3*) 'latin-3)
	    ((eq coding '*iso-8859-4*) 'latin-4)
	    ((eq coding '*iso-8859-5*) 'latin-5))))

(or (fboundp 'coding-system-equal)
    (defalias 'coding-system-equal 'eq))

(or (fboundp 'line-beginning-position)
    (defun line-beginning-position ()
      (save-excursion
	(beginning-of-line)
	(point))))

(or (fboundp 'line-end-position)
    (defun line-end-position ()
      (save-excursion
	(end-of-line)
	(point))))

)

(defvar mgp-version "0.90")

(defvar mgp-paper-size "a4")
(defvar mgp-image-scale-factor 0.95)
(defvar mgp-landscape t)
(defvar mgp-lib-directory "/usr/X11R6/lib/X11/mgp")
(defvar mgp-disable-color t)

(defconst mgp-paper-size-list '("a5" "a4" "b5" "letter" "legal" "executive"))
(defconst mgp-predefined-color-list
  '("black" "white" "red" "green" "blue" "yellow" "cyan" "magenta" "gray"))
(defvar mgp-color-list nil)

(defvar mgp-entex-inbuf nil)
(defvar mgp-entex-outbuf nil)

(defvar mgp-entex-source nil)

(defun mgp-entex-file (file)
  (interactive "fMGP source file: ")
  (setq mgp-entex-source file)
  (mgp-entex-setup-color-data)
  (mgp-entex-setup-buffer)
  (mgp-entex-process-buffer)
  (switch-to-buffer mgp-entex-outbuf)
  (goto-char (point-min))
  (save-buffer))

(defun mgp-entex-buffer ()
  (interactive)
  (setq mgp-entex-source (current-buffer))
  (mgp-entex-setup-color-data)
  (mgp-entex-setup-buffer)
  (mgp-entex-process-buffer)
  (switch-to-buffer mgp-entex-outbuf)
  (goto-char (point-min))
  (save-buffer))

(defvar mgp-max-color-value nil)

(defun mgp-entex-setup-color-data ()
  (if (eq window-system 'x)
      (setq mgp-max-color-value (car (x-color-values "white")))))

(defmacro mgp-with-output-buffer (&rest body)
  `(let ((buf (current-buffer)))
     (or (eq buf mgp-entex-outbuf)
	 (set-buffer mgp-entex-outbuf))
     (unwind-protect
	 (progn ,@body)
       (or (eq buf mgp-entex-outbuf)
	   (set-buffer buf)))))

(put 'mgp-with-output-buffer 'lisp-indent-function 0)

(defun mgp-entex-setup-buffer ()
  (let (filename dir coding)
    (save-excursion
      (setq mgp-entex-inbuf (get-buffer-create "*mgp*"))
      (set-buffer mgp-entex-inbuf)
      (erase-buffer)
      (insert "%%\n")
      (if (bufferp mgp-entex-source)
	  (progn
	    (save-excursion
	      (set-buffer mgp-entex-source)
	      (setq filename (concat (file-name-sans-extension
				      (or buffer-file-name (buffer-name)))
				     ".tex")
		    dir default-directory
		    coding (mgp-buffer-file-coding-system)))
	    (set-buffer-file-coding-system coding)
	    (setq default-directory dir)
	    (insert-buffer mgp-entex-source))
	(setq filename
	      (concat (file-name-sans-extension mgp-entex-source) ".tex")
	      dir
	      (file-name-directory (expand-file-name mgp-entex-source)))
	(insert-file-contents (expand-file-name mgp-entex-source))
	(setq coding (mgp-buffer-file-coding-system))
	(setq default-directory dir))

      (goto-char (point-min))
      (while (and (search-forward "\n%include" nil t)
		  (looking-at " +\\([^ ]+\\)"))
	(let ((incfile (mgp-entex-get-string-arg))
	      (pos (line-beginning-position))
	      len)
	  (forward-line 1)
	  (delete-region pos (point))
	  (if (or (file-readable-p incfile)
		  (progn
		    (setq incfile (expand-file-name incfile mgp-lib-directory))
		    (file-readable-p incfile)))
	      (progn
		(message "Inserting file %s..." incfile)
		(insert-file-contents incfile)))
	  (goto-char (point-min))))
      (goto-char (point-min))
      (while (search-forward "\\\n" nil t)
	(delete-char -2))
      (goto-char (point-min))
      (setq mgp-entex-outbuf
	    (get-buffer-create (file-name-nondirectory filename)))
      (set-buffer mgp-entex-outbuf)
      (erase-buffer)
      (setq default-directory dir
	    buffer-file-name filename)
      (set-buffer-file-coding-system coding))))

(defvar mgp-entex-continue nil)
(defvar mgp-entex-linehead nil)
(defvar mgp-entex-prefix "")

(defun mgp-entex-process-buffer ()
  (message "Converting MGP to LaTeX...")
  (mgp-entex-init-global-setting)
  (save-excursion
    (set-buffer mgp-entex-inbuf)
    (while (not (or (eobp) (looking-at "^%page")))
      (mgp-entex-process-preamble)
      (forward-line 1))
    (mgp-entex-start-body)
    (forward-line 1)
    (let ((page 0)
	  line)
      (while (not (eobp))
	(mgp-entex-init-local-setting)
	(setq page (1+ page))
	(message "Page %d" page)
	(setq line 1)
	(mgp-entex-start-page)
	(setq mgp-entex-linehead t
	      mgp-entex-prefix "")
	(while (not (or (eobp) (looking-at "^%page")))
	  (setq line (mgp-entex-process-page line))
	  (forward-line 1))
	(mgp-entex-finish-page line)
	(forward-line 1))
      (mgp-entex-finish-body))))

(defconst mgp-setting-num 128)
(defvar mgp-global-setting nil)
(defvar mgp-local-setting nil)

(defun mgp-entex-init-global-setting ()
  (let ((i 2)
	(len (* mgp-setting-num 2)))
    (setq mgp-global-setting (make-vector len nil))
    (aset mgp-global-setting 1 (list 'font nil))
    (while (< i len)
      (aset mgp-global-setting i (list 'font nil))
      (setq i (1+ i)))))

(defun mgp-entex-init-local-setting ()
  (let ((len (length mgp-global-setting))
	(i 0))
    (if (< (length mgp-local-setting) len)
	(setq mgp-local-setting (make-vector len nil)))
    (while (< i len)
      (aset mgp-local-setting i (copy-sequence (aref mgp-global-setting i)))
      (setq i (1+ i)))))

(defun mgp-entex-parse-cmd (globalp defaultp index)
  (save-restriction
    (narrow-to-region (point) (line-end-position))
    (while (re-search-forward "[a-z]+" nil t)
      (let ((func (intern (concat "mgp-entex-cmd-"
				  (downcase (match-string 0))))))
	(if (fboundp func)
	    (funcall func globalp defaultp index)))
      (skip-chars-forward ",")
      (or (eobp)
	  (forward-char 1)))))

(defun mgp-entex-process-preamble ()
  (if (looking-at "^%\\(default\\|tab\\) *")
      (progn
	(forward-char 1)
	(or (eolp)
	    (mgp-entex-parse-cmd 'global nil nil)))))

(defun mgp-entex-start-body ()
  (mgp-with-output-buffer
    (insert "%%% This file was generated by mgp.el ")
    (insert (format "(Ver.%s).\n"  mgp-version))
    (insert "%%%   Document source: ")
    (if (bufferp mgp-entex-source)
	(insert (format "buffer \"%s\"\n" (buffer-name mgp-entex-source)))
      (insert (format "file \"%s\"\n" mgp-entex-source)))
    (insert (format "\\documentclass[%spaper%s]{article}\n\\input{mgp.sty}\n"
		    (if (member mgp-paper-size mgp-paper-size-list)
			mgp-paper-size
		      "a4")
		    (if mgp-landscape ",landscape" "")))
    (or mgp-disable-color
	(progn
	  (insert "\\usepackage{color}\n\\definecolor{gray}{gray}{0.001}")
	  (setq mgp-color-list (cons "gray" mgp-predefined-color-list))))
    (let ((coding (mgp-buffer-file-coding-system)))
      (if coding
	  (let ((base (coding-system-base (mgp-buffer-file-coding-system))))
	    (cond ((coding-system-equal base 'latin-1)
		   (insert "\\usepackage[latin1]{inputenc}\n"))
		  ((coding-system-equal base 'latin-2)
		   (insert "\\usepackage[latin2]{inputenc}\n"))
		  ((coding-system-equal base 'latin-3)
		   (insert "\\usepackage[latin3]{inputenc}\n"))
		  ((coding-system-equal base 'latin-5)
		   (insert "\\usepackage[latin5]{inputenc}\n"))))))
    (insert "\\begin{document}\n")))

(defun mgp-entex-finish-body ()
  (mgp-with-output-buffer
    (insert "\n\\end{document}\n")))

(defun mgp-entex-set-setting (globalp defaultp index prop val)
  (let ((table (if globalp mgp-global-setting mgp-local-setting)))
    (or defaultp
	(setq index (+ mgp-setting-num index)))
    (plist-put (aref table index) prop val)))

(defun mgp-entex-get-setting (globalp defaultp index prop this-line-only)
  (let ((table (if globalp mgp-global-setting mgp-local-setting))
	(limit 0)
	val)
    (or defaultp
	(setq index (+ mgp-setting-num index)
	      limit mgp-setting-num))
    (if this-line-only
	(setq limit index))
    (while (and (>= index limit) (not val))
      (setq val (plist-get (aref table index) prop))
      (setq index (1- index)))
    val))

(defun mgp-entex-get-string-arg ()
  (skip-chars-forward " \t")
  (if (= (following-char) ?\")
      (read (current-buffer))
    (if (looking-at "[^, \n]+")
	(progn
	  (goto-char (match-end 0))
	  (match-string 0)))))

(defun mgp-entex-get-number-arg ()
  (if (looking-at " *[0-9.]+")
      (let ((num (string-to-int (match-string 0))))
	(goto-char (match-end 0))
	num)))

(defun mgp-entex-cmd-default (globalp &rest ignore)
  (let ((index (mgp-entex-get-number-arg)))
    (goto-char (match-end 0))
    (mgp-entex-parse-cmd globalp 'default index)))

(put 'mgp-entex-cmd-default 'mgp-entex-special t)

(defun mgp-entex-cmd-tab (globalp &rest ignore)
  (let ((index (mgp-entex-get-number-arg)))
    (goto-char (match-end 0))
    (mgp-entex-parse-cmd globalp nil index)))

(put 'mgp-entex-cmd-tab 'mgp-entex-special t)

(defvar mgp-mark-position nil)
(defvar mgp-current-line nil)

(defun mgp-entex-cmd-mark (globalp defaultp index)
  (setq mgp-mark-position
	(cons mgp-current-line
	      (mgp-with-output-buffer (line-beginning-position)))))

(defun mgp-entex-cmd-again (globalp defaultp index)
  (mgp-entex-set-setting globalp defaultp index 'again t))

(defun mgp-entex-cmd-fore (globalp defaultp index)
  (let ((arg (mgp-entex-get-string-arg)))
    (if arg
	(mgp-entex-set-setting globalp defaultp index 'fore arg))))

(defun mgp-entex-cmd-back (globalp defaultp index)
  (let ((arg (mgp-entex-get-string-arg)))
    (if arg
	(mgp-entex-set-setting globalp defaultp index 'back arg))))

(defun mgp-entex-cmd-size (globalp defaultp index)
  (let ((arg (mgp-entex-get-number-arg)))
    (if arg
	(mgp-entex-set-setting globalp defaultp index 'size arg))))

(defun mgp-entex-cmd-center (globalp defaultp index)
  (mgp-entex-set-setting globalp defaultp index 'align 'center))

(defun mgp-entex-cmd-left (globalp defaultp index)
  (mgp-entex-set-setting globalp defaultp index 'align 'left))

(defun mgp-entex-cmd-leftfill (globalp defaultp index)
  (mgp-entex-set-setting globalp defaultp index 'align 'left))

(defun mgp-entex-cmd-right (globalp defaultp index)
  (mgp-entex-set-setting globalp defaultp index 'align 'right))

(defun mgp-entex-cmd-vgap (globalp defaultp index)
  (let ((arg (mgp-entex-get-number-arg)))
    (if arg
	(mgp-entex-set-setting globalp defaultp index 'vgap arg))))

(defun mgp-entex-cmd-font (globalp defaultp index)
  (let ((arg (mgp-entex-get-string-arg)))
    (if arg
	(mgp-entex-set-setting globalp defaultp index 'font arg))))

(defun mgp-entex-cmd-xfont (globalp defaultp index)
  (let ((arg (mgp-entex-get-string-arg)))
    (if arg
	(mgp-entex-set-setting globalp defaultp index 'font arg))))

(defun mgp-entex-cmd-cont (globalp defaultp index)
  (mgp-entex-set-setting globalp defaultp index 'cont t))

(defun mgp-entex-cmd-nodefault (globalp defaultp index)
  (if globalp
      (error "%nodefault can't be used in preamble"))
  (let ((len (length mgp-local-setting))
	(i 2))
    (aset mgp-local-setting 1 (list 'font nil))
    (while (< i len)
      (aset mgp-local-setting i (list 'font nil))
      (setq i (1+ i)))))

(defun mgp-entex-cmd-bar (globalp defaultp index)
  (let ((color (mgp-entex-get-string-arg))
	(width (or (mgp-entex-get-number-arg) 10))
	(start (or (mgp-entex-get-number-arg) 0))
	(length (or (mgp-entex-get-number-arg) 100)))
    (mgp-entex-set-setting globalp defaultp index 'bar
			   (list color width start length))))

(defun mgp-entex-cmd-image (globalp defaultp index)
  (let ((arg1 (mgp-entex-get-string-arg)))
    (if arg1
	(let ((arg2 (mgp-entex-get-string-arg))
	      (arg3 (mgp-entex-get-string-arg))
	      (arg4 (mgp-entex-get-string-arg))
	      (arg5 (mgp-entex-get-string-arg)))
;;; SYNTAX for %image is documented as below:	  
;;; %image "imagefile" <numcolor> <xzoomrate> <yzoomrate> <zoomflag>
;;; %image "imagefile" [<numcolor>] <screensize>
;;; but it seems the second form should actually be:
;;; %image "imagefile" [ [<numcolor>] <screensize> ]
	  (if arg4
	      (setq arg2 (and arg2 (string-to-int arg2))
		    arg3 (and arg3 (string-to-int arg3))
		    arg4 (and arg4 (string-to-int arg4))
		    arg5 (and arg5 (string-to-int arg5)))
	    (if arg3
		(setq arg2 (string-to-int arg2))
	      (setq arg3 arg2 arg2 nil)))
	  (mgp-entex-set-setting globalp defaultp index 'image
				 (list arg1 arg2 arg3 arg4 arg5))))))

(defun mgp-entex-cmd-prefix (globalp defaultp index)
  (let ((arg (mgp-entex-get-string-arg)))
    (if arg
	(mgp-entex-set-setting globalp defaultp index 'prefix arg))))

(defun mgp-entex-cmd-icon (globalp defaultp index)
  (let* ((type (mgp-entex-get-string-arg))
	 ;; Currently color and size are just ignored.
	 (color (mgp-entex-get-string-arg))
	 (size (mgp-entex-get-number-arg))
	 (str (cond ((string= type "arc") "$\\bullet$")
		    ((string= type "box") "$\\Box$")
		    ((string= type "dia") "$\\Diamond$")
		    ((string= type "delta1") "$\\bigtriangleup$")
		    ((string= type "delta2") "$\\bigtriangledown$")
		    ((string= type "delta3") "$\\triangleright$")
		    ((string= type "delta4") "$\\triangleleft$")
		    (t "$\\diamond$"))))
    (mgp-entex-set-setting globalp defaultp index 'icon str)))

(defconst mgp-entex-special-characters
  '((?# . "\\#")
    (?$ . "\\$")
    (?% . "\\%")
    (?& . "\\&")
    (?_ . "\\_")
    (?@ . "{\\makeatletter@\\makeatother}")
    (?< . "$<$")
    (?> . "$>$")
    (?~ . "\\~{ }")))

(defconst mgp-entex-space-width 4)

(defun mgp-entex-handle-string (str prefix &optional size force-indent)
  (mgp-with-output-buffer
    (let ((len (length str))
	  (indent 0)
	  i j)
      (if prefix
	  (progn
	    (if (string-match "^ +" prefix)
		(setq indent (match-end 0)
		      prefix (substring prefix indent)))))
      (if (and (not force-indent)
	       (= indent 0) (= (length prefix) 0) (= len 0))
	  (if (eq mgp-entex-linehead t)
	      (setq mgp-entex-linehead 'empty))
	(if (or prefix force-indent)
	    (insert "{"))
	(if size
	    (mgp-entex-handle-size size))
	(if (or (> indent 0) (> (length prefix) 0))
	    (insert (format "\\mgpi{%d}{%s}" indent prefix)))
	(if (string-match "^ +" str)
	    (if (< (match-end 0) len)
		(progn
		  (setq i (match-end 0) j i)
		  (insert (format "\\mgps{%d}" i)))
	      (setq i len j i))
	  (setq i 0 j 0))
	(while (< i len)
	  (let ((slot (assq (aref str i) mgp-entex-special-characters)))
	    (if slot
		(progn
		  (if (< j i)
		      (insert (substring str j i)))
		  (insert (cdr slot))
		  (setq j (1+ i)))))
	  (setq i (1+ i)))
	(if (< j len)
	    (insert (substring str j)))
	(setq mgp-entex-linehead nil)))))

(defun mgp-entex-process-page (line)
  (setq mgp-current-line line)
  (if (memq (following-char) '(?% ?#))
      (progn
	(forward-char 1)
	(if (or (eolp) (= (preceding-char) ?#) (= (following-char) ?%))
	    nil
	  (mgp-entex-parse-cmd nil 'default line)))
    (let* ((str (buffer-substring (point) (line-end-position)))
	   (plist (aref mgp-local-setting line))
	   (continued (plist-get plist 'cont)))
      (if continued
	  (plist-put plist 'cont nil)
	(mgp-with-output-buffer
	  (cond ((eq mgp-entex-linehead 'empty)
		 (insert "\\nl\n")
		 (setq mgp-entex-linehead t))
		((not mgp-entex-linehead)
		 (insert "\\nl}\n")
		 (setq mgp-entex-linehead t)))
	  (setq line (1+ line))))
      (let (func)
	(while plist
	  (setq func (intern (concat "mgp-entex-handle-"
				     (symbol-name (car plist)))))
	  (if (fboundp func)
	      (funcall func (nth 1 plist)))
	  (setq plist (nthcdr 2 plist))))
      (let ((indent 0)
	    (len (length str)))
	(or continued
	    (while (and (< indent len) (= (aref str indent) ?\t))
	      (setq indent (1+ indent))))
	(if (> indent 0)
	    (mgp-entex-handle-indent indent str)
	  (mgp-entex-handle-string str
				   (and (not continued) mgp-entex-prefix))))))
  line)

(defun mgp-entex-start-page ()
  (mgp-with-output-buffer
    (insert "\\parbox{\\hsize}{\n")
    ))

(defun mgp-entex-finish-page (line)
  (mgp-with-output-buffer
    (let ((plist (aref mgp-local-setting line))
	  func)
      (while plist
	(setq func (intern (concat "mgp-entex-handle-"
				   (symbol-name (car plist)))))
	(if (fboundp func)
	    (funcall func (nth 1 plist)))
	(setq plist (nthcdr 2 plist))))
    (cond ((eq mgp-entex-linehead 'empty)
	   (insert "\\nl\n")
	   (setq mgp-entex-linehead t))
	  ((not mgp-entex-linehead)
	   (insert "\\nl}\n")
	   (setq mgp-entex-linehead t)))
    (insert "}\n\\newpage\n")
    (setq mgp-entex-linehead t)))

(defun mgp-entex-handle-again (&rest arg)
  (mgp-with-output-buffer
    (if mgp-mark-position
	(progn
	  ;;(setq line (car mgp-mark-position))
	  (goto-char (cdr mgp-mark-position))
	  (delete-region (point) (point-max))))))

(defun mgp-entex-handle-font (arg)
  (if arg
      (mgp-with-output-buffer
	(insert "\\normalfont")
	(cond ((string-match "bold-r" arg) (insert "\\bfseries"))
	      ((string-match "bold-[oi]" arg) (insert "\\bfseries\\itshape"))
	      ((string-match "medium-[oi]" arg) (insert "\\itshape")))
	(insert " "))))

(defun mgp-entex-define-color (arg)
  (or (member arg mgp-color-list)
      (and (eq window-system 'x)
	   (let ((color-values (x-color-values arg)))
	     (insert (format "\\definecolor{%s}{rgb}{" arg))
	     (while color-values
	       (insert (format "%.3f" (/ (float (car color-values))
					 mgp-max-color-value)))
	       (setq color-values (cdr color-values))
	       (if color-values
		   (insert ",")))
	     (insert "}")
	     t))))

(defun mgp-entex-handle-back (arg)
  (or mgp-disable-color
      (mgp-with-output-buffer
	(if (string= arg "black")
	    (setq arg "gray"))
	(if (mgp-entex-define-color arg)
	    (insert (format "\\pagecolor{%s}" arg))))))

(defun mgp-entex-handle-fore (arg)
  (or mgp-disable-color
      (mgp-with-output-buffer
	(if (mgp-entex-define-color arg)
	    (insert (format "\\color{%s}" arg))))))

(defun mgp-entex-handle-size (arg)
  (mgp-with-output-buffer
    (cond ((>= arg 10) (insert "\\Huge "))
	  ((>= arg 7) (insert "\\huge "))
	  ((>= arg 6) (insert "\\LARGE "))
	  ((>= arg 5) (insert "\\Large "))
	  ((>= arg 4) (insert "\\large "))
	  ((>= arg 3) (insert "\\normalsize "))
	  (t (insert "\\tiny ")))))

(defun mgp-entex-handle-icon (arg)
  (mgp-with-output-buffer
    (insert arg)))

(defun mgp-entex-handle-indent (indent str)
  (mgp-with-output-buffer
    (let ((prefix (or (mgp-entex-get-setting nil nil indent 'prefix t) " "))
	  (size (mgp-entex-get-setting nil nil indent 'size t))
	  (icon (mgp-entex-get-setting nil nil indent 'icon t)))
      (if icon
	  (setq prefix (concat prefix icon)))
      (mgp-entex-handle-string (substring str indent) prefix size t))))

(defun mgp-entex-handle-prefix (arg)
  (setq mgp-entex-prefix arg))

(defun mgp-entex-handle-align (arg)
  (mgp-with-output-buffer
    (insert
     (cond ((eq arg 'center) "\\centering ")
	   ((eq arg 'right) "\\raggedleft ")
	   (t "\\raggedright ")))))

(defun mgp-entex-handle-vgap (arg)
  ;; Currently we don't support it.
  )

(defun mgp-entex-handle-bar (arg)
  (mgp-with-output-buffer
    (cond ((eq mgp-entex-linehead 'empty)
	   (insert "\\nl\n")
	   (setq mgp-entex-linehead t))
	  ((not mgp-entex-linehead)
	   (insert "\\nl}\n")
	   (setq mgp-entex-linehead t)))
    (insert (format "\\mgpb{%d}{%d}{%d}\n"
		    (floor (nth 1 arg))
		    (floor (nth 2 arg))
		    (floor (nth 3 arg))))))

(defun mgp-entex-handle-image (arg)
  (let ((file (car arg))
	;;(numcolor (nth 1 arg)) ; not supported
	(xzoom (nth 2 arg))
	(yzoom (nth 3 arg))
	(zoomflag (nth 4 arg))
	(screensize))
    (setq file (concat (file-name-sans-extension file) ".ps"))
    (or (file-readable-p file)
	(setq file (concat (file-name-sans-extension file) ".eps")))
    (if (file-readable-p file)
	(mgp-with-output-buffer
	  (if zoomflag
	      (if (and (= yzoom 0) (= xzoom 0))
		  (insert (format "\\includegraphics{%s}" file))
		(insert
		 (format "\\scalebox{%f}[%f]{\\includegraphics{%s}}"
			 (* (/ (float xzoom) 100) mgp-image-scale-factor)
			 (* (/ (float yzoom) 100) mgp-image-scale-factor)
			 file)))
	    (insert (format "\\resizebox{\\hsize}{!}{\\includegraphics{%s}}"
			    file)))))))


(provide 'mgp)

;; mgp.el ends here
magicpoint-1.09a/contrib/mgp-el/mgp.sty100644   2007      0        7101  6712076770  16376 0ustar  kazuwheel%%% mgp.sty --- style file for a LaTeX file created by mgp.el
%%% Copyright (C) 1999 Electrotechnical Lab., JAPAN

%% Author: K.Handa <handa@etl.go.jp>
%% Created: 1999/04/28

%% This file is not part of GNU Emacs, but the same permissions apply.
%%
%% GNU Emacs is free software; you can redistribute it and/or modify
%% it under the terms of the GNU General Public License as published by
%% the Free Software Foundation; either version 2, or (at your option)
%% any later version.
%%
%% GNU Emacs 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 General Public License for more details.
%%
%% You should have received a copy of the GNU General Public License
%% along with GNU Emacs; see the file COPYING.  If not, write to the
%% Free Software Foundation, Inc., 59 Temple Place - Suite 330,
%% Boston, MA 02111-1307, USA.

%% Disable special handling of `@'.
\makeatletter
%% Copied from slides.cls and modified slightly.
\def\rmdefault{lcmss}        % no roman
\def\sfdefault{lcmss}
\def\ttdefault{lcmtt}
\def\itdefault{sl}
\def\sldefault{sl}
\def\bfdefault{bx}
\def\ifourteenpt{13.82}
\def\iseventeenpt{16.59}
\def\itwentypt{19.907}
\def\itwentyfourpt{23.89}
\def\itwentyninept{28.66}
\def\ithirtyfourpt{34.4}
\def\ifortyonept{41.28}
\def\@setfontsize@parms#1{%
   \lineskip #1\relax%
   \parskip #1\relax%
  \baselineskip\baselinestretch\baselineskip%
  \normalbaselineskip\baselineskip}
\def\normalsize{%
      \@setfontsize\normalsize\itwentypt{22\p@}%
      \@setfontsize@parms{\z@}}
\def\small{\@setfontsize\small\iseventeenpt{19\p@ plus3\p@}%
           \@setfontsize@parms{2\p@}}
\let\footnotesize=\small
\let\scriptsize=\small
\def\tiny{\@setfontsize\tiny\ifourteenpt{16\p@ plus2\p@}%
          \@setfontsize@parms{2pt}}
\def\large{\@setfontsize\large\itwentyfourpt{26\p@ plus8\p@}%
           \@setfontsize@parms{2\p@}}
\def\Large{\@setfontsize\Large\itwentyninept{31\p@ plus10\p@}%
           \@setfontsize@parms{2\p@}}
\def\LARGE{\@setfontsize\LARGE\ithirtyfourpt{36\p@ plus10\p@}%
           \@setfontsize@parms{2\p@}}
\def\huge{\@setfontsize\huge\ifortyonept{43\p@ plus10\p@}%
           \@setfontsize@parms{2\p@}}
\let\Huge\huge
%% Put 1cm margin at top and bottom.
\setlength\topmargin{-1in}
\advance\topmargin by1cm
\textheight\paperheight\advance\textheight by-2cm
%% Put 1cm margin at left and right
\setlength\oddsidemargin{-1in}
\advance\oddsidemargin by1cm
\textwidth\paperwidth\advance\textwidth by-2cm
%% No surplus spaces.
\setlength\headheight{0pt}
\setlength\headsep   {0pt}
\setlength\topskip   {0pt}
\setlength\footskip  {0pt}
\setlength\parindent {0pt}
\pagestretch20mm
\pagestyle{empty}
%% Special command for line breaking.
\def\nl{\hskip0pt minus10mm\nopagebreak[4]\\}
\newdimen\mgpdimenx
\newdimen\mgpdimeny
\newbox\mgpbox
%% Hanging indent
\def\mgpi#1#2{\setbox\mgpbox=\hbox{#2\hskip.5mm}%
\mgpdimenx#1em\divide\mgpdimenx by2\advance\mgpdimenx by\wd\mgpbox%
\parindent\mgpdimenx\hangindent\mgpdimenx\indent\llap{\box\mgpbox}\ignorespaces}
%% Horizontal skip
\def\mgps#1{\mgpdimenx#1em\divide\mgpdimenx by2\hskip\mgpdimenx}
%% Draw horizontal bar.
\def\mgpb#1#2#3{%
\mgpdimeny\textheight\divide\mgpdimeny by1000#1\multiply\mgpdimeny by#1%
\mgpdimenx\textwidth\divide\mgpdimenx by100\multiply\mgpdimenx by#2%
\makebox[\mgpdimenx]{}%
\mgpdimenx\textwidth\divide\mgpdimenx by100\multiply\mgpdimenx by#3%
\rule{\mgpdimenx}{\mgpdimeny}\\\vskip-10pt minus10pt}
%% Enable special handling of `@'.
\makeatother
%% Some other packages
\usepackage{latexsym}
\usepackage{graphics}
magicpoint-1.09a/contrib/mgp-el/sample.tex100644   2007      0       12423  6712076770  17100 0ustar  kazuwheel%%% This file was generated by mgp.el (Ver.0.90).
%%%   Document source: file "sample.mgp"
\documentclass[a4paper,landscape]{article}
\input{mgp.sty}
\begin{document}
\parbox{\hsize}{
\normalfont \huge \nl
\nl
\nl
\normalfont \centering {MagicPoint\nl}
\normalfont \nl
\nl
\large {Keio University\nl}
{Yoshifumi Nishida\nl}
\normalsize {nishida{\makeatletter@\makeatother}sfc.wide.ad.jp\nl}
\nl
\large {Type SPC key!!\nl}
}
\newpage
\parbox{\hsize}{
\normalfont \raggedright \tiny \nl
\huge {\mgpi{1}{}How to Use \nl}
\tiny \mgpb{10}{0}{100}
{\mgpi{1}{}\nl}
\normalfont \Large {\Large \mgpi{2}{$\Box$}forward page-$>$ press mouse1 button \nl}
{\Large \mgpi{2}{$\Box$}backward page-$>$ press mouse3 button \nl}
{\Large \mgpi{2}{$\Box$}quit -$>$ press q key \nl}
{\mgpi{1}{}\nl}
}
\newpage
\parbox{\hsize}{
\normalfont \raggedright \tiny \nl
\huge {\mgpi{1}{}Command Line Option \nl}
\tiny \mgpb{10}{0}{100}
{\mgpi{1}{}\nl}
\normalfont \Large {\mgpi{4}{-h:}display usage.\nl}
{\mgpi{4}{-g:}geometry. Set the size of window, and placement.\nl}
{\mgpi{4}{-o:}Do not override window manager.\nl}
{\mgpi{4}{-b:}bgcolor. Set background color to bgcolor. (default: black)\nl}
{\nl}
\nl
{\nl}
}
\newpage
\parbox{\hsize}{
\normalfont \raggedright \tiny \nl
\huge {\mgpi{1}{}Place text whereever you like!\nl}
\tiny \mgpb{10}{0}{100}
{\mgpi{1}{}\nl}
\normalfont \LARGE \centering {\mgpi{1}{}center\nl}
{\mgpi{1}{}\nl}
{\mgpi{1}{}\nl}
\raggedright {\mgpi{1}{}left\nl}
{\mgpi{1}{}\nl}
\raggedleft {\mgpi{1}{}right\nl}
}
\newpage
\parbox{\hsize}{
\normalfont \raggedright \tiny \nl
\huge {\mgpi{1}{}Use any font size as you like!\nl}
\tiny \mgpb{10}{0}{100}
{\mgpi{1}{}\nl}
\normalfont \Large {\mgpi{1}{}\nl}
\centering \Huge {\mgpi{1}{}Hello World\nl}
\huge {\mgpi{1}{}Hello World\nl}
\Large {\mgpi{1}{}Hello World\nl}
\large {\mgpi{1}{}Hello World\nl}
\normalsize {\mgpi{1}{}Hello World\nl}
\tiny {\mgpi{1}{}Hello World\nl}
\tiny {\mgpi{1}{}Hello World\nl}
}
\newpage
\parbox{\hsize}{
\normalfont \raggedright \tiny \nl
\huge {\mgpi{1}{}Font is selectable\nl}
\tiny \mgpb{10}{0}{100}
{\mgpi{1}{}\nl}
\normalfont \Large {\mgpi{1}{}\nl}
\large \centering {\mgpi{1}{}\nl}
\normalfont {\mgpi{1}{}This is times-medium-r\nl}
{\mgpi{1}{}\nl}
\normalfont\itshape {\mgpi{1}{}This is times-medium-i\nl}
{\mgpi{1}{}\nl}
\normalfont\bfseries {\mgpi{1}{}This is times-bold-r\nl}
{\mgpi{1}{}\nl}
\normalfont\bfseries\itshape {\mgpi{1}{}This is times-bold-i\nl}
}
\newpage
\parbox{\hsize}{
\normalfont \raggedright \tiny \nl
\huge {\mgpi{1}{}Control can be mixed\nl}
\tiny \mgpb{10}{0}{100}
{\mgpi{1}{}\nl}
\normalfont \Large {\mgpi{1}{}\nl}
\normalfont \large {\mgpi{1}{}This is a\normalfont \LARGE Test\normalfont \Large message\nl}
\normalfont \Large {\mgpi{1}{}\nl}
}
\newpage
\parbox{\hsize}{
\normalfont \raggedright \tiny \nl
\huge {\mgpi{1}{}Automatic folding of long line!\nl}
\tiny \mgpb{10}{0}{100}
{\mgpi{1}{}\nl}
\normalfont \Large {\Large \mgpi{2}{$\Box$}Hello, this is MagicPoint. I can properly handle the folding opeation of very long line, of course english word-wise.  The source code of this line is made up by a single line.\nl}
{\large \mgpi{6}{$\bullet$}This is the next line. Even if the indentation changes, I can handle this!  Yey!\nl}
{\Large \mgpi{2}{$\Box$}You can also connect the line using backslash.  Yes, UNIX tradition.\nl}
}
\newpage
\parbox{\hsize}{
\normalfont \raggedright \tiny \nl
\huge {\mgpi{1}{}Place inline images!\nl}
\tiny \mgpb{10}{0}{100}
{\mgpi{1}{}\normalfont \Large \centering \nl}
}
\newpage
\parbox{\hsize}{
\normalfont \raggedright \tiny \nl
\huge {\mgpi{1}{}Special effects!\nl}
\tiny \mgpb{10}{0}{100}
{\mgpi{1}{}\nl}
\normalfont \Large {\mgpi{1}{}\nl}
\LARGE \centering {\mgpi{1}{}test message\nl}
{\mgpi{1}{}\nl}
{\mgpi{1}{}test message\nl}
{\mgpi{1}{}\nl}
{\mgpi{1}{}test message\nl}
}
\newpage
\parbox{\hsize}{
\normalfont \raggedright \tiny \nl
\huge {\mgpi{1}{}Pause\nl}
\tiny \mgpb{10}{0}{100}
{\mgpi{1}{}\nl}
\normalfont \Large {\Large \mgpi{2}{$\Box$}tap space bar (twice) to proceed.\nl}
{\mgpi{1}{}\nl}
\centering {\mgpi{1}{}Happy hacking!\nl}
{\mgpi{1}{}Happy hacking!\nl}
{\mgpi{1}{}Happy hacking!\nl}
}
\newpage
\parbox{\hsize}{
\normalfont \raggedright \tiny \nl
\huge {\mgpi{1}{}Grab command output into foils\nl}
\tiny \mgpb{10}{0}{100}
{\mgpi{1}{}\nl}
\normalfont \Large {\Large \mgpi{2}{$\Box$}ls -l /kernel /bsd\nl}
{\mgpi{1}{}\nl}
\normalsize {\mgpi{5}{}\nl}
{\Large \mgpi{2}{$\Box$}echo "this is test" | rev\nl}
{\mgpi{5}{}\nl}
{\mgpi{5}{}this is test\nl}
{\mgpi{5}{}\nl}
}
\newpage
\parbox{\hsize}{
\normalfont \raggedright \tiny \nl
\huge {\mgpi{1}{}Subprocess (multimedia!)\nl}
\tiny \mgpb{10}{0}{100}
{\mgpi{1}{}\nl}
\normalfont \Large {\mgpi{1}{}\nl}
{\Large \mgpi{2}{$\Box$}Invoke xanim/mpegplay for multimedia presentation! :-)\nl}
{\mgpi{1}{}\nl}
{\Large \mgpi{2}{$\Box$}No duplicated subprocess for one declaration.\nl}
{\Large \mgpi{2}{$\Box$}Geometry can be presentation-screen relative.\nl}
{\Large \mgpi{2}{$\Box$}xeyes will vanish if you switch the page.\nl}
{\mgpi{1}{}\nl}
}
\newpage
\parbox{\hsize}{
\normalfont \raggedright \tiny \nl
\huge {\mgpi{1}{}Have a nice day!\nl}
\tiny \mgpb{10}{0}{100}
{\mgpi{1}{}\nl}
\normalfont \Large {\Large \mgpi{2}{$\Box$}Visit\nl}
{\large \mgpi{6}{$\bullet$}\normalfont http://www.mew.org/mgp/\nl}
\normalfont {\Large \mgpi{2}{$\Box$}for upcoming information.\nl}
}
\newpage

\end{document}
magicpoint-1.09a/contrib/.cvsignore100644   2007      0         111  6470775305  15644 0ustar  kazuwheeltp2latex.pl
tp2html.pl
mgp2latex.pl
mgp2html.pl
Makefile
mgpnet
mgpnet.0
magicpoint-1.09a/contrib/Imakefile100644   2007      0        1033  6470775305  15501 0ustar  kazuwheel#define IHaveSubdirs
#define PassCDebugFlags

SUBDIRS=	xwintoppm

MakeSubdirs($(SUBDIRS))

#if defined(ImakeConfigRelease) && ImakeConfigRelease >= 6
InstallNamedTarget(install,mgpnet,$(INSTBINFLAGS),$(BINDIR),mgpnet) /*R6 only*/
#else
InstallNamedProg(mgpnet,mgpnet,$(BINDIR)) /*obsoleted in R6?*/
#endif
InstallManPage(mgpnet,$(MANDIR))

all::
depend::
install::

distclean:: clean
	for i in $(SUBDIRS); do \
		(cd $$i; if [ -f Makefile ]; then make distclean; fi) ;\
	done
	-/bin/rm -f mgpnet mgpnet.0 mgp2latex.pl mgp2html.pl Makefile
magicpoint-1.09a/contrib/eqn2eps.sh100755   2007      0         777  6630617101  15565 0ustar  kazuwheel#! /bin/sh
#
# The script is originary contributed by 
# Sylvain Pion <Sylvain.Pion@sophia.inria.fr>
# 	modified by Youjiro UO to support of eqn format formura
#
# Expected usage:
#	%filter "eqn2eps.sh eqn1"
#	1 over sqrt {ax sup 2+bx+c}
#	%endfilter
#	%center, image "eqn1.eps" 0 400 400 1
#
# temporary filename (without .eps suffix)
tmp=$1

echo '.EQN' > $tmp.eqn
echo '.EQ' >> $tmp.eqn
cat >> $tmp.eqn
echo '.EN' >> $tmp.eqn
groff -e $tmp.eqn > $tmp.ps
ps2epsi $tmp.ps $tmp.eps
/bin/rm -f $tmp.eqn $tmp.ps 
magicpoint-1.09a/contrib/mgp-mode.el100644   2007      0       41430  7026506457  15742 0ustar  kazuwheel;; mgp-mode.el 
;;     --- A mode for editing MagicPoint files
;;
;;  Tested on Mule 2.3, based on GNU Emacs 19.28


;; Copyright (C) 1999  Hirotsugu Kakugawa

;; Maintainer: Hirotsugu Kakugawa (h.kakugawa@computer.org)
;;   1 Apr 1999 1.00  First Implementation
;;   2 Apr 1999 1.01  Added mgp-direc-emph. Changed key bindings.
;;   2 Apr 1999 1.10  Added jumping to error line in MagicPoint file
;;   4 Apr 1999 1.20  Added directive completion input feature
;;   5 Apr 1999 1.21  Added starting MagicPoint at the current page 
;;   9 Apr 1999 1.22  Changed mistakes in software license.
;;   8 Dec 1999 1.30  Added syntax hilighting. Carlos Puchol (cpg@puchol.com)

;; This software is free software; you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation; either version 2, or (at your option)
;; any later version.

;; This software 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 General Public License for more details.

;; You should have received a copy of the GNU General Public License
;; along with GNU Emacs; see the file COPYING.  If not, write to
;; the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.


;; In your ~/.emacs (for example)
;; 
;;    (setq auto-mode-alist
;;          (cons '("\\.mgp?\\'" . mgp-mode) 
;; 	       auto-mode-alist))
;;    (autoload 'mgp-mode "mgp-mode")
;;    (setq mgp-options "-g 800x600")
;;    (setq mgp-window-height 6)
;;    (cond 
;;     ((= emacs-major-version 19)     ;; Emacs 19, Mule 2.3
;;      (setq mgp-mode-hook
;;    	(function (lambda () 
;;    		    (set-file-coding-system '*iso-2022-jp*unix)))))
;;     ((= emacs-major-version 20)     ;; Emacs 20
;;      (setq mgp-mode-hook
;;    	(function (lambda ()
;;    		    (set-file-coding-system-for-read 'iso-2022-jp-unix))))))



;; Editting Commands:
;;
;;   KEY SEQUENCE    DESCRIPTION
;;   ------------    ----------------------------------------------------------
;;   M-x mgp-mode    Change the mode of current buffer to Magic-Point mode
;;   C-c C-v         Run MagicPoint for the current buffer.
;;                   If prefix argument with explicit numbers are given, the 
;;                   specified page number is displayed as an inital page.
;;                   If prefix argument without numbe (only 'C-u') is given,
;;                   the page where the cursor is displayed.
;;                       Example 1: C-c C-v  ==> the first page
;;                       Example 2: C-u C-c C-v  ==> the current page
;;                       Example 3: C-u 7 C-c C-v  ==> the seventh page
;;   C-x ` or C-c `  Jump the cursor to the error line in the MagicPoint file.
;;   C-c C-c         Kill the running MagicPoint (if any).
;;   M-TAB           Completing input. If the character at the beginning of 
;;                   line is %, MagicPoint directives are completed. Othewise,
;;                   ISPELL is invoked to complete a word.
;;   C-c C-f         Insert the "fore" directive.
;;   C-c C-b         Insert the "back" directive.
;;   C-c C-p         Insert the "page" directive.
;;   C-c C-l         Insert the "lcutin" directive.
;;   C-c C-r         Insert the "rcutin" directive.
;;   C-c C-i         Insert the "image" directive.      
;;   C-c C-e         Insert a sequence of directives to emphasizing text.
;;   C-c c           Insert the "center" directive.
;;   C-c l           Insert the "leftfill" directive.
;;   C-c L           Insert the "left-line" directive.
;;   C-c r           Insert the "right-line" directive.
;;   C-c f           Insert the "font" directive.
;;   C-c b           Insert the "bimage" directive.
;;   C-c e           Insert the "embed, endembed" directive sequnce.
;;   C-c i           Insert the "icon" directive.
;;   C-c p           Insert the "pause" directive.
;;   C-c a           Insert the "again" directive.
;;   C-c m           Insert the "mark" directive.
;;   C-c n           Insert the "nodefault" directive.
;;   C-c s           Insert the "size" directive.
;;   C-c B           Insert the "bar" directive.
;;   C-c C           Insert the "cont" directive.
;;   C-c G           Insert the "bgrad" directive.
;;   C-c P           Insert the "prefix" directive.
;;   C-c S           Insert the "system" directive.
;;   C-c F           Insert the "filter, endfilter" directive sequence.


;;  Variables for customization
;;   NAME                     DISCRIPTION (buffer local var. is marked *)
;;   --------------------     ---------------------------------------------
;;   mgp-program               MagicPoint program name
;;   mgp-options              *Command line option for MagicPoint
;;   mgp-directives-optional   List of directives for input completion
;;   mgp-window-height         Height of window for output of MagicPoint
;;   mgp-page-separator       *String inserted before %page directive
;;   mgp-emph-color           *Color name for emphasized text, C-c C-e 
;;   mgp-emph-color-normal    *Color name for unemphasizing text, C-c C-e 
;;


(require 'compile)

;; Program name of MagicPoint 
(defvar  mgp-program "mgp"
  "*MagicPoint program name")

;; Command line option for MagicPoint
(defvar  mgp-options nil
  "*MagicPoint optional arguments. nil or  string. Buffer local.")

;; Height of MagicPoint message window
(defvar mgp-window-height nil
  "*Number of lines of a MagicPoint window.  If nil, use Emacs default.")

;; MagicPoint directive alist for completing input
(defvar mgp-directives
  '("size" "fore" "back" "bgrad" "ccolor" "left" "leftfill" "center" "right" 
    "shrink" "lcutin" "rcutin" "cont" "nodefault" "xfont" "vfont" 
    "tfont" "tfont0" "bar" "image" "prefix" "icon" "bimage" "default"
    "tab" "tabprefix" "page" "vgap" "hgap" "pause" "mark" "again" 
    "system" "xsystem" "filter" "endfilter" "vfcap" "tfdir" "deffont" 
    "font" "embed" "endembed" "noop" "linestart" "lineend" "quality")
  "*List of MagicPoint directives for completing input.")
(defvar mgp-directives-optional nil
  "*List of optional MagicPoint directives for completing input. For customization.")

;; Style
(defvar mgp-page-separator "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%"
  "Page separator string.")
(defvar mgp-emph-color "red"
  "The text color name for emphasized words, for mgp-direc-emph function.")
(defvar mgp-emph-color-normal "black"
  "The text color name for non-emphasized words, for mgp-direc-emph function.")

(cond ((= emacs-major-version 19)
       ;; Emacs 19 settings
       (cond ((fboundp 'copy-face)
	      (require 'hilit19)
	      (hilit-set-mode-patterns
	       '(mgp-mode)
	       '(
		 ("^%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*" nil Yellow)
		 ("^#.*" nil comment)
		 ("\"" "[^\\]\"" string)
		 ("\\<\\(size\\|fore\\|back\\|bgrad\\|ccolor\\|left\\|leftfill\\|center\\|right\\|shrink\\|lcutin\\|rcutin\\|cont\\|nodefault\\|xfont\\|vfont\\|tfont\\|tfont0\\|bar\\|image\\|prefix\\|icon\\|bimage\\|default\\|tab\\|tabprefix\\|page\\|vgap\\|hgap\\|pause\\|mark\\|again\\|system\\|xsystem\\|filter\\|endfilter\\|vfcap\\|tfdir\\|deffont\\|font\\|embed\\|endembed\\|noop\\|linestart\\|lineend\\|quality\\)\\>" nil keyword)
		 ("^%.*" nil defun)
		 ))))))


;; History
(defvar mgp-history nil
  "History of mgp commands.")

;; Abbrev Table
(defvar mgp-mode-abbrev-table nil
  "Abbrev table used while in mgp mode.")
(define-abbrev-table 'mgp-mode-abbrev-table ())

;; Directive Completion
(defvar mgp-directive-alist nil
  "Alist of MagicPoint directives.")
(if mgp-directive-alist
    ()
  (setq mgp-directive-alist 
	(mapcar (function (lambda (direc) (list direc)))
		(sort (append mgp-directives mgp-directives-optional) 
		      'string<))))

;; Syntax Table
(defvar mgp-mode-syntax-table nil
  "Syntax table used while in mgp mode.")
(if mgp-mode-syntax-table
    ()
  (setq mgp-mode-syntax-table (make-syntax-table))
  (modify-syntax-entry ?% ".   " mgp-mode-syntax-table)
  (modify-syntax-entry ?\" ".   " mgp-mode-syntax-table)
  (modify-syntax-entry ?\\ ".   " mgp-mode-syntax-table)
  (modify-syntax-entry ?' "w   " mgp-mode-syntax-table))

;; Mode Map
(defvar mgp-mode-map nil
  "Keymap for Mgp (MagicPoint) mode.
Many other modes, such as Mail mode, Outline mode and Indented Mgp mode,
inherit all the commands defined in this map.")
(if mgp-mode-map
    ()
  (setq mgp-mode-map (make-sparse-keymap))
  (define-key mgp-mode-map "\t" 'tab-to-tab-stop)
  (define-key mgp-mode-map "\e\t" 'mgp-complete-word)
  (define-key mgp-mode-map "\C-c\C-v" 'mgp-run-mgp)
  (define-key mgp-mode-map "\C-c\C-c" 'kill-compilation)
  (define-key mgp-mode-map "\C-c`"    'next-error)
  (define-key mgp-mode-map "\C-x`"    'next-error)
  (define-key mgp-mode-map "\C-c\C-f" 'mgp-direc-fore)
  (define-key mgp-mode-map "\C-c\C-b" 'mgp-direc-back)
  (define-key mgp-mode-map "\C-c\C-p" 'mgp-direc-page)
  (define-key mgp-mode-map "\C-c\C-l" 'mgp-direc-lcutin)
  (define-key mgp-mode-map "\C-c\C-r" 'mgp-direc-rcutin)
  (define-key mgp-mode-map "\C-c\C-i" 'mgp-direc-image)
  (define-key mgp-mode-map "\C-c\C-e" 'mgp-direc-emph)
  (define-key mgp-mode-map "\C-cc" 'mgp-direc-center-line)
  (define-key mgp-mode-map "\C-cl" 'mgp-direc-leftfill)
  (define-key mgp-mode-map "\C-cL" 'mgp-direc-left-line)
  (define-key mgp-mode-map "\C-cr" 'mgp-direc-right-line)
  (define-key mgp-mode-map "\C-cf" 'mgp-direc-font)
  (define-key mgp-mode-map "\C-cb" 'mgp-direc-bimage)
  (define-key mgp-mode-map "\C-ce" 'mgp-direc-embed)
  (define-key mgp-mode-map "\C-ci" 'mgp-direc-icon)
  (define-key mgp-mode-map "\C-cp" 'mgp-direc-pause) 
  (define-key mgp-mode-map "\C-ca" 'mgp-direc-again) 
  (define-key mgp-mode-map "\C-cm" 'mgp-direc-mark) 
  (define-key mgp-mode-map "\C-cn" 'mgp-direc-nodefault)
  (define-key mgp-mode-map "\C-cs" 'mgp-direc-size)
  (define-key mgp-mode-map "\C-cB" 'mgp-direc-bar)
  (define-key mgp-mode-map "\C-cC" 'mgp-direc-cont)
  (define-key mgp-mode-map "\C-cG" 'mgp-direc-bgrad)
  (define-key mgp-mode-map "\C-cP" 'mgp-direc-prefix) 
  (define-key mgp-mode-map "\C-cS" 'mgp-direc-system)
  (define-key mgp-mode-map "\C-cF" 'mgp-direc-filter))

;; MagicPoint mode
(defun mgp-mode ()
  "Major mode for editing MagicPoint files.

Special commands:
\\{mgp-mode-map}
Turning on Mgp mode calls the value of the variable `mgp-mode-hook',
if that value is non-nil.

Variables for customization
  NAME                     DISCRIPTION (buffer local var. is marked *)
  --------------------     ---------------------------------------------
   mgp-program               MagicPoint program name
   mgp-options              *Command line option for MagicPoint
   mgp-directives-optional   List of directives for input completion
   mgp-window-height         Height of window for output of MagicPoint
   mgp-page-separator       *String inserted before %page directive
   mgp-emph-color           *Color name for emphasized text, C-c C-e 
   mgp-emph-color-normal    *Color name for unemphasizing text, C-c C-e 
"
  (interactive)
  (kill-all-local-variables)
  (use-local-map mgp-mode-map)
  (setq mode-name "MagicPoint")
  (setq major-mode 'mgp-mode)
  (setq local-abbrev-table mgp-mode-abbrev-table)
  (set-syntax-table mgp-mode-syntax-table)
  (make-local-variable 'mgp-options)
  (make-local-variable 'mgp-page-separator)
  (make-local-variable 'mgp-emph-color)
  (make-local-variable 'mgp-emph-color-normal)
  (run-hooks 'mgp-mode-hook))


;; Inserting Directives

(defun mgp-direc-center-line ()
  (interactive)
  (mgp-insert-directive "center"))
(defun mgp-direc-left-line ()
  (interactive)
  (mgp-insert-directive "left"))
(defun mgp-direc-leftfill ()
  (interactive)
  (mgp-insert-directive "leftfill"))
(defun mgp-direc-right-line ()
  (interactive)
  (mgp-insert-directive "right"))
(defun mgp-direc-image ()
  (interactive)
  (mgp-insert-directive "image" ""))
(defun mgp-direc-fore ()
  (interactive)
  (mgp-insert-directive "fore" ""))
(defun mgp-direc-back ()
  (interactive)
  (mgp-insert-directive "back" ""))
(defun mgp-direc-lcutin ()
  (interactive)
  (mgp-insert-directive "lcutin"))
(defun mgp-direc-rcutin ()
  (interactive)
  (mgp-insert-directive "rcutin"))
(defun mgp-direc-cont ()
  (interactive)
  (mgp-insert-directive "cont"))
(defun mgp-direc-nodefault ()
  (interactive)
  (mgp-insert-directive "nodefault"))
(defun mgp-direc-bar ()
  (interactive)
  (mgp-insert-directive "bar" t))
(defun mgp-direc-pause ()
  (interactive)
  (mgp-insert-directive "pause"))
(defun mgp-direc-font ()
  (interactive)
  (mgp-insert-directive "font" ""))
(defun mgp-direc-noop ()
  (interactive)
  (mgp-insert-directive "noop"))
(defun mgp-direc-system ()
  (interactive)
  (mgp-insert-directive "system" ""))
(defun mgp-direc-bgrad ()
  (interactive)
  (mgp-insert-directive "bgrad" t))
(defun mgp-direc-size ()
  (interactive)
  (mgp-insert-directive "size" t))
(defun mgp-direc-prefix ()
  (interactive)
  (mgp-insert-directive "prefix" ""))
(defun mgp-direc-icon ()
  (interactive)
  (mgp-insert-directive "icon" t))
(defun mgp-direc-bimage ()
  (interactive)
  (mgp-insert-directive "bimage" ""))
(defun mgp-direc-mark ()
  (interactive)
  (mgp-insert-directive "mark"))
(defun mgp-direc-again ()
  (interactive)
  (mgp-insert-directive "again"))

(defun mgp-insert-directive (dirc &optional arg)
  (let ((pos-eol (save-excursion
		   (end-of-line)
		   (point))))
    (beginning-of-line)
    (if (looking-at "%")
	(if (re-search-forward "[a-zA-Z]" pos-eol t)
	    (progn
	      (end-of-line)
	      (insert ", "))
	  (beginning-of-line)
	  (forward-char 1))
      (insert "%")))
  (insert dirc)
  (if arg
      (if (stringp arg)
	  (insert (concat " " "\"" arg "\""))
	(insert " ")
	(backward-char 1))))

(defun mgp-direc-page ()
  (interactive)
  (insert mgp-page-separator)
  (insert "\n%page\n"))

(defun mgp-direc-filter ()
  (interactive)
  (mgp-insert-directive2 "filter"))
(defun mgp-direc-embed ()
  (interactive)
  (mgp-insert-directive2 "embed"))
(defun mgp-insert-directive2 (direc)
  (insert (concat "%" direc "\n%end" direc "\n")))

(defun mgp-direc-emph (n)
  (interactive "P")
  (let ((cn
	 (concat "%" (if n "cont, " "") "fore "))
	(c1 (if mgp-emph-color 
		mgp-emph-color ""))
	(c2 (if mgp-emph-color-normal 
		mgp-emph-color-normal  "")))
    (insert (concat cn "\"" c1 "\"\n\n"))
    (insert (concat cn "\"" c2 "\"\n"))
    (previous-line 2)))


;; Running MagicPoint

(defun mgp-run-mgp (command-args)
  (interactive
   (list (let ((page-opt ""))
	   (if current-prefix-arg
	       (setq page-opt 
		     (concat " -p " 
			     (mgp-current-page-position current-prefix-arg) 
			     " ")))
	   (read-from-minibuffer 
	    "Run MagicPoint: "
	    (concat mgp-program " " mgp-options page-opt)
	    nil nil 'mgp-history))))
  (if (buffer-modified-p)
      (if (y-or-n-p "MagicPoint document is modified. Save it? ")
	  (save-buffer)))
  (if (buffer-file-name (current-buffer))
      (let ((compilation-window-height mgp-window-height))
	(compile-internal 
	 (concat command-args " " 
		 (file-name-nondirectory (buffer-file-name (current-buffer))))
	 "No more errors" "MagicPoint"))))

(defun mgp-current-page-position (arg)
  (if (numberp arg)
      (if (<= arg 0)
	  1
	(let ((total (mgp-total-pages)))
	  (if (< arg total)
	      arg
	    total)))
    (save-excursion
      (end-of-line)
      (let ((bound (point))
	    (page 0))
	(goto-char (point-min))
	(while (search-forward "\n%page" bound t)
	  (setq page (+ page 1)))
	(number-to-string (if (= page 0) 1 page))))))

(defun mgp-total-pages ()
  (save-excursion
    (let ((pages 0))
      (goto-char (point-min))
      (while (search-forward "\n%page" (point-max) t)
	(setq pages (+ pages 1)))
      pages)))


;; Completion 

(defun mgp-complete-word ()
  "Perform completion on a MagicPoint directive or a word preceding point."
  (interactive)
  (if (not (save-excursion
	     (beginning-of-line)
	     (looking-at "%")))
      (ispell-complete-word)
    (if (save-excursion 
	  (goto-char (max (point-min) (- (point) 1)))
	  (= (char-syntax (following-char)) ?\w))
	(let* ((end (point))
	       (beg (save-excursion
		      (backward-word 1)
		      (while (= (char-syntax (following-char)) ?\')
			(forward-char 1))
		      (point)))
	       (pattern (buffer-substring beg end)))
	  (mgp-complete-directive pattern))
      (mgp-complete-directive ""))))

(defun mgp-complete-directive (pattern)
  (let ((completion (try-completion pattern mgp-directive-alist)))
    (cond ((eq completion t)
	   (message "Sole completion"))
	  ((null completion)
	   (message "Can't find completion for \"%s\"" pattern)
	   (ding))
	  ((not (string= pattern completion))
	   (delete-region beg end)
	   (insert completion))
	  (t
	   (message "Making completion list...")
	   (let* ((lizt (all-completions pattern mgp-directive-alist))
		  (new))
	     (while lizt
	       (setq new (cons (car lizt) new))
	       (setq lizt (cdr lizt)))
	     (setq lizt (nreverse new))
	     (with-output-to-temp-buffer "*Completions*"
	       (display-completion-list lizt)))
	   (message "Making completion list...%s" "done")))))

;;; mgp-mode.el ends here
magicpoint-1.09a/contrib/mgp2html.pl.in100644   2007      0       21136  6762437277  16421 0ustar  kazuwheel#! @mgp_cv_path_perl@

# 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 $
#
# 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 LIABLE
# 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.

@keywords = split(/\s+/, <<EOF);
@mgp_keywords@
EOF

$alignmode = '';
$outputsomething = 0;
$page = -1;
$line = 0;
$doimage = 1;
$nodefault = 0;
$indent = 0;
$cont = 0;
$colortext = "";
$colorbg = "";
$colorlink = "";
$colorvflink = "";
$mgpdefaultfontsize = 5;
$mgpfontsize = -1;
$htmldefaultfontsize = -1;
$htmlfontsize = -1;
$htmlfontsizemin = 1;
$htmlfontsizemax = 9;
$htmlfontcol = "";
$colormode = 0;
$colorlast = "";
$infont = 0;
$filtermode = 0;
$filtercmd = "";
$filterinput = "";

while ($_ = $ARGV[0], /^-/) {
	shift;
	last if /^--$/;
	if (/^-c/)        { $colormode = 1; next; }
	if (/^-text$/)    { $colortext = shift; next; }
	if (/^-link$/)    { $colorlink = shift; next; }
	if (/^-vlink$/)   { $colorvlink = shift; next; }
	if (/^-bgcolor$/) { $colorbg = shift; next; }
	if (/^-f$/)       { $mgpdefaultfontsize = shift; next; }
	if (/^-fh$/)      { $htmldefaultfontsize = shift; next; }
	if (/^-fhmin$/)   { $htmlfontsizemin = shift; next; }
	if (/^-fhmax$/)   { $htmlfontsizemax = shift; next; }
}
$fontsize = $defaultfontsize;
$mgpfontsize = $mgpdefaultfontsize;
$| = 1;

&prologue;
while (<>) {
	s/\n$//;

	$_ = '' if (/^#/o);

	if ($_ eq '' || $_ =~ /^[^%]/) {
		$line++;
		$cont = 0 if ($cont == 2);
		$cont = 2 if ($cont == 1);
		if ($default[$line] && !$nodefault) {
			&cmds($default[$line]);
		}
		if ($filtermode) {
			if ($filterinput eq "") {
				$filterinput = $_;
			} else {
				$filterinput = $filterinput . "\n" . $_;
			}
			next; 
		}
		next if ($page == -1);
		&output($_);
		next;
	}

	&cmds($_);
}
&pageepilogue;
&epilogue;
exit 0;


sub cmds {
	local($_) = @_;

	# special directives
	if (/^%page/i) {
		&fontreset;
		if ($page != -1) {
			&alignreset;
			&pageepilogue;
		} else {
			$page = 0;
		}
		&pageprologue;
		$line = 0;
		$nodefault = 0;
		$htmlfontsize = $htmldefaultfontsize;
		$mgpfontsize = $mgpdefaultfontsize;
		$fontchange;
		next;
	} elsif (/^%default/i) {
		$x = (split(/\s+/, $_))[1];
		$default[$x] = $_;
		$default[$x] =~ s/^%default\s+\d+\s+/\%/;
		next;
	} elsif (/^%%/) {
		&output('');
		next;
	}

	# parsed directives
	@dirs = split(/,\s*/, substr($_, 1));
	foreach $j (@dirs) {
		@dir = split(/\s+/, $j);
		$dir[0] =~ tr/A-Z/a-z/;
		if ($dir[0] eq 'image') {
			if ($dir[$#dir] =~ /^\d+x\d+/) {
				$#dir--;
			}
			$dir[1] =~ s/\"//g;
			if (!$doimage) {
				# don't use images
			} elsif (scalar(@dir) == 2 || scalar(@dir) == 3) {
				print "<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";
			} elsif (scalar(@dir) >= 5) {
				# interpretation wrong
				print "<IMG SRC=\"$dir[1]\" WIDTH=$dir[3]% HEIGHT=$dir[4]% ALT=\"$dir[1]\">\n";
			}
		} elsif ($dir[0] eq 'nodefault') {
			$nodefault++;
		} elsif ($dir[0] =~ /^(left|leftfill|right|center)$/) {
			$dir[0] =~ tr/A-Z/a-z/;
			&fontreset;
			&alignreset;
			&alignmode($dir[0]);
			&fontchange;
		} elsif ($dir[0] =~ /^filter$/) {
			&filter;
		} elsif ($dir[0] =~ /^endfilter$/) {
			&endfilter;
		} elsif ($dir[0] =~ /^cont$/) {
			$cont = 1;
		} elsif ($dir[0] =~ /^fore/) {
			$dir[1] =~ s/\"//g;
			$htmlfontcol = $dir[1];
			&fontchange if ($colormode == 1);
		} elsif ($dir[0] =~ /^size/) {
			$dir[1] =~ s/\"//g;
			$mgpfontsize = $dir[1];
			&fontchange;
		} elsif (grep($dir[0] eq $_, @keywords)) {
			# unsupported directive with 1 parameter
		} else {
			die "unsupported directive $dir[0]\n";
		}
	}
}

sub prologue {
	print "<HTML>\n";
	print "<BODY";
	print " TEXT=" . $colortext    if ($colortext ne '');
	print " BGCOLOR=" . $colorbg   if ($colorbg ne '');
	print " LINK=" . $colorlink    if ($colorlink ne '');
	print " VLINK=" . $colorvlink  if ($colorvlink ne '');
	print ">\n";
	if ($htmldefaultfontsize > 0) {
		print "<FONT SIZE=";
		print $htmldefaultfontsize;
		print ">\n";
	}
}

sub epilogue {
	if ($htmldefaultfontsize > 0){
		print "</FONT>\n";
	}
	print <<EOF;
</BODY>
</HTML>
EOF
}

sub pageprologue {
	print <<EOF
<HR>
EOF
}

sub pageepilogue {
	&output_eol;
	$page++;
	&doindent(0);
	print <<EOF
(page $page)<BR>
EOF
}

sub output {
	local($str) = @_;
	local($i) = 0;

	while ($str =~ /^\t/) {
		$i++;
		$str = substr($str, 1);
	}
	if ($cont == 0) {
		&output_eol;
		&doindent($i); 
		if (length($str)) {
			$str =~ s/http:\/\/\S*/<A HREF=$&>$&<\/A>/g;
			if ($indent) {
				print "\t" x $indent . "<LI>" . $str;
				$endline = "\n";
			} else {
				print $str;
				$endline = "<BR>\n";
			}
			$outputsomething++;
		} else {
			$endline = "<BR>\n";
		}
	} else {
		$endline = "";
		if (length($str)) {
			$str =~ s/http:\/\/\S*/<A HREF=$&>$&<\/A>/g;
			print $str;
			$outputsomething++;
		}
	}
}

sub output_eol {
	print $endline;
	$endline = "";
}

sub doindent {
	local($level) = @_;

	if ($indent > $level) {
		while ($indent > $level) {
			print "\t" x $indent . "</UL>\n";
			$indent--;
		}
	} else {
		while ($indent < $level) {
			$indent++;
			print "\t" x $indent . "<UL>\n";
		}
	}
}

sub alignreset {
	return if ($alignmode eq '');

	if ($alignmode eq 'left') {
		print "</DIV>\n";
	} elsif ($alignmode eq 'leftfill') {
		print "</DIV>\n";
	} elsif ($alignmode eq 'right') {
		print "</DIV>\n";
	} elsif ($alignmode eq 'center') {
		print "</DIV>\n";
	} else {
		die "unknown alignment $alignmode\n";
	}
	$alignmode = '';
}

sub alignmode {
	local($mode) = @_;

	$alignmode = $mode;
	if ($alignmode eq 'left') {
		print "<DIV ALIGN=LEFT>\n";
	} elsif ($alignmode eq 'leftfill') {
		print "<DIV ALIGN=LEFT>\n";
	} elsif ($alignmode eq 'right') {
		print "<DIV ALIGN=RIGHT>\n";
	} elsif ($alignmode eq 'center') {
		print "<DIV ALIGN=CENTER>\n";
	} else {
		die "unknown alignment $mode\n";
	}
	$outputsomething = 0;
}

sub filter {
	$filtercmd = "";
	for ($i = 1; $i < scalar(@dir); $i++) {
		$dir[$i] =~ s/\\/\\\\/g;
		if ($i == 1) {
			$dir[$i] =~ s/^\"//;
		} elsif ($i == scalar(@dir) - 1) {
			$dir[$i] =~ s/\"$//;
		} else {
			$dir[$i] =~ s/\"/\\"/g;
		}
		$filtercmd = $filtercmd . " " . $dir[$i];
	}
	$filtermode = 1;
}

sub endfilter {
	if ($filterinput eq '') {
	} else {
		$filterinput =~ s/\\/\\\\/g;
		$filterinput =~ s/"/\\"/g;
		$filtercmd = "echo \"" . $filterinput . "\""
				. " | " . $filtercmd;
	}
	&output_eol;
	print "<PRE>\n";
	system($filtercmd);
	print "</PRE>\n";
	$filterinput = "";
	$filtermode = 0;
}

sub fontchange {
	local($fs, $fsh);
	&fontreset;
	if ($mgpdefaultfontsize > 0) {
		$fs = $mgpfontsize - $mgpdefaultfontsize;
	} else {
		$fs = 0;
	}
	if ($htmldefaultfontsize > 0) {
		$fsh = $fs + $htmldefaultfontsize;
		$fs = $htmlfontsizemin if ($fsh < $htmlfontsizemin);
		$fs = $htmlfontsizemax if ($fsh > $htmlfontsizemax);
	}
	if (($fs != 0) || (($colormode == 1) && ($colorlast ne $htmlfontcol))){
		print "<FONT";
		if ($fs != 0) {
			print " SIZE=";
			print "+" if ($fs >= 0);
			print $fs;
		}
		if (($colormode == 1) && ($colorlast ne $htmlfontcol)) {
			print " COLOR=\"" . $htmlfontcol . "\"";
			$colorlast = $htmlfontcol;
		}
		print ">";
		$infont = 1;
	}
}

sub fontreset {
	$colorlast = "";
	if ($infont == 1) {
		print "</FONT>";
	}
	$infont = 0;
}
magicpoint-1.09a/contrib/mgp2latex.pl.in100644   2007      0       11075  6570716544  16565 0ustar  kazuwheel#! @mgp_cv_path_perl@

# mgp2latex.pl
# converts MagicPoint input file to latex "seminar" style document.
# $Id: mgp2latex.pl.in,v 1.8 1998/08/26 05:30:12 itojun Exp $
#
# 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 LIABLE
# 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.

@keywords = split(/\s+/, <<EOF);
@mgp_keywords@
EOF

$alignmode = '';
$outputsomething = 0;
$page = -1;
$line = 0;
$doimage = 0;
$nodefault = 0;
$ignoremode = 0;

&prologue;
while (<>) {
	s/\n$//;

	$_ = '' if (/^#/o);

	if ($_ eq '' || $_ =~ /^[^%]/) {
		$line++;
		if ($default[$line] && !$nodefault) {
			&cmds($default[$line]);
		}
		next if ($ignoremode);
		next if ($page == -1);
		&output($_);
		next;
	}

	&cmds($_);
}
&pageepilogue;
&epilogue;
exit 0;


sub cmds {
	local($_) = @_;

	# special directives
	if (/^%page/i) {
		if ($page != -1) {
			&alignreset;
			&pageepilogue;
		} else {
			$page = 0;
		}
		&pageprologue;
		$line = 0;
		$nodefault = 0;
		next;
	} elsif (/^%default/i) {
		$x = (split(/\s+/, $_))[1];
		$default[$x] = $_;
		$default[$x] =~ s/^%default\s+\d+\s+/\%/;
		next;
	} elsif (/^%%/) {
		&output('');
		next;
	}

	# parsed directives
	@dirs = split(/,\s*/, substr($_, 1));
	foreach $j (@dirs) {
		@dir = split(/\s+/, $j);
		$dir[0] =~ tr/A-Z/a-z/;
		if ($dir[0] eq 'image') {
#			if (!$doimage) {
#				# don't use images
#			} elsif (scalar(@dir) == 2 || scalar(@dir) == 3) {
#				print "<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";
#			} elsif (scalar(@dir) >= 5) {
#				# interpretation wrong
#				print "<IMG SRC=\"$dir[1]\" WIDTH=$dir[3]% HEIGHT=$dir[4]% ALT=\"$dir[1]\">\n";
#			}
		} elsif ($dir[0] eq 'nodefault') {
			$nodefault++;
		} elsif ($dir[0] =~ /^(left|right|center)$/) {
			$dir[0] =~ tr/A-Z/a-z/;
			&alignreset;
			&alignmode($dir[0]);
		} elsif ($dir[0] =~ /^filter$/) {
			$ignoremode = 1;
		} elsif ($dir[0] =~ /^endfilter$/) {
			$ignoremode = 0;
		} elsif (grep($dir[0] eq $_, @keywords)) {
			# unsupported directive with 1 parameter
		} else {
			die "unsupported directive $dir[0]\n";
		}
	}
}

sub prologue {
	print <<EOF;
\\documentstyle{seminar}
\\begin{document}
EOF
}

sub epilogue {
	print <<EOF;
\\end{document}
EOF
}

sub pageprologue {
	print <<EOF
\\begin{slide}
EOF
}

sub pageepilogue {
	print <<EOF
\\end{slide}
EOF
}

sub output {
	local($str) = @_;

	if (length($str)) {
		print $str . "\\\\\n";
		$outputsomething++;
	} else {
		print "\\vspace{3mm}\n";
	}
}

sub alignreset {
	return if ($alignmode eq '');

	if (!$outputsomething) {
		print "\\quad\n";
	}
	if ($alignmode eq 'left') {
		print "\\end{flushleft}\n";
	} elsif ($alignmode eq 'right') {
		print "\\end{flushright}\n";
	} elsif ($alignmode eq 'center') {
		print "\\end{center}\n";
	} else {
		die "unknown alignment $alignmode\n";
	}

	$alignmode = '';
}

sub alignmode {
	local($mode) = @_;

	$alignmode = $mode;
	if ($alignmode eq 'left') {
		print "\\begin{flushleft}\n";
	} elsif ($alignmode eq 'right') {
		print "\\begin{flushright}\n";
	} elsif ($alignmode eq 'center') {
		print "\\begin{center}\n";
	} else {
		die "unknown alignment $mode\n";
	}
	$outputsomething = 0;
}
magicpoint-1.09a/contrib/mgpnet.in100644   2007      0       26567  6570716545  15557 0ustar  kazuwheel#! @mgp_cv_path_perl@

#
# 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 LIABLE
# 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: mgpnet.in,v 1.4 1998/08/26 05:30:13 itojun Exp $
#

# configurations
$tmpdir = '/tmp';
$httpdatestr = "date '+\%a, \%d \%b \%Y \%H:\%M:\%S \%Z'";
$seltimeout = 1;
$refreshtimeout = 10;
$debug = 0;
$port = 9999;
# it looks that "charset" parameter for Content-type makes many browsers
# unhappy.  it is a shame.
$usecharset = 0;

# do not edit beyond here
$hostname = `hostname`;
$hostname =~ s/\n$//;

# portable?
if (scalar(@ARGV) == 0) {
	open(IN, "ifconfig -a | grep 'inet '|") && do {
		do {
			$hostname = (split(/\s+/, <IN>))[2];
		} while ($hostname =~ /^127\./);
		close(IN);
	};
	print "http://$hostname:$port/\n";
	exit 0;
}

# greeting
print STDERR "welcome to MagicPoint Netserver...\n";

# parameter parsing
$tmpseed = 0;
$checkfile = &tmpname;
if (grep($ARGV[$_] eq '-T', 0 .. scalar(@ARGV) - 1)) {
	$checkfile = $ARGV[$_ + 1];
} else {
	@ARGV = ('-T', $checkfile, @ARGV);
}

$imagefile = &tmpname;
$checkcontent = '';

# OS parameter
&guessparam;
if (!defined $AF_INET || !defined $PF_INET || !defined $SOCK_STREAM
 || !defined $sockaddr || !defined $WNOHANG) {
	print STDERR "could not guess system parameter. edit by hand.\n";
	exit 1;
}

# HTTP/1.0 related
$tmp = <<EOF;
200	OK
201	Created
202	Accepted
204	No Content
301	Moved Permanently
302	Moved Temporarily
304	Not Modified
400	Bad Request
401	Unauthorized
403	Forbidden
404	Not Found
500	Internal Server Error
501	Not Implemented
502	Bad Gateway
503	Service Unavailable
EOF
foreach $i (split(/\n/, $tmp)) {
	($j, $k) = split(/\t/, $i);
	$httpmsg{$j} = $k;
}

# setting up socket.
$anyinaddr = pack('C4', 0, 0, 0, 0);
if ($havesinlen) {
	$mysockaddr = pack($sockaddr, 14, $AF_INET, $port, $anyinaddr);
	$hissockaddr = pack($sockaddr, 14, $AF_INET, $port, $anyinaddr);
} else {
	$mysockaddr = pack($sockaddr, $AF_INET, $port, $anyinaddr);
	$hissockaddr = pack($sockaddr, $AF_INET, $port, $anyinaddr);
}
$proto = (getprotobyname('tcp'))[2];
socket(S, $PF_INET, $SOCK_STREAM, $proto) || die "socket: $!";
if (defined $SOL_SOCKET && defined $SO_REUSEPORT) {
	setsockopt(S, $SOL_SOCKET, $SO_REUSEPORT, 1);
}
bind(S, $mysockaddr) || die "bind: $!";
listen(S, 5) || die "listen: $!";

# fork/exec mgp
$mgppid = fork;
if ($mgppid < 0) {
	print STDERR "could not invoke MagicPoint (fork): $!\n";
	exit -1;
}
$SIG{'CHLD'} = 'chldhandler';
if ($mgppid == 0){
	close(S);
	exec 'mgp', @ARGV;
	print STDERR "could not invoke MagicPoint (exec): $!\n"
}

$SIG{'TERM'} = 'IGNORE';
print STDERR "waiting for connection on port $port.\n";
$acceptstat = 0;
while (1) {
	if (waitpid($mgppid, $WNOHANG) == -1) {
		print STDERR "MagicPoint terminated.\n";
		last;
	}

	# page changed?
	&checkimgfile;

	# wait for an event...
	$rin = $win = $ein = '';
	vec($rin, fileno(S), 1) = 1;
	vec($win, fileno(S), 1) = 1;
	$ewin = $rin | $win;
	print STDERR "waiting for connetion...\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);
		accept(NS, S) || do {
			print STDERR "server: accept fail\n" if ($debug);
			next;
		};

		$acceptstat++;
		print STDERR "connetion accepted...\n" if ($debug);

		$pid = fork;
		if ($pid < 0) {
			print STDERR "server: fork fail\n" if ($debug);
			close(NS);
			next;
		} elsif ($pid) {
			print STDERR "server: fork success\n" if ($debug);
			close(NS);
			next;
		}

		# http server task
		print STDERR "http server task started...\n" if ($debug);
		select(NS); $/ = "\n"; $| = 1;
		&httpserver;
		close(NS);
		close(S);
		exit;
	}
}
print STDERR "leaving MagicPoint Netserver...\n";
print STDERR "accepted $acceptstat connetions so far.\n";
close(NS);
close(S);
unlink($imagefile);
exit 0;

sub checkimgfile {
	local($junk, $t);
	local($imgtmp);
	local($pid, $errout);
	open(CHK, "< $checkfile") || return;
	$junk = select(CHK); $/ = ''; $| = 1; select($junk);
	$t = <CHK>;
	close(CHK);
	if ($checkcontent ne $t) {
		print STDERR "page updated.\n";
		$checkcontent = $t;
		$pid = fork;
		return if (0 < $pid);	# if fork success, parent returns.
		if ($pid == 0) {
			print STDERR "window grab: fork success.\n" if ($debug);
		} else {
			print STDERR "window grab: fork fail, ".
				"process without fork.\n" if ($debug);
		}

		$imgtmp = &tmpname;
		$errout = ($debug ? '' : '2>&-');
		system "xwintoppm -silent -name MagicPoint | ".
			"ppmquant 256 $errout | ppmtogif $errout > $imgtmp";
		if (-z $imgtmp) {
			unlink $imgtmp;
			$checkcontent = '';
		} else {
			unlink $imagefile;
			link($imgtmp, $imagefile);
			unlink $imgtmp;
			$checkcontent = $t;
		}
		print STDERR 'window grab: done with ' .
			($checkcontent eq '' ? 'failure' : 'success') . ".\n";
		if ($pid == 0) {
			print STDERR "window grab: forked process dies.\n"
				if ($debug);
			# if fork success, child dies.
			exit 0;
		}
	}
}

sub chldhandler {
	local($sig) = @_;
	return if ($sig ne 'CHLD');
	wait;
}

sub httpserver {
	local($httpreq, $httpmethod, $httppath, $httpver, $httphost);
	local($httpagent);
	local($imgplace, $imgwidth, $imgheight, $buf, $imglen);
	local($cthtml, $ctgif);

	$cthtml = ($usecharset ? 'text/html; charset=us-ascii' : 'text/html');
	$ctgif = 'image/gif';

	$httpreq = <NS>;
	print STDERR 'HTTP in> ' . $httpreq if ($debug);
	$httpreq =~ s/[\r\n]+$//;
	$httpmethod = $httppath = $httpver = '';
	($httpmethod, $httppath, $httpver) = split(/\s+/, $httpreq);
	$httppath =~ s/http:\/\/[^:\/]+(:\d+)\//\//;
	if ($httpver eq '' || $httpver eq 'HTTP/1.0') {
		;	# ok
	} else {
		&httpheader(501, $cthtml) if ($httpver);

		print <<EOF;
<HEAD><TITLE>Version not implemented</TITLE></HEAD>
<BODY><H1>Version not implemented</H1>
HTTP protocol version $httpversion not supported.<P>
</BODY>
EOF
		return;
	}

	$httphost = "$hostname:$port";
	if ($httpver) {
		while (<NS>) {
			$_ =~ s/[\r\n]+$//;
			$httphost = $1 if ($_ =~ /^Host:\s*(\S+)$/i);
			$httpagent = $1 if ($_ =~ /^User-Agent:\s*(\S+)$/i);
			last if ($_ eq '');
			print STDERR 'HTTP in> ' . $_ . "\n" if ($debug);
		}
	}

	if ($httpmethod !~ /^(GET|HEAD)$/) {
		&httpheader(501, $cthtml) if ($httpver);

		print <<EOF;
<HEAD><TITLE>Method not implemented</TITLE></HEAD>
<BODY><H1>Method not implemented</H1>
$httpmethod to $httppath not supported.<P>
</BODY>
EOF
		return;
	}

	$imgwidth = $imgheight = 0;
	if ($httppath =~ /^\/(\d+)x(\d+)\.html$/) {
		$imgwidth = $1;
		$imgheight = $2;
		$httppath = '/index.html';
	}

	if ($httppath eq '/' || $httppath eq '/index.html') {
		if ($imgwidth && $imgheight) {
			$imgplace = "WIDTH=$imgwidth HEIGHT=$imgheight ";
		} else {
			$imgplace = '';
		}

		&httpheader(200, $cthtml) if ($httpver);
		return if ($httpmethod ne 'GET');

		if ($refreshtimeout) {
			print <<EOF;
<META HTTP-EQUIV=\"Refresh\" CONTENT=$refreshtimeout>
EOF
		}
		print <<EOF;
<HEAD><TITLE>MagicPoint Netserver</TITLE></HEAD>
<BODY>
<IMG SRC=\"/presentation.gif\" ALT=\"presentation image\"
$imgplace ALIGN=left><BR>
<TABLE border=0>
<TR><TD NOWRAP><A HREF=/index.html>normal</A>
<TR><TD NOWRAP><A HREF=/800x600.html>800x600</A>
<TR><TD NOWRAP><A HREF=/640x480.html>640x480</A>
<TR><TD NOWRAP><A HREF=/400x300.html>400x300</A>
<TR><TD NOWRAP><A HREF=/100x75.html>100x75</A>
</TABLE>
<BR CLEAR=left>
<HR>
<TABLE border=0>
<TR><TD NOWRAP ROWSPAN=2>
	<FONT SIZE=+5><I>MagicPoint</I> Netserver</FONT>
<TD>
	Presented by <A HREF=http://www.itojun.org/>itojun.org</A>
<TR><TD NOWRAP>
	Supported by <A HREF=http://www.mew.org/mgp/>MagicPoint Project,</A>
	<A HREF=http://www.wide.ad.jp/>WIDE Internet</A>
</TABLE>
</BODY></HTML>
EOF
	} elsif ($httppath eq '/presentation.gif') {
		open(IMG, "< $imagefile") || do {
			$checkcontent = '';	# invalidate
			&httpheader(404, $cthtml) if ($httpver);
			return if ($httpmethod ne 'GET');

			print <<EOF;
<HEAD><TITLE>File Not found</TITLE></HEAD>
<BODY><H1>File Not found</H1>
The requested URL $httppath was not found on this server.<P>
Looks like a mitake in configuration.
Contact the administrator.<P>
</BODY>
EOF
			return;
		};
		&httpheader(200, $ctgif) if ($httpver);
		return if ($httpmethod ne 'GET');

		while (0 < ($imglen = sysread(IMG, $buf, 4096))) {
			syswrite(NS, $buf, $imglen);
		}
		close(IMG);
	} else {
		&httpheader(404, $cthtml) if ($httpver);
		return if ($httpmethod ne 'GET');

		print <<EOF;
<HEAD><TITLE>File Not found</TITLE></HEAD>
<BODY><H1>File Not found</H1>
The requested URL $httppath was not found on this server.<P>
</BODY>
EOF
	}
}

sub httpheader {
	local($code, $ct) = @_;
	local($tmp);
	local($date);

	$date = `$httpdatestr`;
	$date =~ s/[\r\n]+//;
	$tmp = <<EOF;
HTTP/1.0 $code $httpmsg{$code}
Date: $date
Expires: $date
Server: MagicPointNetserver
Pragma: no-cache
Content-type: $ct
EOF

	$tmp .= "\n";
	$tmp =~ s/\n/\r\n/g;
	print $tmp;

	if ($debug) {
		$tmp =~ s/\r\n/\n/g;
		$tmp = join("\nHTTP out> ", split(/\n/, $tmp));
		$tmp = 'HTTP out> ' . $tmp . "\n";
		print STDERR $tmp;
	}
}

#------------------------------------------------------------

sub guessparam {
	local($tmpnam, $tmp, @tmp1, @tmp2);
	local(%varnames);

	%varnames = (
'XXX1', 'AF_INET',	'XXX2', 'PF_INET',	'XXX3', 'SOL_SOCKET',
'XXX4', 'SO_REUSEPORT',	'XXX5', 'SOCK_STREAM',	'XXX6', 'WNOHANG',
);
	$tmpnam = &tmpname;
	open(CPP, "| @CPP@ >$tmpnam") || return;
	print CPP "#include <sys/socket.h>\n";
	print CPP "#include <sys/wait.h>\n";
	foreach $tmp (keys %varnames) {
		print CPP "$tmp $varnames{$tmp}\n";
	}
	close(CPP) || return;

	$tmp = '';
	open(CPP, "< $tmpnam") || return;
	while (<CPP>) {
		$tmp .= $_;
	}
	close(CPP);
	unlink $tmpnam;

	@tmp1 = split(/\n/, $tmp);

	if (grep($_ =~ /sin_len/, @tmp1)) {
		$havesinlen = 1; $sockaddr = 'C C n a4 x8';
	} else {
		$havesinlen = 0; $sockaddr = 'S n a4 x8';
	}

	foreach $i (keys %varnames) {
		if (@tmp2 = grep($_ =~ /^$i/, @tmp1)) {
			$tmp = (split(/\s+/, @tmp2[0]))[1];
			$tmp = oct($tmp) if ($tmp =~ /^0/);
			next if ($tmp !~ /^[0-9]+$/);
			eval "\$$varnames{$i} = \$tmp;";
		}
	}
}

sub tmpname {
	local($fname);

	do {
		$fname = $tmpdir . '/' . time . '.' . $$ . '.' . $tmpseed++;
	} while (-e $fname);
	return $fname;
}
magicpoint-1.09a/contrib/mgpnet.man100644   2007      0        6043  6570716546  15670 0ustar  kazuwheel.\" 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 LIABLE
.\" 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: mgpnet.man,v 1.3 1998/08/26 05:30:14 itojun Exp $
.\"
.Dd December 1997
.Dt MGPNET 1
.Os
.Sh NAME
.Nm mgpnet
.Nd MagicPoint Netserver (provide MagicPoint presentation over the net)
.Sh SYNOPSIS
.Nm mgpnet
.Op arguments to mgp
.Sh DESCRIPTION
.Nm mgpnet
is a small http server to be executed on the presenter's notebook computer.
It lets audience read MagicPoint presentation foils on her notebook computers,
over the net.
.Pp
When a presenter performs a presentation, she should invoke
.Nm mgpnet
instead of
.Nm mgp ,
with the same argument.
.Nm mgpnet
will become an http server running on tcp port 9999 (by default),
and invokes
.Nm mgp
as a child process.
By accessing URL
.Fa http://hostname:9999/ ,
audience will be able to read the MagicPoint window currently displayed
on the presenter's notebook.
The webpage provided by
.Nm mgpnet
is designed in "client pull" manner;
audience's notebook will reload the page, several times a minute.
.Pp
If no option is specified,
.Nm mgpnet
will print the URL to be accessed by the audience to the standard output.
This is useful for indicating the URL to be accessed on the presentation,
like:
.Bd -literal
%filter "mgpnet"
%endfilter
.Ed
.Sh TODO
Be network conscious.
Current implementation is too naive about CPU/network usage.
Presenter's notebook may be overloaded if there's too many audiences.
.Sh SEE ALSO
.Xr mgp 1 ,
.Xr xwintoppm 1 .
.Sh HISTORY
.Nm mgpnet
was created by Jun-ichiro itojun Itoh <itojun@itojun.org>,
on the day before the newyear's eve, 1997.
magicpoint-1.09a/contrib/tex2eps.sh100644   2007      0         767  6630515763  15611 0ustar  kazuwheel#! /bin/sh
#
# The script is contributed by Sylvain Pion <Sylvain.Pion@sophia.inria.fr>.
#  Subject: (mgp-users 00071) Re: remarks against 1.04a
#
# Expected usage:
#	%filter "tex2eps.sh b"
#	My \TeX\ is nicer with $Magic$ Point
#	%endfilter
#	%image "b.eps" 250x200
#

# temporary filename (without .eps suffix)
tmp=$1

echo '\nopagenumbers' > $tmp.tex
cat >> $tmp.tex
echo '\end' >> $tmp.tex
tex $tmp.tex > /dev/null 2> /dev/null
dvips -q -E $tmp.dvi -o $tmp.eps
/bin/rm -f $tmp.tex $tmp.log $tmp.dvi
magicpoint-1.09a/contrib/xmindpath/ 40755   2007      0           0  7354522472  15567 5ustar  kazuwheelmagicpoint-1.09a/contrib/xmindpath/.cvsignore100644   2007      0          57  6570561062  17623 0ustar  kazuwheelconfig.log
config.cache
config.status
Makefile
magicpoint-1.09a/contrib/xmindpath/Makefile.in100644   2007      0        1340  7045213736  17724 0ustar  kazuwheel#
# $Id: Makefile.in,v 1.3 2000/01/31 05:04:30 itojun Exp $
#

srcdir=	@srcdir@
OBJS=	main.o @LIBOBJS@
CFLAGS=	@DEFS@ @X_CFLAGS@
LDFLAGS=@LDFLAGS@
LIBS=	@LIBS@
CC=	@CC@
TARGET=	xmindpath

INSTALL=@INSTALL@
prefix=	@prefix@
exec_prefix=	@exec_prefix@
bindir=	@bindir@
mandir=	@mandir@

all:	$(TARGET)
$(TARGET):	$(OBJS)
	$(CC) $(LDFLAGS) -o $(TARGET) $(OBJS) $(LIBS) 

main.o:	$(srcdir)/main.c
uucplock.o:	$(srcdir)/uucplock.c

install::
	$(INSTALL) -s -o uucp -g bin -m 4755 $(TARGET) $(bindir)
	$(INSTALL) -o bin -g bin -m 444 $(TARGET).1 $(mandir)/man1

includes::

clean::
	/bin/rm -f *.o $(TARGET)

distclean:: clean
	/bin/rm -f Makefile config.cache config.log config.status .depend

depend:
	mkdep ${CFLAGS:M-[ID]*} $(srcdir)/*.c
magicpoint-1.09a/contrib/xmindpath/config.guess100755   2007      0       47622  6567713431  20241 0ustar  kazuwheel#! /bin/sh
# Attempt to guess a canonical system name.
#   Copyright (C) 1992, 93, 94, 95, 1996 Free Software Foundation, Inc.
#
# This file is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 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
# General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#
# As a special exception to the GNU General Public License, if you
# distribute this file as part of a program that contains a
# configuration script generated by Autoconf, you may include it under
# the same distribution terms that you use for the rest of that program.

# Written by Per Bothner <bothner@cygnus.com>.
# The master version of this file is at the FSF in /home/gd/gnu/lib.
#
# This script attempts to guess a canonical system name similar to
# config.sub.  If it succeeds, it prints the system name on stdout, and
# exits with 0.  Otherwise, it exits with 1.
#
# The plan is that this can be called by configure scripts if you
# don't specify an explicit system type (host/target name).
#
# Only a few systems have been added to this list; please add others
# (but try to keep the structure clean).
#

# This is needed to find uname on a Pyramid OSx when run in the BSD universe.
# (ghazi@noc.rutgers.edu 8/24/94.)
if (test -f /.attbin/uname) >/dev/null 2>&1 ; then
	PATH=$PATH:/.attbin ; export PATH
fi

UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown
UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown
UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown
UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown

trap 'rm -f dummy.c dummy.o dummy; exit 1' 1 2 15

# Note: order is significant - the case branches are not exclusive.

case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
    alpha:OSF1:*:*)
	# A Vn.n version is a released version.
	# A Tn.n version is a released field test version.
	# A Xn.n version is an unreleased experimental baselevel.
	# 1.2 uses "1.2" for uname -r.
	echo alpha-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[VTX]//'`
	exit 0 ;;
    21064:Windows_NT:50:3)
	echo alpha-dec-winnt3.5
	exit 0 ;;
    Amiga*:UNIX_System_V:4.0:*)
	echo m68k-cbm-sysv4
	exit 0;;
    amiga:NetBSD:*:*)
      echo m68k-cbm-netbsd${UNAME_RELEASE}
      exit 0 ;;
    amiga:OpenBSD:*:*)
      echo m68k-cbm-openbsd${UNAME_RELEASE}
      exit 0 ;;
    arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*)
	echo arm-acorn-riscix${UNAME_RELEASE}
	exit 0;;
    Pyramid*:OSx*:*:*|MIS*:OSx*:*:*)
	# akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE.
	if test "`(/bin/universe) 2>/dev/null`" = att ; then
		echo pyramid-pyramid-sysv3
	else
		echo pyramid-pyramid-bsd
	fi
	exit 0 ;;
    NILE:*:*:dcosx)
	echo pyramid-pyramid-svr4
	exit 0 ;;
    sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*)
	echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
	exit 0 ;;
    i86pc:SunOS:5.*:*)
	echo i386-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
	exit 0 ;;
    sun4*:SunOS:6*:*)
	# According to config.sub, this is the proper way to canonicalize
	# SunOS6.  Hard to guess exactly what SunOS6 will be like, but
	# it's likely to be more like Solaris than SunOS4.
	echo sparc-sun-solaris3`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
	exit 0 ;;
    sun4*:SunOS:*:*)
	case "`/usr/bin/arch -k`" in
	    Series*|S4*)
		UNAME_RELEASE=`uname -v`
		;;
	esac
	# Japanese Language versions have a version number like `4.1.3-JL'.
	echo sparc-sun-sunos`echo ${UNAME_RELEASE}|sed -e 's/-/_/'`
	exit 0 ;;
    sun3*:SunOS:*:*)
	echo m68k-sun-sunos${UNAME_RELEASE}
	exit 0 ;;
    aushp:SunOS:*:*)
	echo sparc-auspex-sunos${UNAME_RELEASE}
	exit 0 ;;
    atari*:NetBSD:*:*)
	echo m68k-atari-netbsd${UNAME_RELEASE}
	exit 0 ;;
    atari*:OpenBSD:*:*)
	echo m68k-atari-openbsd${UNAME_RELEASE}
	exit 0 ;;
    sun3*:NetBSD:*:*)
	echo m68k-sun-netbsd${UNAME_RELEASE}
	exit 0 ;;
    sun3*:OpenBSD:*:*)
	echo m68k-sun-openbsd${UNAME_RELEASE}
	exit 0 ;;
    mac68k:NetBSD:*:*)
	echo m68k-apple-netbsd${UNAME_RELEASE}
	exit 0 ;;
    mac68k:OpenBSD:*:*)
	echo m68k-apple-openbsd${UNAME_RELEASE}
	exit 0 ;;
    powerpc:machten:*:*)
	echo powerpc-apple-machten${UNAME_RELEASE}
	exit 0 ;;
    RISC*:Mach:*:*)
	echo mips-dec-mach_bsd4.3
	exit 0 ;;
    RISC*:ULTRIX:*:*)
	echo mips-dec-ultrix${UNAME_RELEASE}
	exit 0 ;;
    VAX*:ULTRIX*:*:*)
	echo vax-dec-ultrix${UNAME_RELEASE}
	exit 0 ;;
    mips:*:*:UMIPS | mips:*:*:RISCos)
	sed 's/^	//' << EOF >dummy.c
	int main (argc, argv) int argc; char **argv; {
	#if defined (host_mips) && defined (MIPSEB)
	#if defined (SYSTYPE_SYSV)
	  printf ("mips-mips-riscos%ssysv\n", argv[1]); exit (0);
	#endif
	#if defined (SYSTYPE_SVR4)
	  printf ("mips-mips-riscos%ssvr4\n", argv[1]); exit (0);
	#endif
	#if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD)
	  printf ("mips-mips-riscos%sbsd\n", argv[1]); exit (0);
	#endif
	#endif
	  exit (-1);
	}
EOF
	${CC-cc} dummy.c -o dummy \
	  && ./dummy `echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` \
	  && rm dummy.c dummy && exit 0
	rm -f dummy.c dummy
	echo mips-mips-riscos${UNAME_RELEASE}
	exit 0 ;;
    Night_Hawk:Power_UNIX:*:*)
	echo powerpc-harris-powerunix
	exit 0 ;;
    m88k:CX/UX:7*:*)
	echo m88k-harris-cxux7
	exit 0 ;;
    m88k:*:4*:R4*)
	echo m88k-motorola-sysv4
	exit 0 ;;
    m88k:*:3*:R3*)
	echo m88k-motorola-sysv3
	exit 0 ;;
    AViiON:dgux:*:*)
        # DG/UX returns AViiON for all architectures
        UNAME_PROCESSOR=`/usr/bin/uname -p`
        if [ $UNAME_PROCESSOR = mc88100 -o $UNAME_PROCESSOR = mc88110 ] ; then
	if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx \
	     -o ${TARGET_BINARY_INTERFACE}x = x ] ; then
		echo m88k-dg-dgux${UNAME_RELEASE}
	else
		echo m88k-dg-dguxbcs${UNAME_RELEASE}
	fi
        else echo i586-dg-dgux${UNAME_RELEASE}
        fi
 	exit 0 ;;
    M88*:DolphinOS:*:*)	# DolphinOS (SVR3)
	echo m88k-dolphin-sysv3
	exit 0 ;;
    M88*:*:R3*:*)
	# Delta 88k system running SVR3
	echo m88k-motorola-sysv3
	exit 0 ;;
    XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3)
	echo m88k-tektronix-sysv3
	exit 0