annotate runtime/autoload/gnat.vim @ 1484:fd68db1a72b5 v7.1.199

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