1. ZyX_I
  2. frawor

Commits

ZyX_I  committed 3f70121

@/functions: moved altervars decorator to a separate plugin

  • Participants
  • Parent commits b539e6a
  • Branches default

Comments (0)

Files changed (63)

File plugin/frawor/decorators/altervars.vim

View file
  • Ignore whitespace
+"▶1 Header
+scriptencoding utf-8
+if exists('s:_pluginloaded') || exists('g:fraworOptions._donotload') ||
+            \exists('g:frawor__donotload')
+    finish
+endif
+execute frawor#Setup('0.0', {'@/functions': '0.0',
+            \                   '@/checks': '0.0',
+            \     '@/decorators/altervars': '0.0'}, 1)
+"▶1 Define messages
+if v:lang=~?'ru'
+    let s:_messages={
+                \    'idnotstr': 'Ошибка создания сохраняющей и '.
+                \                'восстанавливающей функций для '.
+                \                'дополнения %s: их название '.
+                \                'не является строкой',
+                \       'invid': 'Ошибка создания сохраняющей и '.
+                \                'восстанавливающей функций для '.
+                \                'дополнения %s: строка «%s» '.
+                \                'не может являться названием',
+            \}
+    call extend(s:_messages, map({
+                \     'altnlst': 'ключ «altervars» не является списком',
+                \   'altelnlst': 'элемент %u значения ключа «altervars» '.
+                \                'описания функции не является списком',
+                \ 'altelinvlen': 'элемент %u значения ключа «altervars» '.
+                \                'описания функции имеет неверную длину %u '.
+                \                '(список должен содержать один или '.
+                \                 'два элемента)',
+                \   'altelnstr': 'первый элемент элемента %u значения ключа '.
+                \                '«altervars» описания функции '.
+                \                'не является строкой',
+                \    'invvnlen': 'неверен первый элемент элемента %u '.
+                \                'значения ключа «altervars»: длина строки '.
+                \                'не может быть меньше двух символов',
+                \    'invvname': 'неверен первый элемент элемента %u '.
+                \                'значения ключа «altervars»: строка «%s» '.
+                \                'не может являться именем переменной',
+                \    'noocpref': 'неверен первый элемент элемента %u '.
+                \                'значения ключа «altervars»: в имени '.
+                \                'настройки «%s» отсутстувет префикс '.
+                \                '(g: или l:)',
+                \    'invoname': 'неверен первый элемент элемента %u '.
+                \                'значения ключа «altervars»: строка «%s» '.
+                \                'не может являться именем настройки',
+                \     'invoval': 'неверен второй элемент элемента %u '.
+                \                'значения ключа «altervars»: '.
+                \                'тип элемента не совпадает с типом настройки',
+                \     'noclose': 'неверен первый элемент элемента %u '.
+                \                'значения ключа «altervars»: '.
+                \                'отсутствует закрывающая скобка',
+                \     'spnoarg': 'неверен первый элемент элемента %u '.
+                \                'значения ключа «altervars»: '.
+                \                'сохраняющая функция %s не принимает '.
+                \                'дополнительных аргументов',
+                \'acheckfailed': 'неверен первый элемент элемента %u '.
+                \                'значения ключа «altervars»: '.
+                \                'аргумент сохраняющей функции %s не прошёл '.
+                \                'проверку',
+                \      'usaver': 'неверен первый элемент элемента %u '.
+                \                'значения ключа «altervars»: '.
+                \                'неизвестна сохраняющая функция %s',
+                \    'spmisarg': 'неверен первый элемент элемента %u '.
+                \                'значения ключа «altervars»: '.
+                \                'сохраняющая функция %s требует наличия '.
+                \                'дополнительного аргумента',
+                \      'notdep': 'неверен первый элемент элемента %u '.
+                \                'значения ключа «altervars»: '.
+                \                'дополнение %s, определившее сохраняющую '.
+                \                'функцию %s, не указано в списке зависимостей',
+                \        'ualt': 'неверен первый элемент элемента %u '.
+                \                'значения ключа «altervars»: '.
+                \                'способ обработки «%s» неизвестен',
+            \}, '"Ошибка создания функции %s для дополнения %s: ".v:val'))
+    call extend(s:_messages, map({
+                \     'ssiddef': 'функции уже определены дополнением %s',
+                \  'savnotfunc': 'второй аргумент не является '.
+                \                'ссылкой на функцию',
+                \  'setnotfunc': 'третий аргумент не является '.
+                \                'ссылкой на функцию',
+                \  'ssmanyargs': 'слишком большое количество аргументов',
+                \  'ssoptsndct': 'дополнительный аргумент не является словарём',
+                \   'sssavuref': 'сохраняющая функция является ссылкой '.
+                \                'на неизвестную функцию',
+                \   'ssseturef': 'восстанавливающая функция является ссылкой '.
+                \                'на неизвестную функцию',
+            \},
+            \'"Ошибка создания сохраняющей и восстанавливающей функций '.
+            \ '%s для дополнения %s: ".v:val'))
+else
+    let s:_messages={
+                \    'idnotstr': 'Error while creating saver and setter '.
+                \                'functions for plugin %s: id is not a String',
+                \       'invid': 'Error while creating saver and setter '.
+                \                'functions for plugin %s: string `%s'' '.
+                \                'is not a valid identifier',
+            \}
+    call extend(s:_messages, map({
+                \     'altnlst': 'key `altervars'' is not a list',
+                \   'altelnlst': 'element %u of `altervars'' value '.
+                \                'of the function description is not a list',
+                \ 'altelinvlen': 'element %u of `altervars'' value '.
+                \                'of the function description has invalid '.
+                \                'length %u while expected 1 or 2',
+                \   'altelnstr': 'first element of element %u of `altervars'' '.
+                \                'value of the function description is '.
+                \                'not a string',
+                \    'invvnlen': 'first element of element %u of `altervars'' '.
+                \                'value is not valid: string must be at least '.
+                \                'two characters long',
+                \    'invvname': 'first element of element %u of `altervars'' '.
+                \                'value is not valid: string `%s'' '.
+                \                'is not a variable name',
+                \    'noocpref': 'first element of element %u of `altervars'' '.
+                \                'value is not valid: there should be '.
+                \                'g: or l: prefix before option name in '.
+                \                'the string `%s''',
+                \    'invoname': 'first element of element %u of `altervars'' '.
+                \                'value is not valid: string `%s'' '.
+                \                'is not an option name',
+                \     'invoval': 'second element of element %u '.
+                \                'of `altervars'' value is not valid: '.
+                \                'type of the element does not match type of '.
+                \                'the option',
+                \     'noclose': 'first element of element %u of `altervars'' '.
+                \                'value is not valid: closing bracket '.
+                \                'not found',
+                \     'spnoarg': 'first element of element %u of `altervars'' '.
+                \                'value is not valid: saver %s does '.
+                \                'not accept additional arguments',
+                \'acheckfailed': 'first element of element %u of `altervars'' '.
+                \                'value is not valid: argument of saver %s '.
+                \                'failed to pass check',
+                \      'usaver': 'first element of element %u of `altervars'' '.
+                \                'value is not valid: saver %s is not known',
+                \    'spmisarg': 'first element of element %u of `altervars'' '.
+                \                'value is not valid: saver %s requires '.
+                \                'additional argument',
+                \      'notdep': 'first element of element %u of `altervars'' '.
+                \                'value is not valid: plugin %s that defined '.
+                \                'saver %s is not in dependencies list',
+                \        'ualt': 'first element of element %u of `altervars'' '.
+                \                'value is not valid: unable to determine '.
+                \                'how to process %s',
+            \}, '"Error while creating function %s for plugin %s: ".v:val'))
+    call extend(s:_messages, map({
+                \     'ssiddef': 'they were already defined by plugin %s',
+                \  'savnotfunc': 'saver is not a function reference',
+                \  'setnotfunc': 'setter is not a function reference',
+                \  'ssmanyargs': 'too many arguments',
+                \  'ssoptsndct': 'options argument is not a Dictionary',
+                \   'sssavuref': 'saver is a reference to unknown function',
+                \   'ssseturef': 'setter is a reference to unknown function',
+            \},
+            \'"Error while creating saver and setter functions with id %s '.
+            \ 'for plugin %s: ".v:val'))
+endif
+"▶1 rewritefname    :: sid, Funcref → funcname
+function s:F.rewritefname(sid, Fref)
+    let fstr=string(a:Fref)[10:-3]
+    if fstr[:1]==#'s:'
+        let fstr='<SNR>'.a:sid.'_'.fstr[2:]
+    endif
+    return fstr
+endfunction
+"▶1 refunction      :: sid, Funcref, throwargs → Funcref
+function s:F.refunction(sid, Fref, ...)
+    let fstr=s:F.rewritefname(a:sid, a:Fref)
+    if string(+fstr)==#fstr
+        return a:Fref
+    else
+        if !exists('*'.fstr)
+            call call(s:_f.throw, a:000, {})
+        endif
+        return function(fstr)
+    endif
+endfunction
+"▶1 Decorator
+let s:altervars={'lastid': 0}
+let s:ss={}
+let s:altdict={'altervars': s:altervars,
+            \         'ss': s:ss}
+function s:F.altervars(plugdict, fname, arg)
+    "▶2 Check a:arg
+    if type(a:arg)!=type([])
+        call s:_f.throw('altnlst', a:fname, a:plugdict.id)
+    endif
+    "▶2 Define variables
+    let preret=['let @$@={}',
+                \     'try',]
+    let postret=['finally']
+    let laltvars=len(a:arg)
+    let plid=a:plugdict.id
+    let i=0
+    let id=printf('%x', s:altervars.lastid)
+    let fpref='@%@.altervars.'.id
+    let altcopy=map(copy(a:arg), 'copy(v:val)')
+    let s:altervars[id]=altcopy
+    let s:altervars.lastid+=1
+    "▲2
+    while i<laltvars
+        "▶2 Check current element
+        if type(a:arg[i])!=type([])
+            call s:_f.throw('altelnlst', a:fname, plid, i)
+        elseif empty(a:arg[i]) || len(a:arg[i])>2
+            call s:_f.throw('altelinvlen', a:fname, plid, i, len(a:arg[i]))
+        elseif type(a:arg[i][0])!=type("")
+            call s:_f.throw('altelnstr', a:fname, plid, i)
+        endif
+        "▲2
+        let element=altcopy[i]
+        let varname=element[0]
+        let vnlen=len(varname)
+        let hasvar=(len(element)>1)
+        let warnargs="'".varname."', '".a:fname."', ".
+                    \substitute(string(plid), "\n",
+                    \           '''."\\n".''', 'g').', v:exception'
+        "▶2 Check varname length
+        if vnlen<2
+            call s:_f.throw('invvnlen', a:fname, plid, i)
+        "▶2 Process variables
+        elseif varname[1]==#':' && index(['g','b','t','w'], varname[0])!=-1
+            "▶3 Check variable name
+            if varname[2:]!~#'^\h\w*$'
+                call s:_f.throw('invvname', a:fname, plid, i, varname[2:])
+            endif
+            "▲3
+            let preret+=['if exists("'.varname.'")',
+                        \          'let @$@.'.i.'='.varname]
+            if hasvar
+                " Unlet variable to be sure that it won't cause E706 
+                " (variable type mismatch) error
+                let preret+=['unlet '.varname,
+                            \   'endif',
+                            \   'let '.varname.'=']
+                if type(element[1])==type(0) ||
+                            \(has("float") && type(element[1])==type(0.0) &&
+                            \ string(element[1])!~'\w')
+                    let preret[-1].=string(element[1])
+                else
+                    let preret[-1].=fpref."[".i."][1]"
+                endif
+            else
+                call add(preret, 'endif')
+            endif
+            " Restore the previous status: variable will be left undefined if it 
+            " was not defined before function was run
+            let postret+=['if exists("'.varname.'")',
+                        \         'unlet '.varname,
+                        \     'endif',
+                        \     'if has_key(@$@, '.i.')',
+                        \         'let '.varname.'=@$@.'.i,
+                        \     'endif',]
+        "▶2 Process options
+        elseif varname[0]==#'&' && vnlen>3
+            "▶3 Check option name
+            if varname[2]!=#':' || !(varname[1]==#'g' || varname[1]==#'l')
+                call s:_f.throw('noocpref', a:fname, plid, i, varname)
+            elseif varname[3:]!~#'^\l\+$'
+                call s:_f.throw('invoname', a:fname, plid, i, varname[3:])
+            endif
+            "▲3
+            if exists('+'.varname[1:])
+                let ovarname='@$@'.varname[1].'_'.varname[3:]
+                call add(preret, 'let '.ovarname.'='.varname)
+                if hasvar
+                    "▶3 Check value type
+                    if type(element[1])!=type(eval(varname))
+                        call s:_f.throw('invoval', a:fname, plid, i)
+                    endif
+                    "▲3
+                    call add(preret, 'let '.varname.'='.
+                                \substitute(string(element[1]), '\n',
+                                \                  '''."\\n".''', 'g'))
+                endif
+                let postret+=['let '.varname.'='.ovarname]
+            endif
+        "▶2 Process special
+        elseif varname[0]==#'+'
+            "▶3 *args, varname
+            let saveargs=''
+            let setargs=fpref."[".i."][1]"
+            let set2args='@$@.'.i
+            let varname=varname[1:]
+            "▲3
+            let bidx=stridx(varname, '(')
+            "▶3 If argument is supplied
+            if bidx!=-1
+                "▶4 Altering varname, element and *args variables
+                let noclose=(varname[-1:]!=#')')
+                if !hasvar
+                    call add(element, 0)
+                endif
+                call add(element, varname[(bidx+1):-2])
+                let varname=varname[:(bidx-1)]
+                let element[0]='+'.varname
+                let saveargs=fpref."[".i."][2]"
+                let setargs.=", ".saveargs
+                let set2args.=", ".saveargs
+                "▶4 Check existance of special
+                if !has_key(s:ss, varname)
+                    call s:_f.throw('usaver', a:fname, plid, i, varname)
+                endif
+                let ssdef=s:ss[varname]
+                "▶4 Checking () expr
+                if noclose
+                    call s:_f.throw('noclose', a:fname, plid, i)
+                elseif !ssdef.hasarg
+                    call s:_f.throw('spnoarg', a:fname, plid, i, varname)
+                elseif has_key(ssdef, 'checker') && !ssdef.checker([element[2]])
+                    call s:_f.throw('acheckfailed', a:fname, plid, i, varname)
+                endif
+            "▶3 Else just check existance of special
+            else
+                if !has_key(s:ss, varname)
+                    call s:_f.throw('usaver', a:fname, plid, i, varname)
+                endif
+            endif
+            "▲3
+            let ssdef=s:ss[varname]
+            "▶3 Check special name and existance of all arguments
+            if ssdef.hasarg==2 && bidx==-1
+                call s:_f.throw('spmisarg', a:fname, plid, i, varname)
+            elseif !has_key(a:plugdict.dependencies, ssdef.plid)
+                call s:_f.throw('notdep', a:fname, plid, i, ssdef.plid, varname)
+            endif
+            "▲3
+            let preret+=['try',
+                        \          'let @$@.'.i.'=@%@.ss.'.varname.'.saver'.
+                        \                                      '('.saveargs.')',
+                        \      'catch',
+                        \          'call s:_f.warn("savexcept", '.warnargs.')',
+                        \      'endtry',]
+            if hasvar
+                let preret+=['try',
+                            \          'call @%@.ss.'.varname.'.setter'.
+                            \                                   '('.setargs.')',
+                            \      'catch',
+                            \          'call s:_f.warn("setexcept", '.
+                            \                                 warnargs.')',
+                            \      'endtry',]
+            endif
+            let postret+=['try',
+                        \         'call @%@.ss.'.varname.'.setter'.
+                        \                                      '('.set2args.')',
+                        \     'catch',
+                        \         'call s:_f.warn("set2except", '.warnargs.')',
+                        \     'endtry',]
+        "▶2 Process unknown
+        else
+            call s:_f.throw('ualt', a:fname, plid, i, varname)
+        endif
+        "▶2 Finish cycle (increment+unlet)
+        let i+=1
+        unlet element
+        "▲2
+    endwhile
+    call add(postret, 'endtry')
+    return [192, '@@@', s:altdict, preret, postret, 0]
+endfunction
+call s:_f.adddecorator('altervars', s:F.altervars)
+"▶1 addaltspecial feature
+"▶2 delaltspecials  :: {f} → s:ss, fdict
+function s:F.delaltspecials(plugdict, fdict)
+    for ssdef in values(a:fdict)
+        unlet s:ss[ssdef.id]
+        unlet a:fdict[ssdef.id]
+    endfor
+endfunction
+"▶2 addaltspecial   :: {f}, ssid, Saver::Funcref, Setter::Funcref[, ssopts] → +…
+function s:F.addaltspecial(plugdict, fdict, ssid, Saver, Setter, ...)
+    "▶3 Check arguments
+    if type(a:ssid)!=type("")
+        call s:_f.throw('idnotstr', a:plugdict.id)
+    elseif a:ssid!~#'^\h\w*$'
+        call s:_f.throw('invid', a:plugdict.id, a:ssid)
+    elseif has_key(s:ss, a:ssid)
+        call s:_f.throw('ssiddef', a:ssid, a:plugdict.id,
+                    \              s:ss[a:ssid].plid)
+    elseif type(a:Saver)!=2
+        call s:_f.throw('savnotfunc', a:ssid, a:plugdict.id)
+    elseif type(a:Setter)!=2
+        call s:_f.throw('setnotfunc', a:ssid, a:plugdict.id)
+    elseif a:0>1
+        call s:_f.throw('ssmanyargs', a:ssid, a:plugdict.id)
+    elseif a:0
+        if type(a:1)!=type({})
+            call s:_f.throw('ssoptsndct', a:ssid, a:plugdict.id)
+        endif
+    endif
+    "▲3
+    let ssdef={
+                \    "id": a:ssid,
+                \  "plid": a:plugdict.id,
+                \ "saver": s:F.refunction(a:plugdict.sid, a:Saver,
+                \                         'sssavuref', a:ssid, a:plugdict.id),
+                \"setter": s:F.refunction(a:plugdict.sid, a:Setter,
+                \                         'ssseturef', a:ssid, a:plugdict.id),
+                \"hasarg": 0,
+            \}
+    if a:0
+        if has_key(a:1, 'requiresarg')
+            let ssdef.hasarg=2
+        elseif has_key(a:1, 'acceptsarg')
+            let ssdef.hasarg=1
+        endif
+        if has_key(a:1, 'checker')
+            let ssdef.checker=s:_f.conschecker(a:1.checker)
+        endif
+    endif
+    let s:ss[ssdef.id]=ssdef
+    let a:fdict[ssdef.id]=ssdef
+endfunction
+"▶2 Register feature
+call s:_f.newfeature('addaltspecial', {'cons': s:F.addaltspecial,
+            \                        'unload': s:F.delaltspecials,})
+"▶1 Savers/setters
+"▶2 Define dictionaries
+let s:F.saver={}
+let s:F.setter={}
+let s:F.sschk={}
+"▶2 winview
+call s:_f.addaltspecial('winview', function('winsaveview'),
+            \                      function('winrestview'))
+"▶2 buffer
+function s:F.saver.buffer()
+    return bufnr('%')
+endfunction
+function s:F.setter.buffer(bufnr)
+    if type(a:bufnr)==type(0) && a:bufnr!=bufnr('%') && bufexists(a:bufnr)
+        try
+            execute "buffer ".a:bufnr
+        catch
+            " Setter must not throw anything: it may break things
+            echohl ErrorMsg
+            echomsg v:exception
+            echohl None
+        endtry
+    endif
+endfunction
+call s:_f.addaltspecial('buffer', s:F.saver.buffer, s:F.setter.buffer)
+"▶2 variables
+"▶3 check
+function s:F.sschk.variables(arg)
+    if a:arg[0]!~#'^[gtbw]$'
+        call s:_f.throw('invvcvar', a:arg[0])
+    endif
+    return 1
+endfunction
+"▶3 save
+function s:F.saver.variables(...)
+    let dname=get(a:000, 0, 'g').':'
+    return copy(eval(dname))
+endfunction
+"▶3 set
+function s:F.setter.variables(oldv, ...)
+    if type(a:oldv)!=type({})
+        return
+    endif
+    let dname=get(a:000, 0, 'g').':'
+    let v=eval(dname)
+    for name in filter(keys(v), '!has_key(a:oldv, v:val)')
+        unlet v[name]
+    endfor
+    call extend(v, filter(a:oldv, 'v:key=~#"^\\h\\w*$"'), 'force')
+endfunction
+"▲3
+call s:_f.addaltspecial('variables', s:F.saver.variables, s:F.setter.variables,
+            \                               {'checker': s:F.sschk.variables,
+            \                             'acceptsarg': 1,})
+"▶2 matches
+call s:_f.addaltspecial('matches',function('getmatches'),function('setmatches'))
+"▶2 qflist
+function s:F.setqflist(list)
+    return setqflist(a:list, 'r')
+endfunction
+call s:_f.addaltspecial('qflist', function('getqflist'), s:F.setqflist)
+"▲2
+unlet s:F.saver s:F.setter s:F.sschk
+"▶1
+call frawor#Lockvar(s:, 'altervars,ss,altdict')
+lockvar 1 s:altdict
+" vim: fmr=▶,▲ sw=4 ts=4 sts=4 et tw=80

File plugin/frawor/functions.vim

View file
  • Ignore whitespace
 endif
 execute frawor#Setup('0.0', {'plugin/frawor/checks': '0.0',
             \             'plugin/frawor/functions': '0.0',}, 1)
-let s:sidfpref=substitute(s:Eval('expand("<sfile>")[9:-5]'), s:_sid,'%u','')
 "▶1 _messages
 if v:lang=~?'ru'
     let s:_messages={
                 \      'nofunc': 'описание функции не содержит '.
                 \                'ключа «function»',
                 \        'nref': 'ключ «%s» не является ссылкой на функцию',
-                \     'altnlst': 'ключ «altervars» не является списком',
-                \   'altelnlst': 'элемент %u значения ключа «altervars» '.
-                \                'описания функции не является списком',
-                \ 'altelinvlen': 'элемент %u значения ключа «altervars» '.
-                \                'описания функции имеет неверную длину %u '.
-                \                '(список должен содержать один или '.
-                \                 'два элемента)',
-                \   'altelnstr': 'первый элемент элемента %u значения ключа '.
-                \                '«altervars» описания функции '.
-                \                'не является строкой',
-                \    'invvnlen': 'неверен первый элемент элемента %u '.
-                \                'значения ключа «altervars»: длина строки '.
-                \                'не может быть меньше двух символов',
-                \    'invvname': 'неверен первый элемент элемента %u '.
-                \                'значения ключа «altervars»: строка «%s» '.
-                \                'не может являться именем переменной',
-                \    'noocpref': 'неверен первый элемент элемента %u '.
-                \                'значения ключа «altervars»: в имени '.
-                \                'настройки «%s» отсутстувет префикс '.
-                \                '(g: или l:)',
-                \    'invoname': 'неверен первый элемент элемента %u '.
-                \                'значения ключа «altervars»: строка «%s» '.
-                \                'не может являться именем настройки',
-                \     'invoval': 'неверен второй элемент элемента %u '.
-                \                'значения ключа «altervars»: '.
-                \                'тип элемента не совпадает с типом настройки',
-                \     'noclose': 'неверен первый элемент элемента %u '.
-                \                'значения ключа «altervars»: '.
-                \                'отсутствует закрывающая скобка',
-                \     'spnoarg': 'неверен первый элемент элемента %u '.
-                \                'значения ключа «altervars»: '.
-                \                'сохраняющая функция %s не принимает '.
-                \                'дополнительных аргументов',
-                \'acheckfailed': 'неверен первый элемент элемента %u '.
-                \                'значения ключа «altervars»: '.
-                \                'аргумент сохраняющей функции %s не прошёл '.
-                \                'проверку',
-                \      'usaver': 'неверен первый элемент элемента %u '.
-                \                'значения ключа «altervars»: '.
-                \                'неизвестна сохраняющая функция %s',
-                \    'spmisarg': 'неверен первый элемент элемента %u '.
-                \                'значения ключа «altervars»: '.
-                \                'сохраняющая функция %s требует наличия '.
-                \                'дополнительного аргумента',
-                \      'notdep': 'неверен первый элемент элемента %u '.
-                \                'значения ключа «altervars»: '.
-                \                'дополнение %s, определившее сохраняющую '.
-                \                'функцию %s, не указано в списке зависимостей',
-                \        'ualt': 'неверен первый элемент элемента %u '.
-                \                'значения ключа «altervars»: '.
-                \                'способ обработки «%s» неизвестен',
                 \   'invdecret': 'декоратор %s вернул неверное значение',
                 \     'decndep': 'дополнение, определившее декоратор %s, '.
                 \                'не находится в списке зависимостей',
                 \                'значение, не являющееся списком',
                 \    'invvcvar': 'Строка «%s» не может указывать на то, '.
                 \                'какие переменные следует сохранить',
-                \    'idnotstr': 'Ошибка создания сохраняющей и '.
-                \                'восстанавливающей функций для '.
-                \                'дополнения %s: их название '.
-                \                'не является строкой',
-                \       'invid': 'Ошибка создания сохраняющей и '.
-                \                'восстанавливающей функций для '.
-                \                'дополнения %s: строка «%s» '.
-                \                'не может являться названием',
                 \   'savexcept': 'Ошибка при запуске сохраняющей функции %s '.
                 \                'для функции %s дополнения %s: %s',
                 \   'setexcept': 'Ошибка при запуске восстанавливающей '.
                 \    'deceqpri': 'Приоритет декораторов %s и %s совпадает',
             \})
     call extend(s:_messages, map({
-                \     'ssiddef': 'функции уже определены дополнением %s',
-                \  'savnotfunc': 'второй аргумент не является '.
-                \                'ссылкой на функцию',
-                \  'setnotfunc': 'третий аргумент не является '.
-                \                'ссылкой на функцию',
-                \  'ssmanyargs': 'слишком большое количество аргументов',
-                \  'ssoptsndct': 'дополнительный аргумент не является словарём',
-                \   'sssavuref': 'сохраняющая функция является ссылкой '.
-                \                'на неизвестную функцию',
-                \   'ssseturef': 'восстанавливающая функция является ссылкой '.
-                \                'на неизвестную функцию',
-            \},
-            \'"Ошибка создания сохраняющей и восстанавливающей функций '.
-            \ '%s для дополнения %s: ".v:val'))
-    call extend(s:_messages, map({
                 \     'deiddef': 'обвязка уже определена дополнением %s',
                 \     'decnfun': 'обвязка является не является ссылкой '.
                 \                'на функцию',
                 \      'nofunc': 'function description lacks '.
                 \                '`function'' key',
                 \        'nref': 'key `%s'' is not a function reference',
-                \     'altnlst': 'key `altervars'' is not a list',
-                \   'altelnlst': 'element %u of `altervars'' value '.
-                \                'of the function description is not a list',
-                \ 'altelinvlen': 'element %u of `altervars'' value '.
-                \                'of the function description has invalid '.
-                \                'length %u while expected 1 or 2',
-                \   'altelnstr': 'first element of element %u of `altervars'' '.
-                \                'value of the function description is '.
-                \                'not a string',
-                \    'invvnlen': 'first element of element %u of `altervars'' '.
-                \                'value is not valid: string must be at least '.
-                \                'two characters long',
-                \    'invvname': 'first element of element %u of `altervars'' '.
-                \                'value is not valid: string `%s'' '.
-                \                'is not a variable name',
-                \    'noocpref': 'first element of element %u of `altervars'' '.
-                \                'value is not valid: there should be '.
-                \                'g: or l: prefix before option name in '.
-                \                'the string `%s''',
-                \    'invoname': 'first element of element %u of `altervars'' '.
-                \                'value is not valid: string `%s'' '.
-                \                'is not an option name',
-                \     'invoval': 'second element of element %u '.
-                \                'of `altervars'' value is not valid: '.
-                \                'type of the element does not match type of '.
-                \                'the option',
-                \     'noclose': 'first element of element %u of `altervars'' '.
-                \                'value is not valid: closing bracket '.
-                \                'not found',
-                \     'spnoarg': 'first element of element %u of `altervars'' '.
-                \                'value is not valid: saver %s does '.
-                \                'not accept additional arguments',
-                \'acheckfailed': 'first element of element %u of `altervars'' '.
-                \                'value is not valid: argument of saver %s '.
-                \                'failed to pass check',
-                \      'usaver': 'first element of element %u of `altervars'' '.
-                \                'value is not valid: saver %s is not known',
-                \    'spmisarg': 'first element of element %u of `altervars'' '.
-                \                'value is not valid: saver %s requires '.
-                \                'additional argument',
-                \      'notdep': 'first element of element %u of `altervars'' '.
-                \                'value is not valid: plugin %s that defined '.
-                \                'saver %s is not in dependencies list',
-                \        'ualt': 'first element of element %u of `altervars'' '.
-                \                'value is not valid: unable to determine '.
-                \                'how to process %s',
                 \   'invdecret': 'decorator %s returned invalid value',
                 \     'decndep': 'plugin that defined decorator %s '.
                 \                'is not in dependency list',
                 \                'returned value that is not a list',
                 \    'invvcvar': 'String `%s'' does not describe which '.
                 \                'variables should be saved',
-                \    'idnotstr': 'Error while creating saver and setter '.
-                \                'functions for plugin %s: id is not a String',
-                \       'invid': 'Error while creating saver and setter '.
-                \                'functions for plugin %s: string `%s'' '.
-                \                'is not a valid identifier',
                 \   'savexcept': 'Error while running saver function %s '.
                 \                'for function %s of a plugin %s: %s',
                 \   'setexcept': 'Error while running setter function %s '.
                 \    'deceqpri': 'Decorators %s and %s have equal priority',
             \})
     call extend(s:_messages, map({
-                \     'ssiddef': 'they were already defined by plugin %s',
-                \  'savnotfunc': 'saver is not a function reference',
-                \  'setnotfunc': 'setter is not a function reference',
-                \  'ssmanyargs': 'too many arguments',
-                \  'ssoptsndct': 'options argument is not a Dictionary',
-                \   'sssavuref': 'saver is a reference to unknown function',
-                \   'ssseturef': 'setter is a reference to unknown function',
-            \},
-            \'"Error while creating saver and setter functions with id %s '.
-            \ 'for plugin %s: ".v:val'))
-    call extend(s:_messages, map({
                 \     'deiddef': 'decorator already defined by plugin %s',
                 \     'decnfun': 'decorator is not a function reference',
                 \      'deuref': 'decorator is a reference to unknown function',
 function s:F.rewritefname(sid, Fref)
     let fstr=string(a:Fref)[10:-3]
     if fstr[:1]==#'s:'
-        let fstr=printf(s:sidfpref, a:sid).fstr[2:]
+        let fstr='<SNR>'.a:sid.'_'.fstr[2:]
     endif
     return fstr
 endfunction
         endif
         "▶2 Replace s: prefix with <SNR>{SID}_
         if fname[:1]==#'s:'
-            let fname=printf(s:sidfpref, a:plugdict.sid).fname[2:]
+            let fstr='<SNR>'.a:sid.'_'.fstr[2:]
         endif
         "▶2 Check function name
         if fname!~#'^\%(\h:\w\+\|[A-Z_]\w*\)$'
             \                   'unload': s:F.delfunctions,
             \                     'init': {'fundictsname': 'wrappedfuncs',
             \                                  'fundicts': {}}})
-"▶1 addaltspecial feature
-"▶2 delaltspecials  :: {f} → s:ss, fdict
-function s:F.delaltspecials(plugdict, fdict)
-    for ssdef in values(a:fdict)
-        unlet s:ss[ssdef.id]
-        unlet a:fdict[ssdef.id]
-    endfor
-endfunction
-"▶2 addaltspecial   :: {f}, ssid, Saver::Funcref, Setter::Funcref[, ssopts] → +…
-function s:F.addaltspecial(plugdict, fdict, ssid, Saver, Setter, ...)
-    "▶3 Check arguments
-    if type(a:ssid)!=type("")
-        call s:_f.throw('idnotstr', a:plugdict.id)
-    elseif a:ssid!~#'^\h\w*$'
-        call s:_f.throw('invid', a:plugdict.id, a:ssid)
-    elseif has_key(s:ss, a:ssid)
-        call s:_f.throw('ssiddef', a:ssid, a:plugdict.id,
-                    \              s:ss[a:ssid].plid)
-    elseif type(a:Saver)!=2
-        call s:_f.throw('savnotfunc', a:ssid, a:plugdict.id)
-    elseif type(a:Setter)!=2
-        call s:_f.throw('setnotfunc', a:ssid, a:plugdict.id)
-    elseif a:0>1
-        call s:_f.throw('ssmanyargs', a:ssid, a:plugdict.id)
-    elseif a:0
-        if type(a:1)!=type({})
-            call s:_f.throw('ssoptsndct', a:ssid, a:plugdict.id)
-        endif
-    endif
-    "▲3
-    let ssdef={
-                \    "id": a:ssid,
-                \  "plid": a:plugdict.id,
-                \ "saver": s:F.refunction(a:plugdict.sid, a:Saver,
-                \                         'sssavuref', a:ssid, a:plugdict.id),
-                \"setter": s:F.refunction(a:plugdict.sid, a:Setter,
-                \                         'ssseturef', a:ssid, a:plugdict.id),
-                \"hasarg": 0,
-            \}
-    if a:0
-        if has_key(a:1, 'requiresarg')
-            let ssdef.hasarg=2
-        elseif has_key(a:1, 'acceptsarg')
-            let ssdef.hasarg=1
-        endif
-        if has_key(a:1, 'checker')
-            let ssdef.checker=s:_f.conschecker(a:1.checker)
-        endif
-    endif
-    let s:ss[ssdef.id]=ssdef
-    let a:fdict[ssdef.id]=ssdef
-endfunction
-"▶2 Register feature
-call s:_f.newfeature('addaltspecial', {'cons': s:F.addaltspecial,
-            \                        'unload': s:F.delaltspecials,})
 "▶1 adddecorator feature
 "▶2 adddecorator    :: {f}, deid, Decorator::Funcref → + fdict, s:decorators
 let s:decorators={}
 "▶2 Register feature
 call s:_f.newfeature('adddecorator', {'cons': s:F.adddecorator,
             \                       'unload': s:F.deldecorators,})
-"▶1 Savers/setters
-"▶2 Define dictionaries
-let s:ss={}
-let s:F.saver={}
-let s:F.setter={}
-let s:F.sschk={}
-"▶2 winview
-call s:_f.addaltspecial('winview', function('winsaveview'),
-            \                      function('winrestview'))
-"▶2 buffer
-function s:F.saver.buffer()
-    return bufnr('%')
-endfunction
-function s:F.setter.buffer(bufnr)
-    if type(a:bufnr)==type(0) && a:bufnr!=bufnr('%') && bufexists(a:bufnr)
-        try
-            execute "buffer ".a:bufnr
-        catch
-            " Setter must not throw anything: it may break things
-            echohl ErrorMsg
-            echomsg v:exception
-            echohl None
-        endtry
-    endif
-endfunction
-call s:_f.addaltspecial('buffer', s:F.saver.buffer, s:F.setter.buffer)
-"▶2 variables
-"▶3 check
-function s:F.sschk.variables(arg)
-    if a:arg[0]!~#'^[gtbw]$'
-        call s:_f.throw('invvcvar', a:arg[0])
-    endif
-    return 1
-endfunction
-"▶3 save
-function s:F.saver.variables(...)
-    let dname=get(a:000, 0, 'g').':'
-    return copy(eval(dname))
-endfunction
-"▶3 set
-function s:F.setter.variables(oldv, ...)
-    if type(a:oldv)!=type({})
-        return
-    endif
-    let dname=get(a:000, 0, 'g').':'
-    let v=eval(dname)
-    for name in filter(keys(v), '!has_key(a:oldv, v:val)')
-        unlet v[name]
-    endfor
-    call extend(v, filter(a:oldv, 'v:key=~#"^\\h\\w*$"'), 'force')
-endfunction
-"▲3
-call s:_f.addaltspecial('variables', s:F.saver.variables, s:F.setter.variables,
-            \                               {'checker': s:F.sschk.variables,
-            \                             'acceptsarg': 1,})
-"▶2 matches
-call s:_f.addaltspecial('matches',function('getmatches'),function('setmatches'))
-"▶2 qflist
-function s:F.setqflist(list)
-    return setqflist(a:list, 'r')
-endfunction
-call s:_f.addaltspecial('qflist', function('getqflist'), s:F.setqflist)
-"▲2
-unlet s:F.saver s:F.setter s:F.sschk
 "▶1 Decorators
 let s:F.de={}
-"▶2 altervars
-let s:altervars={'lastid': 0}
-function s:F.de.altervars(plugdict, fname, arg)
-    "▶3 Check a:arg
-    if type(a:arg)!=type([])
-        call s:_f.throw('altnlst', a:fname, a:plugdict.id)
-    endif
-    "▶3 Define variables
-    let preret=['let @$@={}',
-                \     'try',]
-    let postret=['finally']
-    let laltvars=len(a:arg)
-    let plid=a:plugdict.id
-    let i=0
-    let fpref='s:altervars.'.s:altervars.lastid
-    let altcopy=map(copy(a:arg), 'copy(v:val)')
-    let s:altervars[s:altervars.lastid]=altcopy
-    let s:altervars.lastid+=1
-    "▲3
-    while i<laltvars
-        "▶3 Check current element
-        if type(a:arg[i])!=type([])
-            call s:_f.throw('altelnlst', a:fname, plid, i)
-        elseif empty(a:arg[i]) || len(a:arg[i])>2
-            call s:_f.throw('altelinvlen', a:fname, plid, i, len(a:arg[i]))
-        elseif type(a:arg[i][0])!=type("")
-            call s:_f.throw('altelnstr', a:fname, plid, i)
-        endif
-        "▲3
-        let element=altcopy[i]
-        let varname=element[0]
-        let vnlen=len(varname)
-        let hasvar=(len(element)>1)
-        let warnargs="'".varname."', '".a:fname."', ".
-                    \substitute(string(plid), "\n",
-                    \           '''."\\n".''', 'g').', v:exception'
-        "▶3 Check varname length
-        if vnlen<2
-            call s:_f.throw('invvnlen', a:fname, plid, i)
-        "▶3 Process variables
-        elseif varname[1]==#':' && index(['g','b','t','w'], varname[0])!=-1
-            "▶4 Check variable name
-            if varname[2:]!~#'^\h\w*$'
-                call s:_f.throw('invvname', a:fname, plid, i, varname[2:])
-            endif
-            "▲4
-            let preret+=['if exists("'.varname.'")',
-                        \          'let @$@.'.i.'='.varname]
-            if hasvar
-                " Unlet variable to be sure that it won't cause E706 
-                " (variable type mismatch) error
-                let preret+=['unlet '.varname,
-                            \   'endif',
-                            \   'let '.varname.'=']
-                if type(element[1])==type(0) ||
-                            \(has("float") && type(element[1])==type(0.0) &&
-                            \ string(element[1])!~'\w')
-                    let preret[-1].=string(element[1])
-                else
-                    let preret[-1].=fpref."[".i."][1]"
-                endif
-            else
-                call add(preret, 'endif')
-            endif
-            " Restore the previous status: variable will be left undefined if it 
-            " was not defined before function was run
-            let postret+=['if exists("'.varname.'")',
-                        \         'unlet '.varname,
-                        \     'endif',
-                        \     'if has_key(@$@, '.i.')',
-                        \         'let '.varname.'=@$@.'.i,
-                        \     'endif',]
-        "▶3 Process options
-        elseif varname[0]==#'&' && vnlen>3
-            "▶4 Check option name
-            if varname[2]!=#':' || !(varname[1]==#'g' || varname[1]==#'l')
-                call s:_f.throw('noocpref', a:fname, plid, i, varname)
-            elseif varname[3:]!~#'^\l\+$'
-                call s:_f.throw('invoname', a:fname, plid, i, varname[3:])
-            endif
-            "▲4
-            if exists('+'.varname[1:])
-                let ovarname='@$@'.varname[1].'_'.varname[3:]
-                call add(preret, 'let '.ovarname.'='.varname)
-                if hasvar
-                    "▶4 Check value type
-                    if type(element[1])!=type(eval(varname))
-                        call s:_f.throw('invoval', a:fname, plid, i)
-                    endif
-                    "▲4
-                    call add(preret, 'let '.varname.'='.
-                                \substitute(string(element[1]), '\n',
-                                \                  '''."\\n".''', 'g'))
-                endif
-                let postret+=['let '.varname.'='.ovarname]
-            endif
-        "▶3 Process special
-        elseif varname[0]==#'+'
-            "▶4 *args, varname
-            let saveargs=''
-            let setargs=fpref."[".i."][1]"
-            let set2args='@$@.'.i
-            let varname=varname[1:]
-            "▲4
-            let bidx=stridx(varname, '(')
-            "▶4 If argument is supplied
-            if bidx!=-1
-                "▶5 Altering varname, element and *args variables
-                let noclose=(varname[-1:]!=#')')
-                if !hasvar
-                    call add(element, 0)
-                endif
-                call add(element, varname[(bidx+1):-2])
-                let varname=varname[:(bidx-1)]
-                let element[0]='+'.varname
-                let saveargs=fpref."[".i."][2]"
-                let setargs.=", ".saveargs
-                let set2args.=", ".saveargs
-                "▶5 Check existance of special
-                if !has_key(s:ss, varname)
-                    call s:_f.throw('usaver', a:fname, plid, i, varname)
-                endif
-                let ssdef=s:ss[varname]
-                "▶5 Checking () expr
-                if noclose
-                    call s:_f.throw('noclose', a:fname, plid, i)
-                elseif !ssdef.hasarg
-                    call s:_f.throw('spnoarg', a:fname, plid, i, varname)
-                elseif has_key(ssdef, 'checker') && !ssdef.checker([element[2]])
-                    call s:_f.throw('acheckfailed', a:fname, plid, i, varname)
-                endif
-            "▶4 Else just check existance of special
-            else
-                if !has_key(s:ss, varname)
-                    call s:_f.throw('usaver', a:fname, plid, i, varname)
-                endif
-            endif
-            "▲4
-            let ssdef=s:ss[varname]
-            "▶4 Check special name and existance of all arguments
-            if ssdef.hasarg==2 && bidx==-1
-                call s:_f.throw('spmisarg', a:fname, plid, i, varname)
-            elseif !has_key(a:plugdict.dependencies, ssdef.plid)
-                call s:_f.throw('notdep', a:fname, plid, i, ssdef.plid, varname)
-            endif
-            "▲4
-            let preret+=['try',
-                        \          'let @$@.'.i.'=s:ss.'.varname.'.saver'.
-                        \                                      '('.saveargs.')',
-                        \      'catch',
-                        \          'call s:_f.warn("savexcept", '.warnargs.')',
-                        \      'endtry',]
-            if hasvar
-                let preret+=['try',
-                            \          'call s:ss.'.varname.'.setter'.
-                            \                                   '('.setargs.')',
-                            \      'catch',
-                            \          'call s:_f.warn("setexcept", '.
-                            \                                 warnargs.')',
-                            \      'endtry',]
-            endif
-            let postret+=['try',
-                        \         'call s:ss.'.varname.'.setter('.set2args.')',
-                        \     'catch',
-                        \         'call s:_f.warn("set2except", '.warnargs.')',
-                        \     'endtry',]
-        "▶3 Process unknown
-        else
-            call s:_f.throw('ualt', a:fname, plid, i, varname)
-        endif
-        "▶3 Finish cycle (increment+unlet)
-        let i+=1
-        unlet element
-        "▲3
-    endwhile
-    call add(postret, 'endtry')
-    return [192, '@@@', 0, preret, postret, 0]
-endfunction
-call s:_f.adddecorator('altervars', s:F.de.altervars)
 "▶2 checker
 function s:F.de.checker(plugdict, fname, Arg)
     let throwargs="'".a:fname."', ".
 "▲2
 unlet s:F.de
 "▶1
-call frawor#Lockvar(s:, 'ss,decorators,extfunctions,wrappedfuncs,altervars,'.
-            \           '_checkers,_filters,lastdeid')
+call frawor#Lockvar(s:, 'decorators,extfunctions,wrappedfuncs,lastdeid,'.
+            \           '_checkers,_filters')
 " vim: fmr=▶,▲ sw=4 ts=4 sts=4 et tw=80

File test/global-functions-reload.ok

View file
  • Ignore whitespace
 1      echo 1
    endfunction
 
-   function <SNR>21_testFunction()
+   function <SNR>22_testFunction()
 1      echo 2
    endfunction
 
 1      echo 1
    endfunction
 
-   function <SNR>21_testFunction()
+   function <SNR>22_testFunction()
 1      echo 2
    endfunction

File test/ignoredeps-feature.ok

View file
  • Ignore whitespace
 load: plugin/frawor/commands
 register: autoload/frawor
 load: autoload/frawor
+register: plugin/frawor/decorators/altervars
+load: plugin/frawor/decorators/altervars
 register: plugin/frawor/options
 load: plugin/frawor/options
 register: plugin/frawor/python

File test/invalid-addaltspecial.ok

View file
  • Ignore whitespace
-.1: plugin/frawor/functions:idnotstr
-.2: plugin/frawor/functions:invid
-.3: plugin/frawor/functions:ssiddef
-.4: plugin/frawor/functions:savnotfunc
-.5: plugin/frawor/functions:setnotfunc
-.6: plugin/frawor/functions:ssmanyargs
-.7: plugin/frawor/functions:ssoptsndct
-.8: plugin/frawor/functions:sssavuref
-.9: plugin/frawor/functions:ssseturef
+.1: plugin/frawor/decorators/altervars:idnotstr
+.2: plugin/frawor/decorators/altervars:invid
+.3: plugin/frawor/decorators/altervars:ssiddef
+.4: plugin/frawor/decorators/altervars:savnotfunc
+.5: plugin/frawor/decorators/altervars:setnotfunc
+.6: plugin/frawor/decorators/altervars:ssmanyargs
+.7: plugin/frawor/decorators/altervars:ssoptsndct
+.8: plugin/frawor/decorators/altervars:sssavuref
+.9: plugin/frawor/decorators/altervars:ssseturef

File test/invalid-addextfunctions.ok

View file
  • Ignore whitespace
 .5: plugin/frawor/functions:foptsnotdict
 .6: plugin/frawor/functions:nofunc
 .7: plugin/frawor/functions:nref
-.8: plugin/frawor/functions:altnlst
-.9: plugin/frawor/functions:altelnlst
-.10: plugin/frawor/functions:altelinvlen
-.11: plugin/frawor/functions:altelinvlen
-.12: plugin/frawor/functions:altelnstr
-.13: plugin/frawor/functions:invvname
-.14: plugin/frawor/functions:invvnlen
-.15: plugin/frawor/functions:ualt
-.16: plugin/frawor/functions:noocpref
-.17: plugin/frawor/functions:invoname
-.18: plugin/frawor/functions:invoval
-.19: plugin/frawor/functions:usaver
-.20: plugin/frawor/functions:ualt
-.21: plugin/frawor/functions:usaver
-.22: plugin/frawor/functions:noclose
-.23: plugin/frawor/functions:spnoarg
-.24: plugin/frawor/functions:invvcvar
-.25: plugin/frawor/functions:notdep
-.26: plugin/frawor/functions:spmisarg
-.27: plugin/frawor/functions:acheckfailed
-.28: plugin/frawor/functions:spmisarg
+.8: plugin/frawor/decorators/altervars:altnlst
+.9: plugin/frawor/decorators/altervars:altelnlst
+.10: plugin/frawor/decorators/altervars:altelinvlen
+.11: plugin/frawor/decorators/altervars:altelinvlen
+.12: plugin/frawor/decorators/altervars:altelnstr
+.13: plugin/frawor/decorators/altervars:invvname
+.14: plugin/frawor/decorators/altervars:invvnlen
+.15: plugin/frawor/decorators/altervars:ualt
+.16: plugin/frawor/decorators/altervars:noocpref
+.17: plugin/frawor/decorators/altervars:invoname
+.18: plugin/frawor/decorators/altervars:invoval
+.19: plugin/frawor/decorators/altervars:usaver
+.20: plugin/frawor/decorators/altervars:ualt
+.21: plugin/frawor/decorators/altervars:usaver
+.22: plugin/frawor/decorators/altervars:noclose
+.23: plugin/frawor/decorators/altervars:spnoarg
+.24: plugin/frawor:nomessage
+.25: plugin/frawor/decorators/altervars:notdep
+.26: plugin/frawor/decorators/altervars:spmisarg
+.27: plugin/frawor/decorators/altervars:acheckfailed
+.28: plugin/frawor/decorators/altervars:spmisarg
 .29: plugin/frawor/functions:decndep

File test/reload-frawor.ok

View file
  • Ignore whitespace
 load: plugin/frawor/commands
 register: autoload/frawor
 load: autoload/frawor
+register: plugin/frawor/decorators/altervars
+load: plugin/frawor/decorators/altervars
 register: plugin/frawor/options
 load: plugin/frawor/options
 register: plugin/frawor/python
 unloadpre: plugin/frawor/autocommands
 unloadpre: plugin/frawor/options
 unloadpre: plugin/writefile-feature
-unloadpre: plugin/frawor/functions
-unloadpre: plugin/frawor/checks
+unloadpre: plugin/frawor/decorators/altervars
 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: plugin/frawor/tcl
 unload: plugin/ignoredeps-feature
 _unload
-register: plugin/frawor/fwc
-load: plugin/frawor/fwc
+register: plugin/frawor/options
+load: plugin/frawor/options
+register: plugin/frawor/autocommands
+load: plugin/frawor/autocommands
 register: plugin/frawor/functions
 load: plugin/frawor/functions
 register: plugin/frawor/checks
 load: autoload/frawor
 register: plugin/ignoredeps-feature
 load: plugin/ignoredeps-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/resources
 register: plugin/writefile-feature
 load: plugin/writefile-feature
-register: plugin/frawor/options
-load: plugin/frawor/options
+register: plugin/frawor/decorators/altervars
+load: plugin/frawor/decorators/altervars
 register: plugin/frawor/tcl
 load: plugin/frawor/tcl
 register: plugin/frawor/ruby

File test/reload-ignoredeps.ok

View file
  • Ignore whitespace
 load: plugin/frawor/commands
 register: autoload/frawor
 load: autoload/frawor
+register: plugin/frawor/decorators/altervars
+load: plugin/frawor/decorators/altervars
 register: plugin/frawor/options
 load: plugin/frawor/options
 register: plugin/frawor/python
 load: plugin/frawor/commands
 register: autoload/frawor
 load: autoload/frawor
+register: plugin/frawor/decorators/altervars
+load: plugin/frawor/decorators/altervars
 register: plugin/frawor/options
 load: plugin/frawor/options
 register: plugin/frawor/python

File test/reload-writefile.ok

View file
  • Ignore whitespace
 load: plugin/frawor/commands
 register: autoload/frawor
 load: autoload/frawor
+register: plugin/frawor/decorators/altervars
+load: plugin/frawor/decorators/altervars
 register: plugin/frawor/options
 load: plugin/frawor/options
 register: plugin/frawor/python
 load: plugin/frawor/commands
 register: autoload/frawor
 load: autoload/frawor
+register: plugin/frawor/decorators/altervars
+load: plugin/frawor/decorators/altervars
 register: plugin/frawor/options
 load: plugin/frawor/options
 register: plugin/frawor/python

File test/rtp/plugin/adddecorator.vim

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

File test/rtp/plugin/except-ss.vim

View file
  • Ignore whitespace
-execute frawor#Setup('0.0', {'plugin/frawor/functions': '0.0',
-            \                       'plugin/except-ss': '0.0'}, 1)
+execute frawor#Setup('0.0', {'@/functions': '0.0',
+            \                 '@except-ss': '0.0',
+            \     '@/decorators/altervars': '0.0'}, 1)
 function s:F.saver()
     throw "Saver exception"
 endfunction

File test/rtp/plugin/invalid-addaltspecial.1.vim

View file
  • Ignore whitespace
-execute frawor#Setup('0.0', {'plugin/frawor/functions': '0.0'}, 1)
+execute frawor#Setup('0.0', {'@/decorators/altervars': '0.0'}, 1)
 call s:_f.addaltspecial(0, 0, 0)

File test/rtp/plugin/invalid-addaltspecial.2.vim

View file
  • Ignore whitespace
-execute frawor#Setup('0.0', {'plugin/frawor/functions': '0.0'}, 1)
+execute frawor#Setup('0.0', {'@/decorators/altervars': '0.0'}, 1)
 call s:_f.addaltspecial("", 0, 0)

File test/rtp/plugin/invalid-addaltspecial.3.vim

View file
  • Ignore whitespace
-execute frawor#Setup('0.0', {'plugin/frawor/functions': '0.0'}, 1)
+execute frawor#Setup('0.0', {'@/decorators/altervars': '0.0'}, 1)
 call s:_f.addaltspecial("winview", 0, 0)

File test/rtp/plugin/invalid-addaltspecial.4.vim

View file
  • Ignore whitespace
-execute frawor#Setup('0.0', {'plugin/frawor/functions': '0.0'}, 1)
+execute frawor#Setup('0.0', {'@/decorators/altervars': '0.0'}, 1)
 call s:_f.addaltspecial("test", 0, 0)

File test/rtp/plugin/invalid-addaltspecial.5.vim

View file
  • Ignore whitespace
-execute frawor#Setup('0.0', {'plugin/frawor/functions': '0.0'}, 1)
+execute frawor#Setup('0.0', {'@/decorators/altervars': '0.0'}, 1)
 call s:_f.addaltspecial("test", function("winsaveview"), 0)

File test/rtp/plugin/invalid-addaltspecial.6.vim

View file
  • Ignore whitespace
-execute frawor#Setup('0.0', {'plugin/frawor/functions': '0.0'}, 1)
+execute frawor#Setup('0.0', {'@/decorators/altervars': '0.0'}, 1)
 call s:_f.addaltspecial("test", function("winsaveview"), function("winrestview"), 0, 0)

File test/rtp/plugin/invalid-addaltspecial.7.vim

View file
  • Ignore whitespace
-execute frawor#Setup('0.0', {'plugin/frawor/functions': '0.0'}, 1)
+execute frawor#Setup('0.0', {'@/decorators/altervars': '0.0'}, 1)
 call s:_f.addaltspecial("test", function("winsaveview"), function("winrestview"), 0)

File test/rtp/plugin/invalid-addaltspecial.8.vim

View file
  • Ignore whitespace
-execute frawor#Setup('0.0', {'plugin/frawor/functions': '0.0'}, 1)
+execute frawor#Setup('0.0', {'@/decorators/altervars': '0.0'}, 1)
 let s:eref=function('s:Eval')
 delfunction s:Eval
 call s:_f.addaltspecial("test", s:eref, s:eref)

File test/rtp/plugin/invalid-addaltspecial.9.vim

View file
  • Ignore whitespace
-execute frawor#Setup('0.0', {'plugin/frawor/functions': '0.0'}, 1)
+execute frawor#Setup('0.0', {'@/decorators/altervars': '0.0'}, 1)
 let s:eref=function('s:Eval')
 delfunction s:Eval
 call s:_f.addaltspecial("test", function('tr'), s:eref)

File test/rtp/plugin/invalid-addextfunctions.10.vim

View file
  • Ignore whitespace
-execute frawor#Setup('0.0', {'plugin/frawor/functions': '0.0'}, 1)
+execute frawor#Setup('0.0', {'@/functions': '0.0',
+            \     '@/decorators/altervars': '0.0'}, 1)
 call s:_f.addextfunctions({'Function': {'function': function('tr'),
             \                         '@altervars': [[]]}})

File test/rtp/plugin/invalid-addextfunctions.11.vim

View file
  • Ignore whitespace
-execute frawor#Setup('0.0', {'plugin/frawor/functions': '0.0'}, 1)
+execute frawor#Setup('0.0', {'@/functions': '0.0',
+            \     '@/decorators/altervars': '0.0'}, 1)
 call s:_f.addextfunctions({'Function': {'function': function('tr'),
             \                         '@altervars': [[1, 1, 1]]}})

File test/rtp/plugin/invalid-addextfunctions.12.vim

View file
  • Ignore whitespace
-execute frawor#Setup('0.0', {'plugin/frawor/functions': '0.0'}, 1)
+execute frawor#Setup('0.0', {'@/functions': '0.0',
+            \     '@/decorators/altervars': '0.0'}, 1)
 call s:_f.addextfunctions({'Function': {'function': function('tr'),
             \                         '@altervars': [[1, 1]]}})

File test/rtp/plugin/invalid-addextfunctions.13.vim

View file
  • Ignore whitespace
-execute frawor#Setup('0.0', {'plugin/frawor/functions': '0.0'}, 1)
+execute frawor#Setup('0.0', {'@/functions': '0.0',
+            \     '@/decorators/altervars': '0.0'}, 1)
 call s:_f.addextfunctions({'Function': {'function': function('tr'),
             \                         '@altervars': [['g:0', 1]]}})

File test/rtp/plugin/invalid-addextfunctions.14.vim

View file
  • Ignore whitespace
-execute frawor#Setup('0.0', {'plugin/frawor/functions': '0.0'}, 1)
+execute frawor#Setup('0.0', {'@/functions': '0.0',
+            \     '@/decorators/altervars': '0.0'}, 1)
 call s:_f.addextfunctions({'Function': {'function': function('tr'),
             \                         '@altervars': [['+', 1]]}})

File test/rtp/plugin/invalid-addextfunctions.15.vim

View file
  • Ignore whitespace
-execute frawor#Setup('0.0', {'plugin/frawor/functions': '0.0'}, 1)
+execute frawor#Setup('0.0', {'@/functions': '0.0',
+            \     '@/decorators/altervars': '0.0'}, 1)
 call s:_f.addextfunctions({'Function': {'function': function('tr'),
             \                         '@altervars': [['&l', 1]]}})

File test/rtp/plugin/invalid-addextfunctions.16.vim

View file
  • Ignore whitespace
-execute frawor#Setup('0.0', {'plugin/frawor/functions': '0.0'}, 1)
+execute frawor#Setup('0.0', {'@/functions': '0.0',
+            \     '@/decorators/altervars': '0.0'}, 1)
 call s:_f.addextfunctions({'Function': {'function': function('tr'),
             \                         '@altervars': [['&list', 1]]}})

File test/rtp/plugin/invalid-addextfunctions.17.vim

View file
  • Ignore whitespace
-execute frawor#Setup('0.0', {'plugin/frawor/functions': '0.0'}, 1)
+execute frawor#Setup('0.0', {'@/functions': '0.0',
+            \     '@/decorators/altervars': '0.0'}, 1)
 call s:_f.addextfunctions({'Function': {'function': function('tr'),
             \                         '@altervars': [['&g:_', 1]]}})

File test/rtp/plugin/invalid-addextfunctions.18.vim

View file
  • Ignore whitespace
-execute frawor#Setup('0.0', {'plugin/frawor/functions': '0.0'}, 1)
+execute frawor#Setup('0.0', {'@/functions': '0.0',
+            \     '@/decorators/altervars': '0.0'}, 1)
 call s:_f.addextfunctions({'Function': {'function': function('tr'),
             \                         '@altervars': [['&l:list', '']]}})

File test/rtp/plugin/invalid-addextfunctions.19.vim

View file
  • Ignore whitespace
-execute frawor#Setup('0.0', {'plugin/frawor/functions': '0.0'}, 1)
+execute frawor#Setup('0.0', {'@/functions': '0.0',
+            \     '@/decorators/altervars': '0.0'}, 1)
 call s:_f.addextfunctions({'Function': {'function': function('tr'),
             \                         '@altervars': [['+!!!', '']]}})

File test/rtp/plugin/invalid-addextfunctions.2.vim

View file
  • Ignore whitespace
-execute frawor#Setup('0.0', {'plugin/frawor/functions': '0.0'}, 1)
+execute frawor#Setup('0.0', {'@/functions': '0.0'}, 1)
 call s:_f.addextfunctions({'function': {}})

File test/rtp/plugin/invalid-addextfunctions.20.vim

View file
  • Ignore whitespace
-execute frawor#Setup('0.0', {'plugin/frawor/functions': '0.0'}, 1)
+execute frawor#Setup('0.0', {'@/functions': '0.0',
+            \     '@/decorators/altervars': '0.0'}, 1)
 call s:_f.addextfunctions({'Function': {'function': function('tr'),
             \                         '@altervars': [['!nomatch', '']]}})

File test/rtp/plugin/invalid-addextfunctions.21.vim

View file
  • Ignore whitespace
-execute frawor#Setup('0.0', {'plugin/frawor/functions': '0.0'}, 1)
+execute frawor#Setup('0.0', {'@/functions': '0.0',
+            \     '@/decorators/altervars': '0.0'}, 1)
 call s:_f.addextfunctions({'Function': {'function': function('tr'),
             \                         '@altervars': [['+()', '']]}})

File test/rtp/plugin/invalid-addextfunctions.22.vim

View file
  • Ignore whitespace
-execute frawor#Setup('0.0', {'plugin/frawor/functions': '0.0'}, 1)
+execute frawor#Setup('0.0', {'@/functions': '0.0',
+            \     '@/decorators/altervars': '0.0'}, 1)
 call s:_f.addextfunctions({'Function': {'function': function('tr'),
             \                         '@altervars': [['+buffer(', '']]}})

File test/rtp/plugin/invalid-addextfunctions.23.vim

View file
  • Ignore whitespace
-execute frawor#Setup('0.0', {'plugin/frawor/functions': '0.0'}, 1)
+execute frawor#Setup('0.0', {'@/functions': '0.0',
+            \     '@/decorators/altervars': '0.0'}, 1)
 call s:_f.addextfunctions({'Function': {'function': function('tr'),
             \                         '@altervars': [['+buffer()', '']]}})

File test/rtp/plugin/invalid-addextfunctions.24.vim

View file
  • Ignore whitespace
-execute frawor#Setup('0.0', {'plugin/frawor/functions': '0.0'}, 1)
+execute frawor#Setup('0.0', {'@/functions': '0.0',
+            \     '@/decorators/altervars': '0.0'}, 1)
 call s:_f.addextfunctions({'Function': {'function': function('tr'),
             \                         '@altervars': [['+variables(l)']]}})

File test/rtp/plugin/invalid-addextfunctions.25.vim

View file
  • Ignore whitespace
-execute frawor#Setup('0.0', {'plugin/frawor/functions': '0.0'}, 1)
+execute frawor#Setup('0.0', {'@/functions': '0.0',
+            \     '@/decorators/altervars': '0.0'}, 1)
 call s:_f.addaltspecial("test", function("winsaveview"), function("winrestview"))
 call s:_f.addextfunctions({'Function': {'function': function('tr'),
             \                         '@altervars': [['+test']]}})

File test/rtp/plugin/invalid-addextfunctions.26.vim

View file
  • Ignore whitespace
-execute frawor#Setup('0.0', {'plugin/frawor/functions': '0.0'}, 1)
+execute frawor#Setup('0.0', {'@/functions': '0.0',
+            \     '@/decorators/altervars': '0.0'}, 1)
 call s:_f.addaltspecial("test", function("winsaveview"), function("winrestview"), {'requiresarg': 1})
 call s:_f.addextfunctions({'Function': {'function': function('tr'),
             \                         '@altervars': [['+test']]}})

File test/rtp/plugin/invalid-addextfunctions.27.vim

View file
  • Ignore whitespace
-execute frawor#Setup('0.0', {'plugin/frawor/functions': '0.0',
-            \      'plugin/invalid-addextfunctions.27': '0.0'}, 1)
+execute frawor#Setup('0.0', {'@/functions': '0.0',
+            \     '@/decorators/altervars': '0.0',
+            \'@invalid-addextfunctions.27': '0.0'}, 1)
 function s:F.checker(...)
     return 0
 endfunction

File test/rtp/plugin/invalid-addextfunctions.28.vim

View file
  • Ignore whitespace
-execute frawor#Setup('0.0', {'plugin/frawor/functions': '0.0'}, 1)
+execute frawor#Setup('0.0', {'@/functions': '0.0',
+            \     '@/decorators/altervars': '0.0'}, 1)
 call s:_f.addaltspecial("test", function("winsaveview"), function("winrestview"), {'requiresarg': 1, 'acceptsarg': 1})
 call s:_f.addextfunctions({'Function': {'function': function('tr'),
             \                         '@altervars': [['+test']]}})

File test/rtp/plugin/invalid-addextfunctions.29.vim

View file
  • Ignore whitespace
-execute frawor#Setup('0.0', {'plugin/frawor/functions': '0.0'}, 1)
+execute frawor#Setup('0.0', {'@/functions': '0.0'}, 1)
 call s:_f.adddecorator('test', function('string'))
 call s:_f.addextfunctions({'Function': {'function': function('tr'),
             \                              '@test': 0}})

File test/rtp/plugin/invalid-addextfunctions.3.vim

View file
  • Ignore whitespace
-execute frawor#Setup('0.0', {'plugin/frawor/functions': '0.0'}, 1)
+execute frawor#Setup('0.0', {'@/functions': '0.0'}, 1)
 call s:_f.addextfunctions({'Function': {'function': function('tr')}})
 call s:_f.addextfunctions({'Function': {'function': function('tr')}})

File test/rtp/plugin/invalid-addextfunctions.4.vim

View file
  • Ignore whitespace
-execute frawor#Setup('0.0', {'plugin/frawor/functions': '0.0'}, 1)
+execute frawor#Setup('0.0', {'@/functions': '0.0'}, 1)
 function s:F.redefineself()
     call s:_f.addextfunctions({'Function': {'function': s:F.redefineself,
                 \                           'redefine': 1}})

File test/rtp/plugin/invalid-addextfunctions.5.vim

View file
  • Ignore whitespace
-execute frawor#Setup('0.0', {'plugin/frawor/functions': '0.0'}, 1)
+execute frawor#Setup('0.0', {'@/functions': '0.0'}, 1)
 call s:_f.addextfunctions({'Function': []})

File test/rtp/plugin/invalid-addextfunctions.6.vim

View file
  • Ignore whitespace
-execute frawor#Setup('0.0', {'plugin/frawor/functions': '0.0'}, 1)
+execute frawor#Setup('0.0', {'@/functions': '0.0'}, 1)
 call s:_f.addextfunctions({'Function': {}})

File test/rtp/plugin/invalid-addextfunctions.7.vim

View file
  • Ignore whitespace
-execute frawor#Setup('0.0', {'plugin/frawor/functions': '0.0'}, 1)
+execute frawor#Setup('0.0', {'@/functions': '0.0'}, 1)
 call s:_f.addextfunctions({'Function': {'function': 0}})

File test/rtp/plugin/invalid-addextfunctions.8.vim

View file
  • Ignore whitespace
-execute frawor#Setup('0.0', {'plugin/frawor/functions': '0.0'}, 1)
+execute frawor#Setup('0.0', {'@/functions': '0.0',
+            \     '@/decorators/altervars': '0.0'}, 1)
 call s:_f.addextfunctions({'Function': {'function': function('tr'),
             \                         '@altervars': 0}})

File test/rtp/plugin/invalid-addextfunctions.9.vim

View file
  • Ignore whitespace
-execute frawor#Setup('0.0', {'plugin/frawor/functions': '0.0'}, 1)
+execute frawor#Setup('0.0', {'@/functions': '0.0',
+            \     '@/decorators/altervars': '0.0'}, 1)
 call s:_f.addextfunctions({'Function': {'function': function('tr'),
             \                         '@altervars': [0]}})

File test/rtp/plugin/wrapfunc-alter-matches.vim

View file
  • Ignore whitespace
-execute frawor#Setup('0.0', {'plugin/frawor/functions': '0.0'}, 1)
+execute frawor#Setup('0.0', {'@/functions': '0.0',
+            \     '@/decorators/altervars': '0.0'}, 1)
 let matches=getmatches()
 function s:F.wrappedfunc(...)
     call clearmatches()

File test/rtp/plugin/wrapfunc-alter-options.vim

View file
  • Ignore whitespace
-execute frawor#Setup('0.0', {'plugin/frawor/functions': '0.0'}, 1)
+execute frawor#Setup('0.0', {'@/functions': '0.0',
+            \     '@/decorators/altervars': '0.0'}, 1)
 function s:F.getopts()
     let r=[]
     for optname in sort(['list', 'fmr'])

File test/rtp/plugin/wrapfunc-alter-special-new.vim

View file
  • Ignore whitespace
-execute frawor#Setup('0.0', {'plugin/frawor/functions': '0.0',
-            \      'plugin/wrapfunc-alter-special-new': '0.0'}, 1)
+execute frawor#Setup('0.0', {'@/functions': '0.0',
+            \     '@/decorators/altervars': '0.0',
+            \'@wrapfunc-alter-special-new': '0.0'}, 1)
 function s:F.writevar()
     if exists('g:abc')
         call WriteFile('g:abc: '.string(g:abc))

File test/rtp/plugin/wrapfunc-alter-special-variables.vim

View file
  • Ignore whitespace
-execute frawor#Setup('0.0', {'plugin/frawor/functions': '0.0'}, 1)
+execute frawor#Setup('0.0', {'@/functions': '0.0',
+            \     '@/decorators/altervars': '0.0'}, 1)
 function s:F.getvars(v)
     let r=[]
     let d=eval(a:v)

File test/rtp/plugin/wrapfunc-alter-variables.vim

View file
  • Ignore whitespace
-execute frawor#Setup('0.0', {'plugin/frawor/functions': '0.0'}, 1)
+execute frawor#Setup('0.0', {'@/functions': '0.0',
+            \     '@/decorators/altervars': '0.0'}, 1)
 function s:F.getvars(v)
     let r=[]
     for varname in sort(keys(eval(a:v)))

File test/rtp/plugin/wrapfunc-alter-winview.vim

View file
  • Ignore whitespace
-execute frawor#Setup('0.0', {'plugin/frawor/functions': '0.0'}, 1)
+execute frawor#Setup('0.0', {'@/functions': '0.0',
+            \     '@/decorators/altervars': '0.0'}, 1)
 call setline('.', range(0, 10))
 let winview=winsaveview()
 function s:F.wrappedfunc(...)

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

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

File test/rtp/plugin/wrapfunc_cons-alter-matches.vim

View file
  • Ignore whitespace
-execute frawor#Setup('0.0', {'plugin/frawor/functions': '0.0'}, 1)
+execute frawor#Setup('0.0', {'@/functions': '0.0',
+            \     '@/decorators/altervars': '0.0'}, 1)
 let matches=getmatches()
 function s:F.wrappedfunc(...)
     call clearmatches()

File test/rtp/plugin/wrapfunc_cons-alter-options.vim

View file
  • Ignore whitespace
-execute frawor#Setup('0.0', {'plugin/frawor/functions': '0.0'}, 1)
+execute frawor#Setup('0.0', {'@/functions': '0.0',
+            \     '@/decorators/altervars': '0.0'}, 1)
 function s:F.getopts()
     let r=[]
     for optname in sort(['list', 'fmr'])

File test/rtp/plugin/wrapfunc_cons-alter-special-new.vim

View file
  • Ignore whitespace
-execute frawor#Setup('0.0', {'plugin/frawor/functions': '0.0',
-            \ 'plugin/wrapfunc_cons-alter-special-new': '0.0'}, 1)
+execute frawor#Setup('0.0',      {'@/functions': '0.0',
+            \          '@/decorators/altervars': '0.0',
+            \'@wrapfunc_cons-alter-special-new': '0.0'}, 1)
 function s:F.writevar()
     if exists('g:abc')
         call WriteFile('g:abc: '.string(g:abc))

File test/rtp/plugin/wrapfunc_cons-alter-special-variables.vim

View file
  • Ignore whitespace
-execute frawor#Setup('0.0', {'plugin/frawor/functions': '0.0'}, 1)
+execute frawor#Setup('0.0', {'@/functions': '0.0',
+            \     '@/decorators/altervars': '0.0'}, 1)
 function s:F.getvars(v)
     let r=[]
     let d=eval(a:v)

File test/rtp/plugin/wrapfunc_cons-alter-variables.vim

View file
  • Ignore whitespace