annotate lisp/progmodes/ada-stmt.el @ 24845:87e4cdfac07b

(IT-display-table-setup): Do not remap \222 to the ASCII apostrophe, as most DOS codepages have some other glyph there.
author Eli Zaretskii <eliz@gnu.org>
date Mon, 14 Jun 1999 15:10:14 +0000
parents 8d2bb5d1416a
children 92828b88cfcc
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
23868
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1 ;;; ada-stmt.el - An extension to Ada mode for inserting statement templates.
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
2
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
3 ;; Copyright (C) 1987, 1993, 1994, 1996, 1997 Free Software Foundation, Inc.
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
4
23869
8d2bb5d1416a Update comment.
Karl Heuer <kwzh@gnu.org>
parents: 23868
diff changeset
5 ;; Authors: Daniel Pfeiffer <occitan@esperanto.org>, Markus Heritsch,
8d2bb5d1416a Update comment.
Karl Heuer <kwzh@gnu.org>
parents: 23868
diff changeset
6 ;; Rolf Ebert <ebert@waporo.muc.de>
23868
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
7 ;; Maintainer: Rolf Ebert <ebert@waporo.muc.de>
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
8 ;; Keywords: languages, ada
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
9 ;; Rolf Ebert's version: 2.26
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
10
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
11 ;;; Commentary:
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
12
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
13 ;;
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
14 ;; put the following statement in your .emacs:
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
15 ;; (require 'ada-stmt)
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
16 ;;
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
17
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
18 ;;; History:
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
19
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
20 ;; Created May 1987.
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
21 ;; Original version from V. Bowman as in ada.el of Emacs-18
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
22 ;; (borrowed heavily from Mick Jordan's Modula-2 package for GNU,
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
23 ;; as modified by Peter Robinson, Michael Schmidt, and Tom Perrine.)
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
24 ;;
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
25 ;; Sep 1993. Daniel Pfeiffer <pfeiffer@cict.fr> (DP)
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
26 ;; Introduced statement.el for smaller code and user configurability.
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
27 ;;
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
28 ;; Nov 1993. Rolf Ebert <ebert@enpc.fr> (RE) Moved the
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
29 ;; skeleton generation into this separate file. The code still is
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
30 ;; essentially written by DP
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
31 ;;
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
32 ;; Adapted Jun 1994. Markus Heritsch
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
33 ;; <Markus.Heritsch@studbox.uni-stuttgart.de> (MH)
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
34 ;; added menu bar support for templates
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
35 ;;
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
36 ;; 1994/12/02 Christian Egli <cegli@hcsd.hac.com>
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
37 ;; General cleanup and bug fixes.
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
38 ;;
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
39 ;; 1995/12/20 John Hutchison <hutchiso@epi.syr.ge.com>
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
40 ;; made it work with skeleton.el from emacs-19.30. Several
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
41 ;; enhancements and bug fixes.
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
42
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
43 ;; BUGS:
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
44 ;;;> I have the following suggestions for the function template: 1) I
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
45 ;;;> 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
46 ;;;> never want it to be called "Result" because that is nondescriptive. If you
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
47 ;;;> must define a variable, give me the ability to specify its name.
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
48 ;;;>
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
49 ;;;> 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
50 ;;;> 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
51 ;;;> to type it in?
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
52 ;;;>
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
53
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
54 ;;;It would be nice if one could configure such layout details separately
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
55 ;;;without patching the LISP code. Maybe the metalanguage used in ada-stmt.el
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
56 ;;;could be taken even further, providing the user with some nice syntax
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
57 ;;;for describing layout. Then my own hacks would survive the next
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
58 ;;;update of the package :-)
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
59
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
60
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
61 ;;; Code:
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
62
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
63 (require 'ada-mode)
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
64 (require 'skeleton)
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
65 (require 'easymenu)
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
66
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
67 (defgroup ada-stmt nil
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
68 "Extension to Ada mode for inserting statement templates"
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
69 :group 'ada)
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
70
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
71 (defcustom ada-stmt-use-debug t
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
72 "*Toggle to insert ada debug code parts."
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
73 :type 'boolean
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
74 :group 'ada-stmt)
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
75
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
76
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
77 (defcustom ada-debug-call-str "pragma Debug (%s);"
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
78 "*Debug call code to insert."
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
79 :type 'string
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
80 :group 'ada-stmt)
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
81
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
82
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
83 (defcustom ada-debug-exception-str "pragma Debug (%s);"
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
84 "*Debug exception code to insert."
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
85 :type 'string
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
86 :group 'ada-stmt)
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
87
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
88
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
89
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
90 (defun ada-func-or-proc-name ()
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
91 ;; Get the name of the current function or procedure."
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
92 (save-excursion
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
93 (let ((case-fold-search t))
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
94 (if (re-search-backward ada-procedure-start-regexp nil t)
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
95 (buffer-substring (match-beginning 2) (match-end 2))
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
96 "NAME?"))))
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 (defun ada-toggle-debugging ()
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
100 "Toggles behaviour of `ada-debug-info-insertion'."
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
101 (interactive)
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
102 (setq ada-stmt-use-debug (not ada-stmt-use-debug))
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
103 (if ada-stmt-use-debug
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
104 (message "Debugging enabled")
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
105 (message "Debugging disabled")))
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
106
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
107
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
108 (defvar ada-template-map nil
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
109 "Keymap used in Ada mode for smart template operations.")
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
110
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
111
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
112 (let ((ada-mp (make-sparse-keymap)))
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
113 (define-key ada-mp "h" 'ada-header)
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
114 ; (define-key ada-mp "p" 'ada-toggle-prompt-pseudo)
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
115 (define-key ada-mp "(" 'insert-parentheses)
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
116 (define-key ada-mp "\C-a" 'ada-array)
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
117 (define-key ada-mp "b" 'ada-exception-block)
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
118 (define-key ada-mp "d" 'ada-declare-block)
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
119 (define-key ada-mp "c" 'ada-case)
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
120 (define-key ada-mp "\C-e" 'ada-elsif)
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
121 (define-key ada-mp "e" 'ada-else)
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
122 (define-key ada-mp "\C-k" 'ada-package-spec)
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
123 (define-key ada-mp "k" 'ada-package-body)
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
124 (define-key ada-mp "\C-p" 'ada-procedure-spec)
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
125 (define-key ada-mp "\C-f" 'ada-function-spec)
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
126 (define-key ada-mp "p" 'ada-subprogram-body)
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
127 (define-key ada-mp "f" 'ada-for-loop)
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
128 (define-key ada-mp "i" 'ada-if)
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
129 (define-key ada-mp "l" 'ada-loop)
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
130 (define-key ada-mp "\C-r" 'ada-record)
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
131 (define-key ada-mp "\C-s" 'ada-subtype)
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
132 (define-key ada-mp "S" 'ada-tabsize)
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
133 (define-key ada-mp "\C-t" 'ada-task-spec)
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
134 (define-key ada-mp "t" 'ada-task-body)
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
135 (define-key ada-mp "\C-y" 'ada-type)
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
136 (define-key ada-mp "\C-v" 'ada-private)
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
137 (define-key ada-mp "u" 'ada-use)
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
138 (define-key ada-mp "\C-u" 'ada-with)
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
139 (define-key ada-mp "\C-w" 'ada-when)
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
140 (define-key ada-mp "w" 'ada-while-loop)
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
141 (define-key ada-mp "\C-x" 'ada-exception)
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
142 (define-key ada-mp "x" 'ada-exit)
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
143 (setq ada-template-map ada-mp))
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 ;; Place the templates into Ada Mode. They may be inserted under any key.
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
147 ;; C-c C-t will be the default. If you use templates alot, you
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
148 ;; may want to consider moving the binding to another key in your .emacs
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
149 ;; file. Be sure to (require 'ada-stmt) first.
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
150 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
151 ;(define-key ada-mode-map "\C-ct" ada-template-map)
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
152 (define-key ada-mode-map "\C-c\C-t" ada-template-map)
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
153
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
154 ;;; ---- statement skeletons ------------------------------------------
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
155
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
156 (define-skeleton ada-array
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
157 "Insert array type definition. Uses the minibuffer to prompt
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
158 for component type and index subtypes."
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
159 ()
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
160 "array (" ("index definition: " str ", " ) -2 ") of " _ ?\;)
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
161
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
162
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
163 (define-skeleton ada-case
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
164 "Build skeleton case statement, prompting for the selector expression.
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
165 Also builds the first when clause."
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
166 "[selector expression]: "
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
167 "case " str " is" \n
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
168 > "when " ("discrete choice: " str " | ") -3 " =>" \n
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
169 > _ \n
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
170 < < "end case;")
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
171
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
172
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
173 (define-skeleton ada-when
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
174 "Start a case statement alternative with a when clause."
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
175 ()
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
176 < "when " ("discrete choice: " str " | ") -3 " =>" \n
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
177 >)
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
178
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
179
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
180 (define-skeleton ada-declare-block
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
181 "Insert a block with a declare part.
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
182 Indent for the first declaration."
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
183 "[block name]: "
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
184 < str & ?: & \n
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
185 > "declare" \n
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
186 > _ \n
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
187 < "begin" \n
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
188 > \n
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
189 < "end " str | -1 ?\;)
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
190
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
191
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
192 (define-skeleton ada-exception-block
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
193 "Insert a block with an exception part.
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
194 Indent for the first line of code."
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
195 "[block name]: "
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
196 < str & ?: & \n
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
197 > "begin" \n
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
198 > _ \n
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
199 < "exception" \n
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
200 > \n
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
201 < "end " str | -1 ?\;)
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
202
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
203
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
204 (define-skeleton ada-exception
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
205 "Insert an indented exception part into a block."
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
206 ()
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
207 < "exception" \n
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
208 >)
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
209
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
210
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
211 (define-skeleton ada-exit-1
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
212 "Insert then exit condition of the exit statement, prompting for condition."
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
213 "[exit condition]: "
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
214 "when " str | -5)
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
215
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
216
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
217 (define-skeleton ada-exit
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
218 "Insert an exit statement, prompting for loop name and condition."
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
219 "[name of loop to exit]: "
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
220 "exit " str & ?\
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
221 (ada-exit-1)
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
222 | -1 ?\;)
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
223
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
224
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
225 (defun ada-header ()
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
226 "Insert a descriptive header at the top of the file."
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
227 (interactive "*")
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
228 (save-excursion
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
229 (goto-char (point-min))
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
230 (if (fboundp 'make-header)
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
231 (make-header)
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
232 (ada-header-tmpl))))
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
233
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
234
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
235 (define-skeleton ada-header-tmpl
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
236 "Insert a comment block containing the module title, author, etc."
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
237 "[Description]: "
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
238 "-- -*- Mode: Ada -*-"
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
239 "\n-- Filename : " (buffer-name)
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
240 "\n-- Description : " str
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
241 "\n-- Author : " (user-full-name)
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
242 "\n-- Created On : " (current-time-string)
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
243 "\n-- Last Modified By: ."
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
244 "\n-- Last Modified On: ."
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
245 "\n-- Update Count : 0"
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
246 "\n-- Status : Unknown, Use with caution!"
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
247 "\n")
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
248
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
249
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
250 (define-skeleton ada-display-comment
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
251 "Inserts three comment lines, making a display comment."
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
252 ()
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
253 "--\n-- " _ "\n--")
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
254
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
255
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
256 (define-skeleton ada-if
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
257 "Insert skeleton if statment, prompting for a boolean-expression."
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
258 "[condition]: "
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
259 "if " str " then" \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 if;")
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-elsif
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
265 "Add an elsif clause to an if statement,
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
266 prompting for the boolean-expression."
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
267 "[condition]: "
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
268 < "elsif " str " then" \n
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
269 >)
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-else
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
273 "Add an else clause inside an if-then-end-if clause."
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
274 ()
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
275 < "else" \n
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
276 >)
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
277
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
278
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
279 (define-skeleton ada-loop
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
280 "Insert a skeleton loop statement. The exit statement is added by hand."
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
281 "[loop name]: "
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
282 < str & ?: & \n
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
283 > "loop" \n
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
284 > _ \n
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
285 < "end loop " str | -1 ?\;)
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-for-loop-prompt-variable
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
289 "Prompt for the loop variable."
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
290 "[loop variable]: "
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-for-loop-prompt-range
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
295 "Prompt for the loop range."
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
296 "[loop range]: "
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
297 str)
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
298
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
299
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
300 (define-skeleton ada-for-loop
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
301 "Build a skeleton for-loop statement, prompting for the loop parameters."
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
302 "[loop name]: "
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
303 < str & ?: & \n
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
304 > "for "
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
305 (ada-for-loop-prompt-variable)
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
306 " in "
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
307 (ada-for-loop-prompt-range)
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
308 " loop" \n
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 < "end loop " str | -1 ?\;)
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
311
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
312
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
313 (define-skeleton ada-while-loop-prompt-entry-condition
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
314 "Prompt for the loop entry condition."
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
315 "[entry condition]: "
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
316 str)
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
317
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
318
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
319 (define-skeleton ada-while-loop
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
320 "Insert a skeleton while loop statement."
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
321 "[loop name]: "
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
322 < str & ?: & \n
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
323 > "while "
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
324 (ada-while-loop-prompt-entry-condition)
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
325 " loop" \n
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
326 > _ \n
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
327 < "end loop " str | -1 ?\;)
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
328
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
329
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
330 (define-skeleton ada-package-spec
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
331 "Insert a skeleton package specification."
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
332 "[package name]: "
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
333 "package " str " is" \n
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
334 > _ \n
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
335 < "end " str ?\;)
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
336
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
337
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
338 (define-skeleton ada-package-body
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
339 "Insert a skeleton package body -- includes a begin statement."
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
340 "[package name]: "
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
341 "package body " str " is" \n
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
342 > _ \n
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
343 ; < "begin" \n
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
344 < "end " str ?\;)
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
345
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
346
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
347 (define-skeleton ada-private
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
348 "Undent and start a private section of a package spec. Reindent."
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
349 ()
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
350 < "private" \n
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
351 >)
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
352
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-function-spec-prompt-return
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
355 "Prompts for function result type."
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
356 "[result type]: "
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
357 str)
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
358
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
359
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
360 (define-skeleton ada-function-spec
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
361 "Insert a function specification. Prompts for name and arguments."
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
362 "[function name]: "
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
363 "function " str
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
364 " (" ("[parameter_specification]: " str "; " ) -2 ")"
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
365 " return "
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
366 (ada-function-spec-prompt-return)
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
367 ";" \n )
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
368
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
369
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
370 (define-skeleton ada-procedure-spec
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
371 "Insert a procedure specification, prompting for its name and arguments."
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
372 "[procedure name]: "
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
373 "procedure " str
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
374 " (" ("[parameter_specification]: " str "; " ) -2 ")"
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
375 ";" \n )
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
376
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
377
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
378 (define-skeleton ada-subprogram-body
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
379 "Insert frame for subprogram body.
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
380 Invoke right after `ada-function-spec' or `ada-procedure-spec'."
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
381 ()
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
382 ;; Remove `;' from subprogram decl
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
383 (save-excursion
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
384 (ada-search-ignore-string-comment ada-subprog-start-re t nil)
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
385 (ada-search-ignore-string-comment "(" nil nil t)
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
386 (backward-char 1)
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
387 (forward-sexp 1)
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
388 (if (looking-at ";")
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
389 (delete-char 1)))
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
390 < "is" \n
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
391 > _ \n
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
392 < "begin" \n
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
393 > (if ada-stmt-use-debug
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
394 (format ada-debug-call-str (ada-func-or-proc-name))) \n
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
395 > \n
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
396 < (if ada-stmt-use-debug
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
397 "exception") & \n
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
398 > (if ada-stmt-use-debug
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
399 "when others =>") & \n
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
400 > (if ada-stmt-use-debug
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
401 (format ada-debug-exception-str (ada-func-or-proc-name))) \n
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
402 < < "end "
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
403 (ada-func-or-proc-name)
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
404 ?\;)
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
405
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
406
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
407 (define-skeleton ada-separate
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
408 "Finish a body stub with `separate'."
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
409 ()
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
410 > "separate;" \n
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
411 <)
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
412
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
413
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
414 ;(define-skeleton ada-with
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
415 ; "Inserts a with clause, prompting for the list of units depended upon."
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
416 ; "[list of units depended upon]: "
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
417 ; "with " str ?\;)
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
418
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
419 ;(define-skeleton ada-use
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
420 ; "Inserts a use clause, prompting for the list of packages used."
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
421 ; "[list of packages used]: "
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
422 ; "use " str ?\;)
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
423
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
424
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
425 (define-skeleton ada-record
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
426 "Insert a skeleton record type declaration."
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
427 ()
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
428 "record" \n
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
429 > _ \n
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
430 < "end record;")
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-subtype
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
434 "Start insertion of a subtype declaration, prompting for the subtype name."
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
435 "[subtype name]: "
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
436 "subtype " str " is " _ ?\;
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
437 (not (message "insert subtype indication.")))
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
438
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
439
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
440 (define-skeleton ada-type
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
441 "Start insertion of a type declaration, prompting for the type name."
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
442 "[type name]: "
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
443 "type " str ?\(
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
444 ("[discriminant specs]: " str " ")
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
445 | (backward-delete-char 1) | ?\)
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
446 " is "
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
447 (not (message "insert type definition.")))
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
448
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
449
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
450 (define-skeleton ada-task-body
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
451 "Insert a task body, prompting for the task name."
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
452 "[task name]: "
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
453 "task body " str " is\n"
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
454 "begin\n"
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
455 > _ \n
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
456 < "end " str ";" )
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
457
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
458
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
459 (define-skeleton ada-task-spec
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
460 "Insert a task specification, prompting for the task name."
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
461 "[task name]: "
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
462 "task " str
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
463 " (" ("[discriminant]: " str "; ") ") is\n"
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
464 > "entry " _ \n
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
465 <"end " str ";" )
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
466
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
467
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
468 (define-skeleton ada-get-param1
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
469 "Prompt for arguments and if any enclose them in brackets."
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
470 ()
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
471 ("[parameter_specification]: " str "; " ) & -2 & ")"
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
472 )
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
473
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
474
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
475 (define-skeleton ada-get-param
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
476 "Prompt for arguments and if any enclose them in brackets."
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
477 ()
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
478 " ("
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
479 (ada-get-param1) | -2
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
480 )
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
481
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
482
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
483 (define-skeleton ada-entry
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
484 "Insert a task entry, prompting for the entry name."
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
485 "[entry name]: "
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
486 "entry " str
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
487 (ada-get-param)
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
488 ";" \n
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
489 ; (ada-indent-current)
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
490 )
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
491
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
492
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
493 (define-skeleton ada-entry-family-prompt-discriminant
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
494 "Insert a entry specification, prompting for the entry name."
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
495 "[discriminant name]: "
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
496 str)
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
497
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
498
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
499 (define-skeleton ada-entry-family
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
500 "Insert a entry specification, prompting for the entry name."
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
501 "[entry name]: "
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
502 "entry " str
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
503 " (" (ada-entry-family-prompt-discriminant) ")"
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
504 (ada-get-param)
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
505 ";" \n
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
506 ;(ada-indent-current)
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
507 )
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
508
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
509
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
510 (define-skeleton ada-select
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
511 "Insert a select block."
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
512 ()
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
513 "select\n"
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
514 > _ \n
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
515 < "end select;")
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
516
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
517
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
518 (define-skeleton ada-accept-1
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
519 "Insert a condition statement, prompting for the condition name."
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
520 "[condition]: "
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
521 "when " str | -5 )
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
522
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
523
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
524 (define-skeleton ada-accept-2
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
525 "Insert an accept statement, prompting for the name and arguments."
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
526 "[accept name]: "
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
527 > "accept " str
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
528 (ada-get-param)
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
529 ; " (" ("[parameter_specification]: " str "; ") -2 ")"
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
530 " do" \n
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
531 > _ \n
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
532 < "end " str ";" )
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
533
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
534
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
535 (define-skeleton ada-accept
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
536 "Insert an accept statement (prompt for condition, name and arguments)."
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
537 ()
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
538 > (ada-accept-1) & " =>\n"
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
539 (ada-accept-2)
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
540 )
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
541
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
542
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
543 (define-skeleton ada-or-accept
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
544 "Insert a or statement, prompting for the condition name."
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
545 ()
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
546 < "or\n"
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
547 (ada-accept)
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
548 )
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
549
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
550
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
551 (define-skeleton ada-or-delay
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
552 "Insert a delay statement, prompting for the delay value."
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
553 "[delay value]: "
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
554 < "or\n"
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
555 > "delay " str ";")
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
556
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
557
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
558 (define-skeleton ada-or-terminate
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
559 "Insert a terminate statement."
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
560 ()
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
561 < "or\n"
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
562 > "terminate;")
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
563
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
564
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
565 ;; ----
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
566 (defun ada-adjust-case-skeleton ()
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
567 "Adjusts the case of the text inserted by a skeleton."
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
568 (save-excursion
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
569 (let ((aa-end (point)))
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
570 (ada-adjust-case-region
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
571 (progn (goto-char beg) (forward-word -1) (point))
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
572 (goto-char aa-end))
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
573 )))
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
574
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
575
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
576 ;; ---- add menu 'Statements' in Ada mode (MH)
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
577 (defun ada-add-statement-menu ()
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
578 "Adds the menu 'Statements' to the menu bar in Ada mode."
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
579 (easy-menu-define ada-stmt-menu ada-mode-map
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
580 "Menu for statement templates in Ada."
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
581 '("Statements"
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
582 ; ["Toggle Prompt/Pseudo Code" toggle-skeleton-no-prompt t]
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
583 ["Toggle: Debugging" ada-toggle-debugging t]
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
584 ; ["-------" nil nil]
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
585 ["Header" (ada-header) t]
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
586 ["-------" nil nil]
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
587 ["package Body" (ada-package-body) t]
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
588 ["package Spec" (ada-package-spec) t]
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
589 ["function Spec" (ada-function-spec) t]
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
590 ["procedure Spec" (ada-procedure-spec) t]
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
591 ["proc/func Body" (ada-subprogram-body) t]
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
592 ["task Body" (ada-task-body) t]
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
593 ["task Spec" (ada-task-spec) t]
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
594 ["declare Block" (ada-declare-block) t]
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
595 ["exception Block" (ada-exception-block) t]
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
596 ["------" nil nil]
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
597 ["entry" (ada-entry) t]
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
598 ["entry family" (ada-entry-family) t]
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
599 ["select" (ada-select) t]
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
600 ["accept" (ada-accept) t]
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
601 ["or accept" (ada-or-accept) t]
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
602 ["or delay" (ada-or-delay) t]
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
603 ["or terminate" (ada-or-terminate) t]
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
604 ["-----" nil nil]
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
605 ["type" (ada-type) t]
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
606 ["private" (ada-private) t]
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
607 ["subtype" (ada-subtype) t]
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
608 ["record" (ada-record) t]
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
609 ["array" (ada-array) t]
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
610 ["------" nil nil]
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
611 ["if" (ada-if) t]
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
612 ["else" (ada-else) t]
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
613 ["elsif" (ada-elsif) t]
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
614 ["case" (ada-case) t]
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
615 ["-----" nil nil]
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
616 ["while Loop" (ada-while-loop) t]
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
617 ["for Loop" (ada-for-loop) t]
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
618 ["loop" (ada-loop) t]
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
619 ["---" nil nil]
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
620 ["exception" (ada-exception) t]
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
621 ["exit" (ada-exit) t]
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
622 ["when" (ada-when) t]
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
623 ))
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
624 (if (ada-xemacs)
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
625 (progn
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
626 (easy-menu-add ada-stmt-menu)
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
627 (setq mode-popup-menu (cons "Ada Mode" ada-stmt-menu)))))
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
628
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
629
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
630
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
631 (add-hook 'ada-mode-hook 'ada-add-statement-menu)
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
632 (add-hook 'ada-mode-hook '(lambda ()
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
633 (setq skeleton-further-elements
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
634 '((< '(backward-delete-char-untabify
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
635 (min ada-indent (current-column))))))
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
636 (add-hook 'skeleton-end-hook
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
637 'ada-adjust-case-skeleton)))
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
638
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
639 (provide 'ada-stmt)
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
640
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
641 ;;; ada-stmt.el ends here