annotate lisp/progmodes/ada-stmt.el @ 112319:9f1234368955

* .bzrignore: Add .h files that are host-dependent. Add lib/.deps/, lib/arg-nonnull.h, lib/c++defs.h, lib/getopt.h, lib/time.h, lib/unistd.h, lib/warn-on-use.h. These are host-dependent and are built as part of an ordinary 'make', and should not be checked in.
author Paul Eggert <eggert@cs.ucla.edu>
date Sun, 09 Jan 2011 00:30:09 -0800
parents 280c8ae2476d
children 417b1e4d63cd
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
38422
7a94f1c588c4 Some fixes to follow coding conventions.
Pavel Janík <Pavel@Janik.cz>
parents: 34400
diff changeset
1 ;;; ada-stmt.el --- an extension to Ada mode for inserting statement templates
23868
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
2
75347
e3694f1cb928 Add 2007 to copyright years.
Glenn Morris <rgm@gnu.org>
parents: 73933
diff changeset
3 ;; Copyright (C) 1987, 1993, 1994, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
106815
1d1d5d9bd884 Add 2010 to copyright years.
Glenn Morris <rgm@gnu.org>
parents: 101087
diff changeset
4 ;; 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010
101087
ffd82d2cb8ec Comments (minor fixes of some header conventions).
Glenn Morris <rgm@gnu.org>
parents: 100908
diff changeset
5 ;; Free Software Foundation, Inc.
23868
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
6
101087
ffd82d2cb8ec Comments (minor fixes of some header conventions).
Glenn Morris <rgm@gnu.org>
parents: 100908
diff changeset
7 ;; Authors: Daniel Pfeiffer
ffd82d2cb8ec Comments (minor fixes of some header conventions).
Glenn Morris <rgm@gnu.org>
parents: 100908
diff changeset
8 ;; Markus Heritsch
ffd82d2cb8ec Comments (minor fixes of some header conventions).
Glenn Morris <rgm@gnu.org>
parents: 100908
diff changeset
9 ;; Rolf Ebert <ebert@waporo.muc.de>
73564
0058ef19e376 Change maintainer, apply whitespace-cleanup, checkdoc.
Juanma Barranquero <lekktu@gmail.com>
parents: 68773
diff changeset
10 ;; Maintainer: Stephen Leake <stephen_leake@stephe-leake.org>
23868
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
11 ;; Keywords: languages, ada
110015
280c8ae2476d Add "Package:" file headers to denote built-in packages.
Chong Yidong <cyd@stupidchicken.com>
parents: 106840
diff changeset
12 ;; Package: ada-mode
23868
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
13
78233
b6205894fe69 Add missing license notice (GPLv3 or later).
Glenn Morris <rgm@gnu.org>
parents: 75347
diff changeset
14 ;; This file is part of GNU Emacs.
b6205894fe69 Add missing license notice (GPLv3 or later).
Glenn Morris <rgm@gnu.org>
parents: 75347
diff changeset
15
94673
52b7a8c22af5 Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents: 93975
diff changeset
16 ;; GNU Emacs is free software: you can redistribute it and/or modify
78233
b6205894fe69 Add missing license notice (GPLv3 or later).
Glenn Morris <rgm@gnu.org>
parents: 75347
diff changeset
17 ;; it under the terms of the GNU General Public License as published by
94673
52b7a8c22af5 Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents: 93975
diff changeset
18 ;; the Free Software Foundation, either version 3 of the License, or
52b7a8c22af5 Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents: 93975
diff changeset
19 ;; (at your option) any later version.
78233
b6205894fe69 Add missing license notice (GPLv3 or later).
Glenn Morris <rgm@gnu.org>
parents: 75347
diff changeset
20
b6205894fe69 Add missing license notice (GPLv3 or later).
Glenn Morris <rgm@gnu.org>
parents: 75347
diff changeset
21 ;; GNU Emacs is distributed in the hope that it will be useful,
b6205894fe69 Add missing license notice (GPLv3 or later).
Glenn Morris <rgm@gnu.org>
parents: 75347
diff changeset
22 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
b6205894fe69 Add missing license notice (GPLv3 or later).
Glenn Morris <rgm@gnu.org>
parents: 75347
diff changeset
23 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
b6205894fe69 Add missing license notice (GPLv3 or later).
Glenn Morris <rgm@gnu.org>
parents: 75347
diff changeset
24 ;; GNU General Public License for more details.
b6205894fe69 Add missing license notice (GPLv3 or later).
Glenn Morris <rgm@gnu.org>
parents: 75347
diff changeset
25
b6205894fe69 Add missing license notice (GPLv3 or later).
Glenn Morris <rgm@gnu.org>
parents: 75347
diff changeset
26 ;; You should have received a copy of the GNU General Public License
94673
52b7a8c22af5 Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents: 93975
diff changeset
27 ;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
78233
b6205894fe69 Add missing license notice (GPLv3 or later).
Glenn Morris <rgm@gnu.org>
parents: 75347
diff changeset
28
23868
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
29 ;;; Commentary:
44467
e34b692b2fa9 Menu changed from Statements to Templates.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 38422
diff changeset
30 ;; This file is now automatically loaded from ada-mode.el, and creates a submenu
e34b692b2fa9 Menu changed from Statements to Templates.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 38422
diff changeset
31 ;; in Ada/ on the menu bar.
23868
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
32
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
33 ;;; History:
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
34
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
35 ;; Created May 1987.
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
36 ;; Original version from V. Bowman as in ada.el of Emacs-18
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
37 ;; (borrowed heavily from Mick Jordan's Modula-2 package for GNU,
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
38 ;; as modified by Peter Robinson, Michael Schmidt, and Tom Perrine.)
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
39 ;;
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
40 ;; Sep 1993. Daniel Pfeiffer <pfeiffer@cict.fr> (DP)
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
41 ;; Introduced statement.el for smaller code and user configurability.
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
42 ;;
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
43 ;; Nov 1993. Rolf Ebert <ebert@enpc.fr> (RE) Moved the
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
44 ;; skeleton generation into this separate file. The code still is
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
45 ;; essentially written by DP
49598
0d8b17d428b5 Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 47744
diff changeset
46 ;;
23868
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
47 ;; Adapted Jun 1994. Markus Heritsch
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
48 ;; <Markus.Heritsch@studbox.uni-stuttgart.de> (MH)
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
49 ;; added menu bar support for templates
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
50 ;;
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
51 ;; 1994/12/02 Christian Egli <cegli@hcsd.hac.com>
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
52 ;; General cleanup and bug fixes.
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
53 ;;
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
54 ;; 1995/12/20 John Hutchison <hutchiso@epi.syr.ge.com>
26226
b63d041c9108 Changed format of years in copyright notices.
Gerd Moellmann <gerd@gnu.org>
parents: 26000
diff changeset
55 ;; made it work with skeleton.el from Emacs-19.30. Several
23868
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
56 ;; enhancements and bug fixes.
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
57
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
58 ;; BUGS:
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
59 ;;;> I have the following suggestions for the function template: 1) I
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
60 ;;;> don't want it automatically assigning it a name for the return variable. I
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
61 ;;;> never want it to be called "Result" because that is nondescriptive. If you
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
62 ;;;> must define a variable, give me the ability to specify its name.
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
63 ;;;>
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
64 ;;;> 2) You do not provide a type for variable 'Result'. Its type is the same
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
65 ;;;> as the function's return type, which the template knows, so why force me
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
66 ;;;> to type it in?
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
67 ;;;>
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
68
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
69 ;;;It would be nice if one could configure such layout details separately
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
70 ;;;without patching the LISP code. Maybe the metalanguage used in ada-stmt.el
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
71 ;;;could be taken even further, providing the user with some nice syntax
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
72 ;;;for describing layout. Then my own hacks would survive the next
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
73 ;;;update of the package :-)
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
74
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
75
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
76 ;;; Code:
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
77
50812
15929fed5553 (ada-xemacs): Variable removed, since it's better to use (featurep 'xemacs).
Juanma Barranquero <lekktu@gmail.com>
parents: 50739
diff changeset
78 (require 'skeleton nil t)
23868
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
79 (require 'easymenu)
50812
15929fed5553 (ada-xemacs): Variable removed, since it's better to use (featurep 'xemacs).
Juanma Barranquero <lekktu@gmail.com>
parents: 50739
diff changeset
80 (require 'ada-mode)
23868
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
81
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
82 (defun ada-func-or-proc-name ()
73564
0058ef19e376 Change maintainer, apply whitespace-cleanup, checkdoc.
Juanma Barranquero <lekktu@gmail.com>
parents: 68773
diff changeset
83 "Return the name of the current function or procedure."
23868
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
84 (save-excursion
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
85 (let ((case-fold-search t))
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
86 (if (re-search-backward ada-procedure-start-regexp nil t)
73933
f047602e0a17 (ada-func-or-proc-name): Match changes to ada-procedure-start-regexp.
Juanma Barranquero <lekktu@gmail.com>
parents: 73564
diff changeset
87 (match-string 5)
23868
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
88 "NAME?"))))
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
89
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
90 ;;; ---- statement skeletons ------------------------------------------
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
91
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
92 (define-skeleton ada-array
26000
c9e91fc553e6 Doc-string fixes.
Gerd Moellmann <gerd@gnu.org>
parents: 25902
diff changeset
93 "Insert array type definition.
26226
b63d041c9108 Changed format of years in copyright notices.
Gerd Moellmann <gerd@gnu.org>
parents: 26000
diff changeset
94 Prompt for component type and index subtypes."
23868
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
95 ()
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
96 "array (" ("index definition: " str ", " ) -2 ") of " _ ?\;)
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
97
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
98
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
99 (define-skeleton ada-case
26000
c9e91fc553e6 Doc-string fixes.
Gerd Moellmann <gerd@gnu.org>
parents: 25902
diff changeset
100 "Build skeleton case statement.
97078
2f3e251c6e3c Typo fixes for Ada mode.
Juanma Barranquero <lekktu@gmail.com>
parents: 94673
diff changeset
101 Prompt for the selector expression. Also builds the first when clause."
23868
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
102 "[selector expression]: "
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
103 "case " str " is" \n
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
104 > "when " ("discrete choice: " str " | ") -3 " =>" \n
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
105 > _ \n
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
106 < < "end case;")
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
107
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
108
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
109 (define-skeleton ada-when
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
110 "Start a case statement alternative with a when clause."
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
111 ()
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
112 < "when " ("discrete choice: " str " | ") -3 " =>" \n
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
113 >)
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
114
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
115
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
116 (define-skeleton ada-declare-block
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
117 "Insert a block with a declare part.
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
118 Indent for the first declaration."
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
119 "[block name]: "
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
120 < str & ?: & \n
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
121 > "declare" \n
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
122 > _ \n
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
123 < "begin" \n
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
124 > \n
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
125 < "end " str | -1 ?\;)
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
126
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
127
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
128 (define-skeleton ada-exception-block
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
129 "Insert a block with an exception part.
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
130 Indent for the first line of code."
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
131 "[block name]: "
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
132 < str & ?: & \n
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
133 > "begin" \n
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
134 > _ \n
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
135 < "exception" \n
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
136 > \n
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
137 < "end " str | -1 ?\;)
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
138
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
139
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
140 (define-skeleton ada-exception
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
141 "Insert an indented exception part into a block."
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
142 ()
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
143 < "exception" \n
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
144 >)
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
145
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
146
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
147 (define-skeleton ada-exit-1
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
148 "Insert then exit condition of the exit statement, prompting for condition."
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
149 "[exit condition]: "
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
150 "when " str | -5)
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
151
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
152
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
153 (define-skeleton ada-exit
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
154 "Insert an exit statement, prompting for loop name and condition."
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
155 "[name of loop to exit]: "
44467
e34b692b2fa9 Menu changed from Statements to Templates.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 38422
diff changeset
156 "exit " str & ?\ (ada-exit-1) | -1 ?\;)
23868
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
157
25902
92828b88cfcc (ada-stmt-add-to-ada-menu): New function
Gerd Moellmann <gerd@gnu.org>
parents: 23869
diff changeset
158 ;;;###autoload
23868
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
159 (defun ada-header ()
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
160 "Insert a descriptive header at the top of the file."
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
161 (interactive "*")
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
162 (save-excursion
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
163 (goto-char (point-min))
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
164 (if (fboundp 'make-header)
30409
a530830f8a3d (ada-stmt-add-to-ada-menu): Hide the menu if not in
Gerd Moellmann <gerd@gnu.org>
parents: 26226
diff changeset
165 (funcall (symbol-function 'make-header))
23868
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
166 (ada-header-tmpl))))
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
167
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
168
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
169 (define-skeleton ada-header-tmpl
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
170 "Insert a comment block containing the module title, author, etc."
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
171 "[Description]: "
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
172 "-- -*- Mode: Ada -*-"
30409
a530830f8a3d (ada-stmt-add-to-ada-menu): Hide the menu if not in
Gerd Moellmann <gerd@gnu.org>
parents: 26226
diff changeset
173 "\n" ada-fill-comment-prefix "Filename : " (buffer-name)
a530830f8a3d (ada-stmt-add-to-ada-menu): Hide the menu if not in
Gerd Moellmann <gerd@gnu.org>
parents: 26226
diff changeset
174 "\n" ada-fill-comment-prefix "Description : " str
33823
d29063c1c480 (ada-template-map): Initialize and bind it to C-c t in ada-mode-map.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 32301
diff changeset
175 "\n" ada-fill-comment-prefix "Author : " (user-full-name)
30409
a530830f8a3d (ada-stmt-add-to-ada-menu): Hide the menu if not in
Gerd Moellmann <gerd@gnu.org>
parents: 26226
diff changeset
176 "\n" ada-fill-comment-prefix "Created On : " (current-time-string)
a530830f8a3d (ada-stmt-add-to-ada-menu): Hide the menu if not in
Gerd Moellmann <gerd@gnu.org>
parents: 26226
diff changeset
177 "\n" ada-fill-comment-prefix "Last Modified By: ."
a530830f8a3d (ada-stmt-add-to-ada-menu): Hide the menu if not in
Gerd Moellmann <gerd@gnu.org>
parents: 26226
diff changeset
178 "\n" ada-fill-comment-prefix "Last Modified On: ."
a530830f8a3d (ada-stmt-add-to-ada-menu): Hide the menu if not in
Gerd Moellmann <gerd@gnu.org>
parents: 26226
diff changeset
179 "\n" ada-fill-comment-prefix "Update Count : 0"
a530830f8a3d (ada-stmt-add-to-ada-menu): Hide the menu if not in
Gerd Moellmann <gerd@gnu.org>
parents: 26226
diff changeset
180 "\n" ada-fill-comment-prefix "Status : Unknown, Use with caution!"
23868
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
181 "\n")
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
182
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
183
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
184 (define-skeleton ada-display-comment
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
185 "Inserts three comment lines, making a display comment."
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
186 ()
30409
a530830f8a3d (ada-stmt-add-to-ada-menu): Hide the menu if not in
Gerd Moellmann <gerd@gnu.org>
parents: 26226
diff changeset
187 "--\n" ada-fill-comment-prefix _ "\n--")
23868
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
188
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
189
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
190 (define-skeleton ada-if
106840
5df8e547a422 Fix typos in docstrings.
Juanma Barranquero <lekktu@gmail.com>
parents: 106815
diff changeset
191 "Insert skeleton if statement, prompting for a boolean-expression."
23868
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
192 "[condition]: "
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
193 "if " str " then" \n
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
194 > _ \n
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
195 < "end if;")
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
196
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
197
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
198 (define-skeleton ada-elsif
33823
d29063c1c480 (ada-template-map): Initialize and bind it to C-c t in ada-mode-map.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 32301
diff changeset
199 "Add an elsif clause to an if statement,
23868
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
200 prompting for the boolean-expression."
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
201 "[condition]: "
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
202 < "elsif " str " then" \n
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
203 >)
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
204
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
205
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
206 (define-skeleton ada-else
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
207 "Add an else clause inside an if-then-end-if clause."
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
208 ()
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
209 < "else" \n
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
210 >)
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
211
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
212
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
213 (define-skeleton ada-loop
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
214 "Insert a skeleton loop statement. The exit statement is added by hand."
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
215 "[loop name]: "
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
216 < str & ?: & \n
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
217 > "loop" \n
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
218 > _ \n
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
219 < "end loop " str | -1 ?\;)
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
220
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
221
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
222 (define-skeleton ada-for-loop-prompt-variable
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
223 "Prompt for the loop variable."
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
224 "[loop variable]: "
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
225 str)
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
226
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
227
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
228 (define-skeleton ada-for-loop-prompt-range
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
229 "Prompt for the loop range."
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
230 "[loop range]: "
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
231 str)
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
232
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
233
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
234 (define-skeleton ada-for-loop
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
235 "Build a skeleton for-loop statement, prompting for the loop parameters."
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
236 "[loop name]: "
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
237 < str & ?: & \n
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
238 > "for "
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
239 (ada-for-loop-prompt-variable)
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
240 " in "
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
241 (ada-for-loop-prompt-range)
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
242 " loop" \n
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
243 > _ \n
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
244 < "end loop " str | -1 ?\;)
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
245
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
246
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
247 (define-skeleton ada-while-loop-prompt-entry-condition
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
248 "Prompt for the loop entry condition."
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
249 "[entry condition]: "
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
250 str)
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
251
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
252
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
253 (define-skeleton ada-while-loop
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
254 "Insert a skeleton while loop statement."
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
255 "[loop name]: "
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
256 < str & ?: & \n
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
257 > "while "
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
258 (ada-while-loop-prompt-entry-condition)
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
259 " loop" \n
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
260 > _ \n
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
261 < "end loop " str | -1 ?\;)
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
262
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
263
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
264 (define-skeleton ada-package-spec
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
265 "Insert a skeleton package specification."
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
266 "[package name]: "
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
267 "package " str " is" \n
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
268 > _ \n
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
269 < "end " str ?\;)
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
270
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
271
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
272 (define-skeleton ada-package-body
97078
2f3e251c6e3c Typo fixes for Ada mode.
Juanma Barranquero <lekktu@gmail.com>
parents: 94673
diff changeset
273 "Insert a skeleton package body -- includes a begin statement."
23868
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
274 "[package name]: "
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
275 "package body " str " is" \n
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
276 > _ \n
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
277 ; < "begin" \n
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
278 < "end " str ?\;)
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
279
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
280
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
281 (define-skeleton ada-private
97078
2f3e251c6e3c Typo fixes for Ada mode.
Juanma Barranquero <lekktu@gmail.com>
parents: 94673
diff changeset
282 "Undent and start a private section of a package spec. Reindent."
23868
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
283 ()
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
284 < "private" \n
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
285 >)
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
286
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
287
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
288 (define-skeleton ada-function-spec-prompt-return
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
289 "Prompts for function result type."
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
290 "[result type]: "
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
291 str)
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
292
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
293
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
294 (define-skeleton ada-function-spec
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
295 "Insert a function specification. Prompts for name and arguments."
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
296 "[function name]: "
33823
d29063c1c480 (ada-template-map): Initialize and bind it to C-c t in ada-mode-map.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 32301
diff changeset
297 "function " str
23868
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
298 " (" ("[parameter_specification]: " str "; " ) -2 ")"
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
299 " return "
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
300 (ada-function-spec-prompt-return)
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
301 ";" \n )
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
302
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
303
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
304 (define-skeleton ada-procedure-spec
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
305 "Insert a procedure specification, prompting for its name and arguments."
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
306 "[procedure name]: "
33823
d29063c1c480 (ada-template-map): Initialize and bind it to C-c t in ada-mode-map.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 32301
diff changeset
307 "procedure " str
23868
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
308 " (" ("[parameter_specification]: " str "; " ) -2 ")"
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
309 ";" \n )
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
310
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
311
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
312 (define-skeleton ada-subprogram-body
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
313 "Insert frame for subprogram body.
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
314 Invoke right after `ada-function-spec' or `ada-procedure-spec'."
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
315 ()
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
316 ;; Remove `;' from subprogram decl
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
317 (save-excursion
25902
92828b88cfcc (ada-stmt-add-to-ada-menu): New function
Gerd Moellmann <gerd@gnu.org>
parents: 23869
diff changeset
318 (let ((pos (1+ (point))))
92828b88cfcc (ada-stmt-add-to-ada-menu): New function
Gerd Moellmann <gerd@gnu.org>
parents: 23869
diff changeset
319 (ada-search-ignore-string-comment ada-subprog-start-re t nil)
33823
d29063c1c480 (ada-template-map): Initialize and bind it to C-c t in ada-mode-map.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 32301
diff changeset
320 (when (ada-search-ignore-string-comment "(" nil pos t 'search-forward)
d29063c1c480 (ada-template-map): Initialize and bind it to C-c t in ada-mode-map.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 32301
diff changeset
321 (backward-char 1)
d29063c1c480 (ada-template-map): Initialize and bind it to C-c t in ada-mode-map.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 32301
diff changeset
322 (forward-sexp 1)))
23868
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
323 (if (looking-at ";")
73564
0058ef19e376 Change maintainer, apply whitespace-cleanup, checkdoc.
Juanma Barranquero <lekktu@gmail.com>
parents: 68773
diff changeset
324 (delete-char 1)))
25902
92828b88cfcc (ada-stmt-add-to-ada-menu): New function
Gerd Moellmann <gerd@gnu.org>
parents: 23869
diff changeset
325 " is" \n
92828b88cfcc (ada-stmt-add-to-ada-menu): New function
Gerd Moellmann <gerd@gnu.org>
parents: 23869
diff changeset
326 _ \n
92828b88cfcc (ada-stmt-add-to-ada-menu): New function
Gerd Moellmann <gerd@gnu.org>
parents: 23869
diff changeset
327 < "begin" \n
92828b88cfcc (ada-stmt-add-to-ada-menu): New function
Gerd Moellmann <gerd@gnu.org>
parents: 23869
diff changeset
328 \n
92828b88cfcc (ada-stmt-add-to-ada-menu): New function
Gerd Moellmann <gerd@gnu.org>
parents: 23869
diff changeset
329 < "exception" \n
92828b88cfcc (ada-stmt-add-to-ada-menu): New function
Gerd Moellmann <gerd@gnu.org>
parents: 23869
diff changeset
330 "when others => null;" \n
92828b88cfcc (ada-stmt-add-to-ada-menu): New function
Gerd Moellmann <gerd@gnu.org>
parents: 23869
diff changeset
331 < < "end "
23868
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
332 (ada-func-or-proc-name)
25902
92828b88cfcc (ada-stmt-add-to-ada-menu): New function
Gerd Moellmann <gerd@gnu.org>
parents: 23869
diff changeset
333 ";" \n)
23868
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
334
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
335
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
336 (define-skeleton ada-separate
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
337 "Finish a body stub with `separate'."
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
338 ()
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
339 > "separate;" \n
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
340 <)
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
341
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
342
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
343 ;(define-skeleton ada-with
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
344 ; "Inserts a with clause, prompting for the list of units depended upon."
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
345 ; "[list of units depended upon]: "
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
346 ; "with " str ?\;)
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
347
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
348 ;(define-skeleton ada-use
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
349 ; "Inserts a use clause, prompting for the list of packages used."
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
350 ; "[list of packages used]: "
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
351 ; "use " str ?\;)
49598
0d8b17d428b5 Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 47744
diff changeset
352
23868
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
353
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
354 (define-skeleton ada-record
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
355 "Insert a skeleton record type declaration."
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
356 ()
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
357 "record" \n
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
358 > _ \n
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
359 < "end record;")
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
360
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
361
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
362 (define-skeleton ada-subtype
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
363 "Start insertion of a subtype declaration, prompting for the subtype name."
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
364 "[subtype name]: "
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
365 "subtype " str " is " _ ?\;
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
366 (not (message "insert subtype indication.")))
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
367
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
368
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
369 (define-skeleton ada-type
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
370 "Start insertion of a type declaration, prompting for the type name."
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
371 "[type name]: "
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
372 "type " str ?\(
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
373 ("[discriminant specs]: " str " ")
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
374 | (backward-delete-char 1) | ?\)
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
375 " is "
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
376 (not (message "insert type definition.")))
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
377
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
378
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
379 (define-skeleton ada-task-body
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
380 "Insert a task body, prompting for the task name."
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
381 "[task name]: "
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
382 "task body " str " is\n"
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
383 "begin\n"
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
384 > _ \n
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
385 < "end " str ";" )
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
386
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
387
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
388 (define-skeleton ada-task-spec
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
389 "Insert a task specification, prompting for the task name."
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
390 "[task name]: "
33823
d29063c1c480 (ada-template-map): Initialize and bind it to C-c t in ada-mode-map.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 32301
diff changeset
391 "task " str
23868
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
392 " (" ("[discriminant]: " str "; ") ") is\n"
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
393 > "entry " _ \n
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
394 <"end " str ";" )
49598
0d8b17d428b5 Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 47744
diff changeset
395
23868
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
396
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
397 (define-skeleton ada-get-param1
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
398 "Prompt for arguments and if any enclose them in brackets."
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
399 ()
33823
d29063c1c480 (ada-template-map): Initialize and bind it to C-c t in ada-mode-map.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 32301
diff changeset
400 ("[parameter_specification]: " str "; " ) & -2 & ")")
23868
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
401
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
402
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
403 (define-skeleton ada-get-param
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
404 "Prompt for arguments and if any enclose them in brackets."
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
405 ()
33823
d29063c1c480 (ada-template-map): Initialize and bind it to C-c t in ada-mode-map.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 32301
diff changeset
406 " ("
d29063c1c480 (ada-template-map): Initialize and bind it to C-c t in ada-mode-map.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 32301
diff changeset
407 (ada-get-param1) | -2)
23868
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
408
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
409
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
410 (define-skeleton ada-entry
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
411 "Insert a task entry, prompting for the entry name."
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
412 "[entry name]: "
33823
d29063c1c480 (ada-template-map): Initialize and bind it to C-c t in ada-mode-map.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 32301
diff changeset
413 "entry " str
23868
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
414 (ada-get-param)
33823
d29063c1c480 (ada-template-map): Initialize and bind it to C-c t in ada-mode-map.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 32301
diff changeset
415 ";" \n)
23868
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
416
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
417
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
418 (define-skeleton ada-entry-family-prompt-discriminant
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
419 "Insert a entry specification, prompting for the entry name."
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
420 "[discriminant name]: "
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
421 str)
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
422
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
423
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
424 (define-skeleton ada-entry-family
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
425 "Insert a entry specification, prompting for the entry name."
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
426 "[entry name]: "
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
427 "entry " str
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
428 " (" (ada-entry-family-prompt-discriminant) ")"
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
429 (ada-get-param)
33823
d29063c1c480 (ada-template-map): Initialize and bind it to C-c t in ada-mode-map.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 32301
diff changeset
430 ";" \n)
23868
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
431
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
432
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
433 (define-skeleton ada-select
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
434 "Insert a select block."
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
435 ()
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
436 "select\n"
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
437 > _ \n
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
438 < "end select;")
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
439
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
440
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
441 (define-skeleton ada-accept-1
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
442 "Insert a condition statement, prompting for the condition name."
33823
d29063c1c480 (ada-template-map): Initialize and bind it to C-c t in ada-mode-map.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 32301
diff changeset
443 "[condition]: "
23868
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
444 "when " str | -5 )
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
445
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
446
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
447 (define-skeleton ada-accept-2
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
448 "Insert an accept statement, prompting for the name and arguments."
33823
d29063c1c480 (ada-template-map): Initialize and bind it to C-c t in ada-mode-map.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 32301
diff changeset
449 "[accept name]: "
d29063c1c480 (ada-template-map): Initialize and bind it to C-c t in ada-mode-map.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 32301
diff changeset
450 > "accept " str
23868
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
451 (ada-get-param)
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
452 " do" \n
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
453 > _ \n
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
454 < "end " str ";" )
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
455
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
456
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
457 (define-skeleton ada-accept
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
458 "Insert an accept statement (prompt for condition, name and arguments)."
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
459 ()
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
460 > (ada-accept-1) & " =>\n"
33823
d29063c1c480 (ada-template-map): Initialize and bind it to C-c t in ada-mode-map.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 32301
diff changeset
461 (ada-accept-2))
23868
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
462
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
463
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
464 (define-skeleton ada-or-accept
73933
f047602e0a17 (ada-func-or-proc-name): Match changes to ada-procedure-start-regexp.
Juanma Barranquero <lekktu@gmail.com>
parents: 73564
diff changeset
465 "Insert an accept alternative, prompting for the condition name."
23868
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
466 ()
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
467 < "or\n"
33823
d29063c1c480 (ada-template-map): Initialize and bind it to C-c t in ada-mode-map.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 32301
diff changeset
468 (ada-accept))
23868
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
469
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
470
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
471 (define-skeleton ada-or-delay
73933
f047602e0a17 (ada-func-or-proc-name): Match changes to ada-procedure-start-regexp.
Juanma Barranquero <lekktu@gmail.com>
parents: 73564
diff changeset
472 "Insert a delay alternative, prompting for the delay value."
33823
d29063c1c480 (ada-template-map): Initialize and bind it to C-c t in ada-mode-map.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 32301
diff changeset
473 "[delay value]: "
23868
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
474 < "or\n"
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
475 > "delay " str ";")
49598
0d8b17d428b5 Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 47744
diff changeset
476
23868
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
477
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
478 (define-skeleton ada-or-terminate
73933
f047602e0a17 (ada-func-or-proc-name): Match changes to ada-procedure-start-regexp.
Juanma Barranquero <lekktu@gmail.com>
parents: 73564
diff changeset
479 "Insert a terminate alternative."
23868
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
480 ()
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
481 < "or\n"
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
482 > "terminate;")
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
483
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
484
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
485 (provide 'ada-stmt)
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
486
93975
1e3a407766b9 Fix up comment convention on the arch-tag lines.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 79717
diff changeset
487 ;; arch-tag: 94f51555-cc0e-44e5-8865-8788aae8ecd3
23868
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
488 ;;; ada-stmt.el ends here