+++ /dev/null
-;;; Copyright (C) 2007, 2008 Z RESEARCH Inc. <http://www.zresearch.com>\r
-;;; \r
-;;; This program is free software; you can redistribute it and/or modify\r
-;;; it under the terms of the GNU General Public License as published by\r
-;;; the Free Software Foundation; either version 2 of the License, or\r
-;;; (at your option) any later version.\r
-;;; \r
-;;; This program is distributed in the hope that it will be useful,\r
-;;; but WITHOUT ANY WARRANTY; without even the implied warranty of\r
-;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
-;;; GNU General Public License for more details.\r
-;;; \r
-;;; You should have received a copy of the GNU General Public License\r
-;;; along with this program; if not, write to the Free Software\r
-;;; Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.\r
-;;; \r
-\r
-(defvar glusterfs-mode-hook nil)\r
-\r
-;; (defvar glusterfs-mode-map\r
-;; (let ((glusterfs-mode-map (make-keymap)))\r
-;; (define-key glusterfs-mode-map "\C-j" 'newline-and-indent)\r
-;; glusterfs-mode-map)\r
-;; "Keymap for WPDL major mode")\r
-\r
-(add-to-list 'auto-mode-alist '("\\.vol\\'" . glusterfs-mode))\r
-\r
-(defconst glusterfs-font-lock-keywords-1\r
- (list\r
- ; "cluster/{unify,afr,stripe}" \r
- ; "performance/{io-cache,io-threads,write-behind,read-ahead,stat-prefetch}"\r
- ; "protocol/{client/server}"\r
- ; "features/{trash,posix-locks,fixed-id,filter}"\r
- ; "stroage/posix"\r
- ; "encryption/rot-13"\r
- ; "debug/trace"\r
- '("\\<\\(cluster/\\(unify\\|afr\\|stripe\\)\\|\\performance/\\(io-\\(cache\\|threads\\)\\|write-behind\\|read-ahead\\|stat-prefetch\\|booster\\)\\|protocol/\\(server\\|client\\)\\|features/\\(trash\\|posix-locks\\|fixed-id\\|path-converter\\|filter\\)\\|storage/\\(posix\\|bdb\\)\\|encryption/rot-13\\|debug/trace\\)\\>" . font-lock-keyword-face))\r
-"Additional Keywords to highlight in GlusterFS mode.")\r
-\r
-(defconst glusterfs-font-lock-keywords-2\r
- (append glusterfs-font-lock-keywords-1\r
- (list\r
- ; "replicate" "namespace" "scheduler" "remote-subvolume" "remote-host" \r
- ; "auth.addr" "block-size" "remote-port" "listen-port" "transport-type"\r
- ; "limits.min-free-disk" "directory"\r
- ; TODO: add all the keys here.\r
- '("\\<\\(inode-lru-limit\\|replicate\\|namespace\\|scheduler\\|username\\|password\\|allow\\|reject\\|block-size\\|listen-port\\|transport-type\\|directory\\|page-size\\|page-count\\|aggregate-size\\|non-blocking-io\\|client-volume-filename\\|bind-address\\|self-heal\\|read-only-subvolumes\\|read-subvolume\\|thread-count\\|cache-size\\|window-size\\|force-revalidate-timeout\\|priority\\|include\\|exclude\\|remote-\\(host\\|subvolume\\|port\\)\\|auth.\\(addr\\|login\\)\\|limits.\\(min-disk-free\\|transaction-size\\|ib-verbs-\\(work-request-\\(send-\\|recv-\\(count\\|size\\)\\)\\|port\\|mtu\\|device-name\\)\\)\\)\ \\>" . font-lock-constant-face)))\r
- "option keys in GlusterFS mode.")\r
-\r
-(defconst glusterfs-font-lock-keywords-3\r
- (append glusterfs-font-lock-keywords-2\r
- (list\r
- ; "option" "volume" "end-volume" "subvolumes" "type"\r
- '("\\<\\(option\ \\|volume\ \\|subvolumes\ \\|type\ \\|end-volume\\)\\>" . font-lock-builtin-face)))\r
- ;'((regexp-opt (" option " "^volume " "^end-volume" "subvolumes " " type ") t) . font-lock-builtin-face))\r
- "Minimal highlighting expressions for GlusterFS mode.")\r
-\r
-\r
-(defvar glusterfs-font-lock-keywords glusterfs-font-lock-keywords-3\r
- "Default highlighting expressions for GlusterFS mode.")\r
-\r
-(defvar glusterfs-mode-syntax-table\r
- (let ((glusterfs-mode-syntax-table (make-syntax-table)))\r
- (modify-syntax-entry ?\# "<" glusterfs-mode-syntax-table)\r
- (modify-syntax-entry ?* ". 23" glusterfs-mode-syntax-table)\r
- (modify-syntax-entry ?\n ">#" glusterfs-mode-syntax-table)\r
- glusterfs-mode-syntax-table)\r
- "Syntax table for glusterfs-mode")\r
-\r
-;; TODO: add an indentation table\r
-\r
-(defun glusterfs-indent-line ()\r
- "Indent current line as GlusterFS code"\r
- (interactive)\r
- (beginning-of-line)\r
- (if (bobp)\r
- (indent-line-to 0) ; First line is always non-indented\r
- (let ((not-indented t) cur-indent)\r
- (if (looking-at "^[ \t]*volume\ ")\r
- (progn\r
- (save-excursion\r
- (forward-line -1)\r
- (setq not-indented nil)\r
- (setq cur-indent 0))))\r
- (if (looking-at "^[ \t]*end-volume")\r
- (progn\r
- (save-excursion\r
- (forward-line -1)\r
- (setq cur-indent 0))\r
- (if (< cur-indent 0) ; We can't indent past the left margin\r
- (setq cur-indent 0)))\r
- (save-excursion\r
- (while not-indented ; Iterate backwards until we find an indentation hint\r
- (progn\r
- (setq cur-indent 4) ; Do the actual indenting\r
- (setq not-indented nil)))))\r
- (if cur-indent\r
- (indent-line-to cur-indent)\r
- (indent-line-to 0)))))\r
-\r
-(defun glusterfs-mode ()\r
- (interactive)\r
- (kill-all-local-variables)\r
- ;; (use-local-map glusterfs-mode-map)\r
- (set-syntax-table glusterfs-mode-syntax-table)\r
- (set (make-local-variable 'indent-line-function) 'glusterfs-indent-line) \r
- (set (make-local-variable 'font-lock-defaults) '(glusterfs-font-lock-keywords))\r
- (setq major-mode 'glusterfs-mode)\r
- (setq mode-name "GlusterFS")\r
- (run-hooks 'glusterfs-mode-hook))\r
-\r
-(provide 'glusterfs-mode)\r