123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135 |
- (defvar m2-mode-syntax-table nil "\
- Syntax table in use in Modula-2-mode buffers.")
- (if m2-mode-syntax-table nil (let ((table (make-syntax-table))) (modify-syntax-entry 92 "\\" table) (modify-syntax-entry 40 ". 1" table) (modify-syntax-entry 41 ". 4" table) (modify-syntax-entry 42 ". 23" table) (modify-syntax-entry 43 "." table) (modify-syntax-entry 45 "." table) (modify-syntax-entry 61 "." table) (modify-syntax-entry 37 "." table) (modify-syntax-entry 60 "." table) (modify-syntax-entry 62 "." table) (modify-syntax-entry 39 "\"" table) (setq m2-mode-syntax-table table)))
- (defvar m2-mode-map nil "\
- Keymap used in Modula-2 mode.")
- (if m2-mode-map nil (let ((map (make-sparse-keymap))) (define-key map " " (quote m2-tab)) (define-key map "b" (quote m2-begin)) (define-key map "c" (quote m2-case)) (define-key map "d" (quote m2-definition)) (define-key map "e" (quote m2-else)) (define-key map "f" (quote m2-for)) (define-key map "h" (quote m2-header)) (define-key map "i" (quote m2-if)) (define-key map "m" (quote m2-module)) (define-key map "l" (quote m2-loop)) (define-key map "o" (quote m2-or)) (define-key map "p" (quote m2-procedure)) (define-key map "" (quote m2-with)) (define-key map "r" (quote m2-record)) (define-key map "s" (quote m2-stdio)) (define-key map "t" (quote m2-type)) (define-key map "u" (quote m2-until)) (define-key map "v" (quote m2-var)) (define-key map "w" (quote m2-while)) (define-key map "x" (quote m2-export)) (define-key map "y" (quote m2-import)) (define-key map "{" (quote m2-begin-comment)) (define-key map "}" (quote m2-end-comment)) (define-key map "" (quote suspend-emacs)) (define-key map "" (quote m2-visit)) (define-key map "" (quote m2-toggle)) (define-key map "" (quote m2-link)) (define-key map "" (quote m2-compile)) (setq m2-mode-map map)))
- (defvar m2-indent 5 "\
- *This variable gives the indentation in Modula-2-Mode")
- (defun modula-2-mode nil "\
- 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.
- \\{m2-mode-map}
- 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 { begin-comment Control-c } end-comment
- Control-c Control-z suspend-emacs Control-c Control-t toggle
- Control-c Control-c compile Control-x ` next-error
- Control-c Control-l link
- m2-indent controls the number of spaces for each indentation." (interactive) (byte-code "ÐˆÑ ˆÒ!ˆÓ‰ˆÔ‰ˆÕÃ!ˆÖ‰ˆÕÄ!ˆ×‰ˆØ
!ˆÕÆ!ˆÙP‰ˆÕÈ!ˆ‰ˆÕÉ!ˆÊ‰ ˆÕË!ˆÚ‰ˆÕÌ!ˆÛ‰ˆÕÃ!ˆÖ‰ˆÕÍ!ˆÜ‰
ˆÕÎ!ˆÝ‰ˆÕÏ!ˆÊ‰ˆÞß!‡" [m2-mode-map major-mode mode-name comment-column end-comment-column m2-mode-syntax-table paragraph-start page-delimiter paragraph-separate require-final-newline t comment-start comment-end comment-start-skip comment-indent-hook parse-sexp-ignore-comments nil kill-all-local-variables use-local-map modula-2-mode "Modula-2" make-local-variable 41 75 set-syntax-table "^$\\|" "(* " " *)" "/\\*+ *" c-comment-indent run-hooks m2-mode-hook] 16))
- (defun m2-tab nil "\
- Indent to next tab stop." (interactive) (byte-code "ÁˆÂÃÄ \"T\"j‡" [m2-indent nil * / current-indentation] 5))
- (defun m2-begin nil "\
- Insert a BEGIN keyword and indent for the next line." (interactive) (byte-code "ÀˆÁcˆÂ ˆÃ ‡" [nil "BEGIN" m2-newline m2-tab] 3))
- (defun m2-case nil "\
- Build skeleton CASE statment, prompting for the <expression>." (interactive) (byte-code "ÀˆÁÂÃÄ!Å#ˆÆ ˆÆ ˆÇcˆÈÉ!ˆÊ ‡" [nil insert "CASE " read-string ": " " OF" m2-newline "END (* case *);" end-of-line 0 m2-tab] 7))
- (defun m2-definition nil "\
- Build skeleton DEFINITION MODULE, prompting for the <module name>." (interactive) (byte-code "ÁˆÂcˆÃÄ!ÅÆÇ$)ˆÈÉ!‡" [name nil "DEFINITION MODULE " read-string "Name: " insert ";
- END " ".
- " previous-line 3] 6))
- (defun m2-else nil "\
- Insert ELSE keyword and indent for next line." (interactive) (byte-code "ÁˆÂ ˆÃÁ\"ˆÄcˆÂ ˆÅ ‡" [m2-indent nil m2-newline backward-delete-char-untabify "ELSE" m2-tab] 5))
- (defun m2-for nil "\
- Build skeleton FOR loop statment, prompting for the loop parameters." (interactive) (byte-code "ÁˆÂÃÄÅ!ÆÅ$ˆÄÅ!ÇÈ\"?ƒ ÂÉ\"‚ Á)ˆÊcˆË ˆË ˆÌcˆÍÎ!ˆÏ ‡" [by nil insert "FOR " read-string ": " " TO " string-equal "" " BY " " DO" m2-newline "END (* for *);" end-of-line 0 m2-tab] 10))
- (defun m2-header nil "\
- Insert a comment block containing the module title, author, etc." (interactive) (byte-code "ÀˆÁcˆÂÃ!cˆÄcˆÅ cˆÆcˆÇ cˆÈÉÊ ËÌ Í%cˆÎc‡" [nil "(*
- Title: " read-string "Title: " "
- Created: " current-time-string "
- Author: " user-full-name concat "
- <" user-login-name "@" system-name ">
- " "*)
- "] 11))
- (defun m2-if nil "\
- Insert skeleton IF statment, prompting for <boolean-expression>." (interactive) (byte-code "ÀˆÁÂÃÄ!Å#ˆÆ ˆÆ ˆÇcˆÈÉ!ˆÊ ‡" [nil insert "IF " read-string "<boolean-expression>: " " THEN" m2-newline "END (* if *);" end-of-line 0 m2-tab] 7))
- (defun m2-loop nil "\
- Build skeleton LOOP (with END)." (interactive) (byte-code "ÀˆÁcˆÂ ˆÂ ˆÃcˆÄÅ!ˆÆ ‡" [nil "LOOP" m2-newline "END (* loop *);" end-of-line 0 m2-tab] 5))
- (defun m2-module nil "\
- Build skeleton IMPLEMENTATION MODULE, prompting for <module-name>." (interactive) (byte-code "ÁˆÂcˆÃÄ!ÅÆÇ$)ˆÈÉ!‡" [name nil "IMPLEMENTATION MODULE " read-string "Name: " insert ";
- END " ".
- " previous-line 3] 6))
- (defun m2-or nil (interactive) (byte-code "ÁˆÂ ˆÃ!ˆÄcˆÂ ˆÅ ‡" [m2-indent nil m2-newline backward-delete-char-untabify "|" m2-tab] 5))
- (defun m2-procedure nil (interactive) (byte-code "ˆÃcˆÄÅ!ÂÆÇ\"ˆÆÄÈ!É\"ˆÄÊ!‰ˆË Ì\"?ƒ, ÆÍ \"‚- ˆÎcˆÏ ˆÐcˆÏ ˆÏ ˆÑcˆcˆÎcˆÒÓ!ˆÔ *‡" [name args nil "PROCEDURE " read-string "Name: " insert " (" "Arguments: " ")" "Result Type: " string-equal "" " : " ";" m2-newline "BEGIN" "END " end-of-line 0 m2-tab] 13))
- (defun m2-with nil (interactive) (byte-code "ÀˆÁcˆÂÃ!cˆÄcˆÅ ˆÅ ˆÆcˆÇÈ!ˆÉ ‡" [nil "WITH " read-string ": " " DO" m2-newline "END (* with *);" end-of-line 0 m2-tab] 6))
- (defun m2-record nil (interactive) (byte-code "ÀˆÁcˆÂ ˆÂ ˆÃcˆÄÅ!ˆÆ ‡" [nil "RECORD" m2-newline "END (* record *);" end-of-line 0 m2-tab] 5))
- (defun m2-stdio nil (interactive) (byte-code "ÀˆÁc‡" [nil "
- >FROM TextIO IMPORT
- WriteCHAR, ReadCHAR, WriteINTEGER, ReadINTEGER,
- WriteCARDINAL, ReadCARDINAL, WriteBOOLEAN, ReadBOOLEAN,
- WriteREAL, ReadREAL, WriteBITSET, ReadBITSET,
- WriteBasedCARDINAL, ReadBasedCARDINAL, WriteChars, ReadChars,
- WriteString, ReadString, WhiteSpace, EndOfLine;
- >FROM SysStreams IMPORT sysIn, sysOut, sysErr;
- "] 1))
- (defun m2-type nil (interactive) (byte-code "ÀˆÁcˆÂ ˆÃ ‡" [nil "TYPE" m2-newline m2-tab] 3))
- (defun m2-until nil (interactive) (byte-code "ÀˆÁcˆÂ ˆÂ ˆÃcˆÄÅÆ!Ç\"ˆÈÉ!ˆÊ ‡" [nil "REPEAT" m2-newline "UNTIL " insert read-string ": " ";" end-of-line 0 m2-tab] 7))
- (defun m2-var nil (interactive) (byte-code "ÀˆÁ ˆÂcˆÁ ˆÃ ‡" [nil m2-newline "VAR" m2-tab] 4))
- (defun m2-while nil (interactive) (byte-code "ÀˆÁcˆÂÃ!cˆÄcˆÅ ˆÅ ˆÆcˆÇÈ!ˆÉ ‡" [nil "WHILE " read-string ": " " DO" m2-newline "END (* while *);" end-of-line 0 m2-tab] 6))
- (defun m2-export nil (interactive) (byte-code "ÀˆÁc‡" [nil "EXPORT QUALIFIED "] 1))
- (defun m2-import nil (interactive) (byte-code "ÀˆÁcˆÂÃ!cˆÄc‡" [nil "FROM " read-string "Module: " " IMPORT "] 2))
- (defun m2-begin-comment nil (interactive) (byte-code "Áˆn?ƒ ÂÃ\"‚ ÁˆÄc‡" [comment-column nil indent-to 0 "(* "] 3))
- (defun m2-end-comment nil (interactive) (byte-code "Áˆn?ƒ j‚
ÁˆÂc‡" [end-comment-column nil "*)"] 1))
- (defun m2-compile nil (interactive) (byte-code "ÁˆÂ ‰ˆÃÄP!‡" [modulename nil buffer-name compile "m2c "] 4))
- (defun m2-link nil (interactive) (byte-code "ÁˆÂ ‰ˆÃÄÅÆOP!‡" [modulename nil buffer-name compile "m2l " 0 -4] 6))
- (defun execute-monitor-command (command) (byte-code " ÆÇ!È\"ÉÃÄÄÊË
P&*‡" [shell shell-file-name csh nil t command equal file-name-nondirectory "csh" call-process "-cf" "exec "] 10))
- (defun m2-visit nil (interactive) (byte-code "ÁˆÁÁÁŠÄÅ!‰ˆÆÇ!ˆÈÉP!ˆebˆÁÊË�ˆÁÌÍ�ˆ†+
- ?ƒ6 ÎÏ\"‚7 Á)ˆƒQ Ð!ˆ
- ƒM ŠÐ
- !)‚N Á‚X
- …X Ð
- !+‡" [deffile nil modfile modulename read-string "Module name: " switch-to-buffer "*Command Execution*" execute-monitor-command "m2whereis " (byte-code "ÁÂ!ˆÃÄÅ!ÆÅ!\"‰‡" [deffile re-search-forward "\\(.*\\.def\\) *$" buffer-substring match-beginning 1 match-end] 6) ((search-failed (byte-code "À‡" [nil] 1))) (byte-code "ÁÂ!ˆÃÄÅ!ÆÅ!\"‰‡" [modfile re-search-forward "\\(.*\\.mod\\) *$" buffer-substring match-beginning 1 match-end] 6) ((search-failed (byte-code "À‡" [nil] 1))) error "I can find neither definition nor implementation of %s" find-file] 8))
- (defun m2-toggle nil "\
- Toggle between .mod and .def files for the module." (interactive) (byte-code "ÀˆÁ ÃÀOÄ\"ƒ Å ÆÃOÇP!‚- Á ÃÀOÇ\"…- Å ÆÃOÄP!‡" [nil string-equal buffer-name -4 ".def" find-file-other-window 0 ".mod"] 11))
|