annotate runtime/autoload/gnat.vim @ 22298:07e48ee8c3bb v8.2.1698

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