home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Fresh Fish 4
/
FreshFish_May-June1994.bin
/
bbs
/
gnu
/
emacs-18.59-bin.lha
/
lib
/
emacs
/
18.59
/
lisp
/
modula2.elc
< prev
next >
Wrap
Text File
|
1991-01-09
|
10KB
|
151 lines
(defvar m2-mode-syntax-table nil "\
Syntax table in use in Modula-2-mode buffers.")
(defvar m2-compile-command "m2c" "\
Command to compile Modula-2 programs")
(defvar m2-link-command "m2l" "\
Command to link Modula-2 programs")
(defvar m2-link-name nil "\
Name of the executable.")
(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.
m2-compile-command holds the command to compile a Modula-2 program.
m2-link-command holds the command to link a Modula-2 program." (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 paragraph-ignore-fill-prefix t require-final-newline 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] 17))
(defun m2-newline nil "\
Insert a newline and indent following line like previous line." (interactive) (byte-code "ÁÂ Ã j)" [hpos nil current-indentation newline] 3))
(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 "init: " " TO " "end: " "by: " string-equal "" " BY " " DO" m2-newline "END (* for *);" end-of-line 0 m2-tab] 11))
(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Ï Ï ÑccÎ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: " "