diff options
| author | Stefan Monnier | 2005-10-11 21:22:14 +0000 |
|---|---|---|
| committer | Stefan Monnier | 2005-10-11 21:22:14 +0000 |
| commit | f8b4fcda052b72cb32c1adb822d6d47138dea308 (patch) | |
| tree | 3af65b039cae1d3a3109690d6258b33a0df60348 | |
| parent | 125df7f5c8dddeaf81f839f07b33fa0832874f3f (diff) | |
| download | emacs-f8b4fcda052b72cb32c1adb822d6d47138dea308.tar.gz emacs-f8b4fcda052b72cb32c1adb822d6d47138dea308.zip | |
Sync with version in the GNU MDK project.
Try to fix up minor layout issues like indentation, line break, etc...
(mixal-mode-syntax-table): Don't try to specify comment syntax,
because it doesn't work.
(mixal-operation-codes): Add some more codes.
(mixal-font-lock-keywords): Process comments here.
(mixal-mode): mixasm no longer needs -g option.
| -rw-r--r-- | lisp/progmodes/mixal-mode.el | 91 |
1 files changed, 55 insertions, 36 deletions
diff --git a/lisp/progmodes/mixal-mode.el b/lisp/progmodes/mixal-mode.el index fd494324303..5134cf8292e 100644 --- a/lisp/progmodes/mixal-mode.el +++ b/lisp/progmodes/mixal-mode.el | |||
| @@ -17,8 +17,8 @@ | |||
| 17 | ;; Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, | 17 | ;; Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
| 18 | ;; MA 02110-1301 USA | 18 | ;; MA 02110-1301 USA |
| 19 | 19 | ||
| 20 | ;; Author: Pieter E.J. Pareit <pieter.pareit@skynet.be> | 20 | ;; Author: Pieter E.J. Pareit <pieter.pareit@gmail.com> |
| 21 | ;; Maintainer: Pieter E.J. Pareit <pieter.pareit@skynet.be> | 21 | ;; Maintainer: Pieter E.J. Pareit <pieter.pareit@gmail.com> |
| 22 | ;; Created: 09 Nov 2002 | 22 | ;; Created: 09 Nov 2002 |
| 23 | ;; Version: 0.1 | 23 | ;; Version: 0.1 |
| 24 | ;; Keywords: Knuth mix mixal asm mixvm "The Art Of Computer Programming" | 24 | ;; Keywords: Knuth mix mixal asm mixvm "The Art Of Computer Programming" |
| @@ -27,17 +27,17 @@ | |||
| 27 | ;; Major mode for the mix asm language. | 27 | ;; Major mode for the mix asm language. |
| 28 | ;; The mix asm language is described in "The Art Of Computer Programming". | 28 | ;; The mix asm language is described in "The Art Of Computer Programming". |
| 29 | ;; | 29 | ;; |
| 30 | ;; For optimal use, also use GNU MDK. Compiling needs mixasm, running | 30 | ;; For optimal use, also use GNU MDK. Compiling needs mixasm, running |
| 31 | ;; and debugging needs mixvm and mixvm.el from GNU MDK. You can get | 31 | ;; and debugging needs mixvm and mixvm.el from GNU MDK. You can get |
| 32 | ;; GNU MDK from `https://savannah.gnu.org/projects/mdk/' and | 32 | ;; GNU MDK from `https://savannah.gnu.org/projects/mdk/' and |
| 33 | ;; `ftp://ftp.gnu.org/pub/gnu/mdk'. | 33 | ;; `ftp://ftp.gnu.org/pub/gnu/mdk'. |
| 34 | ;; | 34 | ;; |
| 35 | ;; To use this mode, place the following in your .emacs file: | 35 | ;; To use this mode, place the following in your .emacs file: |
| 36 | ;; `(load-file "/PATH-TO-FILE/mixal-mode.el")'. | 36 | ;; `(load-file "/PATH-TO-FILE/mixal-mode.el")'. |
| 37 | ;; When you load a file with the extension .mixal the mode will be started | 37 | ;; When you load a file with the extension .mixal the mode will be started |
| 38 | ;; automatic. If you want to start the mode manual, use `M-x mixal-mode'. | 38 | ;; automatic. If you want to start the mode manual, use `M-x mixal-mode'. |
| 39 | ;; Font locking will work, the behavior of tabs is the same as emacs | 39 | ;; Font locking will work, the behavior of tabs is the same as Emacs's |
| 40 | ;; default behavior. You can compile a source file with `C-c c' you can | 40 | ;; default behavior. You can compile a source file with `C-c c' you can |
| 41 | ;; run a compiled file with `C-c r' or run it in debug mode with `C-c d'. | 41 | ;; run a compiled file with `C-c r' or run it in debug mode with `C-c d'. |
| 42 | ;; You can get more information about a particular operation code by using | 42 | ;; You can get more information about a particular operation code by using |
| 43 | ;; mixal-describe-operation-code or `C-h o'. | 43 | ;; mixal-describe-operation-code or `C-h o'. |
| @@ -45,6 +45,15 @@ | |||
| 45 | ;; Have fun. | 45 | ;; Have fun. |
| 46 | 46 | ||
| 47 | ;;; History: | 47 | ;;; History: |
| 48 | ;; Version 0.3: | ||
| 49 | ;; 08/10/05: sync mdk and emacs cvs | ||
| 50 | ;; from emacs: compile-command and require-final-newline | ||
| 51 | ;; from mdk: see version 0.2 | ||
| 52 | ;; correct my email address | ||
| 53 | ;; Version 0.2: | ||
| 54 | ;; 06/04/05: mixasm no longer needs -g option | ||
| 55 | ;; fontlocking of comments works in all? cases now | ||
| 56 | ;; added some more mixal-operation-codes | ||
| 48 | ;; Version 0.1: | 57 | ;; Version 0.1: |
| 49 | ;; Version 0.1.1: | 58 | ;; Version 0.1.1: |
| 50 | ;; 22/11/02: bugfix in fontlocking, needed to add a '-' to the regex. | 59 | ;; 22/11/02: bugfix in fontlocking, needed to add a '-' to the regex. |
| @@ -54,7 +63,6 @@ | |||
| 54 | ;; 09/11/02: started mixal-mode. | 63 | ;; 09/11/02: started mixal-mode. |
| 55 | 64 | ||
| 56 | ;;; Code: | 65 | ;;; Code: |
| 57 | |||
| 58 | (defvar compile-command) | 66 | (defvar compile-command) |
| 59 | 67 | ||
| 60 | ;;; Key map | 68 | ;;; Key map |
| @@ -66,13 +74,13 @@ | |||
| 66 | (define-key map "\C-ho" 'mixal-describe-operation-code) | 74 | (define-key map "\C-ho" 'mixal-describe-operation-code) |
| 67 | map) | 75 | map) |
| 68 | "Keymap for `mixal-mode'.") | 76 | "Keymap for `mixal-mode'.") |
| 69 | ; (makunbound 'mixal-mode-map) | 77 | ;; (makunbound 'mixal-mode-map) |
| 70 | 78 | ||
| 71 | ;;; Syntax table | 79 | ;;; Syntax table |
| 72 | (defvar mixal-mode-syntax-table | 80 | (defvar mixal-mode-syntax-table |
| 73 | (let ((st (make-syntax-table))) | 81 | (let ((st (make-syntax-table))) |
| 74 | (modify-syntax-entry ?* "<" st) | 82 | ;; (modify-syntax-entry ?* "<" st) we need to do a bit more to make |
| 75 | (modify-syntax-entry ?\n ">" st) | 83 | ;; (modify-syntax-entry ?\n ">" st) fontlocking for comments work |
| 76 | st) | 84 | st) |
| 77 | "Syntax table for `dot-mode'.") | 85 | "Syntax table for `dot-mode'.") |
| 78 | 86 | ||
| @@ -97,6 +105,7 @@ value.") | |||
| 97 | "LD4" "LD5" "LD6" "LDX" "LDAN" "LD1N" "LD2N" "LD3N" "LD4N" "LD5N" "LD6N" | 105 | "LD4" "LD5" "LD6" "LDX" "LDAN" "LD1N" "LD2N" "LD3N" "LD4N" "LD5N" "LD6N" |
| 98 | "LDXN" "STA" "ST1" "ST2" "ST3" "ST4" "ST5" "ST6" "STX" "STJ" "STZ" "JBUS" | 106 | "LDXN" "STA" "ST1" "ST2" "ST3" "ST4" "ST5" "ST6" "STX" "STJ" "STZ" "JBUS" |
| 99 | "IOC" "IN" "OUT" "JRAD" "JMP" "JSJ" "JOV" "JNOV" | 107 | "IOC" "IN" "OUT" "JRAD" "JMP" "JSJ" "JOV" "JNOV" |
| 108 | "JL" "JE" "JG" "JGE" "JNE" "JLE" | ||
| 100 | "JAN" "J1N" "J2N" "J3N" "J4N" "J5N" "J6N" "JXN" | 109 | "JAN" "J1N" "J2N" "J3N" "J4N" "J5N" "J6N" "JXN" |
| 101 | "JAZ" "J1Z" "J2Z" "J3Z" "J4Z" "J5Z" "J6Z" "JXZ" | 110 | "JAZ" "J1Z" "J2Z" "J3Z" "J4Z" "J5Z" "J6Z" "JXZ" |
| 102 | "JAP" "J1P" "J2P" "J3P" "J4P" "J5P" "J6P" "JXP" | 111 | "JAP" "J1P" "J2P" "J3P" "J4P" "J5P" "J6P" "JXP" |
| @@ -109,11 +118,11 @@ value.") | |||
| 109 | "INCX" "DECX" "ENTX" "ENNX" "CMPA" "FCMP" "CMP1" "CMP2" "CMP3" "CMP4" | 118 | "INCX" "DECX" "ENTX" "ENNX" "CMPA" "FCMP" "CMP1" "CMP2" "CMP3" "CMP4" |
| 110 | "CMP5" "CMP6" "CMPX") | 119 | "CMP5" "CMP6" "CMPX") |
| 111 | "List of possible operation codes as strings.") | 120 | "List of possible operation codes as strings.") |
| 112 | ; (makunbound 'mixal-operation-codes) | 121 | ;; (makunbound 'mixal-operation-codes) |
| 113 | 122 | ||
| 114 | (defvar mixal-assembly-pseudoinstructions | 123 | (defvar mixal-assembly-pseudoinstructions |
| 115 | '("ORIG" "EQU" "CON" "ALF" "END") | 124 | '("ORIG" "EQU" "CON" "ALF" "END") |
| 116 | "List of possible assembly pseudoinstructions") | 125 | "List of possible assembly pseudoinstructions.") |
| 117 | 126 | ||
| 118 | ;;; Font-locking: | 127 | ;;; Font-locking: |
| 119 | (defvar mixal-font-lock-keywords | 128 | (defvar mixal-font-lock-keywords |
| @@ -124,10 +133,13 @@ value.") | |||
| 124 | (,(regexp-opt | 133 | (,(regexp-opt |
| 125 | mixal-assembly-pseudoinstructions 'words) | 134 | mixal-assembly-pseudoinstructions 'words) |
| 126 | . mixal-font-lock-assembly-pseudoinstruction-face) | 135 | . mixal-font-lock-assembly-pseudoinstruction-face) |
| 127 | ("^[A-Z0-9a-z]*[ \t]+[A-Z0-9a-z]+[ \t]+[\\-A-Z0-9a-z,():]*[\t]+\\(.*\\)$" | 136 | ("^[A-Z0-9a-z]*[ \t]+[A-ZO-9a-z]+[ \t]+\\(=.*=\\).*$" |
| 128 | (1 font-lock-comment-face))) | 137 | (1 font-lock-constant-face)) |
| 138 | ("^[A-Z0-9a-z]*[ \t]+[A-Z0-9a-z]+[ \t]+[A-Z0-9a-z,():+-\\*=\" ]*\t+\\(.*\\)$" | ||
| 139 | (1 font-lock-comment-face)) | ||
| 140 | ("^\\*.*$" . font-lock-comment-face)) | ||
| 129 | "Keyword highlighting specification for `mixal-mode'.") | 141 | "Keyword highlighting specification for `mixal-mode'.") |
| 130 | ; (makunbound 'mixal-font-lock-keywords) | 142 | ;; (makunbound 'mixal-font-lock-keywords) |
| 131 | 143 | ||
| 132 | ;;;; Compilation | 144 | ;;;; Compilation |
| 133 | ;; Output from mixasm is compatible with default behavior of emacs, | 145 | ;; Output from mixasm is compatible with default behavior of emacs, |
| @@ -139,19 +151,24 @@ value.") | |||
| 139 | ;;;; Describe | 151 | ;;;; Describe |
| 140 | (defvar mixal-operation-codes-alist '() | 152 | (defvar mixal-operation-codes-alist '() |
| 141 | "Alist that contains all the possible operation codes for mix. | 153 | "Alist that contains all the possible operation codes for mix. |
| 142 | Each elt has the form (OP-CODE GROUP FULL-NAME C-BYTE F-BYTE DESCRIPTION EXECUTION-TIME) | 154 | Each elt has the form |
| 143 | Where OP-CODE is the text of the opcode as an symbol, FULL-NAME is the human readable name | 155 | (OP-CODE GROUP FULL-NAME C-BYTE F-BYTE DESCRIPTION EXECUTION-TIME) |
| 144 | as a string, C-BYTE is the operation code telling what operation is to be performed, F-BYTE holds | 156 | Where OP-CODE is the text of the opcode as an symbol, |
| 145 | an modification of the operation code which can be a symbol or a number, DESCRIPTION contains | 157 | FULL-NAME is the human readable name as a string, |
| 146 | an string with a description about the operation code and EXECUTION-TIME holds info | 158 | C-BYTE is the operation code telling what operation is to be performed, |
| 147 | about the time it takes, number or string.") | 159 | F-BYTE holds a modification of the operation code which can be a symbol |
| 148 | ; (makunbound 'mixal-operation-codes-alist) | 160 | or a number, |
| 149 | 161 | DESCRIPTION contains an string with a description about the operation code and | |
| 150 | (defun mixal-add-operation-code (op-code group full-name C-byte F-byte description execution-time) | 162 | EXECUTION-TIME holds info about the time it takes, number or string.") |
| 151 | "Add an operation code to the list that contains information about possible op code's." | 163 | ;; (makunbound 'mixal-operation-codes-alist) |
| 152 | (setq mixal-operation-codes-alist (cons (list op-code group full-name C-byte F-byte | 164 | |
| 153 | description execution-time) | 165 | (defun mixal-add-operation-code (op-code group full-name C-byte F-byte |
| 154 | mixal-operation-codes-alist ))) | 166 | description execution-time) |
| 167 | "Add an operation code to `mixal-operation-codes-alist'." | ||
| 168 | (setq mixal-operation-codes-alist | ||
| 169 | (cons (list op-code group full-name C-byte F-byte | ||
| 170 | description execution-time) | ||
| 171 | mixal-operation-codes-alist))) | ||
| 155 | 172 | ||
| 156 | ;; now add each operation code | 173 | ;; now add each operation code |
| 157 | 174 | ||
| @@ -1250,7 +1267,8 @@ The converted character representation is stored in rAX." | |||
| 1250 | (defun mixal-describe-operation-code (&optional op-code) | 1267 | (defun mixal-describe-operation-code (&optional op-code) |
| 1251 | "Display the full documentation of OP-CODE." | 1268 | "Display the full documentation of OP-CODE." |
| 1252 | (interactive) | 1269 | (interactive) |
| 1253 | ;; we like to provide completition and history, so do it ourself (interactive "?bla")? | 1270 | ;; We like to provide completion and history, so do it ourself |
| 1271 | ;; (interactive "?bla")? | ||
| 1254 | (unless op-code | 1272 | (unless op-code |
| 1255 | (let* ((completion-ignore-case t) | 1273 | (let* ((completion-ignore-case t) |
| 1256 | ;; we already have a list, but it is not in the right format | 1274 | ;; we already have a list, but it is not in the right format |
| @@ -1282,13 +1300,14 @@ The converted character representation is stored in rAX." | |||
| 1282 | 1300 | ||
| 1283 | ;;;; Running | 1301 | ;;;; Running |
| 1284 | (defun mixal-run () | 1302 | (defun mixal-run () |
| 1285 | "Run's mixal file in current buffer, assumes that file has been compiled" | 1303 | "Run mixal file in current buffer, assumes that file has been compiled." |
| 1286 | (interactive) | 1304 | (interactive) |
| 1287 | (mixvm (concat "mixvm -r -t -d " | 1305 | (mixvm (concat "mixvm -r -t -d " |
| 1288 | (file-name-sans-extension (buffer-file-name))))) | 1306 | (file-name-sans-extension (buffer-file-name))))) |
| 1289 | 1307 | ||
| 1290 | (defun mixal-debug () | 1308 | (defun mixal-debug () |
| 1291 | "Starts mixvm for debugging, assumes that file has been compiled with debugging support" | 1309 | "Start mixvm for debugging. |
| 1310 | Assumes that file has been compiled with debugging support." | ||
| 1292 | (interactive) | 1311 | (interactive) |
| 1293 | (mixvm (concat "mixvm " | 1312 | (mixvm (concat "mixvm " |
| 1294 | (file-name-sans-extension (buffer-file-name))))) | 1313 | (file-name-sans-extension (buffer-file-name))))) |
| @@ -1300,9 +1319,9 @@ The converted character representation is stored in rAX." | |||
| 1300 | (set (make-local-variable 'comment-start) "*") | 1319 | (set (make-local-variable 'comment-start) "*") |
| 1301 | (set (make-local-variable 'comment-start-skip) "*") | 1320 | (set (make-local-variable 'comment-start-skip) "*") |
| 1302 | (set (make-local-variable 'font-lock-defaults) '(mixal-font-lock-keywords)) | 1321 | (set (make-local-variable 'font-lock-defaults) '(mixal-font-lock-keywords)) |
| 1303 | ; might add an indent function in the future | 1322 | ;; might add an indent function in the future |
| 1304 | ; (set (make-local-variable 'indent-line-function) 'mixal-indent-line) | 1323 | ;; (set (make-local-variable 'indent-line-function) 'mixal-indent-line) |
| 1305 | (set (make-local-variable 'compile-command) (concat "mixasm -g " | 1324 | (set (make-local-variable 'compile-command) (concat "mixasm " |
| 1306 | buffer-file-name)) | 1325 | buffer-file-name)) |
| 1307 | ;; mixasm will do strange when there is no final newline, | 1326 | ;; mixasm will do strange when there is no final newline, |
| 1308 | ;; so let Emacs ensure that it is always there | 1327 | ;; so let Emacs ensure that it is always there |
| @@ -1314,5 +1333,5 @@ The converted character representation is stored in rAX." | |||
| 1314 | 1333 | ||
| 1315 | (provide 'mixal-mode) | 1334 | (provide 'mixal-mode) |
| 1316 | 1335 | ||
| 1317 | ;;; arch-tag: be7c128a-bf61-4951-a90e-9398267ce3f3 | 1336 | ;; arch-tag: be7c128a-bf61-4951-a90e-9398267ce3f3 |
| 1318 | ;;; mixal-mode.el ends here | 1337 | ;;; mixal-mode.el ends here |