Commits

ZyX_I committed c0cf13f

@/functions: moved checker and filter decorators to a @/checks

Comments (0)

Files changed (11)

     3. Features                                   |frawor-features|
         3.1. Features defined in plugin/frawor    |frawor-f-plugin/frawor|
         3.2. plugin/frawor/functions features     |frawor-f-frawor/functions|
-        3.3. plugin/frawor/options features       |frawor-f-frawor/options|
-        3.4. plugin/frawor/checks features        |frawor-f-frawor/checks|
-        3.5. plugin/frawor/mappings features      |frawor-f-frawor/mappings|
-        3.6. plugin/frawor/autocommands features  |frawor-f-frawor/autocommands|
-        3.7. plugin/frawor/commands features      |frawor-f-frawor/commands|
-        3.8. plugin/frawor/resources features     |frawor-f-frawor/resources|
-        3.9. plugin/frawor/python features        |frawor-f-frawor/python|
-        3.10. plugin/frawor/perl features         |frawor-f-frawor/perl|
-        3.11. plugin/frawor/lua features          |frawor-f-frawor/lua|
-        3.12. plugin/frawor/ruby features         |frawor-f-frawor/ruby|
-        3.13. plugin/frawor/tcl features          |frawor-f-frawor/tcl|
+        3.3. @/decorators/altervars features      |frawor-f-decorators/altervars|
+        3.4. plugin/frawor/options features       |frawor-f-frawor/options|
+        3.5. plugin/frawor/checks features        |frawor-f-frawor/checks|
+        3.6. plugin/frawor/mappings features      |frawor-f-frawor/mappings|
+        3.7. plugin/frawor/autocommands features  |frawor-f-frawor/autocommands|
+        3.8. plugin/frawor/commands features      |frawor-f-frawor/commands|
+        3.9. plugin/frawor/resources features     |frawor-f-frawor/resources|
+        3.10. plugin/frawor/python features       |frawor-f-frawor/python|
+        3.11. plugin/frawor/perl features         |frawor-f-frawor/perl|
+        3.12. plugin/frawor/lua features          |frawor-f-frawor/lua|
+        3.13. plugin/frawor/ruby features         |frawor-f-frawor/ruby|
+        3.14. plugin/frawor/tcl features          |frawor-f-frawor/tcl|
     4. Resources                                  |frawor-resources|
         4.1. map resource                         |frawor-r-map|
         4.2. os resource                          |frawor-r-os|
         Creates a function out of given {funcdescr} (see 
         |frawor-t-funcdescr|). Is useful to wrap some function with 
         savers/setters without making it accessible outside of plugin.
-                                                      *frawor-f-addaltspecial*
-addaltspecial : function ({id}, {saver}, {setter}[, {opts}])
-              + unload
-        Adds saver and setter functions for `+{intname}' (see 
-        |frawor-fd-altervars|). {id} must be a string that starts with 
-        a letter and contains only letters, digits and underscores. {opts} is 
-        a dictionary with the following keys:
-        Key          Description ~
-        requiresarg  If it is present, then {saver} and {setter} functions are 
-                     marked as functions that require additional argument, see 
-                     |frawor-fd-altervars|. This additional argument will be 
-                     the only argument to saver and the second argument to 
-                     setter functions. Overrides `acceptsarg'.
-        acceptsarg   Like `requiresarg', but does not force argument to be 
-                     present.
-        checker      Checker for additional argument, see |frawor-t-checker|. 
-                     Checker must accept list with a single item: additional 
-                     argument.
                                                        *frawor-f-adddecorator*
 adddecorator : function ({decid}, {decfunc})
              + unload
                     argument. Priority: 64.
 
 ------------------------------------------------------------------------------
-3.3. plugin/frawor/options features                  *frawor-f-frawor/options*
+3.3. @/decorators/altervars features           *frawor-f-decorators/altervars*
+
+                                                      *frawor-f-addaltspecial*
+addaltspecial : function ({id}, {saver}, {setter}[, {opts}])
+              + unload
+        Adds saver and setter functions for `+{intname}' (see 
+        |frawor-fd-altervars|). {id} must be a string that starts with 
+        a letter and contains only letters, digits and underscores. {opts} is 
+        a dictionary with the following keys:
+        Key          Description ~
+        requiresarg  If it is present, then {saver} and {setter} functions are 
+                     marked as functions that require additional argument, see 
+                     |frawor-fd-altervars|. This additional argument will be 
+                     the only argument to saver and the second argument to 
+                     setter functions. Overrides `acceptsarg'.
+        acceptsarg   Like `requiresarg', but does not force argument to be 
+                     present.
+        checker      Checker for additional argument, see |frawor-t-checker|. 
+                     Checker must accept list with a single item: additional 
+                     argument.
+
+------------------------------------------------------------------------------
+3.4. plugin/frawor/options features                  *frawor-f-frawor/options*
 
                                                           *frawor-f-getoption*
 getoption : function ({optname}[, {scopes}]) + s:_options, s:_oprefix
         |frawor-od-scopes|.
 
 ------------------------------------------------------------------------------
-3.4. plugin/frawor/checks features                    *frawor-f-frawor/checks*
+3.5. plugin/frawor/checks features                    *frawor-f-frawor/checks*
 
                                                         *frawor-f-conschecker*
 conschecker : function ({checker})
         Like |frawor-f-conschecker|, but for filters, see |frawor-t-filter|.
 
 ------------------------------------------------------------------------------
-3.5. plugin/frawor/mappings features                *frawor-f-frawor/mappings*
+3.6. plugin/frawor/mappings features                *frawor-f-frawor/mappings*
 
                                                         *frawor-f-addmapgroup*
 mapgroup.add : function ({mgid}, {mappings}[, {mgopts}])
         that one which defined this group.
 
 ------------------------------------------------------------------------------
-3.6. plugin/frawor/autocommands features        *frawor-f-frawor/autocommands*
+3.7. plugin/frawor/autocommands features        *frawor-f-frawor/autocommands*
 
 augroup.add : function ({agid}, {events})               *frawor-f-augroup.add*
             + unload
             let s:_augroups+=['FooBar']
 
 ------------------------------------------------------------------------------
-3.7. plugin/frawor/commands features                *frawor-f-frawor/commands*
+3.8. plugin/frawor/commands features                *frawor-f-frawor/commands*
 
 delcommands : unloadpre + s:_commands                   *frawor-f-delcommands*
               register + s:_commands
             let s:_commands+=["Foo"]
 
 ------------------------------------------------------------------------------
-3.8. plugin/frawor/resources features              *frawor-f-frawor/resources*
+3.9. plugin/frawor/resources features              *frawor-f-frawor/resources*
 
 postresource : function ({rid}, {resource})            *frawor-f-postresource*
              + register, unload
         so you don't need anything to get it working.
 
 ------------------------------------------------------------------------------
-3.9. plugin/frawor/python features                    *frawor-f-frawor/python*
+3.10. plugin/frawor/python features                   *frawor-f-frawor/python*
 
 All plugin/frawor/python features are available only if vim is compiled with 
 python support.
         feature, so you don't need to do anything to make it work.
 
 ------------------------------------------------------------------------------
-3.10. plugin/frawor/perl features                       *frawor-f-frawor/perl*
+3.11. plugin/frawor/perl features                       *frawor-f-frawor/perl*
 
 All plugin/frawor/perl features are available only if vim is compiled with 
 perl support.
         feature, so you don't need to do anything to make it work.
 
 ------------------------------------------------------------------------------
-3.11. plugin/frawor/lua features                        *frawor-f-frawor/lua*
+3.12. plugin/frawor/lua features                        *frawor-f-frawor/lua*
 
 All plugin/frawor/lua features are available only if vim is compiled with 
 lua support.
         need to do anything to make it work.
 
 ------------------------------------------------------------------------------
-3.12. plugin/frawor/ruby features                       *frawor-f-frawor/ruby*
+3.13. plugin/frawor/ruby features                       *frawor-f-frawor/ruby*
 
 All plugin/frawor/ruby features are available only if vim is compiled with 
 ruby support.
         feature, so you don't need to do anything to make it work.
 
 ------------------------------------------------------------------------------
-3.13. plugin/frawor/tcl features                        *frawor-f-frawor/tcl*
+3.14. plugin/frawor/tcl features                        *frawor-f-frawor/tcl*
 
 All plugin/frawor/tcl features are available only if vim is compiled with 
 tcl support.

plugin/frawor/checks.vim

             \exists('g:frawor__donotload')
     finish
 endif
-execute frawor#Setup('0.0', {'@/fwc': '0.0'}, 1)
+execute frawor#Setup('0.0', {'@/fwc': '0.0',
+            \          '@/functions': '0.0'}, 1)
 "▶1 _messages
 if v:lang=~?'ru'
     let s:_messages={
 call s:_f.newfeature('consfilter', {'cons': s:F.consfilter,
             \                     'unload': s:F.delfilters,
             \                       'init': {'ids': []}})
+"▶1 Decorators: checker and filter
+let s:F.de={}
+"▶2 checker
+function s:F.de.checker(plugdict, fname, Arg)
+    let throwargs="'".a:fname."', ".
+                \substitute(string(a:plugdict.id), "\n", '''."\\n".''', 'g')
+    return [128, '@@@', a:plugdict.g._f.conschecker(a:Arg),
+                \['if !@%@(@@@)',
+                \     'call s:_f.throw("checkfailed", '.throwargs.')',
+                \ 'endif',], [], 0]
+endfunction
+call s:_f.adddecorator('checker', s:F.de.checker)
+"▶2 filter
+function s:F.de.filter(plugdict, fname, Arg)
+    let throwargs="'".a:fname."', ".
+                \substitute(string(a:plugdict.id), "\n", '''."\\n".''', 'g')
+    return [64, 'args', a:plugdict.g._f.consfilter(a:Arg),
+                \['let args=@%@(@@@)',
+                \ 'if type(args)!='.type([]),
+                \ '    call s:_f.throw("filterfailed", '.throwargs.')',
+                \ 'endif',], [], 0]
+endfunction
+call s:_f.adddecorator('filter', s:F.de.filter)
+"▲2
+unlet s:F.de
 "▶1
 call frawor#Lockvar(s:, 'checkers,filters')
 " vim: fmr=▶,▲ sw=4 ts=4 sts=4 et tw=80

plugin/frawor/functions.vim

             \exists('g:frawor__donotload')
     finish
 endif
-execute frawor#Setup('0.0', {'plugin/frawor/checks': '0.0',
-            \             'plugin/frawor/functions': '0.0',}, 1)
+execute frawor#Setup('0.0', {}, 1)
 "▶1 _messages
 if v:lang=~?'ru'
     let s:_messages={
 "▶2 Register feature
 call s:_f.newfeature('adddecorator', {'cons': s:F.adddecorator,
             \                       'unload': s:F.deldecorators,})
-"▶1 Decorators
-let s:F.de={}
-"▶2 checker
-function s:F.de.checker(plugdict, fname, Arg)
-    let throwargs="'".a:fname."', ".
-                \substitute(string(a:plugdict.id), "\n", '''."\\n".''', 'g')
-    return [128, '@@@',
-                \s:_f.conschecker(
-                \((type(a:Arg)==2)?
-                \   (s:F.refunction(a:plugdict.sid, a:Arg,
-                \                   'uref', a:plugdict.id,"checker",a:fname)):
-                \   (a:Arg))),
-                \['if !@%@(@@@)',
-                \     'call s:_f.throw("checkfailed", '.throwargs.')',
-                \ 'endif',], [], 0]
-endfunction
-call s:_f.adddecorator('checker', s:F.de.checker)
-"▶2 filter
-function s:F.de.filter(plugdict, fname, Arg)
-    let throwargs="'".a:fname."', ".
-                \substitute(string(a:plugdict.id), "\n", '''."\\n".''', 'g')
-    return [64, 'args',
-                \s:_f.consfilter(
-                \((type(a:Arg)==2)?
-                \   (s:F.refunction(a:plugdict.sid, a:Arg,
-                \                   'uref', a:plugdict.id,"filter",a:fname)):
-                \   (a:Arg))),
-                \['let args=@%@(@@@)',
-                \ 'if type(args)!='.type([]),
-                \ '    call s:_f.throw("filterfailed", '.throwargs.')',
-                \ 'endif',], [], 0]
-endfunction
-call s:_f.adddecorator('filter', s:F.de.filter)
-"▲2
-unlet s:F.de
 "▶1
 call frawor#Lockvar(s:, 'decorators,extfunctions,wrappedfuncs,lastdeid,'.
             \           '_checkers,_filters')

test/reload-frawor.ok

 unloadpre: plugin/frawor/options
 unloadpre: plugin/writefile-feature
 unloadpre: plugin/frawor/decorators/altervars
+unloadpre: plugin/frawor/checks
+unloadpre: plugin/frawor/functions
 unloadpre: plugin/frawor/fwc
 unloadpre: plugin/frawor/fwc/compiler
 unloadpre: plugin/frawor/fwc/parser
 unloadpre: plugin/frawor/os
 unloadpre: plugin/frawor/resources
-unloadpre: plugin/frawor/functions
-unloadpre: plugin/frawor/checks
 unloadpre: plugin/frawor
 unload: autoload/frawor
 unload: plugin/frawor/commands
 _unload
 register: plugin/frawor/options
 load: plugin/frawor/options
-register: plugin/frawor/autocommands
-load: plugin/frawor/autocommands
+register: plugin/frawor/fwc
+load: plugin/frawor/fwc
+register: plugin/ignoredeps-feature
+load: plugin/ignoredeps-feature
 register: plugin/frawor/functions
 load: plugin/frawor/functions
-register: plugin/frawor/checks
-load: plugin/frawor/checks
 register: plugin/frawor/os
 load: plugin/frawor/os
 register: autoload/frawor
 load: autoload/frawor
-register: plugin/ignoredeps-feature
-load: plugin/ignoredeps-feature
+register: plugin/writefile-feature
+load: plugin/writefile-feature
+register: plugin/frawor/autocommands
+load: plugin/frawor/autocommands
 register: plugin/frawor/fwc/parser
 load: plugin/frawor/fwc/parser
-register: plugin/frawor/fwc
-load: plugin/frawor/fwc
 register: plugin/frawor
 load: plugin/frawor
 register: plugin/frawor/fwc/compiler
 load: plugin/frawor/fwc/compiler
 register: plugin/frawor/resources
 load: plugin/frawor/resources
-register: plugin/writefile-feature
-load: plugin/writefile-feature
+register: plugin/frawor/checks
+load: plugin/frawor/checks
 register: plugin/frawor/decorators/altervars
 load: plugin/frawor/decorators/altervars
 register: plugin/frawor/tcl

test/rtp/plugin/adddecorator.vim

 execute frawor#Setup('0.0', {'@/functions': '0.0',
             \              '@adddecorator': '0.0',
-            \     '@/decorators/altervars': '0.0'}, 1)
+            \     '@/decorators/altervars': '0.0',
+            \                   '@/checks': '0.0'}, 1)
 function s:F.testdecorator(plugdict, ...)
     call WriteFile('decargs: {'.a:plugdict.id.'}, '.string(a:000)[1:-2])
     return [10, '@@@', 0, ['try',

test/rtp/plugin/wrapfunc-checker,filter,+buffer.vim

 execute frawor#Setup('0.0', {'@/functions': '0.0',
-            \     '@/decorators/altervars': '0.0'}, 1)
+            \     '@/decorators/altervars': '0.0',
+            \                   '@/checks': '0.0'}, 1)
 function s:F.wrappedfunc()
     call WriteFile('funcbefore:b'.bufnr('%'))
     new

test/rtp/plugin/wrapfunc-checker.vim

-execute frawor#Setup('0.0', {'plugin/frawor/functions': '0.0'}, 1)
+execute frawor#Setup('0.0', {'@/functions': '0.0',
+            \                   '@/checks': '0.0'}, 1)
 function s:F.wrappedfunc(bool)
     call WriteFile('arg:'.a:bool)
 endfunction

test/rtp/plugin/wrapfunc-filter.vim

-execute frawor#Setup('0.0', {'plugin/frawor/functions': '0.0'}, 1)
+execute frawor#Setup('0.0', {'@/functions': '0.0',
+            \                   '@/checks': '0.0'}, 1)
 function s:F.wrappedfunc(bool)
     call WriteFile('arg:'.a:bool)
 endfunction

test/rtp/plugin/wrapfunc_cons-checker,filter,+buffer.vim

 execute frawor#Setup('0.0', {'@/functions': '0.0',
-            \     '@/decorators/altervars': '0.0'}, 1)
+            \     '@/decorators/altervars': '0.0',
+            \                   '@/checks': '0.0'}, 1)
 function s:F.wrappedfunc()
     call WriteFile('funcbefore:b'.bufnr('%'))
     new

test/rtp/plugin/wrapfunc_cons-checker.vim

-execute frawor#Setup('0.0', {'plugin/frawor/functions': '0.0'}, 1)
+execute frawor#Setup('0.0', {'@/functions': '0.0',
+            \                   '@/checks': '0.0'}, 1)
 function s:F.wrappedfunc(bool)
     call WriteFile('arg:'.a:bool)
 endfunction

test/rtp/plugin/wrapfunc_cons-filter.vim

-execute frawor#Setup('0.0', {'plugin/frawor/functions': '0.0'}, 1)
+execute frawor#Setup('0.0', {'@/functions': '0.0',
+            \                   '@/checks': '0.0'}, 1)
 function s:F.wrappedfunc(bool)
     call WriteFile('arg:'.a:bool)
 endfunction