[BACK]Return to asir-mode.el CVS log [TXT][DIR] Up to [local] / OpenXM_contrib2 / windows / post-msg-asirgui

Diff for /OpenXM_contrib2/windows/post-msg-asirgui/asir-mode.el between version 1.3 and 1.9

version 1.3, 2013/09/19 19:57:32 version 1.9, 2013/11/27 04:23:07
Line 2 
Line 2 
 ;;  ;;
 ;; asir-mode.el -- asir mode  ;; asir-mode.el -- asir mode
 ;;  ;;
 ;; $OpenXM: OpenXM_contrib2/windows/post-msg-asirgui/asir-mode.el,v 1.2 2013/08/29 17:39:29 ohara Exp $  
   
 ;; This program is free software: you can redistribute it and/or modify  ;; This program is free software: you can redistribute it and/or modify
 ;; it under the terms of the GNU General Public License as published by  ;; it under the terms of the GNU General Public License as published by
Line 10 
Line 9 
 ;; (at your option) any later version.  ;; (at your option) any later version.
   
 ;;;; AsirGUI for Windows  ;;;; AsirGUI for Windows
 (defvar asir-exec-path '("~/Desktop/asir/bin" "c:/Program Files/asir/bin" "c:/Program Files (x64)/asir/bin" "c:/asir/bin")  (defconst asir-exec-path-default '("~/Desktop/asir/bin" "c:/Program Files/asir/bin" "c:/Program Files (x64)/asir/bin" "c:/asir/bin")
   "Default search path for asir binary in Windows")    "Default Search path for asir binary in Windows")
   
 (defun asir-effective-exec-path ()  (defvar asir-exec-path asir-exec-path-default
     "Search path for asir binary")
   
   (defun asir-effective-exec-path ()
   "Search path for command"    "Search path for command"
   (let* ((dir (getenv "ASIR_ROOTDIR"))    (let* ((dir (getenv "ASIR_ROOTDIR"))
                  (path (append asir-exec-path exec-path)))                   (path (append asir-exec-path exec-path)))
         (if dir (cons (concat dir "/bin") path) path)))          (if dir (cons (concat dir "/bin") path) path)))
   
 (defun asir-executable-find (command)  (defun asir-executable-find (command)
   "Search for command"    "Search for command"
   (let* ((exec-path (asir-effective-exec-path)))    (let* ((exec-path (asir-effective-exec-path)))
         (executable-find command)))          (executable-find command)))
   
 ;;;; Asir for UNIX  (defun asir-start-asirgui ()
 (defvar asir-cmd-buffer-name "*asir-cmd*")    "Run asirgui"
   
 (defun asir-cmd-load (filename)  
   "Send `load' command to running asir process"  
   (if (eq system-type 'windows-nt)  
           (let ((exec-path (asir-effective-exec-path)))  
                 (start-process "asir-proc-cmdasir" nil "cmdasir" filename))  
         (save-excursion  
           (if (get-buffer asir-cmd-buffer-name)  
                   (progn  
                         (set-buffer asir-cmd-buffer-name)  
                         (goto-char (point-max))  
                         (insert (format "load(\"%s\");" filename))  
                         (comint-send-input))))))  
   
 (defun asir-start ()  
   "Start asir process"  
   (interactive)    (interactive)
   (if (eq system-type 'windows-nt)    (let ((exec-path (asir-effective-exec-path)))
     ;; for Windows          (start-process "asir-proc-asirgui" nil "asirgui")))
           (let ((exec-path (asir-effective-exec-path)))  
                 (start-process "asir-proc-asirgui" nil "asirgui"))  
     ;; for UNIX  
         (save-excursion  
           (if (not (get-buffer asir-cmd-buffer-name))  
                   (let ((current-frame (selected-frame)))  
                         (or (not window-system)  
                                 (select-frame (make-frame)))  
                         (shell (get-buffer-create asir-cmd-buffer-name)) ;; Switch to new buffer automatically  
                         (sleep-for 1)  
                         (goto-char (point-max))  
                         (insert "asir")  
                         (comint-send-input)  
                         (select-frame current-frame))))))  
   
 (defun asir-terminate ()  (defun asir-terminate-asirgui ()
   "Terminate asir process"    "Execute the current buffer on asir"
   (interactive)    (interactive)
   (if (eq system-type 'windows-nt)    (let ((exec-path (asir-effective-exec-path)))
     ;; for Windows          (start-process "asir-proc-cmdasir" nil "cmdasir" "--quit")))
           (let ((exec-path (asir-effective-exec-path)))  
                 (start-process "asir-proc-cmdasir" nil "cmdasir" "--quit"))  
     ;; for UNIX  
         (if (get-buffer asir-cmd-buffer-name)  
                 (if (not window-system)  
                         (let ((asir-cmd-window (get-buffer-window asir-cmd-buffer-name)))  
                           (and (kill-buffer asir-cmd-buffer-name)  
                                    (or (not asir-cmd-window) (delete-window asir-cmd-window))))  
                   (let ((asir-cmd-frame (window-frame (get-buffer-window asir-cmd-buffer-name 0))))  
                         (and (kill-buffer asir-cmd-buffer-name)  
                                  (delete-frame asir-cmd-frame)))))))  
   
 (defun asir-execute-current-buffer ()  (defun asir-execute-current-buffer-on-asir ()
   "Execute the current buffer on asir"    "Execute the current buffer on asir"
   (interactive)    (interactive)
   (let ((exec-path (asir-effective-exec-path)))    (let ((exec-path (asir-effective-exec-path)))
         (asir-cmd-load (buffer-file-name))))          (start-process "asir-proc-cmdasir" nil "cmdasir" (buffer-file-name))))
   
 (defun asir-execute-region ()  (defun asir-execute-region-on-asir ()
   "Execute the region on asir"    "Execute the region on asir"
   (interactive)    (interactive)
   (save-excursion    (save-excursion
         (if mark-active          (if mark-active
                 (let ((temp-file (make-temp-file (format "%s/cmdasir-" (or (getenv "TEMP") "/var/tmp"))))                  (let ((exec-path (asir-effective-exec-path))
                           (temp-buffer (generate-new-buffer " *asir-temp*")))                            (temp-file (make-temp-file (format "%s/cmdasir-" (getenv "TEMP")))))
                   (write-region (region-beginning) (region-end) temp-file)                    (write-region (region-beginning) (region-end) temp-file)
                   (set-buffer temp-buffer)                    (start-process "asir-proc-cmdasir" nil "cmdasir" temp-file)))))
                   (insert " end$")  
                   (write-region (point-min) (point-max) temp-file t) ;; append  
                   (kill-buffer temp-buffer)  
                   (asir-cmd-load temp-file)))))  
   
 ;;;; Extension for CC-mode.  ;;;; Extension for CC-mode.
   
Line 133 
Line 90 
   asir    asir
   (append (c-lang-const c-mode-menu c)    (append (c-lang-const c-mode-menu c)
                   '("----"                    '("----"
                         ["Start Asir" asir-start t]                          ["Start asirgui" asir-start-asirgui (eq system-type 'windows-nt)]
                         ["Terminate Asir" asir-terminate t]                          ["Terminate asirgui" asir-terminate-asirgui (eq system-type 'windows-nt)]
                         ["Execute Current Buffer on Asir" asir-execute-current-buffer (buffer-file-name)]                          ["Execute the current buffer on asir" asir-execute-current-buffer-on-asir
                         ["Execute Region on Asir" asir-execute-region mark-active]                           (and (eq system-type 'windows-nt) (buffer-file-name))]
                           ["Execute the region on asir" asir-execute-region-on-asir
                            (and (eq system-type 'windows-nt) mark-active)]
                         )))                          )))
   
 (defvar asir-font-lock-extra-types nil  (defvar asir-font-lock-extra-types nil
Line 168  Each list item should be a regexp matching a single id
Line 127  Each list item should be a regexp matching a single id
                       ;; Add bindings which are only useful for asir                        ;; Add bindings which are only useful for asir
                       map)                        map)
   "Keymap used in asir-mode buffers.")    "Keymap used in asir-mode buffers.")
   
 ;; Key binding for asir-mode  
 (define-key asir-mode-map (kbd "C-c s") 'asir-start)  
 (define-key asir-mode-map (kbd "C-c t") 'asir-terminate)  
 (define-key asir-mode-map (kbd "C-c l") 'asir-execute-current-buffer)  
 (define-key asir-mode-map (kbd "C-c r") 'asir-execute-region)  
   
 (easy-menu-define asir-menu asir-mode-map "asir Mode Commands"  (easy-menu-define asir-menu asir-mode-map "asir Mode Commands"
                   ;; Can use `asir' as the language for `c-mode-menu'                    ;; Can use `asir' as the language for `c-mode-menu'

Legend:
Removed from v.1.3  
changed lines
  Added in v.1.9

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>