!standard 2.8(29) 05-05-18 AI95-00433/01 !standard 3.2.2(15) !standard 3.3.1(27) !standard 3.3.1(29) !standard 3.3.1(31) !standard 3.3.1(33) !standard 3.6(30) !standard 3.7(37) !standard 3.9.2(14) !standard 3.10(22) !standard 3.10.1(19) !standard 3.10.1(20) !standard 3.10.1(21) !standard 4.3.3(43) !standard 6.5.1(9) !standard 6.7(4) !standard 9.1(24) !standard 9.11(3) !standard 9.11(6) !standard 9.11(7) !standard 9.11(8) !standard 9.11(9) !standard 9.11(10) !standard 10.1.2(24) !standard 11.3(6) !standard 12.5.5(5) !standard 12.6(18) !standard 12.7(11) !class amendment 05-05-18 !status Amendment 200Y 05-05-18 !status work item 05-05-18 !status received 05-05-18 !priority High !difficulty Easy !subject Examples in the RM !summary (See proposal.) !problem The examples in the RM must be updated to reflect the new language. !proposal Tuck did the examples in a stream-of-consciousness manner, and Pascal got the short stick to write an AI. !wording (See corrigendum.) !discussion (See proposal.) !example An example for examples? Get real! !corrigendum 2.8(29) @drepl @xcode<@b List(Off); @ft<@i<-- turn off listing generation>> @b Optimize(Off); @ft<@i<-- turn off optional optimizations>> @b Inline(Set_Mask); @ft<@i<-- generate code for Set_Mask inline>> @b Suppress(Range_Check, On =@> Index); @ft<@i<-- turn off range checking on Index>>> @dby @xcode<@b List(Off); @ft<@i<-- turn off listing generation>> @b Optimize(Off); @ft<@i<-- turn off optional optimizations>> @b Inline(Set_Mask); @ft<@i<-- generate code for Set_Mask inline>> @b Import(C, Put_Char, External_Name =@> "putchar"); @ft<@i<-- import C putchar function>>> !corrigendum 3.2.2(15) @drepl @xcode<@b Rainbow @b Color @b Red .. Blue; @ft<@i<-- see 3.2.1>> @b Red_Blue @b Rainbow; @b Int @b Integer; @b Small_Int @b Integer @b -10 .. 10; @b Up_To_K @b Column @b 1 .. K; @ft<@i<-- see 3.2.1>> @b Square @b Matrix(1 .. 10, 1 .. 10); @ft<@i<-- see 3.6>> @b Male @b Person(Sex =@> M); @ft<@i<-- see 3.10.1>>> @dby @xcode<@b Rainbow @b Color @b Red .. Blue; @ft<@i<-- see 3.2.1>> @b Red_Blue @b Rainbow; @b Int @b Integer; @b Small_Int @b Integer @b -10 .. 10; @b Up_To_K @b Column @b 1 .. K; @ft<@i<-- see 3.2.1>> @b Square @b Matrix(1 .. 10, 1 .. 10); @ft<@i<-- see 3.6>> @b Male @b Person(Sex =@> M); @ft<@i<-- see 3.10.1>> @b Binop_Ref @b Binop_Ptr; @ft<@i<-- see 3.10>>> !corrigendum 3.3.1(27) @drepl @xcode Person(Sex =@> M); @ft<@i<-- see 3.10.1>>> @dby @xcode Person_Name := @b Person(Sex =@> M); @ft<@i<-- see 3.10.1>>> !corrigendum 3.3.1(29) @drepl @xcode Person(Sex =@> M); Paul : Person_Name := @b Person(Sex =@> M);> @dby @xcode Person_Name := @b Person(Sex =@> M); Paul : @b Person_Name := @b Person(Sex =@> M);> !corrigendum 3.3.1(31) @drepl @xcode 0 .. 10_000 := 0; Sorted : Boolean := False; Color_Table : @b(1 .. Max) @b Color; Option : Bit_Vector(1 .. 10) := (@b =@> True); Hello : @b String := "Hi, world.";> @dby @xcode 0 .. 10_000 := 0; Sorted : Boolean := False; Color_Table : @b(1 .. Max) @b Color; Option : Bit_Vector(1 .. 10) := (@b =@> True); Hello : @b String := "Hi, world.";> !corrigendum 3.3.1(33) @drepl @xcode Integer := 10_000; Low_Limit : @b Integer := Limit/10; Tolerance : @b Real := Dispersion(1.15);> @dby @xcode Integer := 10_000; Low_Limit : @b Integer := Limit/10; Tolerance : @b Real := Dispersion(1.15); Hello_Msg : @b String := Hello'Access; @ft<@i<-- see 3.10.2>>> !corrigendum 3.6(30) @drepl @xcode(1 .. 80, 1 .. 100) @b Boolean; Mix : @b(Color @b Red .. Green) @b Boolean; Page : @b(Positive @b <@>) @b Line := @ft<@i<-- an array of arrays>> (1 | 50 =@> Line'(1 | Line'Last =@> '+', @b =@> '-'), @ft<@i<-- see 4.3.3>> 2 .. 49 =@> Line'(1 | Line'Last =@> '|', @b =@> ' ')); @ft<@i<-- Page is constrained by its initial value to (1..50)>>> @dby @xcode(1 .. 80, 1 .. 100) @b Boolean; Mix : @b(Color @b Red .. Green) @b Boolean; Msg_Table : @b(Error_Code) @b String := (Too_Big =@> @b String'("Result too big"), Too_Small =@> ...); Page : @b(Positive @b <@>) @b Line := @ft<@i<-- an array of arrays>> (1 | 50 =@> Line'(1 | Line'Last =@> '+', @b =@> '-'), @ft<@i<-- see 4.3.3>> 2 .. 49 =@> Line'(1 | Line'Last =@> '|', @b =@> ' ')); @ft<@i<-- Page is constrained by its initial value to (1..50)>>> !corrigendum 3.7(37) @drepl @xcode<@b Item(Number : Positive) @b Content : Integer; @ft<@i<-- no component depends on the discriminant>> @b;> @dby @xcode<@b Worker(Prio : System.Priority; Buf : @b Buffer) @b @ft<@i<-- discriminants used to parameterize the task type (see 9.1)>> @b Priority(Prio); @ft<@i<-- see D.1>> @b Fill; @b Drain; @b Worker;> !corrigendum 3.9.2(14) @dinsa Nonlimited interface types have predefined nonabstract equality operators. These may be overridden with user-defined abstract equality operators. Such operators will then require an explicit overriding for any nonabstract descendant of the interface. @dinss @i<@s8> @i @xcode<@b Queue @b; @b Append(Q : @b Queue; Elem : @b Element) @b; @b Remove_First(Q : @b Queue; Elem : @b Element) @b; @b Cur_Count(Q : @b Queue) @b Natural @b; @b Max_Count(Q : @b Queue) @b Natural @b; Queue_Error : @b; @ft<@i<-- Append raises Queue_Error if Count(Q) = Max_Count(Q) -- Remove_First raises Queue_Error if Count(Q) = 0>> @b Synchronized_Queue @b Queue; @ft<@i<-- see 9.11>> @b Append_Wait(Q : @b Queue; Elem : @b Element) @b; @b Remove_First_Wait(Q : @b Queue; Elem : @b Element) @b; ... @b Transfer(From : @b Queue'Class; To : @b Queue'Class; Number : @b Natural := 1) is Elem : Element; @b I @b 1..Number @b Remove_First(From, Elem); Append(To, Elem); @b; @b Transfer;> The Queue interface has four dispatching operations, Append, Remove_First, Cur_Count, and Max_Count. The body of a class-wide operation, Transfer is also shown. Every non-abstract extension of Queue must provide implementations for at least its four dispatching operations. Any object of a type derived from Queue may be passed to Transfer, as either the From or the To operand. The two operands need not be of the same type in any given call. The Synchronized_Queue interface inherits the four dispatching operations from Queue, and adds two additional dispatching operations, which wait if necessary rather than raising the Queue_Error exception. This synchronized interface may only be implemented by a task or protected type, and as such ensures safe concurrent access. @i @xcode<@b Serial_Device @b; @ft<@i<-- see 9.1>> @b Read (Dev : @b Serial_Device; C : @b Character) @b; @b Write(Dev : @b Serial_Device; C : @b Character) @b;> The Serial_Device interface has two dispatching operations which are intended to be implemented using task entries (see 9.1). !corrigendum 3.10(22) @drepl @xcode<@b Peripheral_Ref @b Peripheral; @ft<@i<-- see 3.8.1>> @b Binop_Ptr @b Binary_Operation'Class; @ft<@i<-- general access-to-class-wide, see 3.9.1>>> @dby @xcode<@b Peripheral_Ref @b Peripheral; @ft<@i<-- see 3.8.1>> @b Binop_Ptr @b Binary_Operation'Class; @ft<@i<-- general access-to-class-wide, see 3.9.1>>> !corrigendum 3.10.1(19) @drepl @xcode<@b Person(<@>); @ft<@i<-- incomplete type declaration>> @b Car; @ft<@i<-- incomplete type declaration>>> @dby @xcode<@b Person(<@>); @ft<@i<-- incomplete type declaration>> @b Car @b; @ft<@i<-- incomplete type declaration>>> !corrigendum 3.10.1(20) @drepl @xcode<@b Person_Name @b Person; @b Car_Name @b Car;> @dby @xcode<@b Person_Name @b Person; @b Car_Name @b Car'Class;> !corrigendum 3.10.1(21) @drepl @xcode<@b Car @b @b Number : Integer; Owner : Person_Name; @b;> @dby @xcode<@b Car @b @b Number : Integer; Owner : Person_Name; @b;> !corrigendum 4.3.3(43) @dinsa @xcode True); @ft<@i<-- see 3.6>> E : Bit_Vector(M .. N) := (@b =@> True); F : String(1 .. 1) := (1 =@> 'F'); @ft<@i<-- a one component aggregate: same as "F">>> @dinss @i @xcode 50, Pos =@> 1, Value =@> String'('x', @b =@> <@>)) @ft<@i<-- see 3.7>>> !corrigendum 6.5.1(9) @dinsa If the body of a non-returning procedure completes normally, Program_Error is raised at the point of the call. @dinss @i<@s8> @xcode<@b Fail(Msg : String); @ft<@i<-- raises Fatal_Error exception>> @b No_Return(Fail); @ft<@i<-- Inform compiler and reader that procedure never returns normally>>> !corrigendum 6.7(4) @dinsa The execution of a null procedure is invoked by a subprogram call. For the execution of a subprogram call on a null procedure, the execution of the @fa has no effect. @dinst @i<@s8> @xcode<@b Simplify(Expr : @b Expression) @b; @ft<@i<-- see 3.9 -- By default, Simplify does nothing, but it may be overridden in extensions of Expression>>> !corrigendum 9.1(24) @drepl @xcode<@b Keyboard_Driver(ID : Keyboard_ID := New_ID) @b @b Read (C : @b Character); @b Write(C : @b Character); @b Keyboard_Driver;> @dby @xcode<@b Keyboard_Driver(ID : Keyboard_ID := New_ID) @b @b Serial_Device @b @ft<@i<-- see 3.9>> @b Read (C : @b Character); @b Write(C : @b Character); @b Keyboard_Driver;> !corrigendum 9.11(3) @drepl @xcode<@b Producer @b Char : Character; @b ... @ft<@i<-- produce the next character Char>> Buffer.Write(Char); @b Char = ASCII.EOT; @b Producer;> @dby @xcode<@b Producer @b Elem : Element; @b ... @ft<@i<-- produce the next element>> Buffer.Append_Wait(Elem); @b Elem = EOT_Elem; @b Producer;> !corrigendum 9.11(6) @drepl @xcode<@b Consumer @b Char : Character; @b Buffer.Read(Char); @b Char = ASCII.EOT; ... @ft<@i<-- consume the character Char>> @b Consumer;> @dby @xcode<@b Consumer @b Elem : Element; @b Buffer.Remove_First_Wait(Elem); @b Elem = EOT_Elem; ... @ft<@i<-- consume the element>> @b Consumer;> !corrigendum 9.11(7) @drepl The buffer object contains an internal pool of characters managed in a round-robin fashion. The pool has two indices, an In_Index denoting the space for the next input character and an Out_Index denoting the space for the next output character. @dby The buffer object contains an internal pool of elements managed in a round-robin fashion. The pool has two indices, an In_Index denoting the space for the next input element and an Out_Index denoting the space for the next output element. The Buffer is defined as an extension of the Synchronized_Queue interface (see 3.9.4), and as such, can be passed to the Transfer class-wide operation defined for objects of a type covered by Queue'Class. !corrigendum 9.11(8) @drepl @xcode<@b Buffer @b Read (C : @b Character); @b Write(C : @b Character); @b Pool : String(1 .. 100); Count : Natural := 0; In_Index, Out_Index : Positive := 1; @b Buffer;> @dby @xcode<@b Buffer @b Synchronized_Queue @b @ft<@i<-- see 3.9.4>> @b Append_Wait (Elem : @b Element); @b Remove_First_Wait (Elem : @b Element); @b Cur_Count @b Natural; @b Max_Count @b Natural; @b Append(Elem : @b Element); @b Remove_First(Elem : @b Element); @b Pool : Element_Array(1 .. 100); Count : Natural := 0; In_Index, Out_Index : Positive := 1; @b Buffer; !corrigendum 9.11(9) @drepl @xcode<@b Buffer @b Write(C : @b Character) @b Count < Pool'Length @b Pool(In_Index) := C; In_Index := (In_Index @b Pool'Length) + 1; Count := Count + 1; @b Write;> @dby @xcode<@b Buffer @b Append_Wait (Elem : @b Element) @b Count < Pool'Length @b Append(Elem); @b Append_Wait; @b Append(Elem : @b Element) @b Count = Pool'Length @b Queue_Error @b "Buffer Full"; @ft<@i<-- see 11.3>> @b; Pool(In_Index) := Elem; In_Index := (In_Index @b Pool'Length) + 1; Count := Count + 1; @b Append;> !corrigendum 9.11(10) @drepl @xcode< @b Read(C : @b Character) @b Count @> 0 @b C := Pool(Out_Index); Out_Index := (Out_Index @b Pool'Length) + 1; Count := Count - 1; @b Read; @b Buffer;> @dby @xcode< @b Remove_First_Wait (Elem : @b Element) @b Count @> 0 @b Remove_First(Elem); @b Remove_First_Wait; @b Remove_First(Elem : @b Element) @b Count = 0 @b Queue_Error @b "Buffer Empty"; @ft<@i<-- see 11.3>> @b; Elem := Pool(Out_Index); Out_Index := (Out_Index @b Pool'Length) + 1; Count := Count - 1; @b Remove_First; @b Cur_Count @b Natural @b Buffer.Count; @b Cur_Count; @b Max_Count @b Natural @b Pool'Length; @b Max_Count; @b Buffer;> !corrigendum 10.1.2(24) @dinsa @xbullet which names an entity declared within the declarative region of the @fa.> @dinss @i<@s8> @xcode<@b Office.Departments; @ft<@i<-- types are incomplete>> @b Office.Locations; @ft<@i<-- only visible in private part>> @b Office.Employees @b @b Employee @b; @b Dept_Of(Emp : Employee) @b Departments.Department; @b Assign_Dept(Emp : @b Employee; Dept : @b Departments.Department); ... @b Employee @b Dept : @b Departments.Department; Loc : Locations.Location; ... @b; @b Office.Employees; @b Office.Employees; @b Office.Departments @b @b Department @b; @b Manager_Of(Dept : Department) @b Employees.Employee; @b Assign_Manager(Dept : @b Department; Mgr : @b Employees.Employee); ... @b Office.Departments;> The @fa may be used to support mutually dependent abstractions that are split across multiple packages. In this case, an employee is assigned to a department, and a department has a manager who is an employee. If a @fa with the reserved word @b appears on one library unit and mentions a second library unit, it provides visibility to the second library unit, but restricts that visibility to the private part and body of the first unit. The compiler checks that no use is made of the second unit in the visible part of the first unit. !corrigendum 11.3(6) @drepl @xcode<@b Ada.IO_Exceptions.Name_Error; @ft<@i<-- see A.13>>> @dby @xcode<@b Ada.IO_Exceptions.Name_Error; @ft<@i<-- see A.13>> @b Queue_Error @b "Buffer Full"; @ft<@i<-- see 9.11>>> !corrigendum 12.5.5(5) @dinsa The actual type shall be a limited, task, protected, or synchronized interface if and only if the formal type is also, respectively, a limited, task, protected, or synchronized interface. @dinss @i<@s8> @xcode<@b Managed_Task @b; @b Work_Item(<@>) @b Root_Work_Item @b; @b Server_Manager @b Server @b Managed_Task @b Start(Data : @b Work_Item); @b Server; @b Server_Manager;> This generic allows an application to establish a standard interface that all tasks need to implement so they can be managed appropriately by an application-specific scheduler. !corrigendum 12.6(18) @drepl @xcode<@b "+"(X, Y : Item) @b Item @b <@>; @b Image(X : Enum) @b String @b Enum'Image; @b Update @b Default_Update;> @dby @xcode<@b "+"(X, Y : Item) @b Item @b <@>; @b Image(X : Enum) @b String @b Enum'Image; @b Update @b Default_Update; @b Pre_Action(X : in Item) @b; @ft<@i<-- defaults to no action>> @b Write(S : @b Root_Stream_Type'Class; Desc : Descriptor) @b Descriptor'Write; @ft<@i<-- see 13.13.2>> @ft<@i<-- Dispatching operation on Descriptor with default>>> !corrigendum 12.7(11) @dinsa For the purposes of matching, if the actual instance @i is itself a formal package, then the actual parameters of @i are those specified explicitly or implicitly in the @fa for @i, plus, for those not specified, the copies of the formal parameters of the template included in the visible part of @i. @dinss @i<@s8> @i @xcode<@b Mapping_1 @b Generic_Mapping(<@>); @b Mapping_2 @b Generic_Mapping (Key_Type =@> Mapping_1.Element_Type, @b =@> <@>); @b Generic_Join @b @ft<@i<-- Provide a "join" between two mappings>> @b Key_Type @b Mapping_1.Key_Type; @b Element_Type @b Mapping_2.Element_Type; @b Lookup(Key : Key_Type) @b Element_Type; ... @b Generic_Join;> @i @xcode<@b String_Table @b Generic_Mapping(Key_Type =@> String, Element_Type =@> String_ID); @b Symbol_Table @b Generic_Mapping(Key_Type =@> String_ID, Element_Type =@> Symbol_Info); @b String_Info @b Generic_Join(Mapping_1 =@> String_Table, Mapping_2 =@> Symbol_Table); Apple_Info : @b Symbol_Info := String_Info.Lookup("Apple");> !ACATS test This one is going to be hard to test! !appendix ****************************************************************