⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 matlab-eei.el

📁 Servlet,处理客户端输入,调查问卷,发送非HTML文档,获取Servlet配置参数,Cookie会话跟踪
💻 EL
📖 第 1 页 / 共 4 页
字号:
(defun matlab-eei-event-stop-if (conditions)   (matlab-eei-set-stop-if-state "error" (nth 0 conditions))  (matlab-eei-set-stop-if-state "caught_error" (nth 1 conditions))  (matlab-eei-set-stop-if-state "warning" (nth 2 conditions))  (matlab-eei-set-stop-if-state "nan_inf" (nth 3 conditions)))     ;; +------------------------------------+;; | Debug Cursor                       |;; +------------------------------------+(if (fboundp 'move-overlay)    (defalias 'matlab-eei-move-marker 'move-overlay)  (defun matlab-eei-move-marker (marker beg end &optional buffer)    "Set the endpoints of MARKER to BEG and END in BUFFER.If MARKER is omitted, leave MARKER in the same buffer it inhabits now.If MARKER is omitted, and MARKER is in no buffer, put it in the currentbuffer."    (if (null buffer)	(setq buffer (extent-object marker)))    (if (null buffer)	(setq buffer (current-buffer)))    (check-argument-type 'bufferp buffer)    (and (= beg end)	 (extent-property marker 'evaporate)	 (delete-extent marker))    (when (> beg end)      (setq beg (prog1 end (setq end beg))))    (set-extent-endpoints marker beg end buffer)    marker))(defun matlab-eei-set-debug-cursor-position ()  (cond    ((string= (car matlab-eei-debug-cursor-type) "arrow")    (setq overlay-arrow-string "=>")    (or overlay-arrow-position	(setq overlay-arrow-position (make-marker)))    (set-marker overlay-arrow-position (point) (current-buffer)))   (t    (matlab-eei-move-marker     matlab-eei-highlight-cursor      (line-beginning-position)     (line-end-position) (current-buffer)))))(defun matlab-eei-hide-debug-cursor ()   (cond    ((string= (car matlab-eei-debug-cursor-type) "arrow")    (setq overlay-arrow-position nil))   (t    (if (featurep 'xemacs)	(delete-extent matlab-eei-highlight-cursor)      (delete-overlay matlab-eei-highlight-cursor)))))(defun matlab-eei-move-debug-cursor (file line)  "Moves the debug cursor to LINE in FILE."  (let* ((buffer (matlab-eei-find-file file))	 (window 	  (and buffer	       (or (get-buffer-window buffer)		   (selected-window))))	  pos)     (if buffer	(progn	  (if (not (get-buffer-window buffer))	      (set-window-buffer window buffer))	  (save-excursion	    (set-buffer buffer)	    (save-restriction	      (widen)	      (goto-line line)	      (setq pos (point))	      (matlab-eei-set-debug-cursor-position))	    (cond ((or (< pos (point-min)) (> pos (point-max)))		   (widen)		   (goto-char pos))))	  (set-window-point window pos)))))	 (defun matlab-eei-event-stop (file line)  "Handles a stop event from MATLAB. This function moves thedebug cursor to LINE number in FILE. It then raises the Emacswindow to the top of the user's desktop."  ;; (message "stop event at %d in %s" line file)  (if (not (buffer-modified-p))      (progn	(raise-frame)	(setq matlab-eei-matlab-in-debug-mode-p t)	;;(setq matlab-eei-matlab-stopped-p t)	(setq matlab-eei-last-event "stop")	;; If the user issues a step command and the current line is	;; the last line in a function, MATLAB issues an open-document-to-line	;; command with the line number equal to the negative of the last line	;; in the M-file and then issues a stop event with the same negative	;; line number. In this case, we issue another step command to	;; move back to the line that invoked the function.	(if (< line 0)	    (matlab-eei-step)	  (matlab-eei-move-debug-cursor file line)))));; +-----------------------------------------+;; | Step Commands                           |;; +-----------------------------------------+(defun matlab-eei-step ()   "Ask MATLAB to advance to the next program line that isnot a function call. This command signals an error ifMATLAB is not stopped or the bufferis modified."  (interactive)  (matlab-run-in-matlab-mode-only   (if matlab-eei-matlab-in-debug-mode-p       (if (not (buffer-modified-p))	   (progn	     (matlab-eei-send-mcmd "step")	     ;; (setq matlab-eei-matlab-stopped-p nil)	     )	 (error "Cannot step in a modified buffer."))     (error "MATLAB is not stopped."))))	(defun matlab-eei-step-in ()  "Ask MATLAB to advance to the next program line."  (interactive)  (matlab-run-in-matlab-mode-only   (if matlab-eei-matlab-in-debug-mode-p       (if (not (buffer-modified-p))	   (progn	     (matlab-eei-send-mcmd "step_in")	     ;; (setq matlab-eei-matlab-stopped-p nil)	     )	 (error "Cannot step in a modified buffer."))     (error "MATLAB is not stopped."))))(defun matlab-eei-step-out ()  "Ask MATLAB to advance to the next program line."  (interactive)  (matlab-run-in-matlab-mode-only   (if matlab-eei-matlab-in-debug-mode-p       (if (not (buffer-modified-p))	   (progn	     (matlab-eei-send-mcmd "step_out")	     ;; (setq matlab-eei-matlab-stopped-p nil)	     )	 (error "Cannot step in a modified buffer."))     (error "MATLAB is not stopped."))))(defvar matlab-eei-go-until-cursor-mode-p nil  "Nonnil if Emacs is in go-until-cursor-mode")(defun matlab-eei-go-until-cursor ()   "Ask MATLAB to advance the program to the current line in the buffer."  (interactive)  (if matlab-eei-matlab-in-debug-mode-p      (matlab-run-in-matlab-mode-only	  (if (not (buffer-modified-p))	      (let ((file (if (eq system-type 'windows-nt) 			      (downcase (buffer-file-name))			    (buffer-file-name))) 		    (line (matlab-eei-get-line-at-point)))		(if (matlab-eei-breakpoint-exists-p file line)		    (matlab-eei-continue)		  (progn		    (setq matlab-eei-go-until-cursor-mode-p t)		    (matlab-eei-request-set-breakpoint file line)		    (if (string= (matlab-eei-wait-for-event) "set-breakpoint")			(progn			  (matlab-eei-continue)			  (matlab-eei-wait-for-event)			  (matlab-eei-request-clear-breakpoint file line)			  (setq matlab-eei-go-until-cursor-mode-p nil))		      (setq matlab-eei-go-until-cursor-mode-p nil)		      (error "Could not set temporary breakpoint.")))))	    (error "Cannot go until cursor in a modified buffer.")))    (error "MATLAB is not stopped.")))(defvar matlab-eei-run-parameter-history '("()")  "Keep track of parameters passed to MATLAB when runningM-files.")(defun matlab-eei-run ()  "Run the M-file in the current buffer."  (interactive)  (matlab-run-in-matlab-mode-only   (let ((fn-name (file-name-sans-extension		   (file-name-nondirectory (buffer-file-name))))	 (param ""))     (if (and (buffer-modified-p)	      (yes-or-no-p "Save changes in buffer first?"))	 (save-buffer))     ;; Do we need parameters?     (if (save-excursion	   (goto-char (point-min))	   (end-of-line)	   (forward-sexp -1)	   (looking-at "([a-zA-Z ]"))	 (setq param (read-string "Parameters: "				  (car matlab-eei-run-parameter-history)				  'matlab-eei-run-parameter-history)))     (if (string= param "()")	 (setq param ""))     (matlab-eei-send-mcmd (format "run %s %s" fn-name param)))))	 (defun matlab-eei-continue ()  "Ask MATLAB to continue execution of a stopped program. This commandsignals an error if MATLAB is not stopped or the buffer is modified."  (interactive)  (matlab-run-in-matlab-mode-only   (if matlab-eei-matlab-in-debug-mode-p       (if (not (buffer-modified-p))	   (matlab-eei-send-mcmd "continue" t)	 (error "Cannot step in a modified buffer."))     (error "MATLAB is not stopped."))))(defun matlab-eei-run-continue ()  (interactive)  (if matlab-eei-matlab-in-debug-mode-p      (matlab-eei-continue)    (matlab-eei-run)))(defun matlab-eei-event-continue ()   "Handle a continue program execution event from MATLAB."  (matlab-eei-hide-debug-cursor)  ;; (setq matlab-eei-matlab-stopped-p nil)  (setq matlab-eei-matlab-in-debug-mode-p nil))(defun matlab-eei-exit-debug ()  "Ask MATLAB to exit debug mode."  (interactive)  (when matlab-eei-matlab-in-debug-mode-p    (matlab-eei-send-mcmd "exit_debug")))(defun matlab-eei-event-exit-debug ()  "Handles an exit debug event from MATLAB."  (matlab-eei-hide-debug-cursor)  ;; (setq matlab-eei-matlab-stopped-p nil)  (setq matlab-eei-matlab-in-debug-mode-p nil))(defun matlab-eei-eval-region (beg end)  "Run region from BEG to END and display result in MATLAB commandwindow. "  (interactive "r")  (if (> beg end) (let (mid) (setq mid beg beg end end mid)))  (let ((command 	 (let ((str 		(concat 		 (buffer-substring-no-properties beg end)		 "\n")))	   (while (string-match "\n\\s-*\n" str)	     (setq str (concat 			(substring str 0 (match-beginning 0))			"\n"			(substring str (match-end 0)))))	   str)))	     (matlab-eei-eval-m-expr command))) ;; +-----------------------------------------+;; | Stack Navigation                        |;; +-----------------------------------------+(defvar matlab-eei-stack "<Base>"  "List of M function names representing the current stack. The firstitem in the list is the top of the stack, i.e., the function in whichMATLAB is currently stopped. The bottom of the list is MATLAB itselfrepresented by the notation <BASE>.")(defvar matlab-eei-stack-pointer 0   "Zero-based index representing the locationof the stack pointer in `matlab-eei-stack'.The stack pointer points to the top of the stack aftera stop event. A user can move the pointer to otherlocations, using the Stack Navigator buffer.")(defun matlab-eei-bump-stack (frame)  "Go to FRAME on stack. FRAME is the positionof the frame relative to the top of the stack."  (matlab-eei-send-mcmd    (format "bump_stack %d" (- frame matlab-eei-stack-pointer))))(defconst matlab-eei-stack-navigator-name "MATLAB Stack Navigator")(defvar matlab-eei-widgets nil  "List of widgets in stack navigator buffer. This isa buffer-local variable.")(make-variable-buffer-local 'matlab-eei-widgets)(defun matlab-eei-refresh-stack-navigator (buffer) (save-excursion   (set-buffer buffer)   (let ((inhibit-read-only t))     ;; Clear buffer     (loop for widget in matlab-eei-widgets do       (widget-delete widget))     (if (featurep 'xemacs)	 (let ((extents (extent-list)))	   (loop for extent in extents do	     (delete-extent extent)))       (let ((overlays (overlays-in (point-min) (point-max))))	 (loop for overlay in overlays do	   (delete-overlay overlay))))     (setq widget-field-new nil)     (setq widget-field-list nil)     (erase-buffer)      (setq matlab-eei-widgets nil)     (widget-insert "MATLAB Stack\n\n")     (let ((i 0)	   button)       (loop for frame in matlab-eei-stack do	 (progn	   (widget-insert	    (format 	     " %s"	     (if (= i matlab-eei-stack-pointer) ">" " ")))	   (setq button		 (widget-create 		  'push-button 		    :notify 		    (lambda (button &rest ignore) 		      (matlab-eei-bump-stack		       (widget-get button :stack-pos)))		    frame))	   (widget-put button :stack-pos i)	   (widget-insert "\n")	   (setq matlab-eei-widgets		 (cons button matlab-eei-widgets))	   (setq i (1+ i)))))     (use-local-map widget-keymap)     (widget-setup))))(defun matlab-eei-display-stack-navigator ()  (interactive)  (let ((nav-buf (get-buffer matlab-eei-stack-navigator-name)))    (if (not nav-buf)	(progn	  (setq nav-buf (get-buffer-create matlab-eei-stack-navigator-name))	  (matlab-eei-refresh-stack-navigator nav-buf)))    (pop-to-buffer nav-buf)))(defun matlab-eei-event-stack-update (stack pointer)  "Function invoked by MATLAB when a workspace event occurs. STACK isa list of M function names representing the current stack.  POINTER is a zero-based integer index representing the stack pointer."  (setq matlab-eei-stack stack)  (setq matlab-eei-stack-pointer pointer)  (let ((nav-buf (get-buffer matlab-eei-stack-navigator-name)))    (if nav-buf	(matlab-eei-refresh-stack-navigator nav-buf))));; +-----------------------------------------+;; | Variable Display                        |;; +-----------------------------------------+(defvar matlab-eei-last-variable nil)(defun matlab-eei-display-variable ()  "Display the value of the variable at point."  (interactive)  (matlab-run-in-matlab-mode-only   (let ((variable (thing-at-point 'symbol)))     (if variable	 (matlab-eei-send-mcmd 	  (concat "display_variable " variable))))))(defun matlab-eei-event-variable-value (value)  "Handles response to a get variable valuecommand."  (setq matlab-eei-last-variable value)  (setq matlab-eei-last-event "variable-value"))

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -