public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc/devel/modula-2] Remove unnecessary directories
@ 2022-09-28 10:47 Gaius Mulley
0 siblings, 0 replies; only message in thread
From: Gaius Mulley @ 2022-09-28 10:47 UTC (permalink / raw)
To: gcc-cvs
https://gcc.gnu.org/g:4ba09edbfdca42454e9901a5add0fd6e44dfe249
commit 4ba09edbfdca42454e9901a5add0fd6e44dfe249
Author: Gaius Mulley <gaiusmod2@gmail.com>
Date: Wed Sep 28 11:44:31 2022 +0100
Remove unnecessary directories
More tidying up, removal of the script to generate the webpages
and removal of a modern modula-2 emacs mode.
gcc/m2/Changelog:
* www: Removed.
* el: Removed.
Signed-off-by: Gaius Mulley <gaiusmod2@gmail.com>
Diff:
---
gcc/m2/el/gm2-mode.el | 2501 --------------------
gcc/m2/www/Makefile.in | 135 --
gcc/m2/www/README | 6 -
gcc/m2/www/gm2-logo.ms | 26 -
gcc/m2/www/gm2.css | 17 -
gcc/m2/www/tools/createhtml.py | 100 -
gcc/m2/www/tools/texi2tr/html/about.tpl | 72 -
| 9 -
| 9 -
gcc/m2/www/tools/texi2tr/html/development.html | 9 -
gcc/m2/www/tools/texi2tr/html/development.tpl | 9 -
gcc/m2/www/tools/texi2tr/html/download.tpl | 107 -
| 3 -
| 11 -
gcc/m2/www/tools/texi2tr/html/heading.ht | 2 -
gcc/m2/www/tools/texi2tr/html/homepage.tpl | 66 -
gcc/m2/www/tools/texi2tr/html/index.html | 9 -
gcc/m2/www/tools/texi2tr/html/license.tpl | 70 -
gcc/m2/www/tools/texi2tr/html/news.html | 9 -
gcc/m2/www/tools/texi2tr/html/news.tpl | 9 -
gcc/m2/www/tools/texi2tr/html/platforms.tpl | 104 -
gcc/m2/www/tools/texi2tr/html/release.tpl | 75 -
gcc/m2/www/tools/texi2tr/html/texi2tr.css | 271 ---
gcc/m2/www/tools/texi2tr/html/title.ht | 20 -
gcc/m2/www/tools/texi2tr/html/users.tpl | 90 -
.../tools/texi2tr/png/200px-Heckert_GNU_white.png | 0
gcc/m2/www/tools/texi2tr/png/debian-swirl48x48.png | 0
gcc/m2/www/tools/texi2tr/png/develop.png | 0
gcc/m2/www/tools/texi2tr/png/install.png | 0
gcc/m2/www/tools/texi2tr/png/library.png | 0
| 0
| 0
| 0
| 0
gcc/m2/www/tools/texi2tr/png/next.png | 0
gcc/m2/www/tools/texi2tr/png/note.png | 0
gcc/m2/www/tools/texi2tr/png/prev.png | 0
gcc/m2/www/tools/texi2tr/png/release.png | 0
gcc/m2/www/tools/texi2tr/png/snapshot.png | 0
gcc/m2/www/tools/texi2tr/png/terminal.png | 0
gcc/m2/www/tools/texi2tr/png/users.png | 0
gcc/m2/www/tools/texi2tr/src/config.py | 38 -
gcc/m2/www/tools/texi2tr/src/navigation.py | 271 ---
gcc/m2/www/tools/texi2tr/src/outputdev.py | 565 -----
gcc/m2/www/tools/texi2tr/src/texi2tr.py | 1445 -----------
45 files changed, 6058 deletions(-)
diff --git a/gcc/m2/el/gm2-mode.el b/gcc/m2/el/gm2-mode.el
deleted file mode 100644
index d1f7903aa10..00000000000
--- a/gcc/m2/el/gm2-mode.el
+++ /dev/null
@@ -1,2501 +0,0 @@
-;; Copyright (C) 1985-2022
-
-;; Free Software Foundation, Inc.
-
-;; This file is part of GNU Emacs.
-
-;; GNU Emacs is distributed in the hope that it will be useful,
-;; but WITHOUT ANY WARRANTY. No author or distributor
-;; accepts responsibility to anyone for the consequences of using it
-;; or for whether it serves any particular purpose or works at all,
-;; unless he says so in writing. Refer to the GNU Emacs General Public
-;; License for full details.
-
-;; Everyone is granted permission to copy, modify and redistribute
-;; GNU Emacs, but only under the conditions described in the
-;; GNU Emacs General Public License. A copy of this license is
-;; supposed to have been given to you along with GNU Emacs so you
-;; can know your rights and responsibilities. It should be in a
-;; file named COPYING. Among other things, the copyright notice
-;; and this notice must be preserved on all copies.
-
-
-;; Modula-2 mode editing commands for Emacs
-
-;; Author Gaius Mulley <gaius.mulley@southwales.ac.uk>
-;; keywords can be displayed in lowercase and optionally underlined.
-;; reserved procedures and functions displayed in lowercase bold and optionally italic.
-;; contains automatic indentation
-;; automatic END matching
-;; electric THEN, END, ELSE
-;; expression formatting
-;; comment formatting
-;; procedure declaration finding
-;; const, type, var declaration finding.
-;; word expansion
-
-;; with statement expansion and module visiting lisp routines from:
-
-;; Mick Jordan
-;; amended by Peter Robinson
-;; ported to GNU Michael Schmidt <michael@pbinfo.UUCP>
-;; modified by Tom Perrine <Perrin@LOGICON.ARPA> (TEP)
-
-(defgroup gm2 nil
- "Modula-2 formatting mode."
- :group 'programming)
-
-(defcustom m2-indent-level 3
- "indentation of Modula-2 statements within a containing block."
- :type 'integer
- :group 'gm2)
-
-(defcustom m2-auto-indent-on-end t
- "automatic indentation when END is typed."
- :type 'boolean
- :group 'gm2)
-
-(defcustom m2-auto-indent-on-then t
- "automatic indentation when THEN is typed."
- :type 'boolean
- :group 'gm2)
-
-(defcustom m2-auto-indent-on-else t
- "automatic indentation when ELSE is typed."
- :type 'boolean
- :group 'gm2)
-
-(defcustom m2-auto-use-algol-style t
- "use the algol style type faces, which displays keywords and reserved
- types and functions in lowercase."
- :type 'boolean
- :group 'gm2)
-
-(defcustom m2-auto-keywords-underlined t
- "keywords should be underlined, probably not wanted if you are not using
- algol style, see m2-auto-use-algol-style."
- :type 'boolean
- :group 'gm2)
-
-(defcustom m2-auto-functions-italic nil
- "reserved functions should be rendered as italic, probably not
- wanted if you are not using algol style, see
- m2-auto-use-algol-style."
- :type 'boolean
- :group 'gm2)
-
-(defcustom m2-auto-default-gm2-extensions t
- "true if the GNU Modula-2 compiler is being used. ASM,
- VOLATILE and UNQUALIFIED keywords are highlighted."
- :type 'boolean
- :group 'gm2)
-
-(defcustom m2-auto-default-dialect 'pim
- "the default dialect of Modula-2 to be rendered. Only used if
- no explicit dialect tag is in the first n lines of the file.
- The choices are pim (1985), iso (1995) and r10 (2010)."
- :type '(radio
- (const pim)
- (const iso)
- (const r10))
- :group 'gm2)
-
-(defcustom m2-dialect-comment-search-limit 200
- "the maximum number of lines to search at the top of the source
- file in order to find the dialect marker."
- :type 'integer
- :group 'gm2)
-
-(defcustom m2-assign-future nil
- "useful for GNU developers, set this to nil if you have not
- assigned all future code to the fsf or set to t if you
- have. If you have assigned all future code to the FSF then
- this is useful as it will automatically generate the FSF
- copyright and warranty disclaimer in any new module."
- :type 'boolean
- :group 'gm2)
-
-(defcustom m2-compile-default-path "."
- "the compile include path to find the library def and mod
- files. This is a UNIX style path, each directory is
- separated by a :"
- :type 'string
- :group 'gm2)
-
-(defcustom m2-options "-g"
- "various compile time options used by the compiler."
- :type 'string
- :group 'gm2)
-
-(defcustom m2-compile-command-default "gm2 -c"
- "command to compile Modula-2 programs"
- :type 'string
- :group 'gm2)
-
-(defun m2-auto-get-compile-command ()
- "returns the compile command and options."
- (interactive)
- (progn
- (concat m2-compile-command-default " " m2-options)))
-
-(defcustom m2-link-command-default "gm2 "
- "command to link Modula-2 programs"
- :type 'string
- :group 'gm2)
-
-(defun m2-auto-get-link-command ()
- "returns the link command and options."
- (interactive)
- (progn
- (concat m2-link-command-default " " m2-options)))
-
-(defvar m2-link-name nil
- "Name of the executable.")
-
-(defconst m2-if-then-same-line nil
- "set this to t if you like the THEN on the same line as IF,
- or set it to nil if you place THEN on the next line.")
-
-(defvar m2-dialect-known nil
- "is the dialect known yet. The mode will examine the first
- m2-dialect-comment-search-limit lines for a special marker
- indicating dialect.")
-
-(defvar m2-dialect nil
- "the dialect list which can contain item tags such as gm2 m2iso
- m2pim m2r10. For example a (*!m2iso+gm2*) or (*!m2pim+gm2*)
- or (*!m2r10*) which specifies a dialect and with/without GNU
- Modula-2 extensions.")
-
-(defvar m2-auto-abbrev-table nil
- "Abbrev table in use in gm2-mode buffers.")
-(define-abbrev-table 'm2-auto-abbrev-table ())
-
-(defvar m2-auto-map ()
- "Keymap used in M2 mode.")
-
-(defun m2-auto-convert-unix-to-emacs-path (path)
- "convert a UNIX style path into a list"
- (interactive)
- (progn
- (let (epath)
- (setq epath nil)
- (let (i)
- (setq i 0)
- (let (l)
- (setq l (length path))
- (let (start)
- (setq start 0)
- (while (< i l)
- (progn
- (if (string-equal (substring path i (+ i 1)) ":")
- (progn
- (add-to-list 'epath (substring path start i))
- (setq start (+ i 1))))
- (setq i (+ i 1))))
- (if (< start l)
- (add-to-list 'epath (substring path start l))))))
- epath)))
-
-(defvar m2-auto-compile-default-path-emacs
- (m2-auto-convert-unix-to-emacs-path m2-compile-default-path)
- "this is an internal list.")
-
-(defun setup-m2-auto-keys ()
- "sets up the keymap for gm2-mode."
- (setq m2-auto-map (make-sparse-keymap))
- (define-key m2-auto-map ")" 'm2-close-paren)
- (define-key m2-auto-map "\t" 'm2-tab)
- (define-key m2-auto-map "D" 'm2-test-end)
- (define-key m2-auto-map "N" 'm2-test-then)
- (define-key m2-auto-map "E" 'm2-test-else)
-;; (define-key m2-auto-map "%" 'm2-local-test)
-;; (define-key m2-auto-map "!" 'm2-local-recompile)
- (define-key m2-auto-map (kbd "DEL") 'm2-backspace)
- (define-key m2-auto-map "\C-d" 'm2-delete)
- (define-key m2-auto-map (kbd "<delete>") 'm2-delete)
- (define-key m2-auto-map "\e." 'm2-tag)
- (define-key m2-auto-map "\e\t" 'm2-complete)
- (define-key m2-auto-map "\C-cb" 'm2-begin)
- (define-key m2-auto-map "\C-cc" 'm2-case)
- (define-key m2-auto-map "\C-cd" 'm2-definition)
- (define-key m2-auto-map "\C-ce" 'm2-else)
- (define-key m2-auto-map "\C-cf" 'm2-for)
- (define-key m2-auto-map "\C-ch" 'm2-header)
- (define-key m2-auto-map "\C-ci" 'm2-if)
- (define-key m2-auto-map "\C-cm" 'm2-module)
- (define-key m2-auto-map "\C-cl" 'm2-loop)
- (define-key m2-auto-map "\C-co" 'm2-or)
- (define-key m2-auto-map "\C-cp" 'm2-procedure)
- (define-key m2-auto-map "\C-c\C-w" 'm2-with)
- (define-key m2-auto-map "\C-c\C-e" 'm2-elsif)
- (define-key m2-auto-map "\C-cr" 'm2-record)
- (define-key m2-auto-map "\C-cs" 'm2-stdio)
- (define-key m2-auto-map "\C-ct" 'm2-type)
- (define-key m2-auto-map "\C-cu" 'm2-until)
- (define-key m2-auto-map "\C-cv" 'm2-var)
- (define-key m2-auto-map "\C-cw" 'm2-while)
- (define-key m2-auto-map "\C-cx" 'm2-export)
- (define-key m2-auto-map "\C-cy" 'm2-import)
- (define-key m2-auto-map "\C-c\C-h" 'm2-help)
- (define-key m2-auto-map "\C-c\C-z" 'suspend-emacs)
- (define-key m2-auto-map "\C-c\C-v" 'm2-visit)
- (define-key m2-auto-map "\C-c\C-t" 'm2-toggle)
- (define-key m2-auto-map "\C-c\C-l" 'm2-link)
- (define-key m2-auto-map "\C-c\C-d" 'm2-debug)
- (define-key m2-auto-map "\C-c\C-a" 'm2-assembler)
- (define-key m2-auto-map "\C-c\C-c" 'm2-compile))
-
-(defun looking-at-keyword (regexp)
- "return t if the cursor is matching regexp."
- (interactive)
- (progn
- (m2-auto-restore-upper-case-region (line-beginning-position) (line-end-position))
- (looking-at regexp)))
-
-(defun re-search-backward-keyword (regexp &optional bound noerror count)
- "return t if the cursor is matching regexp when searching backwards."
- (interactive)
- (progn
- (m2-auto-restore-upper-case-region (point-min) (point-max))
- (re-search-backward regexp bound noerror count)))
-
-(defun re-search-forward-keyword (regexp &optional bound noerror count)
- "return t if the cursor is matching regexp when searching backwards."
- (interactive)
- (progn
- (m2-auto-restore-upper-case-region (point-min) (point-max))
- (re-search-forward regexp bound noerror count)))
-
-(defun m2-close-paren ()
- "Insert a close parenthesis and call m2-match-parenthesis."
- (interactive)
- (insert ")")
- (m2-match-parenthesis))
-
-(defun m2-match-parenthesis ()
- "Match the current character according to the syntax table."
- (interactive)
- (save-excursion
- (progn
- (let (count)
- (setq count 1)
- (forward-char -1)
- (if (> (point) (point-min))
- (progn
- (forward-char -1)
- (while (and (> (point) (point-min))
- (not (= count 0)))
- (progn
- (if (looking-at "(")
- (setq count (- count 1))
- (if (looking-at ")")
- (setq count (+ count 1))))
- (if (not (= count 0))
- (m2-backward-to-token)))))))
- (if (looking-at "(")
- (sit-for 1)
- (message "No matching (")))))
-
-(defun forward-or-backward-sexp (&optional arg)
- "Go to the matching parenthesis character if one is adjacent to point."
- (interactive "^p")
- (cond ((looking-at "\\s(") (forward-sexp arg))
- ((looking-back "\\s)" 1) (backward-sexp arg))
- ;; Now, try to succeed from inside of a bracket
- ((looking-at "\\s)") (forward-char) (backward-sexp arg))
- ((looking-back "\\s(" 1) (backward-char) (forward-sexp arg))))
-
-(defun m2-tag ()
- "m2-tag finds the declaration of the modula-2 symbol the cursor is on."
- (interactive)
- (setq case-fold-search nil)
- (save-excursion
- (while (looking-at "[A-Za-z0-9]")
- (forward-char -1))
- (forward-char 1)
- (let (m2-start)
- (setq m2-start (point))
- (while (looking-at "[A-Za-z0-9]")
- (forward-char 1))
- (let (m2-end)
- (setq m2-end (point))
- (let (m2-object)
- (setq m2-object (buffer-substring m2-start m2-end))
- (if (not (m2-find-declaration m2-object))
- (message "cannot find declaration of: %s" m2-object)))))))
-
-(defun m2-complete ()
- "m2-complete - expands the string the cursor is currently on."
- (interactive)
- (setq case-fold-search nil)
- (forward-char -1)
- (while (looking-at "[A-Za-z0-9]")
- (forward-char -1))
- (forward-char 1)
- (let (m2-start)
- (setq m2-start (point))
- (while (looking-at "[A-Za-z0-9]")
- (forward-char 1))
- (let (m2-end)
- (setq m2-end (point))
- (m2-find-previous-string (buffer-substring m2-start m2-end)))))
-
-(defun m2-find-previous-string (m2-object)
- "searches for a previous m2-object and inserts the remaining characters."
- (interactive)
- (save-excursion
- (message "searching for %s" m2-object)
- (let (m2-insert)
- (setq m2-insert (point))
- (forward-char (- 0 (length m2-object)))
- (if (search-backward m2-object (point-min) t nil)
- (progn
- (forward-char (length m2-object))
- (let (m2-start)
- (setq m2-start (point))
- (while (looking-at "[A-Za-z0-9]")
- (forward-char 1))
- (let (m2-end)
- (setq m2-end (point))
- (goto-char m2-insert)
- (insert (buffer-substring m2-start m2-end)))))
- (progn
- (message "cannot complete: %s" m2-object)))))
- (while (looking-at "[A-Za-z0-9]")
- (forward-char 1)))
-
-(defun m2-find-declaration (m2-object)
- "searches for object locally and then searches externally for object."
- (interactive)
- (let (source-window)
- (let (source-buffer)
- (setq source-window (selected-window))
- (setq source-buffer (current-buffer))
- (delete-other-windows)
- (split-window)
- (if (m2-find-declaration-procedure m2-object)
- (progn
- (m2-move-to-procedure-start)
- (other-window 1)
- t)
- (if (m2-find-type-or-var m2-object)
- (progn
- (m2-move-to-type-or-var-start)
- (other-window 1)
- t)
- (if (m2-find-import-declaration m2-object ".mod")
- (if (m2-find-declaration m2-object)
- (progn
- (switch-to-buffer source-buffer)
- t)
- (progn
- (delete-other-windows)
- (select-window source-window)
- (switch-to-buffer source-buffer)
- (split-window)
- (if (m2-find-import-declaration m2-object ".def")
- (progn
- (m2-find-declaration m2-object)
- t)
- (progn
- (message "not found in the definition module")
- (sit-for 1)
- nil))))
- (progn
- (message (concat "cannot find declaration of " m2-object))
- (sit-for 1)
- nil)))))))
-
-(defun m2-find-type-or-var (m2-object)
- "searches for an object defined as CONST, TYPE or VAR."
- (interactive)
- (goto-char (point-min))
- (let (m2-value)
- (setq m2-value nil)
- (while (and (not m2-value)
- (re-search-forward-keyword "TYPE\\|CONST\\|VAR" nil t))
- (progn
- (m2-forward-to-token)
- (while (and (not (looking-at-keyword "BEGIN\\|END"))
- (not (looking-at m2-object)))
- (m2-forward-to-token))
- (if (looking-at m2-object)
- (progn
- (m2-forward-to-token)
- (if (looking-at "[=:,]")
- (setq m2-value t))))))
- m2-value))
-
-(defun m2-move-to-type-or-var-start ()
- "moves to the start of the CONST, TYPE or VAR declaration."
- (beginning-of-line)
- (let (m2-point)
- (setq m2-point (point))
- (skip-chars-backward " \t\n\f" (point-min))
- (re-search-backward-keyword "TYPE\\|CONST\\|VAR" nil t)
- (set-window-start (selected-window) (point))
- (goto-char m2-point)))
-
-(defun m2-move-to-procedure-start ()
- "moves to the start of the procedure implementation (before the
- comments start - if they exist)."
- (beginning-of-line)
- (let (m2-point)
- (setq m2-point (point))
- (skip-chars-backward " \t\n\f" (point-min))
- (if (and (> (point) 2)
- (save-excursion (forward-char -2) (looking-at "\\*)")))
- (progn
- (m2-run-back-over-comments (point-min))
- (forward-char 1)))
- (set-window-start (selected-window) (point))))
-
-(defun m2-find-declaration-procedure (m2-object)
- "attempts to find the declaration of m2-object as a procedure."
- (interactive)
- (goto-char (point-min))
- (let (m2-value)
- (setq m2-value nil)
- (setq m2-object (concat m2-object " "))
- (while (and (not m2-value)
- (re-search-forward-keyword "PROCEDURE" nil t))
- (progn
- (m2-forward-to-token)
- (if (and (looking-at m2-object) (not (m2-is-forward-declaration)))
- (setq m2-value t))))
- m2-value))
-
-(defun m2-is-forward-declaration ()
- "returns true if this procedure heading is just a FORWARD declaration
- of a implementation further down the file."
- (interactive)
- (save-excursion
- (m2-forward-to-token)
- (if (looking-at "(")
- (progn
- (while (and (< (point) (point-max))
- (not (looking-at ")")))
- (m2-forward-to-token))))
- (while (and (< (point) (point-max))
- (not (looking-at ";"))) ;
- (m2-forward-to-token))
- (m2-forward-to-token)
- (looking-at-keyword "FORWARD")))
-
-(defun m2-find-import-declaration (m2-object m2-extension)
- "scans the import list of the current module for m2-object.
- If m2-object is found then the appropriate module with
- m2-extension is opened and the cursor is placed at the
- start of the declaration."
- (interactive)
- (goto-char (point-min))
- (let (m2-success)
- (setq m2-success nil)
- (let (m2-module-name)
- (let (m2-continue)
- (setq m2-module-name nil)
- (setq m2-continue t)
- (while (and (< (point) (point-max))
- (not m2-success)
- m2-continue
- (not (m2-indent-commencer)))
- (progn
- (if (re-search-forward-keyword "[ ;\n\t]\\(BEGIN\\|FINALLY\\|EXCEPT\\|CONST\\|TYPE\\|VAR\\|FROM\\|PROCEDURE\\)" nil t)
- (progn
- (forward-char -1)
- (while (looking-at "[A-Za-z0-9]")
- (forward-char -1))
- (forward-char 1)))
- (if (looking-at-keyword "FROM")
- (progn
- (m2-forward-until-white (point-max))
- (m2-forward-to-token)
- (let (m2-start)
- (setq m2-start (point))
- (while (looking-at "[A-Za-z0-9]")
- (forward-char 1))
- (setq m2-module-name (buffer-substring m2-start (point)))
- (setq m2-success (m2-found-import-ident m2-object))
- (if m2-success
- (progn
- (message "found %s in module %s" m2-object m2-module-name)
- (m2-find-module m2-module-name)))))
- (progn
- (setq m2-continue (not (m2-indent-commencer)))
- (m2-forward-until-white (point-max))
- (m2-forward-to-token)))))))
- m2-success))
-
-(defun m2-found-import-ident (m2-object)
- "scans the import current list for m2-object.
- If m2-object is found then true is returned."
- (interactive)
- (progn
- (let (m2-success)
- (setq m2-success nil)
- (while (and (not (looking-at-keyword ";\\|BEGIN\\|CONST\\|TYPE\\|VAR\\|FROM\\|PROCEDURE"))
- (not m2-success))
- (progn
- (setq m2-success (looking-at-keyword m2-object))
- (m2-forward-to-token)))
- m2-success)))
-
-(defun m2-help ()
- "displays the help buffer."
- (interactive)
- (let (m2-buffer)
- (setq m2-buffer (current-buffer))
- (if (get-buffer "*Modula-2-Help*")
- (kill-buffer "*Modula-2-Help*"))
- (switch-to-buffer "*Modula-2-Help*")
-
- (insert (concat
-"This is a mode intended to support program development in Modula-2.
-All control constructs of Modula-2 can be reached by typing
-Control-C followed by the first character of the construct.
-
- Control-c b begin Control-c c case
- Control-c d definition Control-c e else
- Control-c f for Control-c h header
- Control-c i if Control-c m module
- Control-c l loop Control-c o or
- Control-c p procedure Control-c Control-w with
- Control-c r record Control-c s stdio
- Control-c t type Control-c u until
- Control-c v var Control-c w while
- Control-c x export Control-c y import
- Control-c Control-d debug Control-c Control-t toggle def/mod
- Control-c Control-c compile Control-x ` next-error
- Control-c Control-l link Esc . find declaration
- Control-c Control-h help Esc \\t complete name
-
- You can customize the following variables using M-x customize and choosing gm2.
-
- m2-compile-command: " m2-compile-command-default "
- m2-link-command: " m2-link-command-default "
- m2-compile-default-path: " m2-compile-default-path "
- m2-options: " m2-options))
- (toggle-read-only)
- (goto-char (point-min))
- (delete-other-windows)
- (split-window)
- (switch-to-buffer m2-buffer)))
-
-(defun m2-newline ()
- "insert a newline and tab to the correct indent."
- (interactive)
- (end-of-line)
- (insert "\n")
- (m2-tab))
-
-(defun m2-begin ()
- "Insert a BEGIN keyword and indent for the next line."
- (interactive)
- (insert "BEGIN")
- (m2-newline)
- (m2-tab))
-
-(defun m2-case ()
- "Build skeleton CASE statment, prompting for the <expression>."
- (interactive)
- (insert "CASE " (read-string "expression: ") " OF")
- (m2-tab)
- (m2-newline)
- (insert "\nEND")
- (m2-tab))
-
-(defun m2-fsf-copyright ()
- "emit the a copyright notice providing m2-assign-future is set."
- (if m2-assign-future
- (insert "(* Copyright (C) 2020 Free Software Foundation, Inc. *)\n")))
-
-(defun m2-fsf-gpl-notice ()
- "emit the fsf gpl notice at the relevant position."
- (insert "(* This file is part of GNU Modula-2.
-
-GNU Modula-2 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 3, or (at your option) any later
-version.
-
-GNU Modula-2 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 gm2; see the file COPYING. If not, write to the Free Software
-Foundation, 51 Franklin Street, Fifth Floor,
-Boston, MA 02110-1301, USA. *)\n\n"))
-
-(defun m2-fsf-lgpl-notice ()
- "emit the fsf notice at the relevant position."
- (insert "(* This file is part of GNU Modula-2.
-
-This library is free software; you can redistribute it and/or
-modify it under the terms of the GNU Lesser General Public
-License as published by the Free Software Foundation; either
-version 2.1 of the License, or (at your option) any later version.
-
-This library 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
-Lesser General Public License for more details.
-
-You should have received a copy of the GNU Lesser General Public
-License along with this library; if not, write to the Free Software
-Foundation, Inc., 51 Franklin Street, Fifth Floor,
-Boston, MA 02110-1301 USA. *)\n\n"))
-
-(defun m2-fsf-notice ()
- "if the m2-assign-future is set then prompt the user for 'g'pl or 'l'gpl."
- (interactive)
- (if m2-assign-future
- (let ((type (read-string "which kind of license (g)GPL or (l)LGPL? ")))
- (if (string-equal type "l")
- (m2-fsf-lgpl-notice)
- (m2-fsf-gpl-notice)))))
-
-(defun m2-dialect-tag ()
- "Insert m2 dialect comment tag."
- (interactive)
- (if m2-dialect-known
- (progn
- (if (m2-auto-dialect-pim)
- (insert "(*!m2pim"))
- (if (m2-auto-dialect-iso)
- (insert "(*!m2iso"))
- (if (m2-auto-dialect-r10)
- (insert "(*!m2r10"))
- (if (m2-auto-dialect-gm2-extensions)
- (insert "+gm2"))
- (insert "*)"))))
-
-(defun m2-definition ()
- "Build skeleton DEFINITION MODULE, prompting for the <module name>."
- (interactive)
- (m2-fsf-copyright)
- (m2-fsf-notice)
- (insert "DEFINITION MODULE ")
- (insert (substring (buffer-name) 0 -4) " ; ")
- (m2-dialect-tag)
- (insert "\n\n\n\nEND " (substring (buffer-name) 0 -4) ".\n")
- (previous-line 3)
- (m2-header))
-
-(defun m2-else ()
- "Insert ELSE keyword and indent for next line."
- (interactive)
- (insert "ELSE")
- (m2-tab)
- (m2-newline))
-
-(defun m2-for ()
- "Build skeleton FOR loop statment, prompting for the loop parameters."
- (interactive)
- (insert "FOR " (read-string "init: ") " TO " (read-string "end: "))
- (let ((by (read-string "by: ")))
- (if (not (string-equal by ""))
- (insert " BY " by)))
- (insert " DO")
- (m2-tab)
- (m2-newline)
- (insert "\nEND")
- (m2-tab)
- (previous-line 1)
- (m2-tab))
-
-(defun m2-header ()
- "Insert a comment block containing the module title, author, etc."
- (interactive)
- (insert "(*\n Title : ")
- (if (or (string-equal (substring (buffer-name) -4) ".def")
- (string-equal (substring (buffer-name) -4) ".mod"))
- (insert (substring (buffer-name) 0 (- (length (buffer-name)) 4)))
- (insert (buffer-name)))
- (insert "\n Author : ")
- (insert (user-full-name))
-;;; (insert (concat "\n\t\t<" (user-login-name) "@" (system-name) ">\n"))
- (insert "\n System : GNU Modula-2")
- (insert "\n Date : ")
- (insert (current-time-string))
- (insert "\n Revision : $Version$ ")
- (insert "\n Description: ")
- (insert "\n*)\n\n")
- (previous-line 3)
- (end-of-line))
-
-(defun m2-if ()
- "Insert skeleton IF statment, prompting for <boolean-expression>."
- (interactive)
- (m2-tab)
- (if m2-if-then-same-line
- (insert "IF " (read-string "<boolean-expression>: ") " THEN")
- (progn
- (insert "IF " (read-string "<boolean-expression>: ") )
- (insert "\nTHEN")))
- (m2-tab)
- (m2-newline)
- (insert "\nEND")
- (m2-tab)
- (previous-line 1))
-
-(defun m2-loop ()
- "Build skeleton LOOP (with END)."
- (interactive)
- (m2-tab)
- (insert "LOOP")
- (m2-newline)
- (m2-newline)
- (insert "END")
- (m2-tab)
- (previous-line 1)
- (m2-tab))
-
-(defun m2-module ()
- "Build skeleton MODULE, prompting for definition, implementation or module."
- (interactive)
- (m2-fsf-copyright)
- (m2-fsf-notice)
- (let ((type (read-string "(i)mplementation or (m)odule: ")))
- (if (string-equal type "i")
- (insert "IMPLEMENTATION "))
- (insert "MODULE " (substring (buffer-name) 0 -4) " ; ")
- (m2-dialect-tag)
- (insert "\n\n\n")
- (if (string-equal type "m")
- (insert "BEGIN\n\n"))
- (insert "END " (substring (buffer-name) 0 -4) ".\n"))
- (previous-line 3))
-
-(defun m2-or ()
- (interactive)
- (m2-newline)
- (insert "OR")
- (m2-newline)
- (m2-tab))
-
-(defun m2-procedure ()
- (interactive)
- (insert "(*\n")
- (m2-indent-comment)
- (let ((name (read-string "Procedure name: " ))
- args)
- (insert name " - \n")
- (insert "*)")
- (m2-indent-comment)
- (end-of-line)
- (insert "\n\n")
- (insert "PROCEDURE ")
- (let (results)
- (setq args (read-string "Arguments: "))
- (setq results (read-string "Result Type: "))
- (insert name)
- (if (or (not (string-equal args ""))
- (not (string-equal results "")))
- (insert " (" args ")"))
- (if (not (string-equal results ""))
- (insert " : " results))
- (insert " ;")
- (m2-newline)
- (insert "BEGIN")
- (m2-newline)
- (m2-newline)
- (insert "END ")
- (insert name)
- (insert " ;\n\n")
- (previous-line 2)
- (m2-tab)
- (previous-line 1)
- (m2-tab)
- (previous-line 5)
- (end-of-line))))
-
-(defun m2-with ()
- (interactive)
- (m2-tab)
- (insert "WITH ")
- (insert (read-string "Designator: "))
- (insert " DO")
- (m2-newline)
- (m2-newline)
- (insert "END")
- (m2-tab)
- (previous-line 1)
- (m2-tab))
-
-(defun m2-elsif ()
- (interactive)
- (m2-tab)
- (insert "ELSIF ")
- (insert (read-string "<boolean expression>: "))
- (end-of-line)
- (m2-tab)
- (insert "\nTHEN")
- (m2-tab)
- (m2-newline))
-
-(defun m2-record ()
- (interactive)
- (m2-tab)
- (insert "RECORD")
- (m2-newline)
- (m2-newline)
- (insert "END")
- (m2-tab)
- (previous-line 1)
- (m2-tab))
-
-(defun m2-stdio ()
- (interactive)
- (if (m2-auto-dialect-pim)
- (insert "
-FROM StrIO IMPORT WriteString, ReadString, WriteLn ;
-FROM StdIO IMPORT Write, Read ;
-"))
- (if (m2-auto-dialect-iso)
- (insert "
-FROM STextIO IMPORT WriteString, WriteLn, ReadString,
- ReadChar, WriteChar,
- ReadRestLine, ReadToken, SkipLine ;
-"))
- (if (m2-auto-dialect-r10)
- (insert "
-m2r10 imports go here
-")))
-
-(defun m2-type ()
- (interactive)
- (insert "TYPE")
- (m2-newline)
- (m2-tab))
-
-(defun m2-until ()
- (interactive)
- (insert "REPEAT")
- (m2-tab)
- (m2-newline)
- (m2-newline)
- (m2-tab)
- (insert "UNTIL ")
- (insert (read-string "<expression>: "))
- (m2-tab)
- (previous-line 1)
- (m2-tab))
-
-(defun m2-var ()
- (interactive)
- (m2-newline)
- (insert "VAR")
- (m2-newline)
- (m2-tab))
-
-(defun m2-while ()
- (interactive)
- (m2-tab)
- (insert "WHILE ")
- (insert (read-string "<expression>: "))
- (insert " DO")
- (m2-newline)
- (m2-newline)
- (insert "END")
- (m2-tab)
- (previous-line 1)
- (m2-tab))
-
-(defun m2-export ()
- (interactive)
- (insert "EXPORT QUALIFIED "))
-
-(defun m2-import ()
- (interactive)
- (insert "FROM ")
- (insert (read-string "Module: "))
- (insert " IMPORT "))
-
-(defun m2-debug ()
- (interactive)
- (gdb m2-debug-command))
-
-(defun m2-compile ()
- (interactive)
- (compile (m2-auto-get-compile-command)))
-
-(defun m2-assembler ()
- (interactive)
- (let (source-window)
- (let (source-buffer)
- (let (source-line)
- (let (m2-file)
- (setq m2-file (concat (substring (buffer-name) 0 -4) ".s"))
- (setq source-line (substring (what-line) 5 (length (what-line))))
- (delete-other-windows)
- (split-window)
- (if (not (or (get-buffer m2-file)
- (find-file m2-file)))
- (progn
- (let (old-compile-command)
- (setq old-compile-command compile-command)
- (compile (generate-assembler-command m2-file))
- (setq compile-command old-compile-command)))
- (m2-search-for-line m2-file source-line)))))))
-
-(defun m2-search-for-line (m2-file source-line)
- "search for the source code equivalent, source-line, in assembly file, m2-file"
- (interactive)
- (save-excursion
- (if (switch-to-buffer m2-file)
- (if (search-forward (concat ".stabn 68,0," source-line))
- (progn
- (beginning-of-line)
- (while (and (< (point) (point-max))
- (looking-at "^\\."))
- (next-line 1))))))
- (message "failed to compile module %s" (buffer-name)))
-
-(defun generate-assembler-command (assembly-file)
- "generate the compilation string which will generate, assembly-file"
- (interactive)
- (if (string-equal "gm2" (substring compile-command 0 3))
- (concat "gm2 -S -g " (substring compile-command 4 (length compile-command)))
- ""))
-
-(defun m2-link ()
- (interactive)
- (let (modulename)
- (setq modulename (buffer-name))
- (cond ((string-equal (substring (buffer-name) -4) ".def")
- (compile (concat m2-link-command " "
- (substring (buffer-name) 0 -4))))
- ((string-equal (substring (buffer-name) -4) ".mod")
- (compile (concat m2-link-command " "
- (substring (buffer-name) 0 -4)))))))
-
-(defun m2-visit ()
- (interactive)
- (let (modulename)
- (save-excursion
- (setq modulename
- (read-string "Module name: "))
- (m2-find-module modulename))))
-
-(defun m2-find-module (name)
- "attempts to find module, name, by searching the directories
- determined by m2-path."
- (progn
- (let (m2-found)
- (setq m2-found (locate-file name m2-auto-compile-default-path-emacs '(".def" ".mod" ".md" ".mi")))
- (if m2-found
- (find-file m2-found))
- m2-found)))
-
-(defun m2-toggle ()
- "Toggle between .mod and .def files for the module."
- (interactive)
- (cond ((string-equal (substring (buffer-name) -4) ".def")
- (find-file-other-window
- (concat (substring (buffer-name) 0 -4) ".mod")))
- ((string-equal (substring (buffer-name) -4) ".mod")
- (find-file-other-window
- (concat (substring (buffer-name) 0 -4) ".def")))
- ((string-equal (substring (buffer-name) -3) ".mi")
- (find-file-other-window
- (concat (substring (buffer-name) 0 -3) ".md")))
- ((string-equal (substring (buffer-name) -3) ".md")
- (find-file-other-window
- (concat (substring (buffer-name) 0 -3) ".mi")))))
-
-(defun m2-tab ()
- "tab moves to the correct indentation for the current line."
- (interactive)
- (let (m2-point)
- (if (and (> (point) 1)
- (save-excursion (forward-char -1) (looking-at "(\\*")))
- (progn
- (setq m2-point 1)
- (forward-char -1))
- (setq m2-point 0))
- (if (m2-in-parameter)
- (progn
- (message "Formatting parameter block")
- (m2-format-expression))
- (if (m2-in-expression)
- (progn
- (message "Formatting expression")
- (m2-format-expression))
- (m2-indent))
- (forward-char m2-point))))
-
-(defun m2-in-parameter ()
- "returns true if the cursor is currently inside a parameter block."
- (interactive)
- (let (m2-point)
- (setq m2-point (point))
- (save-excursion
- (m2-backward-to-token)
- (if (looking-at-keyword "PROCEDURE[ \n]")
- nil
- (while (and (> (point) 1) (not (m2-is-parameter-commencer))
- (not (m2-is-parameter-terminator)))
- (m2-backward-to-token))
- (if (looking-at-keyword "PROCEDURE[ \n]")
- (progn
- (goto-char m2-point)
- (while (not (m2-is-parameter-terminator))
- (m2-forward-to-token))
- (looking-at ")"))
- nil)))))
-
-(defun m2-is-parameter-commencer ()
- "returns true if we are looking at a parameter block commencer"
- (looking-at-keyword "PROCEDURE[ \n]"))
-
-(defun m2-is-parameter-terminator ()
- "returns true if we are looking at a parameter block terminator"
- (looking-at-keyword ")\\|BEGIN\\|IF\\|THEN\\|ELSE\\|END\\|WHILE\\|REPEAT\\|UNTIL\\|LOOP\\|CONST|\\MODULE"))
-
-(defun m2-indent-comment ()
- "moves cursor to the current indentation of the comment."
- (interactive)
- (let (m2-point-end)
- (let (m2-indent)
- (let (m2-start-line)
- (save-excursion
- (save-excursion
- (beginning-of-line)
- (setq m2-start-line (point)))
- (m2-backward-to-comment-start)
- (setq m2-point-end (point))
- (beginning-of-line)
- (setq m2-indent (- m2-point-end (point))))
- (m2-remove-leading-spaces)
- (if (and (not (looking-at "\\*)"))
- (>= m2-start-line m2-point-end))
- (setq m2-indent (+ m2-indent m2-indent-level)))
- (m2-create-indent m2-indent)))))
-
-(defun m2-backward-to-comment-start ()
- "moves back to the start of a comment."
- (interactive)
- (let (m2-point)
- (let (carry-on)
- (if (and (> (point) 1)
- (looking-at "\\*)"))
- (forward-char -1))
- (setq m2-point (point))
- (setq carry-on t)
- (while carry-on
- (setq m2-point (point))
- (if (and (>= (point) 3)
- (save-excursion
- (forward-char -2)
- (looking-at "\\*)")))
- (m2-run-back-over-comments 1))
- (if (> (point) 1)
- (forward-char -1))
- (setq carry-on (and (> (point) 1)
- (not (looking-at "(\\*"))))))))
-
-(defun m2-indent ()
- "calculates the indentation for the current line."
- (interactive)
- (let (m2-point)
- (save-excursion
- (m2-remove-leading-spaces))
- (setq m2-point (point))
- (beginning-of-line)
- (setq m2-point (- m2-point (point)))
- (m2-create-indent (m2-calculate-indent))
- (while (> m2-point 0)
- (forward-char 1)
- (setq m2-point (- m2-point 1)))))
-
-(defun m2-remove-leading-spaces ()
- "removes any leading spaces in a source line."
- (interactive)
- (beginning-of-line)
- (if (looking-at "[\t| ]")
- (progn (delete-char 1)
- (m2-remove-leading-spaces))))
-
-(defun m2-create-indent (num)
- "generates num indent."
- (interactive)
- (while (> num 0)
- (progn
- (insert " ")
- (setq num (- num 1)))))
-
-(defun m2-calculate-indent ()
- "calculates the indentation required for the current source line."
- (interactive)
- (let ((m2-level)
- (m2-found-record))
- (if (m2-indent-terminator)
- (setq m2-level (- m2-indent-level))
- (setq m2-level 0))
- (save-excursion
- (m2-backward-to-token)
- (while (and (> (point) 1)
- (or (and (m2-in-parameter)
- (looking-at-keyword "VAR"))
- (not (or (m2-indent-terminator)
- (m2-indent-commencer)
- (looking-at-keyword "CASE")))))
- (m2-backward-to-token))
- (if (looking-at-keyword "CASE")
- (setq m2-level 0)
- (if (m2-indent-commencer)
- (setq m2-level (+ m2-level m2-indent-level))))
- (setq m2-found-record nil)
- (if (looking-at-keyword "END")
- (progn
- (save-excursion
- (m2-match-end)
- (if (looking-at-keyword "RECORD")
- (progn
- (setq m2-level (+ m2-level (m2-calculate-indent)))
- (setq m2-found-record t))))))
- (if (not m2-found-record)
- (progn
- (setq m2-level (+ m2-level (point)))
- (beginning-of-line)
- (setq m2-level (- m2-level (point))))))
- m2-level))
-
-(defun m2-in-expression ()
- "returns true if we are currently inside a modula-2 expression."
- (interactive)
- (let (m2-level)
- (save-excursion
- (beginning-of-line)
- (if (looking-at "[\t ]")
- (progn
- (m2-forward-to-token)
- (if (looking-at ")")
- (progn
- (forward-char -1)
- (message "found )")))))
- (while (and (> (point) 1)
- (not (or (m2-expression-commencer)
- (m2-expression-terminator))))
- (if (looking-at ")")
- (m2-skip-brackets ")" "(")
- (m2-backward-to-token)))
- (setq m2-level (and (not (looking-at "(\\*"))
- (m2-expression-commencer))))
- m2-level))
-
-(defun m2-skip-brackets (m2-open m2-close)
- "skips the brackets () it stops at the next matching bracket."
- (interactive)
- (m2-backward-to-token)
- (while (and (> (point) 1)
- (not (or (m2-expression-terminator)
- (looking-at m2-close))))
- (if (looking-at m2-open)
- (m2-skip-brackets m2-open m2-close)
- (m2-backward-to-token))))
-
-(defun m2-expression-backstop ()
- "returns true if we are looking at a Modula-2 keyword behind which
- an expression cannot exist."
- (interactive)
- (or (looking-at-keyword "UNTIL")
- (looking-at-keyword "WHILE")
- (looking-at-keyword "IF")
- (looking-at ":=")
- (looking-at-keyword "TO")
- (looking-at "(\\*")
- (looking-at-keyword "FOR")))
-
-(defun m2-expression-commencer ()
- "returns true if we are currently looking at an expression commencer."
- (interactive)
- (looking-at "[-+*=(<>/#[]"))
-;;; be VERY careful if you add anything to the above regexp
-;;; test it against:
-;;; a := = b + - c * d : ; ) ( , < > . [ ] # / !
-
-(defun m2-expression-terminator ()
- "returns true if we are currently looking at an expression terminator."
- (interactive)
- (or (looking-at-keyword "THEN")
- (looking-at-keyword "ELSE")
- (looking-at-keyword "ELSIF")
- (looking-at-keyword "END")
- (looking-at-keyword "VAR")
- (looking-at-keyword "TYPE")
- (looking-at-keyword "CONST")
- (looking-at-keyword "BEGIN")
- (looking-at-keyword "WITH")
- (looking-at-keyword "RECORD")
- (looking-at-keyword "PROCEDURE")
- (looking-at-keyword "OF")
- (looking-at-keyword "DO")
- (looking-at "[;:]")))
-
-(defun m2-format-expression ()
- "formats the current expression."
- (interactive)
- (beginning-of-line)
- (let (m2-spaces)
- (let (m2-cursor)
- (let (m2-end)
- (let (m2-start)
- (let (m2-start-exp)
- (let (m2-next-tok)
- (setq m2-cursor (point))
- (save-excursion
- (m2-find-beginning-of-expression)
- (setq m2-start-exp (point))
- (save-excursion
- (beginning-of-line)
- (setq m2-start (point))
- (end-of-line)
- (setq m2-end (point)))
- (m2-forward-to-token)
- (setq m2-next-tok (point)))
- (if (> m2-next-tok m2-end)
- (progn
- (setq m2-spaces (+ (- m2-start-exp m2-start) 1))
- (goto-char m2-cursor)
- (beginning-of-line)
- (m2-remove-leading-spaces)
- (if (looking-at "[\])]")
- (progn
- (setq m2-spaces (- m2-start-exp m2-start))))
- (if (or (m2-indent-commencer)
- (m2-indent-terminator))
- (m2-indent)
- (m2-create-indent m2-spaces)))
- (progn
- (m2-remove-leading-spaces)
- (if (looking-at "[\])]")
- (progn
- (m2-create-indent (- m2-start-exp m2-start)))
- (m2-create-indent (- m2-next-tok m2-start))))))))))))
-
-(defun m2-find-beginning-of-expression ()
- "positions the cursor on the start of the current subexpression."
- (interactive)
- (let (m2-level)
- (setq m2-level 1)
- (while (and
- (not (and (= m2-level 0)
- (m2-expression-commencer)))
- (not (m2-expression-backstop)))
- (m2-backward-to-token)
- (if (looking-at ")")
- (setq m2-level (+ m2-level 1))
- (if (looking-at "(")
- (setq m2-level (- m2-level 1)))))))
-
-(defun m2-delete-indent-spaces ()
- "removes 3 spaces from the beginning of the line if they exist."
- (interactive)
- (m2-delete-space)
- (m2-delete-space)
- (m2-delete-space))
-
-(defun m2-delete-space ()
- "removes a space from the beginning of the line if one exists."
- (save-excursion
- (beginning-of-line)
- (if (looking-at "\t")
- (progn
- (delete-char 1)
- (insert " "))
- (if (looking-at " ")
- (delete-char 1)))))
-
-(defun m2-old-calculate-indent ()
- "calculates the indentation required for the current source line."
- (interactive)
- (let (m2-level)
- (save-excursion
- (setq m2-level 0)
- (while (> (point) 1)
- (if (m2-indent-terminator)
- (setq m2-level (- m2-level 1)))
- (m2-backward-to-token)
- (if (m2-indent-commencer)
- (setq m2-level (+ m2-level 1)))))
- (while (> m2-level 0)
- (progn
- (insert " ")
- (setq m2-level (- m2-level 1))))))
-
-(defun m2-indent-commencer ()
- "returns true if a token representing the beginning of an indent sequence was found."
- (or (and
- m2-if-then-same-line
- (looking-at-keyword "IF"))
- (and
- (not m2-if-then-same-line)
- (looking-at-keyword "THEN"))
- (looking-at-keyword "BEGIN")
- (looking-at-keyword "FINALLY")
- (looking-at-keyword "EXCEPT")
- (looking-at-keyword "RECORD")
- (looking-at-keyword "FOR")
- (looking-at-keyword "CONST")
- (looking-at-keyword "TYPE")
- (looking-at-keyword "VAR")
- (looking-at-keyword "WITH")
- (looking-at-keyword "LOOP")
- (looking-at-keyword "REPEAT")
- (looking-at-keyword "ELSE")
- (looking-at-keyword "WHILE")))
-
-(defun m2-indent-terminator ()
- "returns true if a token representing the end of an indent sequence was found."
- (or (looking-at-keyword "END")
- (looking-at-keyword "BEGIN")
- (looking-at-keyword "FINALLY")
- (looking-at-keyword "EXCEPT")
- (looking-at-keyword "CONST")
- (looking-at-keyword "TYPE")
- (looking-at-keyword "VAR")
- (looking-at-keyword "ELSE")
- (looking-at-keyword "ELSIF")
- (looking-at-keyword "UNTIL")))
-
-(defun m2-local-recompile ()
- "recompile the gm2-mode and load the file"
- (interactive)
- (byte-compile-file (concat (getenv "HOME") "/m2/comp/el/gm2-mode.el"))
- (read-abbrev-file (concat (getenv "HOME") "/m2/comp/el/gm2-mode.elc"))
- (message "Compilation complete"))
-
-(defvar m2-auto-syntax-table nil
- "Syntax table in use in gm2-mode buffers.")
-
-(if m2-auto-syntax-table
- ()
- (setq m2-auto-syntax-table (make-syntax-table))
- (modify-syntax-entry ?\\ "\\" m2-auto-syntax-table)
- (modify-syntax-entry ?/ ". 14" m2-auto-syntax-table)
- (modify-syntax-entry ?+ "." m2-auto-syntax-table)
- (modify-syntax-entry ?- "." m2-auto-syntax-table)
- (modify-syntax-entry ?= "." m2-auto-syntax-table)
- (modify-syntax-entry ?% "." m2-auto-syntax-table)
- (modify-syntax-entry ?< "." m2-auto-syntax-table)
- (modify-syntax-entry ?> "." m2-auto-syntax-table)
- (modify-syntax-entry ?& "." m2-auto-syntax-table)
- (modify-syntax-entry ?| "." m2-auto-syntax-table)
- (modify-syntax-entry ?\' "\"" m2-auto-syntax-table)
- ;; sadly cannot use the follow as it conflicts with comment
- ;; delimiters
- ;; (modify-syntax-entry ?\( "($" m2-auto-syntax-table)
- ;; (modify-syntax-entry ?\) ")^" m2-auto-syntax-table)
- ;; Modula-2, Pascal, Mathematica style comment: (* ... *)
- (modify-syntax-entry ?\( ". 1" m2-auto-syntax-table)
- (modify-syntax-entry ?\) ". 4" m2-auto-syntax-table)
- (modify-syntax-entry ?* ". 23" m2-auto-syntax-table))
-
-(defun m2-test-end ()
- "check to see whether END has been typed"
- (interactive)
- (insert "D")
- (setq case-fold-search nil)
- (if (and (not (m2-is-in-string))
- (> (point) 4))
- (save-excursion
- (forward-char -4)
- (if (looking-at-keyword "[; \t\n]END[; \t\n]")
- (progn
- (m2-found-end))))))
-
-(defun m2-found-end ()
- "found END now attempt to line up code"
- (interactive)
- (if m2-auto-indent-on-end
- (m2-tab))
- (save-excursion
- (if (m2-match-end)
- (m2-display-match (point))
- (message "no matching statement found"))))
-
-(defun m2-test-then ()
- "check to see whether THEN has been typed"
- (interactive)
- (insert "N")
- (setq case-fold-search nil)
- (if (and (not (m2-is-in-string))
- (> (point) 5))
- (save-excursion
- (forward-char -5)
- (if (looking-at-keyword "[; \t\n]THEN[; \t\n]")
- (m2-found-then)))))
-
-(defun m2-found-then ()
- "found THEN now attempt to line up code"
- (interactive)
- (if m2-auto-indent-on-then
- (m2-tab)))
-
-(defun m2-test-else ()
- "check to see whether ELSE has been typed"
- (interactive)
- (insert "E")
- (setq case-fold-search nil)
- (if (and (not (m2-is-in-string))
- (> (point) 5))
- (save-excursion
- (forward-char -5)
- (if (looking-at-keyword "[; \t\n]ELSE[; \t\n]")
- (m2-found-else)))))
-
-(defun m2-found-else ()
- "found ELSE now attempt to line up code"
- (interactive)
- (if m2-auto-indent-on-else
- (m2-tab)))
-
-(defun m2-local-test ()
- "simple test hook."
- (interactive)
- (let ((m2-success (m2-testing)))
- (if (numberp m2-success)
- (message "number found")
- (if (stringp m2-success)
- (message "Error found missing: %s" m2-success)
- (if (bufferp m2-success)
- (message "buffer found")
- (if (symbolp m2-success)
- (if m2-success
- (message "No error found")
- (message "FALSE returned %s" m2-success))))))))
-
-(defun m2-testing ()
- "simple function which returns a number of different symbols"
- nil
-)
-
-(defun m2-match-end ()
- "finds the start of the statement matching the END returns true if found."
- (interactive)
- (let (m2-level)
- (let (beginning)
- (setq m2-level 1)
- (while (and (> m2-level 0) (> (point) 1))
- (re-search-backward-keyword "[ ;\n\t]\\(END\\|IF\\|LOOP\\|WITH\\|WHILE\\|RECORD\\|CASE\\|FOR\\|MODULE\\|PROCEDURE\\)" nil t)
- (forward-char 1)
- (if (not (m2-is-in-string))
- (if (looking-at-keyword "END")
- (setq m2-level (+ m2-level 1))
- (setq m2-level (- m2-level 1)
- beginning (point)))))
- (= m2-level 0))))
-
-(defun m2-end-commencer ()
- "returns true if a token representing the beginning of an END was found."
- (and (> (point) 1)
- (or (save-excursion (forward-char -1) (looking-at-keyword "[ ;\n\t]IF"))
- (save-excursion (forward-char -1) (looking-at-keyword "[ ;\n\t]LOOP"))
- (save-excursion (forward-char -1) (looking-at-keyword "[ ;\n\t]WITH"))
- (save-excursion (forward-char -1) (looking-at-keyword "[ ;\n\t]WHILE"))
- (save-excursion (forward-char -1) (looking-at-keyword "[ ;\n\t]RECORD"))
- (save-excursion (forward-char -1) (looking-at-keyword "[ ;\n\t]CASE"))
- (save-excursion (forward-char -1) (looking-at-keyword "[ ;\n\t]FOR"))
- (save-excursion (forward-char -1) (looking-at-keyword "[ ;\n\t]MODULE"))
- (save-excursion (forward-char -1) (looking-at-keyword "[ ;\n\t]PROCEDURE")))))
-
-(defun m2-is-end()
- "returns true if END is found."
- (and (> (point) 1)
- (save-excursion (forward-char -1) (looking-at-keyword "[ ;\n\t]END"))))
-
-(defun m2-display-match (m2-beginning)
- "displays a match"
- (interactive)
- (if (<= (window-start) m2-beginning)
- (progn
- (goto-char m2-beginning)
- (sit-for 1))
- (progn
- (save-excursion
- (let (m2-start)
- (let (m2-end)
- (beginning-of-line)
- (setq m2-start (point))
- (end-of-line)
- (setq m2-end (point))
- (message "matches: %s" (buffer-substring m2-start m2-end))))))))
-
-(defun m2-backward-to-token ()
- "moves back to the beginning of the last token"
- (interactive)
- (if (> (point) 1)
- (progn
- (forward-char -1)
- (while (or (and (> (point) 1)
- (save-excursion (forward-char -1) (looking-at "\\*)")))
- (looking-at "[ \t\n]"))
- (if (looking-at "[ \t\n]")
- (forward-char -1)
- (progn
- (m2-backward-to-comment-start)
- (if (> (point) 1)
- (forward-char -1)))))
- (if (save-excursion (forward-char -1) (or (looking-at ":=")
- (looking-at "<=")
- (looking-at ">=")
- (looking-at "\\.\\.")
- (looking-at "<>")))
- (forward-char -1)
- (if (looking-at "'")
- (m2-move-backward-over-quotes)
- (if (looking-at "[0-9a-zA-Z]")
- (progn
- (while (and (> (point) 1)
- (looking-at "[0-9a-zA-Z]"))
- (forward-char -1))
- (if (> (point) 1)
- (forward-char 1)))))))))
-
-(defun m2-backward-until-ident-delimeter ()
- "moves the cursor back until an ident delimeter is found."
- (interactive)
- (while (and (> (point) 1)
- (save-excursion
- (forward-char -1)
- (not (looking-at "[ \n\t=:,;]"))))
- (forward-char -1))
- (if (and (> (point) 1)
- (save-excursion
- (forward-char -1)
- (looking-at "[=:,;]")))
- (forward-char -1)))
-
-(defun m2-backward-until-white ()
- "moves the cursor back until white space is found."
- (interactive)
- (while (and (> (point) 1)
- (save-excursion
- (forward-char -1)
- (not (looking-at "[ \t\n]"))))
- (forward-char -1)))
-
-(defun m2-backward-to-noncomment (lim)
- "moves back to the start of a non comment text."
- (interactive)
- (let (carry-on)
- (setq carry-on t)
- (while carry-on
- (skip-chars-backward " \t\n\f" lim)
- (if (and (>= (point) (+ 2 lim))
- (save-excursion
- (forward-char -2)
- (looking-at "\\*)")))
- (m2-run-back-over-comments lim))
- (setq carry-on (and (> (point) lim)
- (or (and (>= (point) (+ 2 lim))
- (save-excursion (forward-char -2) (looking-at "\\*)")))
- (save-excursion (forward-char -1) (looking-at "[\n\t ]"))))))))
-
-(defun m2-run-back-over-comments (lim)
- "moves over a comment."
- (interactive)
- (let (m2-comment-level)
- (forward-char -2)
- (if (looking-at "(\\*")
- (setq m2-comment-level 1)
- (if (looking-at "\\*)")
- (setq m2-comment-level -1)
- (message "run-over-comments assumes it is on a comment")))
- (forward-char -1)
- (while (and
- (not (= m2-comment-level 0))
- (> (point) lim))
- (if (looking-at "(\\*")
- (setq m2-comment-level (+ m2-comment-level 1)))
- (if (looking-at "\\*)")
- (setq m2-comment-level (- m2-comment-level 1)))
- (forward-char -1))))
-
-(defun m2-is-in-string ()
- "returns true if we are in a string."
- (interactive)
- (let (m2-in-quotes)
- (let (m2-point)
- (setq m2-in-quotes nil)
- (setq m2-point (point))
- (save-excursion
- (beginning-of-line)
- (while (< (point) m2-point)
- (if (looking-at "\"")
- (setq m2-in-quotes (not (m2-run-over-double-quotes m2-point)))
- (if (looking-at "'")
- (setq m2-in-quotes (not (m2-run-over-single-quotes m2-point)))))
- (forward-char 1)))
- m2-in-quotes)))
-
-(defun m2-run-over-double-quotes (m2-opoint)
- "returns true if we see a another double quote before m2-opoint."
- (interactive)
- (forward-char 1)
- (while (and (< (point) m2-opoint)
- (not (looking-at "\"")))
- (forward-char 1))
- (and (looking-at "\"") (< (point) m2-opoint)))
-
-(defun m2-run-over-single-quotes (m2-opoint)
- "returns true if we see a another single quote before m2-opoint."
- (interactive)
- (forward-char 1)
- (while (and (< (point) m2-opoint)
- (not (looking-at "'")))
- (forward-char 1))
- (and (looking-at "'") (< (point) m2-opoint)))
-
-(defun m2-is-in-comment ()
- "returns true if we are in a comment."
- (interactive)
- (let (m2-in-comment)
- (let (m2-point)
- (setq m2-point (point))
- (setq m2-in-comment nil)
- (save-excursion
- (goto-char (point-min))
- (while (< (point) m2-point)
- (if (looking-at "\"")
- (m2-run-over-double-quotes m2-point)
- (if (looking-at "'")
- (m2-run-over-single-quotes m2-point)
- (if (looking-at "(\\*")
- (setq m2-in-comment (not (m2-run-forward-over-comments m2-point))))))
- (forward-char 1)))
- m2-in-comment)))
-
-(defun m2-run-forward-over-comments (lim)
- "moves over a comment and returns true if we are not in a comment"
- (interactive)
- (let (m2-comment-level)
- (if (looking-at "(\\*")
- (setq m2-comment-level 1)
- (if (looking-at "\\*)")
- (setq m2-comment-level -1)
- (message "run-over-comments assumes it is on a comment")))
- (forward-char 1)
- (while (and
- (not (= m2-comment-level 0))
- (< (point) (- lim 1)))
- (if (looking-at "(\\*")
- (setq m2-comment-level (+ m2-comment-level 1)))
- (if (looking-at "\\*)")
- (setq m2-comment-level (- m2-comment-level 1)))
- (forward-char 1))
- (forward-char 1)
- (= m2-comment-level 0)))
-
-(defun m2-forward-to-token ()
- "moves forward to the beginning of the next token"
- (if (looking-at "[][=,;)--+#\\*\\|\\^\\%\\$@]")
- (forward-char 1)
- (if (or (looking-at ":=")
- (looking-at "<=")
- (looking-at ">=")
- (looking-at "\\.\\.")
- (looking-at "<>"))
- (forward-char 2)
- (if (looking-at "[><:\\.]")
- (forward-char 1)
- (if (looking-at "[A-Z|a-z|0-9]")
- (while (looking-at "[A-Z|a-z|0-9]")
- (forward-char 1))
- (if (and (looking-at "(") (not (looking-at "(\\*")))
- (forward-char 1)
- (if (looking-at "'")
- (progn
- (m2-move-over-quotes)
- (forward-char 1))))))))
- (while (or (looking-at "(\\*")
- (looking-at "[ \t\n]"))
- (m2-forward-to-noncomment (point-max))))
-
-(defun m2-forward-until-white (lim)
- "moves the cursor forward until white space is found."
- (while (and (< (point) lim)
- (save-excursion
- (forward-char 1)
- (not (looking-at "[ \t\n]"))))
- (forward-char 1)))
-
-(defun m2-forward-until-non-white (lim)
- "moves the cursor forward until non white space is found."
- (while (and (< (point) lim)
- (save-excursion
- (forward-char 1)
- (looking-at "[ \t\n]|(\\*")))
- (forward-char 1)))
-
-(defun m2-forward-to-noncomment (lim)
- "moves forward to the start of a non comment text."
- (interactive)
- (let (m2-point)
- (let (m2-carry-on)
- (setq m2-point (point))
- (setq m2-carry-on (< (point) lim))
- (while m2-carry-on
- (skip-chars-forward "[ \t\n]" lim)
- (setq m2-point (point))
- (if (and (< (point) lim)
- (looking-at "(\\*"))
- (m2-run-forward-over-comments lim))
- (setq m2-carry-on (and (< (point) lim)
- (or (looking-at "(\\*")
- (looking-at "[\n\t ]")))))
- (< (point) lim))))
-
-(defun m2-is-token (string)
- "returns true if we can see a token string. It does not eat up the token."
- (let (m2-point)
- (let (m2-found-noncom)
- (setq m2-point (point))
- (setq m2-found-noncom (m2-forward-to-noncomment (point-max)))
- (if m2-found-noncom
- (if (looking-at string)
- t
- nil)
- (progn
- (goto-char m2-point)
- nil)))))
-
-(defun m2-token-is (string)
- "returns true if we can see a token string. It does eat the token."
- (let (m2-point)
- (let (m2-found-noncom)
- (setq m2-point (point))
- (setq m2-found-noncom (m2-forward-to-noncomment (point-max)))
- (if m2-found-noncom
- (if (looking-at string)
- (progn
- (forward-char (length string))
- t)
- nil)
- (progn
- (goto-char m2-point)
- nil)))))
-
-(defun m2-ident ()
- "derived from EBNF for ident"
- (let (m2-point)
- (let (m2-found-noncom)
- (setq m2-point (point))
- (setq m2-found-noncom (m2-forward-to-noncomment (point-max)))
- (if m2-found-noncom
- (progn
- (if (and (looking-at "[A-Za-z][A-Za-z]*[0-9]*")
- (progn (skip-chars-forward "[A-Za-z][A-Za-z]*[0-9]*")
- (or (looking-at "[ \n\t]")
- (looking-at "(\\*"))))
- (progn
- (skip-chars-forward "[A-Za-z][A-Za-z]*[0-9]*")
- t)
- "Identifier"))
- (goto-char m2-point)
- "Identifier"))))
-
-(defun m2-string ()
- "derived from EBNF for a modula-2 string"
- (let (m2-found-noncom)
- (let (m2-point)
- (setq m2-point (point))
- (setq m2-found-noncom (m2-forward-to-noncomment (point-max)))
- (if m2-found-noncom
- (if (looking-at "'")
- (m2-move-over-quotes)
- nil)
- (progn
- (goto-char m2-point)
- nil)))))
-
-(defun m2-move-over-quotes ()
- "moves the cursor over the quoted string, nil is returned if
- the string encounters a newline before the quote."
- (let (m2-qpoint)
- (let (m2-carry-on)
- (setq m2-qpoint (point))
- (if (looking-at "'")
- (progn
- (forward-char 1)
- (setq m2-carry-on (not (looking-at "['\n]")))
- (while m2-carry-on
- (progn
- (forward-char 1)
- (setq m2-carry-on (not (looking-at "['\n]")))))
- (if (looking-at "\n")
- (progn
- (goto-char m2-qpoint)
- "missing end quote before newline")
- t))
- (progn
- (forward-char 1)
- (set m2-carry-on (not (looking-at "[\"\n]")))
- (while m2-carry-on
- (progn
- (forward-char 1)
- (setq m2-carry-on (not (looking-at "[\"\n]")))))
- (if (looking-at "\n")
- (progn
- (goto-char m2-qpoint)
- "missing end quote before newline")
- t))))))
-
-(defun m2-move-backward-over-quotes ()
- "moves the cursor over the quoted string, nil is returned if
- the string encounters a newline before the quote."
- (let (m2-qpoint)
- (let (m2-carry-on)
- (setq m2-qpoint (point))
- (if (looking-at "'")
- (progn
- (forward-char -1)
- (setq m2-carry-on (not (looking-at "['\n]")))
- (while m2-carry-on
- (progn
- (forward-char -1)
- (setq m2-carry-on (not (looking-at "['\n]")))))
- (if (looking-at "\n")
- (progn
- (goto-char m2-qpoint)
- "missing end quote before newline")
- t))
- (progn
- (forward-char -1)
- (setq m2-carry-on (not (looking-at "[\"\n]")))
- (while m2-carry-on
- (progn
- (forward-char -1)
- (setq m2-carry-on (not (looking-at "[\"\n]")))))
- (if (looking-at "\n")
- (progn
- (goto-char m2-qpoint)
- "missing end quote before newline")
- t))))))
-
-(defun interactive-blink-matching-open ()
- "Indicate momentarily the start of sexp before point."
- (interactive)
- (let ((blink-matching-paren-distance (buffer-size))
- (blink-matching-paren t))
- (blink-matching-open)))
-
-;; define several class of keywords, longest similar string first
-;; so that the regexp performs the longer match first.
-;; eg MOD and MODULE, PACKED and PACKEDSET
-
-(defvar m2-auto-keywords-pim
- '("AND" "ARRAY" "BEGIN" "BY" "CASE" "CONST" "DEFINITION" "DIV"
- "DO" "ELSE" "ELSIF" "END" "EXCEPT" "EXIT" "EXPORT" "FINALLY"
- "FOR" "FROM" "IF" "IMPLEMENTATION" "IMPORT" "IN" "LOOP"
- "MOD" "NOT" "OF" "OR" "PACKEDSET" "PACKED" "POINTER"
- "QUALIFIED" "RECORD" "REPEAT" "RETURN" "SET" "THEN" "TO" "TYPE"
- "UNTIL" "VAR" "WHILE" "WITH")
- "Modula-2 keywords.")
-
-(defvar m2-auto-keywords-iso
- '("EXCEPT" "FINALLY" "PACKEDSET" "PACKED" "REM" "RETRY")
- "Modula-2 keywords.")
-
-(defvar m2-auto-keywords-gm2
- '("ASM" "VOLATILE" "UNQUALIFIED")
- "GNU Modula-2 keyword extensions.")
-
-(defvar m2-auto-keywords-r10
- '("FIXME")
- "M2R10 keywords. --fixme-- complete this")
-
-(defvar m2-auto-keywords
- '()
- "Modula-2 keywords.")
-
-(defvar m2-auto-types
- '()
- "Modula-2 types.")
-
-(defvar m2-auto-types-gm2
- '("SHORTREAL" "SHORTINT" "SHORTCARD" "SHORTCOMPLEX"
- "INTEGER8" "INTEGER16" "INTEGER32" "INTEGER64"
- "CARDINAL8" "CARDINAL16" "CARDINAL32" "CARDINAL64"
- "WORD16" "WORD32" "WORD64"
- "BITSET8" "BITSET16" "BITSET32"
- "REAL32" "REAL64" "REAL128"
- "COMPLEX32" "COMPLEX64" "COMPLEX128"
- "COMPLEX" "LONGCOMPLEX"
- "CSIZE_T" "CSSIZE_T" "LOC")
- "Modula-2 types.")
-
-(defvar m2-auto-types-iso
- '("REAL" "LONGREAL" "INTEGER" "LONGINT"
- "CARDINAL" "LONGCARD" "CHAR" "BOOLEAN"
- "COMPLEX" "LONGCOMPLEX"
- "ADDRESS" "WORD" "BYTE" "LOC" "BITSET")
- "Modula-2 types.")
-
-(defvar m2-auto-types-pim
- '("REAL" "LONGREAL" "INTEGER" "LONGINT"
- "CARDINAL" "LONGCARD" "CHAR" "BOOLEAN"
- "ADDRESS" "WORD" "BYTE" "BITSET")
- "Modula-2 types.")
-
-(defvar m2-auto-types-r10
- '()
- "R10 types.")
-
-(defvar m2-auto-constants
- '("FALSE" "TRUE" "NIL")
- "Modula-2 constants.")
-
-(defvar m2-auto-functions
- '()
- "Modula-2 functions.")
-
-(defvar m2-auto-functions-pim
- '("ABS" "ADR" "CAP" "CHR" "DEC" "DISPOSE" "EXCL" "FLOAT"
- "HIGH" "INC" "INCL" "MAX" "MIN" "NEW" "ODD" "ORD"
- "SIZE" "TRUNC" "VAL")
- "Modula-2 functions found in PIM.")
-
-(defvar m2-auto-functions-iso
- '("ABS" "ADR" "CAP" "CHR" "CMPLX" "DEC" "DISPOSE" "EXCL" "FLOAT"
- "HIGH" "IM" "INC" "INCL" "LENGTH" "MAX" "MIN" "NEW" "ODD" "ORD"
- "RE" "SIZE" "TRUNC" "VAL")
- "Modula-2 functions found in ISO.")
-
-(defvar m2-auto-functions-gm2
- '("IM" "LENGTH" "MAX" "MIN" "RE" "ROTATE" "SHIFT" "THROW" "TBITSIZE")
- "Modula-2 functions found in SYSTEM and gm2 allows access to ISO
- if PIM is used.")
-
-(defvar m2-auto-functions-r10
- '()
- "R10 functions.")
-
-(defvar m2-auto-block-name
- '("END" "MODULE" "PROCEDURE")
- "Modula-2 keywords which will name a block.")
-
-;; create the regex string for each class of keywords
-(defvar m2-auto-keywords-regexp (regexp-opt m2-auto-keywords 'words))
-(defvar m2-auto-type-regexp (regexp-opt m2-auto-types 'words))
-(defvar m2-auto-constant-regexp (regexp-opt m2-auto-constants 'words))
-(defvar m2-auto-functions-regexp (regexp-opt m2-auto-functions 'words))
-
-(defvar m2-auto-traditional-keywords-regexp (regexp-opt m2-auto-keywords 'words))
-(defvar m2-auto-traditional-type-regexp (regexp-opt m2-auto-types 'words))
-(defvar m2-auto-traditional-constant-regexp (regexp-opt m2-auto-constants 'words))
-(defvar m2-auto-traditional-functions-regexp (regexp-opt m2-auto-functions 'words))
-
-(defun m2-debug-message (m)
- "."
- (interactive)
- (message m)
- (while t
- (progn)))
-
-(defun m2-union (a b)
- "."
- (interactive)
- (progn
- (let (result)
- (setq result (copy-tree a))
- (let (l)
- (setq l (length b))
- (let (i)
- (setq i 0)
- (while (< i l)
- (progn
- (add-to-list 'result (nth i b))
- (setq i (+ i 1))))))
- result)))
-
-(defun m2-generate-keywords ()
- "generate the variable m2-auto-keywords from the chosen dialect."
- (interactive)
- (setq m2-auto-keywords (m2-union m2-auto-keywords m2-auto-keywords-pim))
- (if (eq m2-auto-default-dialect 'iso)
- (setq m2-auto-keywords (m2-union m2-auto-keywords m2-auto-keywords-iso)))
- (if (eq m2-auto-default-dialect 'r10)
- (setq m2-auto-keywords (m2-union m2-auto-keywords m2-auto-keywords-r10)))
- (if m2-auto-default-gm2-extensions
- (setq m2-auto-keywords (m2-union m2-auto-keywords m2-auto-keywords-gm2)))
- (setq m2-auto-keyword-regexp (concat "\\(\\.\\|(\\|,\\|;\\|^\\| \\|\t\\)\\("
- (mapconcat 'identity m2-auto-keywords "\\|")
- "\\)\\(,\\|)\\|(\\|;\\| \\|$\\)"))
- (setq m2-auto-traditional-keywords-regexp (regexp-opt m2-auto-keywords 'words)))
-
-(defun m2-generate-types ()
- "generate the variable m2-auto-types from the chosen dialect."
- (interactive)
- (if (eq m2-auto-default-dialect 'pim)
- (setq m2-auto-types (m2-union m2-auto-types m2-auto-types-pim)))
- (if (eq m2-auto-default-dialect 'iso)
- (setq m2-auto-types (m2-union m2-auto-types m2-auto-types-iso)))
- (if (eq m2-auto-default-dialect 'r10)
- (setq m2-auto-types (m2-union m2-auto-types m2-auto-types-r10)))
- (if m2-auto-default-gm2-extensions
- (setq m2-auto-types (m2-union m2-auto-types m2-auto-types-gm2)))
- (setq m2-auto-type-regexp (concat "\\(\\.\\|(\\|,\\|;\\|^\\| \\|\t\\)\\(" (mapconcat 'identity m2-auto-types "\\|") "\\)\\(,\\|)\\|(\\|;\\| \\|$\\)"))
- (setq m2-auto-traditional-type-regexp (regexp-opt m2-auto-types 'words)))
-
-(defun m2-generate-functions ()
- "generate the variable m2-auto-functions from the chosen dialect."
- (interactive)
- (if (eq m2-auto-default-dialect 'pim)
- (setq m2-auto-functions (m2-union m2-auto-functions m2-auto-functions-pim)))
- (if (eq m2-auto-default-dialect 'iso)
- (setq m2-auto-functions (m2-union m2-auto-functions m2-auto-functions-iso)))
- (if (eq m2-auto-default-dialect 'r10)
- (setq m2-auto-functions (m2-union m2-auto-functions m2-auto-functions-r10)))
- (if m2-auto-default-gm2-extensions
- (setq m2-auto-functions (m2-union m2-auto-functions m2-auto-functions-gm2)))
- (setq m2-auto-builtin-regexp (concat "\\(\\.\\|(\\|,\\|;\\|^\\| \\|\t\\)\\(" (mapconcat 'identity m2-auto-functions "\\|") "\\)\\(,\\|)\\|(\\|;\\| \\|$\\)"))
- (setq m2-auto-traditional-functions-regexp (regexp-opt m2-auto-functions 'words)))
-
-(defun restore-upper (begin end)
- "."
- (interactive)
- (if (m2-auto-on-upper begin)
- (progn
- (let (was-modified)
- (setq was-modified (buffer-modified-p))
- (upcase-region begin end)
- (remove-text-properties begin end '(font-lock-face nil))
- (remove-text-properties begin end '(upper nil))
- (remove-text-properties begin end '(face nil))
- (set-buffer-modified-p was-modified)))))
-
-(defun m2-auto-restore-upper-case ()
- "."
- (interactive)
- (m2-auto-restore-upper-case-region (point-min) (point-max)))
-
-(defun m2-auto-restore-upper-case-region (begin end)
- "."
- (interactive)
- (save-excursion
- (goto-char begin)
- (let (m2-auto-min)
- (setq m2-auto-min (point))
- (let (seen-upper)
- (setq seen-upper (m2-auto-on-upper (point)))
- (while (< (point) end)
- (progn
- (if (not (eq seen-upper (m2-auto-on-upper (point))))
- (progn
- (setq seen-upper (m2-auto-on-upper (point)))
- (if (m2-auto-on-upper (point))
- ;; just moved onto an uppercase
- (setq m2-auto-min (point))
- ;; just moved off an uppercase
- (restore-upper m2-auto-min (point)))))
- (forward-char 1)))
- (if (m2-auto-on-upper m2-auto-min)
- (restore-upper m2-auto-min (point)))))))
-
-(defun remove-upper-highlight-right ()
- "."
- (interactive)
- ;; (message "insert hook executed")
- (if (< (point) (point-max))
- (progn
- (save-excursion
- (forward-char 1)
- (if (< (point) (point-max))
- (progn
- (let (start)
- (setq start (point))
- (forward-char 1)
- (while (and (< (point) (point-max))
- (m2-auto-on-upper (point)))
- (forward-char 1))
- (forward-char -1)
- (if (m2-auto-on-upper (point))
- (restore-upper start (point))))))))))
-
-(defun remove-upper-highlight-left ()
- "."
- (interactive)
- (progn
- ;; (message "insert hook executed")
- (let (bol)
- (setq bol (line-beginning-position))
- (if (> (point) bol)
- (progn
- (save-excursion
- (forward-char -1)
- (let (start)
- (setq start -1)
- (while (and (>= (point) bol)
- (m2-auto-on-upper (point)))
- (progn
- (setq start (point))
- (forward-char -1)))
- (if (> start -1)
- (progn
- (let (end)
- (goto-char start)
- (setq bol (line-end-position))
- (setq end -1)
- (while (and (<= (point) bol)
- (m2-auto-on-upper (point)))
- (progn
- (forward-char 1)
- (setq end (point))))
- (if (> end -1)
- (restore-upper start end))))))))))))
-
-(defun m2-auto-check-on-insertion ()
- "."
- (interactive)
- (m2-auto-restore-upper-case-region (line-beginning-position) (line-end-position)))
-
-(defun m2-backspace ()
- "."
- (interactive)
- (backward-delete-char-untabify 1)
- (m2-auto-check-on-insertion))
-
-(defun m2-delete ()
- "."
- (interactive)
- (delete-char 1)
- (m2-auto-check-on-insertion))
-
-(defun m2-auto-on-upper (pos)
- "."
- (interactive)
- (progn
- (get-text-property pos 'upper)))
-
-(defun m2-auto-trim-left (s)
- "Remove whitespace at the beginning of S."
- (if (string-match "\\`[ \t\n\r]+" s)
- (replace-match "" t t s)
- s))
-
-(defun m2-auto-trim-right (s)
- "Remove whitespace at the end of S."
- (if (string-match "[ \t\n\r]+\\'" s)
- (replace-match "" t t s)
- s))
-
-(defun m2-auto-trim (s)
- "Remove whitespace at the beginning and end of S."
- (m2-auto-trim-left (m2-auto-trim-right s)))
-
-(defun m2-auto-lowerise (all-matched left-leader token face)
- "."
- (interactive)
- (progn
- (save-excursion
- (let (l)
- ;; (message (concat "m2-auto-keywordise <" all-matched ">"))
- (setq l (length token))
- (goto-char (match-beginning 0))
- ;; (message (format "value of l is %d, keyword %d and all-matched %d" l (length keyword) (length all-matched)))
- (forward-char (length left-leader))
- (insert (propertize (downcase token)
- 'font-lock-face face
- 'rear-nonsticky t
- 'upper t))
- (delete-char (length token))))
- nil))
-
-(defun m2-auto-lowerise-block (all-matched left-leader token face)
- "."
- (interactive)
- (progn
- (save-excursion
- (goto-char (match-beginning 0))
- (forward-char (length left-leader))
- (insert (propertize (downcase token)
- 'font-lock-face face
- 'rear-nonsticky t
- 'upper t))
- (delete-char (length token)))
- nil))
-
-(defun m2-auto-lowerise-block-ident (all-matched left-leader token ident keyword-face function-face)
- "."
- (interactive)
- (progn
- (save-excursion
- (let (l)
- ;; (message (concat "m2-auto-lowerise-block-ident <" all-matched "> ident <" ident ">"))
- (setq l (length token))
- (goto-char (match-beginning 0))
- ;; (message (format "value of l is %d, keyword %d and all-matched %d" l (length keyword) (length all-matched)))
- (forward-char (length left-leader))
- (insert (propertize (downcase token)
- 'font-lock-face keyword-face
- 'rear-nonsticky t
- 'upper t))
- (delete-char (length token))
- (setq l (- (length all-matched) (length ident)))
- (setq l (- l (length token)))
- (forward-char l)
- (insert (propertize ident
- 'font-lock-face function-face
- 'rear-nonsticky t))
- (delete-char (length ident))))
- nil))
-
-(defun m2-all-upper-case-region (begin end)
- "."
- (interactive)
- (progn
- (save-excursion
- (goto-char begin)
- (let (m2-auto-min)
- (setq m2-auto-min (point))
- (let (is-upper)
- (setq is-upper nil)
- (while (and (< (point) end)
- is-upper)
- (progn
- (if (not (m2-auto-on-upper (point)))
- (setq seen-upper nil))
- (forward-char 1)))
- is-upper)))))
-
-(defun dbg (kind s)
- "."
- (interactive)
- (message (concat kind "<" s ">"))
- (sit-for 1))
-
-(defun m2-auto-detect-dialect ()
- "."
- (interactive)
- (save-excursion
- (if (re-search-forward "(*!m2" nil t)
- (progn
- (while (and (< (point) (point-max))
- (not (looking-at "*)")))
- (progn
- ;; (message (concat "while: " (buffer-substring (point) (+ (point) 3))))
- (if (looking-at "pim")
- (progn
- (forward-char 3)
- (setq m2-dialect-known t)
- (add-to-list 'm2-dialect 'pim))
- (if (looking-at "iso")
- (progn
- (forward-char 3)
- (setq m2-dialect-known t)
- (add-to-list 'm2-dialect 'iso))
- (if (looking-at "r10")
- (progn
- (forward-char 3)
- (setq m2-dialect-known t)
- (add-to-list 'm2-dialect 'r10))
- (if (looking-at "gm2")
- (progn
- (forward-char 3)
- (add-to-list 'm2-dialect 'gm2))
- (forward-char 1)))))))))))
-
-(defun m2-auto-dialect-pim ()
- "return t if m2pim dialect was configured or detected."
- (interactive)
- (if (not m2-dialect-known)
- (m2-auto-detect-dialect))
- (progn
- (memq 'pim m2-dialect)))
-
-(defun m2-auto-dialect-iso ()
- "return t if m2iso dialect was configured or detected."
- (interactive)
- (if (not m2-dialect-known)
- (m2-auto-detect-dialect))
- (progn
- (memq 'iso m2-dialect)))
-
-(defun m2-auto-dialect-r10 ()
- "return t if m2r10 dialect was configured or detected."
- (interactive)
- (if (not m2-dialect-known)
- (m2-auto-detect-dialect))
- (progn
- (memq 'r10 m2-dialect)))
-
-(defun m2-auto-dialect-gm2-extensions ()
- "return t if either the tag +gm2 detected or gm2 has been configured in customize."
- (interactive)
- (if (not m2-dialect-known)
- (m2-auto-detect-dialect))
- (progn
- (memq 'gm2 m2-dialect)))
-
-(defun m2-auto-message-dialect ()
- "."
- (interactive)
- (if (m2-auto-dialect-pim)
- (message "pim dialect of Modula-2"))
- (if (m2-auto-dialect-iso)
- (message "iso dialect of Modula-2"))
- (if (m2-auto-dialect-r10)
- (message "r10 dialect of Modula-2")))
-
-(defun m2-auto-after-load-hook (filename)
- "."
- (interactive)
- ;; (message "after-load-hook")
- (m2-auto-detect-dialect))
-;; (if m2-dialect-known
-;; (m2-auto-message-dialect)
-;; (message "no dialect of Modula-2 detected or configured yet using emacs customize")))
-
-(defconst m2-auto-keyword-regexp (concat "\\((\\|,\\|;\\|^\\| \\|\t\\)\\(" (mapconcat 'identity m2-auto-keywords "\\|") "\\)\\(,\\|)\\|(\\|;\\| \\|$\\)"))
-(defconst m2-auto-type-regexp (concat "\\((\\|,\\|;\\|^\\| \\|\t\\)\\(" (mapconcat 'identity m2-auto-types "\\|") "\\)\\(,\\|)\\|(\\|;\\| \\|$\\)"))
-(defconst m2-auto-constant-regexp (concat "\\((\\|,\\|;\\|^\\| \\|\t\\)\\(" (mapconcat 'identity m2-auto-constants "\\|") "\\)\\(,\\|)\\|(\\|;\\| \\|$\\)"))
-(defconst m2-auto-builtin-regexp (concat "\\((\\|,\\|;\\|^\\| \\|\t\\)\\(" (mapconcat 'identity m2-auto-functions "\\|") "\\)\\(,\\|)\\|(\\|;\\| \\|$\\)"))
-;; (defconst m2-auto-procedure-regexp "\\(PROCEDURE\\( \\|\t\\|\n\\)\\*\\(\\[:alpha:\\]\\[:alpnum:\\]\\*\\)\\)")
-;; (defconst m2-auto-procedure-regexp "\\(PROCEDURE\\( \\|\t\\)*\\)")
-;; (defconst m2-auto-procedure-regexp (concat "\\((\\|,\\|;\\|^\\| \\|\t\\)\\(" (mapconcat 'identity m2-auto-block-name "\\|") "\\)\\( \\|)\\(\\[:alpha:\\]\\[:alpnum:\\]*\\)\\|(\\|;\\| \\|$\\)")) ; work
-;; (defconst m2-auto-procedure-regexp (concat "\\(\\|,\\|;\\^| \\|\t\\)\\(" (mapconcat 'identity m2-auto-block-name "\\|") "\\)\\( \\|,\\|)\\|(\\|;\\|$\\)"))
-(defconst m2-auto-block-regexp (concat "\\(\\|,\\|;\\^| \\|\t\\)\\(" (mapconcat 'identity m2-auto-block-name "\\|") "\\)\\(,\\|(\\|(\\|;\\| \\|$\\)"))
-;; (defconst m2-auto-block-ident-regexp (concat "\\(\\|,\\|;\\^| \\|\t\\)\\(" (mapconcat 'identity m2-auto-block-name "\\|") "\\)\\( \\)\\([\\[:alpha:]\\]+\\)"))
-(defconst m2-auto-block-ident-regexp (concat "\\(\\|,\\|;\\^| \\|\t\\)\\(" (mapconcat 'identity m2-auto-block-name "\\|") "\\)\\( \\)+\\([\\[:alpha:]\\[:alnum:]\\]+\\)"))
-
-(defvar m2-auto-test-keywords nil
- "dynamically generated keyword list from the dialects.")
-
-(defun m2-auto-adapt-font-faces ()
- "."
- (interactive)
- (if m2-auto-keywords-underlined
- (progn
- (make-variable-buffer-local 'font-lock-keyword-face)
- (copy-face 'font-lock-keyword-face 'm2-auto-keyword-face)
- ;; (set-face-foreground 'm2-auto-keyword-face "green4")
- (set-face-bold 'm2-auto-keyword-face t)
- (set-face-underline 'm2-auto-keyword-face t)
- (setq font-lock-keyword-face 'm2-auto-keyword-face)))
- (if m2-auto-functions-italic
- (progn
- (make-variable-buffer-local 'font-lock-builtin-face)
- (copy-face 'font-lock-builtin-face 'm2-auto-builtin-face)
- (set-face-bold 'm2-auto-builtin-face t)
- (set-face-italic 'm2-auto-builtin-face t)
- (setq font-lock-builtin-face 'm2-auto-builtin-face))))
-
-;;(make-variable-buffer-local 'font-lock-keyword-face) (copy-face
-;;'font-lock-keyword-face 'm2-auto-keyword-face) (set-face-foreground
-;;'m2-auto-keyword-face "green4")
-
-;;(add-hook 'lua-mode-hook
-;; (lambda ()
-;; (setq font-lock-keyword-face 'm2-auto-keyword-face)
-;; ))
-
-
-(defun m2-auto-function-name-test (name)
- "."
- (interactive)
- (message name)
- (sit-for 1))
-
-(defun m2-auto-add-keywords ()
- "."
- (interactive)
-
- (m2-auto-adapt-font-faces)
- (m2-generate-keywords)
- (m2-generate-types)
- (m2-generate-functions)
- (if m2-auto-use-algol-style
- (progn
- `(
- (,m2-auto-type-regexp "\\(.*$\\)"
- (m2-auto-lowerise (match-string 0) (match-string 1) (match-string 2) font-lock-type-face) nil
- (1 font-lock-type-face))
- (,m2-auto-constant-regexp "\\(.*$\\)"
- (m2-auto-lowerise (match-string 0) (match-string 1) (match-string 2) font-lock-constant-face) nil
- (1 font-lock-constant-face))
- (,m2-auto-builtin-regexp "\\(.*$\\)"
- (m2-auto-lowerise (match-string 0) (match-string 1) (match-string 2) font-lock-builtin-face) nil
- (1 font-lock-builtin-face))
- ;; (,m2-auto-procedure-regexp "\\(.*$\\)"
- ;; (m2-auto-function-name-test (match-string 0))
- ;; (1 font-lock-function-face))
- ;;
- ;; got to here
- ;;
- (,m2-auto-block-ident-regexp "\\(.*$\\)"
- (m2-auto-lowerise-block-ident
- (match-string 0) (match-string 1) (match-string 2) (match-string 4)
- font-lock-keyword-face font-lock-function-name-face) nil
- (1 font-lock-keyword-face))
- (,m2-auto-block-regexp "\\(.*$\\)"
- (m2-auto-lowerise-block (match-string 0) (match-string 1) (match-string 2) font-lock-keyword-face) nil
- (1 font-lock-keyword-face))
- ;; end here
- (,m2-auto-keyword-regexp "\\(.*$\\)"
- (m2-auto-lowerise (match-string 0) (match-string 1) (match-string 2) font-lock-keyword-face) nil
- (1 font-lock-keyword-face))))
- (progn
- `(
- (,m2-auto-traditional-type-regexp . font-lock-type-face)
- (,m2-auto-traditional-constant-regexp . font-lock-constant-face)
- (,m2-auto-traditional-functions-regexp . font-lock-function-name-face)
- (,m2-auto-traditional-keywords-regexp . font-lock-keyword-face)
- ;; note: order above matters.
- ))))
-
-(defun gm2-mode ()
- "Major mode for editing M2 code. User definable variables:
- m2-indent-level
- Indentation of M2 statements within surrounding block."
- (interactive)
- (kill-all-local-variables)
- (setup-m2-auto-keys)
- (use-local-map m2-auto-map)
- (setq major-mode 'gm2-mode)
- (setq mode-name "GM2-trunk")
- (setq local-abbrev-table m2-auto-abbrev-table)
- (set-syntax-table m2-auto-syntax-table)
- (setq blink-matching-paren t)
-
- ;; code for syntax highlighting
- (setq font-lock-defaults '(m2-auto-add-keywords))
- ;; clear memory
- (setq m2-auto-keywords-regexp nil)
- (setq m2-auto-types-regexp nil)
- (setq m2-auto-constants-regexp nil)
- (setq m2-auto-functions-regexp nil)
- ;; end of syntax highlighting
-
- ;; (comment-start "(*") (comment-end "*)")
- (setq case-fold-search nil)
- (setq indent-tabs-mode nil)
- (setq m2-auto-hook
- '(lambda ()
- (progn (make-local-variable 'compile-command)
- (setq compile-command (concat (m2-auto-get-compile-command) " " (concat (substring (buffer-name) 0 -4) ".mod")))
- (linum-mode 0))))
-
- (add-hook 'before-save-hook 'm2-auto-restore-upper-case)
- (add-hook 'post-self-insert-hook 'm2-auto-check-on-insertion nil 'local)
- (add-hook 'after-load-functions 'm2-auto-after-load-hook)
- (run-hooks 'm2-auto-hook))
-
-;;
-;; ----------------------------------------------------------------------
-;; how to install this emacs file on your system?
-;; ----------------------------------------------------------------------
-;;
-;; add this to your $HOME/.emacs file
-;;
-;; (add-to-list 'package-archives
-;; '("gm2" . "http://floppsie.comp.glam.ac.uk/packages/"))
-;;
-;; now in emacs type
-;;
-;; M-x package-install gm2
-;;
diff --git a/gcc/m2/www/Makefile.in b/gcc/m2/www/Makefile.in
deleted file mode 100644
index 9f91118fbc2..00000000000
--- a/gcc/m2/www/Makefile.in
+++ /dev/null
@@ -1,135 +0,0 @@
-# Copyright (C) 2006-2021 Free Software Foundation, Inc.
-
-# This file is part of GNU Modula-2.
-
-# GNU Modula-2 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 3, or (at your option)
-# any later version.
-
-# GNU Modula-2 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 Modula-2; see the file COPYING. If not, write to
-# the Free Software Foundation, 51 Franklin Street, Fifth Floor,
-# Boston, MA 02110-1301, USA.
-
-objdir = @objdir@
-srcdir = @srcdir@
-
-WWWDIR=../../../../../www/gm2
-
-TEXISRC = $(srcdir)/../../doc/gm2.texi
-RELEASE = 12
-
-# $(objdir)/gm2/gm2-libs.texi \
-# $(objdir)/gm2/gm2-ebnf.texi \
-# $(objdir)/gm2/SYSTEM-pim.texi \
-# $(objdir)/gm2/SYSTEM-iso.texi \
-# $(objdir)/gm2/Builtins.texi \
-# $(objdir)/gm2/version.texi
-
-TEXI2HTML = python3 $(srcdir)/tools/texi2tr/src/texi2tr.py
-CREATEHTML = python3 $(srcdir)/tools/createhtml.py
-
-TOP_LEVEL_OUTPUTS = download.html homepage.html license.html platforms.html \
- about.html release.html users.html texi2tr.css \
- news.html development.html community.html index.html \
- gm2-logo.png
-
-RELEASE_OUTPUTS = $(RELEASE)/download.html $(RELEASE)/homepage.html \
- $(RELEASE)/license.html $(RELEASE)/platforms.html \
- $(RELEASE)/about.html $(RELEASE)/release.html $(RELEASE)/users.html \
- $(RELEASE)/texi2tr.css $(RELEASE)/news.html $(RELEASE)/development.html \
- $(RELEASE)/community.html $(RELEASE)/index.html \
- $(RELEASE)/gm2-logo.png $(RELEASE)/gm2.html
-
-OUTPUTS=$(TOP_LEVEL_OUTPUTS) $(RELEASE_OUTPUTS)
-
-PNGS=debian-swirl48x48.png develop.png install.png library.png menu-left-tab.png \
- menu-right-tab.png menu-selected-left-tab.png menu-selected-right-tab.png \
- next.png note.png prev.png release.png snapshot.png terminal.png users.png \
- 200px-Heckert_GNU_white.png
-
-RELEASE_PNGS=$(RELEASE)/debian-swirl48x48.png $(RELEASE)/develop.png $(RELEASE)/install.png \
- $(RELEASE)/library.png $(RELEASE)/menu-left-tab.png \
- $(RELEASE)/menu-right-tab.png $(RELEASE)/menu-selected-left-tab.png \
- $(RELEASE)/menu-selected-right-tab.png \
- $(RELEASE)/next.png note.png $(RELEASE)/prev.png $(RELEASE)/release.png \
- $(RELEASE)/snapshot.png $(RELEASE)/terminal.png $(RELEASE)/users.png \
- $(RELEASE)/200px-Heckert_GNU_white.png
-
-all: $(OUTPUTS) $(PNGS) $(RELEASE_PNGS)
-
-%.png: ${srcdir}/tools/texi2tr/png/%.png
- cp $< $@
-
-%.pdf: %.ps
- gs -q -dBATCH -dNOPAUSE -sDEVICE=pdfwrite -sOutputFile=$@ $<
-
-%.ps: %.ms
- groff -s -e -t -Tps -ms -mwww $< > $@
-
-gm2-logo.png: gm2-logo.eps
- pstopnm -nocrop -stdout $< | pnmcrop | pnmscale .4 | pnmrotate -90 | pnmtopng > $@
-
-gm2-logo.eps: $(srcdir)/gm2-logo.ms
- groff -P-b16 $< > gm2-logo.ps
- gs -dNOPAUSE -sDEVICE=bbox -- gm2-logo.ps 2> gm2-logo.bbox
- cat gm2-logo.ps | sed -e '/%%Orientation/rgm2-logo.bbox' > gm2-logo.eps
- rm gm2-logo.bbox
-
-%.html: $(srcdir)/tools/texi2tr/html/%.tpl
- $(CREATEHTML) -o $@ $<
-
-index.html: $(srcdir)/tools/texi2tr/html/index.html
- cp $< $@
-
-texi2tr.css: $(srcdir)/tools/texi2tr/html/texi2tr.css
- cp $< $@
-
-$(RELEASE)/%.png: ${srcdir}/tools/texi2tr/png/%.png
- cp $< $@
-
-$(RELEASE)/%.html: $(srcdir)/tools/texi2tr/html/%.tpl $(RELEASE)
- $(CREATEHTML) -s $(RELEASE) -o $@ $<
-
-$(RELEASE)/%.ht: $(srcdir)/tools/texi2tr/html/%.ht
- $(CREATEHTML) -w $(RELEASE) -s $(RELEASE) -o $@ $<
-
-$(RELEASE)/index.html: $(srcdir)/tools/texi2tr/html/index.html $(RELEASE)
- cp $< $@
-
-$(RELEASE)/texi2tr.css: $(srcdir)/tools/texi2tr/html/texi2tr.css $(RELEASE)
- cp $< $@
-
-$(RELEASE):
- mkdir $(RELEASE)
-
-$(RELEASE)/gm2.html: $(TEXISRC) $(RELEASE) $(RELEASE)/title.ht
- $(TEXI2HTML) -T$(RELEASE):$(srcdir)/tools/texi2tr/html -n -s $(RELEASE) -I../..:../../m2:$(srcdir)/../../m2:$(srcdir)/../../doc/include:$(srcdir)/../../doc -b $(RELEASE)/gm2-%d.html -r gm2.html gm2.texi
-
-$(RELEASE)/gm2-logo.png: gm2-logo.eps
- pstopnm -nocrop -stdout $< | pnmcrop | pnmscale .4 | pnmrotate -90 | pnmtopng > $@
-
-install: all force
- @if [ "$(WWWDIR)" = "" ] ; then \
- echo "you must set WWWDIR" ; \
- exit 1 ; \
- fi
- @if [ ! -d $(WWWDIR) ] ; then \
- echo "you must set WWWDIR to point to a directory" ; \
- exit 1 ; \
- fi
- cp -r $(RELEASE) $(WWWDIR)
-
-# cp *.html *.png *.css $(WWWDIR)
-# cp -r $(RELEASE) $(WWWDIR)
-
-clean: force
- $(RM) *.eps *.ps *.html *.png *~
-
-force:
diff --git a/gcc/m2/www/README b/gcc/m2/www/README
deleted file mode 100644
index e4c3fd21156..00000000000
--- a/gcc/m2/www/README
+++ /dev/null
@@ -1,6 +0,0 @@
-This directory contains the source files for the GNU Modula-2
-homepage. This is done as there is a strong relationship between the
-information on the homepage and the GNU Modula-2 documentation
-gm2/gm2.texi, NEWS file gm2/NEWS). It also allows encourages
-collaborative web authoring. Nevertheless this directory does not
-contain documentation, this is held in texinfo format in gm2/gm2.texi.
diff --git a/gcc/m2/www/gm2-logo.ms b/gcc/m2/www/gm2-logo.ms
deleted file mode 100644
index 215310c4f52..00000000000
--- a/gcc/m2/www/gm2-logo.ms
+++ /dev/null
@@ -1,26 +0,0 @@
-.\"
-.\" Copyright (C) 2006-2021 Free Software Foundation, Inc.
-.\"
-.\" Permission is granted to copy, distribute and/or modify this document
-.\" under the terms of the GNU Free Documentation License, Version 1.3 or
-.\" any later version published by the Free Software Foundation; with the
-.\" Invariant Sections being ``Funding Free Software'', the Front-Cover
-.\" Texts being (a) (see below), and with the Back-Cover Texts being (b)
-.\" (see below). A copy of the license is included in the section entitled
-.\" ``GNU Free Documentation License''.
-.\"
-.\" (a) The FSF's Front-Cover Text is:
-.\"
-.\" A GNU Manual
-.\"
-.\" (b) The FSF's Back-Cover Text is:
-.\"
-.\" You have freedom to copy and modify this GNU Manual, like GNU
-.\" software. Copies published by the Free Software Foundation raise
-.\" funds for GNU development.
-.\"
-.defcolor darkred rgb 0.65f 0.1f 0.2f
-.defcolor darkgreen rgb 0.1f 0.4f 0.2f
-.defcolor darkblue rgb 0.1f 0.2f 0.6f
-.LP
-\s[30]\fB\m[darkred]G\mP\m[darkgreen]\v'.2i'M\mP\m[darkblue]\v'.2i'2\mP\s0\fP
diff --git a/gcc/m2/www/gm2.css b/gcc/m2/www/gm2.css
deleted file mode 100644
index c2f5cd3a367..00000000000
--- a/gcc/m2/www/gm2.css
+++ /dev/null
@@ -1,17 +0,0 @@
-
-BODY {
- margin-top: 0%;
- margin-left: 0%;
- margin-right: 0%;
- margin-bottom: 0%;
- background-color: white;
- color: black;
-}
-
-PRE {
- background-color: lightgrey;
- color: black;
- border: thin;
- border-style: solid;
-}
-
diff --git a/gcc/m2/www/tools/createhtml.py b/gcc/m2/www/tools/createhtml.py
deleted file mode 100644
index 05680990c1a..00000000000
--- a/gcc/m2/www/tools/createhtml.py
+++ /dev/null
@@ -1,100 +0,0 @@
-#!/usr/bin/env python3
-
-# Copyright (C) 2021 Free Software Foundation, Inc.
-#
-# This file is part of GNU Modula-2.
-#
-# GNU Modula-2 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 3, or (at your option)
-# any later version.
-#
-# GNU Modula-2 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 Modula-2; see the file COPYING. If not, write to the
-# Free Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA
-# 02110-1301, USA.
-
-import sys
-import os
-import glob
-import string
-import getopt
-
-outputFile = "-"
-inputFile = "-"
-subDirectory = None
-webRelease = "12"
-
-
-def usage (code):
- print ("usage: createhtml [-d] [-h] [-o outputfile] [-s subdirectory] [-w webrelease]")
- os.sys.exit (code)
-
-
-def collectArgs ():
- global outputFile, subDirectory, webrelease
- try:
- optlist, arglist = getopt.getopt(sys.argv[1:],':dho:s:vw:')
- except getopt.GetoptError:
- usage (1)
- for opt in optlist:
- if opt[0] == '-d':
- debugging = True
- if opt[0] == '-h':
- usage (0)
- if opt[0] == '-v':
- verbose = True
- if opt[0] == '-s':
- subDirectory = opt[1]
- if opt[0] == '-o':
- outputFile = opt[1]
- if opt[0] == '-w':
- webRelease = opt[1]
- return arglist
-
-
-# transformHtml - copy inputfile to outputFile replacing
-# HOME_HREF and 12_HREF with html tags.
-
-def transformHtml ():
- if inputFile == "-":
- usage (1)
- inputFileFd = open (inputFile, "r")
- if outputFile == "-":
- outputFileFd = sys.stdout
- else:
- outputFileFd = open (outputFile, "w")
- text = inputFileFd.read ()
- if subDirectory is None or subDirectory == ".":
- text = text.replace ("HOME_HREF", '<a href="homepage.html">Home</a>')
- text = text.replace ("11_HREF", '<a href="11/homepage.html">GCC-11</a>')
- text = text.replace ("12_HREF", '<a href="12/homepage.html">GCC-12</a>')
- text = text.replace ("__WEBRELEASE__", webRelease)
- text = text.replace ("__RELEASE__", ".")
- else:
- text = text.replace ("HOME_HREF", '<a href="../homepage.html">Home</a>')
- text = text.replace ("11_HREF", '<a href="../11/homepage.html">GCC-11</a>')
- text = text.replace ("12_HREF", '<a href="../12/homepage.html">GCC-12</a>')
- text = text.replace ("__WEBRELEASE__", "../" + webRelease)
- text = text.replace ("__RELEASE__", "../" + subDirectory)
- outputFileFd.write (text)
- outputFileFd.close ()
-
-
-
-# main - collect arguments and call transformHtml.
-
-def main ():
- global inputFile
- arglist = collectArgs ()
- if arglist != []:
- inputFile = arglist[0]
- transformHtml ()
-
-
-main()
diff --git a/gcc/m2/www/tools/texi2tr/html/about.tpl b/gcc/m2/www/tools/texi2tr/html/about.tpl
deleted file mode 100644
index e666368be1c..00000000000
--- a/gcc/m2/www/tools/texi2tr/html/about.tpl
+++ /dev/null
@@ -1,72 +0,0 @@
-<!-- Creator : groff version 1.20.1 -->
-<!-- CreationDate: Fri Jan 14 19:57:50 2011 -->
-<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
-"http://www.w3.org/TR/html4/loose.dtd">
-<html>
-<head>
-<meta name="generator" content="groff -Thtml, see www.gnu.org">
-<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
-<meta name="Content-Style" content="text/css">
-<link rel="stylesheet" type="text/css" href="texi2tr.css" />
-<title>GNU Modula-2</title>
-</head>
-
-<body>
- <!-- site wide top running header menu -->
-
- <ul id="overview">
- <li class="home">
- HOME_HREF
- </li>
- <li class="release">
- 12_HREF
- </li>
-
- <li>
- <a href="news.html" title="News">News</a>
- </li>
- <li>
- <a href="development.html" title="Development">Development</a>
- </li>
- <li>
- <a href="community.html" title="Community">Community</a>
- </li>
- </ul>
-
- <div id="header">
- <h1>
- <span style="display:inline-block; vertical-align:middle">
- <img src="200px-Heckert_GNU_white.png" alt="Heckert_GNU_white.png">
- </span>
- <span style="display:inline-block; vertical-align:middle; font-size: 50px">
- GNU Modula-2
- </span>
- </h1>
-
- <!-- homepage tab menu -->
-
- <div id="tabmenu">
- <ul id="tab">
- <li class="selected"><a href="about.html"><span>About</span></a></li>
- <li><a href="download.html"><span>Download</span></a></li>
- <li><a href="release.html"><span>Latest Release</span></a></li>
- <li><a href="license.html"><span>License</span></a></li>
- <li><a href="platforms.html"><span>Platforms</span></a></li>
- <li><a href="users.html"><span>Users</span></a></li>
- </ul>
- </div>
- </div>
-
-<div id="page">
- <div class="plain">
- <h2>The home of the GNU Modula-2 compiler</h2>
- <p>
- GNU Modula-2 is a <a href="http://gcc.gnu.org/frontends.html">front end</a>
- for the GNU Compiler Collection
- (<a href="http://gcc.gnu.org/">GCC</a>).
- GNU Modula-2 is complete and implements PIM2, PIM3, PIM4 and ISO dialects.
- Also implemented are a complete set of free ISO libraries and PIM libraries.</p>
- </div>
-</div>
-</body>
-</html>
diff --git a/gcc/m2/www/tools/texi2tr/html/community.html b/gcc/m2/www/tools/texi2tr/html/community.html
deleted file mode 100644
index 062f7ec1d77..00000000000
--- a/gcc/m2/www/tools/texi2tr/html/community.html
+++ /dev/null
@@ -1,9 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
-<html>
-<head>
-<title>GNU Modula-2 community</title>
-<meta http-equiv="refresh" content="0;url=community.html"></head>
-<body>
-how to subscribe to the mailing list.
-</body>
-</html>
diff --git a/gcc/m2/www/tools/texi2tr/html/community.tpl b/gcc/m2/www/tools/texi2tr/html/community.tpl
deleted file mode 100644
index 8f86f1ce02c..00000000000
--- a/gcc/m2/www/tools/texi2tr/html/community.tpl
+++ /dev/null
@@ -1,9 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
-<html>
-<head>
-<title>GNU Modula-2 community</title>
-<meta http-equiv="refresh" content="0;url=__WEBRELEASE__/community.html"></head>
-<body>
-how to subscribe to the mailing list.
-</body>
-</html>
diff --git a/gcc/m2/www/tools/texi2tr/html/development.html b/gcc/m2/www/tools/texi2tr/html/development.html
deleted file mode 100644
index ddf0aa90a11..00000000000
--- a/gcc/m2/www/tools/texi2tr/html/development.html
+++ /dev/null
@@ -1,9 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
-<html>
-<head>
-<title>GNU Modula-2 development</title>
-<meta http-equiv="refresh" content="0;url=gm2-27.html"></head>
-<body>
-git access etc.
-</body>
-</html>
diff --git a/gcc/m2/www/tools/texi2tr/html/development.tpl b/gcc/m2/www/tools/texi2tr/html/development.tpl
deleted file mode 100644
index acc390021bf..00000000000
--- a/gcc/m2/www/tools/texi2tr/html/development.tpl
+++ /dev/null
@@ -1,9 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
-<html>
-<head>
-<title>GNU Modula-2 development</title>
-<meta http-equiv="refresh" content="0;url=__WEBRELEASE__/gm2-27.html"></head>
-<body>
-git access etc.
-</body>
-</html>
diff --git a/gcc/m2/www/tools/texi2tr/html/download.tpl b/gcc/m2/www/tools/texi2tr/html/download.tpl
deleted file mode 100644
index e6bff57e6b0..00000000000
--- a/gcc/m2/www/tools/texi2tr/html/download.tpl
+++ /dev/null
@@ -1,107 +0,0 @@
-<!-- Creator : groff version 1.20.1 -->
-<!-- CreationDate: Fri Jan 14 19:57:50 2011 -->
-<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
-"http://www.w3.org/TR/html4/loose.dtd">
-<html>
-<head>
-<meta name="generator" content="groff -Thtml, see www.gnu.org">
-<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
-<meta name="Content-Style" content="text/css">
-<link rel="stylesheet" type="text/css" href="texi2tr.css" />
-<title>GNU Modula-2</title>
-</head>
-
-<body>
- <!-- site wide top running header menu -->
-
- <ul id="overview">
- <li class="home">
- HOME_HREF
- </li>
- <li class="release">
- 12_HREF
- </li>
-
- <li>
- <a href="news.html" title="News">News</a>
- </li>
- <li>
- <a href="development.html" title="Development">Development</a>
- </li>
- <li>
- <a href="community.html" title="Community">Community</a>
- </li>
- </ul>
-
- <div id="header">
- <h1>
- <span style="display:inline-block; vertical-align:middle">
- <img src="200px-Heckert_GNU_white.png" alt="Heckert_GNU_white.png">
- </span>
- <span style="display:inline-block; vertical-align:middle; font-size: 50px">
- GNU Modula-2
- </span>
- </h1>
-
- <!-- homepage tab menu -->
-
- <div id="tabmenu">
- <ul id="tab">
- <li><a href="about.html"><span>About</span></a></li>
- <li class="selected"><a href="download.html"><span>Download</span></a></li>
- <li><a href="release.html"><span>Latest Release</span></a></li>
- <li><a href="license.html"><span>License</span></a></li>
- <li><a href="platforms.html"><span>Platforms</span></a></li>
- <li><a href="users.html"><span>Users</span></a></li>
- </ul>
- </div>
- </div>
-
-<div id="page">
- <div class="plain">
- <h2>The home of the GNU Modula-2 compiler</h2>
- <p>GNU Modula-2 is about to go into the GCC tree for the
- development branch (GCC-12). In time it will be back ported to
- GCC-11. At the time of writing the gcc-11 graft is the stable release.
- <div>
- <span style="display:inline-block; vertical-align:middle; margin-left: 3%">
- <img src="release.png" alt="users"</img></span>
- <span style="display:inline-block; vertical-align:middle">
- Stable release of gm2 (branch gm2-11)
-<pre>git clone http://floppsie.comp.glam.ac.uk/gm2 gm2-floppsie
-git checkout gm2-11
-</pre>
- <p>Documentation for GNU Modula-2 on 11_HREF.</p>
- </span>
- </div>
- <br>
- <div>
- <span style="display:inline-block; vertical-align:middle; margin-left: 3%">
- <img src="develop.png" alt="installing"</img></span>
- <span style="display:inline-block; vertical-align:middle">
- Current development branch (gm2-master) (for gcc-12)
-<pre>git clone http://floppsie.comp.glam.ac.uk/gm2 gm2-floppsie
-git checkout gm2-master
-</pre>
- <p>This is in the process of migrating into the GCC
- tree.</p>
- <p>Documentation for GNU Modula-2 on 12_HREF.</p>
- </span>
- </span>
- </div>
- <br>
- <div>
- <span style="display:inline-block; vertical-align:middle; margin-left: 3%">
- <img src="snapshot.png" alt="library"</img></span>
- <span style="display:inline-block; vertical-align:middle">
- Other
- <a href="http://floppsie.comp.glam.ac.uk/download/c/">snapshots</a>.
- </span>
- </div>
- </p>
- <p>Binaries can be found under
- the <a href="platforms.html">Platforms</a> tab.</p>
- </div>
-</div>
-</body>
-</html>
diff --git a/gcc/m2/www/tools/texi2tr/html/footer.ht b/gcc/m2/www/tools/texi2tr/html/footer.ht
deleted file mode 100644
index 9943ff0f851..00000000000
--- a/gcc/m2/www/tools/texi2tr/html/footer.ht
+++ /dev/null
@@ -1,3 +0,0 @@
-</div>
-</body>
-</html>
diff --git a/gcc/m2/www/tools/texi2tr/html/header.ht b/gcc/m2/www/tools/texi2tr/html/header.ht
deleted file mode 100644
index 119316b098c..00000000000
--- a/gcc/m2/www/tools/texi2tr/html/header.ht
+++ /dev/null
@@ -1,11 +0,0 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
-"http://www.w3.org/TR/html4/loose.dtd">
-<html>
-<head>
-<meta name="generator" content="automatically created by texi2tr, see www.nongnu.org/gm2">
-<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
-<meta name="Content-Style" content="text/css">
-<link rel="stylesheet" type="text/css" href="texi2tr.css" />
-</head>
-
-<body>
diff --git a/gcc/m2/www/tools/texi2tr/html/heading.ht b/gcc/m2/www/tools/texi2tr/html/heading.ht
deleted file mode 100644
index aa6b25594f9..00000000000
--- a/gcc/m2/www/tools/texi2tr/html/heading.ht
+++ /dev/null
@@ -1,2 +0,0 @@
- <div id="heading">
- <h1>The GNU Modula-2 front end to GCC</h1>
diff --git a/gcc/m2/www/tools/texi2tr/html/homepage.tpl b/gcc/m2/www/tools/texi2tr/html/homepage.tpl
deleted file mode 100644
index ac48793f8ec..00000000000
--- a/gcc/m2/www/tools/texi2tr/html/homepage.tpl
+++ /dev/null
@@ -1,66 +0,0 @@
-<!-- Creator : groff version 1.20.1 -->
-<!-- CreationDate: Fri Jan 14 19:57:50 2011 -->
-<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
-"http://www.w3.org/TR/html4/loose.dtd">
-<html>
-<head>
-<meta name="generator" content="groff -Thtml, see www.gnu.org">
-<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
-<meta name="Content-Style" content="text/css">
-<link rel="stylesheet" type="text/css" href="texi2tr.css" />
-<title>GNU Modula-2</title>
-</head>
-
-<body>
- <!-- site wide top running header menu -->
-
- <ul id="overview">
- <li class="home">
- HOME_HREF
- </li>
- <li class="release">
- 12_HREF
- </li>
-
- <li>
- <a href="news.html">News</a>
- </li>
- <li>
- <a href="development.html">Development</a>
- </li>
- <li>
- <a href="community.html">Community</a>
- </li>
- </ul>
-
- <div id="header">
- <h1>
- <span style="display:inline-block; vertical-align:middle">
- <img src="200px-Heckert_GNU_white.png" alt="Heckert_GNU_white.png">
- </span>
- <span style="display:inline-block; vertical-align:middle; font-size: 50px">
- GNU Modula-2
- </span>
- </h1>
-
- <!-- homepage tab menu -->
-
- <div id="tabmenu">
- <ul id="tab">
- <li><a href="about.html"><span>About</span></a></li>
- <li><a href="download.html"><span>Download</span></a></li>
- <li><a href="release.html"><span>Latest Release</span></a></li>
- <li><a href="license.html"><span>License</span></a></li>
- <li><a href="platforms.html"><span>Platforms</span></a></li>
- <li><a href="users.html"><span>Users</span></a></li>
- </ul>
- </div>
- </div>
-
-<div id="page">
- <div class="plain">
- <h2>The home of the GNU Modula-2 compiler</h2>
- </div>
-</div>
-</body>
-</html>
diff --git a/gcc/m2/www/tools/texi2tr/html/index.html b/gcc/m2/www/tools/texi2tr/html/index.html
deleted file mode 100644
index 9039e352350..00000000000
--- a/gcc/m2/www/tools/texi2tr/html/index.html
+++ /dev/null
@@ -1,9 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
-<html>
-<head>
-<title>GNU Modula-2</title>
-<meta http-equiv="refresh" content="0;url=homepage.html"></HEAD>
-<body>
-The home of the GNU Modula-2 compiler
-</body>
-</html>
diff --git a/gcc/m2/www/tools/texi2tr/html/license.tpl b/gcc/m2/www/tools/texi2tr/html/license.tpl
deleted file mode 100644
index f50dbe6fd9a..00000000000
--- a/gcc/m2/www/tools/texi2tr/html/license.tpl
+++ /dev/null
@@ -1,70 +0,0 @@
-<!-- Creator : groff version 1.20.1 -->
-<!-- CreationDate: Fri Jan 14 19:57:50 2011 -->
-<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
-"http://www.w3.org/TR/html4/loose.dtd">
-<html>
-<head>
-<meta name="generator" content="groff -Thtml, see www.gnu.org">
-<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
-<meta name="Content-Style" content="text/css">
-<link rel="stylesheet" type="text/css" href="texi2tr.css" />
-<title>GNU Modula-2</title>
-</head>
-
-<body>
- <!-- site wide top running header menu -->
-
- <ul id="overview">
- <li class="home">
- HOME_HREF
- </li>
- <li class="release">
- 12_HREF
- </li>
-
- <li>
- <a href="news.html" title="News">News</a>
- </li>
- <li>
- <a href="development.html" title="Development">Development</a>
- </li>
- <li>
- <a href="community.html" title="Community">Community</a>
- </li>
- </ul>
-
- <div id="header">
- <h1>
- <span style="display:inline-block; vertical-align:middle">
- <img src="200px-Heckert_GNU_white.png" alt="Heckert_GNU_white.png">
- </span>
- <span style="display:inline-block; vertical-align:middle; font-size: 50px">
- GNU Modula-2
- </span>
- </h1>
-
- <!-- homepage tab menu -->
-
- <div id="tabmenu">
- <ul id="tab">
- <li><a href="about.html"><span>About</span></a></li>
- <li><a href="download.html"><span>Download</span></a></li>
- <li><a href="release.html"><span>Latest Release</span></a></li>
- <li class="selected"><a href="license.html"><span>License</span></a></li>
- <li><a href="platforms.html"><span>Platforms</span></a></li>
- <li><a href="users.html"><span>Users</span></a></li>
- </ul>
- </div>
- </div>
-
-<div id="page">
- <div class="plain">
- <h2>The home of the GNU Modula-2 compiler</h2>
- <p>The compiler is held under the GNU Public Licence v3.</p>
- <p>The ISO and PIM libraries are under the GPL v3.1 with GCC runtime extensions. Copies of the
- licences can be found on the
- <a href="http://www.gnu.org/licenses">GNU</a> web site.</p>
- </div>
-</div>
-</body>
-</html>
diff --git a/gcc/m2/www/tools/texi2tr/html/news.html b/gcc/m2/www/tools/texi2tr/html/news.html
deleted file mode 100644
index 14caa4bf6ce..00000000000
--- a/gcc/m2/www/tools/texi2tr/html/news.html
+++ /dev/null
@@ -1,9 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
-<html>
-<head>
-<title>GNU Modula-2 news</title>
-<meta http-equiv="refresh" content="0;url=gm2.html"></head>
-<body>
-no news is good news! The news section is still being created.
-</body>
-</html>
diff --git a/gcc/m2/www/tools/texi2tr/html/news.tpl b/gcc/m2/www/tools/texi2tr/html/news.tpl
deleted file mode 100644
index 4ecd4cde8b7..00000000000
--- a/gcc/m2/www/tools/texi2tr/html/news.tpl
+++ /dev/null
@@ -1,9 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
-<html>
-<head>
-<title>GNU Modula-2 news</title>
-<meta http-equiv="refresh" content="0;url=__WEBRELEASE__/gm2.html"></head>
-<body>
-no news is good news! The news section is still being created.
-</body>
-</html>
diff --git a/gcc/m2/www/tools/texi2tr/html/platforms.tpl b/gcc/m2/www/tools/texi2tr/html/platforms.tpl
deleted file mode 100644
index eca62a599d3..00000000000
--- a/gcc/m2/www/tools/texi2tr/html/platforms.tpl
+++ /dev/null
@@ -1,104 +0,0 @@
-<!-- Creator : groff version 1.20.1 -->
-<!-- CreationDate: Fri Jan 14 19:57:50 2011 -->
-<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
-"http://www.w3.org/TR/html4/loose.dtd">
-<html>
-<head>
-<meta name="generator" content="groff -Thtml, see www.gnu.org">
-<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
-<meta name="Content-Style" content="text/css">
-<link rel="stylesheet" type="text/css" href="texi2tr.css" />
-<title>GNU Modula-2</title>
-</head>
-
-<body>
- <!-- site wide top running header menu -->
-
- <ul id="overview">
- <li class="home">
- HOME_HREF
- </li>
- <li class="release">
- 12_HREF
- </li>
-
- <li>
- <a href="news.html" title="News">News</a>
- </li>
- <li>
- <a href="development.html" title="Development">Development</a>
- </li>
- <li>
- <a href="community.html" title="Community">Community</a>
- </li>
- </ul>
-
- <div id="header">
- <h1>
- <span style="display:inline-block; vertical-align:middle">
- <img src="200px-Heckert_GNU_white.png" alt="Heckert_GNU_white.png">
- </span>
- <span style="display:inline-block; vertical-align:middle; font-size: 50px">
- GNU Modula-2
- </span>
- </h1>
-
- <!-- homepage tab menu -->
-
- <div id="tabmenu">
- <ul id="tab">
- <li><a href="about.html"><span>About</span></a></li>
- <li><a href="download.html"><span>Download</span></a></li>
- <li><a href="release.html"><span>Latest Release</span></a></li>
- <li><a href="license.html"><span>License</span></a></li>
- <li class="selected"><a href="platforms.html"><span>Platforms</span></a></li>
- <li><a href="users.html"><span>Users</span></a></li>
- </ul>
- </div>
- </div>
-
-<div id="page">
- <div class="plain">
- <h2>The home of the GNU Modula-2 compiler</h2>
- <p>GNU Modula-2 is about to go into the GCC tree and therefore it is likely
- it can be installed via your distribution repository. </p>
- <p>If your distribution does not include gm2 then you can build it
- from source alternatively for a few distributions there are some
- pre-built binararies.</p>
-
- <table width="100%">
- <tr valign="top">
- <td style="width:40%;text-align:top;">
- <div>
- <p>
- <span style="display:inline-block; vertical-align:middle; margin-left: 3%">
- <img src="debian-swirl48x48.png" alt="debian"</img></span>
- <span style="display:inline-block; vertical-align:middle">
- <a href="debian.html">Debian
- packages</a>.
- </span></p>
- </div>
- <div>
- <p><span style="display:inline-block; vertical-align:middle; margin-left: 3%">
- <img src="terminal.png" alt="./configure etc"</img></span>
- <span style="display:inline-block; vertical-align:middle">
- <a href="building.html">Building
- on GNU/Linux</a>.
- </span></p>
- </div>
- </td>
- <td style="width:40%;text-align:top;">
- <div>
- </div>
- <div>
- </div>
- <div>
- </div>
- </td>
- </tr>
- </table>
- </p>
- </div>
-</div>
-</body>
-</html>
diff --git a/gcc/m2/www/tools/texi2tr/html/release.tpl b/gcc/m2/www/tools/texi2tr/html/release.tpl
deleted file mode 100644
index 28fd60da734..00000000000
--- a/gcc/m2/www/tools/texi2tr/html/release.tpl
+++ /dev/null
@@ -1,75 +0,0 @@
-<!-- Creator : groff version 1.20.1 -->
-<!-- CreationDate: Fri Jan 14 19:57:50 2011 -->
-<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
-"http://www.w3.org/TR/html4/loose.dtd">
-<html>
-<head>
-<meta name="generator" content="groff -Thtml, see www.gnu.org">
-<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
-<meta name="Content-Style" content="text/css">
-<link rel="stylesheet" type="text/css" href="texi2tr.css" />
-<title>GNU Modula-2</title>
-</head>
-
-<body>
- <!-- site wide top running header menu -->
-
- <ul id="overview">
- <li class="home">
- HOME_HREF
- </li>
- <li class="release">
- 12_HREF
- </li>
-
- <li>
- <a href="news.html" title="News">News</a>
- </li>
- <li>
- <a href="development.html" title="Development">Development</a>
- </li>
- <li>
- <a href="community.html" title="Community">Community</a>
- </li>
- </ul>
-
- <div id="header">
- <div id="header-wrap">
- <h1>
- <span style="display:inline-block; vertical-align:middle">
- <img src="200px-Heckert_GNU_white.png" alt="Heckert_GNU_white.png">
- </span>
- <span style="display:inline-block; vertical-align:middle; font-size: 50px">
- GNU Modula-2
- </span>
- </h1>
- </div>
-
- <!-- homepage tab menu -->
-
- <div id="tabmenu">
- <ul id="tab">
- <li><a href="about.html"><span>About</span></a></li>
- <li><a href="download.html"><span>Download</span></a></li>
- <li class="selected"><a href="release.html"><span>Latest Release</span></a></li>
- <li><a href="license.html"><span>License</span></a></li>
- <li><a href="platforms.html"><span>Platforms</span></a></li>
- <li><a href="users.html"><span>Users</span></a></li>
- </ul>
- </div>
- </div>
-
-<div id="page">
- <div class="plain">
- <h2>The home of the GNU Modula-2 compiler</h2>
- <p>GNU Modula-2 is about to go into the GCC tree (for GCC-12 onwards).</p>
- <p>In time the front end also will be back ported to GCC-11. Releases
- prior to GCC-11 are still available from the gm2 git reprository
- and tarballs on floppsie.comp.glam.ac.uk (see the
- <a href="download.html">download</a> tab).</p>
- <p>Documentation for GNU Modula-2 on 12_HREF.</p>
- <p>Documentation for GNU Modula-2 on 11_HREF.</p>
- </div>
-</div>
-</body>
-</html>
diff --git a/gcc/m2/www/tools/texi2tr/html/texi2tr.css b/gcc/m2/www/tools/texi2tr/html/texi2tr.css
deleted file mode 100644
index b110668b41d..00000000000
--- a/gcc/m2/www/tools/texi2tr/html/texi2tr.css
+++ /dev/null
@@ -1,271 +0,0 @@
-/*
- * Copyright (C) 2011-2021
- * Free Software Foundation, Inc.
- *
- * Gaius Mulley <gaius@gnu.org> constructed this file.
- */
-
-/*
-This file is part of GNU Modula-2.
-
-GNU Modula-2 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 3, or (at your option)
-any later version.
-
-GNU Modula-2 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 Modula-2; see the file COPYING. If not, write to the
-Free Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301, USA.
-*/
-
-h2, h3, h4, h5, h6 {
- color: #3f3f3f; /* grey headings */
-}
-
-h1 {
- font-size: 1.4em;
-}
-
-h2 {
- font-size: 1.2em;
-}
-
-h3 {
- font-size: 1.0em;
-}
-
-html {
- height: 100%;
-}
-
-body {
- /* set the defaults for the page, ensure the body extends over all of the html area */
- margin: 0px;
- padding: 0px;
- font-family: sans-serif;
- background: white;
- color: black;
- height: 100%;
-}
-
-div {
- margin: 0;
-}
-
-#page {
- margin: 0px;
- padding: 0px;
-}
-
-#page ul {
- margin: 0;
-}
-
-div.body {
- clear: both;
-}
-
-#overview {
- list-style: none;
- background: #2e3436 0 100% repeat-x;
- text-align: right;
- padding: 0 1ex;
- margin: 0;
- font-size: 70%;
-}
-
-#overview li {
- display: inline;
- background: 0 0 no-repeat;
- padding-top: 10px;
- padding-bottom: 8px;
- margin-left: 0px;
- margin-top: 0px;
-}
-
-#overview li a {
- font-weight: bold;
- color: #9f9f9f;
- margin: 0 2ex;
- text-decoration: none;
- line-height: 30px;
-}
-
-#overview li a:hover {
- color: white;
- background: transparent;
-}
-
-#overview .home {
- float: left;
- padding-top: 0;
- padding-bottom: 0;
-}
-
-#overview .home a {
- float: left;
- margin-left: 0;
- padding-left: 27px;
-}
-
-#overview .release {
- float: left;
- padding-top: 0;
- padding-bottom: 0;
- color: white;
- font-weight: bold;
-}
-
-#header {
- background: #729fcf;
- float: left;
- width: 100%;
- font-size: 75%;
-}
-
-#header h1 {
- margin: 0;
- height: 250px;
- margin-left: 85px;
- padding-top: 25px;
- font-size: 200%;
- color: #eeeeec;
-}
-
-#heading {
- background: #729fcf;
- float: left;
- width: 100%;
- font-size: 75%;
-}
-
-#heading h1 {
- margin: 0;
- height: 100px;
- margin-left: 85px;
- padding-top: 55px;
- font-size: 200%;
- color: #eeeeec;
-}
-
-#tabmenu {
- width: 100%;
- float: left;
- margin: 0;
- padding: 0;
-}
-
-#tab {
- float: right;
- list-style: none;
- margin: 0;
- margin-right: 3ex;
-}
-
-#tab li {
- float: left;
- margin: 0;
- margin-left: 0.2ex;
- font-size: 2ex;
-}
-
-#tab li a:hover {
- color: #111111;
-}
-
-#tab li a {
- float: left;
- text-decoration: none;
- color: #555555;
- background: url(menu-left-tab.png) no-repeat;
- padding: 7px 0 7px 7px;
- border-bottom: 2px solid #cccccc;
-}
-
-#tab li span {
- background: url(menu-right-tab.png) 100% 0 no-repeat;
- padding: 7px 28px 7px 19px;
-}
-
-#tab li.selected a {
- color: #2e3436;
- background: url(menu-selected-left-tab.png) no-repeat;
- border-bottom: none;
- padding-top: 8px;
- padding-bottom: 8px;
-}
-
-#tab li.selected a span {
- background: url(menu-selected-right-tab.png) 100% 0 no-repeat;
- padding-top: 8px;
- padding-bottom: 8px;
-}
-
-div.body {
- background-color: transparent;
- border: none;
- padding: 1em;
-}
-
-a {
- color: #3465a4;
-}
-
-div.navigation {
- margin: 0 29ex 0 2ex;
-}
-
-div.footnote {
- border: thin;
- border-style: solid;
- margin-left: 7%;
- margin-right: 5%;
-}
-
-ul.footnote {
- list-style: none;
- margin-left: 50px;
- background: url(note.png) no-repeat;
-}
-
-li.footnote {
- margin-left: 60px;
- background: transparent;
-}
-
-pre {
- font-size: 95%;
- border: thin;
- border-style: solid;
-}
-
-h1.title {
- font-size: 1.72em;
- margin: 0;
- padding: 0;
- color: #3f3f3f;
-}
-
-h1.title a {
- color: inherit;
- text-decoration: none;
-}
-
-div.plain {
- margin-left: 7%;
- width: 90%;
-}
-
-div.plain p {
- padding-top: 1em;
-}
-
-div.itemize p {
- padding-top: 0em;
-}
diff --git a/gcc/m2/www/tools/texi2tr/html/title.ht b/gcc/m2/www/tools/texi2tr/html/title.ht
deleted file mode 100644
index 8d62fcc747f..00000000000
--- a/gcc/m2/www/tools/texi2tr/html/title.ht
+++ /dev/null
@@ -1,20 +0,0 @@
-
- <!-- site wide top running header menu -->
- <ul id="overview">
- <li class="home">
- HOME_HREF
- </li>
- <li class="release">
- 12_HREF
- </li>
-
- <li>
- <a href="news.html">News</a>
- </li>
- <li>
- <a href="development.html">Development</a>
- </li>
- <li>
- <a href="community.html">Community</a>
- </li>
- </ul>
diff --git a/gcc/m2/www/tools/texi2tr/html/users.tpl b/gcc/m2/www/tools/texi2tr/html/users.tpl
deleted file mode 100644
index 0ef8b181193..00000000000
--- a/gcc/m2/www/tools/texi2tr/html/users.tpl
+++ /dev/null
@@ -1,90 +0,0 @@
-<!-- Creator : groff version 1.20.1 -->
-<!-- CreationDate: Fri Jan 14 19:57:50 2011 -->
-<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
-"http://www.w3.org/TR/html4/loose.dtd">
-<html>
-<head>
-<meta name="generator" content="groff -Thtml, see www.gnu.org">
-<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
-<meta name="Content-Style" content="text/css">
-<link rel="stylesheet" type="text/css" href="texi2tr.css" />
-<title>GNU Modula-2</title>
-</head>
-
-<body>
- <!-- site wide top running header menu -->
-
- <ul id="overview">
- <li class="home">
- HOME_HREF
- </li>
- <li class="release">
- 11_HREF
- </li>
-
- <li>
- <a href="news.html" title="News">News</a>
- </li>
- <li>
- <a href="development.html" title="Development">Development</a>
- </li>
- <li>
- <a href="community.html" title="Community">Community</a>
- </li>
- </ul>
-
- <div id="header">
- <h1>
- <span style="display:inline-block; vertical-align:middle">
- <img src="200px-Heckert_GNU_white.png" alt="Heckert_GNU_white.png">
- </span>
- <span style="display:inline-block; vertical-align:middle; font-size: 50px">
- GNU Modula-2
- </span>
- </h1>
-
- <!-- homepage tab menu -->
-
- <div id="tabmenu">
- <ul id="tab">
- <li><a href="about.html"><span>About</span></a></li>
- <li><a href="download.html"><span>Download</span></a></li>
- <li><a href="release.html"><span>Latest Release</span></a></li>
- <li><a href="license.html"><span>License</span></a></li>
- <li><a href="platforms.html"><span>Platforms</span></a></li>
- <li class="selected"><a href="users.html"><span>Users</span></a></li>
- </ul>
- </div>
- </div>
-
- <!-- users tab -->
-<div id="page">
- <div class="plain">
- <h2>The home of the GNU Modula-2 compiler</h2>
- <div>
- <p><span style="display:inline-block; vertical-align:middle; margin-left: 3%">
- <img src="users.png" alt="users"</img></span>
- <span style="display:inline-block; vertical-align:middle">
- <a href="__RELEASE__/using.html">User guide</a>.
- </span></p>
- </div>
- <div>
- <p><span style="display:inline-block; vertical-align:middle; margin-left: 3%">
- <img src="install.png" alt="installing"</img></span>
- <span style="display:inline-block; vertical-align:middle">
- <a href="__WEBRELEASE__/obtaining.html">
- Install instructions</a>.
- </span></p>
- </div>
- <div>
- <p><span style="display:inline-block; vertical-align:middle; margin-left: 3%">
- <img src="library.png" alt="library"</img></span>
- <span style="display:inline-block; vertical-align:middle">
- <a href="__RELEASE__/libraries.html">
- Library documentation</a>.
- </span></p>
- </div>
- </div>
-</div>
-</body>
-</html>
diff --git a/gcc/m2/www/tools/texi2tr/png/200px-Heckert_GNU_white.png b/gcc/m2/www/tools/texi2tr/png/200px-Heckert_GNU_white.png
deleted file mode 100644
index e69de29bb2d..00000000000
diff --git a/gcc/m2/www/tools/texi2tr/png/debian-swirl48x48.png b/gcc/m2/www/tools/texi2tr/png/debian-swirl48x48.png
deleted file mode 100644
index e69de29bb2d..00000000000
diff --git a/gcc/m2/www/tools/texi2tr/png/develop.png b/gcc/m2/www/tools/texi2tr/png/develop.png
deleted file mode 100644
index e69de29bb2d..00000000000
diff --git a/gcc/m2/www/tools/texi2tr/png/install.png b/gcc/m2/www/tools/texi2tr/png/install.png
deleted file mode 100644
index e69de29bb2d..00000000000
diff --git a/gcc/m2/www/tools/texi2tr/png/library.png b/gcc/m2/www/tools/texi2tr/png/library.png
deleted file mode 100644
index e69de29bb2d..00000000000
diff --git a/gcc/m2/www/tools/texi2tr/png/menu-left-tab.png b/gcc/m2/www/tools/texi2tr/png/menu-left-tab.png
deleted file mode 100644
index e69de29bb2d..00000000000
diff --git a/gcc/m2/www/tools/texi2tr/png/menu-right-tab.png b/gcc/m2/www/tools/texi2tr/png/menu-right-tab.png
deleted file mode 100644
index e69de29bb2d..00000000000
diff --git a/gcc/m2/www/tools/texi2tr/png/menu-selected-left-tab.png b/gcc/m2/www/tools/texi2tr/png/menu-selected-left-tab.png
deleted file mode 100644
index e69de29bb2d..00000000000
diff --git a/gcc/m2/www/tools/texi2tr/png/menu-selected-right-tab.png b/gcc/m2/www/tools/texi2tr/png/menu-selected-right-tab.png
deleted file mode 100644
index e69de29bb2d..00000000000
diff --git a/gcc/m2/www/tools/texi2tr/png/next.png b/gcc/m2/www/tools/texi2tr/png/next.png
deleted file mode 100644
index e69de29bb2d..00000000000
diff --git a/gcc/m2/www/tools/texi2tr/png/note.png b/gcc/m2/www/tools/texi2tr/png/note.png
deleted file mode 100644
index e69de29bb2d..00000000000
diff --git a/gcc/m2/www/tools/texi2tr/png/prev.png b/gcc/m2/www/tools/texi2tr/png/prev.png
deleted file mode 100644
index e69de29bb2d..00000000000
diff --git a/gcc/m2/www/tools/texi2tr/png/release.png b/gcc/m2/www/tools/texi2tr/png/release.png
deleted file mode 100644
index e69de29bb2d..00000000000
diff --git a/gcc/m2/www/tools/texi2tr/png/snapshot.png b/gcc/m2/www/tools/texi2tr/png/snapshot.png
deleted file mode 100644
index e69de29bb2d..00000000000
diff --git a/gcc/m2/www/tools/texi2tr/png/terminal.png b/gcc/m2/www/tools/texi2tr/png/terminal.png
deleted file mode 100644
index e69de29bb2d..00000000000
diff --git a/gcc/m2/www/tools/texi2tr/png/users.png b/gcc/m2/www/tools/texi2tr/png/users.png
deleted file mode 100644
index e69de29bb2d..00000000000
diff --git a/gcc/m2/www/tools/texi2tr/src/config.py b/gcc/m2/www/tools/texi2tr/src/config.py
deleted file mode 100644
index 3270fd9273d..00000000000
--- a/gcc/m2/www/tools/texi2tr/src/config.py
+++ /dev/null
@@ -1,38 +0,0 @@
-#!/usr/bin/python3
-
-# Copyright (C) 2011-2021 Free Software Foundation, Inc.
-#
-# This file is part of GNU Modula-2.
-#
-# GNU Modula-2 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 3, or (at your option)
-# any later version.
-#
-# GNU Modula-2 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 Modula-2; see the file COPYING. If not, write to the
-# Free Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA
-# 02110-1301, USA.
-
-#
-# ignoreh1Titlepage - should we ignore any <h1> from being emitted in
-# the title page? This might be the case if the
-# users wishes to have a boiler plate title
-# <h1> in the template file title.ht
-#
-ignoreh1Titlepage = True
-#
-#
-# multipleFragments - should we produce multiple fragments, one for each node.
-# Normally this is True - and False is only used for debugging.
-#
-multipleFragments = True
-#
-#
-#
-debugFragments = False
diff --git a/gcc/m2/www/tools/texi2tr/src/navigation.py b/gcc/m2/www/tools/texi2tr/src/navigation.py
deleted file mode 100644
index 9531bb3d45a..00000000000
--- a/gcc/m2/www/tools/texi2tr/src/navigation.py
+++ /dev/null
@@ -1,271 +0,0 @@
-#!/usr/bin/python3
-
-# Copyright (C) 2011-2021 Free Software Foundation, Inc.
-#
-# This file is part of GNU Modula-2.
-#
-# GNU Modula-2 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 3, or (at your option)
-# any later version.
-#
-# GNU Modula-2 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 Modula-2; see the file COPYING. If not, write to the
-# Free Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA
-# 02110-1301, USA.
-
-import sys
-import os
-import string
-
-anchors = {}
-nodes = {}
-
-maxNoOfShortLabels = 10 # only allow this many different short tabs
-maxLabelLength = 90 # total character length of all menus
-
-class nodeInfo:
- #
- # record the texinfo nodes
- #
- def __init__ (self, me, n, p, u):
- self.name = me
- self.__next__ = n
- self.prev = p
- self.up = u
- def selectTab (self, root, selected):
- if (root != None) and (root._isShort()):
- for i in root.list:
- if (i[0] == self.name) or (selected == ""):
- return i[0]
- return selected
- def generateMenu (self, html, root, selected):
- if self.name == "Top":
- return selected
- html.emitMenuTitle()
- html.emitNodeHeading()
- self.emitPrevNext(html)
- selected = self.selectTab(root, selected)
- root.emitTab(html, selected)
- html.raw('</div>\n')
- return selected
- def requiresNewFile(self):
- return self.name != "Top"
- def _isShort (self):
- return False
- def _genShort (self, html, active):
- pass
- def emitTab (self, root, selected):
- pass
- def isNode (self):
- return True
- def getName (self):
- return self.name
- def emitPrevNext (self, html):
- global anchors
-
- html.raw("""
- <div id="navigation">
- <table width="100%" cellpadding="2" cellspacing="2">
- <tr valign="middle">
-""")
- if (self.prev != "") and (self.prev != "Top") and self.prev in anchors:
- html.raw('''
- <td><a accesskey="p" href="''')
- html.raw(anchors[self.prev])
- html.raw('"><img width="48" alt="Prev" src="prev.png" border="0" height="48"></img></a></td>')
- if (self.__next__ != "") and (self.__next__ != "Top") and self.__next__ in anchors:
- html.raw('''
- <td align="right"><a accesskey="n" href="''')
- html.raw(anchors[self.__next__])
- html.raw('"><img width="48" alt="Next" src="next.png" border="0" height="48"></img></a></td>')
- html.raw('</tr></table></div>')
-
-
-#
-# addNode - adds a node to the dictionary.
-#
-
-def addNode (html, line):
- global nodes
-
- w = line.split(',')
- if len(w)>4:
- w = w[:4]
- while len(w)<4:
- w += [""]
- me, n, p, u = w
-
- me = me.rstrip().lstrip()
- n = n.rstrip().lstrip()
- p = p.rstrip().lstrip()
- u = u.rstrip().lstrip()
-
- nodes[me] = nodeInfo(me, n, p, u)
- anchor(html, me)
- return nodes[me]
-
-class menuInfo:
- #
- # records the data contained in the menu texinfo sections
- #
- def __init__ (self, initial):
- self.list = []
- self.short = initial
- def isNode (self):
- return False
- #
- # parseMenu - parse the content and populate the data structures.
- #
- def parseMenu (self, content):
- for line in content.split('\n'):
- l = line.lstrip().rstrip()
- if (len(l)>1) and (l[0] == '*'):
- l = l[1:]
- l = l.lstrip()
- i = l.find('::')
- if (i>0) and (i+2<len(l)):
- m = l[i+2:].lstrip()
- self.list += [[l[:i], m]]
- #
- # debugMenu - dump the data structures
- #
- def debugMenu (self):
- for m in self.list:
- print((m[0], m[1]))
- #
- # generateMenu - issues the menu
- #
- def generateMenu (self, html, root, selected):
- if self != root:
- self._genLong(html)
- return selected
- #
- # requiresNewFile - returns False for a menu
- #
- def requiresNewFile(self):
- return False
- #
- #
- #
- def emitTab (self, html, selected):
- if self._isShort():
- self._genShort(html, selected)
- #
- # isShort - return True if the menu can be encoded in a short form.
- #
- def _isShort (self):
- global maxNoOfShortLabels, maxLabelLength
-
- if (len(self.list)>maxNoOfShortLabels) or (not self.short):
- return False
- t = 0
- for m in self.list:
- t += len(m[0])
- return t<maxLabelLength
- #
- # genShort - generate a list of tabs for the short menu
- #
- def _genShort (self, html, active):
- html.raw('<div id="tabmenu">\n')
- html.raw('<ul id="tab">\n')
- for m in self.list:
- if m[0] in anchors:
- active = litab(html, anchors[m[0]], m[0], active)
- else:
- if (len(m[1]) > 1) and (m[1][-1] == '.') and (m[1][:-1] in anchors):
- active = litab(html, anchors[m[1][:-1]], m[0], active)
- elif m[1] in anchors:
- active = litab(html, anchors[m[1]], m[0], active)
- else:
- print(("cannot find anchor for section", m[0], "or", m[1]))
- html.raw('\n</ul>\n')
- html.raw('</div>\n')
- #
- # genLong - generate a unordered list for the short menu
- #
- def _genLong (self, html):
- html.raw('\n<ul>\n')
- for m in self.list:
- if m[0] in anchors:
- liurl(html, anchors[m[0]], m[1])
- else:
- if (len(m[1]) > 1) and (m[1][-1] == '.') and (m[1][:-1] in anchors):
- liurl(html, anchors[m[1][:-1]], m[1])
- elif m[1] in anchors:
- liurl(html, anchors[m[1]], m[1])
- else:
- print(("cannot find anchor for section", m[0], "or", m[1]))
- html.raw('</ul>\n')
-
-#
-# anchor - adds an anchor to the output and enters it into our dictionary
-#
-
-def anchor (html, label):
- global anchors
-
- if label in anchors:
- print(("node", label, "already exists"))
- anchors[label] = html.getNodeLink()
- s = '<a name="' + html.getNodeAnchor() + '"></a>\n'
- html.raw(s)
- html.nextAnchor()
-
-#
-# liurl - issue a <li> url </li> as long as text is not empty.
-#
-
-def liurl (html, link, text):
- if text != "":
- html.raw('<li>\n')
- url(html, link, text)
- html.raw('</li>\n')
-
-#
-# url - issue a link providing that text is non nul.
-#
-
-def url (html, link, text):
- if text != "":
- html.raw('<a href="')
- html.raw(link)
- html.raw('">')
- html.puts(text)
- html.raw('</a>')
-
-#
-# litab - issue a tab link providing that text is non nul.
-#
-
-def litab (html, link, text, selected):
- if text != "":
- if (selected == ""):
- html.raw('<li class="selected">')
- selected = text
- elif selected == text:
- html.raw('<li class="selected">')
- else:
- html.raw('<li>')
- html.raw('<a href="')
- html.raw(link)
- html.raw('"><span>')
- html.puts(text)
- html.raw('</span></a></li>\n')
- return selected
-
-#
-# getRoot - returns the root menu
-#
-
-def getRoot (frags):
- for m in frags:
- if (m[0] == 'menu') or (m[0] == 'node'):
- if (not m[1].isNode()) and (m[1]._isShort()):
- return m[1]
- return None
diff --git a/gcc/m2/www/tools/texi2tr/src/outputdev.py b/gcc/m2/www/tools/texi2tr/src/outputdev.py
deleted file mode 100644
index 202bfb35814..00000000000
--- a/gcc/m2/www/tools/texi2tr/src/outputdev.py
+++ /dev/null
@@ -1,565 +0,0 @@
-#!/usr/bin/python3
-
-# Copyright (C) 2011-2021 Free Software Foundation, Inc.
-#
-# This file is part of GNU Modula-2.
-#
-# GNU Modula-2 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 3, or (at your option)
-# any later version.
-#
-# GNU Modula-2 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 Modula-2; see the file COPYING. If not, write to the
-# Free Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA
-# 02110-1301, USA.
-
-import sys
-import os
-import string
-import config
-
-
-# html tag
-null_tag, title_tag, header1_tag, header2_tag, header3_tag, header4_tag, center_tag, paragraph_tag, preformatted_tag, teletype_tag, italic_tag, bold_tag, no_tag = list(range(13))
-
-# html state machine
-init_state, known_state, end_state, copy_state, white_state, nf_state = list(range(6))
-
-# char2code contains all html character codes
-char2code = {}
-char2code['"'] = """
-char2code['&'] = "&"
-char2code['<'] = "<"
-char2code['>'] = ">"
-
-
-# all methods prefixed by _ are for internal use only.
-
-class htmlDevice:
- #
- # setTemplatePath set the templatePath field.
- #
- def setTemplatePath (self, p):
- self.templatePath = p
- #
- # setSubDirectory set the subDirectory field.
- #
- def setSubDirectory (self, d):
- print ("setting subDirectory to", d)
- self.subDirectory = d
- #
- #
- #
- def getNodeAnchor (self):
- if config.multipleFragments or config.debugFragments:
- return self.currentFilename
- else:
- return "SEC%d" % self.anchorCount
- #
- #
- #
- def getNodeLink (self):
- if config.multipleFragments or config.debugFragments:
- return self.currentFilename
- else:
- return "#SEC%d" % self.anchorCount
- #
- #
- #
- def getAnchor (self):
- if config.multipleFragments:
- if self.anchorCount == 0:
- return self.currentFilename
- else:
- if config.debugFragments:
- return ('<<' + self.currentFilename + ">> SEC%d") % self.anchorCount
- else:
- return "SEC%d" % self.anchorCount
- else:
- return "SEC%d" % self.anchorCount
- #
- # nextAnchor
- #
- def nextAnchor (self):
- self.anchorCount += 1
- #
- #
- #
- def getLink (self):
- if config.multipleFragments:
- if self.anchorCount == 0:
- return self.currentFilename
- else:
- if config.debugFragments:
- return ('<<' + self.currentFilename + ">> #SEC%d") % self.anchorCount
- else:
- return "%s#SEC%d" % (self.currentFilename, self.anchorCount)
- else:
- return "#SEC%d" % self.anchorCount
- #
- # openDiv - delay opening a div
- #
- def openDiv (self):
- self.pendingDiv = True
- return self
- #
- # closeDiv - delay closing a div
- #
- def closeDiv (self):
- self.pendingDiv = False
- return self
- #
- # flushDiv - really write the div needed.
- #
- def flushDiv (self):
- if self.pendingDiv == self.actualDiv:
- return self
- self.actualDiv = self.pendingDiv
- if self.pendingDiv:
- self.raw(' <div class="page">\n')
- self.raw(' <div class="plain">\n')
- else:
- self.raw(' </div>\n')
- self.raw(' </div>\n')
- return self
- #
- # setBasename - assigns the basename with name. The fragments
- # will be named (basename % no).html
- #
- def setBasename (self, name):
- self.basename = name
- #
- # setNodename - determines whether file is generated from the node
- # name.
- #
- def setNodename (self, useNode):
- self.nodename = useNode
- #
- # setFilename - assigns the filename to name providing that nodename
- # is true.
- #
- def setFilename (self, name):
- if self.nodename:
- self.currentFilename = name
- #
- # collectFragment - return the old fragment filename and string and
- # create a new filename and an empty new fragment.
- #
- def collectFragment (self, dataType):
- if dataType == "menu":
- f, s = "", self.currentFragment
- self.currentFragment = ""
- else:
- f, s = self.currentFilename, self.currentFragment
- self.currentFragment = ""
- self.maxFrag += 1
- sys.stderr.write('[%d] ' % self.maxFrag)
- if (self.maxFrag % 10) == 0:
- sys.stderr.write('\n')
- self.previousFilename = self.currentFilename
- if not self.nodename:
- self.currentFilename = self.basename % self.maxFrag
- self.anchorCount = 0
- return f, s
- #
- # encodeChar -
- #
- def _encodeChar (self, c):
- global char2code
- if c in char2code:
- self.raw(char2code[c])
- else:
- self.raw(c)
- #
- # puts - append, s, to the currentFragment, encoding each
- # character in turn.
- #
- def puts (self, s):
- for i in s:
- self._encodeChar(i)
- #
- # raw - append, s, to the currentFragment.
- #
- def raw (self, s):
- if self.output == None:
- self.currentFragment += s
- else:
- self.output.write(s)
- #
- # openFragment - open up the initial fragment.
- #
- def openFragment (self):
- self.fragNo = 0
- #
- # nextFragment - closes the last fragment and opens up the next
- # filename.
- #
- def nextFragment (self, name):
- if self.fragNo > 0:
- self.closeFragment()
- if config.multipleFragments:
- completePath = os.path.join (self.subDirectory, name)
- self.output = open (completePath, 'w')
- if config.debugFragments:
- print()
- print("----------------------------------------------")
- print(name)
- print("----------------------------------------------")
- print()
- self.output = sys.stdout
- self.fragNo += 1
- self.deviceHeader()
- #
- # closeFragment - closes the final file fragment.
- #
- def closeFragment (self):
- self.deviceFooter()
- if config.multipleFragments:
- if self.output == None:
- sys.stderr.write ('output channel is None')
- else:
- self.output.close()
- #
- # copyright - output the (C) symbol.
- #
- def copyright (self):
- self.raw('©')
- #
- # emitTagName - write out tag names
- #
- def _emitTagName(self, s):
- if (self.state == init_state) or (self.tag == no_tag):
- return
- self.raw(s)
- if self.tag == title_tag:
- self.raw('title>')
- elif self.tag == header1_tag:
- self.raw('h1>')
- elif self.tag == header2_tag:
- self.raw('h2>')
- elif self.tag == header3_tag:
- self.raw('h3>')
- elif self.tag == header4_tag:
- self.raw('h4>')
- elif self.tag == center_tag:
- self.raw('center>')
- elif self.tag == paragraph_tag:
- self.raw('p>')
- elif self.tag == preformatted_tag:
- self.raw('pre>')
- elif self.tag == teletype_tag:
- self.raw('tt>')
- elif self.tag == italic_tag:
- self.raw('i>')
- elif self.tag == bold_tag:
- self.raw('b>')
-
- #
- # emitTag - write out the start tag
- #
- def _emitTag(self):
- self._emitTagName('<')
- #
- # emitTagEnd - write out the end tag
- #
- def _emitTagEnd(self):
- if self.state in [copy_state, white_state, nf_state]:
- self._emitTagName('</')
- if self.tag in [header1_tag, header2_tag, header3_tag, header4_tag, title_tag, center_tag, paragraph_tag, preformatted_tag]:
- self.raw('\n')
- if not (self.tag in [teletype_tag, italic_tag, bold_tag]):
- self.raw('\n')
- def _initState (self):
- self.state = init_state
- def __init__ (self, name):
- self.state = init_state
- self.tag = null_tag
- self.stack = []
- self.lastnewline = False
- self.filenameList = []
- self.currentFragment = ""
- self.currentFilename = name
- self.previousFilename = name
- self.title = ""
- self.output = None
- self.fragNo = 0
- self.maxFrag = 0
- sys.stderr.write('[1] ')
- self.pendingDiv = False
- self.actualDiv = False
- self.anchorCount = 0
- self.templatePath = '.'
- self.nodename = False
- self.sectionCount = 0
- self.subDirectory = "."
- def _to (self, s):
- self.state = s
- def _status (self):
- return self.state
- def push (self):
- self.stack += [(self.state, self.tag)]
- def pop (self):
- self.state, self.tag = self.stack[-1]
- self.stack = self.stack[:-1]
- if self.state == white_state:
- self.state = copy_state
- def _twoNewlines (self, c):
- if (c == '\n') and (self.lastnewline) and (self.tag == paragraph_tag):
- self._end()
- self.paraBegin()
- return True
- else:
- self.lastnewline = (c == '\n')
- return False
- def _doChar (self, c):
- if self.state == known_state:
- if c in string.whitespace:
- return
- self._emitTag()
- self.puts(c)
- self.state = copy_state
- elif self.state == copy_state:
- if self._twoNewlines(c):
- return
- self.puts(c)
- if c in string.whitespace:
- self.state = white_state
- elif self.state == white_state:
- if self._twoNewlines(c):
- return
- if not (c in string.whitespace):
- self.puts(c)
- self.state = copy_state
- elif self.state == nf_state:
- self.puts(c)
- def _end (self):
- if (self.state == init_state) or (self.state == known_state):
- return
- self._emitTagEnd()
- self.lastnewline = False
- self.state = init_state
- def write (self, contents):
- if self.state == init_state:
- return
- for c in contents:
- self._doChar(c)
- def setTitle(self, content):
- title = content
- def titleBegin(self):
- self._end()
- self.state = known_state
- self.tag = title_tag
- def titleEnd(self):
- self._end()
- def paraBegin(self):
- self._end()
- self.state = known_state
- self.tag = paragraph_tag
- def paraEnd(self):
- self._end()
- def centerBegin(self):
- self._end()
- self.state = known_state
- self.tag = center_tag
- def centerEnd(self):
- self._end()
- def h1Begin(self):
- self._end()
- self.state = known_state
- self.tag = header1_tag
- self.sectionCount += 1
- def h1End(self):
- self._end()
- def h2Begin(self):
- self._end()
- self.state = known_state
- self.tag = header2_tag
- self.sectionCount += 1
- def h2End(self):
- self._end()
- def h3Begin(self):
- self._end()
- self.state = known_state
- self.tag = header3_tag
- self.sectionCount += 1
- def h3End(self):
- self._end()
- def h4Begin(self):
- self._end()
- self.state = known_state
- self.tag = header4_tag
- self.sectionCount += 1
- def h4End(self):
- self._end()
- def preBegin(self):
- self._end()
- self.state = nf_state
- self.tag = preformatted_tag
- self._emitTag()
- def preEnd(self):
- self._end()
- def ttBegin(self):
- self.push()
- self.state = nf_state
- self.tag = teletype_tag
- self._emitTag()
- def ttEnd(self):
- self._end()
- self.pop()
- def iBegin(self):
- self.push()
- self.tag = italic_tag
- self._emitTag()
- def iEnd(self):
- self._end()
- self.pop()
- def bBegin(self):
- self.push()
- self.tag = bold_tag
- self._emitTag()
- def bEnd(self):
- self._end()
- self.pop()
- def centerBegin(self):
- self._end()
- self.state = known_state
- self.tag = center_tag
- def end(self):
- self._end()
- self.state = init_state
- self.tag = null_tag
- def noBegin(self):
- self.push()
- self.state = known_state
- self.tag = no_tag
- self._emitTag()
- def noEnd(self):
- self._end()
- self.pop()
- #
- # tableBegin -
- #
- def tableBegin(self):
- self.raw('<div class="itemize">\n')
- self.raw("<dl>\n")
- self.firstItem = True
- self.tableRightOpen = False
- #
- # tableEnd -
- #
- def tableEnd(self):
- self.raw("</dl>\n")
- self.raw('</div>\n')
- #
- # tableLeftBegin -
- #
- def tableLeftBegin(self):
- if self.firstItem:
- self.tableRightEnd()
- self.raw("<dt>")
- self.noBegin()
- #
- # tableLeftEnd -
- #
- def tableLeftEnd(self):
- self.noEnd()
- self.firstItem = False
- self.raw("</dt>\n")
- #
- # tableRightBegin -
- #
- def tableRightBegin(self):
- self._end()
- self.tableRightOpen = True
- self.raw("<dd>")
- #
- # tableRightEnd -
- #
- def tableRightEnd(self):
- self._end()
- if self.tableRightOpen:
- self.raw("</dd>")
- self.tableRightOpen = False
- #
- # itemizeBegin
- #
- def itemizeBegin(self):
- self._end()
- self.raw("<ul type=disc>")
- #
- # itemizeEnd
- #
- def itemizeEnd(self):
- self._end()
- self.raw("</ul>")
- #
- # item
- #
- def item(self):
- self._end()
- self.raw("<li>")
- #
- # emitTitle
- #
- def emitTitle (self):
- self.titleBegin()
- self.write(title)
- self.titleEnd()
- if config.ignoreh1Titlepage:
- pass
- else:
- self.h1Begin()
- self.write(self.title)
- self.h1End()
-
- #
- # deviceHeader - emit html header.
- #
- def deviceHeader (self):
- self.raw(self._safeOpen('header.ht', 'header template "header.ht"'))
- #
- # deviceFooter - emit html footer.
- #
- def deviceFooter (self):
- self.raw(self._safeOpen('footer.ht', 'footer template "footer.ht"'))
- #
- # safeOpen -
- #
- def _safeOpen (self, filename, description):
- try:
- for i in self.templatePath.split(':'):
- f = os.path.join(i, filename)
- if os.path.exists(f) and os.path.isfile(f):
- return open(f, 'r').read()
- print(("cannot open", description))
- sys.exit(0)
- except:
- print(("cannot open", description))
- sys.exit(0)
- #
- # emitMenuTitle -
- #
- def emitMenuTitle (self):
- self.raw(self._safeOpen('title.ht', 'title template "title.ht"'))
- #
- # emitNodeHeading -
- #
- def emitNodeHeading (self):
- self.raw(self._safeOpen('heading.ht', 'heading template "heading.ht"'))
- #
- #
- #
- def getSectionAnchor (self):
- return "section%d" % self.sectionCount
- #
- # sectionAnchor -
- #
- def sectionAnchor (self, content):
- self.raw('<a name="' + self.getSectionAnchor() + '"></a>\n')
- return self.currentFilename + '#' + self.getSectionAnchor()
diff --git a/gcc/m2/www/tools/texi2tr/src/texi2tr.py b/gcc/m2/www/tools/texi2tr/src/texi2tr.py
deleted file mode 100644
index 75f7012f63e..00000000000
--- a/gcc/m2/www/tools/texi2tr/src/texi2tr.py
+++ /dev/null
@@ -1,1445 +0,0 @@
-#!/usr/bin/python3
-
-# Copyright (C) 2011-2021 Free Software Foundation, Inc.
-#
-# This file is part of GNU Modula-2.
-#
-# GNU Modula-2 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 3, or (at your option)
-# any later version.
-#
-# GNU Modula-2 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 Modula-2; see the file COPYING. If not, write to the
-# Free Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA
-# 02110-1301, USA.
-
-import sys
-import os
-import glob
-import string
-import getopt
-import outputdev
-import navigation
-import config
-
-verbose = False
-debugging = False
-lineNo = 0
-filename = ""
-argStack = []
-functions = {}
-endFunctions = {}
-values = {}
-statementStack = {}
-includePath = './'
-templatePath = '.'
-title = ""
-inTitlePage = False
-nodeName = False
-tableSpecifier = []
-enumerateSpecifier = []
-menuText = ""
-macroText = ""
-frags = []
-outputFile = sys.stdout.write
-rootName = ""
-baseName = "texi2tr-%d.html"
-indexFunc = {}
-indexSections = {}
-html = None
-macroDef = {}
-macroContent = {}
-currentMacro = None
-subDirectory = "."
-
-
-# output state
-ignore, passthrough, arguments, menu, macro = list (range (5))
-
-currentMenu = navigation.menuInfo (True)
-
-
-
-#
-# printf - keeps C programmers happy :-)
-#
-
-def printf (format, *args):
- print(str(format) % args, end=' ')
-
-
-#
-# debugf - issues prints if debugging is set
-#
-
-def debugf (format, *args):
- global debugging
- if debugging:
- print(str(format) % args, end=' ')
-
-
-#
-# verbosef - issues prints if verbose is set
-#
-
-def verbosef (format, *args):
- global verbose
- if verbose:
- print(str(format) % args, end=' ')
-
-
-#
-# Usage - displays the usage
-#
-
-def Usage ():
- print("texi2tr [-h] [-v] [-Iincludepath] [-s subdirectory] [-Ttemplatepath] [-r rootname.html] [-b basename-%d.html] filename.texi")
- print(" produces html from the texinfo filename.texi")
- print(" -s subdirectory place html pages generated into subdirectory")
- print(" -h help")
- print(" -v verbose")
- sys.exit(0)
-
-
-#
-# collectArgs - collects the arguments supplied and places
-# useful contents into global variables.
-#
-
-def collectArgs():
- global verbose, debugging, includePath, templatePath, rootName, baseName, nodeName, subDirectory
- try:
- optlist, list = getopt.getopt(sys.argv[1:],':b:dhI:nr:s:T:v')
- except getopt.GetoptError:
- Usage()
- for opt in optlist:
- if opt[0] == '-d':
- debugging = True
- if opt[0] == '-h':
- Usage()
- if opt[0] == '-v':
- verbose = True
- if opt[0] == '-I':
- includePath = opt[1]
- if opt[0] == '-T':
- templatePath = opt[1]
- if opt[0] == '-r':
- rootName = opt[1]
- if opt[0] == '-s':
- subDirectory = opt[1]
- if opt[0] == '-b':
- baseName = opt[1]
- if opt[0] == '-n':
- nodeName = True
- return list
-
-
-#
-# readFile - returns the contents of a file, but will exit gracefully
-# if filename does not exist.
-#
-
-def readFile (filename):
- global includePath
- try:
- for i in includePath.split(':'):
- f = os.path.join(i, filename)
- if os.path.exists(f) and os.path.isfile(f):
- debugf('opening file: %s\n', f)
- return open(f, 'r').read()
- printf("cannot find file: %s\n", filename)
- sys.exit(0)
- except:
- printf("cannot open: %s\n", filename)
- sys.exit(0)
-
-
-#
-# doState - determine whether to emit contents or not.
-#
-
-def doState(contents, state):
- global lineNo, html, menu, menuText, macroText
- debugf('doState')
- if state == passthrough:
- html.write(contents)
- elif state == arguments:
- argStack[0] += contents
- elif state == menu:
- menuText += contents
- elif state == macro:
- macroText += contents
-
-#
-# skipLine - removes the first line from contents.
-#
-
-def skipLine (contents, state):
- debugf('skipLine')
- i = contents.find('\n')
- if (i>=0) and (i<len(contents)):
- doState(contents[:i+1], state)
- return contents[i+1:], state
- else:
- return "", state
-
-
-#
-# error - issue an error and exit
-#
-
-def error (message):
- global filename, lineNo
- sys.stderr.write('%s:%d %s\n' % (filename, lineNo, message))
- sys.exit(1)
-
-#
-# warning - issue a warning
-#
-
-def warning (message):
- global filename, lineNo
- sys.stderr.write('%s:%d warning %s\n' % (filename, lineNo, message))
-
-
-#
-# pushArg - place init at the top of the argStack.
-# (head of the list)
-#
-
-def pushArg (init):
- global argStack, debugging
- argStack = [init] + argStack
- if debugging:
- print("pushArg: argStack", argStack)
-
-
-#
-# popArg - return the top of the argStack.
-# (remove head of the list and return it)
-#
-
-def popArg ():
- global argStack, debugging
- value = argStack[0]
- if len(argStack)>1:
- argStack = argStack[1:]
- else:
- argStack = []
- if debugging:
- print("popArg: argStack", argStack)
- return value
-
-
-#
-# findArgend - return the end position denoting the end of the
-# argument string.
-#
-
-def findArgend (contents):
- debugf('findArgend')
- i = 0
- level = 0
- while (i<len(contents)) and ((contents[i] != '}') or (level != 0)):
- if contents[i] == '{':
- level += 1
- elif (contents[i] == '@') and (len(contents)>i+1) and ((contents[i+1] == '{') or (contents[i+1] == '}')):
- i += 1
- elif contents[i] == '}':
- level -= 1
- i += 1
- return i
-
-
-def stop():
- pass
-
-#
-# parseArgs
-#
-
-def parseArgs (contents, i, delim):
- debugf('parseArgs')
- if contents[i] == ' ':
- contents = contents[i:]
- contents = contents.lstrip(' ')
- pushArg("")
- i = contents.find('\n')
- args = contents.split('\n')[0]
- elif contents[i] == '{':
- contents = contents[i+1:]
- pushArg("")
- i = findArgend(contents)
- args = contents[:i]
- if len(contents)>i:
- return contents[i+1:], args
- else:
- return "", args
-
-
-def endMacroSeen (content, args):
- if (content == "end") and (args == "macro"):
- return (content == "end") and (args == "macro")
- return False
-
-
-#
-# substitute - given a macro, command, substute its parameters
-# with args.
-#
-
-def substitute (command, args):
- contents = macroContent[command]
- formalParameters = macroDef[command]
- for count, param in enumerate (formalParameters.split (",")):
- param = param.rstrip ()
- param = param.lstrip ()
- if count < len (args):
- contents = contents.replace ("\\" + param + "\\", args[count])
- return contents
-
-
-#
-# call - call the function, command, with args and state.
-#
-
-def call (command, args, state):
- global functions, macroDef, macroContent, macroText
-
- # printf ("command = %s, state = %d\n", command, state)
- if (state == macro) and (not endMacroSeen (command, args)):
- macroText += "@"
- macroText += command
- macroText += "{"
- macroText += args
- macroText += "}"
- return "", state
- elif command in macroContent:
- # need to substitute args into macro
- return substitute (command, args), state
- elif command in functions:
- return functions[command](args, state)
- else:
- # printf ("********* unknown command %s\n", command)
- # error("unknown command '" + command + "'")
- return "", state
-
-#
-# collectNonProcessedArgs - returns the arguments but without
-# processing @ symbols.
-#
-
-def collectNonProcessedArgs (command, contents):
- if (command == 'c') or (command == 'comment'):
- i = contents.find('\n')
- if len(contents)<i:
- return "", ""
- else:
- contents = contents[i+1:]
- return contents, ""
- elif command == 'table':
- i = contents.find(' ')
- if (len(contents)<i) or (i == -1):
- return "", ""
- else:
- contents = contents[i:]
- i = contents.find('\n')
- if len(contents)<i:
- return "", ""
- else:
- args = contents[:i].lstrip(' ').rstrip(' ')
- contents = contents[i+1:]
- return contents, args
-
-
-#
-# switchAt - extracts the command and argument and proceeds to
-# call the appropriate function.
-#
-
-def switchAt (contents, state):
- global macroText
-
- debugf('switchAt')
- if len (contents) > 0:
- return prepareCall (contents, state)
- debugf('return final switchAt')
- return contents, state
-
-
-def prepareCall (contents, state):
- contents = contents[1:]
- if (contents[0] == '@') or (contents[0] == '{') or (contents[0] == '}') or (contents[0] == '.'):
- if state==arguments:
- # still need to escape it
- doState('@', state)
- doState(contents[0], state)
- debugf('return 1st switchAt')
- return contents[1:], state
- else:
- # search for space or {
- l = contents.find('\n')
- if l>=0:
- i = contents.find(' ', 0, l)
- j = contents.find('{', 0, l)
- else:
- i = contents.find(' ')
- j = contents.find('{')
- if (i>=0) and ((j == -1) or (i<j)):
- command = contents.split()[0]
- if command in ['c', 'comment']:
- contents, args = collectNonProcessedArgs(command, contents)
- return contents, state
- elif command in ['table']:
- contents, args = collectNonProcessedArgs(command, contents)
- c, s = call(command, args, state)
- contents = c + contents
- return contents, s
- contents, args = parseArgs(contents, i, '\n')
- debugf('space delimited' + command + "<" + args + ">")
- debugf('return 3rd switchAt')
- c, s = call(command, args, state)
- contents = c + contents
- return contents, s
- elif (j>=0) and ((i == -1) or (j<i)):
- command = contents.split('{')[0]
- contents, args = parseArgs(contents, j, '}')
- debugf('brace delimited' + command + "<" + args + ">")
- debugf('return 4th switchAt')
- c, s = call(command, args, state)
- contents = c + contents
- return contents, s
- else:
- command = contents.split()[0]
- i = contents.find('\n')
- if (i>=0) and (i<len(contents)):
- contents = contents[i+1:]
- args = ""
- debugf(command + "<" + args + ">")
- debugf('return 4th switchAt')
- c, s = call(command, args, state)
- contents = c + contents
- return contents, s
-
-
-
-#
-# scanFor - search for '@' and parse this command.
-#
-
-def scanFor (contents, state):
- debugf('scanFor')
- i = contents.find('@')
- while i>=0:
- doState(contents[:i], state)
- contents, state = switchAt(contents[i:], state)
- i = contents.find('@')
- doState(contents, state)
- return "", state
-
-
-#
-# parseFile -
-#
-
-def parseFile (contents, state):
- global html
- debugf('parseFile')
- contents, state = skipLine(contents, state)
- contents, state = scanFor(contents, state)
- return contents, state
-
-
-#
-# doComment -
-#
-
-def doComment (content, state):
- return "", state
-
-def doSetfilename (content, state):
- return "", state
-
-def doInclude (content, state):
- return readFile(content), state
-
-def doSet (content, state):
- global values
- if len(content.split())>2:
- des, expr = content.split()[0:2]
- elif len(content.split()) == 2:
- des, expr = content.split()
- else:
- des = content.split ()[0]
- expr = True
- values[des] = expr
- return "", state
-
-def doValue (content, state):
- global values
- if content in values:
- return values[content], state
- else:
- error('unknown value ' + content)
- return "", state
-
-def doSettitle (content, state):
- return "", state
-
-def doTitlepage (content, state):
- global inTitlePage
- inTitlePage = True
- return doConsume(content, state, 'titlepage')
-
-def doTitlepageEnd (state):
- global html, title, inTitlePage
- inTitlePage = False
- html.setTitle(title)
- html.paraBegin()
-
-def doCenter (content, state):
- global html, title, inTitlePage
-
- if inTitlePage:
- return content, state
- elif state == ignore:
- return "", state
- else:
- html.centerBegin()
- html.write(content)
- html.centerEnd()
- return "", state
-
-def doTitlefont (content, state):
- global title, inTitlePage
- if inTitlePage and (state != ignore) and (title == ""):
- pushArg("")
- scanFor(content, arguments)
- title = popArg()
- return "", state
-
-def doI (content, state):
- global html
- if state != ignore:
- html.push()
- html.iBegin()
- scanFor(content, state)
- html.iEnd()
- html.pop()
- return "", state
-
-def doStrong (content, state):
- global html
- if state != ignore:
- html.push()
- html.bBegin()
- scanFor(content, state)
- html.bEnd()
- html.pop()
- return "", state
-
-def doVar (content, state):
- global html
- if state != ignore:
- html.push()
- html.iBegin()
- scanFor(content, state)
- html.iEnd()
- html.pop()
- return "", state
-
-def doSamp (content, state):
- global html
- if state != ignore:
- html.push()
- html.ttBegin()
- scanFor(content, state)
- html.ttEnd()
- html.pop()
- return "", state
-
-def doCode (content, state):
- global html
- if state != ignore:
- html.push()
- html.ttBegin()
- scanFor(content, state)
- html.ttEnd()
- html.pop()
- return "", state
-
-def doBr (content, state):
- global html
- return "", state
- # html.br ()
-
-#
-# doQuotation -
-#
-
-def doQuotation (content, state):
- return doConsume(content, state, 'quotation')
-
-def doIfinfo (content, state):
- if state == ignore:
- return doConsume(content, state, 'ifinfo')
- else:
- pushState('ifinfo', state)
- return '', ignore
-
-def doIfhtml (content, state):
- if state == ignore:
- return doConsume(content, state, 'ifhtml')
- else:
- pushState('ifhtml', state)
- return '', state
-
-def doIftex (content, state):
- if state == ignore:
- return doConsume(content, state, 'iftex')
- else:
- pushState('iftex', state)
- return '', state
-
-def doIfNottex (content, state):
- if state == ignore:
- return doConsume(content, state, 'ifnottex')
- else:
- pushState('ifnottex', state)
- return '', state
-
-def doIfSet (content, state):
- # printf ("ifset %s\n", content)
- if state == ignore:
- return doConsume(content, state, 'ifset')
- else:
- pushState('ifset', state)
- # print ("values = ", values)
- if content in values:
- # printf ("values contains %s\n", content)
- return '', state
- else:
- # printf ("values does not contain %s\n", content)
- return '', ignore
-
-def doIfClear (content, state):
- if state == ignore:
- return doConsume(content, state, 'ifclear')
- else:
- if content in values:
- return doConsume(content, ignore, 'ifclear')
- else:
- pushState('ifclear', state)
- return '', state
-
-def doCopying (content, state):
- if state == ignore:
- return doConsume(content, state, 'copying')
- else:
- html.end()
- pushState('copying', state)
- html.paraBegin()
- return '', state
-
-def doCopyingEnd (state):
- global html
- if state != ignore:
- html.end() # end of paragraph
-
-def doPass (content, state):
- return content, state
-
-def doIgnoreTag (content, state):
- return "", state
-
-def doIgnore (content, state):
- pushState ('ignore', state)
- return "", ignore
-
-def doIgnoreEnd (state):
- pass
-
-def doFormat (content, state):
- pushState ('format', state)
- return "", state
-
-def doFormatEnd (state):
- pass
-
-def doDirentry (content, state):
- pushState ('direntry', state)
- return "", state
-
-def doDirentryEnd (state):
- pass
-
-def pushState (keyword, state):
- global statementStack
- if keyword in statementStack:
- statementStack[keyword] = [state] + statementStack[keyword]
- else:
- statementStack[keyword] = [state]
-
-def popState (keyword):
- state = statementStack[keyword][0]
- # printf ("statement stack %s\n", statementStack[keyword])
- if len (statementStack[keyword]) == 1:
- statementStack[keyword] = []
- else:
- statementStack[keyword] = statementStack[keyword][1:]
- return state
-
-def doConsume (content, state, keyword):
- pushState(keyword, state)
- return content, ignore
-
-def doEnd (content, state):
- global statementStack, endFunctions
- keyword = content.split ()[0]
- if keyword in statementStack:
- if len (statementStack[keyword]) == 0:
- error ("unexpected end '" + keyword + "'")
- else:
- if keyword in endFunctions:
- # printf ("end %s\n", keyword)
- endFunctions[keyword] (state)
- else:
- # printf ("end function %s missing\n", keyword)
- pass
- # printf ("end %s: old state = %d", keyword, state)
- state = popState (keyword)
- # printf (", new state = %d", state)
- else:
- error ("'@end " + keyword + "'" + " without '@" + keyword + "'")
- return "", state
-
-def doExampleEnd (state):
- global html
- if state != ignore:
- html.preEnd()
- html.paraBegin()
-
-def doCopyright (content, state):
- global html
-
- if state != ignore:
- html.copyright()
- return content, state
-
-#
-# sefeName
-#
-
-def safeName (name):
- name = name.replace ("%", "")
- name = name.replace ("^", "")
- name = name.replace (")", "")
- name = name.replace ("(", "")
- name = name.replace ("[", "")
- name = name.replace ("]", "")
- name = name.replace ("{", "")
- name = name.replace ("}", "")
- name = name.replace ("<", "")
- name = name.replace (">", "")
- name = name.replace ("'", "")
- name = name.replace ("?", "")
- name = name.replace ("*", "")
- name = name.replace ("/", "")
- name = name.replace ('"', "")
- name = name.replace ("'", "")
- name = name.replace ("`", "")
- name = name.replace ("~", "")
- name = name.replace (" ", "_")
- return name.lower()
-
-def doNode (content, state):
- global frags
- if state == ignore:
- return skipLine (content, state)
- label = content.split(',')[0].rstrip().lstrip()
- if label == "Top":
- return "", state
- frags += [['text', html.collectFragment('node')]]
- name = safeName (label) + '.html'
- html.setFilename (name)
- # print ("node name =", name)
- frags += [['text', html.collectFragment('node')]]
- frags += [['node', navigation.addNode(html, content)]]
- return "", state
-
-def doTop (content, state):
- if state == ignore:
- return skipLine (content, state)
- return "", state
-
-def doMenu (content, state):
- global currentMenu, html, menuText, frags
- if state == ignore:
- return doConsume(content, state, 'menu')
- else:
- frags += [['text', html.collectFragment('menu')]]
- pushState('menu', state)
- menuText = ""
- return "", menu
-
-def doMenuEnd (state):
- global currentMenu, frags
- if state != ignore:
- currentMenu.parseMenu(menuText)
- frags += [['menu', currentMenu]]
- currentMenu = navigation.menuInfo(False)
- return "", state
-
-def doChapter (content, state):
- global html
- if state == ignore:
- return skipLine (content, state)
- html.h2Begin()
- html.write(content)
- html.h2End()
- html.paraBegin()
- return "", state
-
-def addSectionAnchor (content):
- global html, indexSections
- if content in indexSections:
- error('section name "' + content + '" already exists')
- else:
- indexSections[content] = html.sectionAnchor(content)
-
-def doSection (content, state):
- global html
- if state == ignore:
- return skipLine (content, state)
- addSectionAnchor(content)
- html.h3Begin()
- html.write(content)
- html.h3End()
- html.paraBegin()
- return "", state
-
-def doSubSection (content, state):
- global html, indexSections
- if state == ignore:
- return skipLine (content, state)
- addSectionAnchor(content)
- html.h4Begin()
- html.write(content)
- html.h4End()
- html.paraBegin()
- return "", state
-
-def doUref (content, state):
- global html
- if state != ignore:
- html.raw('<a href="')
- p = content.split(',')
- if len(p) == 1:
- scanFor(content, state)
- html.raw('">')
- scanFor(content, state)
- elif len(p) == 2:
- scanFor(p[0].rstrip().lstrip(), state)
- html.raw('">')
- scanFor(p[1].rstrip().lstrip(), state)
- elif len(p) >= 2:
- scanFor(p[0].rstrip().lstrip(), state)
- html.raw('">')
- scanFor(p[2].rstrip().lstrip(), state)
- html.raw('</a>')
- return "", state
-
-def doEmail (content, state):
- global html
- if state != ignore:
- html.raw('<a href="mailto:')
- scanFor(content, state)
- html.raw('">')
- scanFor(content, state)
- html.raw('</a>')
- return "", state
-
-#
-# pushSpecifier - pushes a format to the top of stack.
-#
-
-def pushSpecifier (dataType, format):
- global tableSpecifier
- tableSpecifier = [[dataType, format]] + tableSpecifier
-
-#
-# popSpecifier - removes the top of stack
-#
-
-def popSpecifier ():
- global tableSpecifier
- if len(tableSpecifier)>1:
- tableSpecifier = tableSpecifier[1:]
- else:
- tableSpecifier = []
-
-#
-# getSpecifier - returns the top of stack.
-#
-
-def getSpecifier ():
- global tableSpecifier
- return tableSpecifier[0]
-
-def isTableSpecifier (s):
- return s[0] == 'table'
-
-def isEnumSpecifier (s):
- return s[0] == 'enumerate'
-
-def isItemizeSpecifier (s):
- return s[0] == 'itemize'
-
-def is_int(s):
- try:
- int(s)
- return True
- except ValueError:
- return False
-
-def incrementSpecifier ():
- global tableSpecifier
- if is_int(tableSpecifier[0][1]):
- tableSpecifier[0][1] = "%d" % (int(tableSpecifier[0][1])+1)
- else:
- tableSpecifier[0][1] = chr(ord(tableSpecifier[0][1])+1)
-
-#
-# doItemize - collect the format specifier and emit the start
-#
-
-def doItemize (content, state):
- global html
- if state == ignore:
- return doConsume(content, state, 'itemize')
- else:
- html.end()
- pushSpecifier('itemize', content)
- pushState('itemize', state)
- html.itemizeBegin()
- html.noBegin()
- return "", state
-
-#
-# doItemizeEnd - terminates the current itemize
-#
-
-def doItemizeEnd (state):
- global html
- if state != ignore:
- html.noEnd()
- popSpecifier()
- html.itemizeEnd()
- html.paraBegin()
-
-#
-# doMacro - define a texi macro.
-#
-
-def doMacro (content, state):
- global html, currentMacro, macroDef
- if state == ignore:
- return doConsume (content, state, 'macro')
- else:
- # print ("macro seen: defn = ", content)
- currentMacro = content.split ("{")[0]
- macroDef[currentMacro] = content
- pushState ('macro', state)
- return "", macro
-
-#
-# doMacroEnd - terminates the current macro.
-#
-
-def doMacroEnd (state):
- global macroText, macroContent, currentMacro
- if state == macro:
- macroContent[currentMacro] = macroText
- print ("macro defined: ", currentMacro, "contents", macroText)
- currentMacro = None
- macroText = ""
-
-
-#
-# doTable - collect the format specifier and emit the start
-#
-
-def doTable (content, state):
- global html
- if state == ignore:
- return doConsume(content, state, 'table')
- else:
- html.end()
- pushSpecifier('table', content)
- pushState('table', state)
- html.tableBegin()
- html.paraBegin()
- return "", state
-
-#
-# doTableEnd - terminates the current table
-#
-
-def doTableEnd (state):
- global html
- if state != ignore:
- html.end() # end of paragraph
- popSpecifier()
- html.tableRightEnd()
- html.tableEnd()
- html.paraBegin()
-
-#
-# doItem -
-#
-
-def doItem (content, state):
- global html
- if state == ignore:
- return skipLine (content, state)
- else:
- if isItemizeSpecifier(getSpecifier()):
- html.noEnd()
- html.item()
- html.noBegin()
- else:
- html.end() # shuts down a para
- html.tableRightEnd()
- html.tableLeftBegin()
- if isEnumSpecifier(getSpecifier()):
- stop()
- scanFor(getSpecifier ()[1] + ' ' + content, state)
- incrementSpecifier()
- else:
- scanFor(getSpecifier ()[1] + '{' + content + '}', state)
- html.tableLeftEnd()
- html.tableRightBegin()
- html.paraBegin()
- return "", state
-
-
-#
-# doAlias - alias one macro by another.
-#
-
-def doAlias (content, state):
- if state == ignore:
- return skipLine (content, state)
- else:
- # --fixme-- this needs to be completed.
- return "", state
-
-#
-# doTex - perform commands in tex.
-#
-
-def doTex (content, state):
- global html
- if state == ignore:
- return doConsume(content, state, 'tex')
- else:
- pushState('tex', state)
- return "", ignore
-
-#
-# doTexEnd - terminates the tex statement sequence.
-#
-
-def doTexEnd (state):
- global html
- if state != ignore:
- pass
-
-#
-#
-#
-
-def doBullet (content, state):
- global html
- if state == ignore:
- return skipLine (content, state)
- else:
- html.end() # shuts down a para
- html.tableRightEnd()
- html.tableLeftBegin()
- scanFor(content, state)
- html.tableLeftEnd()
- html.tableRightBegin()
- html.paraBegin()
- return "", state
-
-
-#
-# doEnumerate - collect the enumeration specifier and emit the start
-#
-
-def doEnumerate (content, state):
- global html
- if state == ignore:
- return doConsume(content, state, 'enumerate')
- else:
- html.end()
- pushSpecifier('enumerate', content)
- pushState('enumerate', state)
- html.tableBegin()
- html.paraBegin()
- return "", state
-
-#
-# doEnumerateEnd - terminates the current enumeration list.
-#
-
-def doEnumerateEnd (state):
- global html
- if state != ignore:
- html.end() # end of paragraph
- popSpecifier()
- html.tableRightEnd()
- html.tableEnd()
- html.paraBegin()
-
-def doExample (content, state):
- global html
- if state == ignore:
- return doConsume(content, state, 'example')
- else:
- pushState('example', state)
- html.paraEnd()
- html.preBegin()
- return content, state
-
-def doSmallExample (content, state):
- global html
- if state == ignore:
- return doConsume(content, state, 'smallexample')
- else:
- pushState('smallexample', state)
- html.paraEnd()
- html.preBegin()
- return content, state
-
-def doSmallExampleEnd (state):
- global html
- if state != ignore:
- html.preEnd()
- html.paraBegin()
-
-def doFootnote (content, state):
- global html
- if state == ignore:
- return doConsume(content, state, 'footnote')
- else:
- html.paraEnd()
- pushState('footnote', state)
- html.raw('<div class="footnote"><ul class="footnote"><li class="footnote">\n')
- html.paraBegin()
- scanFor(content, state)
- html.paraEnd()
- html.raw("\n</li></ul></div>\n")
- state = popState('footnote')
- html.paraBegin()
- return "", state
-
-def doXref (content, state):
- if state == ignore:
- return "", state
- else:
- text = "See ("
- args = content.split (",")
- if len (args) > 1:
- text += args[0]
- text += ", "
- text += args[-1]
- elif len (args) == 1:
- text += args[0]
- text += ")"
- return text, state
-
-def doDisplay (content, state):
- global html
- if state == ignore:
- return doConsume(content, state, 'display')
- else:
- pushState('display', state)
- html.paraEnd()
- html.raw("<div display>\n")
- html.paraBegin()
- return content, state
-
-def doDisplayEnd (state):
- global html
- if state != ignore:
- html.paraEnd()
- html.raw("</div>\n")
- html.paraBegin()
-
-def doHeading (content, state):
- global html
- if state == ignore:
- return skipLine (content, state)
- html.h2Begin()
- html.write(content)
- html.h2End()
- html.paraBegin()
- return "", state
-
-def doFindex (content, state):
- global indexFunc, html
-
- if state == ignore:
- return skipLine (content, state)
- if content in indexFunc:
- indexFunc[content] += [html.getLink()]
- else:
- indexFunc[content] = [html.getLink()]
- s = '<a name="' + html.getAnchor() + '"></a>\n'
- html.raw(s)
- html.nextAnchor()
- return "", state
-
-def sort_compare (a, b):
- return a < b
-
-#
-#
-#
-
-def doPrintIndex (content, state):
- global indexFunc, html, frags
-
- if state == ignore:
- return skipLine (content, state)
- if not (content in ['cp', 'fn']):
- error('printindex knows about cp and fn but not ' + content)
- frags += [['text', html.collectFragment(content)]]
- frags += [[content, html.collectFragment(content)]]
- return "", state
-
-#
-# doBye - adds the remaining fragment to the list of frags.
-#
-
-def doBye (content, state):
- global frags
- frags += [['text', html.collectFragment('bye')]]
- return "", state
-
-
-def generateFunctionIndex (html):
- global indexFunc
-
- html.openDiv().flushDiv()
- html.paraBegin()
- for k,v in sorted([(key, value) for (key,value) in list(indexFunc.items())]):
- html.write(k)
- html.write(': ')
- for n in range(len(v)):
- if n>0:
- html.write(', ')
- html.raw('<a href="')
- html.raw(v[n])
- html.raw('">')
- html.write('[%d]' % (n+1))
- html.raw('</a>')
- html.raw('.<br>\n')
- html.paraEnd()
- html.closeDiv()
-
-
-def generateSectionIndex (html):
- global indexSections
-
- html.openDiv().flushDiv()
- html.paraBegin()
- html.write('Alphabetically sorted list of contents')
- html.raw('<br>\n')
- for k,v in sorted([(key, value) for (key,value) in list(indexSections.items())]):
- html.raw('<a href="')
- html.raw(v)
- html.raw('">')
- html.write(k)
- html.raw('</a>')
- html.raw('<br>\n')
- html.paraEnd()
- html.closeDiv()
-
-
-#
-# populateFunctions - create the dictionary of commands.
-#
-
-def populateFunctions ():
- global functions
- functions['*'] = doBr
- functions['alias'] = doAlias
- functions['author'] = doIgnoreTag
- functions['bullet'] = doBullet
- functions['bye'] = doBye
- functions['c'] = doComment
- functions['center'] = doPass
- functions['chapter'] = doChapter
- functions['code'] = doCode
- functions['command'] = doSamp
- functions['comment'] = doComment
- functions['copying'] = doCopying
- endFunctions['copying'] = doCopyingEnd
- functions['copyright'] = doCopyright
- functions['dircategory'] = doIgnoreTag
- functions['direntry'] = doDirentry
- endFunctions['direntry'] = doDirentryEnd
- functions['display'] = doDisplay
- endFunctions['display'] = doDisplayEnd
- functions['email'] = doEmail
- functions['end'] = doEnd
- functions['enumerate'] = doEnumerate
- endFunctions['enumerate'] = doEnumerateEnd
- functions['example'] = doExample
- endFunctions['example'] = doExampleEnd
- functions['file'] = doSamp
- functions['finalout'] = doPass
- functions['findex'] = doFindex
- functions['footnote'] = doFootnote
- functions['format'] = doFormat
- endFunctions['format'] = doFormatEnd
- functions['heading'] = doHeading
- functions['i'] = doI
- functions['ignore'] = doIgnore
- endFunctions['ignore'] = doIgnoreEnd
- functions['image'] = doIgnoreTag
- functions['include'] = doInclude
- functions['insertcopying'] = doIgnoreTag
- functions['ifclear'] = doIfClear
- functions['ifhtml'] = doIfhtml
- functions['ifinfo'] = doIfinfo
- functions['iftex'] = doIftex
- functions['ifnottex'] = doIfNottex
- functions['ifset'] = doIfSet
- functions['item'] = doItem
- functions['itemize'] = doItemize
- endFunctions['itemize'] = doItemizeEnd
- functions['macro'] = doMacro
- endFunctions['macro'] = doMacroEnd
- functions['menu'] = doMenu
- endFunctions['menu'] = doMenuEnd
- functions['node'] = doNode
- functions['page'] = doPass
- functions['printindex'] = doPrintIndex
- functions['summarycontents'] = doPass
- functions['contents'] = doPass
- functions['quotation'] = doQuotation
- functions['value'] = doValue
- functions['var'] = doVar
- functions['samp'] = doSamp
- functions['sc'] = doStrong
- functions['section'] = doSection
- functions['set'] = doSet
- functions['setchapternewpage'] = doPass
- functions['setfilename'] = doSetfilename
- functions['settitle'] = doSettitle
- functions['smallbook'] = doPass
- functions['smallexample'] = doSmallExample
- endFunctions['smallexample'] = doSmallExampleEnd
- functions['sp'] = doPass
- functions['strong'] = doStrong
- functions['subsection'] = doSubSection
- functions['subtitle'] = doPass # doSubTitle
- functions['table'] = doTable
- endFunctions['table'] = doTableEnd
- functions['tex'] = doTex
- endFunctions['tex'] = doTexEnd
- functions['title'] = doIgnoreTag
- functions['titlepage'] = doTitlepage
- endFunctions['titlepage'] = doTitlepageEnd
- functions['titlefont'] = doTitlefont
- functions['top'] = doTop
- functions['unnumbered'] = doChapter
- functions['unnumberedsec'] = doSection
- functions['uref'] = doUref
- functions['url'] = doUref
- functions['versionsubtitle'] = doIgnoreTag
- functions['vskip'] = doPass
- functions['xref'] = doXref
-
-def openDiv (openedDiv):
- if not openedDiv:
- html.raw(' <div class="page">\n')
- html.raw(' <div class="plain">\n')
- return True
-
-def closeDiv (openedDiv):
- if openedDiv:
- html.raw(' </div>\n')
- html.raw(' </div>\n')
- return False
-
-#
-# mergeMenu - write out each menu between each fragment.
-#
-
-def mergeMenu ():
- global frags, html, outputFile
-
- root = navigation.getRoot(frags)
- fn = ""
- html.openFragment()
- selected = ""
- for f in frags:
- if f[0] == 'menu':
- if f[1] == root:
- pass
- elif not f[1]._isShort():
- html.openDiv().flushDiv()
- selected = f[1].generateMenu(html, root, selected)
- html.closeDiv()
- elif f[0] == 'node':
- if f[1] == root:
- pass
- else:
- html.flushDiv()
- html.nextFragment(fn)
- selected = f[1].generateMenu(html, root, selected)
- elif f[0] == 'text':
- if (fn != f[1][0]) and (f[1][0] != ""):
- fn = f[1][0]
- html.openDiv().flushDiv()
- html.raw(f[1][1])
- html.closeDiv()
- elif f[0] == 'fn':
- generateFunctionIndex(html)
- elif f[0] == 'cp':
- generateSectionIndex(html)
- html.flushDiv()
- html.closeFragment()
-
-#
-# main - the first procedure to execute.
-#
-
-def main():
- global filename, baseName, rootName, templatePath, html, nodeName, subDirectory
-
- list = collectArgs()
- filename = list[0]
- html = outputdev.htmlDevice (rootName)
- html.setBasename (baseName)
- html.setTemplatePath (templatePath)
- html.setNodename (nodeName)
- html.setSubDirectory (subDirectory)
-
- populateFunctions()
- contents = readFile(filename)
- contents, state = parseFile(contents, passthrough)
- mergeMenu()
-
-main()
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2022-09-28 10:47 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-09-28 10:47 [gcc/devel/modula-2] Remove unnecessary directories Gaius Mulley
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).