16 Standards Enforcement
|
|
|
|
|
Online Documentation Home Page
Standards Enforcement
This chapter describes how Ada-ASSURED enforces standards.
Ada-ASSURED was originally designed to address the Ada Quality and Style
(AQ&S) guidelines published by the Software Productivity Consortium
(SPC)[Note: Ada Quality and Style: Guidelines for
Professional Programmers, Software Productivity Consortium, Herndon,
Virginia, SPC-91061-CMC, Version 02.01.01 December 1992.
Ada 95 Quality and Style: Guidelines for Professional
Programmers, Software Productivity Consortium, Herndon,
Virginia, SPC-94093-CMC, Version 01.00.10 October 1995.], which are
recommended by the Ada Joint Program Office (AJPO).
In fact, the SPC used Ada-ASSURED to format all of the examples in their
guide. However, the guidelines can be customized by individual
projects, so that more or less strict rules can be enforced.
The material on enforcement is presented in:
Levels of Enforcement
Ada-ASSURED monitors compliance with two different kinds of standard:
- language definition, and
- quality and style guidelines.
By language definition, we mean the rules of Ada as given in the
Ada Language Reference Manual (LRM). By quality and style
guidelines, we mean the rules of disciplined Ada usage as given in the
SPC guidelines or in a project's own local coding standards.
Language Definition Enforcement
Ada-ASSURED enforces language definition rules that can be checked by
static analysis of individual program units. Although, broadly
speaking, these are all issues of ``syntactic correctness'', we
distinguish between:
- syntax errors, and
- errors
based on how the mistakes are treated within Ada-ASSURED.
Syntax errors are grammatical mistakes that prevent further
formatting and analysis because the underlying structure cannot be
deciphered. The default response to a syntax error is designed to
promote its immediate correction: a bell rings or flashes, the
insertion cursor is positioned near the problem, and a notification
appears in the status pane. Typical examples are mismatched
brackets, missing semicolons, misspelled keywords, etc.
Errors are grammatical mistakes that are well-enough understood
so that the underlying structure is clearit's just wrong. The
default response to an error is designed to promote awareness of the
problem, but not immediate correction: an error message formatted as a
comment is inserted into the Ada text. The message is deleted
automatically when the error is corrected. Temporary errors may arise
when text must be edited consistently in two places. For example,
consider changing the code fragment:
procedure P
(X : in The_Type_Of_X := 0) is ...
so the mode of X is in out. Then after changing the mode,
but before deleting the initializer, the display will appear as:
procedure P
(X : in out The_Type_Of_X := 0
--ERROR-- [E2] Cannot initialize a parameter specification
--ERROR-- in this mode.
) is ...
The error message disappears as soon as the initializer is deleted:
procedure P
(X : in out The_Type_Of_X) is ...
Syntax errors can only occur in text typed by the user, or in text
inserted by a textual cut-and-paste. In contrast, constructs inserted
by a template are necessarily syntactically correct because templates
are context sensitive, i.e., a template is enabled only if its
insertion would be syntactically correct. Similarly, constructs
inserted by structural cut-and-paste are necessarily syntactically
correct because structural paste is context sensitive, i.e., it is
permitted only if the result would be syntactically correct.
Ada-ASSURED's language definition enforcement eliminates a great number
of the errors typically detected by a compiler. The remaining errors
are easily pinpointed by invoking the compiler with Ada-ASSURED's
compile command. You can navigate from a compiler error
message to the offending file and line number in a single
keystroke. See command next-error for further details.
Quality and Style Enforcement
Many guidelines, especially those relating to the visual presentation
of the program, are automatically enforced. These are described in
Section Automatically Enforced Guidelines. For other guidelines, problems are
detected, and transformations are enabled that can bring the program
into compliance.
Ada-ASSURED reports quality and style enforcement problems at two levels
of severity:
- violations, and
- indicators.
Generally speaking, violations are reported when a program construct
is found to actually violate a guideline; indicators are
warnings reported when a construct may violate a guideline, or
when a given construct warrants further scrutiny.
Quality and style enforcement is customizable by setting enforcement
parameters. Section Enforcement Parameters explains the parameters and
references the guidelines they are designed to enforce.
Views
Files can be displayed in either of two views:
The BASEVIEW displays formatted Ada code and (optionally) in-line
diagnostic messages about the Ada code. The MESSAGES view
displays just diagnostic messages and no Ada code.
It is convenient to display a buffer in two windows, one for each
view. The messages are incrementally updated as the Ada code is
edited. Views can be coupled so that selection in one view causes
selection and scrolling in the other, e.g., clicking on a diagnostic
in the MESSAGES view scrolls to the corresponding place in the
BASEVIEW. This provides a quick and easy method for non-local
navigation to incomplete or erroneous parts of the program.
The MESSAGES view contains three sorts of message:
- placeholder messages,
- standards enforcement diagnostic messages, and
- message comments.
A placeholder message warns that the Ada file contains a placeholder
that has not been filled in yet. The message has the format:
MISSING <placeholder>
where <placeholder> is one of Ada's syntactic categories.
Each standards enforcement diagnostic message is formatted as a
comment that begins with a distinctive prefix:
| --ERROR-- [Enum]
<text> | Ada language error |
| --VIOLATION-- [Vnum]
<text> | Style enforcement violation |
| --INDICATOR-- [Inum]
<text> | Style enforcement indicator |
The complete message set is documented in Section
Messages.
Clicking Select within
[Enum],
[Vnum], or
[Inum]
navigates to the appropriate page in the hypertext documentation system.
Message comments
are comments written in the Ada file that are intended for inclusion
in the MESSAGES view. If a comment begins with --c,
where c is a character in enforcement parameter Message
Comments, then the comment will appear in MESSAGES. One use for
message comments is to annotate or explain a style violation. Message
comments can also be used as bookmarks.
The view associated with a window can be changed using the
change-view command. The coupling of multiple windows
displaying a given buffer is controlled by the
auto-scroll-sets command. The selective display of the
different standards enforcement messages in the different views is
customized by the three enforcement parameters:
- Display Errors
- Display Violations
- Display Indicators
These parameters are described in Section Enforcement Parameters.
Automatically Enforced Guidelines
Many of the guidelines enforced automatically by Ada-ASSURED concern
formatting. These are described below. Cross references to the
relevant Ada Quality and Style guidelines are given by
(AQ&S n).
- Horizontal spacing (AQ&S 2.1.1)
-
Horizontal spacing is enforced to be consistent throughout the entire
object.
- Indentation (AQ&S 2.1.2)
-
Indentation and alignment of control constructs is automatic.
The amount of indentation is controlled by the indentation
editor parameter.
Continuation indentation is context sensitive. If the formatter
cannot fit a construct onto a single line, the line is split at
a meaningful position and the continuation will start at a point
that aligns vertically with the context on the previous line.
- Alignment of declarations (AQ&S 2.1.4)
-
Various declarations are aligned vertically.
Enumeration literals are optionally formatted in tables or
in a single column.
Variable and constant declarations are aligned vertically
about the colon and initialization delimiters.
Also type declarations are aligned around the is
keyword.
- Alignment of parameter modes (AQ&S 2.1.5)
-
Parameters are formatted so that the colons and the
modes are aligned vertically.
- Number of statements per line (AQ&S 2.1.8)
-
Statements are formatted one per line.
- Source code line length (AQ&S 2.1.9)
-
The formatting of objects in Ada-ASSURED usually depends on the
window width. When an object is written to a file, the line length
is specified by the editor parameter Absolute Right Margin.
- Naming begin statements (AQ&S 3.3.7)
-
The unit name is automatically repeated in a comment to mark the
begin of a package body, subroutine body, task body, or block.
- Naming end statements (AQ&S 5.1.4)
-
Simple names are automatically appended to end
keywords.
- Mode indication (AQ&S 5.2.4)
-
All procedure and entry parameters have their modes
displayed.
Enforcement Parameters
The section describes the parameters that control enforcement of
individual style guidelines. There are two classes of enforcement
parameter, described below in:
Enforcement Parameter Form
Most enforcement parameters are aggregated into a preference file
identified by Ada-ASSURED resource user0. The preference file is not in
ASCII format, but can be viewed and modified from within Ada-ASSURED.
Command set-enforcement-parameters displays the current
values of the enforcement parameters in a window. Command
use-enforcement-parameters adopts the current setting of the
parameters, e.g., after they have been edited in the parameter form
window. Command save-enforcement-parameters updates the
current preference file, provided you have write permission for it.
Command save-as can be used to save the current parameters
to a new preference file. When parameters are saved, they should
always be saved in structure format.
Enforcement-parameter files created by older versions of
Ada-ASSURED may be read into newer versions. However, in order
for the parameters to become active, the user must manually invoke
the transformation convert-to-new, followed by the command
use-enforcement-parameters.
The new version overwrites the old when the command
save-enforcement-parameters is invoked.
In the description given below, cross references to the relevant Ada
Quality and Style guidelines are given by (AQ&S n) or (AQ&S95 n).
- Display Errors
-
Controls the display of --ERROR-- messages. If the value is
Inline, they are displayed inline in BASEVIEW; if the value is
MESSAGES, they are displayed in the MESSAGES view; if the
value is Both, they are displayed in both views; if the value is
No, they are displayed in neither view.
- Display Violations
-
Controls the display of --VIOLATION-- messages. If the value is
Inline, they are displayed inline in BASEVIEW; if the value is
MESSAGES, they are displayed in the MESSAGES view; if the
value is Both, they are displayed in both views; if the value is
No, they are displayed in neither view.
- Display Indicators
-
Controls the display of --INDICATOR-- messages. If the value is
Inline, they are displayed inline in BASEVIEW; if the value is
MESSAGES, they are displayed in the MESSAGES view; if the
value is Both, they are displayed in both views; if the value is
No, they are displayed in neither view.
- Number Format Enforcement (AQ&S 3.1.2)
-
If the value is on, numbers are displayed with interleaved
underscores every third digit, e.g., 12_345.678_901E+234_5; or
every fourth digit if the number is a based literal with the base
equal to two or sixteen.
Numbers may be entered in any valid format.
- Identifier Capitalization Enforcement (AQ&S 3.1.3)
-
If the value is Upper Case (Lower Case), identifiers are
displayed with characters all in upper (lower) case. If the value is
Mixed Case, the first character of each underscore-separated
syllable of an identifier is displayed in upper case and all other
characters are displayed in lower case. If the value is off, the
identifier is displayed exactly as it was entered. Note, however,
that if files are saved in text format, the original typed
capitalization will be lost and upon re-reading the file, the
``original capitalization'' will be the format that was saved in the
file. The recommended value is Mixed Case.
Individual identifiers or syllables may be exempted from whatever rule
is in place by including them in the list of Capitalization
Exempt Syllables,
as described below.
Individual identifiers or syllables may be capitalized in a unique
manner by including them in the list of Capitalization Enforced
Syllables,
as described below.
Dollar-prefixed identifiers are subject to the same enforcement rules as
regular identifiers.
The dollar character is ignored when applying the capitalization rules.
- Pagination Marker Enforcement (AQ&S 2.1.7, 3.3.7)
-
If the value is on, procedures, packages, tasks, etc. are set off
from surrounding code by lines of dashes. The line of dashes
is introduced by the string --~. This is to distinguish
pagination markers from user-entered comments.
- Return Whitespace Enforcement (AQ&S 5.6.8)
-
If the value is on, return statements are highlighted
by being surrounded by blank lines.
- Message Comments
-
Controls the set of user comments displayed in the MESSAGES view.
The value is a string. If character c is in the string,
comments of the form --c are displayed.
- Count Preprocessor Lines
-
Ada-ASSURED automatically counts the number items in constructs such
as package bodies.
Preprocessor lines (those marked by a # in column one) can
be optionally included in these counts.
If the value of this parameter is on, preprocessor lines
are included in the total size of a construct.
The default value is on.
- Size Thresholds
-
The following parameters are pairs of numeric thresholds.
For each construct, if the size of the construct exceeds the
first threshold, a violation occurs. Otherwise, if the
size exceeds the second threshold, an indicator occurs.
- Subprogram Body Size
-
A message appears for each subprogram body containing more than
m code constructs. The default for violations is 200,
and the default for indicators is 100.
- Task Body Size
-
A message appears for each task body containing more than
m code constructs. The default for violations is 300,
and the default for indicators is 150.
- Expression Nesting Depth (AQ&S 5.6.1)
-
A message appears for expressions more deeply nested
than n. The default value for violations and indicators is 5.
- Control Nesting Depth (AQ&S 5.6.1)
-
A message appears for each control construct more
deeply nested than n. The default value for violations and
indicators is 5.
- Negative Logic Occurrences (AQ&S 5.5.4)
-
A message appears for expressions that have
more than n nested not expressions.
The default for violations is 5, and the default for indicators
is 1.
- Named Association For Instantiations (AQ&S 5.2.2)
-
The named association form is required for instantiations with more
than n items.
Transformation convert-list-to-named is
provided to bring the code into compliance.
The default value for violations is 8 and for indicators is 5.
- Named Association For Names (AQ&S 5.2.2)
-
The named association form is required for names with more than n
components. Transformation convert-list-to-named is
provided to bring the code into compliance.
The default value for violations is 8 and for indicators is 5.
- Named Association For Aggregates (AQ&S 5.6.10)
-
The named associa-tion form is required for aggregates with more than
n fields. Transformation convert-list-to-named is
provided to bring the code into compliance.
The default value for violations is 8 and for indicators is 5.
- Named Association For Pragmas (AQ&S 5.2.2)
-
The named association
form is required for pragmas with more than
n item associations. Transformation convert-list-to-named is
provided to bring the code into compliance.
The default value for violations is 8 and for indicators is 5.
- Unnamed Loops
-
Loops that have bodies containing more than n
statements must be named. The default value for violations
and indicators is 15.
- Marker Comment Loc (AQ&S 3.3.7)
-
If statements and case statements consisting of more than n lines of
code (loc) require a marker comment on their end if or
end case. The default value is 20 for violations and 10 for
indicators.
- Marker Comment Nest Level (AQ&S 3.3.7)
-
If statements and case statements consisting of more than n nesting
levels of code require a marker comment on their end if or
end case. The default value is 5 for violations and 4 for
indicators.
- Else Marker Comment Loc (AQ&S 3.3.7)
-
If statements statements consisting of more than n lines of code
(loc) require a marker comment on their else.
- Else Marker Comment Nest Level (AQ&S 3.3.7)
-
If statements statements consisting of more than n nesting levels of
code require a marker comment on their else.
- Column width thresholds
-
In a group of contiguous items that can be aligned, a single item is
usually considered an anomalous item if its width is more than two
standard deviations different from the mean of all the widths in the
group. The other items in the group are aligned according to their
maximum width, and the anomalous item is unaligned. The following
parameters allow finer control over this feature.
- Maximum Column Width
-
If set, only items that exceed the value of this parameter
are considered to be anomalous.
- Anomaly Sigmas
-
Only those items whose length differs from the mean of
all the lengths in the group by this number times the
standard deviation are considered anomalous. The default
value is 2.0.
- Goto Enforcement (AQ&S 5.6.7)
-
If the value is on, a violation message
appears next to every occurrence of a goto statement,
and to every occurrence of a label.
- Abort Enforcement (AQ&S 6.3.3)
-
If the value is on, a violation message
appears next to every occurrence of an abort statement.
- Others Handlers in Tasks Enforcement (AQ&S 6.3.4)
-
If the value is on, then others handlers are required in task
bodies.
- Nested Loop Naming Enforcement (AQ&S 5.1.1, 5.1.3)
-
If the value is on, nested loops require names
and exit statements in these loops are required to have names.
Transformation loop-name is
provided to bring the code into compliance by adding a placeholder
for a loop name.
- Block Naming Enforcement (AQ&S 5.1.2)
-
If the value is on, blocks require names.
- Anonymous Type Enforcement (AQ&S 5.3.2)
-
If the value is on, anonymous types are not permitted.
- Anonymous Task Type Enforcement (AQ&S 6.1.2, AQ&S95 6.1.3)
-
If the value is on, anonymous task types are not permitted.
- Derived Type Enforcement
-
If the value is on, a violation will be reported for each
occurrence of a derived type.
- Access Type Enforcement
-
If the value is on, a violation will be reported for
each occurrence of an access type.
- Exported Variable Enforcement (AQ&S 4.1.6, AQ&S95 4.1.7)
-
Variables may not be declared in the public part of a package.
- Exported Task Enforcement (AQ&S 4.2.4, 5.3.3)
-
If the value is on, a violation is reported for
tasks that are declared in the public part of a package.
- Exported Protected Enforcement (AQ&S 5.3.3)
-
If the value is on, a violation is reported for each occurrence
of an exported protected.
- Exported Protected Type Enforcement (AQ&S 5.3.3 AQ&S95 6.1.2)
-
If the value is on, a violation is reported for each occurrence
of an exported protected type.
- Parameter Order Enforcement
-
If the value is on, parameter declarations must be sorted
in the following order:
- in parameters without the optional initialization clause,
- in out parameters,
- out parameters,
- in parameters with the optional initialization clause
present (AQ&S 5.2.3).
Transformation order-list will sort the parameter list into the
above order.
- Single Identifier List Enforcement
-
If the value is on, only one identifier is permitted in a
declaration list. Transformation convert-to-singleton
will transform a declaration list as appropriate to bring it
into compliance.
- Separate Compilation Unit Enforcement (AQ&S 4.1.1)
-
If the value is on, only one compilation unit per file is permitted.
- Freeform Text Enforcement
-
If the value is on, a violation is reported if a region of code is
bracketed by freeform text comments.
- Aliased Object Enforcement (AQ&S95 5.4.4)
-
If the value is on, a violation is reported for each occurrence of
an aliased object.
- Columnar Enumeration Literals (AQ&S 2.1.4)
-
If the value is on, enumeration literals are printed in a single
vertical column. Note that enumeration literals are also printed this
way if they contain interleaved comments.
- Commented Identifier Enforcement
-
If the value is on, a violation is reported if comments occur
interleaved with identifiers in identifier lists.
- Align Loop Exit
-
If on, then the exit keyword in unnamed exit statements are
aligned with the corresponding loop keyword. Note that use of
this option violates the SPC guidelines.
- Align Loop Loopname
-
If on, then loop statements are formatted with a linebreak
after the loop name, and with the loop keyword aligned
with the loop name.
- Align Block Blockname
-
If on, then block statements are formatted with a linebreak
after the block name, and with the block keyword aligned
with the block name.
- Align If Then
-
If on, then if statements are formatted with a linebreak
after the conditional expression, and with the if keyword
aligned with the then keyword.
- Align While/For Loop
-
If on, then the for or while keywords are aligned
vertically with the loop keyword.
- Single Line Subprogram Declarations
-
If on, then all zero or single-parameter subprogram
declarations are prettyprinted on a single line if possible.
- Preserve Modes
-
If on, then when parameter modes are missing on parsing,
then they are not forced to be in parameters.
- Preserve Parentheses
-
If on, then instead of generating minimal parentheses
for expressions, the editor will preserve the parenthesization
as they are input.
- Blank After Is
-
If the value is on, a blank line is printed after the is
keyword of a procedure body, task body, or package body. Declarations
are always set off by blank lines, so this only affects units with no
declarations.
- Blank Before Left Paren
-
If the parameter is on, any Ada construct that contains a left
parenthesis will have a single blank before the parenthesis, except when
the parenthesis occurs in a sequence as in an expression
such as ``((1 - V) / X * 7 + 3) / 4''.
The default value of the parameter is off;
- Indentation Tabs
-
Then number of tab stops used to indent continuation lines for
aggregates. If the value is 1, the aggregate part is indented one
more tab stop than continuation lines of compound names; if the value
is 0, the aggregate is indented at the same tab stop as continuations
lines of compound names.
- Right Comment Column
-
This is used, in conjunction with Right Comment Width, to control
the appearance of comments that are to the right of other constructs.
A right comment is printed Right Comment Column columns to the
right of the current indentation, but only if there are at least
Right Comment Width columns remaining on the line. If not,
the comment is printed directly after the construct.
- Right Comment Width
-
This is used, in conjunction with Right Comment Column, to control
the appearance of comments that are to the right of other constructs.
A right comment is printed Right Comment Column columns to the
right of the current indentation, but only if there are at least
Right Comment Width columns remaining on the line. If not,
the comment is printed directly after the construct.
- Indicators For Tasks
-
If the value is on, an indicator appears for each occurrence of a
task.
- Indicators For Generics
-
If the value is on, an indicator appears for each occurrence of a
generic.
- Indicators For Dynamic Memory
-
If the value is on, an indicator appears for each use of dynamic memory.
- Indicators For Others Handlers (AQ&S 5.8.2)
-
If the value is on, an indicator appears for each occurrence of an
others handler.
- Indicators For Abort Statements (AQ&S 6.3.3, 7.4.6)
-
If the value is on,
an indicator appears for each occurrence of an abort statement.
- Indicators For Code Statements (AQ&S 7.6.3)
-
If the value is on,
an indicator appears for each occurrence of a code statement.
- Indicators For Representation Clauses (AQ&S 7.6.1)
-
If the value is on, an indicator appears for each occurrence of a
representation clause.
- Indicators For Pragmas
-
If the value is on,
an indicator appears for each occurrence of a pragma.
- Indicators For Exits
-
If the value is on, an indicator appears for each occurrence of an
exit statement.
- Violations (or Indicators) For Selected Identifiers
-
These parameters
are used to display violations (or indicators) for each occurrence of
an identifier in a particular context. For example, re-declaration of
Text_IO can be forbidden by specifying a violation (or
indicator) for occurrences of Text_IO in context
new-type-name. The possible contexts are:
any-new-name,
anywhere,
attribute,
entry&accept,
enumeration-literal,
exception-handler,
executable-code,
new-exception,
new-type-name,
object-name,
pragma,
program-unit-name,
raise-statement,
type-use,
use-clause, and
with-clause.
A regular expression can be specified to match classes of identifiers.
The regular expressions supported are exactly those of the standard
Unix tool grep. A string will not be recognized as a regular
expression unless it contains one of the following characters: $^[]*? .
Because each identifier must be matched against each
regular expression, performance will degrade in proportion to the
number of regular expressions listed.
These parameters can be used to enforce, partly or completely, the
following AQ&S guidelines:
- Abbreviations. (AQ&S 3.1.4)
-
- Unchecked conversion. (AQ&S 5.9.1, 7.6.7)
-
- Unchecked deallocation. (AQ&S 5.9.1, 7.6.6)
-
- Unchecked access. (AQ&S95 5.9.2, 7.6.6)
-
- Direct_IO and Sequential_IO. (AQ&S 5.9.7)
-
- Defensive task communication. (AQ&S 6.2.2)
-
- Attributes 'Count, 'Callable, and 'Terminated.
(AQ&S 6.2.3)
-
- Predefined Numeric Types. (AQ&S 7.2.1)
-
- Package Calendar, Type Duration, and
System.Tick. (AQ&S 7.4.3)
-
- Constraint_Error and Numeric_Error. (AQ&S 7.5.2)
-
- Implementation defined exceptions. (AQ&S 7.5.3)
-
- Use of package System. (AQ&S 7.6.2)
-
- Interfacing Foreign Languages. (AQ&S 7.6.4)
-
- Implementation-defined Pragmas and Attributes. (AQ&S 7.6.5)
-
- Use of Name and Form parameters. (AQ&S 7.7.1)
-
- Use of package Low_Level_IO. (AQ&S 7.7.4)
-
- Use of pragmas Elaborate and Priority. (AQ&S 8.4.2)
-
As delivered, the enforcement file for Ada-ASSURED does not
produce violations for any identifiers.
It does produce indicators for identifiers considered problematic by the
SPC guidelines as shown in Figure f-ind-ids.
Additional violations and indicators are delivered in the files
Ada-ASSURED/files/violations_for_identifiers
and
Ada-ASSURED/files/indicators_for_identifiers
respectively, in ASCII form.
These files represent an alternative set of guidelines, and illustrate
a method by which you may maintain identifier lists for your project.
To insert one of these files into the
enforcement parameters form, you can position the structural selection
at syntactic category enforcement_parameter_list and execute
command insert-file-structure.
| Context | Identifier |
|
anywhere | Unchecked_Conversion |
| anywhere | Unchecked_Deallocation |
| anywhere | Unchecked_Access |
| anywhere | Direct_IO |
| anywhere | Sequential_IO |
| anywhere | System |
| anywhere | Calendar |
| attribute | Count |
| attribute | Callable |
| attribute | Terminated |
| type use | Duration |
| exception handler | Program_Error |
| exception handler | Tasking_Error |
| exception handler | Constraint_Error |
| exception handler | Numeric_Error |
| executable code | Name |
| executable code | Form |
| with clause | Low_Level_IO |
| use clause | Low_Level_IO |
| pragma | Interface |
| pragma | Elaborate |
| pragma | Priority |
- Capitalization Enforced (or Exempt) Syllables (AQ&S 3.1.3)
-
These parameters control exceptions to the identifier capitalization
rule. They apply only when some form of Identifier Capitalization
Enforcement is enabled.
Application of the capitalization exceptions can be restricted to
particular contexts. The possible contexts are the following:
any-new-name,
anywhere,
attribute,
entry&accept,
enumeration-literal,
exception-handler,
executable-code,
new-exception,
new-type-name,
object-name,
pragma,
program-unit-name,
raise-statement,
type-use,
use-clause, and
with-clause.
Each identifier consists of one or more syllables separated by
underscore (_) characters.
The Capitalization Enforced Syllables list specifies syllables
with unique capitalization rules, i.e., syllables to be formatted
exactly as they appear in the list. For example, if the list contains
the syllable IO, then every occurrence of the syllable will be
printed IO regardless of how it was entered. Unmatched syllables
are capitalized according to whatever Identifier Capitalization
Enforcement is in effect. Recommended values include: IO, RPC,
and COBOL.
The Capitalization Enforcement Syllables list may not contain
regular expressions.
The Capitalization Exempt Syllables list specifies syllables
that are exempt from the capitalization rules, i.e., syllables to be
formatted exactly as they are entered. For example, if the list
contains the string ada (in any case combination), then all
occurrences of the syllable Ada will be formatted as Ada,
all occurrences of the syllable ADA will be formatted as ADA, etc. Unmatched syllables are capitalized according to whatever
Identifier Capitalization Enforcement is in effect.
The Capitalization Exempt Syllables list can contain a regular
expression. The regular expressions supported are exactly those of
the standard Unix tool grep. Characters in the regular expression
are case sensitive. To be recognized as a regular expression, one of
the special characters of regular expressions must be present. For
example, [A]da is a regular expression, but Ada is not.
Any identifier that matches a regular expression is formatted, in its
entirety, exactly as it was entered. For example, if the list
contains the regular expression ^Xm, then any identifier
that begins with the substring Xm will be formatted exactly as
it was entered, e.g., XmText. Because each identifier must be
matched against each regular expression, performance will degrade in
proportion to the number of regular expressions listed.
Enforcement Parameter Resources
A small number of enforcement parameters are associated with
individual resources. These parameters must be defined in a
resource initialization file, as they are not included among the
parameters described in Section Enforcement Parameter Form. See
Chapter Customizing an Editor for details on setting resources.
Two enforcement parameters are associated with the command
set-parameters. Is is possible to temporarily modify these
from within Ada-ASSURED, but any permanent change must be made in a
resource initialization file.
- absoluteRightMargin
-
An integer specifying the value of editor parameter
absolute right margin. This
defines the right margin for the prettyprinter. Lines may extend
beyond this width, but only if no appropriate place to break the line
is available.
- indentingSpaces
-
An integer specifying the value of editor parameter
indentation.
It defines the width of each indentation unit in the prettyprinter.
The unit of width is the width of a space in the largest font
specified in the style definition file.
The remaining enforcement parameters cannot be modified while
Ada-ASSURED is running. If you need to modify one of them, exit Ada-ASSURED,
edit the resource initialization file, and run Ada-ASSURED again.
- columnOneComments
-
If the value is True, then all comments that appear in column one
of the input will remain in column one. Furthermore, these comments
will not be wrapped like other comments. The default value is
False.
- commentOutString
-
The string s such that --s introduces a
commented-out section of code, such as is created by the
comment-out transformation. The default is value is ``C'',
i.e., the string containing the character C.
- dollarIdentifiers
-
If the value is True, identifiers prefixed with a dollar sign
($) are allowed. Otherwise, they are considered syntax errors.
- freeformTextBegin
-
The character c such that --c marks the beginning of
a freeform text region. Text between freeform text begin and end
markers is not formatted. The default is ``(''.
- freeformTextEnd
-
The character c such that --c marks the end of a
freeform text region. Text between freeform text begin and end
markers is not formatted. The default value is ``)''.
- parseFreeformText
-
If True, text between freeform text begin and end markers is
parsed, and if there is a syntax error, an error message is produced.
- preprocessorOk
-
If the value is True, preprocessor directives are allowed.
Otherwise, they are considered syntax errors.
- untouchableComments
-
The value is a string. If a comment begins with any character c
contained in this string, then the comment will not be reindented or
wrapped. The default value is ``|'', i.e., the string
containing the vertical bar character.
- user0
-
The full pathname of the enforcement parameter preference file.
If user0 is a directory, the file is .aa_enforcement_params
contained in that directory.
- user2
-
A string that contains characters to be recognized as comment
continuation characters. Upon parsing, a line is recognized as a
continuation of a previous comment line if the previous line ended
with a comment, and the current line begins with the string
``--'' followed by one of the characters from the user2
string. The first character of the user2 string is distinguished
in that it is used as the comment continuation character upon output.
The default value is the string containing the single character
``+''.
- warnOnLineOverflow
-
If the value is True, a warning is printed when a file that is
being written as text contains lines that cannot be printed using the
available width. The width is the value of the editor parameter absolute right margin.