1125
|
1 "------------------------------------------------------------------------------
|
|
2 " Description: Vim Ada/GNAT compiler file
|
|
3 " Language: Ada (GNAT)
|
2034
|
4 " $Id: gnat.vim 887 2008-07-08 14:29:01Z krischik $
|
1125
|
5 " Copyright: Copyright (C) 2006 Martin Krischik
|
1668
|
6 " Maintainer: Martin Krischi <krischik@users.sourceforge.net>k
|
|
7 " Ned Okie <nokie@radford.edu>
|
2034
|
8 " $Author: krischik $
|
|
9 " $Date: 2008-07-08 16:29:01 +0200 (Di, 08 Jul 2008) $
|
1668
|
10 " Version: 4.6
|
2034
|
11 " $Revision: 887 $
|
1668
|
12 " $HeadURL: https://gnuada.svn.sourceforge.net/svnroot/gnuada/trunk/tools/vim/autoload/gnat.vim $
|
1125
|
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
|
1668
|
20 " 19.09.2007 NO use project file only when there is a project
|
1125
|
21 " Help Page: compiler-gnat
|
|
22 "------------------------------------------------------------------------------
|
|
23
|
|
24 if version < 700
|
|
25 finish
|
|
26 endif
|
|
27
|
|
28 function gnat#Make () dict " {{{1
|
|
29 let &l:makeprg = self.Get_Command('Make')
|
|
30 let &l:errorformat = self.Error_Format
|
|
31 wall
|
|
32 make
|
|
33 copen
|
|
34 set wrap
|
|
35 wincmd W
|
|
36 endfunction gnat#Make " }}}1
|
|
37
|
|
38 function gnat#Pretty () dict " {{{1
|
|
39 execute "!" . self.Get_Command('Pretty')
|
|
40 endfunction gnat#Make " }}}1
|
|
41
|
|
42 function gnat#Find () dict " {{{1
|
|
43 execute "!" . self.Get_Command('Find')
|
|
44 endfunction gnat#Find " }}}1
|
|
45
|
|
46 function gnat#Tags () dict " {{{1
|
|
47 execute "!" . self.Get_Command('Tags')
|
|
48 edit tags
|
|
49 call gnat#Insert_Tags_Header ()
|
|
50 update
|
|
51 quit
|
|
52 endfunction gnat#Tags " }}}1
|
|
53
|
|
54 function gnat#Set_Project_File (...) dict " {{{1
|
|
55 if a:0 > 0
|
|
56 let self.Project_File = a:1
|
|
57
|
|
58 if ! filereadable (self.Project_File)
|
|
59 let self.Project_File = findfile (
|
|
60 \ fnamemodify (self.Project_File, ':r'),
|
|
61 \ $ADA_PROJECT_PATH,
|
|
62 \ 1)
|
|
63 endif
|
|
64 elseif strlen (self.Project_File) > 0
|
|
65 let self.Project_File = browse (0, 'GNAT Project File?', '', self.Project_File)
|
|
66 elseif expand ("%:e") == 'gpr'
|
|
67 let self.Project_File = browse (0, 'GNAT Project File?', '', expand ("%:e"))
|
|
68 else
|
|
69 let self.Project_File = browse (0, 'GNAT Project File?', '', 'default.gpr')
|
|
70 endif
|
|
71
|
|
72 if strlen (v:this_session) > 0
|
|
73 execute 'mksession! ' . v:this_session
|
|
74 endif
|
|
75
|
1668
|
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
|
1125
|
89
|
|
90 return
|
|
91 endfunction gnat#Set_Project_File " }}}1
|
|
92
|
|
93 function gnat#Get_Command (Command) dict " {{{1
|
|
94 let l:Command = eval ('self.' . a:Command . '_Command')
|
|
95 return eval (l:Command)
|
|
96 endfunction gnat#Get_Command " }}}1
|
|
97
|
|
98 function gnat#Set_Session (...) dict " {{{1
|
|
99 if argc() == 1 && fnamemodify (argv(0), ':e') == 'gpr'
|
|
100 call self.Set_Project_File (argv(0))
|
|
101 elseif strlen (v:servername) > 0
|
|
102 call self.Set_Project_File (v:servername . '.gpr')
|
|
103 endif
|
|
104 endfunction gnat#Set_Session " }}}1
|
|
105
|
|
106 function gnat#New () " {{{1
|
|
107 let 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
|
|
124 return l:Retval
|
|
125 endfunction gnat#New " }}}1
|
|
126
|
|
127 function gnat#Insert_Tags_Header () " {{{1
|
|
128 1insert
|
|
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 .
|
|
136 return
|
|
137 endfunction gnat#Insert_Tags_Header " }}}1
|
|
138
|
|
139 finish " 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
|