"SfR Fresh" - the SfR Freeware/Shareware Archive

Member "vil96w32/filters.rc" of archive vile-w32.zip:


As a special service "SfR Fresh" has tried to format the requested source page into HTML format using source code syntax highlighting with prefixed line numbers. Alternatively you can here view or download the uninterpreted source code file. That can be also achieved for any archive member file by clicking within an archive contents listing on the first character of the file(path) respectively on the according byte size field.
    1 ; $Id: filters.rc,v 1.209 2007/10/21 19:16:20 tom Exp $
    2 ; majormodes in this file are ordered alphabetically for convenience - the
    3 ; precedence used by vile is strictly alphabetic, counting case.
    4 
    5 ; This file depends upon modes.rc, which may have been source'd by vileinit.rc
    6 ; so we will check if it was not source'd.
    7 ~if &error %filters-modes
    8 	source modes.rc
    9 ~elseif &seq %filters-modes ''
   10 	source modes.rc
   11 ~endif
   12 unsetv %filters-modes
   13 
   14 define-mode cpp
   15 ~with define-submode cpp
   16 	filtername	'vile-c-filt -k cpp'
   17 ~endwith
   18 
   19 define-mode cs
   20 ~with define-submode cs
   21 	filtername	'vile-c-filt -k cs'
   22 ~endwith
   23 
   24 define-mode csh
   25 ~with define-submode csh
   26 	filtername	'vile-sh-filt -k csh'
   27 ~endwith
   28 
   29 ; using txt filter will highlight quoted strings
   30 define-mode csv
   31 ~with define-submode csv
   32 	filtername	'vile-txt-filt'
   33 ~endwith
   34 
   35 define-mode delphi
   36 ~with define-submode delphi
   37 	filtername	'vile-pas-filt -k delphi'
   38 ~endwith
   39 
   40 define-mode docbook
   41 ~with define-submode docbook
   42 	filtername	'vile-xml-filt -k docbook'
   43 ~endwith
   44 
   45 define-mode java
   46 ~with define-submode java
   47 	filtername	'vile-c-filt -j -p -k java'
   48 ~endwith
   49 
   50 define-mode js
   51 ~with define-submode js
   52 	filtername	'vile-c-filt -j -s -p -k js'
   53 ~endwith
   54 
   55 define-mode jsp
   56 ~with define-submode jsp
   57 	filtername	'vile-html-filt -j'
   58 ~endwith
   59 
   60 define-mode latex
   61 ~with define-submode latex
   62 	filtername	'vile-latex-filt -a'
   63 ~endwith
   64 
   65 define-mode nmake
   66 ~with define-submode nmake
   67 	filtername	'vile-make-filt'
   68 ~endwith
   69 
   70 define-mode nsis
   71 ~with define-submode nsis
   72 	filtername	'vile-conf-filt -k nsis'
   73 ~endwith
   74 
   75 define-mode pc
   76 ~with define-submode pc
   77 	filtername	'vile-tc-filt -k pc'
   78 ~endwith
   79 
   80 define-mode rb
   81 ~with define-submode rb
   82 	filtername	'vile-ruby-filt -k rb'
   83 ~endwith
   84 
   85 define-mode RCS
   86 ~with define-submode RCS
   87 	filtername	'vile-rcs-filt'
   88 ~endwith
   89 
   90 define-mode SCCS
   91 ~with define-submode SCCS
   92 	filtername	'vile-sccs-filt'
   93 ~endwith
   94 
   95 define-mode tex
   96 ~with define-submode tex
   97 	filtername	'vile-latex-filt -k tex'
   98 ~endwith
   99 
  100 define-mode vb
  101 ~with define-submode vb
  102 	filtername	'vile-basic-filt -k vb'
  103 ~endwith
  104 
  105 define-mode vbs
  106 ~with define-submode vbs
  107 	filtername	'vile-basic-filt -k vb'
  108 ~endwith
  109 
  110 define-mode vim
  111 ~with define-submode vim
  112 	filtername	'vile-vile-filt -k vim'
  113 ~endwith
  114 
  115 define-mode xpm
  116 ~with define-submode xpm
  117 	filtername	'vile-c-filt'
  118 ~endwith
  119 
  120 store-procedure HighlightFilter 'Invoke syntax-highlighting filter on the current buffer'
  121     ~if &not $highlight
  122 	~return
  123     ~elseif &seq $majormode ''
  124 	~return
  125     ~elseif &filter $majormode
  126 	~local $curcol $curline
  127 	~hidden goto-beginning-of-file
  128 	~hidden attribute-directly end-of-file $majormode
  129 	~return
  130     ~else
  131 	~local $curcol $curline
  132 	~local %filtername %filterpath %filteropts
  133 	~hidden goto-beginning-of-file
  134 	~if &seq $filtername ''
  135 		set-variable %filtername &cat &cat 'vile-' $majormode '-filt'
  136 	~else
  137 		set-variable %filtername $filtername
  138 	~endif
  139 	set-variable %filterpath &word 0 %filtername
  140 	set-variable %filteropts &right %filtername &add 1 &len %filterpath
  141 	~if &seq '' &lookup e+p &cat %filterpath $exec-suffix
  142 		set-variable %filterpath &lookup e+l &cat %filterpath $exec-suffix
  143 	~endif
  144 	~if &not &seq %filterpath ''
  145 		~hidden attribute-from-filter end-of-file &cat &pquote %filterpath &cat %filteropts &cat ' -t' $tabstop
  146 	~endif
  147     ~endif
  148 ~endm
  149 store-procedure HighlightFilterMsg 'Attach highlighting to the current buffer'
  150 	HighlightFilter
  151 	write-message '[Attaching attributes...]'
  152 ~endm
  153 bind-key HighlightFilterMsg ^X-q
  154 
  155 store-procedure HighlightClear 'Clear all highlighting from the current buffer'
  156 	~local $curcol $curline
  157 	~hidden goto-beginning-of-file
  158 	~hidden clear-attributes-til goto-char
  159 ~endm
  160 bind-key HighlightClear ^X-Q
  161 
  162 store-procedure set-highlighting ma 'Set a majormode and invoke highlighting'
  163 	; show-variables
  164 	write-message $1
  165 	~force setl $1
  166 	HighlightFilter
  167 ~endm
  168 
  169 ; Normally filtermsgs is off since it would slow down autocolor.  This macro
  170 ; turns it on temporarily to create an error-buffer which can be used to walk
  171 ; through the syntax errors.
  172 store-procedure show-filtermsgs 'Show syntax-filter error messages for current buffer'
  173 	~local $filtermsgs $highlight
  174 	set highlight
  175 	~if &not $highlight
  176 		write-message 'Cannot setup highlighting'
  177 	~elseif &seq $majormode ''
  178 		write-message 'No majormode is associated with this buffer'
  179 	~elseif &filter $majormode
  180 		set filtermsgs
  181 		; make sure there are no prior results to confuse us
  182 		~if &isa buffer '[Filter Messages]'
  183 			~quiet ~hidden kill-buffer '[Filter Messages]'
  184 		~endif
  185 		HighlightFilter
  186 		~if &isa buffer '[Filter Messages]'
  187 			popup-buffer '[Filter Messages]'
  188 			goto-beginning-of-file
  189 			error-buffer '[Filter Messages]'
  190 		~else
  191 			write-message 'No messages found'
  192 		~endif
  193 	~else
  194 		write-message 'This only works for built-in filters'
  195 	~endif
  196 ~endm
  197 
  198 ; If we have built-in filters, and colors are available, simply turn on
  199 ; the syntax highlighting.
  200 ~if &and \
  201 	&not &error $filter-list \
  202 	&not &error $ncolors
  203 	setv $read-hook HighlightFilter
  204 	set autocolor=5000
  205 	setv $autocolor-hook HighlightFilter
  206 ~endif