Angleichen bmsk - bmsx: Bmsk benutzt GetVars, ...
git-svn-id: https://vimsuite.svn.sourceforge.net/svnroot/vimsuite/trunk@134 eb2d0018-73a3-4aeb-bfe9-1def61c9ec69
This commit is contained in:
parent
28d94f21ed
commit
0c7dbfc4be
@ -14,9 +14,6 @@ let b:forceRedoTexCompiler = 'yes'
|
|||||||
let g:Tex_ShowallLines = 1
|
let g:Tex_ShowallLines = 1
|
||||||
"execute 'source ' . expand(g:vimfiles . '/compiler/tex.vim')
|
"execute 'source ' . expand(g:vimfiles . '/compiler/tex.vim')
|
||||||
|
|
||||||
let g:makeprg = simplify(GetBmskDir() . '/make_fsw.bat')
|
|
||||||
let &makeprg = g:makeprg . ' $*'
|
|
||||||
|
|
||||||
if exists('g:make_log')
|
if exists('g:make_log')
|
||||||
let &shellpipe = '| ' . g:tee . PathNormpath(make_log) . ' | ' . g:tee
|
let &shellpipe = '| ' . g:tee . PathNormpath(make_log) . ' | ' . g:tee
|
||||||
else
|
else
|
||||||
@ -133,22 +130,6 @@ if (g:SW_Stand != '')
|
|||||||
let g:makeopts = g:makeopts . ' Stand=' . g:SW_Stand
|
let g:makeopts = g:makeopts . ' Stand=' . g:SW_Stand
|
||||||
endif
|
endif
|
||||||
|
|
||||||
" user commands
|
|
||||||
command! -nargs=* Make execute(':make! <args> ' . g:makeopts)
|
|
||||||
command! -nargs=0 Clean call Clean()
|
|
||||||
command! -nargs=0 CleanAll call CleanAll()
|
|
||||||
command! Compile call Compile_File()
|
|
||||||
command! PreCompile call PreCompile_File()
|
|
||||||
|
|
||||||
" Clean function
|
|
||||||
function! Clean()
|
|
||||||
Make clean
|
|
||||||
endfunction
|
|
||||||
function! CleanAll()
|
|
||||||
cscope kill -1
|
|
||||||
Make cleanall
|
|
||||||
endfunction
|
|
||||||
|
|
||||||
" reformat i-file
|
" reformat i-file
|
||||||
command! ReformatIFile call Reformat_IFile()
|
command! ReformatIFile call Reformat_IFile()
|
||||||
function! Reformat_IFile() abort
|
function! Reformat_IFile() abort
|
||||||
@ -168,38 +149,3 @@ function! Reformat_IFile() abort
|
|||||||
endwhile
|
endwhile
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! GetMakeVar(varName)
|
|
||||||
let var = GetMakeVars([a:varName])
|
|
||||||
if has_key(var, a:varName)
|
|
||||||
let varValue = var[a:varName]
|
|
||||||
else
|
|
||||||
let varValue = ''
|
|
||||||
endif
|
|
||||||
return varValue
|
|
||||||
endfunction
|
|
||||||
|
|
||||||
function! GetMakeVars(varNameList)
|
|
||||||
let varlist = {}
|
|
||||||
try
|
|
||||||
let vars = join(a:varNameList, ' ')
|
|
||||||
let command = g:makeprg . g:makeopts . ' getvar name="' . vars . '"'
|
|
||||||
let output = system(command)
|
|
||||||
let lines = split(output, "\n")
|
|
||||||
if len(lines) == 1
|
|
||||||
" make < make-43 (Antwort nur VALUE)
|
|
||||||
let RE = '\(.*\)'
|
|
||||||
let SU = "let varlist['" . vars . "']='\\1'"
|
|
||||||
else
|
|
||||||
" make >= make-43 (Antwort: NAME=VALUE
|
|
||||||
let RE = '^\(\w\+\)=\(.*\)\s*'
|
|
||||||
let SU = "let varlist['\\1']='\\2'"
|
|
||||||
endif
|
|
||||||
for line in lines
|
|
||||||
if match(line, RE) >= 0
|
|
||||||
execute substitute(line, RE, SU, '')
|
|
||||||
endif
|
|
||||||
endfor
|
|
||||||
endtry
|
|
||||||
return varlist
|
|
||||||
endfunction
|
|
||||||
|
|
||||||
|
@ -10,7 +10,9 @@ setlocal softtabstop=4
|
|||||||
setlocal formatoptions=croq
|
setlocal formatoptions=croq
|
||||||
|
|
||||||
" vimfiles sollen immer im unix-Format gespeichert werden
|
" vimfiles sollen immer im unix-Format gespeichert werden
|
||||||
setlocal fileformat=unix
|
if filereadable('%')
|
||||||
|
setlocal fileformat=unix
|
||||||
|
endif
|
||||||
|
|
||||||
" commenting
|
" commenting
|
||||||
let b:commentstring = '"'
|
let b:commentstring = '"'
|
||||||
|
@ -45,6 +45,8 @@ function s:SetBmskProject(basedir)
|
|||||||
let basedir = fnamemodify(makefile, ':p:h')
|
let basedir = fnamemodify(makefile, ':p:h')
|
||||||
let makefile = fnamemodify(makefile, ':t')
|
let makefile = fnamemodify(makefile, ':t')
|
||||||
if ((makefile == 'make_fsw.bat') || (makefile == 'makefile.mak') || (makefile == 'makefile'))
|
if ((makefile == 'make_fsw.bat') || (makefile == 'makefile.mak') || (makefile == 'makefile'))
|
||||||
|
let g:makeCommand = makefile
|
||||||
|
let &makeprg = g:makeCommand . ' $*'
|
||||||
call s:SetBmskDirs(basedir)
|
call s:SetBmskDirs(basedir)
|
||||||
else
|
else
|
||||||
echo 'No makefile:' makefile
|
echo 'No makefile:' makefile
|
||||||
@ -59,6 +61,8 @@ function s:SetBmskProject(basedir)
|
|||||||
let basedir = fnamemodify(makefile, ':p:h')
|
let basedir = fnamemodify(makefile, ':p:h')
|
||||||
endif
|
endif
|
||||||
if (filereadable(makefile))
|
if (filereadable(makefile))
|
||||||
|
let g:makeCommand = makefile
|
||||||
|
let &makeprg = g:makeCommand . ' $*'
|
||||||
call s:SetBmskDirs(basedir)
|
call s:SetBmskDirs(basedir)
|
||||||
else
|
else
|
||||||
echo 'No makefile' makefile
|
echo 'No makefile' makefile
|
||||||
@ -755,7 +759,8 @@ command -nargs=? GrepBmsk call GrepFull(GetBmskSwDir(), '*.c *.h *.kgs', '<args>
|
|||||||
" ----------------
|
" ----------------
|
||||||
" Make and compile
|
" Make and compile
|
||||||
" ----------------
|
" ----------------
|
||||||
command -complete=custom,GetAllBmskTargets -nargs=* Bmsk call s:Bmsk('<args>')
|
"command -complete=custom,GetAllBmskTargets -nargs=* Make call s:Make('<args>')
|
||||||
|
command -complete=custom,GetAllBmskTargets -nargs=* Bmsk call s:Make('<args>')
|
||||||
command -complete=custom,GetAllBmskTargets -nargs=* BmskDoku call s:BmskDoku('<args>')
|
command -complete=custom,GetAllBmskTargets -nargs=* BmskDoku call s:BmskDoku('<args>')
|
||||||
command -nargs=* Clean compiler bmsk | Clean <args>
|
command -nargs=* Clean compiler bmsk | Clean <args>
|
||||||
command -nargs=* CleanAll compiler bmsk | CleanAll <args>
|
command -nargs=* CleanAll compiler bmsk | CleanAll <args>
|
||||||
@ -764,11 +769,11 @@ command -nargs=* Lint Bmsk <args> %:t:r.lint
|
|||||||
command -complete=customlist,GetAllBmskSWStand -nargs=1 BmskAll call s:BmskAll('<args>')
|
command -complete=customlist,GetAllBmskSWStand -nargs=1 BmskAll call s:BmskAll('<args>')
|
||||||
|
|
||||||
" Programmstand compilieren
|
" Programmstand compilieren
|
||||||
function s:Bmsk(args)
|
function s:Make(args)
|
||||||
echo a:args
|
echo a:args
|
||||||
cscope kill -1
|
cscope kill -1
|
||||||
compiler bmsk
|
compiler bmsk
|
||||||
execute 'Make ' . a:args
|
execute 'make!' a:args g:makeopts
|
||||||
CscopeConnect
|
CscopeConnect
|
||||||
clist
|
clist
|
||||||
endfunction
|
endfunction
|
||||||
|
@ -25,7 +25,7 @@ let g:projectFile = fnamemodify($VIMRUNTIME . '/../projects.txt', ':p')
|
|||||||
" SetProject
|
" SetProject
|
||||||
" ----------
|
" ----------
|
||||||
if (v:version > 602)
|
if (v:version > 602)
|
||||||
command -complete=customlist,GetAllMakefiles -nargs=? SetProject call s:SetProject('<args>')
|
command -complete=customlist,GetAllMakefiles -nargs=? SetProject call SetProject('<args>')
|
||||||
else
|
else
|
||||||
command -nargs=1 SetProject call SetProject('<args>')
|
command -nargs=1 SetProject call SetProject('<args>')
|
||||||
endif
|
endif
|
||||||
@ -84,7 +84,7 @@ endfunction
|
|||||||
|
|
||||||
" Find makefile and set some options
|
" Find makefile and set some options
|
||||||
" ----------------------------------
|
" ----------------------------------
|
||||||
function s:SetProject(makefile)
|
function SetProject(makefile)
|
||||||
if ((a:makefile == '') && has('browse'))
|
if ((a:makefile == '') && has('browse'))
|
||||||
" Browse for makefile
|
" Browse for makefile
|
||||||
if exists('g:WA')
|
if exists('g:WA')
|
||||||
@ -106,13 +106,16 @@ function s:SetProject(makefile)
|
|||||||
|
|
||||||
" split file name and path
|
" split file name and path
|
||||||
let g:basedir = fnamemodify(makefilePath, ':p:h')
|
let g:basedir = fnamemodify(makefilePath, ':p:h')
|
||||||
let g:makefileName = fnamemodify(makefilePath, ':t')
|
let makefileName = fnamemodify(makefilePath, ':t')
|
||||||
|
|
||||||
" test if makefile is a batch-script
|
" test if makefile is a batch-script
|
||||||
let ext = fnamemodify(g:makefileName, ':e')
|
let ext = fnamemodify(makefileName, ':e')
|
||||||
if ext == 'bat'
|
if ext == 'bat'
|
||||||
let &makeprg = makefilePath . ' $*'
|
let g:makeCommand = makefilePath
|
||||||
|
else
|
||||||
|
let g:makeCommand = 'make -f ' . makefilePath
|
||||||
endif
|
endif
|
||||||
|
let &makeprg = g:makeCommand . ' $*'
|
||||||
|
|
||||||
" set directories
|
" set directories
|
||||||
execute 'cd ' . g:basedir
|
execute 'cd ' . g:basedir
|
||||||
@ -138,7 +141,7 @@ function s:SetProjectVariables()
|
|||||||
\ 'VIM_CSCOPEFILE',
|
\ 'VIM_CSCOPEFILE',
|
||||||
\ 'GOALS',
|
\ 'GOALS',
|
||||||
\]
|
\]
|
||||||
let s:Variables = s:GetMakeVars(varnames)
|
let s:Variables = GetMakeVars(varnames)
|
||||||
|
|
||||||
echo 'Reading variables from makefile'
|
echo 'Reading variables from makefile'
|
||||||
echo '-------------------------------'
|
echo '-------------------------------'
|
||||||
@ -154,7 +157,7 @@ function s:SetProjectVariables()
|
|||||||
try
|
try
|
||||||
execute 'set path=' . s:Variables['VIM_PATH']
|
execute 'set path=' . s:Variables['VIM_PATH']
|
||||||
catch
|
catch
|
||||||
echoerr 'cant set path to ' . s:Variables['VIM_PATH']
|
echoerr 'cant set path to "' . s:Variables['VIM_PATH'] . '"'
|
||||||
echoerr 'check the make variable VIM_PATH'
|
echoerr 'check the make variable VIM_PATH'
|
||||||
endtry
|
endtry
|
||||||
else
|
else
|
||||||
@ -166,7 +169,7 @@ function s:SetProjectVariables()
|
|||||||
try
|
try
|
||||||
execute 'set tags=' . s:Variables['VIM_TAGS']
|
execute 'set tags=' . s:Variables['VIM_TAGS']
|
||||||
catch
|
catch
|
||||||
echoerr 'cant set tags to ' . s:Variables['VIM_TAGS']
|
echoerr 'cant set tags to "' . s:Variables['VIM_TAGS'] . '"'
|
||||||
echoerr 'check the make variable VIM_TAGS'
|
echoerr 'check the make variable VIM_TAGS'
|
||||||
endtry
|
endtry
|
||||||
else
|
else
|
||||||
@ -178,7 +181,7 @@ function s:SetProjectVariables()
|
|||||||
try
|
try
|
||||||
execute 'set cscopeprg=' . s:Variables['VIM_CSCOPEPRG']
|
execute 'set cscopeprg=' . s:Variables['VIM_CSCOPEPRG']
|
||||||
catch
|
catch
|
||||||
echoerr 'cant set cscopeprg to ' . s:Variables['VIM_CSCOPEPRG']
|
echoerr 'cant set cscopeprg to "' . s:Variables['VIM_CSCOPEPRG'] . '"'
|
||||||
echoerr 'check the make variable VIM_CSCOPEPRG'
|
echoerr 'check the make variable VIM_CSCOPEPRG'
|
||||||
endtry
|
endtry
|
||||||
else
|
else
|
||||||
@ -189,7 +192,7 @@ function s:SetProjectVariables()
|
|||||||
cscope kill -1
|
cscope kill -1
|
||||||
execute 'cscope add ' . s:Variables['VIM_CSCOPEFILE']
|
execute 'cscope add ' . s:Variables['VIM_CSCOPEFILE']
|
||||||
catch
|
catch
|
||||||
echomsg 'cant add cscope-file ' . s:Variables['VIM_CSCOPEFILE']
|
echomsg 'cant add cscope-file "' . s:Variables['VIM_CSCOPEFILE'] . '"'
|
||||||
echomsg 'check the make variable VIM_CSCOPEFILE and if file exists'
|
echomsg 'check the make variable VIM_CSCOPEFILE and if file exists'
|
||||||
endtry
|
endtry
|
||||||
else
|
else
|
||||||
@ -201,7 +204,7 @@ function s:SetProjectVariables()
|
|||||||
try
|
try
|
||||||
execute 'compiler ' . s:Variables['VIM_COMPILER']
|
execute 'compiler ' . s:Variables['VIM_COMPILER']
|
||||||
catch
|
catch
|
||||||
echoerr 'cant set compiler to ' . s:Variables['VIM_COMPILER']
|
echoerr 'cant set compiler to "' . s:Variables['VIM_COMPILER'] . '"'
|
||||||
echoerr 'check the make variable VIM_COMPILER'
|
echoerr 'check the make variable VIM_COMPILER'
|
||||||
endtry
|
endtry
|
||||||
else
|
else
|
||||||
@ -209,29 +212,30 @@ function s:SetProjectVariables()
|
|||||||
endif
|
endif
|
||||||
|
|
||||||
catch
|
catch
|
||||||
echoerr 'Could not read variables from makefile (vim-script-error)'
|
echoerr 'Error while reading make-variables: ' . v:exception
|
||||||
endtry
|
endtry
|
||||||
|
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
" Get values for a list of variables as dictionary
|
" Get values for a list of variables as dictionary
|
||||||
function! s:GetMakeVars(varNameList)
|
function GetMakeVars(varNameList)
|
||||||
let varlist = {}
|
let varlist = {}
|
||||||
try
|
try
|
||||||
let vars = join(a:varNameList, ' ')
|
let vars = join(a:varNameList, ' ')
|
||||||
let command = g:makefileName . ' getvar name="' . vars . '"'
|
let command = g:makeCommand . ' getvar name="' . vars . '"'
|
||||||
|
"echomsg command
|
||||||
let output = system(command)
|
let output = system(command)
|
||||||
let lines = split(output, "\n")
|
let lines = split(output, "\n")
|
||||||
let RE = '^\(\w\+\)=\(.*\)\s*'
|
let RE = '^\(\w\+\)=\(.*\)\s*'
|
||||||
let SU = "let varlist['\\1']='\\2'"
|
let SU = "let varlist['\\1']='\\2'"
|
||||||
"echo 'getvars:'
|
"echomsg 'getvars:'
|
||||||
for line in lines
|
for line in lines
|
||||||
" echo line
|
"echomsg line
|
||||||
if match(line, RE) >= 0
|
if match(line, RE) >= 0
|
||||||
execute substitute(line, RE, SU, '')
|
execute substitute(line, RE, SU, '')
|
||||||
endif
|
endif
|
||||||
endfor
|
endfor
|
||||||
"echo ''
|
"echomsg ''
|
||||||
catch
|
catch
|
||||||
echoerr 'Could not read make variables'
|
echoerr 'Could not read make variables'
|
||||||
endtry
|
endtry
|
||||||
@ -248,6 +252,17 @@ function! s:GetMakeVars(varNameList)
|
|||||||
return varlist
|
return varlist
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
function GetMakeVar(varName)
|
||||||
|
let var = GetMakeVars([a:varName])
|
||||||
|
try
|
||||||
|
varValue = var[a:varName]
|
||||||
|
catch
|
||||||
|
varValue = ''
|
||||||
|
echoerr 'Could not read make-variable "' . varName . '"'
|
||||||
|
endtry
|
||||||
|
return varValue
|
||||||
|
endfunction
|
||||||
|
|
||||||
" ------------------------------------------
|
" ------------------------------------------
|
||||||
" special make-command for target-completion
|
" special make-command for target-completion
|
||||||
" ------------------------------------------
|
" ------------------------------------------
|
||||||
|
Loading…
x
Reference in New Issue
Block a user