Deprecated: The each() function is deprecated. This message will be suppressed on further calls in /home/zhenxiangba/zhenxiangba.com/public_html/phproxy-improved-master/index.php on line 456
;; clu-more.el ;; found someplace on athena in the 6.170 locker . ;; author unknown. (provide 'clu-debug) (provide 'clu-indent-buffer) (defvar clu-debug-process nil) (defvar clu-debug-mode-map nil) ;; Set the extra key bindings for clu-mode (setq clu-mode-hook '(lambda () (local-set-key "\^\\j" 'clu-debug) (local-set-key "\^\\e" 'next-error) (local-set-key "\^\\i" 'clu-indent-buffer))) (defun clu-debug () "Begins or continues a CLU debugger" (interactive) (if clu-debug-process (if (or (not (eq (process-status clu-debug-process) 'run)) (not (yes-or-no-p "Continue current debugger? "))) (progn (kill-process clu-debug-process) (sit-for 1) (delete-process clu-debug-process) (delete-windows-on (process-buffer clu-debug-process)) (setq clu-debug-process nil)) (let* ((buf (process-buffer clu-debug-process))) (message "Continuing debug....") (pop-to-buffer buf) (set-window-start (get-buffer-window buf) (- (point) 30)))) (call-interactively 'start-clu-debug))) (defun start-clu-debug (jcl) (interactive) (list (read-input "JCL = " "")) (setq clu-debug-process (start-process "clu-debugger" "*debug*" shell-file-name "-c" (concat "exec debug " jcl))) (with-output-to-temp-buffer "*debug*" (princ "cd ") (princ default-directory) (terpri) (princ (concat "debug " jcl)) (terpri)) (progn (pop-to-buffer (process-buffer clu-debug-process)) (clu-debug-mode)) (set-process-filter clu-debug-process 'clu-debug-filter)) (if (not clu-debug-mode-map) (progn (setq clu-debug-mode-map (make-sparse-keymap)) (define-key clu-debug-mode-map "\e&" 'clu-debug-go-end) (define-key clu-debug-mode-map "\r" 'clu-debug-command) (define-key clu-debug-mode-map "\^z" 'suspend-clu-debug) (define-key clu-debug-mode-map "\^\\" 'send-clu-debug-interrupt))) (defun clu-debug-mode () (interactive) (use-local-map clu-debug-mode-map) (setq mode-name "clu-debug") (setq major-mode 'clu-debug-mode)) (defun clu-debug-command () "Gets next command from debug-mode buffer" (interactive) (skip-chars-forward " \t") (if (not (equal (point) (point-max))) (insert-string "\n") (beginning-of-line) (skip-chars-forward ": \t") (set-mark (point)) (setq command (buffer-substring (point) (progn (end-of-line) (point)))) (goto-char (mark)) (delete-region (point) (point-max)) (send-string clu-debug-process (concat command "\n")))) (defun send-clu-debug-interrupt () (interactive) (send-string clu-debug-process "\034")) (defun clu-debug-go-end () "Just puts cursor on proper command line" (interactive) (goto-char (point-max))) (defvar clu-debug-regexp "^JCL =" "") (defun clu-debug-filter (proc string) "This gets called with each string the debugger outputs. Removes ^M's and also checks to see if JCL is being prompted for." (set-buffer (process-buffer proc)) (goto-char (point-max)) (let ((save-pos (point)) save-pos2 save-pos3) (insert-string string) (beginning-of-line) (while (re-search-forward clu-debug-regexp nil t) (setq save-pos2 (match-beginning 0)) (setq save-pos3 (match-end 0)) (save-excursion (goto-char (match-beginning 0)) (cond ((looking-at "JCL =") (call-interactively 'get-jcl))))) (goto-char save-pos) (while (re-search-forward "\^M" nil t) (delete-backward-char 1))) (goto-char (point-max))) (defun get-jcl (jcl) "Gets JCL if none specified on command line" (goto-char (point-max)) (interactive (list (read-input "Enter JCL: "))) (send-string clu-debug-process (concat jcl "\n"))) (defun suspend-clu-debug () "Removes debugging window" (interactive) (delete-windows-on (process-buffer clu-debug-process))) (defun clu-indent-buffer () "Saves current buffer, runs a standalone indenter on visited file, and then reloads this file into buffer" (interactive) (let ((errbuf (generate-new-buffer "*clu-indent*"))) (progn (display-buffer errbuf) (save-buffer (current-buffer)) (message "Indenting....") (call-process shell-file-name nil errbuf nil "-c" (concat "exec clu_indent " (buffer-file-name (current-buffer)))) (revert-buffer t t) (message "done"))))