--- /dev/null
+<!-- This is sinfo.dtd,
+ by MORIOKA Tomohiko
+ $Id: sinfo.dtd,v 6.1 1996/10/21 01:49:19 morioka Exp $
+-->
+
+<!entity % emph
+ "em|it|bf|sf|sl|tt|cparam|code|verb|var|mail|file|kbd|key">
+
+<!entity % index "idx|cdx" >
+
+<!-- url added by HG; htmlurl added by esr -->
+<!entity % xref
+ " a|label|ref|dref|cf|cite|ncite|concept " >
+
+<!entity % inline
+ " (#pcdata | f| x| %emph; |sq| %xref | %index )* " >
+
+<!entity % list
+ " list | ul | ol | dl | kl | vl | memo | lisp | rfc | standard
+ | report " >
+
+<!entity % par
+ " %list; | comment | lq | quote | tscreen " >
+
+<!entity % mathpar " dm | eq " >
+
+<!entity % thrm
+ " defun | define | defvar | prop | lemma | coroll | proof | theorem " >
+
+<!entity % sectpar
+ " %par; | figure | table | faq | hrule | %mathpar; |
+ %thrm; ">
+<!element sinfo o o (head, body) >
+
+<!element head - - (titlepag, header?, toc?, lof?, lot?)>
+<!attlist head opts cdata "null">
+
+<!element body - - ( abstract?, (p|noindent)*, h1*,
+ (appendix, h1+)?, biblio?) +(footnote)>
+<!attlist body opts cdata "null">
+
+<!entity % general system -- general purpose characters -- >
+%general;
+<!entity Ae 'Ä' >
+<!entity ae 'ä' >
+<!entity Oe 'Ö' >
+<!entity oe 'ö' >
+<!entity Ue 'Ü' >
+<!entity ue 'ü' >
+<!entity sz 'ß' >
+<!element noindent o o (( %inline | %sectpar )+) +(newline) >
+<!element p o o (( %inline | %sectpar )+) +(newline) >
+<!entity ptag '<p>' >
+<!entity psplit '</p><p>' >
+
+<!element em - - (%inline)>
+<!element bf - - (%inline)>
+<!element it - - (%inline)>
+<!element sf - - (%inline)>
+<!element sl - - (%inline)>
+<!element tt - - (%inline)>
+<!element sq - - (%inline)>
+<!element cparam - - (%inline)>
+
+<!entity ftag '<f>' -- formula begin -- >
+<!entity qendtag '</sq>'>
+
+<!element lq - - ((p|noindent)*)>
+<!element quote - - ((%inline; | %sectpar;)*, (p|noindent)*)+ >
+<!element tscreen - - ((%inline; | %sectpar;)*, (p|noindent)*)+ >
+<!element ul - - (li+)>
+<!element ol - - (li+)>
+<!element list - - (li+)>
+<!element memo - - ((%inline; | %sectpar; )*, (p|noindent)*)+ >
+<!attlist memo title cdata "Memo">
+<!element rfc - o empty>
+<!attlist rfc
+ name cdata #implied
+ number cdata #required
+ type cdata #implied
+ author cdata #required
+ title cdata #required
+ date cdata #required
+ obsolete cdata #implied>
+<!element standard - o empty>
+<!attlist standard
+ abbrev cdata #implied
+ org cdata #implied
+ title-cn cdata #implied
+ title-en cdata #implied
+ title-fr cdata #implied
+ title-ja cdata #implied
+ number cdata #required
+ year cdata #implied>
+<!element report - o empty>
+<!attlist report
+ abbrev cdata #implied
+ author cdata #required
+ title-cn cdata #implied
+ title-en cdata #implied
+ title-fr cdata #implied
+ title-ja cdata #implied
+ date cdata #implied>
+<!element dl - - (dt,dd)+ >
+<!element dt - o ((%inline; | %sectpar;)*, (p|noindent)*) >
+<!element dd - o ((%inline; | %sectpar;)*, (p|noindent|newline)*) >
+
+<!element kl - - ((kt,kd)|(dt,dd))+ >
+<!element kt - o ((%inline; | %sectpar;)*, (p|noindent)*) >
+<!element kd - o ((%inline; | %sectpar;)*, (p|noindent|newline)*) >
+
+<!element vl - - (dt,dd)+ >
+
+<!element li - o ((%inline; | %sectpar;)*, (p|noindent)*) >
+
+<!element tag - o (%inline)>
+<!entity space " ">
+<!entity null "">
+
+<!element faq - - (keyword?, (poster?, pdate?, (question| answer| coment)? )*)+>
+<!element keyword - o (%inline;)*>
+<!element poster - o (%inline;)*>
+<!element pdate - o (%inline;)*>
+<!element question - o ((%inline; | %sectpar;)*, (p|noindent)*)+>
+<!element answer - o ((%inline; | %sectpar;)*, (p|noindent)*)+>
+<!element coment - o ((%inline; | %sectpar;)*, (p|noindent)*)+>
+<!element hrule - o empty >
+
+<!element figure - - ((eps | ph ), caption?)>
+<!attlist figure
+ loc cdata "tbp">
+
+<!-- eps attributes added by mb and td -->
+<!element eps - o empty >
+<!attlist eps
+ file cdata #required
+ height cdata "5cm"
+ angle cdata "0">
+
+<!element ph - o empty >
+<!attlist ph
+ vspace cdata #required>
+
+<!element caption - o (%inline)>
+
+<!element rowsep - o empty>
+<!element colsep - o empty>
+<!element hline - o empty>
+
+<!entity rowsep "<rowsep>">
+<!entity colsep "<colsep>">
+
+<!element table - - (tabular, caption?) >
+<!attlist table
+ loc cdata "tbp">
+
+<!element code - - rcdata>
+<!element verb - - rcdata>
+<!element var - - rcdata>
+<!element lisp - - rcdata>
+<!element mail - - rcdata>
+<!element file - - rcdata>
+<!element kbd - - rcdata>
+<!element key - - rcdata>
+
+<!shortref ttmap -- also on one-line --
+ "B&#RE;" space
+ "&#RS;&#RE;" null
+ "&#RS;B&#RE;" null
+ "&#RS;B" null
+ '#' num
+ '%' percnt
+ '~' tilde
+ '_' lowbar
+ '^' circ
+ '{' lcub
+ '}' rcub
+ '|' verbar >
+
+<!usemap ttmap tt>
+<!element mc - - cdata >
+<!entity % sppos "tu" >
+<!entity % fcs "%sppos;|phr" >
+<!entity % fcstxt "#pcdata|mc|%fcs;" >
+<!entity % fscs "rf|v|fi" >
+<!entity % limits "pr|in|sum" >
+<!entity % fbu "fr|lim|ar|root" >
+<!entity % fph "unl|ovl|sup|inf" >
+<!entity % fbutxt "(%fbu;) | (%limits;) |
+ (%fcstxt;)|(%fscs;)|(%fph;)" >
+<!entity % fphtxt "p|#pcdata" >
+<!element f - - ((%fbutxt;)*) >
+
+<!entity fendtag '</f>' -- formula end -- >
+
+<!shortref fmap
+ "&#RS;B" null
+ "&#RS;B&#RE;" null
+ "&#RS;&#RE;" null
+ "_" thinsp
+ "~" nbsp
+ "]" fendtag
+ "#" num
+ "%" percnt
+ "^" circ
+ "{" lcub
+ "}" rcub
+ "|" verbar>
+
+<!usemap fmap f >
+
+<!element dm - - ((%fbutxt;)*)>
+<!element eq - - ((%fbutxt;)*)>
+
+<!shortref dmmap
+ "&#RE;" space
+ "_" thinsp
+ "~" nbsp
+ "]" fendtag
+ "#" num
+ "%" percnt
+ "^" circ
+ "{" lcub
+ "}" rcub
+ "|" verbar>
+
+<!usemap dmmap (dm,eq)>
+<!element fr - - (nu,de) >
+<!element nu o o ((%fbutxt;)*) >
+<!element de o o ((%fbutxt;)*) >
+<!element sub o o ((%fbutxt;)*) >
+<!element super o o ((%fbutxt;)*) >
+<!element opd - o ((%fbutxt;)*) >
+<!element pr - - (ll,u,opd?) >
+<!element in - - (ll,u,opd?) >
+<!element sum - - (ll,u,opd?) >
+<!element lim - - (op,ll,u,opd?) >
+<!element op o o (%fcstxt;|rf|%fph;) -(tu) >
+<!element root - - ((%fbutxt;)*) >
+<!attlist root
+ n cdata "">
+<!element col o o ((%fbutxt;)*) >
+<!element row o o (col, (arc, col)*) >
+
+<!element ar - - (row, (arr, row)*) >
+<!attlist ar
+ ca cdata #required >
+<!element arr - o empty >
+<!element arc - o empty >
+<!entity arr "<arr>" >
+<!entity arc "<arc>" >
+
+<!shortref arrmap
+ "&#RE;" space
+ "@" arr
+ "|" arc
+ "_" thinsp
+ "~" nbsp
+ "#" num
+ "%" percnt
+ "^" circ
+ "{" lcub
+ "}" rcub >
+
+<!usemap arrmap ar >
+<!element sup - - ((%fbutxt;)*) -(tu) >
+<!element inf - - ((%fbutxt;)*) -(tu) >
+<!element unl - - ((%fbutxt;)*) >
+<!element ovl - - ((%fbutxt;)*) >
+<!element rf - o (#pcdata) >
+<!element phr - o ((%fphtxt;)*) >
+<!element v - o ((%fcstxt;)*)
+ -(tu|%limits;|%fbu;|%fph;) >
+<!element fi - o (#pcdata) >
+<!element tu - o empty >
+
+<!element defun - - (args?,opts?,rest?,(p|noindent|newline)*)>
+<!attlist defun
+ name cdata #required>
+<!element args - o (#pcdata)>
+<!element opts - o (#pcdata)>
+<!element rest - o (#pcdata)>
+
+<!element define - - (args?,opts?,rest?,(p|noindent|newline)*)>
+<!attlist define
+ type cdata #required
+ name cdata #required>
+
+<!element defvar - - ((p|noindent)+) >
+<!attlist defvar
+ name cdata #required>
+<!element prop - - (thtag?, p+) >
+<!element lemma - - (thtag?, p+) >
+<!element coroll - - (thtag?, p+) >
+<!element proof - - (p+) >
+<!element theorem - - (thtag?, p+) >
+<!element thtag - - (%inline)>
+
+<!entity qtag '<sq>' >
+
+<!element label - o empty>
+<!attlist label id cdata #required>
+
+<!element concept - - cdata>
+
+<!element a - - (p+)>
+<!attlist a
+ file cdata #implied
+ node cdata #implied
+ href cdata #implied>
+
+<!element cf - o empty>
+<!attlist cf
+ file cdata #implied
+ node cdata #implied
+ href cdata #implied >
+
+<!element ref - o empty>
+<!attlist ref
+ file cdata #implied
+ node cdata #implied>
+
+<!element dref - - cdata>
+<!attlist dref
+ file cdata #implied>
+
+<!element comment - - (%inline)>
+<!element x - - ((#pcdata | mc)*) >
+<!usemap #empty x >
+
+<!-- Hacked by mdw, abstract now part of titlepag -->
+<!element titlepag o o (title, author, date?, trans?, tdate?)>
+<!element title - o (%inline, subtitle?) +(newline)>
+<!element subtitle - o (%inline)>
+<!element author - o (name, thanks?, inst?, mail?,
+ (and, name, thanks?, inst?)*)>
+<!element trans - o (name, thanks?, inst?,
+ (and, name, thanks?, inst?)*)>
+<!element name o o (%inline) +(newline)>
+<!element and - o empty>
+<!element thanks - o (%inline)>
+<!element inst - o (%inline) +(newline)>
+<!element date - o (#pcdata) >
+<!element tdate - o (#pcdata) >
+
+<!element newline - o empty >
+<!entity nl "<newline>">
+
+<!-- Hacked by ono -->
+<!element abstract - o (%inline, (p|noindent)*)+ +(newline)>
+
+
+<!element toc - o empty>
+<!element lof - o empty>
+<!element lot - o empty>
+<!element header - - (lhead, rhead) >
+<!element lhead - o (%inline)>
+<!element rhead - o (%inline)>
+<!entity % sec-b "(p|noindent)*, (cindex|findex|vindex)* " >
+<!entity % sect "heading, node?, %sec-b " >
+<!element heading o o (%inline)>
+<!element h1 - o (%sect, h2*) +(footnote)>
+<!element h2 - o (%sect, h3*)>
+<!element h3 - o (%sect, h4*)>
+<!element h4 - o (%sect, h5*)>
+<!element h5 - o (%sect)>
+<!element node - o (heading)>
+<!element cindex - o empty>
+<!element findex - o empty>
+<!element vindex - o empty>
+<!element appendix - o empty >
+<!element footnote - - (%inline)>
+<!element cite - o empty>
+<!attlist cite
+ id cdata #required>
+
+<!element ncite - o empty>
+<!attlist ncite
+ id cdata #required
+ note cdata #required>
+
+<!element idx - - (#pcdata)>
+<!element cdx - - (#pcdata)>
+
+<!element biblio - o empty>
+<!attlist biblio
+ style cdata "sinfo"
+ files cdata "">
+<!element slides - - (slide*) >
+
+<!attlist slides
+ opts cdata "null">
+<!element slide - o (title?, p+) >
+<!entity % addr "(address?, email?, phone?, fax?)" >
+
+<!element letter - -
+ (from, %addr, to, %addr, cc?, subject?, sref?, rref?,
+ rdate?, opening, p+, closing, encl?, ps?)>
+
+<!attlist letter
+ opts cdata "null">
+
+<!element from - o (#pcdata) >
+<!element to - o (#pcdata) >
+
+<!element address - o (#pcdata) +(newline) >
+<!element email - o (#pcdata) >
+<!element phone - o (#pcdata) >
+<!element fax - o (#pcdata) >
+
+<!element subject - o (%inline;) >
+<!element sref - o (#pcdata) >
+<!element rref - o (#pcdata) >
+<!element rdate - o (#pcdata) >
+
+<!element opening - o (%inline;) >
+
+<!element closing - o (%inline;) >
+<!element cc - o (%inline;) +(newline) >
+<!element encl - o (%inline;) +(newline) >
+
+<!element ps - o (p+) >
+
+<!element telefax - -
+ (from, %addr, to, address, email?,
+ phone?, fax, cc?, subject?,
+ opening, p+, closing, ps?)>
+
+<!attlist telefax
+ opts cdata "null"
+ length cdata "2">
+
+<!element notes - - (title?, p+) >
+<!attlist notes
+ opts cdata "null" >
+
+<!-- end of sinfo dtd -->
--- /dev/null
+;;; sinfo.el --- sinfo to Texinfo converter
+
+;; Copyright (C) 1996 MORIOKA Tomohiko
+
+;; Author: MORIOKA Tomohiko <morioka@jaist.ac.jp>
+;; Version: $Id: sinfo.el,v 3.3 1996/11/28 13:34:51 morioka Exp $
+;; Keywords: outline-mode, Texinfo, plain2
+
+;; This file is part of sinfo (SGML based info system).
+
+;; 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, 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; see the file COPYING. If not, write to
+;; the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+;; Boston, MA 02111-1307, USA.
+
+;;; Comment:
+
+;; This program is for Emacs/mule (mule-19.33-delta) and requires
+;; sgmls.
+
+;;; Code:
+
+(require 'tl-list)
+(require 'tl-str)
+(require 'texinfmt)
+(require 'texi-util)
+
+(defvar sinfo-texi-mapping-file
+ "/usr/local/share/sgml/rep/sinfo/texi-mapping"
+ "*SGML mapping file to convert into Texinfo.")
+
+(defun sinfo-texi-swap-node ()
+ (interactive)
+ (goto-char (point-min))
+ (while (re-search-forward
+ "^\\(@\\(chapter\\|\\(sub\\)*section\\) .*\\)
+\\(@node .*\\)\n" nil t)
+ (let* ((md (match-data))
+ (nd (last md 2))
+ (nb (car nd))
+ (ne (second nd))
+ )
+ (replace-match (format "%s\n%s"
+ (buffer-substring nb ne)
+ (buffer-substring (match-beginning 0) nb)
+ ))
+ )))
+
+(defun sinfo-filter-for-standard ()
+ (goto-char (point-min))
+ (while (re-search-forward
+ "@noindent\n\\[\\([^][]*\\)\\]\n@quotation\n\\([^,]*\\)," nil t)
+ (let ((name (buffer-substring (match-beginning 1)(match-end 1)))
+ (org (buffer-substring (match-beginning 2)(match-end 2)))
+ (dest "@quotation\n")
+ (b (match-beginning 0))
+ )
+ (save-restriction
+ (and (eq (aref name 0) ?:)
+ (eq (aref name 1) ?\ )
+ (setq name (substring name 2))
+ )
+ (or (string= name "")
+ (setq dest (concat "@noindent\n[" name "]\n" dest))
+ )
+ (or (string= org "")
+ (setq dest (concat dest org ","))
+ )
+ (replace-match dest)
+ (search-forward "@end quotation")
+ (narrow-to-region b (match-beginning 0))
+ (goto-char b)
+ (if (search-forward " (obsolete RFC )" nil t)
+ (replace-match "")
+ )
+ (goto-char b)
+ (while (search-forward "\e$B!X!Y\e(B" nil t)
+ (replace-match "")
+ )
+ (goto-char b)
+ (while (search-forward "``''" nil t)
+ (replace-match "")
+ )
+ (goto-char b)
+ (while (re-search-forward ",[ \t\n]*," nil t)
+ (replace-match ",")
+ (goto-char b)
+ )
+ (and (re-search-forward "^,[ \t\n]*" nil t)
+ (replace-match "")
+ )
+ (if (search-forward ", ." nil t)
+ (replace-match ".")
+ )
+ (goto-char (point-max))
+ (fill-paragraph nil)
+ ))))
+
+(defun sinfo-to-texi ()
+ (interactive)
+ (let* ((the-buf (current-buffer))
+ (src-name (buffer-file-name))
+ (name (file-name-non-extension src-name))
+ (dst-name (concat name ".texi"))
+ (fname (concat (file-name-nondirectory name) ".info"))
+ (cs buffer-file-coding-system)
+ status)
+ (find-file dst-name)
+ (erase-buffer)
+ (insert-buffer the-buf)
+ (goto-char (point-min))
+ (while (re-search-forward "[@{}]" nil t)
+ (replace-match (concat "@" (buffer-substring (match-beginning 0)
+ (match-end 0))))
+ )
+ (let ((coding-system-for-read 'coding-system-internal)
+ (coding-system-for-write 'coding-system-internal)
+ )
+ (setq status
+ (call-process-region (point-min)(point-max)
+ "sh" t t t
+ "-c"
+ (format "sgmls|sgmlsasp %s"
+ (expand-file-name
+ sinfo-texi-mapping-file)
+ )
+ )
+ )
+ )
+ (goto-char (point-min))
+ (if (and (search-forward "sgmls:" nil t)
+ (re-search-forward "line \\([0-9]+\\)" nil t)
+ )
+ (let ((line (string-to-number
+ (buffer-substring (match-beginning 1)
+ (match-end 1)))
+ ))
+ (progn
+ (pop-to-buffer the-buf)
+ (goto-line line)
+ ))
+ (set-buffer-file-coding-system cs)
+ (sinfo-texi-swap-node)
+ (let ((title
+ (progn
+ (goto-char (point-min))
+ (and (re-search-forward "@title \\(.*\\)\n" nil t)
+ (buffer-substring (match-beginning 1)(match-end 1))
+ )))
+ )
+ (goto-char (point-min))
+ (and (re-search-forward "@setfilename$" nil t)
+ (replace-match
+ (format "@setfilename %s" fname)
+ ))
+ (and (re-search-forward "@settitle{}" nil t)
+ (replace-match
+ (format "@settitle{%s}" title)
+ ))
+ (and (re-search-forward "@top$" nil t)
+ (replace-match
+ (format "@top %s" title)
+ ))
+ )
+ (goto-char (point-min))
+ (while (re-search-forward
+ "@DREF{\\(([^{}()]*)\\)\\([^{}]+\\)}"
+ nil t)
+ (let ((file (buffer-substring (match-beginning 1)(match-end 1)))
+ (word (buffer-substring (match-beginning 2)(match-end 2)))
+ )
+ (replace-match "")
+ (re-search-forward "@end DREF")
+ (replace-match
+ (concat word " (@ref{"
+ (if (string= file "()")
+ word
+ (concat file word)
+ ) "})"))
+ ))
+ (goto-char (point-min))
+ (while (re-search-forward
+ "@AREF{\\([^{}]*\\)}{<URL:\\([^<>()]*\\)>}\n*"
+ nil t)
+ (let ((node (buffer-substring (match-beginning 1)(match-end 1)))
+ (url (buffer-substring (match-beginning 2)(match-end 2)))
+ )
+ (replace-match "")
+ (re-search-forward "@end AREF")
+ (replace-match
+ (if (string= node "()")
+ (concat "(" url ")")
+ (concat "(@ref{" node "})")
+ ))
+ ))
+ (sinfo-filter-for-standard)
+ (goto-char (point-min))
+ (while (re-search-forward "@CONCEPT{\\([^{}]+\\)}" nil t)
+ (let ((name (buffer-substring (match-beginning 1) (match-end 1))))
+ (replace-match (format "@cindex{%s}@strong{%s}" name name)
+ 'fixed-case)
+ ))
+ (goto-char (point-min))
+ (while (search-forward "{<URL:>}" nil t)
+ (replace-match "")
+ )
+ (goto-char (point-min))
+ (while (search-forward "@ref{()" nil t)
+ (replace-match "@ref{")
+ )
+ (goto-char (point-min))
+ (while (search-forward "@ref{}" nil t)
+ (replace-match "")
+ )
+ (goto-char (point-min))
+ (while (search-forward "@cindex{}" nil t)
+ (replace-match "")
+ )
+ (goto-char (point-min))
+ (while (re-search-forward "{@refill}" nil t)
+ (replace-match "")
+ (if (= (current-column) 0)
+ (delete-char 1)
+ ;;(fill-paragraph nil)
+ (if (looking-at "\n\n")
+ (insert "@refill")
+ )
+ (fill-paragraph nil)
+ ))
+ (texinfo-every-node-update)
+ (texinfo-all-menus-update)
+ (texinfo-all-menu-titles-update)
+ (goto-char (point-min))
+ )))
+
+
+;;; @ end
+;;;
+
+(provide 'sinfo)
+
+;;; sinfo.el ends here