robin/laufey
git clone https://git.robinwobin.dev/robin/laufey
db210dd2a4
master
1"------------------------------------------------------------------------------ 2" Description: Vim Ada/GNAT compiler file 3" Language: Ada (GNAT) 4" $Id: gnat.vim 887 2008-07-08 14:29:01Z krischik $ 5" Copyright: Copyright (C) 2006 Martin Krischik 6" Maintainer: Martin Krischi <krischik@users.sourceforge.net> 7" Ned Okie <nokie@radford.edu> 8" $Author: krischik $ 9" $Date: 2008-07-08 16:29:01 +0200 (Di, 08 Jul 2008) $ 10" Version: 4.6 11" $Revision: 887 $ 12" $HeadURL: https://gnuada.svn.sourceforge.net/svnroot/gnuada/trunk/tools/vim/autoload/gnat.vim $ 13" History: 24.05.2006 MK Unified Headers 14" 16.07.2006 MK Ada-Mode as vim-ball 15" 05.08.2006 MK Add session support 16" 15.10.2006 MK Bram's suggestion for runtime integration 17" 05.11.2006 MK Bram suggested not to use include protection for 18" autoload 19" 05.11.2006 MK Bram suggested to save on spaces 20" 19.09.2007 NO use project file only when there is a project 21" Help Page: compiler-gnat 22"------------------------------------------------------------------------------ 23 24if version < 700 25finish 26endif 27 28function gnat#Make () dict" {{{1 29let & l: makeprg = self . Get_Command ( 'Make' ) 30let & l: errorformat = self . Error_Format 31wall 32make 33copen 34set wrap 35wincmd W 36endfunction gnat#Make " }}}1 37 38function gnat#Pretty () dict" {{{1 39execute "!" . self . Get_Command ( 'Pretty' ) 40endfunction gnat#Make " }}}1 41 42function gnat#Find () dict" {{{1 43execute "!" . self . Get_Command ( 'Find' ) 44endfunction gnat#Find " }}}1 45 46function gnat#Tags () dict" {{{1 47execute "!" . self . Get_Command ( 'Tags' ) 48edit tags 49call gnat#Insert_Tags_Header () 50update 51quit 52endfunction gnat#Tags " }}}1 53 54function gnat#Set_Project_File (...) dict" {{{1 55if a: 0 > 0 56let self . Project_File = a: 1 57 58if ! filereadable ( self . Project_File ) 59let self . Project_File = findfile ( 60 \fnamemodify ( self . Project_File , ':r' ), 61 \$ ADA_PROJECT_PATH , 62 \1 ) 63endif 64elseif strlen ( self . Project_File ) > 0 65let self . Project_File = browse ( 0 , 'GNAT Project File?' , '' , self . Project_File ) 66elseif expand ( "%:e" ) == 'gpr' 67let self . Project_File = browse ( 0 , 'GNAT Project File?' , '' , expand ( "%:e" )) 68else 69let self . Project_File = browse ( 0 , 'GNAT Project File?' , '' , 'default.gpr' ) 70endif 71 72if strlen ( v: this_session ) > 0 73execute 'mksession! ' . v: this_session 74endif 75 76"if strlen (self.Project_File) > 0 77"if has("vms") 78"call ada#Switch_Session ( 79"\ expand('~')[0:-2] . ".vimfiles.session]gnat_" . 80"\ fnamemodify (self.Project_File, ":t:r") . ".vim") 81"else 82"call ada#Switch_Session ( 83"\ expand('~') . "/vimfiles/session/gnat_" . 84"\ fnamemodify (self.Project_File, ":t:r") . ".vim") 85"endif 86"else 87"call ada#Switch_Session ('') 88"endif 89 90return 91endfunction gnat#Set_Project_File " }}}1 92 93function gnat#Get_Command ( Command ) dict" {{{1 94let l: Command = eval ( 'self.' . a: Command . '_Command' ) 95return eval ( l: Command ) 96endfunction gnat#Get_Command " }}}1 97 98function gnat#Set_Session (...) dict" {{{1 99if argc () == 1 && fnamemodify ( argv ( 0 ), ':e' ) == 'gpr' 100call self . Set_Project_File ( argv ( 0 )) 101elseif strlen ( v: servername ) > 0 102call self . Set_Project_File ( v: servername . '.gpr' ) 103endif 104endfunction gnat#Set_Session " }}}1 105 106function gnat#New () " {{{1 107let l: Retval = { 108 \'Make' : function ( 'gnat#Make' ), 109 \'Pretty' : function ( 'gnat#Pretty' ), 110 \'Find' : function ( 'gnat#Find' ), 111 \'Tags' : function ( 'gnat#Tags' ), 112 \'Set_Project_File' : function ( 'gnat#Set_Project_File' ), 113 \'Set_Session' : function ( 'gnat#Set_Session' ), 114 \'Get_Command' : function ( 'gnat#Get_Command' ), 115 \'Project_File' : '' , 116 \'Make_Command' : '"gnat make -P " . self.Project_File . " -F -gnatef "' , 117 \'Pretty_Command' : '"gnat pretty -P " . self.Project_File . " "' , 118 \'Find_Program' : '"gnat find -P " . self.Project_File . " -F "' , 119 \'Tags_Command' : '"gnat xref -P " . self.Project_File . " -v *.AD*"' , 120 \'Error_Format' : '%f:%l:%c: %trror: %m,' . 121 \'%f:%l:%c: %tarning: %m,' . 122 \'%f:%l:%c: (%ttyle) %m' } 123 124return l: Retval 125endfunction gnat#New " }}}1 126 127function gnat#Insert_Tags_Header () " {{{1 1281 insert 129! _TAG_FILE_FORMAT 1 /extended format; --format=1 will not append ; " to lines/ 130! _TAG_FILE_SORTED 1 /0=unsorted, 1=sorted, 2=foldcase/ 131! _TAG_PROGRAM_AUTHOR AdaCore /info@adacore.com/ 132! _TAG_PROGRAM_NAME gnatxref // 133! _TAG_PROGRAM_URL http://www.adacore.com /official site/ 134! _TAG_PROGRAM_VERSION 5.05w // 135. 136return 137endfunction gnat#Insert_Tags_Header " }}}1 138 139finish " 1}}} 140 141"------------------------------------------------------------------------------ 142" Copyright (C) 2006 Martin Krischik 143" 144" Vim is Charityware - see ":help license" or uganda.txt for licence details. 145"------------------------------------------------------------------------------ 146" vim: textwidth=0 wrap tabstop=8 shiftwidth=3 softtabstop=3 noexpandtab 147" vim: foldmethod=marker