Fix maintainer address.
[emacs.git] / lisp / generic-x.el
blob50a852f316df24b42de50bbda4ba6fa16651b0f2
1 ;;; generic-x.el --- Extra Modes for generic-mode
3 ;; Copyright (C) 1997, 1998 Free Software Foundation, Inc.
5 ;; Author: Peter Breton <pbreton@cs.umb.edu>
6 ;; Created: Tue Oct 08 1996
7 ;; Keywords: generic, comment, font-lock
9 ;; This file is part of GNU Emacs.
11 ;; GNU Emacs is free software; you can redistribute it and/or modify
12 ;; it under the terms of the GNU General Public License as published by
13 ;; the Free Software Foundation; either version 2, or (at your option)
14 ;; any later version.
16 ;; GNU Emacs is distributed in the hope that it will be useful,
17 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
18 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 ;; GNU General Public License for more details.
21 ;; You should have received a copy of the GNU General Public License
22 ;; along with GNU Emacs; see the file COPYING. If not, write to the
23 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
24 ;; Boston, MA 02111-1307, USA.
26 ;;; Commentary:
28 ;; This file contains some pre-defined generic-modes.
29 ;;
30 ;; INSTALLATION:
32 ;; Add this line to your .emacs file:
34 ;; (require 'generic-x)
36 ;; You can decide which modes to load by setting the variable
37 ;; `generic-extras-enable-list'. Some platform-specific modes are
38 ;; affected by the variables `generic-define-mswindows-modes' and
39 ;; `generic-define-unix-modes' (which see).
40 ;;
41 ;; You can also send in new modes; if the file types a reasonably common,
42 ;; we would like to install them.
44 ;; PROBLEMS WHEN USED WITH FOLDING MODE:
46 ;; [The following relates to the obsolete selective-display technique.
47 ;; Folding mode should use invisible text properties instead. -- Dave
48 ;; Love]
50 ;; From Anders Lindgren <andersl@csd.uu.se>
51 ;;
52 ;; Problem summary: Wayne Adams has found a problem when using folding
53 ;; mode in conjuction with font-lock for a mode defined in
54 ;; `generic-x.el'.
56 ;; The problem, as Wayne described it, was that error messages of the
57 ;; following form appeared when both font-lock and folding are used:
58 ;;
59 ;; > - various msgs including "Fontifying region...(error Stack
60 ;; > overflow in regexp matcher)" appear
61 ;;
62 ;; I have just tracked down the cause of the problem. The regexp:s in
63 ;; `generic-x.el' does not take into account the way that folding
64 ;; hides sections of the buffer. The technique is known as
65 ;; `selective-display' and has been available for a very long time (I
66 ;; started using it back in the good old' Emacs 18 days). Basically, a
67 ;; section is hidden by creating one very long line were the newline
68 ;; character (C-j) is replaced by a linefeed (C-m) character.
69 ;;
70 ;; Many other hiding packages, besides folding, use the same technique,
71 ;; the problem should occur when using them as well.
72 ;;
73 ;; The erroronous lines in `generic-extras' look like the following (this
74 ;; example is from the `ini' section):
75 ;;
76 ;; '(("^\\(\\[.*\\]\\)" 1 'font-lock-reference-face)
77 ;; ("^\\(.*\\)=" 1 'font-lock-variable-name-face)
78 ;;
79 ;; The intention of these lines is to highlight lines of the following
80 ;; form:
81 ;;
82 ;; [foo]
83 ;; bar = xxx
84 ;;
85 ;; However, since the `.' regexp symbol match the linefeed character the
86 ;; entire folded section is searched, resulting in a regexp stack
87 ;; overflow.
88 ;;
89 ;; Solution suggestion 2: Instead of using ".", use the sequence
90 ;; "[^\n\r]". This will make the rules behave just as before, but they
91 ;; will work together with selective-display.
93 ;;; Code:
95 (require 'generic)
96 (require 'font-lock)
98 (defgroup generic-x nil
99 "Extra modes for generic mode."
100 :prefix "generic-"
101 :group 'generic
102 :version "20.3")
104 (defcustom generic-extras-enable-list nil
105 "*List of generic modes to enable by default.
106 Each entry in the list should be a symbol.
107 The variables `generic-define-mswindows-modes' and `generic-define-unix-modes'
108 also affect which generic modes are defined.
109 Please note that if you set this variable after generic-x is loaded,
110 you must reload generic-x to enable the specified modes."
111 :group 'generic-x
112 :type '(repeat sexp)
115 (defcustom generic-define-mswindows-modes
116 (memq system-type (list 'windows-nt 'ms-dos))
117 "*If non-nil, some MS-Windows specific generic modes will be defined."
118 :group 'generic-x
119 :type 'boolean
122 (defcustom generic-define-unix-modes
123 (not (memq system-type (list 'windows-nt 'ms-dos)))
124 "*If non-nil, some Unix specific generic modes will be defined."
125 :group 'generic-x
126 :type 'boolean
129 (and generic-define-mswindows-modes
130 (setq generic-extras-enable-list
131 (append (list 'bat-generic-mode 'ini-generic-mode
132 'inf-generic-mode 'rc-generic-mode
133 'reg-generic-mode 'rul-generic-mode
134 'hosts-generic-mode 'apache-generic-mode)
135 generic-extras-enable-list)))
137 (and generic-define-unix-modes
138 (setq generic-extras-enable-list
139 (append (list 'apache-generic-mode 'samba-generic-mode
140 'hosts-generic-mode 'fvwm-generic-mode
141 'x-resource-generic-mode
142 'alias-generic-mode
144 generic-extras-enable-list)))
146 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
147 ;; Generic-modes
148 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
150 ;;; Apache
151 (and
152 (memq 'apache-generic-mode generic-extras-enable-list)
154 (define-generic-mode 'apache-generic-mode
155 (list ?#)
156 nil
157 '(("^\\(<.*>\\)" 1 'font-lock-reference-face)
158 ("^\\(\\sw+\\)\\s-" 1 'font-lock-variable-name-face))
159 (list "srm\\.conf\\'" "httpd\\.conf\\'" "access\\.conf\\'")
160 nil
161 "Generic mode for Apache or HTTPD configuration files."))
163 ;;; Samba
164 (and
165 (memq 'samba-generic-mode generic-extras-enable-list)
167 (define-generic-mode 'samba-generic-mode
168 (list ?\;)
170 '(("^\\(\\[.*\\]\\)" 1 'font-lock-reference-face))
171 (list "smb\\.conf\\'")
172 (list 'generic-bracket-support)
173 "Generic mode for Samba configuration files."))
175 ;;; Fvwm
176 ;; This is pretty basic. Also, modes for other window managers could
177 ;; be defined as well.
178 (and
179 (memq 'fvwm-generic-mode generic-extras-enable-list)
181 (define-generic-mode 'fvwm-generic-mode
182 (list ?#)
183 (list
184 "AddToMenu"
185 "AddToFunc"
186 "ButtonStyle"
187 "EndFunction"
188 "EndPopup"
189 "Function"
190 "IconPath"
191 "Key"
192 "ModulePath"
193 "Mouse"
194 "PixmapPath"
195 "Popup"
196 "Style"
199 (list "\\.fvwmrc\\'" "\\.fvwm2rc\\'")
201 "Generic mode for FVWM configuration files."))
203 ;;; X Resource
204 ;; I'm pretty sure I've seen an actual mode to do this, but I don't
205 ;; think it's standard with Emacs
206 (and
207 (memq 'x-resource-generic-mode generic-extras-enable-list)
209 (define-generic-mode 'x-resource-generic-mode
210 (list ?!)
212 '(("^\\([^:\n]+:\\)" 1 'font-lock-variable-name-face))
213 (list "\\.Xdefaults\\'" "\\.Xresources\\'")
215 "Generic mode for X Resource configuration files."))
217 ;;; Hosts
218 (and
219 (memq 'hosts-generic-mode generic-extras-enable-list)
221 (define-generic-mode 'hosts-generic-mode
222 (list ?#)
223 (list "localhost")
224 '(("\\([0-9]+\.[0-9]+\.[0-9]+\.[0-9]+\\)" 1 'font-lock-reference-face))
225 (list "[hH][oO][sS][tT][sS]\\'")
227 "Generic mode for HOSTS files."))
229 ;;; Windows INF files
230 (and
231 (memq 'inf-generic-mode generic-extras-enable-list)
233 (define-generic-mode 'inf-generic-mode
234 (list ?\;)
235 nil
236 '(("^\\(\\[.*\\]\\)" 1 'font-lock-reference-face))
237 (list "\\.[iI][nN][fF]\\'")
238 (list 'generic-bracket-support)
239 "Generic mode for MS-Windows INF files."))
241 ;;; Windows INI files
242 ;; Should define escape character as well!
243 (and
244 (memq 'ini-generic-mode generic-extras-enable-list)
246 (define-generic-mode 'ini-generic-mode
247 (list ?\;)
249 '(("^\\(\\[.*\\]\\)" 1 'font-lock-reference-face)
250 ("^\\([^=\n\r]*\\)=\\([^\n\r]*\\)$"
251 (1 font-lock-function-name-face)
252 (2 font-lock-variable-name-face)))
253 (list "\\.[iI][nN][iI]\\'")
254 (list
255 (function
256 (lambda ()
257 (setq imenu-generic-expression
258 '((nil "^\\[\\(.*\\)\\]" 1)
259 ("*Variables*" "^\\s-*\\([^=]+\\)\\s-*=" 1)))
261 "Generic mode for MS-Windows INI files."))
263 ;;; Windows REG files
264 ;;; Unfortunately, Windows 95 and Windows NT have different REG file syntax!
265 (and
266 (memq 'reg-generic-mode generic-extras-enable-list)
268 (define-generic-mode 'reg-generic-mode
269 '(?\;)
270 '("key" "classes_root" "REGEDIT" "REGEDIT4")
271 '(("\\(\\[.*]\\)" 1 'font-lock-reference-face)
272 ("^\\([^\n\r]*\\)\\s-*=" 1 'font-lock-variable-name-face))
273 '("\\.[rR][eE][gG]\\'")
274 (list
275 (function
276 (lambda ()
277 (setq imenu-generic-expression
278 '((nil "^\\s-*\\(.*\\)\\s-*=" 1))))))
279 "Generic mode for MS-Windows Registry files."))
281 ;;; DOS/Windows BAT files
282 (if (not (memq 'bat-generic-mode generic-extras-enable-list))
284 (define-generic-mode 'bat-generic-mode
287 (list
288 ;; Make this one first in the list, otherwise comments will
289 ;; be over-written by other variables
290 (list "^[@ \t]*\\([rR][eE][mM][^\n\r]*\\)" 1 'font-lock-comment-face t)
291 (list "^[ \t]*\\(::-.*\\)" 1 'font-lock-comment-face t)
292 (list
293 "^[@ \t]*\\([bB][rR][eE][aA][kK]\\|[vV][eE][rR][iI][fF][yY]\\)[ \t]+\\([oO]\\([nN]\\|[fF][fF]\\)\\)"
294 '(1 font-lock-builtin-face)
295 '(2 font-lock-constant-face 'append t))
296 ;; Any text (except ON/OFF) following ECHO is a string.
297 (list
298 "^[@ \t]*\\([eE][cC][hH][oO]\\)[ \t]+\\(\\([oO]\\([nN]\\|[fF][fF]\\)\\)\\|\\([^>|\r\n]+\\)\\)"
299 '(1 font-lock-builtin-face)
300 '(3 font-lock-constant-face t t)
301 '(5 font-lock-string-face t t))
302 ;; These keywords appear as the first word on a line. (Actually, they
303 ;; can also appear after "if ..." or "for ..." clause, but since they
304 ;; are frequently used in simple text, we punt.)
305 (generic-make-keywords-list
306 (list
307 "FOR" "for" "For"
308 "IF" "if" "If"
310 'font-lock-keyword-face "^[@ \t]*")
311 ;; These keywords can be anywhere on a line
312 (generic-make-keywords-list
313 (list
314 "DO" "do" "Do"
315 "EXIST" "exist" "Exist"
316 "ERRORLEVEL" "errorlevel" "ErrorLevel" "Errorlevel"
317 "GOTO" "goto" "GoTo" "Goto"
318 "NOT" "not" "Not"
319 ) 'font-lock-keyword-face "[ \t|\n]")
320 ; These are built-in commands. Only frequently-used ones are listed.
321 (generic-make-keywords-list
322 (list
323 "CALL" "call" "Call"
324 "CD" "cd" "Cd"
325 "CLS" "cls" "Cls"
326 "COPY" "copy" "Copy"
327 "DEL" "del" "Del"
328 "ECHO" "echo" "Echo"
329 "MD" "md" "Md"
330 "PATH" "path" "Path"
331 "PAUSE" "pause" "Pause"
332 "PROMPT" "prompt" "Prompt"
333 "RD" "rd" "Rd"
334 "REN" "ren" "Ren"
335 "SET" "set" "Set"
336 "START" "start" "Start"
337 "SHIFT" "shift" "Shift"
338 ) 'font-lock-builtin-face "[ \t|\n]")
339 (list "^[ \t]*\\(:\\sw+\\)" 1 'font-lock-function-name-face t)
340 (list "\\(%\\sw+%\\)" 1 'font-lock-variable-name-face t)
341 (list "\\(%[0-9]\\)" 1 'font-lock-variable-name-face t)
342 (list "\\(/[^/ \"\t\n]+\\)" 1 'font-lock-type-face)
343 (list "[\t ]+\\([+-][^\t\n\" ]+\\)" 1 'font-lock-type-face)
344 (list "[ \t\n|]\\<\\([gG][oO][tT][oO]\\)\\>[ \t]*\\(\\sw+\\)?"
345 '(1 font-lock-keyword-face)
346 '(2 font-lock-function-name-face nil t))
347 (list "[ \t\n|]\\<\\([sS][eE][tT]\\)\\>[ \t]*\\(\\sw+\\)?[ \t]*=?"
348 '(1 font-lock-builtin-face)
349 '(2 font-lock-variable-name-face t t))
352 (list
353 "\\.[bB][aA][tT]\\'"
354 "\\`[cC][oO][nN][fF][iI][gG]\\."
355 "\\`[aA][uU][tT][oO][eE][xX][eE][cC]\\." )
356 (list 'generic-bat-mode-setup-function)
357 "Generic mode for MS-Windows BAT files.")
359 (defvar bat-generic-mode-syntax-table nil
360 "Syntax table in use in bat-generic-mode buffers.")
362 ;; Make underscores count as words
363 (if bat-generic-mode-syntax-table
365 (setq bat-generic-mode-syntax-table (make-syntax-table))
366 (modify-syntax-entry ?_ "w" bat-generic-mode-syntax-table))
368 ;; bat-generic-mode doesn't use the comment functionality of generic-mode
369 ;; because it has a three-letter comment-string, so we do it
370 ;; here manually instead
371 (defun generic-bat-mode-setup-function ()
372 (make-local-variable 'parse-sexp-ignore-comments)
373 (make-local-variable 'comment-start)
374 (make-local-variable 'comment-start-skip)
375 (make-local-variable 'comment-end)
376 (setq imenu-generic-expression '((nil "^:\\(\\sw+\\)" 1))
377 parse-sexp-ignore-comments t
378 comment-end ""
379 comment-start "REM "
380 comment-start-skip "[Rr][Ee][Mm] *"
382 (set-syntax-table bat-generic-mode-syntax-table)
386 ;;; Mailagent
387 ;; Mailagent is a Unix mail filtering program. Anyone wanna do a generic mode
388 ;; for procmail?
389 (and
390 (memq 'mailagent-rules-generic-mode generic-extras-enable-list)
392 (define-generic-mode 'mailagent-rules-generic-mode
393 (list ?#)
394 (list "SAVE" "DELETE" "PIPE" "ANNOTATE" "REJECT")
395 '(("^\\(\\sw+\\)\\s-*=" 1 'font-lock-variable-name-face)
396 ("\\s-/\\([^/]+\\)/[i, \t\n]" 1 'font-lock-reference-face))
397 (list "\\.rules\\'")
398 (list 'mailagent-rules-setup-function)
399 "Mode for Mailagent rules files.")
401 (defun mailagent-rules-setup-function ()
402 (make-local-variable 'imenu-generic-expression)
403 (setq imenu-generic-expression
404 '((nil "\\s-/\\([^/]+\\)/[i, \t\n]" 1))))
407 ;; Solaris/Sys V prototype files
408 (and
409 (memq 'prototype-generic-mode generic-extras-enable-list)
411 (define-generic-mode 'prototype-generic-mode
412 (list ?#)
415 ("^\\([0-9]\\)?\\s-*\\([a-z]\\)\\s-+\\([A-Za-z_]+\\)\\s-+\\([^\n\r]*\\)$"
416 (2 font-lock-reference-face)
417 (3 font-lock-keyword-face))
418 ("^\\([a-z]\\) \\([A-Za-z_]+\\)=\\([^\n\r]*\\)$"
419 (1 font-lock-reference-face)
420 (2 font-lock-keyword-face)
421 (3 font-lock-variable-name-face))
422 ("^\\(!\\s-*\\(search\\|include\\|default\\)\\)\\s-*\\([^\n\r]*\\)$"
423 (1 font-lock-keyword-face)
424 (3 font-lock-variable-name-face))
425 ("^\\(!\\s-*\\sw+\\)=\\([^\n\r]*\\)$"
426 (1 font-lock-keyword-face)
427 (2 font-lock-variable-name-face))
429 (list "prototype\\'")
431 "Mode for Sys V prototype files."))
433 ;; Solaris/Sys V pkginfo files
434 (and
435 (memq 'pkginfo-generic-mode generic-extras-enable-list)
437 (define-generic-mode 'pkginfo-generic-mode
438 (list ?#)
441 ("^\\([A-Za-z_]+\\)=\\([^\n\r]*\\)$"
442 (1 font-lock-keyword-face)
443 (2 font-lock-variable-name-face))
445 (list "pkginfo\\'")
447 "Mode for Sys V pkginfo files."))
449 ;; Javascript mode
450 (define-generic-mode 'javascript-generic-mode
451 (list "//")
452 (list
453 "document"
454 "else"
455 "function"
456 "function"
457 "if"
458 "then"
459 "var"
461 (list
462 (list "^\\s-*function\\s-+\\([A-Za-z0-9]+\\)"
463 '(1 font-lock-function-name-face))
464 (list "^\\s-*var\\s-+\\([A-Za-z0-9]+\\)"
465 '(1 font-lock-variable-name-face))
467 (list "\\.js\\'")
468 (list
469 (function
470 (lambda ()
471 (setq imenu-generic-expression
472 '((nil "^function\\s-+\\([A-Za-z0-9_]+\\)" 1)))
474 "Mode for JavaScript files.")
476 ;; VRML files
477 (define-generic-mode 'vrml-generic-mode
478 (list ?#)
479 (list
480 "DEF"
481 "NULL"
482 "USE"
483 "Viewpoint"
484 "ambientIntensity"
485 "appearance"
486 "children"
487 "color"
488 "coord"
489 "coordIndex"
490 "creaseAngle"
491 "diffuseColor"
492 "emissiveColor"
493 "fieldOfView"
494 "geometry"
495 "info"
496 "material"
497 "normal"
498 "orientation"
499 "position"
500 "shininess"
501 "specularColor"
502 "texCoord"
503 "texture"
504 "textureTransform"
505 "title"
506 "transparency"
507 "type"
509 (list
510 (list "USE\\s-+\\([-A-Za-z0-9_]+\\)"
511 '(1 font-lock-reference-face))
512 (list "DEF\\s-+\\([-A-Za-z0-9_]+\\)\\s-+\\([A-Za-z0-9]+\\)\\s-*{"
513 '(1 font-lock-type-face)
514 '(2 font-lock-reference-face))
515 (list "^\\s-*\\([-A-Za-z0-9_]+\\)\\s-*{"
516 '(1 font-lock-function-name-face))
517 (list
518 "^\\s-*\\(geometry\\|appearance\\|material\\)\\s-+\\([-A-Za-z0-9_]+\\)"
519 '(2 font-lock-variable-name-face))
521 (list "\\.wrl\\'")
522 (list
523 (function
524 (lambda ()
525 (setq imenu-generic-expression
526 '((nil "^\\([A-Za-z0-9_]+\\)\\s-*{" 1)
527 ("*Definitions*"
528 "DEF\\s-+\\([-A-Za-z0-9_]+\\)\\s-+\\([A-Za-z0-9]+\\)\\s-*{"
529 1)))
531 "Generic Mode for VRML files.")
533 ;; Java Manifests
534 (define-generic-mode 'java-manifest-generic-mode
535 (list ?#)
536 (list
537 "Name"
538 "Digest-Algorithms"
539 "Manifest-Version"
540 "Required-Version"
541 "Signature-Version"
542 "Magic"
543 "Java-Bean"
544 "Depends-On"
546 '(("^Name:\\s-+\\([^\n\r]*\\)$"
547 (1 font-lock-variable-name-face))
548 ("^\\(Manifest\\|Required\\|Signature\\)-Version:\\s-+\\([^\n\r]*\\)$"
549 (2 font-lock-reference-face))
551 (list "manifest\\.mf\\'")
553 "Mode for Java Manifest files")
555 ;; Java properties files
556 (define-generic-mode 'java-properties-generic-mode
557 (list ?#)
559 ;; Property and value can be separated with whitespace or an equal sign
560 '(("^\\([\\.A-Za-z0-9_]+\\)\\(\\s-+\\|\\(\\s-*=\\s-*\\)\\)\\([^\r\n]*\\)$"
561 (1 font-lock-reference-face) (4 font-lock-variable-name-face)))
564 "Mode for Java properties files.")
566 ;; C shell alias definitions
567 (and
568 (memq 'alias-generic-mode generic-extras-enable-list)
570 (define-generic-mode 'alias-generic-mode
571 (list ?#)
572 (list "alias" "unalias")
573 '(("^alias\\s-+\\([-A-Za-z0-9_]+\\)\\s-+"
574 (1 font-lock-variable-name-face))
575 ("^unalias\\s-+\\([-A-Za-z0-9_]+\\)\\s-*$"
576 (1 font-lock-variable-name-face))
578 (list "alias\\'")
579 (list
580 (function
581 (lambda ()
582 (setq imenu-generic-expression
583 '((nil "^\\(alias\\|unalias\\)\\s-+\\([-a-zA-Z0-9_]+\\)" 2)))
585 "Mode for C Shell alias files.")
588 ;;; Windows RC files
589 ;; Contributed by ACorreir@pervasive-sw.com (Alfred Correira)
590 (and
591 (memq 'rc-generic-mode generic-extras-enable-list)
593 (define-generic-mode 'rc-generic-mode
594 ;; (list ?\/)
595 (list "//")
596 '("ACCELERATORS"
597 "AUTO3STATE"
598 "AUTOCHECKBOX"
599 "AUTORADIOBUTTON"
600 "BITMAP"
601 "BOTTOMMARGIN"
602 "BUTTON"
603 "CAPTION"
604 "CHARACTERISTICS"
605 "CHECKBOX"
606 "CLASS"
607 "COMBOBOX"
608 "CONTROL"
609 "CTEXT"
610 "CURSOR"
611 "DEFPUSHBUTTON"
612 "DESIGNINFO"
613 "DIALOG"
614 "DISCARDABLE"
615 "EDITTEXT"
616 "EXSTYLE"
617 "FONT"
618 "GROUPBOX"
619 "GUIDELINES"
620 "ICON"
621 "LANGUAGE"
622 "LEFTMARGIN"
623 "LISTBOX"
624 "LTEXT"
625 "MENUITEM SEPARATOR"
626 "MENUITEM"
627 "MENU"
628 "MOVEABLE"
629 "POPUP"
630 "PRELOAD"
631 "PURE"
632 "PUSHBOX"
633 "PUSHBUTTON"
634 "RADIOBUTTON"
635 "RCDATA"
636 "RIGHTMARGIN"
637 "RTEXT"
638 "SCROLLBAR"
639 "SEPARATOR"
640 "STATE3"
641 "STRINGTABLE"
642 "STYLE"
643 "TEXTINCLUDE"
644 "TOOLBAR"
645 "TOPMARGIN"
646 "VERSIONINFO"
647 "VERSION"
649 ;; the choice of what tokens go where is somewhat arbitrary,
650 ;; as is the choice of which value tokens are included, as
651 ;; the choice of face for each token group
652 (list
653 (generic-make-keywords-list
654 (list
655 "FILEFLAGSMASK"
656 "FILEFLAGS"
657 "FILEOS"
658 "FILESUBTYPE"
659 "FILETYPE"
660 "FILEVERSION"
661 "PRODUCTVERSION"
662 ) 'font-lock-type-face)
663 (generic-make-keywords-list
664 (list
665 "BEGIN"
666 "BLOCK"
667 "END"
668 "VALUE"
669 ) 'font-lock-function-name-face)
670 '("^#[ \t]*include[ \t]+\\(<[^>\"\n]+>\\)" 1 font-lock-string-face)
671 '("^#[ \t]*define[ \t]+\\(\\sw+\\)(" 1 font-lock-function-name-face)
672 '("^#[ \t]*\\(elif\\|if\\)\\>"
673 ("\\<\\(defined\\)\\>[ \t]*(?\\(\\sw+\\)?" nil nil
674 (1 font-lock-reference-face) (2 font-lock-variable-name-face nil t)))
675 '("^#[ \t]*\\(\\sw+\\)\\>[ \t]*\\(\\sw+\\)?"
676 (1 font-lock-reference-face) (2 font-lock-variable-name-face nil t)))
677 (list "\\.[rR][cC]$")
679 "Generic mode for MS-Windows Resource files."))
681 ;; InstallShield RUL files
682 ;; Contributed by Alfred.Correira@Pervasive.Com
683 (and
684 (memq 'rul-generic-mode generic-extras-enable-list)
685 ;;; build the regexp strings using regexp-opt
686 (defvar installshield-statement-keyword-list
687 (list
688 "abort"
689 "begin"
690 "call"
691 "case"
692 "declare"
693 "default"
694 "downto"
695 "elseif"
696 "else"
697 "endfor"
698 "endif"
699 "endswitch"
700 "endwhile"
701 "end"
702 "exit"
703 "external"
704 "for"
705 "function"
706 ;; "goto" -- handled elsewhere
707 "if"
708 "program"
709 "prototype"
710 "repeat"
711 "return"
712 "step"
713 "switch"
714 "then"
715 "to"
716 "typedef"
717 "until"
718 "void"
719 "while"
721 "Statement keywords used in InstallShield 3 and 5.")
723 (defvar installshield-system-functions-list
724 (list
725 "AddFolderIcon"
726 "AddProfString"
727 "AddressString"
728 "AppCommand"
729 "AskDestPath"
730 "AskOptions"
731 "AskPath"
732 "AskText"
733 "AskYesNo"
734 "BatchDeleteEx"
735 "BatchFileLoad"
736 "BatchFileSave"
737 "BatchFind"
738 "BatchGetFileName"
739 "BatchMoveEx"
740 "BatchSetFileName"
741 "CloseFile"
742 "CmdGetHwndDlg"
743 "ComponentAddItem" ; differs between IS3 and IS5
744 "ComponentCompareSizeRequired" ; IS5 only
745 "ComponentDialog"
746 "ComponentError" ; IS5 only
747 "ComponentFileEnum" ; IS5 only
748 "ComponentFileInfo" ; IS5 only
749 "ComponentFilterLanguage" ; IS5 only
750 "ComponentFilterOS" ; IS5 only
751 "ComponentGetData" ; IS5 only
752 "ComponentGetItemInfo" ; IS3 only
753 "ComponentGetItemSize" ; differs between IS3 and IS5
754 "ComponentIsItemSelected" ; differs between IS3 and IS5
755 "ComponentListItems"
756 "ComponentMoveData" ; IS5 only
757 "ComponentSelectItem" ; differs between IS3 and IS5
758 "ComponentSetData" ; IS5 only
759 "ComponentSetItemInfo" ; IS3 only
760 "ComponentSetTarget" ; IS5 only
761 "ComponentSetupTypeEnum" ; IS5 only
762 "ComponentSetupTypeGetData" ; IS5 only
763 "ComponentSetupTypeSet" ; IS5 only
764 "ComponentTotalSize"
765 "ComponentValidate" ; IS5 only
766 "CompressAdd" ; IS3 only
767 "CompressDel" ; IS3 only
768 "CompressEnum" ; IS3 only
769 "CompressGet" ; IS3 only
770 "CompressInfo" ; IS3 only
771 "CopyFile"
772 "CreateDir"
773 "CreateFile"
774 "CreateProgramFolder"
775 "DeinstallSetReference" ; IS5 only
776 "DeinstallStart"
777 "Delay"
778 "DeleteDir"
779 "DeleteFile"
780 "DialogSetInfo"
781 "Disable"
782 "DoInstall"
783 "Do"
784 "Enable"
785 "EnterDisk"
786 "ExistsDir"
787 "ExistsDisk"
788 "ExitProgMan"
789 "EzBatchAddPath"
790 "EzBatchAddString"
791 "EzBatchReplace"
792 "EzConfigAddDriver"
793 "EzConfigAddString"
794 "EzConfigGetValue"
795 "EzConfigSetValue"
796 "EzDefineDialog"
797 "FileCompare"
798 "FileDeleteLine"
799 "FileGrep"
800 "FileInsertLine"
801 "FileSetBeginDefine" ; IS3 only
802 "FileSetEndDefine" ; IS3 only
803 "FileSetPerformEz" ; IS3 only
804 "FileSetPerform" ; IS3 only
805 "FileSetReset" ; IS3 only
806 "FileSetRoot" ; IS3 only
807 "FindAllDirs"
808 "FindAllFiles"
809 "FindFile"
810 "FindWindow"
811 "GetDiskSpace"
812 "GetDisk"
813 "GetEnvVar"
814 "GetExtents"
815 "GetFileInfo"
816 "GetLine"
817 "GetProfString"
818 "GetSystemInfo"
819 "GetValidDrivesList"
820 "GetVersion"
821 "GetWindowHandle"
822 "InstallationInfo"
823 "Is"
824 "LaunchApp"
825 "ListAddItem"
826 "ListAddString"
827 "ListCount"
828 "ListCreate"
829 "ListDestroy"
830 "ListFindItem"
831 "ListFindString"
832 "ListGetFirstItem"
833 "ListGetFirstString"
834 "ListGetNextItem"
835 "ListGetNextString"
836 "ListReadFromFile"
837 "ListSetNextItem"
838 "ListSetNextString"
839 "ListSetIndex"
840 "ListWriteToFile"
841 "LongPathToQuote"
842 "LongPathToShortPath"
843 "MessageBox"
844 "NumToStr"
845 "OpenFileMode"
846 "OpenFile"
847 "ParsePath"
848 "PathAdd"
849 "PathDelete"
850 "PathFind"
851 "PathGet"
852 "PathMove"
853 "PathSet"
854 "Path"
855 "PlaceBitmap"
856 "PlaceWindow"
857 "PlayMMedia" ; IS5 only
858 "ProgDefGroupType"
859 "RegDBCreateKeyEx"
860 "RegDbDeleteValue"
861 "RegDBGetItem"
862 "RegDBKeyExist"
863 "RegDBSetItem"
864 "RegDBGetKeyValueEx"
865 "RegDBSetKeyValueEx"
866 "RegDBSetDefaultRoot"
867 "RenameFile"
868 "ReplaceFolderIcon"
869 "ReplaceProfString"
870 "SdAskDestPath"
871 "SdAskOptions"
872 "SdAskOptionsList"
873 "SdBitmap"
874 "SdCloseDlg"
875 "SdComponentAdvCheckSpace"
876 "SdComponentAdvInit"
877 "SdComponentAdvUpdateSpace"
878 "SdComponentDialog"
879 "SdComponentDialog2"
880 "SdComponentDialogAdv"
881 "SdComponentDialogEx"
882 "SdComponentDlgCheckSpace"
883 "SdComponentMult"
884 "SdConfirmNewDir"
885 "SdConfirmRegistration"
886 "SdDiskSpace"
887 "SdDisplayTopics"
888 "SdDoStdButton"
889 "SdEnablement"
890 "SdError"
891 "SdFinish"
892 "SdFinishInit32"
893 "SdFinishReboot"
894 "SdGeneralInit"
895 "SdGetItemName"
896 "SdGetTextExtent"
897 "SdGetUserCompanyInfo"
898 "SdInit"
899 "SdIsShellExplorer"
900 "SdIsStdButton"
901 "SdLicense"
902 "SdMakeName"
903 "SdOptionInit"
904 "SdOptionSetState"
905 "SdOptionsButtons"
906 "SdOptionsButtonsInit"
907 "SdPlugInProductName"
908 "SdProductName"
909 "SdRegEnableButton"
910 "SdRegExEnableButton"
911 "SdRegisterUser"
912 "SdRegisterUserEx"
913 "SdRemoveEndSpace"
914 "SdSelectFolder"
915 "SdSetSequentialItems"
916 "SdSetStatic"
917 "SdSetupTypeEx" ; IS5 only
918 "SdSetupType"
919 "SdShowAnyDialog"
920 "SdShowDlgEdit1"
921 "SdShowDlgEdit2"
922 "SdShowDlgEdit3"
923 "SdShowFileMods"
924 "SdShowInfoList"
925 "SdShowMsg"
926 "SdStartCopy"
927 "SdUnInit"
928 "SdUpdateComponentSelection"
929 "SdWelcome"
930 "SendMessage"
931 "SetColor"
932 "SetFont"
933 "SetDialogTitle"
934 "SetDisplayEffect" ; IS5 only
935 "SetFileInfo"
936 "SetForegroundWindow"
937 "SetStatusWindow"
938 "SetTitle"
939 "SetupType"
940 "ShowProgramFolder"
941 "Split" ; IS3 only
942 "SprintfBox"
943 "Sprintf"
944 "StatusUpdate"
945 "StrCompare"
946 "StrFind"
947 "StrGetTokens"
948 "StrLength"
949 "StrRemoveLastSlash"
950 "StrToLower"
951 "StrToUpper"
952 "StrSub"
953 "VarRestore"
954 "VarSave"
955 "VerCompare"
956 "VerGetFileVersion"
957 "WaitOnDialog"
958 "Welcome"
959 "WriteLine"
960 "WriteProfString"
961 "XCopyFile"
963 "System functions defined in InstallShield 3 and 5.")
965 (defvar installshield-system-variables-list
966 (list
967 "CMDLINE"
968 "CORECOMPONENTHANDLING"
969 "ERRORFILENAME"
970 "INFOFILENAME"
971 "ISRES"
972 "ISUSER"
973 "ISVERSION"
974 "MODE"
975 "SRCDIR"
976 "SRCDISK"
977 "SUPPORTDIR"
978 "TARGETDIR"
979 "TARGETDISK"
980 "WINDIR"
981 "WINDISK"
982 "WINMAJOR"
983 "WINSYSDIR"
984 "WINSYSDISK"
986 "System variables used in InstallShield 3 and 5.")
988 (defvar installshield-types-list
989 (list
990 "BOOL"
991 "BYREF"
992 "CHAR"
993 "HIWORD"
994 "HWND"
995 "INT"
996 "LIST"
997 "LONG"
998 "LOWORD"
999 "NUMBER"
1000 "POINTER"
1001 "QUAD"
1002 "RGB"
1003 "SHORT"
1004 "STRINGLIST"
1005 "STRING"
1007 "Type keywords used in InstallShield 3 and 5.")
1009 ;;; some might want to skip highlighting these to improve performance
1010 (defvar installshield-funarg-constants-list
1011 (list
1012 "AFTER"
1013 "APPEND"
1014 "ALLCONTENTS"
1015 "BACKBUTTON"
1016 "BACKGROUNDCAPTION"
1017 "BACKGROUND"
1018 "BACK"
1019 "BASEMEMORY"
1020 "BEFORE"
1021 "BIOS"
1022 "BITMAPICON"
1023 "BK_BLUE"
1024 "BK_GREEN"
1025 "BK_RED"
1026 "BLUE"
1027 "BOOTUPDRIVE"
1028 "CANCEL"
1029 "CDROM_DRIVE"
1030 "CDROM"
1031 "CHECKBOX95"
1032 "CHECKBOX"
1033 "CHECKLINE"
1034 "CHECKMARK"
1035 "COLORS"
1036 "COMMANDEX"
1037 "COMMAND"
1038 "COMP_NORMAL"
1039 "COMP_UPDATE_DATE"
1040 "COMP_UPDATE_SAME"
1041 "COMP_UPDATE_VERSION"
1042 "COMPACT"
1043 "CONTINUE"
1044 "CPU"
1045 "CUSTOM"
1046 "DATE"
1047 "DEFWINDOWMODE"
1048 "DIR_WRITEABLE"
1049 "DIRECTORY"
1050 "DISABLE"
1051 "DISK_TOTALSPACE"
1052 "DISK"
1053 "DLG_OPTIONS"
1054 "DLG_PATH"
1055 "DLG_TEXT"
1056 "DLG_ASK_YESNO"
1057 "DLG_ENTER_DISK"
1058 "DLG_ERR"
1059 "DLG_INFO_ALTIMAGE"
1060 "DLG_INFO_CHECKSELECTION"
1061 "DLG_INFO_KUNITS"
1062 "DLG_INFO_USEDECIMAL"
1063 "DLG_MSG_INFORMATION"
1064 "DLG_MSG_SEVERE"
1065 "DLG_MSG_WARNING"
1066 "DLG_STATUS"
1067 "DLG_WARNING"
1068 "DLG_USER_CAPTION"
1069 "DRIVE"
1070 "ENABLE"
1071 "END_OF_FILE"
1072 "END_OF_LIST"
1073 "ENVSPACE"
1074 "EQUALS"
1075 "EXCLUDE_SUBDIR"
1076 "EXCLUSIVE"
1077 "EXISTS"
1078 "EXIT"
1079 "EXTENDED_MEMORY"
1080 "EXTENSION_ONLY"
1081 "FAILIFEXISTS"
1082 "FALSE"
1083 "FEEDBACK_FULL"
1084 "FILE_ATTR_ARCHIVED"
1085 "FILE_ATTR_DIRECTORY"
1086 "FILE_ATTR_HIDDEN"
1087 "FILE_ATTR_NORMAL"
1088 "FILE_ATTR_READONLY"
1089 "FILE_ATTR_SYSTEM"
1090 "FILE_ATTRIBUTE"
1091 "FILE_DATE"
1092 "FILE_LINE_LENGTH"
1093 "FILE_MODE_APPEND"
1094 "FILE_MODE_BINARYREADONLY"
1095 "FILE_MODE_BINARY"
1096 "FILE_MODE_NORMAL"
1097 "FILE_NO_VERSION"
1098 "FILE_NOT_FOUND"
1099 "FILE_SIZE"
1100 "FILE_TIME"
1101 "FILENAME_ONLY"
1102 "FILENAME"
1103 "FIXED_DRIVE"
1104 "FOLDER_DESKTOP"
1105 "FOLDER_STARTMENU"
1106 "FOLDER_STARTUP"
1107 "FREEENVSPACE"
1108 "FULLWINDOWMODE"
1109 "FULL"
1110 "FONT_TITLE"
1111 "GREATER_THAN"
1112 "GREEN"
1113 "HOURGLASS"
1114 "INCLUDE_SUBDIR"
1115 "INDVFILESTATUS"
1116 "INFORMATION"
1117 "IS_WINDOWSNT"
1118 "IS_WINDOWS95"
1119 "IS_WINDOWS"
1120 "IS_WIN32S"
1121 "ISTYPE"
1122 "LANGUAGE_DRV"
1123 "LANGUAGE"
1124 "LESS_THAN"
1125 "LIST_NULL"
1126 "LISTFIRST"
1127 "LISTNEXT"
1128 "LOCKEDFILE"
1129 "LOGGING"
1130 "LOWER_LEFT"
1131 "LOWER_RIGHT"
1132 "MAGENTA"
1133 "MOUSE_DRV"
1134 "MOUSE"
1135 "NETWORK_DRV"
1136 "NETWORK"
1137 "NEXT"
1138 "NONEXCLUSIVE"
1139 "NORMALMODE"
1140 "NOSET"
1141 "NOTEXISTS"
1142 "NOWAIT"
1143 "NO"
1144 "OFF"
1145 "ONLYDIR"
1146 "ON"
1147 "OSMAJOR"
1148 "OSMINOR"
1149 "OS"
1150 "OTHER_FAILURE"
1151 "PARALLEL"
1152 "PARTIAL"
1153 "PATH_EXISTS"
1154 "PATH"
1155 "RED"
1156 "REGDB_APPPATH_DEFAULT"
1157 "REGDB_APPPATH"
1158 "REGDB_BINARY"
1159 "REGDB_ERR_CONNECTIONEXISTS"
1160 "REGDB_ERR_CORRUPTEDREGSITRY"
1161 "REGDB_ERR_INITIALIZATION"
1162 "REGDB_ERR_INVALIDHANDLE"
1163 "REGDB_ERR_INVALIDNAME"
1164 "REGDB_NUMBER"
1165 "REGDB_STRING_EXPAND"
1166 "REGDB_STRING_MULTI"
1167 "REGDB_STRING"
1168 "REGDB_UNINSTALL_NAME"
1169 "REMOTE_DRIVE"
1170 "REMOVALE_DRIVE"
1171 "REPLACE_ITEM"
1172 "REPLACE"
1173 "RESET"
1174 "RESTART"
1175 "ROOT"
1176 "SELFREGISTER"
1177 "SERIAL"
1178 "SET"
1179 "SEVERE"
1180 "SHAREDFILE"
1181 "SHARE"
1182 "SILENTMODE"
1183 "SRCTARGETDIR"
1184 "STATUSBAR"
1185 "STATUSDLG"
1186 "STATUSOLD"
1187 "STATUS"
1188 "STYLE_NORMAL"
1189 "SW_MAXIMIZE"
1190 "SW_MINIMIZE"
1191 "SW_RESTORE"
1192 "SW_SHOW"
1193 "TIME"
1194 "TRUE"
1195 "TYPICAL"
1196 "UPPER_LEFT"
1197 "UPPER_RIGHT"
1198 "VALID_PATH"
1199 "VERSION"
1200 "VIDEO"
1201 "VOLUMELABEL"
1202 "YELLOW"
1203 "YES"
1204 "WAIT"
1205 "WARNING"
1206 "WINMAJOR"
1207 "WINMINOR"
1208 "WIN32SINSTALLED"
1209 "WIN32SMAJOR"
1210 "WIN32SMINOR"
1212 "Function argument constants used in InstallShield 3 and 5.")
1214 (define-generic-mode 'rul-generic-mode
1215 ;; Using "/*" and "*/" doesn't seem to be working right
1216 (list "//")
1217 installshield-statement-keyword-list
1218 (list
1219 ;; preprocessor constructs
1220 '("#[ \t]*include[ \t]+\\(<[^>\"\n]+>\\)"
1221 1 font-lock-string-face)
1222 '("#[ \t]*\\(\\sw+\\)\\>[ \t]*\\(\\sw+\\)?"
1223 (1 font-lock-reference-face)
1224 (2 font-lock-variable-name-face nil t))
1225 ;; indirect string constants
1226 '("\\(@[A-Za-z][A-Za-z0-9_]+\\)" 1 font-lock-builtin-face)
1227 ;; gotos
1228 '("[ \t]*\\(\\sw+:\\)" 1 font-lock-reference-face)
1229 '("\\<\\(goto\\)\\>[ \t]*\\(\\sw+\\)?"
1230 (1 font-lock-keyword-face)
1231 (2 font-lock-reference-face nil t))
1232 ;; system variables
1233 (generic-make-keywords-list
1234 installshield-system-variables-list
1235 'font-lock-variable-name-face "[^_]" "[^_]")
1236 ;; system functions
1237 (generic-make-keywords-list
1238 installshield-system-functions-list
1239 'font-lock-function-name-face "[^_]" "[^_]")
1240 ;; type keywords
1241 (generic-make-keywords-list
1242 installshield-types-list
1243 'font-lock-type-face "[^_]" "[^_]")
1244 ;; function argument constants
1245 (generic-make-keywords-list
1246 installshield-funarg-constants-list
1247 'font-lock-variable-name-face "[^_]" "[^_]") ; is this face the best choice?
1249 (list "\\.[rR][uU][lL]$")
1250 (list
1251 (function
1252 (lambda ()
1253 (setq imenu-generic-expression
1254 '((nil "^function\\s-+\\([A-Za-z0-9_]+\\)" 1)))
1256 "Generic mode for InstallShield RUL files.")
1258 (define-skeleton rul-if
1259 "Insert an if statement."
1260 "condition: "
1261 "if(" str ") then" \n
1262 > _ \n
1263 ( "other condition, %s: "
1264 > "elseif(" str ") then" \n
1265 > \n)
1266 > "else" \n
1267 > \n
1268 resume:
1269 > "endif;"
1272 (define-skeleton rul-function
1273 "Insert a function statement."
1274 "function: "
1275 "function " str " ()" \n
1276 ( "local variables, %s: "
1277 > " " str ";" \n)
1278 > "begin" \n
1279 > _ \n
1280 resume:
1281 > "end;")
1285 ;; Additions by ACorreir@pervasive-sw.com (Alfred Correira)
1286 (define-generic-mode 'mailrc-generic-mode
1287 (list ?#)
1288 (list
1289 "alias"
1290 "else"
1291 "endif"
1292 "group"
1293 "if"
1294 "ignore"
1295 "set"
1296 "unset"
1298 '(("^\\s-*\\(alias\\|group\\)\\s-+\\([-A-Za-z0-9_]+\\)\\s-+\\([^\n\r#]*\\)\\(#.*\\)?$"
1299 (2 font-lock-reference-face) (3 font-lock-variable-name-face))
1300 ("^\\s-*\\(unset\\|set\\|ignore\\)\\s-+\\([-A-Za-z0-9_]+\\)=?\\([^\n\r#]*\\)\\(#.*\\)?$"
1301 (2 font-lock-reference-face) (3 font-lock-variable-name-face)))
1302 (list "\\.mailrc\\'")
1304 "Mode for mailrc files.")
1306 (provide 'generic-x)
1308 ;;; generic-x.el ends here