fix GetOsp...()

Change-Id: Ib88f893ca9ff75153f5baf07edcb15c3d57fbe41
This commit is contained in:
Stefan Liebl 2015-03-25 16:28:50 +01:00
parent 0386b90ac5
commit e2ec08ef7c
7 changed files with 38 additions and 66 deletions

View File

@ -227,17 +227,20 @@ function s:GetPolynom(umrechnung)
if XmlTag['Attributes']['Value'] == a:umrechnung if XmlTag['Attributes']['Value'] == a:umrechnung
let elements = XmlTag['Elements'] let elements = XmlTag['Elements']
for element in elements for element in elements
let name = element['Name'] if type(element) == 4
if name == 'Mas' let name = element['Name']
let umr['Mas'] = element['Elements'][0] if name == 'Mas'
else let umr['Mas'] = element['Elements'][0]
let nr = substitute(name, 'P\(\d\)', '\1', '')
if nr != name
let p[str2nr(nr)] = element['Elements'][0]
else else
echoerr 'Unknown attribute' name let nr = substitute(name, 'P\(\d\)', '\1', '')
if nr != name
let p[str2nr(nr)] = element['Elements'][0]
else
echoerr 'Unknown attribute' name
endif
endif endif
endif endif
unlet element
endfor endfor
else else
echoerr 'Error: Wrong conversion' XmlTag['Attributes']['n'] echoerr 'Error: Wrong conversion' XmlTag['Attributes']['n']

View File

@ -56,7 +56,7 @@ syntax keyword kgsKomponents unwirksamkeitswert
syntax keyword kgsKomponents deutsch syntax keyword kgsKomponents deutsch
syntax keyword kgsDeprecated min_w min_x min_y max_w max_x max_y init_wert test_wert syntax keyword kgsDeprecated min_w min_x min_y max_w max_x max_y init_wert test_wert
syntax keyword kgsDeprecated test_stuetzstellen_x test_stuetzstellen_y syntax keyword kgsDeprecated test_stuetzstellen_x test_stuetzstellen_y
syntax keyword kgsDeprecated kopfdaten_applizierbar unwirksamkeitswert syntax keyword kgsDeprecated kopfdaten_applizierbar
highlight def link kgsFunctions Function highlight def link kgsFunctions Function

View File

@ -68,7 +68,7 @@ endfunction
"command -nargs=1 PathNormpath call PathNormpath('<fargs>') "command -nargs=1 PathNormpath call PathNormpath('<fargs>')
"function PathNormpath(string) "function PathNormpath(string)
" if (v:version > 602) " if has('python')
" try " try
"python <<EOF "python <<EOF
"import vim "import vim
@ -107,7 +107,7 @@ function Double_quote(text)
endfunction endfunction
function Eval(expression) function Eval(expression)
if (v:version > 602) if has('python')
try try
python <<EOF python <<EOF
import vim import vim
@ -120,14 +120,13 @@ EOF
let result = a:expression let result = a:expression
endtry endtry
else else
echoerr 'Eval needs python' let result = eval(a:expression)
let result = a:expression
endif endif
return result return result
endfunction endfunction
function ToInt(expression) function ToInt(expression)
if (v:version > 602) if has('python')
try try
let expression = substitute(a:expression, '\.\d\+', '', '') let expression = substitute(a:expression, '\.\d\+', '', '')
python <<EOF python <<EOF
@ -141,14 +140,13 @@ EOF
let result = a:expression let result = a:expression
endtry endtry
else else
echoerr 'ToInt needs python' let result = float2nr(a:expression)
let result = a:expression
endif endif
return result return result
endfunction endfunction
function ToHex(expression, bits) function ToHex(expression, bits)
if (v:version > 602) if has('python')
try try
let expression = substitute(a:expression, 'L', '', '') let expression = substitute(a:expression, 'L', '', '')
python <<EOF python <<EOF
@ -157,18 +155,17 @@ result = hex(long(int(vim.eval('expression'))))
#print 'result: ', result #print 'result: ', result
vim.command('let result = \"' + result + '\"') vim.command('let result = \"' + result + '\"')
EOF EOF
if (a:bits != 0)
let digits = a:bits / 4
let result = substitute(result, '\(0x\)\x*\(\x\{' . digits . '}\>\)', '\1\2', '')
"echo 'result:'.result.':'. a:bits digits
endif
catch /^Vim\%((\a\+)\)\=:E370/ " python not available catch /^Vim\%((\a\+)\)\=:E370/ " python not available
throw 'ToHex needs python' throw 'ToHex needs python'
let result = a:expression let result = a:expression
endtry endtry
else else
echoerr 'ToHex needs python' let result = printf('%x', a:expression)
let result = a:expression endif
if (a:bits != 0)
let digits = a:bits / 4
let result = substitute(result, '\(0x\)\x*\(\x\{' . digits . '}\>\)', '\1\2', '')
"echo 'result:'.result.':'. a:bits digits
endif endif
return result return result
endfunction endfunction

View File

@ -17,18 +17,23 @@ if exists('g:pythonPath')
else else
" pythonPath zum Suchpfad hinzufügen " pythonPath zum Suchpfad hinzufügen
let PATH = $PATH let PATH = $PATH
if (match(PATH, '\c' . escape(g:pythonPath, '\')) >= 0) let paths = split(tolower(PATH), ';')
if ( count(paths, tolower(g:pythonPath)) > 0)
" ist schon drin, abbrechen " ist schon drin, abbrechen
echo 'kein python.exe in g:pythonPath=' . g:pythonPath . ' gefunden' echo 'kein python.exe in g:pythonPath=' . g:pythonPath . ' gefunden'
finish finish
else else
" andere Python Verzeichnisse aus PATH löschen
" for p in paths
" if (match(p, 'python') >= 0)
" call remove(paths, index(paths, p))
" endif
" endfor
" bei Bedarf ';' an PATH anhängen " bei Bedarf ';' an PATH anhängen
if (match(PATH, ';$') < 0) call add(paths, g:pythonPath)
let PATH = PATH . ';' let PATH = join(paths, ';')
endif echo 'Python = ' . g:pythonPath
let PATH = PATH . g:pythonPath echo 'PATH:' PATH
"echo 'Python = ' . g:pythonPath
"echo 'PATH:' PATH
let $PATH = PATH let $PATH = PATH
endif endif
endif endif
@ -40,8 +45,8 @@ if exists('g:pythonPath')
finish finish
endif endif
let s:pythonLibPath = expand(g:pythonPath . '/lib') " let s:pythonLibPath = expand(g:pythonPath . '/lib')
let s:pythonDllPath = expand(g:pythonPath . '/dlls') " let s:pythonDllPath = expand(g:pythonPath . '/dlls')
endif endif
"try "try

View File

@ -1,11 +0,0 @@
%echo off
set vim=%~dp0..\..\..\vim74\gvim.exe
set base=%1
set mine=%2
set theirs=%3
set merged=%4
if not exist %vim% (
echo gvim.exe nicht gefunden
)
echo %vim% %base% %mine% %theirs% %merged%

View File

@ -1,11 +0,0 @@
%echo off
set vim=%~dp0..\..\..\vim74\gvim.exe
set base=%1
set mine=%2
set theirs=%3
set merged=%4
if not exist %vim% (
echo gvim.exe nicht gefunden
)
echo %vim% %base% %mine% %theirs% %merged%

View File

@ -1,11 +0,0 @@
%echo off
set vim=%~dp0..\..\..\vim74\gvim.exe
set base=%1
set mine=%2
set theirs=%3
set merged=%4
if not exist %vim% (
echo gvim.exe nicht gefunden
)
echo %vim% %base% %mine% %theirs% %merged%