Skip to main content

  | मौसम…

411 समाचार
Public archive edition · Attributed source reporting with original dates · AI drafts are excluded

411 REFERENCE · Wikibooks

Software Engineers Handbook/Language Dictionary/Ada

Reference material by Wikibooks contributors. This retains its source identity and is not 411 news reporting.

Ada Ada is a strongly typed Multi-paradigmed programming language suitable for embedded systems, device drivers and other forms of system programming. Type Ada is a full Multi-paradigmed programming language implementing the following paradigmen: concurrent, distributed, generic (template metaprogramming), imperative and object-oriented (class-based) programming. Execution Entry Point The procedure name of the entry point can be freely choosen. General Syntax The typical statement is completed by a semi-colon. For the assignment of b to a use: a := b ; Comments this is an inline comment. Everything after the -- is a comment. Variable Declarations Declarations can appear at the beginning of an block. Declare i as an integer: declare I : Integer ; begin program end ; Here are two ways to declare i as an integer and give it an initial value of 0: declare I : Integer := 0 ; begin program end ; Method Declaration/Implementation procedures and functions are declared by the keyword procedure or function respectively. See Ada Programming/Subprograms for details. procedure A_Test (A, B: in Integer; C: out Integer) is begin C := A + B; end A_Test; function Minimum (A, B : Integer) return Integer is begin if A <= B then return B; else return A; end if; end Minimum; Class methods are primitive operations (procedures and functions) declared in the same scope as the class record. See Ada_Programming/Object_Orientation for details. Scope Scope is declared by the use of packages which may consist of three parts: public specification (package), private specification (private) and body (package body). package Package_With_Body is type Basic_Record is private; procedure Set_A (This : in out Basic_Record; An_A : in Integer); function Get_A (This : Basic_Record) return Integer; private type Basic_Record is record A : Integer; end record ; end Package_With_Body; package body Package_With_Body is procedure Set_A (This : in out Basic_Record; An_A : in Integer) is begin This.A := An_A; end Set_A; function Get_A (This : Basic_Record) return Integer is begin return This.A; end Get_A; end Package_With_Body; See Ada_Programming/Packages for details. Conditional Statements <Describe the conditional statements in text and present range_1.adb if A < Range_Type'Last then T_IO.Put (","); else T_IO.New_Line; end if; See Ada_Programming/Control#if-else for details. Looping Statements <Describe looping statements in English and present code examples.> range_1.adb for A in Range_Type loop I_IO.Put (Item => A, Width => 3, Base => 10); if A < Range_Type'Last then T_IO.Put (","); else T_IO.New_Line; end if; end loop; See Ada Programming/Control#loops for details. Output Statements <Describe how to output Hello world! including the new-line with or without a carriage return.> hello_world_1.adb with Ada Text_IO; procedure Hello is begin Ada.Text_IO.Put_Line("Hello, world!"); end Hello; See Ada_Programming/Libraries/Ada.Text_IO for details. Error Handling/Recovery <Describe error handling and recovery. Give examples as appropriate.> See Ada_Programming/Exceptions for details. Containers The following predefined packages are now available natively within Ada (since Ada 2005): Ada.Containers.Doubly_Linked_Lists Ada.Containers.Hashed_Maps Ada.Containers.Hashed_Sets Ada.Containers.Ordered_Maps Ada.Containers.Ordered_Sets Ada.Containers.Vectors These are definite versions - indefinite versions of each area also provided. All containers are unbounded. Algorithms <List algorithms or references to lists of algorithms available natively for this language. List ways to incorporate algorithms if they are not native to the language. Or, if not available, describe that.> Garbage collection Carbage collections can be either manual or automatic - refer to your compiler handbook. If automatic collection is provided then Controlled () can deactivate atomatic collection for the named access type. For manual deallocation the package Ada Unchecked_Deallocation is used. See Ada Programming/Types/access for details. Physical Structure <Describe how the files, libararies, and parts are typically divided and arranged.> Tips <Please include tips that make it easier to switch to this language from another language.> Web References Ada Programming - 75% Apr 3, 2005 - (Index) (this wikibook is a tutorial) Books and Articles Subject: Ada programming language deep