project.vim wird von make erzeugt und inkludiert

git-svn-id: https://vimsuite.svn.sourceforge.net/svnroot/vimsuite/trunk@139 eb2d0018-73a3-4aeb-bfe9-1def61c9ec69
This commit is contained in:
stefan 2007-05-08 14:35:11 +00:00
parent ce727f6410
commit bcb2bb581f
10 changed files with 834 additions and 674 deletions

View File

@ -1,114 +0,0 @@
" Vim compiler file
" Compiler: diab data 4.4
" Maintainer: Stefan Liebl
" Last Change: 13.06.2002
"if exists('current_compiler')
" finish
"endif
"let current_compiler = 'bcc'
set errorformat=
" tex-errorformat laden
let b:forceRedoTexCompiler = 'yes'
let g:Tex_ShowallLines = 1
"execute 'source ' . expand(g:vimfiles . '/compiler/tex.vim')
if exists('g:make_log')
let &shellpipe = '| ' . g:tee . PathNormpath(make_log) . ' | ' . g:tee
else
let &shellpipe = '| ' . g:tee
endif
set makeef=
" -------------------------------------
" Diab-Data-Compiler, Assembler, Linker
" -------------------------------------
" dcc_info, dcc_warning, dcc_error, dcc_fatal
setlocal errorformat+=\"%f\"\\,\ line\ %l:\ %t%.%#\ \(dcc:%n\):%m
" dcc_fatal
setlocal errorformat+=\"%f\"\\,\ line\ %l:\ %tatal\ error\ \(dcc:%n\):%m
setlocal errorformat+=%tatal\ error\ \(dcc:%n\):%m
" das_error
setlocal errorformat+=\"%f\"\\,\ line\ %l:\ %t[a-z]:%m
" dld_error
setlocal errorformat+=d%td:%m
setlocal errorformat+=d%td.EXE:%m
" -------
" PC-Lint
" -------
setlocal errorformat+=\"%f\"\\,\ line\ %l:\ %t%.%#\ \(pclint:%n\):%m
setlocal errorformat+=%t%.%#\ \(pclint:%n\):%m
" -------
" SP-Lint
" -------
"setlocal errorformat+=%f\(%l,%c\):\ %m
setlocal errorformat+=%A%f\(%l\):\ %m
setlocal errorformat+=%A%f\(%l\):
setlocal errorformat+=%A%f\(%l\\,%c\):\ %m
setlocal errorformat+=%A%f\(%l\\,%c\):
setlocal errorformat+=%C\ \ \ \ %m
" --------
" GNU-Make
" --------
setlocal errorformat+=%f:%l:\ %m
setlocal errorformat+=%f:%l:%t%.%#:\ %m
setlocal errorformat+=%+G%.%#make.exe:\ %m
setlocal errorformat+=%+G%.%#make%.%#.sh:\ %m
setlocal errorformat+=%+G%.%#mkdir.exe:\ %m
setlocal errorformat+=%+G%.%#cp.exe:\ %m
setlocal errorformat+=%+G%.%#rm.exe:\ %m
" ---------
" BMSK make
" ---------
setlocal errorformat+=bmsk:\ %m
" ------------
" python error
" ------------
setlocal errorformat+=%+G%.%#python.exe:\ %m
"setlocal errorformat+=%C\ %.%#,%A\ \ File\ \"%f\"\\,\ line\ %l%.%#,%Z%[%^\ ]%\\@=%m
" -----
" DAMOS
" -----
" Damos error
setlocal errorformat +=%PDAM-S-INPUTFILEOPENED\ %f%*\\s
setlocal errorformat +=%PDAM-S-OUTPUTFILEOPENED\ %f%*\\s
setlocal errorformat +=%QDAM-S-FILECLOSED\ %f%*\\s
"setlocal errorformat +=%PDAM-S-OSP-OPENING-SEQ-OSP\ %f%*\\s
setlocal errorformat +=%QDAM-S-OSP-CLOSE\ %f%*\\s
" ignore 'DAM-W-KONS-SW-IGNORED'
setlocal errorformat+=%-O%.%#DAM-W-KONS-SW-IGNORED
" Damos Info-Feld
"setlocal errorformat +=%-I\|\ DAM-I-%m,
" \%-Z+-%#
" Damos Warning- oder Error-Feld
" DAM-W-...
setlocal errorformat +=%A\ %#\|\ DAM-%t-%m,
\%C\ %#\|\%*\\sZeile\ %l%m,
\%C\ %#\|\%*\\sZeile\ %f:\ %l%m,
\%C\ %#\|\ %#%m,
\%-Z\ %#+-%#
" Damos: Kenngrößen, die in mehr als einer SG-Funktion definiert sind:
" Kgs: ... Fkt: ...
setlocal errorformat +=%+WKenngrößen%m
setlocal errorformat +=%+WKgs:%m
" Damos: Ram-Größen, die in einer SG-Funktion enthalten sind,
" aber nicht im OSp existieren:
" Ram: ... Fkt: ...
setlocal errorformat +=%+WRam-Größen%m,
\%+Zaber%m
" Damos: Lokale Ram-Größen, die referenziert werden:
" Ram: ... Fkt: ...
setlocal errorformat +=%+WLokale\ Ram-Größen%m
setlocal errorformat +=%+WRam:%m
"
setlocal errorformat +=%W%\\%#%#DAM-S-KGR-PLS-EXCEEDED%m:%*\\s,
\%CDAM-S-KGR-PLS-EXCEEDED%m,
\%-Z+-%#
" ignore uninterresting lines
" ---------------------------
" ignore 'ignoring option ...'
setlocal errorformat+=%-Oignoring\ option%.%#
" ignore 'file: 123: #error ...'
setlocal errorformat+=%-O%*\\S\ %*\\d:\ #%.%#

View File

@ -144,7 +144,7 @@ function s:ReportRev(Rev)
endfunction
" uncomment next line to get changelog for the last version
execute 'call s:ReportRev(' . g:VimFilesRevision . ')'
"execute 'call s:ReportRev(' . g:VimFilesRevision . ')'
" comment changelog after first usage
silent! new <sfile>

View File

@ -24,11 +24,12 @@ let g:projectFile = fnamemodify($VIMRUNTIME . '/../projects.txt', ':p')
" ----------
" SetProject
" ----------
if (v:version > 602)
command -complete=customlist,GetAllMakefiles -nargs=? SetProject call SetProject('<args>')
else
command -nargs=1 SetProject call SetProject('<args>')
endif
command -complete=customlist,GetAllMakefiles -nargs=? SetProject call s:SetProject('<args>')
" only for backward compatibility
command -nargs=? SetBmskProject
\ execute 'source ' . g:vimfiles . '/tools/bmsk.vim'
\ | SetBmskProject <args>
"function GetAllMakefiles(ArgLead, CmdLine, CursorPos)
function GetAllMakefiles(...)
let makefilePaths = []
@ -86,7 +87,7 @@ endfunction
" Find makefile and set some options
" ----------------------------------
function SetProject(makefile)
function s:SetProject(makefile)
if ((a:makefile == '') && has('browse'))
" Browse for makefile
if exists('g:WA')
@ -129,19 +130,15 @@ function SetProject(makefile)
" search path
set path&
call s:SetProjectVariables()
call s:GetProjectVariables()
call s:EvalProjectVariables()
endfunction
" Set Project Specific Variables
function s:SetProjectVariables()
" Get Project Specific Variables
function s:GetProjectVariables()
let varnames = [
\ 'VIM_COMPILER',
\ 'VIM_PATH',
\ 'VIM_TAGS',
\ 'VIM_CSCOPEPRG',
\ 'VIM_CSCOPEFILE',
\ 'GOALS',
\ 'VIM_CONFIGFILE',
\]
let s:Variables = GetMakeVars(varnames)
@ -152,73 +149,33 @@ function s:SetProjectVariables()
endfor
echo '-------------------------------'
echo ''
endfunction
" Evaluate Project Specific Variables
function s:EvalProjectVariables()
try
" evaluate path variable
if s:Variables['VIM_PATH'] != ''
if s:Variables['VIM_CONFIGFILE'] != ''
if !filereadable(s:Variables['VIM_CONFIGFILE'])
" try to create config-file
make vim-config
endif
try
execute 'set path=' . s:Variables['VIM_PATH']
execute 'source ' . s:Variables['VIM_CONFIGFILE']
catch
echoerr 'cant set path to "' . s:Variables['VIM_PATH'] . '"'
echoerr 'check the make variable VIM_PATH'
echoerr 'cant source "' . s:Variables['VIM_CONFIGFILE'] . '"'
echoerr 'check the make variable VIM_CONFIGFILE'
endtry
else
echomsg 'set the make-variable VIM_PATH to what you want to be set to path'
echomsg 'set the make-variable VIM_CONFIGFILE to the project-config file for vim'
echomsg 'For old BMSK-Projects try :SetBmskProject'
endif
" evaluate tags
if s:Variables['VIM_TAGS'] != ''
try
execute 'set tags=' . s:Variables['VIM_TAGS']
catch
echoerr 'cant set tags to "' . s:Variables['VIM_TAGS'] . '"'
echoerr 'check the make variable VIM_TAGS'
endtry
else
echomsg 'set the make-variable VIM_TAGS to what you want to be set to tags'
endif
" evaluate cscope
if s:Variables['VIM_CSCOPEPRG'] != ''
try
execute 'set cscopeprg=' . s:Variables['VIM_CSCOPEPRG']
catch
echoerr 'cant set cscopeprg to "' . s:Variables['VIM_CSCOPEPRG'] . '"'
echoerr 'check the make variable VIM_CSCOPEPRG'
endtry
else
echomsg 'set the make-variable VIM_CSCOPEPRG to what you want to be set to cscopeprg'
endif
if s:Variables['VIM_CSCOPEFILE'] != ''
try
cscope kill -1
execute 'cscope add ' . s:Variables['VIM_CSCOPEFILE']
catch
echomsg 'cant add cscope-file "' . s:Variables['VIM_CSCOPEFILE'] . '"'
echomsg 'check the make variable VIM_CSCOPEFILE and if file exists'
endtry
else
echomsg 'set the make-variable VIM_CSCOPEFILE if you want to add a cscope-database'
endif
" evaluate compiler
if s:Variables['VIM_COMPILER'] != ''
try
execute 'compiler ' . s:Variables['VIM_COMPILER']
catch
echoerr 'cant set compiler to "' . s:Variables['VIM_COMPILER'] . '"'
echoerr 'check the make variable VIM_COMPILER'
endtry
else
echomsg 'set the make-variable VIM_COMPILER to the compiler plugin you want to use'
endif
catch /E716/ " Schlüssel nicht vorhanden
echomsg v:exception
echomsg 'For old BMSK-Projects try :SetBmskProject'
catch
echoerr 'Error while reading make-variables: ' . v:exception
endtry
endfunction
" Get values for a list of variables as dictionary
@ -230,7 +187,7 @@ function GetMakeVars(varNameList)
"echomsg command
let output = system(command)
let lines = split(output, "\n")
if len(lines) == 1
if len(lines) == 1 && len(a:varNameList) == 1 && match(lines[0], '=') < 0
" make output: value
let RE = '\(.*\)'
let SU = "let varlist['" . vars . "']='\\1'"
@ -243,7 +200,9 @@ function GetMakeVars(varNameList)
for line in lines
"echomsg line
if match(line, RE) >= 0
execute substitute(line, RE, SU, '')
let command = substitute(line, RE, SU, '')
"echomsg command
execute command
endif
endfor
"echomsg ''
@ -274,63 +233,6 @@ function GetMakeVar(varName)
return varValue
endfunction
" ------------------------------------------
" special make-command for target-completion
" ------------------------------------------
" Command
command -complete=customlist,GetAllMakeGoals -nargs=* Make call s:Make('<args>')
" Targets
function GetAllMakeGoals(...)
return g:GetAllMakeGoals()
endfunction
function s:GetDefaultMakeGoals(...)
" evaluate make-goals
if s:Variables['GOALS'] != ''
try
let goals = split(s:Variables['GOALS'])
return goals
catch
echoerr 'cant set goals to ' . s:Variables['GOALS']
echoerr 'check the make variable GOALS'
endtry
else
echomsg 'set the make-variable VIM_COMPILER to the compiler plugin you want to use'
endif
endfunction
let g:GetAllMakeGoals = function('s:GetDefaultMakeGoals')
" Options
function GetDefaultMakeOpts()
return ''
endfunction
let g:GetMakeOptsFunction = function("GetDefaultMakeOpts")
function s:Make(args)
echo a:args
cscope kill -1
let makeopts = g:GetMakeOptsFunction()
execute ':make ' . a:args . makeopts
call s:CscopeConnect()
clist
endfunction
" -----------------
" CSCOPE-Connection
" -----------------
command CscopeConnect call s:CscopeConnect()
function s:CscopeConnect()
try
let cscopefile = s:Variables['VIM_CSCOPEFILE']
if filereadable(cscopefile)
execute 'cscope add ' . cscopefile
elseif cscopefile == ''
echomsg 'cscope: Could not connect: Make-variable "VIM_CSCOPEFILE" is empty'
else
echomsg 'cscope: Could not connect: File ' . cscopefile . ' does not exist'
endif
catch /E716/ " Schlüssel nicht vorhanden
echomsg 'cscope: Could not connect: Make-variable "VIM_CSCOPEFILE" is empty'
endtry
endfunction
" ------------------
" Draw Vimsuite-Menu
@ -452,7 +354,7 @@ function s:DelSessions()
exec 'anoremenu '.s:VimSuiteMenuLocation.'.20 '.s:VimSuiteMenuName.
\'&Session.&Save<tab>:SessionSave'.
\' :SessionSave<CR>'
exec 'anoremenu '.s:VimSuiteMenuLocation.'.20 '.s:VimSuiteMenuName.
exec 'anoremenu '.s:VimSuiteMenuLocation.'.30 '.s:VimSuiteMenuName.
\'&Session.Save\ &As<tab>:SessionSave'.
\' :let v:this_session = ""<CR>:SessionSave<CR>'
endfunction

View File

@ -19,12 +19,36 @@ let s:BMSKmenuname = '&BMSK.'
" Set Project
" -----------
command -complete=dir -nargs=1 SetBmskWA let g:bmskWA = '<args>'
command -complete=custom,GetAllBmskProjects -nargs=? SetBmskProject
command! -complete=custom,GetAllBmskProjects -nargs=? SetBmskProject
\ call s:SetBmskProject('<args>')
function s:SetBmskProject(basedir)
if (a:basedir == '')
let makefile = ''
if ((a:basedir == '') && has('browse'))
" Browse for makefile
if exists('g:bmskWA')
let l:bmskWA = g:bmskWA
else
let l:bmskWA = ''
endif
if exists('b:browsefilter')
let l:browsefilter = b:browsefilter
endif
let b:browsefilter =
\ 'Makefiles (make_fsw.bat)\tmake_fsw.bat\n' .
\ 'Makefiles (makefile*)\tmakefile*\n' .
\ 'All Files (*.*)\t*.*'
let makefile = browse(0, 'Select makefile', l:bmskWA, '')
if exists('l:browsefilter')
let b:browsefilter = l:browsefilter
endif
let basedir = fnamemodify(makefile, ':p:h')
let makefile = fnamemodify(makefile, ':t')
if ((makefile == 'make_fsw.bat') || (makefile == 'makefile.mak') || (makefile == 'makefile'))
call s:SetBmskDirs(basedir)
else
echo 'No makefile:' makefile
endif
else
" set Workarea and basedir
if (isdirectory(a:basedir))
@ -32,19 +56,17 @@ function s:SetBmskProject(basedir)
let makefile = fnamemodify(a:basedir . '/make_fsw.bat', ':p')
if !filereadable(makefile)
let makefile = glob(a:basedir . '/*/make_fsw.bat')
let basedir = fnamemodify(makefile, ':p:h')
endif
if !filereadable(makefile)
echoerr 'No makefile' makefile
if (filereadable(makefile))
call s:SetBmskDirs(basedir)
else
echo 'No makefile' makefile
endif
else
echoerr 'No directory:' a:basedir
echo 'No directory:' a:basedir
endif
endif
call SetProject(makefile)
let GetMakeOptsFunction = function('GetBmskMakeOpts')
let g:GetAllMakeGoals = function('GetAllBmskTargets')
let basedir = getcwd()
call s:SetBmskDirs(basedir)
endfunction
function GetAllBmskProjects(ArgLead, CmdLine, CursorPos)
@ -122,8 +144,8 @@ function s:BmskRedrawMenu()
\'&Compile.&Build<tab>:Make'.
\' :Make<CR>'
exec 'anoremenu ..20 '.s:BMSKmenuname.
\'&Compile.&Alle\ Teststände<tab>:BmskAll\ Test'.
\' :BmskAll Test<CR>'
\'&Compile.&Alle\ Teststände<tab>:MakeAll\ Test'.
\' :MakeAll Test<CR>'
exec 'anoremenu ..30 '.s:BMSKmenuname.
\'&Compile.&Lint<tab>:Lint'.
\' :Lint<CR>'
@ -131,8 +153,8 @@ function s:BmskRedrawMenu()
\'&Compile.&Doku\ erstellen<tab>:Make\ doku'.
\' :Make doku<CR>'
exec 'anoremenu ..36 '.s:BMSKmenuname.
\'&Compile.&Einzeldoku\ erstellen<tab>:BmskDoku\ doku\ funktionen="\.\.\."'.
\' :BmskDoku<CR>'
\'&Compile.&Einzeldoku\ erstellen<tab>:MakeDoku\ doku\ funktionen="\.\.\."'.
\' :MakeDoku<CR>'
exec 'anoremenu ..40 '.s:BMSKmenuname.
\'&Compile.&Clean<tab>:Make\ clean'.
\' :Make clean<CR>'
@ -206,11 +228,11 @@ function s:BmskRedrawMenu()
\' :cscope kill -1<CR>'
" BuildManager
exec 'anoremenu .60.10 '.s:BMSKmenuname.
\'&BuildManager.&Entwicklerstand<tab>:BmskAll\ Entwickler'.
\' :BmskAll Entwickler<CR>'
\'&BuildManager.&Entwicklerstand<tab>:MakeAll\ Entwickler'.
\' :MakeAll Entwickler<CR>'
exec 'anoremenu ..20 '.s:BMSKmenuname.
\'&BuildManager.&Serienstand<tab>:BmskAll\ Serie'.
\' :BmskAll Serie<CR>'
\'&BuildManager.&Serienstand<tab>:MakeAll\ Serie'.
\' :MakeAll Serie<CR>'
exec 'anoremenu ..30 '.s:BMSKmenuname.
\'&BuildManager.&Deliver\ Products<tab>:CopyProgrammstand'.
\' :CopyProgrammstand<CR>'
@ -406,6 +428,7 @@ function s:SetBmskDirs(bmskdir)
unlet! g:Goals
unlet! g:Programname
unlet! g:OutDirVariante
unlet! g:bmsk_stand
" Variablen erzeugen, damit GetMakeVar funktioniert
if !exists('g:Muster')
@ -429,7 +452,9 @@ function s:SetBmskDirs(bmskdir)
" cd to bmskdir
execute 'cd ' . g:bmskdir
compiler bmsk
" Make
call s:SetBmskCompiler()
" Default-Werte aus Make übernehmen
call GetAllMakeVars()
@ -455,6 +480,8 @@ function s:SetBmskDirs(bmskdir)
let g:bmskProject = fnamemodify(g:bmskdir, ':h:h:t')
let g:bmsk_sw = fnamemodify(g:bmskdir . '/sw', ':p')
let g:bmsk_bios = fnamemodify(g:bmskdir . '/sw/bios', ':p')
let g:bmsk_d = GetDfilesDir()
let g:bmsk_stand = GetStandDir()
let g:OutDir = GetOutDir()
let g:OutDirVariante = GetOutDirVariante()
let g:bmsk_ext = '*.c *.h *.kgs *.d *.dat *.mak *.inv'
@ -481,11 +508,20 @@ function s:SetBmskDirs(bmskdir)
let &path = substitute(&path, '\\', '/', 'g')
" files for tags (may not start with './', since . is the path of the
" current file
let &tags = substitute(GetCTagsFile(), '^\..', '', '') . ',' . substitute(GetPTagsFile() , '^\..', '', '')
" Grep Dir and Extentions
let g:GrepDir = g:bmsk_sw
let g:GrepFiles = '*.c *.h *.kgs'
" cscope
let &cscopeprg = GetCscopePrg()
cscope kill -1
let reffile = GetCscopeFile()
if (filereadable(reffile))
execute 'cscope add' reffile
endif
call s:BmskRedrawMenu()
call GetGoals()
@ -499,6 +535,110 @@ function s:SetBmskDirs(bmskdir)
endfunction
function s:SetBmskCompiler()
set errorformat=
" tex-errorformat laden
let b:forceRedoTexCompiler = 'yes'
let g:Tex_ShowallLines = 1
"execute 'source ' . expand(g:vimfiles . '/compiler/tex.vim')
let g:makeCommand = g:bmskdir . 'make_fsw.bat'
let &makeprg = g:makeCommand . ' $*'
let &shellpipe = '| ' . g:tee
set makeef=
" -------------------------------------
" Diab-Data-Compiler, Assembler, Linker
" -------------------------------------
" dcc_info, dcc_warning, dcc_error, dcc_fatal
setlocal errorformat+=\"%f\"\\,\ line\ %l:\ %t%.%#\ \(dcc:%n\):%m
" dcc_fatal
setlocal errorformat+=\"%f\"\\,\ line\ %l:\ %tatal\ error\ \(dcc:%n\):%m
setlocal errorformat+=%tatal\ error\ \(dcc:%n\):%m
" das_error
setlocal errorformat+=\"%f\"\\,\ line\ %l:\ %t[a-z]:%m
" dld_error
setlocal errorformat+=d%td:%m
setlocal errorformat+=d%td.EXE:%m
" -------
" PC-Lint
" -------
setlocal errorformat+=\"%f\"\\,\ line\ %l:\ %t%.%#\ \(pclint:%n\):%m
setlocal errorformat+=%t%.%#\ \(pclint:%n\):%m
" -------
" SP-Lint
" -------
"setlocal errorformat+=%f\(%l,%c\):\ %m
setlocal errorformat+=%A%f\(%l\):\ %m
setlocal errorformat+=%A%f\(%l\):
setlocal errorformat+=%A%f\(%l\\,%c\):\ %m
setlocal errorformat+=%A%f\(%l\\,%c\):
setlocal errorformat+=%C\ \ \ \ %m
" --------
" GNU-Make
" --------
setlocal errorformat+=%f:%l:\ %m
setlocal errorformat+=%f:%l:%t%.%#:\ %m
setlocal errorformat+=%+G%.%#make.exe:\ %m
setlocal errorformat+=%+G%.%#make%.%#.sh:\ %m
setlocal errorformat+=%+G%.%#mkdir.exe:\ %m
setlocal errorformat+=%+G%.%#cp.exe:\ %m
setlocal errorformat+=%+G%.%#rm.exe:\ %m
" ---------
" BMSK make
" ---------
setlocal errorformat+=bmsk:\ %m
" ------------
" python error
" ------------
setlocal errorformat+=%+G%.%#python.exe:\ %m
"setlocal errorformat+=%C\ %.%#,%A\ \ File\ \"%f\"\\,\ line\ %l%.%#,%Z%[%^\ ]%\\@=%m
" -----
" DAMOS
" -----
" Damos error
setlocal errorformat +=%PDAM-S-INPUTFILEOPENED\ %f%*\\s
setlocal errorformat +=%PDAM-S-OUTPUTFILEOPENED\ %f%*\\s
setlocal errorformat +=%QDAM-S-FILECLOSED\ %f%*\\s
"setlocal errorformat +=%PDAM-S-OSP-OPENING-SEQ-OSP\ %f%*\\s
setlocal errorformat +=%QDAM-S-OSP-CLOSE\ %f%*\\s
" ignore 'DAM-W-KONS-SW-IGNORED'
setlocal errorformat+=%-O%.%#DAM-W-KONS-SW-IGNORED
" Damos Info-Feld
"setlocal errorformat +=%-I\|\ DAM-I-%m,
" \%-Z+-%#
" Damos Warning- oder Error-Feld
" DAM-W-...
setlocal errorformat +=%A\ %#\|\ DAM-%t-%m,
\%C\ %#\|\%*\\sZeile\ %l%m,
\%C\ %#\|\%*\\sZeile\ %f:\ %l%m,
\%C\ %#\|\ %#%m,
\%-Z\ %#+-%#
" Damos: Kenngrößen, die in mehr als einer SG-Funktion definiert sind:
" Kgs: ... Fkt: ...
setlocal errorformat +=%+WKenngrößen%m
setlocal errorformat +=%+WKgs:%m
" Damos: Ram-Größen, die in einer SG-Funktion enthalten sind,
" aber nicht im OSp existieren:
" Ram: ... Fkt: ...
setlocal errorformat +=%+WRam-Größen%m,
\%+Zaber%m
" Damos: Lokale Ram-Größen, die referenziert werden:
" Ram: ... Fkt: ...
setlocal errorformat +=%+WLokale\ Ram-Größen%m
setlocal errorformat +=%+WRam:%m
"
setlocal errorformat +=%W%\\%#%#DAM-S-KGR-PLS-EXCEEDED%m:%*\\s,
\%CDAM-S-KGR-PLS-EXCEEDED%m,
\%-Z+-%#
" ignore uninterresting lines
" ---------------------------
" ignore 'ignoring option ...'
setlocal errorformat+=%-Oignoring\ option%.%#
" ignore 'file: 123: #error ...'
setlocal errorformat+=%-O%*\\S\ %*\\d:\ #%.%#
endfunction
" make backups
set backup " keep a backup file
set backupext=~
@ -515,6 +655,7 @@ function GetAllMakeVars()
let varnames['OutDir'] = 'OUTDIR'
let varnames['ProductDir'] = 'OUTDIR_PRODUCTS'
let varnames['DfilesDir'] = 'OUTDIR_D_FILES'
let varnames['bmsk_stand'] = 'OUTDIR_STAND'
let varnames['OutDirVariante'] = 'OUTDIR_VARIANTE'
let varnames['CscopePrg'] = 'CSCOPE'
let varnames['CscopeFile'] = 'CSCOPEFILE'
@ -577,6 +718,33 @@ function GetProductDir()
return g:ProductDir
endfunction
" ---------------------
function GetDfilesDir()
" ---------------------
if !exists('g:DfilesDir')
let g:DfilesDir = GetMakeVar('D_FILES_DIR')
if (g:DfilesDir == '')
let g:DfilesDir = GetMakeVar('OUTDIR_D_FILES')
endif
if (g:DfilesDir != '')
let g:DfilesDir = fnamemodify(g:DfilesDir, ':p')
endif
endif
return g:DfilesDir
endfunction
" --------------------
function GetStandDir()
" --------------------
if !exists('g:bmsk_stand')
let g:bmsk_stand = GetMakeVar('OUTDIR_STAND')
endif
if (g:bmsk_stand != '')
let g:bmsk_stand = fnamemodify(g:bmsk_stand, ':p')
endif
return g:bmsk_stand
endfunction
" --------------------------
function GetOutDirVariante()
" --------------------------
@ -589,13 +757,61 @@ function GetOutDirVariante()
return g:OutDirVariante
endfunction
" ----------------------
function GetCscopePrg()
" ----------------------
if !exists('g:CscopePrg')
let g:CscopePrg = GetMakeVar('CSCOPE')
endif
if (g:CscopePrg != '')
let g:CscopePrg = fnamemodify(g:CscopePrg, ':p')
endif
return g:CscopePrg
endfunction
" ----------------------
function GetCscopeFile()
" ----------------------
if !exists('g:CscopeFile')
let g:CscopeFile = GetMakeVar('CSCOPEFILE')
endif
if (g:CscopeFile != '')
let g:CscopeFile = fnamemodify(g:CscopeFile, ':p')
endif
return g:CscopeFile
endfunction
" ---------------------
function GetCTagsFile()
" ---------------------
if !exists('g:CTagsFile')
let g:CTagsFile = GetMakeVar('CTAGFILE')
endif
if (g:CTagsFile != '')
let g:CTagsFile = fnamemodify(g:CTagsFile, ':p')
endif
return g:CTagsFile
endfunction
" ---------------------
function GetPTagsFile()
" ---------------------
if !exists('g:PTagsFile')
let g:PTagsFile = GetMakeVar('PTAGFILE')
endif
if (g:PTagsFile != '')
let g:PTagsFile = fnamemodify(g:PTagsFile, ':p')
endif
return g:PTagsFile
endfunction
" -----------------
function GetGoals()
" -----------------
if !exists('g:Goals')
let g:Goals = GetMakeVar('GOALS')
endif
return split(g:Goals)
return g:Goals
endfunction
" -----------------------
@ -625,6 +841,14 @@ command CleanSRCfile %s/^#\t\(\(r\d\{1,2\}\t\)\|\(not allocated\)\)\t\(\(\$\$\d\
" tags
" ----
command CscopeConnect call s:CscopeConnect()
function s:CscopeConnect()
let reffile = GetCscopeFile()
if (filereadable(reffile))
execute 'cscope add' reffile
endif
endfunction
" significant characters in tags
set taglength=0
set notagrelative
@ -637,13 +861,22 @@ command -nargs=? GrepBmsk call GrepFull(GetBmskSwDir(), '*.c *.h *.kgs', '<args>
" ----------------
" Make and compile
" ----------------
command -complete=customlist,GetAllBmskTargets -nargs=* Bmsk Make <args>
command -complete=customlist,GetAllBmskTargets -nargs=* BmskDoku call s:BmskDoku('<args>')
command -complete=custom,GetAllBmskTargets -nargs=* Make call s:Make('<args>')
command -complete=custom,GetAllBmskTargets -nargs=* MakeDoku call s:MakeDoku('<args>')
command -nargs=* Lint Make <args> %:t:r.lint
command -complete=customlist,GetAllBmskSWStand -nargs=1 BmskAll call s:BmskAll('<args>')
command -complete=customlist,GetAllBmskSWStand -nargs=1 MakeAll call s:MakeAll('<args>')
" make options
function GetBmskMakeOpts()
" Programmstand compilieren
function s:Make(args)
echo a:args
cscope kill -1
call s:SetBmskCompiler()
execute 'make! ' . a:args .' '. s:GetMakeOptions()
CscopeConnect
clist
endfunction
function s:GetMakeOptions()
let makeopts = ''
if (g:Motor != '')
let makeopts = makeopts . ' Motor=' . g:Motor
@ -663,27 +896,8 @@ function GetBmskMakeOpts()
return makeopts
endfunction
" reformat i-file
command ReformatIFile call Reformat_IFile()
function Reformat_IFile() abort
let cName = expand('%:t:r') . '.c'
let CR = '\<CR>'
DelAllMultipleEmptyLines
" do not wrap over end of file
setlocal nowrapscan
" go to top of file
execute 'normal gg'
" do unil error
while 1
" delete until line of c-file
execute 'normal d/\c^# \d\+ ".*\(' . cName . '\)' . CR
" go to line of include-file
execute 'normal /\c^# \d\+ ".*\(' . cName . '\)\@<!"' . CR
endwhile
endfunction
" Dokumentation erzeugen (Verwenden des LaTeX errorparsers)
function s:BmskDoku(args)
function s:MakeDoku(args)
echo a:args
let command = 'Make ' . a:args . ' '
if match(a:args, '\(^\|\s\)\w\+\($\|\s\+\)') < 0
@ -706,7 +920,7 @@ function s:BmskDoku(args)
cscope kill -1
compiler tex
let &makeprg = g:makeprg . ' $*'
let &makeprg = g:makeCommand . ' $*'
let latexflags = '-interaction=nonstopmode'
execute command . ' LATEXFLAGS=' . latexflags
CscopeConnect
@ -714,7 +928,7 @@ function s:BmskDoku(args)
endfunction
" Erzeugen aller Programmstände
function s:BmskAll(Stand)
function s:MakeAll(Stand)
" Software Stand gegebenenfalls einstellen
if (a:Stand != '') && (g:SW_Stand != a:Stand)
call SetSWStand(a:Stand)
@ -729,43 +943,44 @@ function GetAllBmskSWStand(ArgLead, CmdLine, CursorPos)
endfunction
" Alle Make-Targets als Text Liste
function GetAllBmskTargets(...)
function GetAllBmskTargets(ArgLead, CmdLine, CursorPos)
let goals = GetGoals()
if goals == []
let goals += ['Programmstand']
let goals += ['clean']
let goals += ['cleanall']
let goals += ['cleanProducts']
let goals += ['allTest']
let goals += ['allEntwickler']
let goals += ['allSerie']
let goals += ['patch_a2l']
let goals += ['check_memory']
let goals += ['create_csv']
let goals += ['create_arcus_csv']
let goals += ['import_arcus_csv']
let goals += ['boschsig']
let goals += ['archivate']
let goals += ['lint file=' . expand('%:p')]
let goals += ['tags']
let goals += ['ctags']
let goals += ['ptags']
let goals += ['cscope']
let goals += ['ccm_products_checkout CCM=' . g:ccm]
let goals += ['help']
if goals == ''
let targets = 'Programmstand'
let targets = targets . "\n" . 'clean'
let targets = targets . "\n" . 'cleanall'
let targets = targets . "\n" . 'cleanProducts'
let targets = targets . "\n" . 'allTest'
let targets = targets . "\n" . 'allEntwickler'
let targets = targets . "\n" . 'allSerie'
let targets = targets . "\n" . 'patch_a2l'
let targets = targets . "\n" . 'check_memory'
let targets = targets . "\n" . 'create_csv'
let targets = targets . "\n" . 'create_arcus_csv'
let targets = targets . "\n" . 'import_arcus_csv'
let targets = targets . "\n" . 'boschsig'
let targets = targets . "\n" . 'archivate'
let targets = targets . "\n" . 'lint file=' . expand('%:p')
let targets = targets . "\n" . 'tags'
let targets = targets . "\n" . 'ctags'
let targets = targets . "\n" . 'ptags'
let targets = targets . "\n" . 'cscope'
let targets = targets . "\n" . 'ccm_products_checkout CCM=' . g:ccm
let targets = targets . "\n" . 'help'
else
let goals += [expand('%:t:r') . '.obj']
let goals += [expand('%:t:r') . '.i']
let goals += [expand('%:t:r') . '.src']
let goals += [expand('%:t:r') . '.lint']
let goals += ['FORCE_PROGID=no']
let goals += ['MAKE_DBG=2']
let goals += ['EXTRA_C_FLAGS=']
let goals += ['DIAB_OPTIMIZE=']
let goals += ['MAIN_MAKEFILES=']
let goals += ['ALL_EXIT=']
let targets = substitute(goals, '\s\+', '\n', 'g')
let targets = targets . "\n" . expand('%:t:r') . '.obj'
let targets = targets . "\n" . expand('%:t:r') . '.i'
let targets = targets . "\n" . expand('%:t:r') . '.src'
let targets = targets . "\n" . expand('%:t:r') . '.lint'
let targets = targets . "\n" . 'FORCE_PROGID=no'
let targets = targets . "\n" . 'MAKE_DBG=2'
let targets = targets . "\n" . 'EXTRA_C_FLAGS='
let targets = targets . "\n" . 'DIAB_OPTIMIZE='
let targets = targets . "\n" . 'MAIN_MAKEFILES='
let targets = targets . "\n" . 'ALL_EXIT='
endif
return goals
return targets
endfunction
" -----------------------------------
@ -773,7 +988,7 @@ endfunction
" -----------------------------------
command PatchA2L call s:A2L_EXTENTION()
function s:A2L_EXTENTION()
execute 'compiler bmsk'
call s:SetBmskCompiler()
execute '!start make_fsw.bat patch_a2l ' . g:makeopts . ' & pause'
endfunction

View File

@ -0,0 +1,63 @@
" vim: filetype=vim
" ========
" Settings
" ========
compiler $VIM_COMPILER
set path=$VIM_PATH
set tags=$VIM_TAGS
set cscopeprg=$VIM_CSCOPEPRG
let s:cscopefile = $VIM_CSCOPEFILE
let s:makegoals = $VIM_MAKEGOALS
let s:makeopts = $VIM_MAKEOPTS
if exists('s:did_projectplugin')
finish
endif
let s:did_projectplugin='bmsk'
" ====
" Make
" ====
function s:GetMakeOptions()
return ''
endfunction
function GetAllMakeCompletions(...)
return join(s:makegoals + s:makeopts, "\n")
endfunction
command -complete=custom,GetAllMakeCompletions -nargs=* Make call s:Make('<args>')
function s:Make(args)
echo a:args
CscopeDisconnect
execute 'make ' . a:args .' '. s:GetMakeOptions()
CscopeConnect
clist
endfunction
" -----------------
" CSCOPE-Connection
" -----------------
command CscopeConnect call s:CscopeConnect(s:cscopefile)
function s:CscopeConnect(cscopefile)
if filereadable(a:cscopefile)
execute 'cscope add ' . a:cscopefile
else
echomsg 'cscope: Could not connect: File ' . a:cscopefile . ' does not exist'
endif
endfunction
command CscopeDisconnect call s:CscopeDisconnect()
function s:CscopeDisconnect()
cscope kill -1
endfunction
" ================
" Start of session
" ================
function s:ProjectOnStart()
CscopeConnect
endfunction
call s:ProjectOnStart()

View File

@ -18,3 +18,4 @@ ScriptID SourceID Filename
1772 6973 DAMOS.zip DAMOS tools (von Stefan)
987 6978 DoxygenToolkit.vim
1397 6887 xml.vim
1290 5190 LogiPat

View File

@ -1,328 +0,0 @@
*getlatestvimscripts.txt* Get the Latest VimScripts Dec 23, 2005
Authors: Charles E. Campbell, Jr. <NdrOchip@ScampbellPfamilyA.Mbiz>
(remove NOSPAM from the email address)
*GetLatestVimScripts-copyright*
Copyright: (c) 2004-2005 by Charles E. Campbell, Jr.
The VIM LICENSE applies to GetLatestVimScripts.vim and
GetLatestVimScripts.txt (see |copyright|) except use
"GetLatestVimScripts" instead of "Vim".
No warranty, express or implied. Use At-Your-Own-Risk.
==============================================================================
1. Contents *glvs-contents*
1. Contents...........................................: |glvs-contents|
2. GetLatestVimScripts -- Getting Started.............: |glvs-install|
3. GetLatestVimScripts Usage..........................: |glvs|
4. GetLatestVimScripts Data File......................: |glvs-data|
5. GetLatestVimScripts Plugins........................: |glvs-plugins|
6. GetLatestVimScripts AutoInstall....................: |glvs-autoinstall|
7. GetLatestVimScripts Algorithm......................: |glvs-alg|
8. GetLatestVimScripts History........................: |glvs-hist|
==============================================================================
2. GetLatestVimScripts -- Getting Started *getlatestvimscripts-start*
*getlatestvimscripst-install* *glvs-install*
The last step, that of renaming/moving the GetLatestVimScripts.dist
file, is for those who have just downloaded GetLatestVimScripts.tar.bz2
for the first time. The GetLatestVimScripts.dist file serves as an
example and a template for your own personal list. Feel free to remove
all the scripts mentioned within it; the "important" part of it is the
first two lines.
Your computer needs to have wget for GetLatestVimScripts to do its work.
1. Unix:
cd $HOME/.vim
bunzip2 GetLatestVimScripts.tar.bz2
tar -oxvf GetLatestVimScripts.tar
cd GetLatest
mv GetLatestVimScripts.dist GetLatestVimScripts.dat
vi
:helptags ~/.vim/doc
2. Windows:
cd
cd vimfiles
bunzip2 GetLatestVimScripts.tar.bz2
tar -oxvf GetLatestVimScripts.tar
cd GetLatest
ren GetLatestVimScripts.dist GetLatestVimScripts.dat
vi
:helptags ~/vimfiles/doc
==============================================================================
3. GetLatestVimScripts Usage *getlatestvimscripts* *glvs*
While in vim, type
>
:GetLatestVimScripts
<
Unless its been defined elsewhere,
>
:GLVS
<
will also work.
The script will attempt to update and, if so directed, automatically
install scripts from http://vim.sourceforge.net/. To do so it will
peruse a file, [.vim|vimfiles]/GetLatest/GetLatestVimScripts.dat
(see |glvs-data|), and examine plugins in your [.vim|vimfiles]/plugin
directory (see |glvs-plugin|).
Scripts which have been downloaded will appear in the .../GetLatest
subdirectory.
The <GetLatestVimScripts.dat> file will be automatically be updated to
reflect the latest version of script(s) so downloaded.
==============================================================================
4. GetLatestVimScripts Data File *getlatestvimscripts-data* *glvs-data*
The Data file has a header which should appear as:
>
ScriptID SourceID Filename
--------------------------
<
Below that are three columns; the first two are numeric followed by a
text column.
The first number on each line gives the script's ScriptID. When you're
about to use a web browser to look at scripts on http://vim.sf.net/, just
before you click on the script's link, you'll see a line resembling
http://vim.sourceforge.net/scripts/script.php?script_id=40
The "40" happens to be a ScriptID that GetLatestVimScripts needs to
download the associated page.
The second number on each line gives the script's SourceID. The SourceID
records the count of uploaded scripts as determined by vim.sf.net; hence
it serves to indicate "when" a script was uploaded. Setting the SourceID
to 1 insures that GetLatestVimScripts will assume that the script it has
is out-of-date.
The SourceID is extracted by GetLatestVimScripts from the script's page on
vim.sf.net; whenever its greater than the one stored in the
GetLatestVimScripts.dat file, the script will be downloaded.
If your script's author has included a special comment line in his/her
plugin, the plugin itself will be used by GetLatestVimScripts to build
your <GetLatestVimScripts.dat> file, including any dependencies on
other scripts it may have.
If your comment field begins with :AutoInstall:, GetLatestVimScripts will
attempt to automatically install the script. Thus, GetLatestVimScripts
thus provides a comprehensive ability to keep your plugins up-to-date!
==============================================================================
5. GetLatestVimScripts Plugins *getlatestvimscripts-plugins* *glvs-plugins*
If a plugin author includes the following comment anywhere in their
plugin, GetLatestVimScripts will find it and use it to build user's
GetLatestVimScripts.dat files:
>
src_id
v
" GetLatestVimScripts: ### ### yourscriptname
^
scriptid
<
As an author, you should include such a line in to refer to your own
script plus any additional lines describing any plugin dependencies it
may have. Same format, of course!
If your command is auto-installable (see |glvs-autoinstall|), and most
scripts are, then you may include :AutoInstall: at the start of
"yourscriptname".
GetLatestVimScript commands for those scripts are then appended, if not
already present, to the user's GetLatest/GetLatestVimScripts.dat file.
Its a relatively painless way to automate the acquisition of any scripts
your plugins depend upon.
Now, as an author, you probably don't want GetLatestVimScripts to download
your own scripts for you yourself, thereby overwriting your
not-yet-released hard work. GetLatestVimScripts provides a solution for
this: put
>
0 0 yourscriptname
<
into your <GetLatestVimScripts.dat> file and GetLatestVimScripts will
skip examining the "yourscriptname" scripts for those GetLatestVimScript
comment lines. As a result, those lines won't be inadvertently installed
into your <GetLatestVimScripts.dat> file and subsequently used to download
your own scripts. This is especially important to do if you've included
the :AutoInstall: option.
Be certain to use the same "yourscriptname" in the "0 0 yourscriptname" line
as you've used in your GetLatestVimScript comment!
==============================================================================
6. GetLatestVimScripts AutoInstall *getlatestvimscripts-autoinstall*
*glvs-autoinstall*
GetLatestVimScripts now supports "AutoInstall". Not all scripts are
supportive of auto-install, as they may have special things you need to do
to install them (please refer to the script's "install" directions). On
the other hand, most scripts will be auto-installable.
To let GetLatestVimScripts do an autoinstall, the data file's comment
field should begin with (surrounding blanks are ignored):
:AutoInstall:
Both colons are needed, and it should begin the comment (yourscriptname)
field.
One may prevent any autoinstalling by putting the following line
in your <.vimrc>:
>
let g:GetLatestVimScripts_allowautoinstall= 0
<
With :AutoInstall: enabled, as it is by default, files which end with
---.tar.bz2 : decompressed and untarred in [.vim|vimfiles] directory
---.tar.gz : decompressed and untarred in [.vim|vimfiles] directory
---.vim.bz2 : decompressed and moved to the .vim/plugin directory
---.vim.gz : decompressed and moved to the .vim/plugin directory
---.zip : unzipped in [.vim|vimfiles] directory
---.vim : moved to [.vim|vimfiles]/plugin directory
and which merely need to have their components placed by the untar/gunzip
or move-to-plugin-directory process should be auto-installable.
When is a script not auto-installable? Let me give an example:
>
[.vim|vimfiles]/after/syntax/blockhl.vim
<
The <blockhl.vim> script provides block highlighting for C/C++ programs;
it is available at:
>
http://vim.sourceforge.net/scripts/script.php?script_id=104
<
Currently, vim's after/syntax only supports by-filetype scripts (in
blockhl.vim's case, that's after/syntax/c.vim). Hence, auto-install would
possibly overwrite the current user's after/syntax/c.vim file.
In my own case, I use <aftersyntax.vim> (renamed to after/syntax/c.vim) to
allow a after/syntax/c/ directory:
>
http://vim.sourceforge.net/scripts/script.php?script_id=1023
<
The script allows multiple syntax files to exist separately in the
after/syntax/c subdirectory. I can't bundle aftersyntax.vim in and build
an appropriate tarball for auto-install because of the potential for the
after/syntax/c.vim contained in it to overwrite a user's c.vim.
==============================================================================
7. GetLatestVimScripts Algorithm *getlatestvimscripts-algorithm* *glvs-alg*
The Vim sourceforge page dynamically creates a page by keying off of the
so-called script-id. Within the webpage of
http://vim.sourceforge.net/scripts/script.php?script_id=40
is a line specifying the latest source-id (src_id). The source identifier
numbers are always increasing, hence if the src_id is greater than the one
recorded for the script in GetLatestVimScripts then its time to download a
newer copy of that script.
GetLatestVimScripts will then download the script and update its internal
database of script ids, source ids, and scriptnames.
The AutoInstall process will:
Move the file from GetLatest/ to the following directory
Unix : $HOME/.vim
Windows: $HOME\vimfiles
if the downloaded file ends with ".bz2"
bunzip2 it
else if the downloaded file ends with ".gz"
gunzip it
if the resulting file ends with ".zip"
unzip it
else if the resulting file ends with ".tar"
tar -oxvf it
else if the resulting file ends with ".vim"
move it to the plugin subdirectory
==============================================================================
8. GetLatestVimScripts History *getlatestvimscripts-history* *glvs-hist*
v20 Dec 23, 2005 : * Eric Haarbauer found&fixed a bug with unzip use;
unzip needs the -o flag to overwrite.
v19 Nov 28, 2005 : * v18's GetLatestVimScript line accessed the wrong
script! Fixed.
v18 Mar 21, 2005 : * bugfix to automatic database construction
* bugfix - nowrapscan caused an error
(tnx to David Green for the fix)
Apr 01, 2005 * if shell is bash, "mv" instead of "ren" used in
:AutoInstall:s, even though its o/s is windows
Apr 01, 2005 * when downloading errors occurred, GLVS was
terminating early. It now just goes on to trying
the next script (after trying three times to
download a script description page)
Apr 20, 2005 * bugfix - when a failure to download occurred,
GetLatestVimScripts would stop early and claim that
everything was current. Fixed.
v17 Aug 25, 2004 : * g:GetLatestVimScripts_allowautoinstall, which
defaults to 1, can be used to prevent all
:AutoInstall:
v16 Aug 25, 2004 : * made execution of bunzip2/gunzip/tar/zip silent
* fixed bug with :AutoInstall: use of helptags
v15 Aug 24, 2004 : * bugfix: the "0 0 comment" download prevention wasn't
always preventing downloads (just usually). Fixed.
v14 Aug 24, 2004 : * bugfix -- helptags was using dotvim, rather than
s:dotvim. Fixed.
v13 Aug 23, 2004 : * will skip downloading a file if its scriptid or srcid
is zero. Useful for script authors; that way their
own GetLatestVimScripts activity won't overwrite
their scripts.
v12 Aug 23, 2004 : * bugfix - a "return" got left in the distribution that
was intended only for testing. Removed, now works.
* :AutoInstall: implemented
v11 Aug 20, 2004 : * GetLatestVimScripts is now a plugin:
* :GetLatestVimScripts command
* (runtimepath)/GetLatest/GetLatestVimScripts.dat
now holds scripts that need updating
v10 Apr 19, 2004 : * moved history from script to doc
v9 Jan 23, 2004 : windows (win32/win16/win95) will use
double quotes ("") whereas other systems will use
single quotes ('') around the urls in calls via wget
v8 Dec 01, 2003 : makes three tries at downloading
v7 Sep 02, 2003 : added error messages if "Click on..." or "src_id="
not found in downloaded webpage
Uses t_ti, t_te, and rs to make progress visible
v6 Aug 06, 2003 : final status messages now display summary of work
( "Downloaded someqty scripts" or
"Everything was current")
Now GetLatestVimScripts is careful about downloading
GetLatestVimScripts.vim itself!
(goes to <NEW_GetLatestVimScripts.vim>)
v5 Aug 04, 2003 : missing an endif near bottom
v4 Jun 17, 2003 : redraw! just before each "considering" message
v3 May 27, 2003 : Protects downloaded files from errant shell
expansions with single quotes: '...'
v2 May 14, 2003 : extracts name of item to be obtained from the
script file. Uses it instead of comment field
for output filename; comment is used in the
"considering..." line and is now just a comment!
* Fixed a bug: a string-of-numbers is not the
same as a number, so I added zero to them
and they became numbers. Fixes comparison.
==============================================================================
vim:tw=78:ts=8:ft=help

102
vimfiles/doc/LogiPat.txt Normal file
View File

@ -0,0 +1,102 @@
*logipat.txt* Logical Patterns Aug 09, 2005
Author: Charles E. Campbell, Jr. <NdrOchip@ScampbellPfamily.AbizM>
Copyright: (c) 2004-2005 by Charles E. Campbell, Jr. *logipat-copyright*
The VIM LICENSE applies to LogiPat.vim and LogiPat.txt
(see |copyright|) except use "LogiPat" instead of "Vim"
No warranty, express or implied. Use At-Your-Own-Risk.
==============================================================================
1. Contents *logipat*
1. Contents.................: |logipat-contents|
2. LogiPat Manual...........: |logipat-manual|
3. LogiPat Examples.........: |logipat-examples|
4. Caveat...................: |logipat-caveat|
5. LogiPat History..........: |logipat-history|
==============================================================================
2. LogiPat Manual *logipat-manual* *logipat-man*
*logipat-arg* *logipat-input* *logipat-pattern* *logipat-operators*
Boolean logic patterns are composed of
operators ! = not
| = logical-or
& = logical-and
grouping ( ... )
patterns "pattern"
:LogiPat {boolean-logic pattern} *:LogiPat*
:LogiPat is a command which takes a boolean-logic
argument (|logipat-arg|).
:LP {boolean-logic pattern} *:LP*
:LP is a shorthand command version of :LogiPat
(|logipat-cmd|).
:LogiPatFlags {search flags} *LogiPat-flags*
:LogiPatFlags {search flags}
LogiPat uses the |search()| command. The flags
passed to that call to search() may be specified
by the :LogiPatFlags command.
:LPF {search flags} *:LPF*
:LPF is a shorthand version of :LogiPatFlags.
:let pat=LogiPat({boolean-logic pattern}) *LogiPat()*
If one calls LogiPat() directly, no search
is done, but the transformation from the boolean
logic pattern into a regular expression pattern
is performed and returned.
==============================================================================
3. LogiPat Examples *logipat-examples*
LogiPat takes Boolean logic arguments and produces a regular
expression which implements the choices. A series of examples
follow:
>
:LogiPat "abc"
< will search for lines containing the string "abc"
>
:LogiPat !"abc"
< will search for lines which don't contain the string "abc"
>
:LogiPat "abc"|"def"
< will search for lines which contain either the string
"abc" or the string "def"
>
:LogiPat !("abc"|"def")
< will search for lines which don't contain either
of the strings "abc" or "def"
>
:LogiPat "abc"&"def"
< will search for lines which contain both of the strings
"abc" and "def"
>
:let pat= LogiPat('!"abc"')
< will return the regular expression which will match
all lines not containing "abc". The double quotes
are needed to pass normal patterns to LogiPat, and
differentiate such patterns from boolean logic
operators.
==============================================================================
4. Caveat *logipat-caveat*
The "not" operator may be fragile; ie. it may not always play well
with the & (logical-and) and | (logical-or) operators. Please try out
your patterns, possibly with :set hls, to insure that what is matching
is what you want.
==============================================================================
3. LogiPat History *logipat-history*
v2 May 31, 2005 * LPF and LogiPatFlags commands weren't working
v1 May 23, 2005 * initial release
==============================================================================
vim:tw=78:ts=8:ft=help

View File

@ -2,6 +2,9 @@
:GLVS pi_getscript.txt /*:GLVS*
:GetLatestVimScripts_dat pi_getscript.txt /*:GetLatestVimScripts_dat*
:Hexplore pi_netrw.txt /*:Hexplore*
:LP LogiPat.txt /*:LP*
:LPF LogiPat.txt /*:LPF*
:LogiPat LogiPat.txt /*:LogiPat*
:MkVimball pi_vimball.txt /*:MkVimball*
:Nexplore pi_netrw.txt /*:Nexplore*
:Pexplore pi_netrw.txt /*:Pexplore*
@ -18,7 +21,6 @@
:VimballList pi_vimball.txt /*:VimballList*
C-Reference crefvim.txt /*C-Reference*
GetLatestVimScripts pi_getscript.txt /*GetLatestVimScripts*
GetLatestVimScripts-copyright GetLatestVimScripts.txt /*GetLatestVimScripts-copyright*
GetLatestVimScripts-copyright pi_getscript.txt /*GetLatestVimScripts-copyright*
GetLatestVimScripts_dat pi_getscript.txt /*GetLatestVimScripts_dat*
I visincr.txt /*I*
@ -35,6 +37,8 @@ IO visincr.txt /*IO*
IR visincr.txt /*IR*
IX visincr.txt /*IX*
IYMD visincr.txt /*IYMD*
LogiPat() LogiPat.txt /*LogiPat()*
LogiPat-flags LogiPat.txt /*LogiPat-flags*
Nread pi_netrw.txt /*Nread*
Nsource pi_netrw.txt /*Nsource*
Nwrite pi_netrw.txt /*Nwrite*
@ -1326,44 +1330,39 @@ g:netrw_win95ftp pi_netrw.txt /*g:netrw_win95ftp*
g:netrw_winsize pi_netrw.txt /*g:netrw_winsize*
g:vimball_home pi_vimball.txt /*g:vimball_home*
g:visincr_datedivset visincr.txt /*g:visincr_datedivset*
getlatestvimscripst-install GetLatestVimScripts.txt /*getlatestvimscripst-install*
getlatestvimscripts GetLatestVimScripts.txt /*getlatestvimscripts*
getlatestvimscripts-algorithm GetLatestVimScripts.txt /*getlatestvimscripts-algorithm*
getlatestvimscripts-autoinstall GetLatestVimScripts.txt /*getlatestvimscripts-autoinstall*
getlatestvimscripts-data GetLatestVimScripts.txt /*getlatestvimscripts-data*
getlatestvimscripts-history GetLatestVimScripts.txt /*getlatestvimscripts-history*
getlatestvimscripts-install pi_getscript.txt /*getlatestvimscripts-install*
getlatestvimscripts-plugins GetLatestVimScripts.txt /*getlatestvimscripts-plugins*
getlatestvimscripts-start GetLatestVimScripts.txt /*getlatestvimscripts-start*
getlatestvimscripts.txt GetLatestVimScripts.txt /*getlatestvimscripts.txt*
getscript pi_getscript.txt /*getscript*
getscript-autoinstall pi_getscript.txt /*getscript-autoinstall*
getscript-data pi_getscript.txt /*getscript-data*
getscript-history pi_getscript.txt /*getscript-history*
getscript-plugins pi_getscript.txt /*getscript-plugins*
getscript-start pi_getscript.txt /*getscript-start*
glvs GetLatestVimScripts.txt /*glvs*
glvs pi_getscript.txt /*glvs*
glvs-alg GetLatestVimScripts.txt /*glvs-alg*
glvs-alg pi_getscript.txt /*glvs-alg*
glvs-algorithm pi_getscript.txt /*glvs-algorithm*
glvs-autoinstall GetLatestVimScripts.txt /*glvs-autoinstall*
glvs-autoinstall pi_getscript.txt /*glvs-autoinstall*
glvs-contents GetLatestVimScripts.txt /*glvs-contents*
glvs-contents pi_getscript.txt /*glvs-contents*
glvs-copyright pi_getscript.txt /*glvs-copyright*
glvs-data GetLatestVimScripts.txt /*glvs-data*
glvs-data pi_getscript.txt /*glvs-data*
glvs-dist-install pi_getscript.txt /*glvs-dist-install*
glvs-hist GetLatestVimScripts.txt /*glvs-hist*
glvs-hist pi_getscript.txt /*glvs-hist*
glvs-install GetLatestVimScripts.txt /*glvs-install*
glvs-install pi_getscript.txt /*glvs-install*
glvs-options pi_getscript.txt /*glvs-options*
glvs-plugins GetLatestVimScripts.txt /*glvs-plugins*
glvs-plugins pi_getscript.txt /*glvs-plugins*
glvs-usage pi_getscript.txt /*glvs-usage*
http pi_netrw.txt /*http*
logipat LogiPat.txt /*logipat*
logipat-arg LogiPat.txt /*logipat-arg*
logipat-caveat LogiPat.txt /*logipat-caveat*
logipat-copyright LogiPat.txt /*logipat-copyright*
logipat-examples LogiPat.txt /*logipat-examples*
logipat-history LogiPat.txt /*logipat-history*
logipat-input LogiPat.txt /*logipat-input*
logipat-man LogiPat.txt /*logipat-man*
logipat-manual LogiPat.txt /*logipat-manual*
logipat-operators LogiPat.txt /*logipat-operators*
logipat-pattern LogiPat.txt /*logipat-pattern*
logipat.txt LogiPat.txt /*logipat.txt*
netreadfixup pi_netrw.txt /*netreadfixup*
netrw pi_netrw.txt /*netrw*
netrw-- pi_netrw.txt /*netrw--*

320
vimfiles/plugin/LogiPat.vim Normal file
View File

@ -0,0 +1,320 @@
" LogiPat:
" Author: Charles E. Campbell, Jr.
" Date: Sep 01, 2005
" Version: 2
" Purpose: to do Boolean-logic based regular expression pattern matching
" Copyright: Copyright (C) 1999-2005 Charles E. Campbell, Jr. {{{1
" Permission is hereby granted to use and distribute this code,
" with or without modifications, provided that this copyright
" notice is copied with it. Like anything else that's free,
" LogiPat.vim is provided *as is* and comes with no warranty
" of any kind, either expressed or implied. By using this
" plugin, you agree that in no event will the copyright
" holder be liable for any damages resulting from the use
" of this software.
"
" Usage: {{{1
" :LogiPat ...
"
" Boolean logic supported:
" () grouping operators
" ! not the following pattern
" | logical or
" & logical and
" "..pattern.."
" Example: {{{1
" :LogiPat !("january"|"february")
" would match all strings not containing the strings january
" or february
" GetLatestVimScripts: 1290 1 :AutoInstall: LogiPat.vim
"
" Behold, you will conceive in your womb, and bring forth a son, {{{1
" and will call his name Jesus. He will be great, and will be
" called the Son of the Most High. The Lord God will give him the
" throne of his father, David, and he will reign over the house of
" Jacob forever. There will be no end to his kingdom. (Luke 1:31-33 WEB)
" ---------------------------------------------------------------------
" Load Once: {{{1
if &cp || exists("loaded_logipat")
finish
endif
let g:loaded_LogiPat = "v2"
let s:keepcpo = &cpo
set cpo&vim
" ---------------------------------------------------------------------
" Public Interface: {{{1
com! -nargs=* LogiPat call LogiPat(<q-args>,1)
silent! com -nargs=* LP call LogiPat(<q-args>,1)
com! -nargs=+ LogiPatFlags let s:LogiPatFlags="<args>"
silent! com -nargs=+ LPF let s:LogiPatFlags="<args>"
" =====================================================================
" Functions: {{{1
" ---------------------------------------------------------------------
" LogiPat: this function interprets the boolean-logic pattern {{{2
fun! LogiPat(pat,...)
" call Dfunc("LogiPat(pat<".a:pat.">)")
" LogiPat(pat,dosearch)
if a:0 > 0
let dosearch= a:1
else
let dosearch= 0
endif
let s:npatstack = 0
let s:nopstack = 0
let s:preclvl = 0
let expr = a:pat
" Lexer/Parser
while expr != ""
" call Decho("expr<".expr.">")
if expr =~ '^"'
" push a Pattern
let pat = substitute(strpart(expr,1),'^\([^"]*\)".*$','\1','')
let patlen = strlen(pat) - 1
" call Decho("pat<".pat."> patlen-1=".patlen)
if patlen > 1 && strpart(pat,patlen,1) == '\\'
echoerr "LogiPat doesn't accept escaped backquotes in patterns (yet)"
" call Dret("LogiPat --error--")
return '--error--'
endif
call s:LP_PatPush('.*'.pat.'.*')
let patlen = patlen+3
let expr = strpart(expr,patlen)
elseif expr =~ '^[!()|&]'
" push an operator
let op = strpart(expr,0,1)
let expr = strpart(expr,strlen(op))
call s:LP_OpPush(op)
elseif expr =~ '^\s'
" skip whitespace
let expr= strpart(expr,1)
else
echoerr "operator<".strpart(expr,0,1)."> not supported (yet)"
let expr= strpart(expr,1)
endif
endwhile
" Final Execution
call s:LP_OpPush('Z')
let result= s:LP_PatPop(1)
" call Decho("result=".result)
" sanity checks and cleanup
if s:npatstack > 0
echoerr s:npatstack." patterns left on stack!"
let s:npatstack= 0
endif
if s:nopstack > 0
echoerr s:nopstack." operators left on stack!"
let s:nopstack= 0
endif
" perform the indicated search
if dosearch
if exists("s:LogiPatFlags")
" call Decho("search(result<".result."> LogiPatFlags<".s:LogiPatFlags.">)")
call search(result,s:LogiPatFlags)
else
" call Decho("search(result<".result.">)")
call search(result)
endif
let @/= result
endif
" call Dret("LogiPat ".result)
return result
endfun
" ---------------------------------------------------------------------
" LP_PatPush: {{{2
fun! s:LP_PatPush(pat)
" call Dfunc("LP_PatPush(pat<".a:pat.">)")
let s:npatstack = s:npatstack + 1
let s:patstack_{s:npatstack} = a:pat
" call s:StackLook("patpush") "Decho
" call Dret("LP_PatPush : npatstack=".s:npatstack)
endfun
" ---------------------------------------------------------------------
" LP_PatPop: pop a number/variable from LogiPat's pattern stack {{{2
fun! s:LP_PatPop(lookup)
" call Dfunc("LP_PatPop(lookup=".a:lookup.")")
if s:npatstack > 0
let ret = s:patstack_{s:npatstack}
let s:npatstack = s:npatstack - 1
else
let ret= "---error---"
echoerr "(LogiPat) invalid expression"
endif
" call s:StackLook("patpop") "Decho
" call Dret("LP_PatPop ".ret)
return ret
endfun
" ---------------------------------------------------------------------
" LP_OpPush: {{{2
fun! s:LP_OpPush(op)
" call Dfunc("LP_OpPush(op<".a:op.">)")
" determine new operator's precedence level
if a:op == '('
let s:preclvl= s:preclvl + 10
let preclvl = s:preclvl
elseif a:op == ')'
let s:preclvl= s:preclvl - 10
if s:preclvl < 0
let s:preclvl= 0
echoerr "too many )s"
endif
let preclvl= s:preclvl
elseif a:op =~ '|'
let preclvl= s:preclvl + 2
elseif a:op =~ '&'
let preclvl= s:preclvl + 4
elseif a:op == '!'
let preclvl= s:preclvl + 6
elseif a:op == 'Z'
let preclvl= -1
else
echoerr "expr<".expr."> not supported (yet)"
let preclvl= s:preclvl
endif
" execute higher-precdence operators
call s:LP_Execute(preclvl)
" push new operator onto operator-stack
if a:op =~ '!'
let s:nopstack = s:nopstack + 1
let s:opprec_{s:nopstack} = preclvl
let s:opstack_{s:nopstack} = a:op
elseif a:op =~ '|'
let preclvl= s:preclvl + 1
let s:nopstack = s:nopstack + 1
let s:opprec_{s:nopstack} = preclvl
let s:opstack_{s:nopstack} = a:op
elseif a:op == '&'
let preclvl= s:preclvl + 2
let s:nopstack = s:nopstack + 1
let s:opprec_{s:nopstack} = preclvl
let s:opstack_{s:nopstack} = a:op
endif
" call s:StackLook("oppush") "Decho
" call Dret("LP_OpPush")
endfun
" ---------------------------------------------------------------------
" LP_Execute: execute operators from opstack using pattern stack {{{2
fun! s:LP_Execute(preclvl)
" call Dfunc("LP_Execute(preclvl=".a:preclvl.") npatstack=".s:npatstack." nopstack=".s:nopstack)
" execute all higher precedence operators
while s:nopstack > 0 && a:preclvl < s:opprec_{s:nopstack}
let op= s:opstack_{s:nopstack}
" call Decho("op<".op."> nop=".s:nopstack." [preclvl=".a:preclvl."] < [opprec_".s:nopstack."=".s:opprec_{s:nopstack}."]")
let s:nopstack = s:nopstack - 1
if op == '!'
let n1= s:LP_PatPop(1)
call s:LP_PatPush(s:LP_Not(n1))
elseif op == '|'
let n1= s:LP_PatPop(1)
let n2= s:LP_PatPop(1)
call s:LP_PatPush(s:LP_Or(n2,n1))
elseif op =~ '&'
let n1= s:LP_PatPop(1)
let n2= s:LP_PatPop(1)
call s:LP_PatPush(s:LP_And(n2,n1))
endif
" call s:StackLook("execute") "Decho
endwhile
" call Dret("LP_Execute")
endfun
" ---------------------------------------------------------------------
" LP_Not: writes a logical-not for a pattern {{{2
fun! s:LP_Not(pat)
" call Dfunc("LP_Not(pat<".a:pat.">)")
if a:pat =~ '^\.\*' && a:pat =~ '\.\*$'
let pat= substitute(a:pat,'^\.\*\(.*\)\.\*$','\1','')
let ret= '^\%(\%('.pat.'\)\@!.\)*$'
else
let ret= '^\%(\%('.a:pat.'\)\@!.\)*$'
endif
" call Dret("LP_Not ".ret)
return ret
endfun
" ---------------------------------------------------------------------
" LP_Or: writes a logical-or branch using two patterns {{{2
fun! s:LP_Or(pat1,pat2)
" call Dfunc("LP_Or(pat1<".a:pat1."> pat2<".a:pat2.">)")
let ret= a:pat1.'\|'.a:pat2
" call Dret("LP_Or ".ret)
return ret
endfun
" ---------------------------------------------------------------------
" LP_And: writes a logical-and concat using two patterns {{{2
fun! s:LP_And(pat1,pat2)
" call Dfunc("LP_And(pat1<".a:pat1."> pat2<".a:pat2.">)")
let ret= '\%('.a:pat1.'\&'.a:pat2.'\)'
" call Dret("LP_And ".ret)
return ret
endfun
" ---------------------------------------------------------------------
" StackLook: {{{2
fun! s:StackLook(description)
" call Dfunc("StackLook(description<".a:description.">)")
let iop = 1
let ifp = 1
" call Decho("Pattern Operator")
" print both pattern and operator
while ifp <= s:npatstack && iop <= s:nopstack
let fp = s:patstack_{ifp}
let op = s:opstack_{iop}." (P".s:opprec_{s:nopstack}.')'
let fplen= strlen(fp)
if fplen < 30
let fp= fp.strpart(" ",1,30-fplen)
endif
" call Decho(fp.op)
let ifp = ifp + 1
let iop = iop + 1
endwhile
" print just pattern
while ifp <= s:npatstack
let fp = s:patstack_{ifp}
" call Decho(fp)
let ifp = ifp + 1
endwhile
" print just operator
while iop <= s:nopstack
let op = s:opstack_{iop}." (P".s:opprec_{s:nopstack}.')'
" call Decho(" ".op)
let iop = iop + 1
endwhile
" call Dret("StackLook")
endfun