diff --git a/OSN.asd b/OSN.asd index df8935e..e75277d 100644 --- a/OSN.asd +++ b/OSN.asd @@ -43,7 +43,8 @@ (:file "osn-to-os10" :depends-on ("pkgdef" "conditions" "osn")) (:file "ui-utils" :depends-on ("pkgdef" "globals" "conditions")) (:file "debugger-ui" :depends-on ("pkgdef" "globals" "conditions" "ui-utils")) - (:file "osn-viewer" :depends-on ("pkgdef" "globals" "conditions" "osn" "osn-parser" "osn-writer" "osn-to-os10" "ui-utils")) + (:file "osn-mode" :depends-on ("pkgdef" "globals" "conditions" "osn" "osn-parser" "osn-writer" "osn-to-os10")) + (:file "osn-viewer" :depends-on ("pkgdef" "globals" "conditions" "osn" "osn-parser" "osn-writer" "osn-to-os10" "ui-utils" "osn-mode")) (:file "xosc-viewer" :depends-on ("pkgdef" "globals" "conditions" "ui-utils")) (:file "win-ui" :depends-on ("pkgdef" "globals" "conditions" "ui-utils" "debugger-ui" "osn-viewer" "xosc-viewer"))) :depends-on ("lib"))) diff --git a/src/osn-mode.lisp b/src/osn-mode.lisp new file mode 100644 index 0000000..b5c63da --- /dev/null +++ b/src/osn-mode.lisp @@ -0,0 +1,75 @@ +;;;; OpenScenarioNext --- OpenScenario Language Design +;;;; This is copyrighted software. See documentation for terms. +;;;; +;;;; osn-mode.lisp --- OSN Editor Mode + +(cl:in-package "EDITOR") + +;;;; %File Description: +;;;; +;;;; OSN Editor Mode +;;;; + +(defun ensure-osn-mode () + nil) + +(defparameter *osn-syntax-table* + (create-syntax-table :string-escape #\\ + :escape #\\ + :nested nil + :double-comment #\/ + :second-comment #\* + :first-close-comment #\* + :second-close-comment #\/ + :string #\" + :close '(#\)) + :open '(#\() + :whitespace '(#\tab #\space + #\formfeed + #\newline + #\return))) + +(defmode "OSN" + :major-p t + :vars '((Paren-Pause-Period . nil) + (Highlight-Matching-Parens . t) + (Comment-Start . "/*") + (Comment-Begin . "/*") + (Comment-End . "*/")) + :syntax-table *osn-syntax-table*) + +(defcommand "OSN Mode" (p) + "Put current buffer in OSN mode." + "Put current buffer in OSN mode." + (declare (ignore p)) + (setf (buffer-major-mode (current-buffer)) "OSN")) + +(define-editor-mode-variable Compile-Region-Function "OSN" 'region-osn-compile) + +(define-editor-mode-variable Compile-Buffer-File-Function "OSN" + 'compile-osn-file-internal) + +(define-editor-mode-variable Evaluate-Region-Function "OSN" 'region-osn-eval) + +(defun region-osn-compile (&rest args) + (declare (ignore args)) + (error "Not available")) + +(defun compile-osn-file-internal (&rest args) + (declare (ignore args)) + (error "Not available")) + +(defun region-osn-eval (&rest args) + (declare (ignore args)) + (error "Not available")) + +(define-editor-mode-variable Find-Dspec-In-Buffer-Function "OSN" nil) + +(define-editor-mode-variable Mark-Defun-Possible "OSN" nil + "Predicate to determine if valid to mark a defun") + +(define-file-type-hook + ("osn") + (buffer type) + (declare (ignore type)) + (setf (editor:buffer-major-mode buffer) "OSN")) diff --git a/src/osn-viewer.lisp b/src/osn-viewer.lisp index 7aa0a8f..da3f5bb 100644 --- a/src/osn-viewer.lisp +++ b/src/osn-viewer.lisp @@ -15,7 +15,8 @@ (make-instance 'osn-viewer :source nil :osn-buffer - (editor:make-buffer "Unknown" :temporary t)) + (editor:make-buffer "Unknown" :temporary t + :modes '("OSN"))) :screen (derive-main-interface-screen interface)))