;ELC ;;; Compiled ;;; in Emacs version 28.0.50 ;;; with all optimizations. (require 'matlab) #@66 Port used for the Emacs server listening for MATLAB connections. (defvar matlab-netshell-listen-port 32475 (#$ . 105)) #@36 Name used for the Netshell server. (defvar matlab-netshell-server-name "*MATLAB netshell*" (#$ . 230)) #@58 List of clients created from the MATLAB netshell server. (defvar matlab-netshell-clients nil (#$ . 339)) #@62 Return non-nil if there is an active MATLAB netshell server. (defalias 'matlab-netshell-server-active-p #[nil "\302!\211\205\303 !\205\304)\207" [matlab-netshell-server-name buff get-buffer get-buffer-process t] 3 (#$ . 450)]) #@35 Start the MATLAB netshell server. (defalias 'matlab-netshell-server-start #[nil "\303\304\305\306\307\310\311\312 \313\314\315\316\317\320&\210\321\211\207" [matlab-netshell-server-name matlab-netshell-listen-port matlab-netshell-clients make-network-process :name :buffer :family ipv4 :host local :service :filter matlab-netshell-filter :sentinel matlab-netshell-sentinel :server t nil] 17 (#$ . 689) nil]) #@27 Return a netshell client. (defalias 'matlab-netshell-client #[nil "@\207" [matlab-netshell-clients] 1 (#$ . 1107)]) #@34 Stop the MATLAB Netshell server. (defalias 'matlab-netshell-server-stop #[nil "\304\211\203\n@\305 !\210\nA\211\204*\304\305 !\207" [matlab-netshell-clients C --dolist-tail-- matlab-netshell-server-name nil delete-process] 3 (#$ . 1230) nil]) #@41 Text Accumulator for MATLAB's netshell. (defvar matlab-netshell-acc "" (#$ . 1489)) (make-variable-buffer-local 'matlab-netshell-acc) #@93 Filter used for MATLAB Netshell processes. PROC is the TCP connection that produced STRING. (defalias 'matlab-netshell-filter #[(proc string) " P\306\307\"\205N\310\211\224O\310\225\311O\n\312\230\204J\306\313\n\"\204(\314\315!\210\n\310\211\224O\310\225\nG V\203>\n \311O\202?\312)\316 \f#\210*)\202\207" [matlab-netshell-acc string cmdstr me data cmd string-match "" 0 nil "" "\n" message "Unable to find command in MATLAB command. Ignoring." matlab-netshell-execute-command proc] 4 (#$ . 1629)]) #@215 For MATLAB associated with PROC, execute CMD with DATA. The CMD is a request from MATLAB to do something in Emacs. A common command might be to display data to the user as a response from some Emacs based request. (defalias 'matlab-netshell-execute-command #[(proc cmd data) "r\306!q\210db\210i\307U\204\310c\210\311 \312\261\210\n\313\230\204$\314\n\310\261\210) \315\230\203Sr\306!q\210\316 \210)\317 \204O\320 \211\205E\321\322 \" \203N\323\f!\210*\324\325!\207 \326\230\203b\324\327!\210\330\331\313\"\207 \331\230\203l\324\332!\207 \333\230\203w\324\334\n\"\207 \335\230\203\202\324\336\n\"\207 \337\230\203\221\340\n!\341 !)\207\324\342 \"\207" [proc cmd data ecc ecca forms process-buffer 0 "\n" "Command: [" "]\n" "" "Data: :" "init" matlab-shell-mode-gud-enable-bindings matlab-shell-active-p matlab-shell--get-emacsclient-command format "emacs.set('clientcmd', '%s');" matlab-netshell-eval message "MATLAB connection initialized." "ack" "Ack recieved. Send ACK back." matlab-netshell-send "nowledge" "Acknowledgement recieved." "output" "Ouput: %S" "error" "MATLAB Error: %s" "eval" read eval "Unknown command from matlab: %S"] 4 (#$ . 2156)]) #@151 Sentinel used for MATLAB Netshell processes. Identify when a connection is lost, and close down services. PROC is the TCP stream which generated MSG. (defalias 'matlab-netshell-sentinel #[(proc msg) "\304\305\"\203 \nB\306\307 !!\310 \"\210)\311\312!\207\313\230\203,\314 \n\"\311\315\316!!\207\311\317!\207" [msg proc matlab-netshell-clients newbuff string-match "^open from " get-buffer-create process-name set-process-buffer message "MATLAB Has connected!" "connection broken by remote peer\n" delq format "MATLAB has dropped its connecction" "Unhandled event."] 3 (#$ . 3337)]) #@58 Send a command CMD to MATLAB shell connection with DATA. (defalias 'matlab-netshell-send #[(cmd data) "@\211\203\304 \n\305 \306R\"\202\307\310!)\207" [matlab-netshell-clients C cmd data process-send-string "\n" "" error "No MATLAB network connection to send to"] 7 (#$ . 3934)]) #@59 Send MCODE to the active MATLAB shell connection to eval. (defalias 'matlab-netshell-eval #[(mcode) "@\211\203\303 \304\n\305Q\"\202\306\307!)\207" [matlab-netshell-clients C mcode process-send-string "eval\n" "" error "No MATLAB network connection to send to"] 6 (#$ . 4227) "sMCode: "]) #@59 Send MCODE to the active MATLAB shell connection to eval. (defalias 'matlab-netshell-evalc #[(mcode) "@\211\203\303 \304\n\305Q\"\202\306\307!)\207" [matlab-netshell-clients C mcode process-send-string "evalc\n" "" error "No MATLAB network connection to send to"] 6 (#$ . 4529) "sMCode: "]) #@49 Send an ACK to MATLAB to see if it can respond. (defalias 'matlab-netshell-ack #[nil "\300\301\302\"\207" [matlab-netshell-send "ack" ""] 3 (#$ . 4833) nil]) (provide 'matlab-netshell)